﻿/*
  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);

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

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

  --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;

  --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;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  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;
}

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);
}

header.topbar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  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);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  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: screen;
}

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

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

.brand .title span {
  margin-top: 3px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  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: 4px;
  color: var(--muted-2);
  font-family: var(--font-head);
  font-size: 11px;
  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;
}

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 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);
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 20px 36px;
}

.hero {
  position: relative;
  overflow: hidden;
  margin: 4px 0 18px;
  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;
}

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

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

.card {
  position: relative;
  overflow: hidden;
  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;
}

.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);
}

.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, 45, 55, 0.55);
  background:
    linear-gradient(180deg, rgba(255, 45, 55, 0.97), rgba(173, 14, 25, 0.95));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 8px 18px rgba(159, 10, 20, 0.35);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  border-color: rgba(255, 87, 97, 0.8);
  background:
    linear-gradient(180deg, rgba(255, 66, 77, 0.98), rgba(191, 15, 28, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 10px 22px rgba(159, 10, 20, 0.42);
}

.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));
}

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));
}

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;
}

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%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

.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 th.table-col-actions {
  width: 1%;
}

.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;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge-accent {
  border-color: rgba(255, 45, 55, 0.45);
  background:
    linear-gradient(180deg, rgba(209, 15, 30, 0.2), rgba(209, 15, 30, 0.1));
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.flash {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 45, 55, 0.4);
  background:
    linear-gradient(180deg, rgba(209, 15, 30, 0.16), rgba(209, 15, 30, 0.09));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.changelog-toggle {
  list-style: none;
  cursor: pointer;
  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-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;
}

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);
}

.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-section-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px;
}

.portal-section-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  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: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.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;
}

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

.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::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, 1.15fr) minmax(0, 0.85fr);
  align-items: start;
}

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

.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.card-accent {
  background:
    linear-gradient(135deg, rgba(209, 15, 30, 0.1), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.008) 45%),
    linear-gradient(180deg, #151a20, #11161b);
}

.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: rgba(255, 45, 55, 0.28);
  background:
    linear-gradient(90deg, rgba(209, 15, 30, 0.08), transparent 60%),
    rgba(255, 255, 255, 0.015);
}

.workflow-step-done {
  border-color: rgba(34, 197, 94, 0.15);
}

.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: rgba(34, 197, 94, 0.25);
  color: #d6ffe5;
  background: rgba(34, 197, 94, 0.12);
}

.workflow-step-current .workflow-step-marker {
  border-color: rgba(255, 45, 55, 0.4);
  color: #fff;
  background: rgba(209, 15, 30, 0.18);
}

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

.workflow-step-head {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

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

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

.workflow-state-badge {
  color: var(--muted);
}

.workflow-state-badge-done {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.12);
  color: #dbffe8;
}

.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;
  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;
}

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

.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;
}

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

.doc-group summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
}

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

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

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

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

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

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

.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;
}

/* KIS-like payment/rechnung split layout (current scope, provider-agnostic) */
.payment-checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 12px;
}

.payment-panel {
  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);
  padding: 12px;
}

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

.payment-panel-head h3 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.invoice-summary-box {
  border-radius: 12px;
  border: 1px solid rgba(255, 45, 55, 0.18);
  background:
    linear-gradient(135deg, rgba(209, 15, 30, 0.08), transparent 58%),
    rgba(255, 255, 255, 0.015);
  padding: 12px;
  margin-bottom: 10px;
}

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

.invoice-summary-title {
  margin-top: 6px;
  color: var(--text);
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.invoice-summary-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.kv-list {
  margin: 0;
  display: grid;
  gap: 8px;
}

.kv-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.kv-list > div:first-child {
  padding-top: 0;
  border-top: none;
}

.kv-list dt {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.kv-list dd {
  margin: 0;
  color: var(--text);
  font-weight: 600;
  text-align: right;
}

.payment-kv-list dd {
  overflow-wrap: anywhere;
}

.payment-kv-list > div {
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

.payment-kv-list dd {
  text-align: left;
}

.payment-tab-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.payment-tab-trigger {
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.15;
  text-transform: uppercase;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.payment-tab-trigger:hover,
.payment-tab-trigger:focus-visible {
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--text);
  outline: none;
}

.payment-tab-trigger.is-active {
  border-color: rgba(255, 45, 55, 0.38);
  color: #fff;
  background:
    linear-gradient(180deg, rgba(209, 15, 30, 0.18), rgba(209, 15, 30, 0.08)),
    rgba(255, 255, 255, 0.02);
}

.payment-tab-panel {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.01);
  padding: 10px;
}

.payment-tab-panel p:last-child {
  margin-bottom: 0;
}

.payment-method-grid {
  display: grid;
  gap: 8px;
}

.payment-method-card {
  display: block;
  cursor: pointer;
}

.payment-method-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.payment-method-card-content {
  display: grid;
  gap: 3px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.012);
  padding: 10px;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.payment-method-card:hover .payment-method-card-content {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.02);
}

.payment-method-card input[type="radio"]:focus-visible + .payment-method-card-content {
  border-color: rgba(255, 45, 55, 0.35);
  box-shadow: 0 0 0 3px rgba(209, 15, 30, 0.12);
}

.payment-method-card input[type="radio"]:checked + .payment-method-card-content {
  border-color: rgba(255, 45, 55, 0.35);
  background:
    linear-gradient(90deg, rgba(209, 15, 30, 0.08), transparent 62%),
    rgba(255, 255, 255, 0.02);
  transform: translateY(-1px);
}

.payment-method-card-title {
  color: var(--text);
  font-weight: 600;
}

.payment-method-card-note {
  color: var(--muted);
  font-size: 12px;
}

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;
}

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

@media (max-width: 760px) {
  .topbar-inner {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px 12px;
    padding-top: 12px;
    padding-bottom: 14px;
  }

  .brand {
    width: 100%;
    max-width: 100%;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    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(16px);
    pointer-events: none;
    align-items: flex-start;
    text-align: left;
    width: auto;
    max-width: min(100%, 430px);
    margin-left: 4px;
  }

  .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: 18px;
  }

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

  .card {
    padding: 14px;
  }

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

  /* Keep row actions reachable while the table content scrolls horizontally. */
  .table-scroll .table th.table-col-actions,
  .table-scroll .table td.table-cell-actions {
    position: sticky;
    right: 0;
    box-shadow: -12px 0 14px -12px rgba(0, 0, 0, 0.85);
  }

  .table-scroll .table th.table-col-actions {
    background:
      linear-gradient(180deg, rgba(20, 24, 30, 0.98), rgba(15, 19, 24, 0.96));
    z-index: 3;
  }

  .table-scroll .table td.table-cell-actions {
    background: rgba(14, 18, 23, 0.96);
    z-index: 2;
  }

  .row {
    gap: 8px;
  }

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

  .portal-section-nav {
    padding: 10px;
  }

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

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

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

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

  .payment-checkout-grid {
    grid-template-columns: 1fr;
  }

  .payment-tab-list {
    grid-template-columns: 1fr;
  }

  .kv-list > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .kv-list dd {
    text-align: left;
  }

  .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;
  }

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

@media (max-width: 680px) {
  .portal-section-nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .portal-section-nav a {
    width: 100%;
    justify-content: flex-start;
  }

  .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%;
  }

  .doc-group-body .table-scroll {
    display: none;
  }

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

@media (max-width: 620px) {
  .brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .brand .title {
    transform: none;
    width: 100%;
    margin-left: 0;
  }
}

@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: 10px;
  }

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

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

  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: 4px;
    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;
  }
}
