﻿/*
  FDZ-KIS visual theme (FDZ-inspired):
  - dark workshop / technical surfaces
  - strong red accents
  - condensed uppercase typography for headings and labels
  - rugged card and control styling for admin + portal UI
*/

:root {
  --bg: #08090b;
  --bg-2: #0f1216;
  --surface: #14181d;
  --surface-2: #1a2027;
  --surface-3: #202833;
  --panel-edge: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.16);
  --frame-border-subtle: rgba(255, 255, 255, 0.04);
  --frame-divider-subtle: rgba(255, 255, 255, 0.03);

  --text: #f2f3f5;
  --muted: #b3bac4;
  --muted-2: #9099a6;

  --accent: #d10f1e;
  --accent-2: #ff2d37;
  --accent-dark: #8c0913;
  --accent-soft: rgba(209, 15, 30, 0.18);

  --state-open-border: rgba(255, 45, 55, 0.45);
  --state-open-bg-start: rgba(209, 15, 30, 0.2);
  --state-open-bg-end: rgba(209, 15, 30, 0.1);
  --state-open-text: #fff2f2;
  --state-open-soft: rgba(209, 15, 30, 0.18);

  --state-success-border: rgba(34, 197, 94, 0.45);
  --state-success-bg-start: rgba(34, 197, 94, 0.2);
  --state-success-bg-end: rgba(34, 197, 94, 0.1);
  --state-success-text: #f4fff8;
  --state-success-soft: rgba(34, 197, 94, 0.12);

  --success-tint: rgba(34, 197, 94, 0.1);
  --success-glow: rgba(34, 197, 94, 0.2);
  --success-dot-start: rgba(34, 197, 94, 0.9);
  --success-dot-end: rgba(22, 163, 74, 0.9);
  --success-dot-shadow: rgba(34, 197, 94, 0.32);
  --success-flash-border: var(--state-success-border);
  --success-flash-start: rgba(34, 197, 94, 0.18);
  --success-flash-end: rgba(34, 197, 94, 0.09);
  --success-flash-text: #e9ffee;

  --ok: #22c55e;
  --warning: #f59e0b;

  --shadow-lg: 0 28px 60px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 14px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 8px 18px rgba(0, 0, 0, 0.26);

  --radius: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --section-gap: 18px;

  --maxw: 1200px;

  --font-body: "Segoe UI Variable", "Trebuchet MS", "Segoe UI", Tahoma, sans-serif;
  --font-head: "Bahnschrift Condensed", "Arial Narrow", "Franklin Gothic Medium", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

html[data-theme="light"] {
  --bg: #e7e8eb;
  --bg-2: #dddee2;
  --surface: #eff0f3;
  --surface-2: #e8eaee;
  --surface-3: #dde0e6;
  --panel-edge: rgba(15, 23, 42, 0.2);
  --line: rgba(15, 23, 42, 0.22);
  --line-strong: rgba(15, 23, 42, 0.3);
  --frame-border-subtle: rgba(15, 23, 42, 0.16);
  --frame-divider-subtle: rgba(15, 23, 42, 0.1);

  --text: #161c25;
  --muted: #3e4653;
  --muted-2: #566173;

  --accent: #c90f1d;
  --accent-2: #e11d2f;
  --accent-dark: #8c0913;
  --accent-soft: rgba(201, 15, 29, 0.12);

  --state-open-border: rgba(177, 70, 78, 0.54);
  --state-open-bg-start: rgba(177, 70, 78, 0.24);
  --state-open-bg-end: rgba(177, 70, 78, 0.12);
  --state-open-text: #682a31;
  --state-open-soft: rgba(177, 70, 78, 0.16);

  --state-success-border: rgba(23, 138, 74, 0.6);
  --state-success-bg-start: rgba(23, 138, 74, 0.34);
  --state-success-bg-end: rgba(23, 138, 74, 0.17);
  --state-success-text: #0d5a32;
  --state-success-soft: rgba(23, 138, 74, 0.2);

  --success-tint: rgba(23, 138, 74, 0.16);
  --success-glow: rgba(23, 138, 74, 0.14);
  --success-dot-start: rgba(23, 138, 74, 0.86);
  --success-dot-end: rgba(15, 92, 50, 0.82);
  --success-dot-shadow: rgba(23, 138, 74, 0.22);
  --success-flash-border: var(--state-success-border);
  --success-flash-start: rgba(23, 138, 74, 0.2);
  --success-flash-end: rgba(23, 138, 74, 0.1);
  --success-flash-text: #173b28;

  --ok: #178a4a;
  --warning: #b86b00;

  --shadow-lg: 0 18px 34px rgba(20, 28, 43, 0.2);
  --shadow-md: 0 10px 22px rgba(20, 28, 43, 0.17);
  --shadow-sm: 0 6px 13px rgba(20, 28, 43, 0.13);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  scrollbar-gutter: stable;
}

html::before {
  content: "";
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  pointer-events: none;
  z-index: 30;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent), var(--accent-2), var(--accent-dark));
  box-shadow: 0 0 24px rgba(209, 15, 30, 0.45);
}

html[data-theme="light"] {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.45;
  background:
    radial-gradient(1200px 700px at 8% -8%, rgba(255, 45, 55, 0.16), transparent 58%),
    radial-gradient(900px 520px at 92% 5%, rgba(209, 15, 30, 0.13), transparent 58%),
    linear-gradient(180deg, #0a0c0f 0%, #08090b 34%, #090b0e 100%);
  position: relative;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

@supports (overflow: clip) {
  html,
  body {
    overflow-x: clip;
  }
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.028) 0,
      rgba(255, 255, 255, 0.028) 1px,
      transparent 1px,
      transparent 64px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.02) 0,
      rgba(255, 255, 255, 0.02) 1px,
      transparent 1px,
      transparent 64px
    );
  opacity: 0.45;
}

body::after {
  background:
    linear-gradient(115deg, transparent 38%, rgba(255, 45, 55, 0.05) 49%, transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 25%);
}

header.topbar,
main.container,
footer {
  position: relative;
  z-index: 1;
}

header.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background:
    linear-gradient(180deg, rgba(11, 13, 16, 0.93), rgba(11, 13, 16, 0.78));
  backdrop-filter: blur(10px);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.05);
}

header.topbar::before {
  content: none;
}

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 20px 16px;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  min-width: 0;
  flex: 1 1 auto;
}

.brand img {
  width: 248px;
  height: 88px;
  flex: 0 0 auto;
  object-fit: contain;
  object-position: left center;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  display: block;
  mix-blend-mode: normal;
  filter: brightness(0) invert(1);
}

.brand .title {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  align-items: flex-start;
  text-align: left;
  position: static;
  z-index: 1;
  pointer-events: none;
  transform: translateY(12px);
  margin-left: -12px;
}

.brand .title strong {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
  white-space: nowrap;
}

.brand .title span {
  margin-top: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: 0.03em;
  text-transform: none;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.brand .title small {
  margin-top: 0;
  color: var(--muted-2);
  font-family: var(--font-head);
  font-size: 11px;
  line-height: 1.08;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

nav.topnav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  position: relative;
  z-index: 2;
  margin-left: auto;
}

nav.topnav form {
  margin: 0;
}

@media (min-width: 761px) {
  .topbar-inner {
    display: grid;
    grid-template-columns: minmax(0, 520px) auto;
    align-items: center;
    gap: 16px;
  }

  .brand {
    width: 100%;
    min-width: 0;
    max-width: 520px;
    flex: none;
  }

  nav.topnav {
    margin-left: 0;
    flex-wrap: nowrap;
    justify-self: end;
  }
}

nav.topnav a,
nav.topnav button.topnav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  text-decoration: none;
  color: var(--muted);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease, transform 120ms ease;
}

nav.topnav button.topnav-link {
  cursor: pointer;
  appearance: none;
}

nav.topnav button.topnav-theme-toggle {
  width: 40px;
  min-width: 40px;
  padding: 0;
  gap: 0;
}

.topnav-theme-toggle-icon {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  background:
    linear-gradient(90deg, #0c1016 0 50%, #d8dde5 50% 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.topnav-theme-toggle-icon::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 3px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: #0a0d13;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
  transition: left 120ms ease, background 120ms ease, border-color 120ms ease;
}

.topnav-theme-toggle-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(100%);
  white-space: nowrap;
}

