/* ==========================================================
   Mandanten — Design Tokens
   ========================================================== */
:root {
  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "SF Pro Text",
    "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Light surfaces */
  --bg: oklch(0.985 0.002 260);
  --surface: #ffffff;
  --surface-2: oklch(0.975 0.003 260);
  --surface-hover: oklch(0.965 0.003 260);
  --border: oklch(0.92 0.004 260);
  --border-strong: oklch(0.86 0.005 260);

  /* Text */
  --text: oklch(0.22 0.01 260);
  --text-muted: oklch(0.48 0.01 260);
  --text-subtle: oklch(0.62 0.008 260);
  --text-on-dark: oklch(0.95 0.005 260);
  --text-on-dark-muted: oklch(0.68 0.01 260);

  /* Sidebar (dark) */
  --side-bg: oklch(0.21 0.008 260);
  --side-bg-2: oklch(0.235 0.008 260);
  --side-border: oklch(0.28 0.008 260);
  --side-hover: oklch(0.27 0.01 260);
  --side-active-bg: oklch(0.32 0.04 270);
  --side-active-fg: oklch(0.98 0.005 260);

  /* Accent — Indigo */
  --accent: oklch(0.55 0.18 270);
  --accent-hover: oklch(0.50 0.19 270);
  --accent-soft: oklch(0.96 0.03 270);
  --accent-soft-fg: oklch(0.42 0.16 270);
  --accent-ring: oklch(0.55 0.18 270 / 0.25);

  /* Status (subtle) */
  --green: oklch(0.55 0.10 155);
  --green-soft: oklch(0.96 0.03 155);
  --orange: oklch(0.65 0.12 60);
  --orange-soft: oklch(0.97 0.04 70);
  --blue: oklch(0.55 0.12 245);
  --blue-soft: oklch(0.96 0.03 245);
  --gray: oklch(0.55 0.005 260);
  --gray-soft: oklch(0.95 0.003 260);

  /* Hint box */
  --hint-bg: oklch(0.97 0.025 245);
  --hint-border: oklch(0.88 0.04 245);
  --hint-fg: oklch(0.38 0.10 245);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.04), 0 1px 3px rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 12px rgb(0 0 0 / 0.06), 0 1px 3px rgb(0 0 0 / 0.04);
  --shadow-lg: 0 16px 40px rgb(0 0 0 / 0.12), 0 4px 12px rgb(0 0 0 / 0.06);

  /* Radii */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-xl: 14px;
}

* { box-sizing: border-box; }

html, body, #root {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----------------------------------------------------------
   App shell
   ---------------------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  height: 100vh;
  overflow: hidden;
}
.app--login { display: block; }

.sidebar {
  background: var(--side-bg);
  color: var(--text-on-dark);
  border-right: 1px solid var(--side-border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 14px 10px;
  gap: 4px;
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--side-border);
}
.sb-logo {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, oklch(0.62 0.18 270), oklch(0.45 0.18 280));
  display: grid; place-items: center;
  color: white; font-weight: 600; font-size: 13px;
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.08) inset, 0 4px 10px rgb(0 0 0 / 0.3);
}
.sb-brand-name { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }
.sb-brand-sub { font-size: 11px; color: var(--text-on-dark-muted); margin-top: 1px; }

.sb-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-on-dark-muted);
  padding: 14px 12px 6px;
}

.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text-on-dark-muted);
  font-size: 13.5px;
  border: none; background: transparent;
  text-align: left;
  width: 100%;
  transition: background 0.12s, color 0.12s;
}
.sb-item:hover { background: var(--side-hover); color: var(--text-on-dark); }
.sb-item--active {
  background: var(--side-active-bg);
  color: var(--side-active-fg);
  font-weight: 500;
}
.sb-item .lu { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.sb-item--active .lu { opacity: 1; }

.sb-foot {
  margin-top: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  border-top: 1px solid var(--side-border);
  color: var(--text-on-dark-muted);
  font-size: 12.5px;
}
.sb-foot-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--side-bg-2);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  color: var(--text-on-dark);
  border: 1px solid var(--side-border);
}

/* ----------------------------------------------------------
   Main area / topbar
   ---------------------------------------------------------- */
.main {
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
}

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 28px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.topbar-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.topbar-search .lu {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--text-subtle);
}
.topbar-search input {
  width: 100%;
  height: 32px;
  padding: 0 12px 0 32px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
}
.topbar-search input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.topbar-date {
  font-size: 13px;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 8px;
}

.scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ----------------------------------------------------------
   Buttons
   ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s, border-color 0.12s, transform 0.04s;
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: translateY(0.5px); }
.btn .lu { width: 14px; height: 14px; }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.1) inset, 0 1px 2px rgb(0 0 0 / 0.08);
}
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn--ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn--ghost:hover { background: var(--surface-hover); color: var(--text); }

.btn--sm { height: 28px; padding: 0 10px; font-size: 12.5px; }

