:root {
  --teal: #0e97ad;
  --sky: #0ea5e9;
  --light: #b0cfe5;
  --navy: #2a314d;
  --deep: #0b162a;
  --bg: #020617;
  --bg-2: #1a2235;
  --bg-3: #1e2c42;
  --text: #e8eef5;
  --text-muted: #7a91ab;
  --border: rgba(176, 207, 229, 0.12);
  --glow: rgba(14, 151, 173, 0.18);
  --accent: var(--teal);
  --accent-2: var(--sky);
  --input-bg: #1e2c42;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --grid-color: rgba(14, 151, 173, 0.035);
  --success: #22c55e;
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --button-secondary-bg: rgba(14, 151, 173, 0.18);
  --button-secondary-bg-hover: rgba(14, 151, 173, 0.28);
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --header-height: 56px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #eef4fa;
  --bg-2: #ffffff;
  --bg-3: #e2ecf5;
  --text: #0f1c2e;
  --text-muted: #4e6680;
  --border: rgba(14, 97, 150, 0.13);
  --glow: rgba(14, 151, 173, 0.13);
  --accent: #0a7d94;
  --accent-2: #0284c7;
  --input-bg: #f5f9fd;
  --shadow: 0 4px 24px rgba(14, 60, 120, 0.1);
  --shadow-sm: 0 2px 10px rgba(14, 60, 120, 0.08);
  --grid-color: rgba(14, 97, 173, 0.045);
  --danger: #b91c1c;
  --danger-bg: rgba(185, 28, 28, 0.08);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.1);
  --button-secondary-bg: rgba(14, 151, 173, 0.12);
  --button-secondary-bg-hover: rgba(14, 151, 173, 0.2);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(14, 151, 173, 0.2), transparent 30%),
    radial-gradient(circle at bottom left, rgba(14, 165, 233, 0.12), transparent 25%),
    var(--bg);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: -1;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--header-height);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
}

.header-inner {
  width: min(1180px, calc(100% - 32px));
  min-height: var(--header-height);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

body.page-width-wide .header-inner {
  width: min(1380px, calc(100% - 32px));
}

body.page-width-inbox .header-inner {
  width: min(1400px, 100%);
  padding: 0 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-link {
  display: inline-flex;
  align-items: baseline;
}

.brand-desktop {
  color: var(--text);
}

.brand-accent {
  color: var(--sky);
}

.brand-separator {
  color: var(--text-muted);
  margin: 0 8px;
}

.theme-toggle {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-2) 78%, transparent);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  min-width: 112px;
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--teal);
  transform: translateY(-1px);
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: color 0.2s ease, transform 0.2s ease;
}

.btn-logout:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.user-display {
  color: var(--text-muted);
  font-size: 13px;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
}

.login-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  margin-bottom: 10px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.login-form {
  display: grid;
  gap: 18px;
}

.login-submit {
  width: 100%;
}

.form-error {
  min-height: 20px;
  color: #f87171;
  font-size: 13px;
}

.page-head {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.page-head h1,
.page-head h2,
.section-title {
  margin: 0;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.page-head p,
.section-copy,
.muted {
  margin: 8px 0 0;
  color: var(--text-muted);
}

.stack {
  display: grid;
  gap: 24px;
}

.grid-2,
.stat-grid,
.card-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  box-shadow: var(--shadow);
  animation: fadeUp 0.4s ease both;
}

.card-clickable {
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card-clickable:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--teal) 55%, var(--border));
  box-shadow:
    0 0 0 1px var(--glow),
    var(--shadow);
}

.card-muted {
  opacity: 0.7;
}

.card-icon {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(14, 151, 173, 0.22), rgba(14, 165, 233, 0.12));
  color: var(--accent-2);
  margin-bottom: 18px;
  font-size: 22px;
}