html[data-theme="light"] .topnav-theme-toggle-icon {
  border-color: rgba(15, 23, 42, 0.4);
  background:
    linear-gradient(90deg, #333c4a 0 50%, #f2f4f8 50% 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

html[data-theme="light"] .topnav-theme-toggle-icon::after {
  left: 9px;
  border-color: rgba(15, 23, 42, 0.34);
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}

nav.topnav a.topnav-icon-link {
  width: 40px;
  padding: 0;
  font-size: 17px;
  letter-spacing: 0;
}

nav.topnav a.topnav-icon-link span {
  line-height: 1;
}

nav.topnav a:hover,
nav.topnav a:focus-visible,
nav.topnav button.topnav-link:hover,
nav.topnav button.topnav-link:focus-visible,
nav.topnav a.is-active {
  color: var(--text);
  border-color: rgba(209, 15, 30, 0.38);
  background:
    linear-gradient(180deg, rgba(209, 15, 30, 0.16), rgba(209, 15, 30, 0.06)),
    rgba(255, 255, 255, 0.02);
  outline: none;
  transform: translateY(-1px);
}

html[data-theme="light"] body {
  background:
    radial-gradient(1200px 700px at 8% -8%, rgba(209, 15, 30, 0.08), transparent 58%),
    radial-gradient(900px 520px at 92% 5%, rgba(225, 29, 47, 0.05), transparent 58%),
    linear-gradient(180deg, #eceef1 0%, #e5e7eb 36%, #dcdee3 100%);
}

html[data-theme="light"] body::before {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(15, 23, 42, 0.045) 0,
      rgba(15, 23, 42, 0.045) 1px,
      transparent 1px,
      transparent 64px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(15, 23, 42, 0.03) 0,
      rgba(15, 23, 42, 0.03) 1px,
      transparent 1px,
      transparent 64px
    );
  opacity: 0.66;
}

html[data-theme="light"] body::after {
  background:
    linear-gradient(115deg, transparent 38%, rgba(225, 29, 47, 0.04) 49%, transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 25%);
}

html[data-theme="light"] header.topbar {
  border-bottom: 1px solid rgba(15, 23, 42, 0.18);
  background: linear-gradient(180deg, rgba(236, 238, 242, 0.96), rgba(227, 230, 236, 0.94));
}

html[data-theme="light"] header.topbar::before {
  content: none;
}

html[data-theme="light"] .brand img {
  filter: none;
}

html[data-theme="light"] nav.topnav a,
html[data-theme="light"] nav.topnav button.topnav-link {
  color: var(--muted);
  border-color: rgba(15, 23, 42, 0.24);
  background: linear-gradient(180deg, #eff1f4, #e2e5ea);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

html[data-theme="light"] nav.topnav a:hover,
html[data-theme="light"] nav.topnav a:focus-visible,
html[data-theme="light"] nav.topnav button.topnav-link:hover,
html[data-theme="light"] nav.topnav button.topnav-link:focus-visible,
html[data-theme="light"] nav.topnav a.is-active {
  border-color: rgba(209, 15, 30, 0.38);
  background:
    linear-gradient(180deg, rgba(209, 15, 30, 0.16), rgba(209, 15, 30, 0.06)),
    linear-gradient(180deg, #eceff3, #e4e8ee);
}

html[data-theme="light"] .hero {
  border: 1px solid rgba(15, 23, 42, 0.24);
  background:
    linear-gradient(140deg, rgba(209, 15, 30, 0.1), transparent 42%),
    linear-gradient(180deg, rgba(240, 242, 246, 0.94), rgba(230, 234, 240, 0.94)),
    linear-gradient(180deg, #eceef2, #e3e7ed);
}

html[data-theme="light"] .hero::after {
  background:
    linear-gradient(120deg, transparent 0 36%, rgba(15, 23, 42, 0.03) 36% 40%, transparent 40% 100%),
    linear-gradient(120deg, transparent 0 52%, rgba(209, 15, 30, 0.08) 52% 56%, transparent 56% 100%);
}

html[data-theme="light"] .card {
  border: 1px solid rgba(15, 23, 42, 0.24);
  background:
    linear-gradient(140deg, rgba(239, 242, 246, 0.95), rgba(228, 232, 238, 0.96)),
    linear-gradient(180deg, #edf0f4, #e3e7ed);
}

html[data-theme="light"] .card::before {
  background: linear-gradient(90deg, transparent, rgba(15, 23, 42, 0.16), transparent);
}

html[data-theme="light"] .btn {
  border-color: rgba(15, 23, 42, 0.28);
  background: linear-gradient(180deg, #eff1f4, #e2e5ea);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    0 4px 10px rgba(15, 23, 42, 0.14);
}

html[data-theme="light"] .btn:hover,
html[data-theme="light"] .btn:focus-visible {
  border-color: rgba(15, 23, 42, 0.34);
  background: linear-gradient(180deg, #f3f5f8, #dde2e9);
}

html[data-theme="light"] .icon-btn {
  border-color: rgba(15, 23, 42, 0.24);
  background: linear-gradient(180deg, #edf0f4, #e3e7ed);
}

html[data-theme="light"] .confirm-dialog::backdrop {
  background: rgba(7, 10, 16, 0.42);
}

html[data-theme="light"] .confirm-dialog-card {
  border: 1px solid rgba(15, 23, 42, 0.28);
  background: linear-gradient(180deg, rgba(237, 240, 246, 0.98), rgba(227, 231, 237, 0.98));
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea {
  border-color: rgba(15, 23, 42, 0.28);
  background: linear-gradient(180deg, rgba(238, 241, 245, 0.98), rgba(228, 232, 238, 0.94));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.56);
}

html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder {
  color: rgba(78, 87, 100, 0.72);
}

html[data-theme="light"] input:hover,
html[data-theme="light"] select:hover,
html[data-theme="light"] textarea:hover {
  border-color: rgba(15, 23, 42, 0.36);
}

html[data-theme="light"] input:focus,
html[data-theme="light"] select:focus,
html[data-theme="light"] textarea:focus {
  background: linear-gradient(180deg, rgba(242, 245, 249, 0.99), rgba(230, 235, 242, 0.95));
}

html[data-theme="light"] select {
  background-color: #e8ebf0;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%),
    linear-gradient(180deg, rgba(238, 241, 245, 0.98), rgba(228, 232, 238, 0.94));
}

html[data-theme="light"] select option,
html[data-theme="light"] select optgroup {
  color: var(--text);
  background: #ffffff;
}

html[data-theme="light"] select option:checked {
  color: var(--text);
  background: #d8dde5;
}

html[data-theme="light"] input[type="file"]::file-selector-button {
  border-color: rgba(15, 23, 42, 0.28);
  background: linear-gradient(180deg, #eef0f4, #e2e6ec);
}

html[data-theme="light"] .table {
  border-color: rgba(15, 23, 42, 0.24);
  background: rgba(233, 236, 241, 0.95);
}

html[data-theme="light"] .table th {
  background: rgba(214, 221, 231, 0.9);
  color: var(--muted-2);
}

html[data-theme="light"] .table th,
html[data-theme="light"] .table td {
  border-bottom-color: rgba(15, 23, 42, 0.2);
}

html[data-theme="light"] .table tbody tr:nth-child(even) {
  background: rgba(225, 230, 238, 0.92);
}

html[data-theme="light"] .table tbody tr:hover {
  background: rgba(211, 218, 228, 0.95);
}

html[data-theme="light"] .changelog-toggle,
html[data-theme="light"] .changelog-item {
  border-color: rgba(15, 23, 42, 0.22);
  background: rgba(233, 237, 243, 0.78);
}

html[data-theme="light"] code {
  border-color: rgba(15, 23, 42, 0.22);
  background: rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .portal-quicknav summary,
html[data-theme="light"] .portal-panel > summary,
html[data-theme="light"] .portal-section-nav a,
html[data-theme="light"] .doc-group,
html[data-theme="light"] .doc-group-mobile-item,
html[data-theme="light"] .accordion-table,
html[data-theme="light"] .accordion-table-head,
html[data-theme="light"] .accordion-row,
html[data-theme="light"] .accordion-row-body,
html[data-theme="light"] .logbook-entry,
html[data-theme="light"] .logbook-entry-body,
html[data-theme="light"] .status-item,
html[data-theme="light"] .workflow-step,
html[data-theme="light"] .portal-notification-switch-track,
html[data-theme="light"] .card.admin-index-disclosure {
  border-color: rgba(15, 23, 42, 0.22);
}

html[data-theme="light"] .portal-quicknav summary,
html[data-theme="light"] .portal-panel > summary,
html[data-theme="light"] .portal-section-nav a {
  background: rgba(223, 228, 237, 0.72);
}

html[data-theme="light"] .doc-group,
html[data-theme="light"] .doc-group-mobile-item,
html[data-theme="light"] .accordion-table,
html[data-theme="light"] .logbook-entry,
html[data-theme="light"] .status-item,
html[data-theme="light"] .workflow-step {
  background: rgba(225, 231, 239, 0.82);
}

html[data-theme="light"] .doc-group-body,
html[data-theme="light"] .logbook-entry-body,
html[data-theme="light"] .accordion-table-head,
html[data-theme="light"] .accordion-row-body {
  border-top-color: rgba(15, 23, 42, 0.16);
}

html[data-theme="light"] .doc-group > summary:hover,
html[data-theme="light"] .accordion-row summary:hover {
  background:
    linear-gradient(90deg, rgba(209, 15, 30, 0.08), transparent 70%),
    rgba(15, 23, 42, 0.04);
}

html[data-theme="light"] .event-type-select {
  border-color: rgba(15, 23, 42, 0.4);
  background:
    linear-gradient(45deg, transparent 50%, #4f5a6b 50%),
    linear-gradient(135deg, #4f5a6b 50%, transparent 50%),
    linear-gradient(180deg, rgba(231, 235, 241, 0.99), rgba(219, 225, 234, 0.97));
  color: #1a2330;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    0 1px 0 rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .event-type-select:hover {
  border-color: rgba(15, 23, 42, 0.46);
}

html[data-theme="light"] .event-type-select:focus {
  border-color: rgba(201, 15, 29, 0.6);
  box-shadow:
    0 0 0 3px rgba(201, 15, 29, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

html[data-theme="light"] .event-type-select optgroup {
  color: #4a5567;
  background: #eceff4;
}

html[data-theme="light"] .event-type-select option.event-option-secondary {
  color: #263243;
}

html[data-theme="light"] .event-type-select option.event-option-note {
  color: #334056;
}

/* Force neutral light select surfaces for all admin/portal dropdowns so no
   dark-blue control leaks through on specific browser/OS combinations. */
html[data-theme="light"] select,
html[data-theme="light"] #upload-kind,
html[data-theme="light"] .event-type-select {
  color: #1a2431 !important;
  border-color: rgba(15, 23, 42, 0.42) !important;
  background-color: #e6e9ee !important;
  background-image:
    linear-gradient(45deg, transparent 50%, #4f5a6b 50%),
    linear-gradient(135deg, #4f5a6b 50%, transparent 50%),
    linear-gradient(180deg, #eef1f5, #dbe1e8) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 1px 0 rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="light"] select:hover,
html[data-theme="light"] #upload-kind:hover,
html[data-theme="light"] .event-type-select:hover {
  border-color: rgba(15, 23, 42, 0.52) !important;
}

html[data-theme="light"] select:focus,
html[data-theme="light"] #upload-kind:focus,
html[data-theme="light"] .event-type-select:focus {
  border-color: rgba(201, 15, 29, 0.62) !important;
  box-shadow:
    0 0 0 3px rgba(201, 15, 29, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.62) !important;
}

html[data-theme="light"] select option,
html[data-theme="light"] select optgroup {
  color: #1f2b3b !important;
  background: #eceff3 !important;
}

html[data-theme="light"] select option:checked {
  color: #101722 !important;
  background: #d6dbe3 !important;
}

html[data-theme="light"] .badge {
  border-color: rgba(15, 23, 42, 0.28);
  background: rgba(220, 226, 236, 0.92);
  color: #2f3e52;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

html[data-theme="light"] .badge-accent {
  border-color: var(--state-open-border);
  background: linear-gradient(180deg, var(--state-open-bg-start), var(--state-open-bg-end));
  color: var(--state-open-text);
}

html[data-theme="light"] .badge-success {
  border-color: var(--state-success-border);
  background: linear-gradient(180deg, var(--state-success-bg-start), var(--state-success-bg-end));
  color: var(--state-success-text);
}

html[data-theme="light"] .workflow-state-badge {
  border-color: var(--state-open-border);
  background: linear-gradient(180deg, var(--state-open-bg-start), var(--state-open-bg-end));
  color: var(--state-open-text);
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-top: 12px;
  padding-right: 20px;
  padding-bottom: 36px;
  padding-left: 20px;
}

.container > .hero:first-child {
  margin-top: calc(var(--section-gap) - 12px);
}

.container > .auth-shell:first-child {
  padding-top: var(--section-gap);
}

.hero {
  position: relative;
  overflow: hidden;
  margin: 4px 0 var(--section-gap);
  padding: 22px 22px 20px;
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(140deg, rgba(209, 15, 30, 0.1), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
    linear-gradient(180deg, #12161b, #0f1317);
  box-shadow: var(--shadow-lg);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent-dark));
  box-shadow: 0 0 22px rgba(209, 15, 30, 0.35);
}

.hero::after {
  content: "";
  position: absolute;
  right: -10%;
  top: -40%;
  width: 55%;
  height: 180%;
  background:
    linear-gradient(120deg, transparent 0 36%, rgba(255, 255, 255, 0.03) 36% 40%, transparent 40% 100%),
    linear-gradient(120deg, transparent 0 52%, rgba(209, 15, 30, 0.14) 52% 56%, transparent 56% 100%);
  transform: rotate(8deg);
  opacity: 0.9;
}

.hero h1 {
  position: relative;
  margin: 0 0 8px;
  padding-right: 1rem;
  font-family: var(--font-head);
  font-size: clamp(28px, 4vw, 40px);
  line-height: 0.95;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  text-wrap: balance;
}

.hero h1::after {
  content: "";
  display: block;
  width: 72px;
  height: 3px;
  margin-top: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), rgba(255, 45, 55, 0.25));
}

.hero p {
  position: relative;
  margin: 0;
  max-width: 72ch;
  color: var(--muted);
  font-size: 15px;
}

.hero p.hero-meta-line {
  max-width: none;
}

.hero p .badge {
  vertical-align: middle;
}

.admin-index-hero,
.admin-case-hero,
.portal-dashboard-hero {
  min-height: 110px;
}

.admin-case-hero {
  margin-top: 0;
  padding-right: 74px;
}

.admin-case-export-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  width: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

main p,
main li {
  overflow-wrap: break-word;
  word-break: normal;
  -webkit-hyphens: auto;
  hyphens: auto;
}

.error-card {
  max-width: none;
}

.error-actions {
  margin-top: 14px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--section-gap);
  margin-top: var(--section-gap);
}

.grid-two-col {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.grid-no-margin {
  margin-top: 0;
}

@media (max-width: 980px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .admin-case-hero {
    padding-right: 58px;
  }

  .admin-case-export-btn {
    top: 14px;
    right: 14px;
    width: 30px;
    min-height: 30px;
    font-size: 16px;
  }
}

.card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.008) 45%),
    linear-gradient(180deg, #151a20, #11161b);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 16px;
}

.card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
}

.card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 88px;
  height: 88px;
  background: radial-gradient(circle at 100% 0%, rgba(209, 15, 30, 0.2), transparent 70%);
  pointer-events: none;
}

/* Cards with interactive popovers must not clip overlays and must keep
   decorative pseudo-elements behind actionable content. */
.card-allow-popovers {
  overflow: visible;
  isolation: isolate;
}

.card-allow-popovers::before,
.card-allow-popovers::after {
  z-index: 0;
}

.card-allow-popovers > * {
  position: relative;
  z-index: 1;
}

.card h2 {
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}

.card h2::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent-dark));
  box-shadow: 0 0 14px rgba(209, 15, 30, 0.35);
  flex: 0 0 auto;
}

p {
  margin: 0 0 12px;
}

a {
  color: inherit;
}

.muted {
  color: var(--muted);
}

.legal-license-note {
  margin-top: 8px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 6px 14px rgba(0, 0, 0, 0.22);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  outline: none;
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  border-color: rgba(255, 88, 96, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.015)),
    linear-gradient(180deg, rgba(212, 28, 40, 0.92), rgba(138, 17, 26, 0.94));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    0 6px 14px rgba(118, 10, 18, 0.24);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  border-color: rgba(255, 114, 122, 0.58);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02)),
    linear-gradient(180deg, rgba(222, 38, 50, 0.94), rgba(149, 19, 29, 0.95));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 8px 18px rgba(118, 10, 18, 0.28);
}

.btn-danger {
  border-color: rgba(255, 82, 82, 0.48);
  background:
    linear-gradient(180deg, rgba(122, 16, 24, 0.95), rgba(88, 12, 17, 0.94));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 18px rgba(95, 10, 16, 0.28);
}

.btn-danger:hover,
.btn-danger:focus-visible {
  border-color: rgba(255, 114, 114, 0.65);
  background:
    linear-gradient(180deg, rgba(146, 20, 30, 0.96), rgba(105, 14, 21, 0.95));
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012));
  color: var(--muted);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.26);
  color: var(--text);
  outline: none;
}

.icon-btn-danger {
  border-color: rgba(255, 82, 82, 0.3);
  color: rgba(255, 160, 160, 0.92);
  background:
    linear-gradient(180deg, rgba(122, 16, 24, 0.5), rgba(88, 12, 17, 0.42));
}

.icon-btn-danger:hover,
.icon-btn-danger:focus-visible {
  border-color: rgba(255, 114, 114, 0.62);
  color: #ffd7d7;
  background:
    linear-gradient(180deg, rgba(146, 20, 30, 0.72), rgba(105, 14, 21, 0.62));
}

.doc-delete-icon {
  position: relative;
  width: 13px;
  height: 13px;
  display: inline-block;
}

.doc-delete-icon::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 4px;
  bottom: 1px;
  border: 1.4px solid currentColor;
  border-top: none;
  border-radius: 0 0 2px 2px;
}

.doc-delete-icon::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  top: 1px;
  height: 2px;
  border: 1.4px solid currentColor;
  border-radius: 3px;
}

.confirm-dialog {
  width: min(92vw, 520px);
  max-width: 520px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text);
}

.confirm-dialog::backdrop {
  background: rgba(6, 8, 12, 0.74);
  backdrop-filter: blur(2px);
}

.confirm-dialog-card {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(23, 29, 37, 0.97), rgba(14, 18, 24, 0.98));
  box-shadow:
    0 22px 58px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 16px;
}

.confirm-dialog-title {
  margin: 0;
  font-family: var(--font-head);
  font-size: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.confirm-dialog-message {
  margin: 8px 0 0;
  line-height: 1.45;
}

.confirm-dialog-actions {
  margin-top: 14px;
  justify-content: flex-end;
}

form {
  margin: 0;
}

label {
  display: block;
  margin: 10px 0 6px;
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(6, 8, 10, 0.78), rgba(6, 8, 10, 0.62));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  outline: none;
  font: inherit;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

input::placeholder,
textarea::placeholder {
  color: rgba(179, 186, 196, 0.78);
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(255, 45, 55, 0.55);
  box-shadow:
    0 0 0 3px rgba(209, 15, 30, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
  background:
    linear-gradient(180deg, rgba(7, 9, 12, 0.88), rgba(7, 9, 12, 0.72));
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: rgba(255, 45, 55, 0.55);
  box-shadow:
    0 0 0 3px rgba(209, 15, 30, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

textarea {
  resize: vertical;
  min-height: 84px;
}

select {
  appearance: none;
  background-color: #0b1015;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%),
    linear-gradient(180deg, rgba(6, 8, 10, 0.78), rgba(6, 8, 10, 0.62));
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px),
    0 0;
  background-size: 6px 6px, 6px 6px, 100% 100%;
  background-repeat: no-repeat;
  padding-right: 34px;
}

/* Prefer dark popup colors to match the UI. Some native Windows select popups
   may still ignore parts of this styling depending on browser/OS behavior. */
select option,
select optgroup {
  color: var(--text);
  background: #121820;
}

select option:checked {
  color: #ffffff;
  background: #263142;
}

/* Option-level emphasis is a progressive enhancement. Native select popups on
   some mobile/desktop browsers may ignore these colors, but optgroup labels
   still provide the structural distinction. */
.event-type-select optgroup {
  color: var(--muted);
}

.event-type-select option.event-option-secondary {
  color: rgba(223, 230, 240, 0.82);
}

.event-type-select option.event-option-note {
  color: rgba(197, 205, 216, 0.74);
}

input[type="file"] {
  padding: 8px;
}

input[type="file"]::file-selector-button {
  margin-right: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  color: var(--text);
  padding: 8px 10px;
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(9, 11, 14, 0.42);
}

.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior-x: contain;
}

.table-scroll .table {
  min-width: 100%;
}

.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.table th {
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
}

.table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.012);
}

.table tbody tr:hover {
  background:
    linear-gradient(90deg, rgba(209, 15, 30, 0.08), transparent 55%),
    rgba(255, 255, 255, 0.012);
}

.table tr:last-child td {
  border-bottom: none;
}

.table th.table-col-actions,
.table td.table-cell-actions {
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.table-rows-middle tbody td {
  vertical-align: middle;
}

.table th.table-col-actions {
  width: 1%;
}

.admin-case-actions {
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.table-case-info {
  table-layout: fixed;
}

.table-case-info th {
  width: 142px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.table-case-info td {
  font-size: 13px;
  line-height: 1.35;
  font-weight: 500;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.badge-neutral {
  border-color: rgba(255, 255, 255, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
  color: #e2e7ef;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.badge-accent {
  border-color: var(--state-open-border);
  background:
    linear-gradient(180deg, var(--state-open-bg-start), var(--state-open-bg-end));
  color: var(--state-open-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.badge-success {
  border-color: var(--state-success-border);
  background:
    linear-gradient(180deg, var(--state-success-bg-start), var(--state-success-bg-end));
  color: var(--state-success-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.badge-danger {
  border-color: var(--state-open-border);
  background:
    linear-gradient(180deg, var(--state-open-bg-start), var(--state-open-bg-end));
  color: var(--state-open-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.flash {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--state-open-border);
  background:
    linear-gradient(180deg, var(--state-open-bg-start), var(--state-open-bg-end));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  color: var(--text);
  overflow-wrap: break-word;
  word-break: normal;
  -webkit-hyphens: auto;
  hyphens: auto;
}

.flash-inline {
  margin-top: 0;
  margin-bottom: 10px;
}

.flash-auto-dismiss {
  transition: opacity 180ms ease, transform 180ms ease, margin 180ms ease;
}

.flash-auto-dismiss.is-dismissing {
  opacity: 0;
  transform: translateY(-4px);
  margin-top: 0;
  margin-bottom: 0;
}

.flash-success {
  border-color: var(--success-flash-border);
  background:
    linear-gradient(180deg, var(--success-flash-start), var(--success-flash-end));
  color: var(--success-flash-text);
}

.changelog-toggle {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.015);
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.changelog-toggle::-webkit-details-marker {
  display: none;
}

.changelog-toggle::after {
  content: "+";
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}

.changelog-wrap[open] .changelog-toggle::after {
  content: "−";
  color: var(--text);
}

.changelog-wrap[open] .changelog-toggle {
  border-color: rgba(255, 45, 55, 0.32);
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(209, 15, 30, 0.08), transparent 72%),
    rgba(255, 255, 255, 0.02);
}

.changelog-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.changelog-item {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.012);
  padding: 10px 11px;
}

.changelog-item-title {
  margin-top: 4px;
  font-weight: 600;
  color: var(--text);
}

.changelog-item-meta {
  margin: 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  padding: 0.15em 0.4em;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.28);
}

.flash code {
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: top;
}

.flash code.portal-link-code {
  display: inline;
  max-width: none;
  vertical-align: baseline;
}

.portal-link-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.portal-link-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
}

.portal-link-copy-btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.06);
}

.portal-link-copy-btn:focus-visible {
  outline: 2px solid rgba(255, 45, 55, 0.55);
  outline-offset: 2px;
}

.portal-link-copy-btn[data-state="copied"] {
  color: #89d6a0;
  border-color: rgba(137, 214, 160, 0.45);
  background: rgba(137, 214, 160, 0.1);
}

.portal-link-copy-icon {
  position: relative;
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
}

.portal-link-copy-icon::before,
.portal-link-copy-icon::after {
  content: "";
  position: absolute;
  border: 1px solid currentColor;
  border-radius: 2px;
}

.portal-link-copy-icon::before {
  width: 8px;
  height: 8px;
  top: 2px;
  left: 0;
  opacity: 0.6;
}

.portal-link-copy-icon::after {
  width: 8px;
  height: 8px;
  top: 0;
  left: 3px;
}

.portal-link-copy-status {
  min-width: 56px;
  font-size: 0.78rem;
}

.portal-password-hint {
  font-size: 0.88rem;
}

hr {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

canvas.signature {
  width: 100%;
  height: 220px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background:
    linear-gradient(180deg, rgba(5, 7, 9, 0.8), rgba(5, 7, 9, 0.65));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  touch-action: none;
}

canvas.signature:hover {
  border-color: rgba(255, 45, 55, 0.35);
}

canvas.signature.signature-invalid {
  border-color: rgba(255, 45, 55, 0.66);
  box-shadow:
    0 0 0 3px rgba(209, 15, 30, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.portal-signature-validation {
  margin-top: 8px;
  min-height: 22px;
}

.portal-signature-validation-message {
  margin: 0;
  color: #ffc5c8;
  font-size: 0.92rem;
  line-height: 1.35;
}

.portal-signature-actions .btn[disabled] {
  opacity: 0.7;
  cursor: wait;
  pointer-events: none;
}

.auth-shell {
  min-height: calc(100vh - 240px);
  display: grid;
  place-items: center;
  gap: 16px;
  align-content: start;
  padding-top: 12px;
}

.auth-hero {
  width: 100%;
  max-width: 760px;
}

.auth-card {
  justify-self: center;
}

.auth-card h2 {
  margin-bottom: 4px;
}

.auth-card-note {
  margin-bottom: 10px;
}

.auth-token-hint {
  margin-top: 12px;
  margin-bottom: 0;
}

.portal-quicknav {
  margin-bottom: var(--section-gap);
  padding: 10px;
}

.portal-quicknav summary {
  list-style: none;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 34px;
  padding: 0 12px 0 32px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  user-select: none;
}

.portal-quicknav summary::-webkit-details-marker {
  display: none;
}

.portal-quicknav summary::after {
  content: "+";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}

.portal-quicknav[open] summary::after {
  content: "−";
}

.portal-quicknav[open] summary {
  border-color: rgba(255, 45, 55, 0.34);
  color: var(--text);
}

.portal-panel {
  padding: 10px;
}

.portal-panel > summary {
  list-style: none;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  padding: 0 12px 0 32px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  user-select: none;
}

.portal-panel > summary::-webkit-details-marker {
  display: none;
}

.portal-panel-title {
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.portal-panel > summary::after {
  content: "+";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}

.portal-panel[open] > summary {
  border-color: rgba(255, 45, 55, 0.34);
}

.portal-panel[open] > summary::after {
  content: "−";
  color: var(--text);
}

.portal-panel[open] .portal-panel-title {
  color: var(--text);
}

.portal-panel-body {
  margin-top: 10px;
}

@media (min-width: 761px) {
  .portal-quicknav summary {
    display: none;
  }

  .portal-quicknav .portal-section-nav {
    margin-top: 0;
  }
}

.portal-section-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 0;
}

.portal-section-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  text-decoration: none;
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.portal-section-nav a.portal-section-nav-primary {
  border-color: rgba(255, 45, 55, 0.42);
  background:
    linear-gradient(180deg, rgba(209, 15, 30, 0.18), rgba(209, 15, 30, 0.08)),
    rgba(255, 255, 255, 0.02);
  color: #fff;
}

.portal-section-nav a:hover,
.portal-section-nav a:focus-visible {
  color: var(--text);
  border-color: rgba(255, 45, 55, 0.38);
  background: rgba(209, 15, 30, 0.08);
  outline: none;
}

.portal-section-nav a.portal-section-nav-primary:hover,
.portal-section-nav a.portal-section-nav-primary:focus-visible {
  border-color: rgba(255, 45, 55, 0.5);
  background:
    linear-gradient(180deg, rgba(209, 15, 30, 0.24), rgba(209, 15, 30, 0.11)),
    rgba(255, 255, 255, 0.02);
}

.portal-notification-banner {
  margin-bottom: var(--section-gap);
  padding: 10px 12px;
}

.portal-notification-toggle-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.portal-notification-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.portal-notification-switch input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(100%);
}

.portal-notification-switch-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 52px;
  height: 30px;
  padding: 2px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  transition: background 120ms ease, border-color 120ms ease;
}

.portal-notification-switch-thumb {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #d7dde7;
  box-shadow: 0 1px 4px rgba(6, 9, 13, 0.5);
  transition: transform 120ms ease, background 120ms ease;
}

.portal-notification-switch input[type="checkbox"]:checked + .portal-notification-switch-track {
  border-color: rgba(34, 197, 94, 0.55);
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.32), rgba(34, 197, 94, 0.18));
}

.portal-notification-switch input[type="checkbox"]:checked + .portal-notification-switch-track .portal-notification-switch-thumb {
  transform: translateX(22px);
  background: #effff4;
}

.portal-notification-switch input[type="checkbox"]:focus-visible + .portal-notification-switch-track {
  outline: 2px solid rgba(255, 45, 55, 0.55);
  outline-offset: 2px;
}

.portal-notification-switch-label {
  color: var(--text);
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-portal-notification-row {
  margin: 8px 0 10px;
}

.admin-portal-access-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.admin-portal-notification-toggle-form {
  justify-content: flex-start;
  margin: 0;
}

.admin-timeline-mobile-list {
  display: none;
}

.admin-timeline-mobile-item {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.012);
  padding: 10px;
}

.admin-timeline-mobile-time {
  font-family: var(--font-head);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-timeline-mobile-status {
  margin-top: 6px;
}

.admin-timeline-mobile-note {
  margin-top: 8px;
  font-size: 14px;
  overflow-wrap: break-word;
  word-break: normal;
  -webkit-hyphens: auto;
  hyphens: auto;
}

.admin-timeline-note-cell {
  vertical-align: top;
}

.admin-timeline-note-content {
  overflow-wrap: break-word;
  word-break: normal;
  -webkit-hyphens: auto;
  hyphens: auto;
  white-space: pre-wrap;
}

.admin-note-edit-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.admin-note-edit-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.admin-note-edit-row .admin-timeline-note-content {
  flex: 1 1 auto;
  min-width: 0;
}

.admin-note-edit-toggle {
  flex: 0 0 auto;
  width: 30px;
  min-height: 30px;
}

.admin-note-edit-panel {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.02);
  width: 100%;
}

.admin-note-edit-panel form {
  margin: 0;
}

.admin-note-edit-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.admin-note-edit-panel-head label {
  margin: 0;
}

.admin-note-edit-cancel-toggle {
  width: 30px;
  min-height: 30px;
  flex: 0 0 auto;
}

.admin-note-edit-panel textarea {
  min-height: 120px;
  line-height: 1.4;
  resize: vertical;
  overflow-y: hidden;
}

.admin-note-edit-actions {
  gap: 8px;
}

.table-timeline {
  table-layout: auto;
}

.table-timeline th.timeline-col-time,
.table-timeline td.timeline-time-cell {
  width: 1%;
  min-width: 138px;
  white-space: nowrap;
}

.table-timeline th.timeline-col-status,
.table-timeline td.timeline-status-cell {
  width: 1%;
  min-width: 172px;
  text-align: center;
}

.table-timeline td.timeline-status-cell .badge {
  width: min(100%, 148px);
  min-height: 32px;
  margin: 0 auto;
}

.table-overview {
  table-layout: auto;
}

.table-overview th.overview-col-number,
.table-overview td.overview-number-cell {
  width: 86px;
  white-space: nowrap;
}

.table-overview th.overview-col-created,
.table-overview td.overview-created-cell {
  width: 132px;
  white-space: nowrap;
}

.table-overview th.overview-col-status,
.table-overview td.overview-status-cell {
  width: 174px;
  text-align: center;
}

.table-overview td.overview-status-cell .badge {
  width: min(100%, 156px);
  min-height: 32px;
  margin: 0 auto;
}

.admin-index-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-index-search-form {
  flex: 1 1 420px;
  max-width: 680px;
  margin-left: auto;
}

.admin-index-search-label {
  margin: 0 0 6px;
}

.admin-index-search-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.admin-index-search-controls input {
  flex: 1 1 240px;
  min-width: 0;
}

.admin-index-search-result {
  margin: 0 0 12px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: var(--section-gap);
}

.status-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01)),
    linear-gradient(180deg, #13181e, #101419);
  padding: 12px 12px 10px;
  box-shadow: var(--shadow-sm);
}

.status-item-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.status-item-link:hover {
  border-color: rgba(255, 45, 55, 0.28);
}

.status-item-link:focus-visible {
  outline: 2px solid rgba(255, 45, 55, 0.45);
  outline-offset: 2px;
}

.status-item::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
}

.status-item-accent {
  background:
    linear-gradient(135deg, rgba(209, 15, 30, 0.14), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.012)),
    linear-gradient(180deg, #141920, #101419);
}

.status-item-label {
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.status-item-value {
  margin-top: 4px;
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--text);
}

.status-item-value-small {
  font-size: 18px;
  letter-spacing: 0.03em;
  line-height: 1.15;
}

.status-item-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.status-progress {
  margin-top: 8px;
  height: 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.status-progress > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 16px rgba(209, 15, 30, 0.35);
}

.portal-main-grid {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.admin-case-layout-stack {
  grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 980px) {
  .portal-main-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
  min-width: 0;
}

.card-accent {
  background:
    linear-gradient(135deg, var(--state-open-soft), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.008) 45%),
    linear-gradient(180deg, #151a20, #11161b);
}

.card-success {
  background:
    linear-gradient(135deg, var(--success-tint), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.008) 45%),
    linear-gradient(180deg, #151a20, #11161b);
}

.card-success::after {
  background: radial-gradient(circle at 100% 0%, var(--success-glow), transparent 70%);
}

.card-success h2::before {
  background: linear-gradient(180deg, var(--success-dot-start), var(--success-dot-end));
  box-shadow: 0 0 14px var(--success-dot-shadow);
}

.workflow-steps {
  list-style: none;
  margin: 0;
  padding: 2px 0 0;
  display: grid;
  gap: 10px;
}

.workflow-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.015);
}

.workflow-step-current {
  border-color: var(--state-open-border);
  background:
    linear-gradient(90deg, var(--state-open-soft), transparent 60%),
    rgba(255, 255, 255, 0.015);
}

.workflow-step-done {
  border-color: var(--state-success-border);
}

.workflow-step-marker {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.workflow-step-done .workflow-step-marker {
  border-color: var(--state-success-border);
  color: #d6ffe5;
  background: var(--state-success-soft);
}

.workflow-step-current .workflow-step-marker {
  border-color: var(--state-open-border);
  color: #fff;
  background: var(--state-open-soft);
}

.workflow-step-content {
  min-width: 0;
}

.workflow-step-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 8px;
  align-items: start;
}

.workflow-step-head strong {
  font-size: 15px;
  min-width: 0;
}

.workflow-step-head .badge {
  justify-self: end;
  white-space: nowrap;
  width: 126px;
  min-height: 30px;
}

.workflow-step-content p {
  margin: 6px 0 0;
  font-size: 13px;
}

.workflow-state-badge {
  border-color: var(--state-open-border);
  background:
    linear-gradient(180deg, var(--state-open-bg-start), var(--state-open-bg-end));
  color: var(--state-open-text);
}

.workflow-state-badge-done {
  border-color: var(--state-success-border);
  background:
    linear-gradient(180deg, var(--state-success-bg-start), var(--state-success-bg-end));
  color: var(--state-success-text);
}

.logbook-list {
  display: grid;
  gap: 10px;
}

.logbook-entry {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.015);
  overflow: hidden;
}

