/* =====================================================================
   AI Workforce — design system
   Aurora backdrop · spatial glass panels · neumorphic sign-in & controls
   Light and dark themes share one set of components via CSS variables.
   Text colours are chosen for WCAG AA contrast (4.5:1 body, 3:1 large).
   ===================================================================== */

/* ---------- Theme tokens ---------- */
:root,
:root[data-theme="light"] {
  color-scheme: light;
  --page-base: #eef2fa;
  --text: #0e1a2f;
  --text-strong: #07101f;
  --muted: #36435c;
  --faint: #4b5873;
  --brand: #1a5fc2;
  --brand-strong: #134a99;
  --accent: #5b47d6;
  --label: #0f3a7a;   /* labels that sit directly on the aurora */
  --line: rgba(14, 26, 47, .11);
  --line-strong: rgba(14, 26, 47, .2);

  --glass: rgba(255, 255, 255, .80);
  --glass-strong: rgba(255, 255, 255, .92);
  --glass-edge: rgba(255, 255, 255, .9);
  --glass-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 18px 50px -18px rgba(22, 40, 90, .28), 0 4px 14px -6px rgba(22, 40, 90, .14);

  --neu-bg: #e8edf6;
  --neu-dark: rgba(163, 177, 204, .75);
  --neu-light: rgba(255, 255, 255, .95);
  --field-bg: #edf1f8;
  --field-text: #0e1a2f;

  --btn-from: #1a5fc2;
  --btn-to: #4b3fd0;
  --btn-text: #ffffff;
  --danger-bg: #b42335;
  --danger-text: #ffffff;
  --danger-ink: #a11d2e;

  --aurora-1: rgba(60, 140, 255, .52);
  --aurora-2: rgba(132, 96, 255, .44);
  --aurora-3: rgba(28, 205, 175, .48);
  --aurora-4: rgba(255, 128, 196, .40);

  --chip-bg: #e2e9f6; --chip-text: #23385e;
  --ok-bg: #d8f3e6;   --ok-text: #0c5a37;
  --warn-bg: #fdefc9; --warn-text: #6a4800;
  --bad-bg: #fde0e4;  --bad-text: #8f1527;
  --info-bg: #dcebff; --info-text: #0f4a96;
  --notice-bg: #fff4d6; --notice-text: #5c4100; --notice-line: #e6c56b;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page-base: #060c18;
  --text: #e9f0fc;
  --text-strong: #ffffff;
  --muted: #a9b7cf;
  --faint: #93a3bf;
  --brand: #7fbaff;
  --brand-strong: #a9d0ff;
  --accent: #b2a4ff;
  --label: #8fc3ff;
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .18);

  --glass: rgba(16, 26, 44, .74);
  --glass-strong: rgba(18, 29, 49, .9);
  --glass-edge: rgba(255, 255, 255, .08);
  --glass-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 24px 60px -20px rgba(0, 0, 0, .7), 0 6px 18px -8px rgba(0, 0, 0, .5);

  --neu-bg: #111a2b;
  --neu-dark: rgba(0, 0, 0, .55);
  --neu-light: rgba(46, 64, 98, .45);
  --field-bg: #0c1424;
  --field-text: #e9f0fc;

  --btn-from: #6aaeff;
  --btn-to: #9a86ff;
  --btn-text: #06101f;
  --danger-bg: #ff8a98;
  --danger-text: #2a0509;
  --danger-ink: #ff9eab;

  --aurora-1: rgba(40, 120, 255, .50);
  --aurora-2: rgba(140, 90, 255, .44);
  --aurora-3: rgba(16, 200, 160, .34);
  --aurora-4: rgba(255, 90, 185, .26);

  --chip-bg: #1d2c47; --chip-text: #cfe0fb;
  --ok-bg: #12392b;   --ok-text: #a6ecc9;
  --warn-bg: #3d3014; --warn-text: #ffdf9a;
  --bad-bg: #44202a;  --bad-text: #ffc4cc;
  --info-bg: #15304f; --info-text: #b6d8ff;
  --notice-bg: #33280f; --notice-text: #ffe3a3; --notice-line: #7a5f22;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--page-base); }