.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent; color: var(--text-muted);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }

/* ----------------------------------------------------------
   Inputs
   ---------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.field-label .req { color: var(--accent); margin-left: 2px; }

.input, .select, .textarea {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.input:disabled, .input[readonly] {
  background: var(--surface-2);
  color: var(--text-subtle);
  cursor: not-allowed;
}
.textarea {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  min-height: 96px;
  line-height: 1.55;
}
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2398a1ad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }

/* Toggle */
.toggle {
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer;
  user-select: none;
}
.toggle-track {
  width: 34px; height: 20px;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  transition: background 0.15s;
}
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
  transition: left 0.15s;
}
.toggle--on .toggle-track { background: var(--accent); }
.toggle--on .toggle-thumb { left: 16px; }
.toggle-label { font-size: 13.5px; color: var(--text); }

/* ----------------------------------------------------------
   Cards / surfaces
   ---------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-weight: 600; font-size: 14px; letter-spacing: -0.005em; display: flex; align-items: center; gap: 8px; }
.card-title .lu { width: 15px; height: 15px; color: var(--text-subtle); }
.card-link { font-size: 12.5px; color: var(--text-muted); }
.card-link:hover { color: var(--accent); text-decoration: none; }
.card-body { padding: 4px 0; }

/* Page header */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
}
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 4px; }
.page-sub { font-size: 13.5px; color: var(--text-muted); margin: 0; }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* ----------------------------------------------------------
   Badges
   ---------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--accent { background: var(--accent-soft); color: var(--accent-soft-fg); border-color: oklch(0.92 0.04 270); }
.badge--green { background: var(--green-soft); color: var(--green); border-color: oklch(0.91 0.04 155); }
.badge--orange { background: var(--orange-soft); color: var(--orange); border-color: oklch(0.92 0.05 70); }
.badge--blue { background: var(--blue-soft); color: var(--blue); border-color: oklch(0.91 0.04 245); }
.badge--gray { background: var(--gray-soft); color: var(--gray); border-color: var(--border); }

.badge--clickable { cursor: pointer; transition: filter 0.12s; }
.badge--clickable:hover { filter: brightness(0.97); }

.tag {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

/* ----------------------------------------------------------
   Tables
   ---------------------------------------------------------- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table thead th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.01em;
}
.table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.1s; cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table-empty { color: var(--text-subtle); }

/* ----------------------------------------------------------
   Avatar
   ---------------------------------------------------------- */
.avatar {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-soft-fg);
  font-weight: 600; font-size: 12px;
  flex-shrink: 0;
}
.avatar--md { width: 40px; height: 40px; font-size: 14px; }
.avatar--lg { width: 64px; height: 64px; font-size: 20px; }
.avatar--solid {
  background: var(--accent);
  color: white;
}

/* ----------------------------------------------------------
   Dashboard cards content
   ---------------------------------------------------------- */
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--surface-2); }
.list-row-main { flex: 1; min-width: 0; }
.list-row-title { font-size: 13.5px; font-weight: 500; color: var(--text); }
.list-row-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.list-row-meta { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }

.dot-indicator {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.dot-indicator--orange { background: var(--orange); }
.dot-indicator--green { background: var(--green); }
.dot-indicator--blue { background: var(--blue); }
.dot-indicator--gray { background: var(--gray); }

/* ----------------------------------------------------------
   Detail page (mandant)
   ---------------------------------------------------------- */
.detail-head {
  display: flex; align-items: center; gap: 18px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.detail-head-info { flex: 1; min-width: 0; }
.detail-name { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; margin: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.detail-age { font-size: 16px; color: var(--text-subtle); font-weight: 400; }
.detail-meta { display: flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.detail-meta-item { font-size: 13px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 5px; }
.detail-meta-item .lu { width: 13px; height: 13px; }
.detail-actions { display: flex; gap: 8px; align-items: center; }

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  padding: 0 0 0 0;
  margin-top: 18px;
  margin-bottom: 24px;
  overflow-x: auto;
}
.tab {
  appearance: none; border: none; background: none;
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.12s, border-color 0.12s;
}
.tab:hover { color: var(--text); }
.tab--active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* Form sections */
.section { margin-bottom: 28px; }
.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 14px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}
.form-grid--3 { grid-template-columns: 2fr 1fr 2fr; }
.field-full { grid-column: 1 / -1; }

/* Hint box */
.hint {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px;
  background: var(--hint-bg);
  border: 1px solid var(--hint-border);
  color: var(--hint-fg);
  border-radius: var(--r-md);
  font-size: 13px;
  line-height: 1.5;
}
.hint .lu { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

.note {
  font-size: 12.5px;
  color: var(--text-subtle);
  margin-top: 6px;
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
}
.empty-state-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: inline-grid; place-items: center;
  margin-bottom: 14px;
  color: var(--text-subtle);
}
.empty-state h3 { font-size: 15px; margin: 0 0 4px; color: var(--text); font-weight: 600; }
.empty-state p { margin: 0 0 16px; font-size: 13.5px; }

/* Family chips */
.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.member-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.08s;
}
.member-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.member-card-info { flex: 1; min-width: 0; }
.member-card-name { font-size: 13.5px; font-weight: 500; }
.member-card-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }

/* ----------------------------------------------------------
   Documents
   ---------------------------------------------------------- */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: 28px;
  text-align: center;
  background: var(--surface-2);
  color: var(--text-muted);
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.dropzone:hover, .dropzone--over {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-soft-fg);
}
.dropzone-icon {
  width: 36px; height: 36px;
  margin: 0 auto 10px;
  color: var(--text-subtle);
}
.dropzone-title { font-size: 14px; font-weight: 500; color: var(--text); }
.dropzone-sub { font-size: 12.5px; margin-top: 3px; }

.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.file-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.file-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.file-icon {
  width: 38px; height: 46px;
  border-radius: 5px;
  display: grid; place-items: center;
  font-size: 9px; font-weight: 700; letter-spacing: 0.04em;
  color: white;
  flex-shrink: 0;
  position: relative;
}
.file-icon::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: 10px; height: 10px;
  background: linear-gradient(225deg, rgb(255 255 255 / 0.4) 50%, transparent 50%);
  border-bottom-left-radius: 3px;
}
.file-icon--pdf { background: oklch(0.55 0.16 25); }
.file-icon--docx { background: oklch(0.5 0.14 245); }
.file-icon--xlsx { background: oklch(0.5 0.13 155); }
.file-icon--img { background: oklch(0.55 0.13 320); }
.file-info { flex: 1; min-width: 0; }
.file-name {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ----------------------------------------------------------
   ToDos
   ---------------------------------------------------------- */
.todo-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.todo-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.todo-row:last-child { border-bottom: none; }
.todo-row:hover { background: var(--surface-2); }
.todo-check {
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  display: grid; place-items: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.12s;
  background: var(--surface);
}
.todo-check:hover { border-color: var(--accent); }
.todo-check--checked {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.todo-check--checked .lu { width: 12px; height: 12px; }
.todo-title { flex: 1; font-size: 13.5px; }
.todo-title--done { color: var(--text-subtle); text-decoration: line-through; }
.todo-due { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }

/* ----------------------------------------------------------
   Termine
   ---------------------------------------------------------- */
.termin-list { display: flex; flex-direction: column; gap: 0; }
.termin-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.termin-row:first-child { border-top: none; }
.termin-row--past { opacity: 0.55; }
.termin-when {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.termin-when-day { font-weight: 500; color: var(--text); }
.termin-title { font-size: 14px; font-weight: 500; }
.termin-note { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

.termin-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 12px 0;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.termin-divider::before, .termin-divider::after {
  content: ''; flex: 1; height: 1px;
  background: var(--accent);
  opacity: 0.5;
}

/* ----------------------------------------------------------
   Modals
   ---------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: oklch(0.2 0.01 260 / 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: grid; place-items: center;
  padding: 24px;
  animation: overlayIn 0.15s ease-out;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  animation: modalIn 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-head {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--surface-2);
  border-bottom-left-radius: var(--r-xl);
  border-bottom-right-radius: var(--r-xl);
}

/* ----------------------------------------------------------
   Login
   ---------------------------------------------------------- */
.login-wrap {
  min-height: 100vh;
  display: grid; place-items: center;
  background:
    radial-gradient(1000px 600px at 50% -10%, oklch(0.93 0.04 270 / 0.6), transparent 60%),
    var(--bg);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 32px 30px 28px;
}
.login-brand {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}
.login-logo {
  width: 44px; height: 44px;
  border-radius: 11px;
  background: linear-gradient(135deg, oklch(0.62 0.18 270), oklch(0.45 0.18 280));
  display: grid; place-items: center;
  color: white; font-weight: 700; font-size: 19px;
  box-shadow: 0 6px 16px rgb(70 60 200 / 0.25), 0 1px 0 rgb(255 255 255 / 0.18) inset;
}
.login-title { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; margin: 0; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-foot {
  margin-top: 22px;
  text-align: center;
  font-size: 12px;
  color: var(--text-subtle);
}

/* Spacing helpers */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.mono { font-variant-numeric: tabular-nums; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid--3 { grid-template-columns: 1fr; }
  .app { grid-template-columns: 64px 1fr; }
  .sb-brand-name, .sb-brand-sub, .sb-section-label, .sb-item span:not(.lu), .sb-foot { display: none; }
  .sb-item { justify-content: center; }
}

/* Scrollbar */
.scroll-area::-webkit-scrollbar { width: 10px; }
.scroll-area::-webkit-scrollbar-thumb { background: oklch(0.88 0.005 260); border-radius: 999px; border: 2px solid var(--bg); }
.scroll-area::-webkit-scrollbar-thumb:hover { background: oklch(0.78 0.005 260); }