.logbook-entry[open] {
  border-color: rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(90deg, rgba(209, 15, 30, 0.05), transparent 65%),
    rgba(255, 255, 255, 0.016);
}

.logbook-entry summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  gap: 4px;
  padding: 11px 12px;
}

.logbook-entry summary::-webkit-details-marker {
  display: none;
}

.logbook-summary-time {
  color: var(--muted-2);
  font-family: var(--font-head);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.logbook-summary-title {
  color: var(--text);
  font-weight: 600;
}

.logbook-summary-note {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logbook-entry-body {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 12px 12px;
}

.accordion-table {
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(9, 11, 14, 0.35);
}

.accordion-table-head {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.7fr) minmax(0, 0.8fr);
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.accordion-row {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.accordion-row:first-of-type {
  border-top: none;
}

.accordion-row summary {
  list-style: none;
  cursor: pointer;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.7fr) minmax(0, 0.8fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px 10px 34px;
}

.accordion-row summary::-webkit-details-marker {
  display: none;
}

.accordion-row summary::after {
  content: "+";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}

.accordion-row[open] summary::after {
  content: "−";
  color: var(--text);
}

.accordion-row summary:hover {
  background:
    linear-gradient(90deg, rgba(209, 15, 30, 0.05), transparent 70%),
    rgba(255, 255, 255, 0.01);
}

.accordion-col {
  min-width: 0;
}

.accordion-col-label {
  font-weight: 600;
}

.accordion-col-value {
  color: var(--muted);
}

.accordion-col-status {
  justify-self: start;
}

.accordion-row-body {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding: 10px 12px 12px;
}

.pruef-status-badge {
  color: #fff;
}

.pruef-status-ok {
  border-color: rgba(34, 197, 94, 0.32);
  background: rgba(34, 197, 94, 0.14);
}

.pruef-status-warn {
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(245, 158, 11, 0.14);
}

.pruef-status-open {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.plain-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.doc-groups {
  display: grid;
  gap: 10px;
}

.admin-case-sections {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.doc-group {
  min-width: 0;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.012);
  overflow: visible;
}

/* Keep photo meta overlays above later admin sections inside the same card. */
.admin-documents-group {
  z-index: 3;
}

.doc-group > summary {
  list-style: none;
  cursor: pointer;
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px 10px 34px;
}

.doc-group > summary > * {
  min-width: 0;
  max-width: 100%;
}

.doc-group > summary::-webkit-details-marker {
  display: none;
}

.doc-group > summary::after {
  content: "+";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}

.doc-group[open] > summary::after {
  content: "−";
  color: var(--text);
}

.doc-group > summary:hover {
  background: rgba(255, 255, 255, 0.015);
}

.admin-case-info-summary {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-case-info-summary-title {
  min-width: 0;
}

.admin-case-inline-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  flex: 0 0 auto;
}

.admin-case-edit-toggle {
  width: 32px;
  min-height: 32px;
}

.doc-group-meta {
  font-size: 12px;
}

.doc-group-body {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding: 10px;
  min-width: 0;
}

.card.admin-index-disclosure {
  padding: 0;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.07);
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.008) 45%),
    linear-gradient(180deg, #151a20, #11161b);
}

.card.admin-index-disclosure > summary {
  padding: 16px 16px 12px 40px;
}

.card.admin-index-disclosure > summary h2 {
  margin: 0;
}

.card.admin-index-disclosure > .doc-group-body {
  padding: 12px 16px 16px;
}

.card.admin-index-disclosure > .doc-group-body > :first-child {
  margin-top: 0;
}

.doc-group-body .table-scroll .table {
  min-width: 560px;
}

.doc-group-table {
  table-layout: fixed;
}

.doc-group-table .doc-filename-cell {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.doc-group-table .doc-upload-col,
.doc-group-table .doc-upload-cell {
  width: 128px;
  padding-right: 4px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.doc-group-table .doc-upload-cell {
  vertical-align: middle;
}

.doc-group-table th.table-col-actions,
.doc-group-table td.table-cell-actions {
  width: 56px;
  min-width: 56px;
  padding-left: 0;
  padding-right: 8px;
}

.doc-group-table td.table-cell-actions {
  position: relative;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

.doc-group-table td.table-cell-actions > form {
  display: inline-flex;
}

.doc-group-table td.table-cell-actions > * + * {
  margin-left: 8px;
}

.doc-group-mobile-list {
  display: none;
}

.doc-row-detail td {
  border-top: 0;
}

.doc-row-detail-cell {
  padding-top: 0;
}

.doc-row-toggle-row {
  cursor: pointer;
}

.doc-row-toggle-row:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.25);
  outline-offset: -1px;
}

.doc-filename-cell-toggle {
  /* Keep native table-cell layout to avoid row-separator misalignment. */
}

.doc-filename-cell-toggle .doc-row-toggle-indicator {
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}

.doc-filename-cell-toggle a {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.doc-row-toggle-indicator {
  flex: 0 0 auto;
  width: 12px;
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 15px;
  line-height: 1;
  text-align: center;
}

.doc-row-toggle-row[aria-expanded="true"] .doc-row-toggle-indicator {
  color: var(--text);
}

.doc-group-mobile-item {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.012);
  padding: 10px;
}

.doc-group-mobile-label {
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.doc-group-mobile-link {
  margin-top: 4px;
  display: inline-block;
  color: var(--text);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.doc-group-mobile-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.doc-group-mobile-actions {
  margin-top: 10px;
}

.doc-group-mobile-item-admin {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "label label"
    "link link"
    "meta actions"
    "payment payment";
  column-gap: 10px;
  row-gap: 8px;
  align-items: center;
}

.doc-group-mobile-item-admin .doc-group-mobile-label {
  grid-area: label;
}

.doc-group-mobile-item-admin .doc-group-mobile-link {
  grid-area: link;
  margin-top: 0;
}

.doc-group-mobile-item-admin .doc-group-mobile-meta {
  grid-area: meta;
  margin-top: 0;
  min-width: 0;
}

.doc-group-mobile-item-admin .doc-group-mobile-actions {
  grid-area: actions;
  margin-top: 0;
  display: flex;
  justify-content: flex-end;
  justify-self: end;
}

.doc-group-mobile-item-admin .doc-group-mobile-actions form {
  margin: 0;
}

.doc-group-mobile-invoice-entry-admin {
  padding: 0;
}

.doc-group-mobile-invoice-entry-body .doc-group-mobile-actions {
  margin-top: 0;
  margin-bottom: 10px;
  display: flex;
  justify-content: flex-end;
}

.doc-group-mobile-invoice-entry-body .doc-group-mobile-actions form {
  margin: 0;
}

.pdf-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 16px;
  margin-right: 6px;
  padding: 0 4px;
  border-radius: 4px;
  border: 1px solid rgba(255, 45, 55, 0.55);
  background:
    linear-gradient(180deg, rgba(255, 45, 55, 0.38), rgba(140, 9, 19, 0.5));
  color: #fff;
  font-family: var(--font-head);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  vertical-align: middle;
  white-space: nowrap;
}

.doc-link-text {
  text-decoration-line: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.doc-filename-cell a,
.doc-group-mobile-link,
.payment-invoice-entry-link a {
  text-decoration: none;
}

.admin-doc-row-toggle {
  order: -1;
  min-width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-family: var(--font-head);
  font-size: 15px;
  line-height: 1;
}

.admin-doc-row-toggle:hover,
.admin-doc-row-toggle:focus-visible {
  color: var(--text);
  background: transparent;
}

.photo-upload-assignment-disclosure {
  margin: 12px 0 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.01);
  padding: 8px 10px;
}

.photo-upload-assignment-disclosure > summary {
  list-style: none;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  cursor: pointer;
}

.photo-upload-assignment-disclosure > summary::-webkit-details-marker {
  display: none;
}

.photo-upload-assignment-label {
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.photo-upload-assignment-toggle {
  order: -1;
  width: auto;
  min-height: 0;
  border: 0;
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: var(--muted);
  font-size: 16px;
}

.photo-upload-assignment-toggle span {
  line-height: 1;
  transition: transform 120ms ease;
}

.photo-upload-assignment-disclosure[open] .photo-upload-assignment-toggle span {
  transform: rotate(45deg);
}

.photo-upload-assignment-body {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 10px;
}

.photo-upload-album-grid {
  margin-top: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

#upload-photo-album-create-panel {
  margin-top: 0;
}

.photo-album-create-feedback {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

.photo-album-create-feedback.is-error {
  color: rgba(255, 188, 188, 0.96);
}

.photo-upload-album-option {
  margin: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.photo-upload-album-option span {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 0;
  border: 0;
  background: transparent;
  padding: 2px 0 2px 30px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  transition: color 120ms ease, transform 120ms ease;
}

.photo-upload-album-option span::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(10, 12, 15, 0.72);
  transform: translateY(-50%);
}

.photo-upload-album-option span::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 5px;
  height: 3px;
  border-left: 1.6px solid #fff;
  border-bottom: 1.6px solid #fff;
  transform: translate(-50%, -65%) rotate(-45deg) scale(0);
  transform-origin: center;
  opacity: 0;
  transition: transform 120ms ease, opacity 120ms ease;
}

.photo-upload-album-option input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.photo-upload-album-option input[type="checkbox"]:checked + span {
  color: var(--text);
}

.photo-upload-album-option input[type="checkbox"]:checked + span::before {
  border-color: var(--accent-2);
  background: var(--accent-2);
}

.photo-upload-album-option input[type="checkbox"]:checked + span::after {
  opacity: 1;
  transform: translate(-50%, -65%) rotate(-45deg) scale(1);
}

.photo-upload-album-option input[type="checkbox"]:focus-visible + span {
  outline: 2px solid rgba(255, 45, 55, 0.34);
  outline-offset: 2px;
}

.photo-upload-album-option input[type="checkbox"]:disabled + span {
  cursor: not-allowed;
  opacity: 0.62;
}

.photo-upload-album-option:hover span {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.22);
}

.photo-album-admin-tools {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.01);
}

.photo-album-create-disclosure {
  margin: 0;
}

.photo-album-create-disclosure > summary {
  list-style: none;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  cursor: pointer;
}

.photo-album-create-disclosure[open] > summary {
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.photo-album-create-disclosure > summary::-webkit-details-marker {
  display: none;
}

.photo-album-create-summary-label {
  color: var(--text);
  font-family: var(--font-head);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.photo-album-create-toggle {
  order: -1;
  width: auto;
  min-height: 0;
  border: 0;
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: var(--muted);
  font-size: 16px;
}

.photo-album-create-toggle span {
  line-height: 1;
  transition: transform 120ms ease;
}

.photo-album-create-disclosure[open] .photo-album-create-toggle span {
  transform: rotate(45deg);
}

.photo-album-create-form {
  margin: 0;
  padding-top: 0;
  border-top: 0;
}

.photo-album-create-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  padding-right: 4px;
}

.photo-album-stack {
  display: grid;
  gap: 10px;
}

.photo-album-block {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.012);
  padding: 8px;
}

.photo-album-block-unassigned {
  border-style: solid;
}

.photo-album-stack + .photo-album-block-unassigned {
  margin-top: 10px;
}

.photo-album-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.photo-album-header h3 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-head);
  font-size: 12px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.photo-album-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.photo-album-title-wrap h3 {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-album-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.photo-album-header-actions > .muted {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  line-height: 1.1;
}

.photo-album-rename-form {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.photo-album-rename-input {
  width: clamp(128px, 24vw, 210px);
  min-height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(10, 12, 15, 0.72);
  color: var(--text);
  padding: 0 8px;
  font-size: 12px;
}

.photo-album-rename-input:focus {
  outline: none;
  border-color: rgba(255, 45, 55, 0.56);
  box-shadow: 0 0 0 2px rgba(255, 45, 55, 0.18);
}

.photo-album-rename-toggle,
.photo-album-rename-save,
.photo-album-rename-cancel {
  width: 26px;
  min-height: 26px;
  border-radius: 7px;
  font-size: 13px;
}

.photo-album-rename-toggle span,
.photo-album-rename-save span,
.photo-album-rename-cancel span {
  line-height: 1;
}

.photo-album-header-delete-form {
  margin: 0;
  display: inline-flex;
}

.photo-album-empty-body {
  margin: 0;
  font-size: 12px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 84px);
  justify-content: start;
  gap: 8px;
}

.photo-tile {
  position: relative;
  min-width: 0;
}

.photo-thumb-link {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.008)),
    rgba(10, 12, 15, 0.45);
  touch-action: manipulation;
  transition: border-color 120ms ease, transform 120ms ease;
}

.photo-thumb-link:hover,
.photo-thumb-link:focus-visible {
  border-color: rgba(255, 45, 55, 0.36);
  transform: translateY(-1px);
  outline: none;
}

.photo-thumb-link img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: auto;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Soften small thumbnail stair-stepping on lower-density displays. */
@media (max-resolution: 1.99dppx) {
  .photo-thumb-link img {
    filter: blur(0.08px);
  }
}

.photo-meta {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 4;
}

.photo-meta[open] {
  z-index: 18;
}

.photo-meta summary {
  list-style: none;
}

.photo-meta summary::-webkit-details-marker {
  display: none;
}

.photo-info-btn {
  width: 22px;
  min-height: 22px;
  border-radius: 999px;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(10, 14, 18, 0.88);
  color: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.photo-meta[open] .photo-info-btn {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(15, 19, 24, 0.96);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.34);
}

.photo-meta-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  margin-top: 0;
  width: min(290px, calc(100vw - 20px));
  padding: 10px 10px 8px;
  padding-right: 38px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(29, 37, 47, 0.965), rgba(18, 24, 32, 0.955)),
    rgba(12, 16, 22, 0.94);
  background-clip: padding-box;
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  z-index: 220;
  isolation: isolate;
}