.kpi-value {
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.kpi-label {
  color: var(--text-muted);
  margin-top: 6px;
}

.button-row,
.table-actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.table-actions--stack {
  flex-direction: column;
  align-items: stretch;
  min-width: 136px;
}

.table-actions--stack > .btn {
  width: 100%;
  min-width: 136px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  padding: 10px 14px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 500;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.btn-sm {
  padding: 5px 16px;
  font-size: 12.5px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--sky);
  color: #ffffff;
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--sky) 88%, white);
}

.btn-secondary {
  background: var(--button-secondary-bg);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--button-secondary-bg-hover);
  border-color: var(--teal);
  color: var(--teal);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: transparent;
  color: #f87171;
}

.btn-danger:hover {
  border-color: rgba(248, 113, 113, 0.4);
}

.icon-btn {
  width: 42px;
  min-width: 42px;
  padding: 10px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-2) 92%, transparent);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--bg-3);
}

th {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--text-muted);
  text-align: left;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--teal) 4%, transparent);
}

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

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.badge--geplant,
.badge--angemeldet {
  color: var(--teal);
  background: rgba(14, 151, 173, 0.12);
}

.badge--anbahnung {
  color: var(--sky);
  background: rgba(14, 165, 233, 0.14);
}

.badge--durchgeführt,
.badge--erstattet {
  color: var(--text-muted);
  background: rgba(122, 145, 171, 0.16);
}

.badge--abgesagt,
.badge--storniert {
  color: #f87171;
  background: rgba(239, 68, 68, 0.12);
}

.badge--warteliste,
.badge--offen {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.14);
}

.badge--teilgenommen,
.badge--bezahlt {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.12);
}

.badge--seminar-id {
  color: var(--accent-2);
  background: rgba(14, 165, 233, 0.14);
}

.hint-text {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.form-layout {
  display: grid;
  gap: 24px;
}

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

.field-grid--top-align {
  align-items: start;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field--full {
  grid-column: 1 / -1;
}

label,
.field-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

input,
select,
textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14, 151, 173, 0.12);
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  min-height: 48px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  accent-color: var(--teal);
}

.empty-state,
.loading-state,
.error-state {
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  color: var(--text-muted);
  text-align: center;
  background: color-mix(in srgb, var(--bg-2) 84%, transparent);
}

.error-state {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
}

.loading-state::after {
  content: "";
  display: block;
  width: 26px;
  height: 26px;
  margin: 14px auto 0;
  border: 3px solid rgba(14, 151, 173, 0.12);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.detail-item {
  display: grid;
  gap: 6px;
}

.detail-item dt {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.detail-item dd {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.context-line {
  margin-top: 10px;
  color: var(--text-muted);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.subtle-link {
  color: var(--accent-2);
}

.subtle-link:hover {
  text-decoration: underline;
}

.inline-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.surface-note {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-3) 70%, transparent);
  color: var(--text-muted);
}

.page-shell--wide {
  width: min(1380px, calc(100% - 32px));
}

.toolbar-search {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.toolbar-search-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.search-shell {
  flex: 1 1 300px;
  position: relative;
}

.search-shell input {
  padding-left: 44px;
}

.search-shell::before {
  content: "⌕";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  pointer-events: none;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar-divider {
  width: 1px;
  min-height: 30px;
  background: var(--border);
}

.toolbar-link-action {
  min-height: 40px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-3) 68%, transparent);
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.filter-chip:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--teal) 64%, var(--border));
  color: var(--text);
}

.filter-chip.is-active {
  border-color: var(--teal);
  color: var(--text);
  background: rgba(14, 151, 173, 0.14);
  box-shadow: 0 0 0 1px rgba(14, 151, 173, 0.15);
}

.table-row-clickable {
  cursor: pointer;
}

.table-row-clickable td:first-child strong {
  transition: color 0.2s ease;
}

.table-row-clickable:hover td:first-child strong {
  color: var(--accent-2);
}

.table-cell-stack {
  display: grid;
  gap: 8px;
}

.badge-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge--role-seminaranbieter {
  color: var(--teal);
  background: rgba(14, 151, 173, 0.16);
}