body {
  margin: 0; min-height: 100vh; color: var(--text); background: transparent; /* the aurora layer shows through */
  font: 16px/1.6 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
img, svg { max-width: 100%; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; background: var(--chip-bg); color: var(--chip-text); padding: 2px 7px; border-radius: 7px; overflow-wrap: anywhere; }
h1, h2, h3, h4 { color: var(--text-strong); line-height: 1.2; }
h1 { font-size: clamp(30px, 4.6vw, 44px); letter-spacing: -.025em; margin: 8px 0 12px; font-weight: 800; }
h2 { font-size: 20px; letter-spacing: -.01em; margin: 10px 0 6px; font-weight: 700; }
h3 { font-size: 17px; margin: 8px 0 4px; font-weight: 700; }
p { margin: 0 0 12px; }
.muted, .panel p.muted { color: var(--muted); }
.small-note, .note { font-size: 14px; color: var(--muted); }
.eyebrow { font-size: 12.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--label); margin: 0 0 4px; }
.preserve { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; }

/* ---------- Aurora backdrop ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: var(--page-base); }
.aurora span { position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%; will-change: transform; }
.aurora span:nth-child(1) { top: -36vmax; left: -14vmax; background: radial-gradient(closest-side, var(--aurora-1), transparent 72%); animation: drift-a 28s ease-in-out infinite alternate; }
.aurora span:nth-child(2) { top: -38vmax; right: -18vmax; background: radial-gradient(closest-side, var(--aurora-2), transparent 72%); animation: drift-b 34s ease-in-out infinite alternate; }
.aurora span:nth-child(3) { bottom: -38vmax; left: 8vmax; background: radial-gradient(closest-side, var(--aurora-3), transparent 72%); animation: drift-c 40s ease-in-out infinite alternate; }
.aurora span:nth-child(4) { bottom: -30vmax; right: -20vmax; width: 55vmax; height: 55vmax; background: radial-gradient(closest-side, var(--aurora-4), transparent 72%); animation: drift-a 46s ease-in-out infinite alternate-reverse; }
.aurora::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 0%, var(--page-base) 96%); opacity: .3; }
@keyframes drift-a { to { transform: translate3d(14vmax, 8vmax, 0) scale(1.12); } }
@keyframes drift-b { to { transform: translate3d(-12vmax, 10vmax, 0) scale(.92); } }
@keyframes drift-c { to { transform: translate3d(10vmax, -12vmax, 0) scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .aurora span { animation: none; } }

/* ---------- Spatial glass surfaces ---------- */
.panel, .metric-card, .stat, .billing-plan, .task-row, .search-bar, .footnote, .review-panel, .notice {
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
}
.panel { padding: 24px; border-radius: 22px; color: var(--text); min-width: 0; }
.panel p { color: var(--muted); }
.panel h2 { margin-top: 0; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .panel, .metric-card, .stat, .billing-plan, .task-row, .search-bar, .footnote, .review-panel { background: var(--glass-strong); }
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; min-height: 68px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px max(20px, calc((100% - 1180px) / 2)); padding-top: max(10px, env(safe-area-inset-top));
  background: var(--glass); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
}
.nav-left { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
.brand { font-size: 20px; font-weight: 800; color: var(--text-strong); letter-spacing: -.02em; margin-right: 18px; white-space: nowrap; }
.brand span { background: linear-gradient(100deg, var(--btn-from), var(--btn-to)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand:hover { text-decoration: none; }
.nav-link { font-size: 15px; font-weight: 600; color: var(--muted); padding: 8px 12px; border-radius: 12px; }
.nav-link:hover { color: var(--text-strong); background: var(--chip-bg); text-decoration: none; }
.nav-link[aria-current="page"] { color: var(--text-strong); background: var(--chip-bg); box-shadow: inset 0 0 0 1px var(--line); }
.topbar-tools { display: flex; align-items: center; gap: 10px; }
.topbar-tools form { margin: 0; }
.quiet { background: none; color: var(--muted); border: 0; cursor: pointer; font: inherit; font-weight: 600; padding: 8px 10px; border-radius: 12px; }
.quiet:hover { color: var(--text-strong); background: var(--chip-bg); }

/* Neumorphic theme toggle */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 700;
  color: var(--text); background: var(--neu-bg); border: 0; border-radius: 999px; padding: 8px 14px 8px 10px; white-space: nowrap;
  box-shadow: 4px 4px 10px var(--neu-dark), -4px -4px 10px var(--neu-light);
}
.theme-toggle:hover { color: var(--text-strong); }
.theme-toggle:active { box-shadow: inset 3px 3px 8px var(--neu-dark), inset -3px -3px 8px var(--neu-light); }
.theme-toggle .ti { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg, var(--btn-from), var(--btn-to)); color: var(--btn-text); font-size: 14px; line-height: 1; }

/* SVG icons */
.ic, .di, .tab-i { width: 22px; height: 22px; flex: none; display: block; }
.theme-toggle .ic { width: 16px; height: 16px; }
.ic-sun { display: none; }
:root[data-theme="dark"] .ic-sun { display: block; }
:root[data-theme="dark"] .ic-moon { display: none; }

/* Phone-only navigation chrome (hidden on larger screens; see mobile.css) */
.menu-button, .app-back, .tabbar, .drawer, .drawer-scrim { display: none; }

/* ---------- Layout ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 48px 24px 72px; }
.hero-row, .page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin: 8px 0 18px; flex-wrap: wrap; }
.page-heading h1 { margin: .2rem 0; }
.section-head { margin: 40px 0 16px; }
.section-head h2 { font-size: 24px; margin: 0 0 6px; }
.grid, .forms-grid, .knowledge-grid, .analytics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 24px 0; }
.analytics-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.dept-grid, .employee-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.integration-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 28px 0; }
.billing-plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 24px 0 30px; }
.metric-grid, .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 24px 0 32px; }

/* ---------- Metrics ---------- */
.metric-card, .stat { padding: 20px 22px; border-radius: 20px; min-width: 0; }
.metric-card span, .stat span { display: block; color: var(--muted); font-size: 14px; font-weight: 600; }
.metric-card strong, .stat strong { display: block; font-size: 30px; line-height: 1.15; margin: 6px 0 4px; color: var(--text-strong); font-weight: 800; letter-spacing: -.02em; overflow-wrap: anywhere; }
.metric-card small { display: block; color: var(--muted); font-size: 14px; }
.stat .role { font-size: 22px; }

/* ---------- Cards ---------- */
.dept-card, .employee-card { padding: 20px; }
.dept-mark, .icon { color: var(--brand); font-size: 26px; line-height: 1; }
.dept-card h3, .employee-card h3 { margin: 10px 0 4px; font-size: 17px; }
.dept-card p, .employee-card p { color: var(--muted); font-size: 14.5px; }
.dept-card small, .employee-foot small { color: var(--faint); font-size: 13.5px; }
.employee-top, .employee-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.employee-foot { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 16px; }
.employee-edit { margin-top: 12px; }
.employee-edit summary { cursor: pointer; color: var(--accent, var(--brand)); font-weight: 600; font-size: 14px; padding: 6px 0; min-height: 32px; }
.employee-edit summary:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 6px; }
.employee-edit form { display: grid; gap: 4px; margin-top: 6px; }
.employee-edit label { margin: 8px 0; }
.employee-edit button { justify-self: start; }
.employee-foot select { width: auto; min-width: 120px; margin: 0; padding: 8px 10px; font-size: 14px; }
.avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; font-size: 20px; color: var(--brand); background: var(--neu-bg); box-shadow: 3px 3px 8px var(--neu-dark), -3px -3px 8px var(--neu-light); }
.job-title { color: var(--brand) !important; font-weight: 600; margin-top: 0; }
.tenant-chip { display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--ok-text); background: var(--ok-bg); }
.pulse { width: 8px; height: 8px; background: currentColor; border-radius: 50%; box-shadow: 0 0 0 0 currentColor; animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* ---------- Shortcuts / links ---------- */
.workspace-shortcuts { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 4px; }
.workspace-shortcuts a, .secondary-link, .button, .filter-tabs a {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 14px; font-size: 15px; font-weight: 700;
  color: var(--text); background: var(--neu-bg); box-shadow: 4px 4px 10px var(--neu-dark), -4px -4px 10px var(--neu-light); border: 0;
}
.workspace-shortcuts a:hover, .secondary-link:hover, .button:hover, .filter-tabs a:hover { color: var(--brand); text-decoration: none; }
.filter-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 4px; }
.filter-tabs a { padding: 8px 14px; border-radius: 999px; font-size: 14px; }
.filter-tabs a.selected { color: var(--btn-text); background: linear-gradient(110deg, var(--btn-from), var(--btn-to)); box-shadow: 0 8px 20px -8px var(--btn-from); }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 18px; font-weight: 700; color: var(--label); }