.photo-meta-panel-admin {
  padding-bottom: 54px;
}

.photo-meta-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  min-height: 22px;
  border-radius: 999px;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.9);
  box-shadow: none;
  font-size: 12px;
  font-weight: 700;
}

.photo-meta-close:hover,
.photo-meta-close:focus-visible {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.photo-meta-actions {
  position: absolute;
  right: 10px;
  bottom: 8px;
  display: flex;
  justify-content: flex-end;
}

.photo-meta-line {
  display: grid;
  gap: 2px;
  margin-bottom: 6px;
}

.photo-meta-line:last-of-type {
  margin-bottom: 0;
}

.photo-meta-label {
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.photo-meta-value {
  color: var(--text);
  font-size: 12px;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.photo-meta-empty {
  margin: 6px 0 0;
  font-size: 12px;
}

.photo-album-assignment-form {
  margin-top: 8px;
}

.photo-album-choice-grid {
  margin-top: 4px;
  max-height: 128px;
  overflow-y: auto;
  display: grid;
  gap: 4px;
  padding-right: 2px;
}

.photo-album-choice {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  border: 0;
  background: transparent;
  padding: 2px 0;
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.photo-album-choice input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent-2);
}

.photo-delete-form {
  margin: 0;
  display: flex;
  justify-content: flex-end;
}

/* Guided two-step payment flow (compact by default, mobile-first readable). */
.payment-guidance {
  margin: 0 0 10px;
}

.payment-flow {
  display: grid;
  gap: 10px;
}

.payment-step {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.008)),
    rgba(8, 10, 13, 0.35);
  overflow: hidden;
}