.badge--role-inhouse {
  color: var(--sky);
  background: rgba(14, 165, 233, 0.18);
}

.badge--role-beratung {
  color: var(--light);
  background: rgba(122, 145, 171, 0.22);
}

.badge--state-active {
  color: var(--success);
  background: rgba(34, 197, 94, 0.14);
}

.badge--state-inactive {
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.16);
}

.badge--main-contact {
  color: #f8fafc;
  background: linear-gradient(135deg, rgba(14, 151, 173, 0.75), rgba(14, 165, 233, 0.75));
}

.badge--short {
  min-height: 24px;
  padding: 4px 8px;
  font-size: 11px;
}

.empty-state strong,
.error-state strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
}

.detail-layout {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  align-items: start;
}

.detail-column {
  display: grid;
  gap: 24px;
  min-width: 0;
}

.detail-hero {
  display: grid;
  gap: 16px;
}

.detail-hero-top {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.detail-hero h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

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

.status-line .muted {
  margin: 0;
}

.detail-card-header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

.detail-card-header h2,
.detail-card-header h3 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.detail-card-header p {
  margin: 8px 0 0;
  color: var(--text-muted);
}

.address-block {
  display: grid;
  gap: 3px;
  font-size: 16px;
  line-height: 1.7;
}

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

.meta-item {
  display: grid;
  gap: 6px;
}

.meta-item dt {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.meta-item dd {
  margin: 0;
  line-height: 1.55;
}

.warning-banner {
  position: relative;
  overflow: hidden;
  padding: 20px 22px;
  border-radius: 18px;
  border: 1px solid rgba(245, 158, 11, 0.32);
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(249, 115, 22, 0.12)),
    var(--warning-bg);
  box-shadow: var(--shadow-sm);
}

.warning-banner::after {
  content: "";
  position: absolute;
  inset: auto -30px -30px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(249, 115, 22, 0.12);
}

.warning-banner-header {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.warning-banner-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  color: var(--warning);
  font-size: 18px;
}

.warning-banner p {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--text);
  line-height: 1.65;
}

.warning-banner--archived {
  border-color: rgba(148, 163, 184, 0.34);
  background:
    linear-gradient(135deg, rgba(148, 163, 184, 0.18), rgba(239, 68, 68, 0.1)),
    color-mix(in srgb, var(--bg-3) 78%, transparent);
}

.warning-banner--archived::after {
  background: rgba(148, 163, 184, 0.12);
}

.warning-banner--archived .warning-banner-icon {
  color: #f87171;
}

.contact-list {
  display: grid;
  gap: 14px;
}

.contact-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-3) 62%, transparent);
}

.contact-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: flex-start;
}

.contact-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.contact-meta {
  display: grid;
  gap: 6px;
  color: var(--text-muted);
}

.inline-form-card,
.inline-editor {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 16px;
  border: 1px dashed color-mix(in srgb, var(--teal) 42%, var(--border));
  background: color-mix(in srgb, var(--bg-3) 70%, transparent);
}

.inline-editor.is-hidden,
.inline-form-card.is-hidden,
.model-block.is-hidden {
  display: none;
}

.toggle-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
}

.toggle-copy {
  display: grid;
  gap: 4px;
}

.toggle-copy strong {
  font-size: 14px;
}

.toggle-copy span {
  color: var(--text-muted);
  font-size: 13px;
}

.toggle-switch {
  position: relative;
  display: inline-flex;
  width: 52px;
  height: 30px;
}

.toggle-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.toggle-switch span {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 35%, var(--bg-3));
  border: 1px solid var(--border);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.toggle-switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}

.toggle-switch input:checked + span {
  background: linear-gradient(135deg, rgba(14, 151, 173, 0.68), rgba(14, 165, 233, 0.68));
  border-color: rgba(14, 151, 173, 0.42);
}

.toggle-switch input:checked + span::after {
  transform: translateX(22px);
}

.rich-empty {
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: 16px;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  background: color-mix(in srgb, var(--bg-2) 80%, transparent);
}