/* ---------- Forms (neumorphic fields) ---------- */
form label { display: block; margin: 16px 0; color: var(--text); font-size: 15px; font-weight: 600; }
form label small { color: var(--muted); font-weight: 500; }
input, select, textarea {
  display: block; width: 100%; margin-top: 8px; padding: 13px 15px; font: inherit; font-size: 16px; color: var(--field-text);
  background: var(--field-bg); border: 1px solid transparent; border-radius: 14px; outline: none;
  box-shadow: inset 3px 3px 7px var(--neu-dark), inset -3px -3px 7px var(--neu-light);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: inset 2px 2px 5px var(--neu-dark), inset -2px -2px 5px var(--neu-light), 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); }
textarea { resize: vertical; min-height: 110px; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; padding: 0; margin: 0; box-shadow: none; accent-color: var(--brand); display: inline-block; }
input[type=file] { font-size: 15px; padding: 11px; }
select { appearance: auto; }

/* ---------- Buttons ---------- */
.primary, button[type=submit]:not([class]) {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 10px;
  border: 0; border-radius: 14px; padding: 14px 20px; cursor: pointer; font: inherit; font-size: 16px; font-weight: 800; letter-spacing: .01em;
  color: var(--btn-text); background: linear-gradient(110deg, var(--btn-from), var(--btn-to));
  box-shadow: 0 10px 24px -10px var(--btn-from), 0 2px 0 rgba(255,255,255,.25) inset;
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.primary:hover, button[type=submit]:not([class]):hover { filter: brightness(1.06); transform: translateY(-1px); }
.primary:active, button[type=submit]:not([class]):active { transform: translateY(0); }
.secondary-button {
  border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer; font: inherit; font-size: 15px; font-weight: 700;
  color: var(--text); background: var(--neu-bg); box-shadow: 4px 4px 10px var(--neu-dark), -4px -4px 10px var(--neu-light);
}
.secondary-button:hover { color: var(--brand); }
.secondary-button:active { box-shadow: inset 3px 3px 8px var(--neu-dark), inset -3px -3px 8px var(--neu-light); }
.danger { border: 0; border-radius: 14px; padding: 12px 18px; cursor: pointer; font: inherit; font-size: 15px; font-weight: 800; color: var(--danger-text); background: var(--danger-bg); box-shadow: 0 8px 20px -10px var(--danger-bg); }
.danger:hover { filter: brightness(1.08); }
.text-danger { background: none; border: 0; color: var(--danger-ink); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
.decision-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.decision-actions .primary, .decision-actions .danger { width: auto; min-width: 140px; }

/* ---------- Status chips ---------- */
.status, .state, .current-badge {
  display: inline-block; font-size: 12.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  padding: 5px 11px; border-radius: 999px; background: var(--chip-bg); color: var(--chip-text); white-space: nowrap;
}
.current-badge { text-transform: none; letter-spacing: 0; font-size: 14px; background: var(--info-bg); color: var(--info-text); }
.state-active, .state-completed, .state-approved { background: var(--ok-bg); color: var(--ok-text); }
.state-paused, .state-pending, .state-ready, .state-needs_review, .state-needs-review { background: var(--warn-bg); color: var(--warn-text); }
.state-running, .state-queued { background: var(--info-bg); color: var(--info-text); }
.state-failed, .state-rejected { background: var(--bad-bg); color: var(--bad-text); }

/* ---------- Notices / footnotes ---------- */
.notice { padding: 14px 18px; border-radius: 16px; margin-bottom: 20px; font-weight: 600; color: var(--notice-text); background: var(--notice-bg); border-color: var(--notice-line); }
.footnote { margin-top: 28px; padding: 14px 18px; border-radius: 16px; border-left: 4px solid var(--brand); color: var(--muted); font-size: 14px; }

/* ---------- Tasks, runs, approvals ---------- */
.task-form { padding: 24px; margin: 16px 0 30px; }
.compact-form { padding: 24px; }
.compact-form h3 { margin: 4px 0 12px; }
.compact-form label { margin: 12px 0; }
.task-list, .run-list { display: grid; gap: 14px; margin: 14px 0 30px; }
.task-row { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 18px 20px; border-radius: 18px; color: var(--text); }
a.task-row:hover { text-decoration: none; border-color: var(--brand); }
.task-row strong { color: var(--text-strong); }
.task-row small { display: block; color: var(--muted); margin-top: 4px; font-size: 14px; }
.detail-panel { padding: 24px; margin: 18px 0; }
.visuals-panel h2 { margin-top: 4px; }
.visual-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 16px; }
.visual-option { display: flex; flex-direction: column; gap: 6px; padding: 18px; border-radius: 18px; border: 1px solid var(--line); background: var(--glass); }
.visual-option h3 { margin: 0; font-size: 17px; }
.visual-option p { margin: 0 0 6px; font-size: 14px; }
.visual-option label { margin: 6px 0; }
.visual-option .primary { margin-top: auto; }
.style-choice { border: 0; padding: 0; margin: 4px 0 10px; }
.style-choice legend { font-weight: 700; font-size: 14px; margin-bottom: 4px; color: var(--label, inherit); }
.inline-choice { display: flex !important; align-items: center; gap: 8px; margin: 6px 0 !important; font-weight: 500; }
.inline-choice input { width: 20px; height: 20px; margin: 0; flex: none; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 20px; }
.asset-card { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; background: var(--glass-strong); }
.asset-preview { height: 210px; overflow: hidden; display: grid; place-items: center; background: var(--field-bg); border-bottom: 1px solid var(--line); }
.asset-preview img { display: block; width: 100%; height: 210px; object-fit: contain; background: #fff; }
.asset-icon { font-size: 40px; color: #6b7a90; }
.asset-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.asset-body h3 { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.asset-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; align-items: center; }
.asset-actions .secondary-button { text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.asset-review { display: flex; gap: 8px; margin: 0; }
.asset-review .primary, .asset-review .danger { width: auto; min-height: 44px; padding: 10px 16px; font-size: 15px; border-radius: 14px; }
.result-panel { border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.run-card { padding: 22px; }
.run-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.run-head h3 { margin: 0; }
.run-output { margin: 16px 0; }
.task-meta { display: flex; align-items: center; gap: 12px; margin: 18px 0; flex-wrap: wrap; }
.approval-card { margin: 14px 0; }
.review-panel { margin-top: 22px; padding: 22px; border-radius: 18px; border-color: var(--notice-line); }
.review-panel h3 { margin: 4px 0 8px; }
.review-panel label { display: block; margin: 14px 0; }

/* ---------- Knowledge ---------- */
.search-form { display: flex; gap: 12px; align-items: flex-end; margin: 12px 0 22px; }
.search-form input { flex: 1; }
.search-form .primary { width: auto; min-width: 130px; }
.search-bar { margin: 26px 0; padding: 20px; border-radius: 18px; }
.search-bar label { margin: 0 0 8px; }
.search-line { display: flex; gap: 12px; align-items: center; }
.search-line input { margin: 0; flex: 1; }
.search-line .primary { width: auto; min-width: 150px; margin: 0; }
.repo-create { max-width: 760px; margin: 24px 0; }
.repo-create .primary { max-width: 260px; }
.knowledge-card { min-width: 0; }
.knowledge-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.knowledge-actions form { margin: 0; }
.knowledge-actions .danger { padding: 8px 12px; min-width: 0; }
.repo-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.repo-heading h3 { margin: 0; font-size: 20px; }
.document-list { display: grid; gap: 8px; margin: 18px 0; }
.document-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.document-row strong { display: block; font-size: 15px; overflow-wrap: anywhere; color: var(--text-strong); }
.document-row small { display: block; color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.document-actions { display: flex; align-items: center; gap: 14px; white-space: nowrap; font-size: 14px; }
.document-actions form { margin: 0; }
.upload-form, .permissions-form { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 18px; }
.upload-form label { margin: 10px 0; }
.upload-form .primary { max-width: 240px; }
.upload-form > small { display: block; color: var(--muted); font-size: 13.5px; margin-top: 9px; }
.permissions-form h4 { margin: 0; }
.permission-list { display: grid; gap: 4px; margin: 12px 0; }
.permissions-form .permission-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
.permission-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; margin: 0; border-bottom: 1px solid var(--line); }
.permission-row strong { color: var(--text-strong); }
.permission-row small, .permission-item small { display: block; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.permission-item { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 8px 0; font-size: 14.5px; }
.permission-item input { margin-top: 3px; }
.search-results { display: grid; gap: 14px; }
.result-card { min-height: 0; }
.result-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.result-meta span { border-radius: 999px; padding: 4px 10px; background: var(--chip-bg); color: var(--chip-text); font-weight: 600; }
.result-card .preserve { margin: 14px 0; color: var(--text); font-size: 15px; }
.integration-card { min-height: 220px; }

/* ---------- Analytics & billing ---------- */
.usage-line { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.usage-line span { color: var(--muted); }
.usage-line strong { color: var(--text-strong); white-space: nowrap; }
.billing-plan { border-radius: 22px; padding: 24px; display: flex; flex-direction: column; min-width: 0; }
.billing-plan.current { border-color: var(--brand); box-shadow: var(--glass-shadow), 0 0 0 2px color-mix(in srgb, var(--brand) 55%, transparent); }
.billing-plan h2 { margin: .25rem 0; font-size: 24px; }
.billing-plan ul { padding-left: 1.2rem; color: var(--text); line-height: 1.9; margin: 8px 0 16px; }
.billing-plan label { font-size: 14px; color: var(--muted); }
.billing-plan form { margin-top: auto; }
.price { font-size: 32px; font-weight: 800; margin: 14px 0; color: var(--text-strong); letter-spacing: -.02em; }
.price small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.subscription-actions form { display: inline-block; margin: 6px 10px 0 0; }

/* ---------- Tables (scroll inside their own box) ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); color: var(--text); white-space: nowrap; vertical-align: middle; }
tbody tr:hover td { background: color-mix(in srgb, var(--brand) 6%, transparent); }
td form { display: flex; gap: 8px; align-items: center; margin: 0; }
td select { width: auto; margin: 0; padding: 8px 10px; }
.table-input { width: 110px !important; margin: 0 !important; padding: 8px 10px !important; }

/* ---------- Sign-in: neumorphism + spatial ---------- */
.auth-wrap { min-height: calc(100vh - 220px); display: grid; place-items: center; }
.auth-card {
  width: min(460px, 100%); margin: 12px auto; padding: 36px 34px; border-radius: 28px; color: var(--text);
  background: var(--neu-bg);
  box-shadow: 18px 18px 40px var(--neu-dark), -14px -14px 34px var(--neu-light), var(--glass-shadow);
  border: 1px solid var(--glass-edge); position: relative;
}
.auth-card::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, color-mix(in srgb, var(--btn-from) 70%, transparent), transparent 40%, color-mix(in srgb, var(--btn-to) 60%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.auth-card h1 { font-size: clamp(28px, 6vw, 36px); margin: .3rem 0 .5rem; }
.auth-card .muted { color: var(--muted); }
.auth-card .primary, .auth-card button[type=submit] { width: 100%; margin-top: 14px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 18px; font-size: 15px; color: var(--muted); }
.code-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.code-list code { display: block; text-align: center; padding: 8px; }

/* ---------- Responsive (tablet) ---------- */
@media (max-width: 900px) {
  .dept-grid, .employee-grid, .integration-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .billing-plan-grid { grid-template-columns: 1fr; }
  .knowledge-grid { grid-template-columns: 1fr; }
}

/* ---------- Print: always white paper ---------- */
@media print {
  :root, :root[data-theme] { --text: #000; --text-strong: #000; --muted: #333; --faint: #444; --brand: #000; --line: #ccc; --line-strong: #999;
    --glass: #fff; --glass-strong: #fff; --neu-bg: #fff; --field-bg: #fff; --chip-bg: #eee; --chip-text: #000; color-scheme: light; }
  html, body { background: #fff !important; color: #000 !important; }
  .aurora, .topbar, .tabbar, .drawer, .drawer-scrim, .theme-toggle, .menu-button, form button { display: none !important; }
  .panel, .metric-card, .stat, .billing-plan, .task-row, .auth-card, .notice, .footnote { box-shadow: none !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; border: 1px solid #ccc !important; background: #fff !important; }
  .container { padding: 0; max-width: none; }
  a { color: #000; text-decoration: underline; }
}

/* ---------- Google Drive import ---------- */
.drive-import { margin-top: 10px; }
.drive-import label { margin: 8px 0 4px; }
.drive-import .primary { margin-top: 12px; }
.drive-result:empty { display: none; }
.drive-result { margin-top: 12px; }
.drive-list { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 4px; font-size: 14.5px; }
.drive-error { color: var(--bad-text); }
.drive-disconnect { margin-top: 14px; }

/* ---------- Legal pages & footer ---------- */
.legal-page { max-width: 820px; margin: 0 auto; padding: 32px clamp(20px, 4vw, 44px); line-height: 1.65; }
.legal-page h1 { margin: 6px 0 4px; }
.legal-page h2 { font-size: 19px; margin: 28px 0 8px; }
.legal-page ul { padding-left: 22px; }
.legal-page li { margin: 6px 0; }
.legal-contact { list-style: none; padding: 0 !important; }
.site-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 12px; padding: 28px 0 12px; font-size: 14px; color: var(--muted); }
.site-footer a { color: var(--muted); }
.consent { align-items: flex-start !important; font-size: 14px; line-height: 1.45; }
.consent input { margin-top: 2px !important; }
.result-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 10px; }
.result-head .eyebrow { margin: 0; }
.download-row { display: flex; flex-wrap: wrap; gap: 8px; }
.download-row .secondary-button { text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.template-picker { padding: 16px 22px; margin-bottom: 16px; }
.template-picker summary { cursor: pointer; font-weight: 800; font-size: 16px; min-height: 32px; display: flex; align-items: center; }
.template-picker summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 8px; }
.template-group { margin-top: 12px; }
.template-group-label { display: block; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--label); margin-bottom: 6px; }
.template-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.template-chip { display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--glass-strong); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600; }
.template-chip:hover, .template-chip.is-chosen { border-color: var(--brand); color: var(--brand); }
.template-note { margin: 4px 0 12px; }
.repeat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.recurring-list { display: grid; gap: 16px; margin: 20px 0; }
.recurring-card { padding: 22px; }
.recurring-card h2 { font-size: 18px; margin: 0; overflow-wrap: anywhere; }
.recurring-card details summary { cursor: pointer; font-weight: 700; margin: 8px 0; }
.link-button { text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.section-head { flex-wrap: wrap; gap: 10px; }
.invite-form { display: grid; grid-template-columns: 2fr 1fr auto; gap: 0 14px; align-items: end; }
.invite-form .primary { margin-bottom: 12px; white-space: nowrap; }
@media (max-width: 760px) { .invite-form { grid-template-columns: 1fr; } }
.role-help { margin: 8px 0 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.role-help li { margin: 4px 0; }
.member-list { display: grid; gap: 4px; margin-top: 8px; }
.member-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.member-row > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.member-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.member-actions select { width: auto; margin: 0; min-height: 44px; }
.member-actions form { margin: 0; }
.invite-link-panel { border-color: var(--brand); }
.invite-link { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }
.button-link { display: inline-flex; justify-content: center; align-items: center; text-decoration: none; }
.chat-status { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 16px 20px; margin-bottom: 16px; }
.chat-status p { margin: 0; flex: 1; min-width: 200px; }
.settings-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 0 16px; }
@media (max-width: 600px) { .settings-grid { grid-template-columns: 1fr; } }
.chat-settings input[type=color] { height: 48px; padding: 4px; }
.chat-log { border-top: 1px solid var(--line); padding: 10px 0; }
.chat-log p { margin: 4px 0; overflow-wrap: anywhere; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.video-stats { margin: 18px 0; }
.video-options { margin-bottom: 20px; }
.video-options h2 { font-size: 19px; margin: 0; }
.video-options input[type=file] { padding: 12px; }
.video-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; color: inherit; padding: 12px 0; border-top: 1px solid var(--line); }
.video-row small { display: block; }
.video-progress { display: flex; align-items: center; gap: 14px; padding: 18px 20px; margin: 16px 0; }
.video-progress p { margin: 0; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin: 18px 0; }
.video-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.video-card h2 { font-size: 16px; margin: 0; overflow-wrap: anywhere; }
.video-card video { width: 100%; border-radius: 14px; background: #000; display: block; }
.video-card video.video-tall { aspect-ratio: 9 / 16; max-height: 520px; object-fit: contain; }
.video-card video.video-wide { aspect-ratio: 16 / 9; }
.post-text textarea { font-size: 14px; }
.primary:disabled, .primary[disabled] { opacity: .45; cursor: not-allowed; filter: grayscale(.4); }