.payment-step > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "toggle title state";
  align-items: center;
  column-gap: 8px;
  row-gap: 6px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.payment-step > summary::-webkit-details-marker {
  display: none;
}

.payment-step > summary::after {
  grid-area: toggle;
  content: "+";
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 18px;
  line-height: 1;
  justify-self: start;
  align-self: center;
}

.payment-step[open] > summary::after {
  content: "−";
}

.payment-step-title {
  grid-area: title;
  color: var(--text);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  min-width: 0;
}

.payment-step-state {
  grid-area: state;
  margin-left: 0;
  max-width: 100%;
  justify-self: end;
  white-space: normal;
  text-align: center;
}

.payment-step-body {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 12px 12px;
}

.payment-invoice-list {
  display: grid;
  gap: 10px;
}

.payment-invoice-entry {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.payment-invoice-entry > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "toggle main meta";
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}

.payment-invoice-entry > summary::-webkit-details-marker {
  display: none;
}

.payment-invoice-entry > summary::after {
  grid-area: toggle;
  content: "+";
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 18px;
  line-height: 1;
  justify-self: start;
}

.payment-invoice-entry[open] > summary::after {
  content: "−";
}

.payment-invoice-entry-main {
  grid-area: main;
  display: block;
  min-width: 0;
}

.payment-invoice-entry-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.payment-invoice-entry-link a {
  color: var(--text);
  display: inline;
  margin-top: 0;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  overflow-wrap: anywhere;
}