.rich-empty strong {
  color: var(--text);
}

.tagessatz-summary {
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.detail-disclosure {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-3) 66%, transparent);
}

.detail-disclosure summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 16px;
  font-weight: 700;
}

.detail-disclosure summary::-webkit-details-marker {
  display: none;
}

.detail-disclosure p {
  margin: 0;
  padding: 0 16px 16px;
  color: var(--text-muted);
  line-height: 1.65;
}

.detail-subline {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 18px;
}

.detail-kicker {
  margin: 0;
  color: var(--text-muted);
}

.detail-card-stack {
  display: grid;
  gap: 16px;
}

.detail-value {
  font-size: 18px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.detail-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: color-mix(in srgb, var(--bg-3) 64%, transparent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-action {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.preserve-whitespace {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.segmented-choice {
  display: grid;
  gap: 10px;
}

.segmented-choice--inline {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segmented-choice label {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-3) 68%, transparent);
  cursor: pointer;
}

.segmented-choice input {
  margin-top: 2px;
}

.segmented-choice strong {
  display: block;
  margin-bottom: 4px;
}

.segmented-choice span {
  color: var(--text-muted);
  font-size: 14px;
}

.field-help {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.inline-select {
  min-width: 180px;
}

.sticky-footer-bar {
  position: sticky;
  bottom: 18px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-2) 88%, transparent);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.section-divider::before {
  content: "";
  width: 44px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), transparent);
}

.section-divider span {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.grid-aside {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
}

.helper-copy {
  color: var(--text-muted);
  line-height: 1.65;
}

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: grid;
  gap: 12px;
  width: min(360px, calc(100% - 24px));
}

.toast {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-2) 88%, transparent);
  box-shadow: var(--shadow);
  animation: fadeUp 0.25s ease both;
}

.toast strong {
  display: block;
  margin-bottom: 4px;
}

.toast p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.55;
}

.toast--success {
  border-color: rgba(34, 197, 94, 0.28);
}

.toast--error {
  border-color: rgba(248, 113, 113, 0.28);
}

.toast--error strong {
  color: #fca5a5;
}

.toast--success strong {
  color: #86efac;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(10px);
  z-index: 50;
}

.modal {
  width: min(460px, 100%);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 24px;
  animation: fadeUp 0.25s ease both;
}

.modal h3 {
  margin: 0 0 8px;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.modal p {
  margin: 0 0 20px;
  color: var(--text-muted);
  line-height: 1.55;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .page-head,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .grid-2,
  .grid-3,
  .stat-grid,
  .card-grid,
  .field-grid,
  .field-grid-3,
  .detail-grid,
  .detail-layout,
  .meta-grid,
  .grid-aside,
  .segmented-choice--inline {
    grid-template-columns: 1fr;
  }

  .sticky-footer-bar {
    bottom: 10px;
    justify-content: stretch;
  }
}

@media (max-width: 720px) {
  .app-header {
    height: auto;
  }

  .header-inner {
    width: 100%;
    min-height: var(--header-height);
    padding: 10px 16px;
    align-items: flex-start;
  }

  .brand {
    font-size: 17px;
    flex-wrap: wrap;
  }

  .header-actions {
    align-self: center;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .page-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 24px;
  }

  .card {
    padding: 22px;
  }

  th,
  td {
    padding: 12px;
  }
}


.signature-preview {
  border: 1px dashed var(--border);
  border-radius: 20px;
  padding: 18px;
  background: color-mix(in srgb, var(--input-bg) 84%, transparent);
}

.signature-preview.is-empty {
  color: var(--text-muted);
}

.signature-preview h3 {
  margin: 0 0 8px;
}

.preview-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.preview-item {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.preview-item strong {
  display: block;
  margin-bottom: 4px;
}

.inline-note {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.address-stack {
  display: grid;
  gap: 4px;
}

.toolbar-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.form-section-copy {
  margin: 0 0 14px;
  color: var(--text-muted);
}