.payment-invoice-entry-meta {
  grid-area: meta;
  font-size: 12px;
  text-align: right;
}

.payment-invoice-list-admin {
  margin-bottom: 16px;
}

.payment-invoice-list-admin .payment-invoice-entry-link {
  color: var(--text);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.payment-invoice-entry-body {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px;
}

.payment-details-card {
  margin-top: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  padding: 10px;
}

.payment-details-card-compact {
  margin-top: 0;
  padding: 12px;
}

.invoice-payment-link-form {
  margin-top: 12px;
}

.invoice-payment-link-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.invoice-payment-link-input-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.invoice-payment-link-input-delete {
  flex: 0 0 auto;
  width: 42px;
  min-height: 42px;
  border-radius: 12px;
}

.invoice-payment-link-help {
  margin-top: 6px;
}

.invoice-payment-link-actions {
  margin-top: 12px;
  align-items: center;
}

.invoice-payment-link-actions .btn {
  min-width: 220px;
}

.invoice-payment-link-delete-form {
  margin: 0;
}

.payment-link-action {
  border-color: rgba(255, 88, 96, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018)),
    linear-gradient(180deg, rgba(77, 12, 18, 0.92), rgba(40, 10, 14, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 18px rgba(65, 7, 12, 0.18);
}

.payment-link-action:hover,
.payment-link-action:focus-visible {
  border-color: rgba(255, 116, 124, 0.48);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.024)),
    linear-gradient(180deg, rgba(92, 16, 24, 0.94), rgba(49, 11, 16, 0.97));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 10px 22px rgba(78, 9, 15, 0.22);
}

.payment-link-action-prominent {
  border-color: rgba(255, 112, 120, 0.52);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    0 10px 20px rgba(118, 10, 18, 0.26);
}

.payment-details-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.payment-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.payment-detail-item {
  display: grid;
  gap: 4px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.012);
  padding: 8px 10px;
}

.payment-detail-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.payment-detail-value {
  overflow-wrap: anywhere;
}

.payment-bank-note {
  margin-top: 12px;
  font-size: 13px;
}

.payment-bank-note code {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

footer {
  max-width: var(--maxw);
  margin: 12px auto 0;
  padding: 16px 20px 28px;
  color: var(--muted-2);
  font-family: var(--font-head);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
}

footer .footer-version-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 255, 255, 0.35);
}

footer .footer-version-text {
  color: inherit;
}

footer .footer-version-link:hover,
footer .footer-version-link:focus-visible {
  color: var(--text);
  text-decoration-color: rgba(255, 45, 55, 0.72);
}

::selection {
  background: rgba(255, 45, 55, 0.28);
  color: #fff;
}

@media (max-width: 760px) {
  .grid-two-col {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar-inner {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px 12px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    padding-bottom: 14px;
  }

  .brand {
    width: 100%;
    max-width: 100%;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    order: 2;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .brand img {
    width: min(100%, 220px);
    height: 72px;
  }

  .brand .title strong {
    font-size: 14px;
    letter-spacing: 0.12em;
  }

  .brand .title {
    position: static;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    transform: translateY(12px);
    pointer-events: none;
    align-items: flex-start;
    text-align: left;
    width: auto;
    max-width: min(100%, 430px);
    margin-left: -12px;
  }

  .brand .title span {
    font-size: 12px;
    white-space: normal;
    line-height: 1.2;
  }

  .brand .title small {
    white-space: normal;
    line-height: 1.15;
  }

  nav.topnav {
    width: 100%;
    margin-left: 0;
    order: 1;
    justify-content: flex-end;
  }

  nav.topnav a,
  nav.topnav button.topnav-link {
    min-height: 38px;
  }

  .container {
    padding-top: 12px;
  }

  .hero {
    padding: 18px 16px 16px;
  }

  .card {
    padding: 14px;
  }

  .table th,
  .table td {
    padding: 9px 10px;
    font-size: 13px;
  }

  .table-scroll .table {
    min-width: 680px;
  }

  .table-scroll .table-case-info {
    min-width: 100%;
  }

  .table-case-info th,
  .table-case-info td {
    padding: 8px 9px;
  }

  .table-case-info th {
    width: 118px;
    font-size: 11px;
    letter-spacing: 0.08em;
  }

  .table-case-info td {
    font-size: 12px;
    line-height: 1.32;
  }

  .row {
    gap: 8px;
  }

  .auth-shell {
    min-height: auto;
    gap: 12px;
    padding-top: 0;
  }

  .portal-quicknav {
    padding: 8px;
  }

  .portal-quicknav summary {
    min-height: 32px;
    padding: 0 10px 0 28px;
    font-size: 10px;
  }

  .portal-section-nav a {
    min-height: 34px;
    font-size: 11px;
    padding: 0 10px;
  }

  .portal-notification-toggle-form {
    align-items: flex-start;
  }

  .status-strip {
    grid-template-columns: 1fr 1fr;
  }

  .status-item-value {
    font-size: 22px;
  }

  .status-item-value-small {
    font-size: 16px;
  }

  .payment-step > summary {
    padding: 9px 10px;
  }

  .payment-step-title {
    font-size: 12px;
    letter-spacing: 0.07em;
  }

  .payment-step-body {
    padding: 9px 10px 10px;
  }

  .workflow-step {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 10px;
    padding: 9px;
  }

  .workflow-step-marker {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }

  .accordion-table-head,
  .accordion-row summary {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .accordion-table-head {
    display: none;
  }

  .accordion-col-value,
  .accordion-col-status {
    color: var(--muted);
  }

  .doc-group > summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-case-info-group > summary {
    align-items: center;
    flex-direction: row;
    flex-wrap: nowrap;
  }

  .admin-case-inline-actions {
    width: auto;
    justify-content: flex-end;
  }

  .admin-case-inline-actions .btn {
    width: auto;
  }

  .photo-upload-album-grid {
    gap: 6px;
  }

  .photo-album-create-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .photo-album-create-row .btn {
    width: 100%;
  }

  .photo-grid {
    grid-template-columns: repeat(auto-fill, 72px);
    gap: 6px;
  }

  .photo-album-header-actions {
    justify-content: flex-start;
  }

  .photo-album-title-wrap {
    width: auto;
    justify-content: flex-start;
  }

  .photo-album-rename-form {
    max-width: 100%;
  }

  .photo-album-rename-input {
    width: min(62vw, 220px);
  }

  .photo-meta-panel {
    width: min(264px, calc(100vw - 48px));
  }

  .logbook-summary-note {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
}

@media (max-width: 680px) {
  .topbar-inner {
    gap: 8px 10px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    padding-bottom: 12px;
  }

  .brand img {
    width: min(100%, 188px);
    height: 60px;
  }

  .brand .title {
    transform: translateY(6px);
    margin-left: -10px;
  }

  .brand .title strong {
    font-size: 12px;
    letter-spacing: 0.1em;
  }

  .brand .title span {
    font-size: 11px;
    line-height: 1.12;
  }

  .brand .title small {
    display: block;
    font-size: 9px;
    line-height: 1.1;
    letter-spacing: 0.08em;
    opacity: 0.88;
  }

  .portal-section-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .portal-section-nav a {
    width: 100%;
    justify-content: center;
    min-height: 32px;
    padding: 6px 8px;
    font-size: 10px;
    letter-spacing: 0.05em;
    text-align: center;
    white-space: nowrap;
    line-height: 1;
    overflow-wrap: normal;
    word-break: normal;
  }

  .status-strip {
    grid-template-columns: minmax(0, 1fr);
  }

  .portal-mobile-stack-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .portal-mobile-stack-row .btn,
  .portal-mobile-stack-row button {
    width: 100%;
  }

  .admin-timeline-table-wrap {
    display: none;
  }

  .admin-timeline-mobile-list {
    display: grid;
    gap: 8px;
  }

  /* Document groups switch to the dedicated mobile list on narrow viewports. */
  .portal-panel .doc-group-body .table-scroll,
  .admin-documents-group .doc-group-body .table-scroll {
    display: none;
  }

  .doc-group-mobile-list {
    display: grid;
    gap: 8px;
  }

  .payment-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .payment-invoice-entry > summary {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "toggle main"
      "meta meta";
  }

  .payment-invoice-entry-meta {
    text-align: left;
  }

  .photo-grid {
    grid-template-columns: repeat(auto-fill, 64px);
  }

  .photo-info-btn {
    width: 22px;
    min-height: 22px;
    font-size: 11px;
  }

  .photo-meta {
    top: -4px;
    right: -4px;
  }

  .photo-meta-panel {
    position: fixed;
    left: 50%;
    right: auto;
    top: auto;
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    width: min(352px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    max-height: min(72vh, 420px);
    overflow-y: auto;
    margin: 0;
    transform: translateX(-50%);
    padding: 12px 12px 10px;
    padding-right: 42px;
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow:
      0 24px 52px rgba(0, 0, 0, 0.5),
      inset 0 1px 0 rgba(255, 255, 255, 0.05);
    z-index: 320;
  }

  .photo-meta-panel-admin {
    padding-bottom: 60px;
  }

  .photo-meta-close {
    top: 10px;
    right: 10px;
    width: 24px;
    min-height: 24px;
    font-size: 13px;
  }
}

@media (max-width: 560px) {
  .admin-index-hero h1 {
    padding-right: 0;
    font-size: clamp(22px, 6vw, 26px);
    line-height: 1;
    letter-spacing: 0.05em;
  }

  .admin-index-toolbar {
    align-items: stretch;
  }

  .admin-index-toolbar > .btn {
    width: 100%;
  }

  .admin-index-search-form {
    flex-basis: 100%;
    max-width: none;
    margin-left: 0;
  }

  .admin-index-search-controls input {
    flex-basis: 100%;
  }

  .admin-index-search-controls .btn {
    width: 100%;
  }

  nav.topnav a.topnav-overview-link {
    min-height: 36px;
    padding: 0 10px;
    font-size: 11px;
    letter-spacing: 0.05em;
  }

  .table-case-info th {
    width: 104px;
  }

  .photo-album-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .photo-album-title-wrap {
    flex: 1 1 100%;
    width: 100%;
  }

  .photo-album-header-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: nowrap;
  }

  .payment-step > summary {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "toggle title"
      "state state";
    align-items: start;
  }

  .payment-step-state {
    justify-self: start;
  }

  .brand {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
  }

  .brand img {
    width: min(100%, 140px);
    height: 50px;
    flex: 0 0 auto;
  }

  .brand .title {
    transform: translateY(0);
    width: auto;
    margin-left: -2px;
    flex: 1 1 auto;
    min-width: 0;
  }

  .brand .title strong {
    font-size: 11px;
    letter-spacing: 0.08em;
  }

  .brand .title span {
    font-size: clamp(8px, 2.5vw, 9.5px);
    line-height: 1.1;
    letter-spacing: 0.01em;
    white-space: nowrap;
  }

  .brand .title small {
    font-size: 8px;
    line-height: 1.05;
    letter-spacing: 0.07em;
  }
}

@media (max-width: 420px) {
  .admin-index-hero h1 {
    font-size: clamp(20px, 6vw, 23px);
    letter-spacing: 0.04em;
  }

  nav.topnav a.topnav-overview-link {
    min-height: 34px;
    padding: 0 8px;
    font-size: 10px;
    letter-spacing: 0.04em;
  }

  .error-hero {
    padding: 16px 14px 14px;
  }

  .error-hero h1 {
    padding-right: 0;
    font-size: clamp(18px, 5.2vw, 22px);
    line-height: 1.02;
    letter-spacing: 0.04em;
    text-wrap: balance;
    overflow-wrap: normal;
    word-break: normal;
    -webkit-hyphens: none;
    hyphens: none;
  }

  .error-hero p {
    font-size: 14px;
  }

  .error-card {
    padding: 14px 12px;
  }

  .error-actions {
    align-items: stretch;
  }

  .error-actions .btn {
    flex: 1 1 100%;
    width: 100%;
  }
}

@media (max-width: 760px) and (min-width: 651px) {
  .topbar-inner {
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
    padding-bottom: 14px;
  }

  .brand {
    order: 1;
    width: auto;
    max-width: 100%;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .brand img {
    width: min(100%, 220px);
    height: 72px;
  }

  .brand .title {
    transform: translateY(16px);
    width: auto;
    max-width: min(100%, 430px);
    margin-left: 0;
  }

  nav.topnav {
    order: 2;
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
  }

  nav.topnav a,
  nav.topnav button.topnav-link {
    min-height: 36px;
    padding: 0 12px;
    font-size: 12px;
  }
}

@media (max-width: 1360px) and (min-width: 761px) {
  .topbar-inner {
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
  }

  .brand {
    flex: 1 1 auto;
    max-width: 100%;
    align-items: center;
  }

  .brand img {
    width: 220px;
    height: 78px;
  }

  .brand .title {
    position: static;
    transform: translateY(16px);
    margin-left: -8px;
    align-items: flex-start;
    text-align: left;
    max-width: min(100%, 520px);
  }

  .brand .title strong {
    font-size: 14px;
    letter-spacing: 0.12em;
  }

  .brand .title span {
    font-size: 12px;
    line-height: 1.15;
    white-space: normal;
  }

  .brand .title small {
    line-height: 1.15;
    white-space: normal;
  }

  nav.topnav {
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
    gap: 6px;
  }

  nav.topnav a,
  nav.topnav button.topnav-link {
    min-height: 36px;
    padding: 0 12px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }

  .btn,
  nav.topnav a,
  nav.topnav button.topnav-link {
    transition: none;
  }
}

/* Final light-theme hard overrides (keep at end to win cascade reliably). */
html[data-theme="light"] {
  --accent: #b1464e;
  --accent-2: #ca5d64;
  --accent-dark: #8d3239;
  --accent-soft: rgba(177, 70, 78, 0.1);
}

html[data-theme="light"]::before {
  background: linear-gradient(
    90deg,
    rgba(141, 50, 57, 0.58),
    rgba(177, 70, 78, 0.52),
    rgba(202, 93, 100, 0.52),
    rgba(141, 50, 57, 0.58)
  ) !important;
  box-shadow: 0 0 7px rgba(177, 70, 78, 0.14) !important;
}

html[data-theme="light"] nav.topnav a:hover,
html[data-theme="light"] nav.topnav a:focus-visible,
html[data-theme="light"] nav.topnav button.topnav-link:hover,
html[data-theme="light"] nav.topnav button.topnav-link:focus-visible,
html[data-theme="light"] nav.topnav a.is-active {
  border-color: rgba(177, 70, 78, 0.34) !important;
  background:
    linear-gradient(180deg, rgba(177, 70, 78, 0.09), rgba(177, 70, 78, 0.03)),
    linear-gradient(180deg, #f0f3f8, #e4e9f1) !important;
}

html[data-theme="light"] .hero {
  background:
    linear-gradient(140deg, rgba(177, 70, 78, 0.045), transparent 42%),
    linear-gradient(180deg, rgba(242, 245, 249, 0.95), rgba(232, 236, 243, 0.96)),
    linear-gradient(180deg, #eef2f7, #e4e9f1) !important;
}

html[data-theme="light"] .hero::before {
  background: linear-gradient(180deg, rgba(202, 93, 100, 0.82), rgba(141, 50, 57, 0.78)) !important;
  box-shadow: 0 0 8px rgba(177, 70, 78, 0.14) !important;
}

html[data-theme="light"] .hero::after {
  background:
    linear-gradient(120deg, transparent 0 36%, rgba(15, 23, 42, 0.03) 36% 40%, transparent 40% 100%),
    linear-gradient(120deg, transparent 0 52%, rgba(177, 70, 78, 0.04) 52% 56%, transparent 56% 100%) !important;
}

html[data-theme="light"] .card:not(.card-success)::after {
  background: radial-gradient(circle at 100% 0%, rgba(177, 70, 78, 0.07), transparent 70%) !important;
}

html[data-theme="light"] .portal-section-nav a.portal-section-nav-primary {
  border-color: rgba(177, 70, 78, 0.34) !important;
  background:
    linear-gradient(180deg, rgba(177, 70, 78, 0.12), rgba(177, 70, 78, 0.04)),
    rgba(228, 234, 243, 0.76) !important;
  color: #4f3237 !important;
}

html[data-theme="light"] .portal-section-nav a.portal-section-nav-primary:hover,
html[data-theme="light"] .portal-section-nav a.portal-section-nav-primary:focus-visible {
  border-color: rgba(177, 70, 78, 0.46) !important;
  background:
    linear-gradient(180deg, rgba(177, 70, 78, 0.16), rgba(177, 70, 78, 0.06)),
    rgba(231, 236, 245, 0.82) !important;
}

html[data-theme="light"] .card:not(.card-success),
html[data-theme="light"] .doc-group,
html[data-theme="light"] .doc-group-mobile-item,
html[data-theme="light"] .accordion-table,
html[data-theme="light"] .logbook-entry,
html[data-theme="light"] .status-item,
html[data-theme="light"] .workflow-step {
  border-color: rgba(17, 28, 45, 0.28) !important;
  background: rgba(227, 232, 240, 0.9) !important;
}

html[data-theme="light"] .card-success {
  border-color: var(--state-success-border) !important;
  background:
    linear-gradient(135deg, var(--success-tint), transparent 58%),
    linear-gradient(180deg, rgba(234, 239, 247, 0.96), rgba(221, 228, 239, 0.94)) !important;
}

html[data-theme="light"] .card-success::after {
  background: radial-gradient(circle at 100% 0%, var(--success-glow), transparent 70%) !important;
}

html[data-theme="light"] .card-success h2::before {
  background: linear-gradient(180deg, var(--success-dot-start), var(--success-dot-end)) !important;
  box-shadow: 0 0 8px var(--success-dot-shadow) !important;
}

html[data-theme="light"] .status-item {
  border-color: rgba(17, 28, 45, 0.34) !important;
  background:
    linear-gradient(180deg, rgba(233, 238, 246, 0.95), rgba(221, 228, 238, 0.94)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.62),
    0 4px 12px rgba(15, 23, 42, 0.1) !important;
}

html[data-theme="light"] .status-item::before {
  background: linear-gradient(90deg, transparent, rgba(15, 23, 42, 0.26), transparent) !important;
}

html[data-theme="light"] .status-item-accent {
  border-color: rgba(177, 70, 78, 0.44) !important;
  background:
    linear-gradient(135deg, rgba(177, 70, 78, 0.16), transparent 58%),
    linear-gradient(180deg, rgba(234, 239, 247, 0.96), rgba(221, 228, 239, 0.94)) !important;
}

html[data-theme="light"] .status-progress {
  border-color: rgba(177, 70, 78, 0.44) !important;
  background: rgba(194, 205, 221, 0.66) !important;
}

html[data-theme="light"] .status-progress > span {
  background: linear-gradient(90deg, #b1464e, #ca5d64) !important;
  box-shadow: 0 0 8px rgba(177, 70, 78, 0.24) !important;
}

html[data-theme="light"] .workflow-step {
  border-color: rgba(17, 28, 45, 0.34) !important;
  background:
    linear-gradient(180deg, rgba(231, 236, 244, 0.96), rgba(218, 225, 236, 0.95)) !important;
}

html[data-theme="light"] .workflow-step-current {
  border-color: var(--state-open-border) !important;
  background:
    linear-gradient(90deg, var(--state-open-soft), transparent 65%),
    linear-gradient(180deg, rgba(231, 236, 244, 0.97), rgba(218, 225, 236, 0.96)) !important;
}

html[data-theme="light"] .workflow-step-done {
  border-color: var(--state-success-border) !important;
}

html[data-theme="light"] .workflow-step-marker {
  border-color: rgba(15, 23, 42, 0.34) !important;
  background:
    linear-gradient(180deg, rgba(241, 244, 249, 0.95), rgba(220, 227, 237, 0.93)) !important;
  color: #1f2a3a !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 2px 6px rgba(15, 23, 42, 0.1) !important;
}

html[data-theme="light"] .workflow-step-done .workflow-step-marker {
  border-color: var(--state-success-border) !important;
  background: linear-gradient(180deg, var(--state-success-bg-start), var(--state-success-bg-end)) !important;
  color: var(--state-success-text) !important;
}

html[data-theme="light"] .workflow-step-current .workflow-step-marker {
  border-color: var(--state-open-border) !important;
  background: linear-gradient(180deg, var(--state-open-bg-start), var(--state-open-bg-end)) !important;
  color: var(--state-open-text) !important;
}

html[data-theme="light"] .workflow-step-head strong {
  color: #182233 !important;
}

html[data-theme="light"] .portal-notification-switch-track {
  border-color: rgba(15, 23, 42, 0.38) !important;
  background: linear-gradient(180deg, #dde5f0, #ccd7e6) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 1px 2px rgba(15, 23, 42, 0.12) !important;
}

html[data-theme="light"] .portal-notification-switch-thumb {
  background: #f9fcff !important;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.24) !important;
}

html[data-theme="light"] .portal-notification-switch input[type="checkbox"]:checked + .portal-notification-switch-track {
  border-color: rgba(23, 138, 74, 0.7) !important;
  background: linear-gradient(180deg, rgba(23, 138, 74, 0.5), rgba(23, 138, 74, 0.32)) !important;
}

html[data-theme="light"] .portal-notification-switch input[type="checkbox"]:checked + .portal-notification-switch-track .portal-notification-switch-thumb {
  background: #ffffff !important;
  box-shadow: 0 2px 7px rgba(8, 70, 38, 0.28) !important;
}

html[data-theme="light"] .portal-notification-switch input[type="checkbox"]:focus-visible + .portal-notification-switch-track {
  outline: 2px solid rgba(177, 70, 78, 0.64) !important;
}

html[data-theme="light"] .portal-notification-switch-label {
  color: #253244 !important;
}

html[data-theme="light"] .table {
  border-color: rgba(17, 28, 45, 0.3) !important;
  background: rgba(225, 231, 240, 0.94) !important;
}

html[data-theme="light"] .table th {
  background: rgba(206, 214, 226, 0.94) !important;
  color: #3c485c !important;
}

html[data-theme="light"] .table tbody tr:nth-child(even) {
  background: rgba(216, 224, 236, 0.85) !important;
}

html[data-theme="light"] .table tbody tr:hover {
  background:
    linear-gradient(90deg, rgba(177, 70, 78, 0.08), transparent 70%),
    rgba(205, 214, 228, 0.88) !important;
}

html[data-theme="light"] select,
html[data-theme="light"] #upload-kind,
html[data-theme="light"] .event-type-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  color: #1a2331 !important;
  border: 1px solid rgba(15, 23, 42, 0.5) !important;
  background-color: #e8ecf2 !important;
  background-image:
    linear-gradient(45deg, transparent 50%, #596375 50%),
    linear-gradient(135deg, #596375 50%, transparent 50%),
    linear-gradient(180deg, #f8f9fb, #e0e6ef) !important;
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px),
    0 0 !important;
  background-size: 6px 6px, 6px 6px, 100% 100% !important;
  background-repeat: no-repeat !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.74),
    0 1px 0 rgba(15, 23, 42, 0.1) !important;
}

html[data-theme="light"] select:hover,
html[data-theme="light"] #upload-kind:hover,
html[data-theme="light"] .event-type-select:hover {
  border-color: rgba(15, 23, 42, 0.62) !important;
}

html[data-theme="light"] select:focus,
html[data-theme="light"] #upload-kind:focus,
html[data-theme="light"] .event-type-select:focus {
  border-color: rgba(177, 70, 78, 0.64) !important;
  box-shadow:
    0 0 0 3px rgba(177, 70, 78, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.76) !important;
}

html[data-theme="light"] select option,
html[data-theme="light"] select optgroup {
  color: #1b2534 !important;
  background: #f2f5f9 !important;
}

html[data-theme="light"] select option:checked {
  color: #121a27 !important;
  background: #d2dbe8 !important;
}

html[data-theme="light"] .badge {
  border-color: rgba(15, 23, 42, 0.38) !important;
  background: rgba(213, 221, 233, 0.94) !important;
  color: #2a384c !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.66) !important;
}

html[data-theme="light"] .badge-neutral {
  border-color: rgba(15, 23, 42, 0.4) !important;
  background: linear-gradient(180deg, rgba(220, 227, 237, 0.94), rgba(206, 215, 228, 0.9)) !important;
  color: #273546 !important;
}

html[data-theme="light"] .badge-accent {
  border-color: var(--state-open-border) !important;
  background: linear-gradient(180deg, var(--state-open-bg-start), var(--state-open-bg-end)) !important;
  color: var(--state-open-text) !important;
}

html[data-theme="light"] .badge-success {
  border-color: var(--state-success-border) !important;
  background: linear-gradient(180deg, var(--state-success-bg-start), var(--state-success-bg-end)) !important;
  color: var(--state-success-text) !important;
}

html[data-theme="light"] .badge-danger {
  border-color: var(--state-open-border) !important;
  background: linear-gradient(180deg, var(--state-open-bg-start), var(--state-open-bg-end)) !important;
  color: var(--state-open-text) !important;
}

html[data-theme="light"] .workflow-state-badge {
  border-color: var(--state-open-border) !important;
  background: linear-gradient(180deg, var(--state-open-bg-start), var(--state-open-bg-end)) !important;
  color: var(--state-open-text) !important;
}

html[data-theme="light"] .workflow-state-badge-done {
  border-color: var(--state-success-border) !important;
  background: linear-gradient(180deg, var(--state-success-bg-start), var(--state-success-bg-end)) !important;
  color: var(--state-success-text) !important;
}

html[data-theme="light"] .btn {
  border-color: rgba(15, 23, 42, 0.32) !important;
  background: linear-gradient(180deg, #f2f5f9, #e1e7f0) !important;
  color: #1a2432 !important;
}

html[data-theme="light"] .btn:hover,
html[data-theme="light"] .btn:focus-visible {
  border-color: rgba(15, 23, 42, 0.42) !important;
  background: linear-gradient(180deg, #f8fafd, #dde4ef) !important;
}

html[data-theme="light"] .btn-primary {
  border-color: rgba(177, 70, 78, 0.68) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02)),
    linear-gradient(180deg, rgba(187, 77, 85, 0.9), rgba(141, 50, 57, 0.9)) !important;
  color: #ffffff !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 6px 14px rgba(86, 30, 36, 0.26) !important;
}

html[data-theme="light"] .btn-primary:hover,
html[data-theme="light"] .btn-primary:focus-visible {
  border-color: rgba(177, 70, 78, 0.78) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.03)),
    linear-gradient(180deg, rgba(197, 88, 96, 0.93), rgba(151, 56, 64, 0.93)) !important;
}

html[data-theme="light"] .payment-link-action {
  border-color: rgba(177, 70, 78, 0.34) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.44)),
    linear-gradient(180deg, rgba(244, 231, 232, 0.96), rgba(233, 219, 221, 0.94)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.68),
    0 4px 12px rgba(86, 30, 36, 0.12) !important;
}

html[data-theme="light"] .payment-link-action:hover,
html[data-theme="light"] .payment-link-action:focus-visible {
  border-color: rgba(177, 70, 78, 0.48) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.52)),
    linear-gradient(180deg, rgba(248, 236, 237, 0.98), rgba(238, 224, 226, 0.96)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.76),
    0 6px 14px rgba(86, 30, 36, 0.14) !important;
}

html[data-theme="light"] .btn-danger {
  border-color: rgba(163, 49, 58, 0.76) !important;
  background:
    linear-gradient(180deg, rgba(171, 51, 61, 0.94), rgba(130, 35, 43, 0.94)) !important;
  color: #fff8f8 !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 8px 16px rgba(81, 19, 26, 0.28) !important;
}

html[data-theme="light"] .btn-danger:hover,
html[data-theme="light"] .btn-danger:focus-visible {
  border-color: rgba(163, 49, 58, 0.82) !important;
  background:
    linear-gradient(180deg, rgba(183, 58, 68, 0.95), rgba(138, 38, 46, 0.95)) !important;
}

html[data-theme="light"] .muted,
html[data-theme="light"] .portal-panel-title,
html[data-theme="light"] .payment-detail-label,
html[data-theme="light"] .payment-invoice-entry-label {
  color: #344054 !important;
}

html[data-theme="light"] .flash:not(.flash-success) {
  border-color: var(--state-open-border) !important;
  background:
    linear-gradient(180deg, var(--state-open-bg-start), var(--state-open-bg-end)),
    rgba(234, 239, 246, 0.92) !important;
  color: #263142 !important;
}

html[data-theme="light"] canvas.signature.signature-invalid {
  border-color: rgba(185, 28, 28, 0.62);
  box-shadow:
    0 0 0 3px rgba(220, 38, 38, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

html[data-theme="light"] .portal-signature-validation-message {
  color: #b91c1c;
}

html[data-theme="light"] .payment-step {
  border-color: rgba(15, 23, 42, 0.34) !important;
  background:
    linear-gradient(180deg, rgba(223, 230, 240, 0.97), rgba(205, 214, 228, 0.95)),
    rgba(214, 222, 234, 0.95) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.52),
    0 2px 8px rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="light"] .payment-step > summary {
  background:
    linear-gradient(180deg, rgba(205, 214, 227, 0.92), rgba(196, 206, 220, 0.88)) !important;
}

html[data-theme="light"] .payment-step > summary::after {
  color: #2f3e52 !important;
}

html[data-theme="light"] .payment-step-title {
  color: #1a2535 !important;
}

html[data-theme="light"] .payment-step-body {
  border-top-color: rgba(15, 23, 42, 0.24) !important;
  background: rgba(230, 236, 245, 0.84) !important;
}

html[data-theme="light"] .payment-invoice-entry {
  border-color: rgba(15, 23, 42, 0.28) !important;
  background: rgba(219, 227, 238, 0.9) !important;
}

html[data-theme="light"] .payment-invoice-entry > summary::after {
  color: #2f3e52 !important;
}

html[data-theme="light"] .payment-invoice-entry-link a,
html[data-theme="light"] .payment-detail-value {
  color: #182334 !important;
}

html[data-theme="light"] .payment-invoice-entry-body {
  border-top-color: rgba(15, 23, 42, 0.24) !important;
  background: rgba(228, 234, 243, 0.72) !important;
}

html[data-theme="light"] .payment-details-card {
  border-color: rgba(15, 23, 42, 0.3) !important;
  background:
    linear-gradient(180deg, rgba(210, 220, 233, 0.94), rgba(202, 214, 228, 0.92)) !important;
}

html[data-theme="light"] .payment-detail-item {
  border-color: rgba(15, 23, 42, 0.24) !important;
  background: rgba(236, 241, 248, 0.95) !important;
}

/* Keep photo info overlays in visual sync with the light theme. */
html[data-theme="light"] .photo-info-btn {
  border-color: rgba(15, 23, 42, 0.32) !important;
  background: linear-gradient(180deg, rgba(245, 248, 253, 0.98), rgba(222, 230, 241, 0.95)) !important;
  color: #1f2b3c !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 4px 10px rgba(15, 23, 42, 0.16) !important;
}

html[data-theme="light"] .photo-meta[open] .photo-info-btn {
  border-color: rgba(177, 70, 78, 0.5) !important;
  background:
    linear-gradient(180deg, rgba(177, 70, 78, 0.12), rgba(177, 70, 78, 0.05)),
    linear-gradient(180deg, rgba(245, 248, 253, 0.99), rgba(225, 232, 243, 0.96)) !important;
  color: #662b31 !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 6px 12px rgba(15, 23, 42, 0.2) !important;
}

html[data-theme="light"] .photo-meta-panel {
  border-color: rgba(15, 23, 42, 0.28) !important;
  background:
    linear-gradient(145deg, rgba(177, 70, 78, 0.08), transparent 52%),
    linear-gradient(180deg, rgba(241, 245, 251, 0.98), rgba(223, 231, 242, 0.96)) !important;
  box-shadow:
    0 18px 40px rgba(15, 23, 42, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.78) !important;
}

html[data-theme="light"] .photo-meta-close {
  border-color: rgba(15, 23, 42, 0.3) !important;
  background: linear-gradient(180deg, rgba(247, 249, 253, 0.96), rgba(225, 232, 243, 0.94)) !important;
  color: #273449 !important;
}

html[data-theme="light"] .photo-meta-close:hover,
html[data-theme="light"] .photo-meta-close:focus-visible {
  border-color: rgba(177, 70, 78, 0.46) !important;
  background:
    linear-gradient(180deg, rgba(177, 70, 78, 0.12), rgba(177, 70, 78, 0.05)),
    linear-gradient(180deg, rgba(247, 249, 253, 0.98), rgba(227, 234, 244, 0.95)) !important;
  color: #662b31 !important;
}

html[data-theme="light"] .photo-meta-label {
  color: #566174 !important;
}

html[data-theme="light"] .photo-meta-value,
html[data-theme="light"] .photo-meta-empty {
  color: #1b2738 !important;
}

/* Global frame harmonization:
   Keep disclosure/card containers visually consistent across light and dark
   while reducing dark-theme border prominence project-wide. */
.card:not(.card-success),
.card.admin-index-disclosure,
.portal-quicknav summary,
.portal-panel > summary,
.doc-group,
.doc-group-mobile-item,
.photo-upload-assignment-disclosure,
.photo-album-admin-tools,
.photo-album-block,
.accordion-table,
.accordion-row,
.payment-details-card {
  border-color: var(--frame-border-subtle) !important;
}

.doc-group-body,
.photo-upload-assignment-body,
.photo-album-create-disclosure[open] > summary,
.accordion-row,
.accordion-row-body {
  border-top-color: var(--frame-divider-subtle) !important;
}

.accordion-table-head {
  border-bottom-color: var(--frame-divider-subtle) !important;
}

/* Keep active/open section cues in accent colors after the global harmonization. */
.portal-quicknav[open] summary,
.portal-panel[open] > summary {
  border-color: rgba(255, 45, 55, 0.34) !important;
}

html[data-theme="light"] .portal-quicknav[open] summary,
html[data-theme="light"] .portal-panel[open] > summary {
  border-color: rgba(177, 70, 78, 0.4) !important;
}
