/* Service Flow design system: calm, precise, data-first. */
:root {
  --ink-950: #0b1220;
  --ink-900: #101a2e;
  --ink-800: #16233a;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #172033;
  --text-2: #344054;
  --muted: #5d6b82;
  --muted-3: #667085;
  --primary: #2563eb;
  --primary-700: #1d4ed8;
  --primary-soft: #eff4ff;
  --primary-line: #bfdbfe;
  --accent: #ea580c;
  --accent-soft: #fff4ed;
  --accent-line: #fed7aa;
  --success: #0e9f6e;
  --success-soft: #ecfdf5;
  --success-line: #a7f3d0;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-line: #fecaca;
  --indigo: #4f46e5;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 12px 32px rgba(16, 24, 40, .08);
  --shadow-lg: 0 28px 80px rgba(15, 23, 42, .16);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --sidebar-w: 252px;
  --font-sans: "SF Pro Text", "Segoe UI Variable", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .58; }
a { color: inherit; }
img, svg { display: block; }
[hidden] { display: none !important; }
::selection { color: #fff; background: var(--primary); }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--ink-950);
  color: #fff;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform .2s ease;
}
.skip-link:focus { transform: translateY(0); }

:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .28);
  outline-offset: 2px;
}

.muted, small { color: var(--muted); }
.eyebrow {
  margin: 0;
  color: var(--muted-3);
  font: 600 10px/1.4 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.mono, code { font-family: var(--font-mono); }
code {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: .86em;
  word-break: break-all;
}

/* Authentication */
.login-page {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow-x: hidden;
  padding: 42px;
  background:
    radial-gradient(circle at 8% 14%, #dbeafe 0, transparent 27%),
    radial-gradient(circle at 92% 86%, #ffedd5 0, transparent 24%),
    var(--bg);
}
.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .35;
  background-image: radial-gradient(#cbd5e1 .8px, transparent .8px);
  background-size: 22px 22px;
  mask-image: linear-gradient(120deg, #000, transparent 55%);
}
.login-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 84px;
  align-items: center;
  width: min(1120px, 100%);
}
.login-brand { padding: 24px 0; }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 42px; }
.auth-brand > span:last-child { display: grid; gap: 2px; }
.auth-brand b { color: var(--ink-950); font-size: 21px; letter-spacing: -.025em; }
.auth-brand small { color: var(--muted-3); font: 600 9px var(--font-mono); letter-spacing: .18em; }
.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #3b82f6, #0891b2);
  box-shadow: 0 8px 22px rgba(37, 99, 235, .3);
  color: #fff;
}
.brand-mark svg { width: 27px; height: 27px; }
.brand-mark.large { width: 48px; height: 48px; border-radius: 14px; }
.brand-mark.large svg { width: 32px; height: 32px; }
.login-brand h1 {
  margin: 16px 0 22px;
  color: var(--ink-950);
  font-size: clamp(44px, 5.2vw, 68px);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -.055em;
}
.login-brand h1 em { color: var(--primary); font-style: normal; }
.brand-copy { max-width: 560px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.8; }
.auth-flow {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 620px;
  margin-top: 34px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, .66);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}
.auth-flow div { display: grid; gap: 3px; min-width: 76px; }
.auth-flow div span { color: var(--primary); font: 600 9px var(--font-mono); letter-spacing: .1em; }
.auth-flow div b { color: var(--text-2); font-size: 12px; white-space: nowrap; }
.auth-flow i { width: 100%; height: 1px; background: var(--line-strong); }
.auth-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.auth-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid #e6ebf2;
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  color: var(--muted);
  font-size: 11px;
}
.auth-meta .icon { width: 14px; height: 14px; color: var(--primary); }
.login-card {
  padding: 38px;
  border: 1px solid #e7edf5;
  border-radius: 22px;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow-lg);
}
.card-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-3);
  font: 600 9px var(--font-mono);
  letter-spacing: .16em;
}
.card-kicker b { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.login-card h2 { margin: 26px 0 7px; color: var(--ink-950); font-size: 28px; letter-spacing: -.035em; }
.login-card > .muted { margin: 0 0 28px; font-size: 13px; }
.login-card label { display: block; margin: 16px 0; color: var(--text-2); font-size: 12px; font-weight: 600; }
.login-card input,
.toolbar input,
.form-grid input,
.form-grid select,
.stack-label input {
  display: block;
  width: 100%;
  height: 44px;
  margin-top: 8px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: 0;
  background: #fff;
  color: var(--text);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.login-card input::placeholder,
.toolbar input::placeholder,
.form-grid input::placeholder { color: var(--muted-3); }
.login-card input:hover,
.toolbar input:hover,
.form-grid input:hover,
.form-grid select:hover,
.stack-label input:hover { border-color: #b6c2d2; }
.login-card input:focus,
.toolbar input:focus,
.form-grid input:focus,
.form-grid select:focus,
.stack-label input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .1);
}
.login-card input[type="date"],
.toolbar input[type="date"],
.form-grid input[type="date"] { color-scheme: light; }
.login-card .primary.full { width: 100%; margin-top: 20px; }
.auth-links { display: flex; justify-content: center; gap: 6px; margin-top: 20px; color: var(--muted); font-size: 12px; }
.auth-links a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }
.login-foot { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 24px 0 0; color: var(--muted-3); font-size: 10px; }

/* Buttons */
.primary, .outline, .logout, .row-action {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.primary {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, .18);
}
.primary:hover { border-color: var(--primary-700); background: var(--primary-700); box-shadow: 0 7px 18px rgba(37, 99, 235, .2); transform: translateY(-1px); }
.primary:active { transform: translateY(0); }
.primary .icon { width: 17px; height: 17px; }
.outline { border: 1px solid var(--line-strong); background: #fff; color: var(--text-2); }
.outline:hover { border-color: #aebccd; background: var(--surface-2); color: var(--ink-950); }
.logout { min-height: 38px; padding: 0 11px; border: 1px solid transparent; background: transparent; color: var(--muted); }
.logout:hover { border-color: var(--line); background: #fff; color: var(--text); }
.logout .icon { width: 16px; height: 16px; }
.row-action { min-height: 32px; padding: 0 11px; border: 1px solid var(--primary-line); background: var(--primary-soft); color: var(--primary-700); font-size: 12px; }
.row-action:hover { border-color: #93c5fd; background: #e0ecff; }
.primary.full { width: 100%; }
.outline.compact { min-height: 34px; padding: 0 11px; font-size: 11px; }
.password-button { width: 100%; margin-top: 6px; }

/* Alerts and notices */
.alert { margin: 0 0 8px; padding: 11px 13px; border-radius: var(--radius-sm); font-size: 12px; line-height: 1.6; }
.alert.error { border: 1px solid var(--danger-line); background: var(--danger-soft); color: #b42318; }
.alert.success { border: 1px solid var(--success-line); background: var(--success-soft); color: #067647; }
.notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0 0 16px;
  padding: 11px 13px;
  border: 1px solid var(--primary-line);
  border-radius: 10px;
  background: var(--primary-soft);
  color: #1e40af;
  font-size: 12px;
  line-height: 1.7;
}
.notice .icon { width: 16px; height: 16px; margin-top: 2px; }
.notice.warning { border-color: var(--accent-line); background: var(--accent-soft); color: #9a3412; }
.notice.success { border-color: var(--success-line); background: var(--success-soft); color: #067647; }

/* App shell */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  flex-direction: column;
  overflow-y: auto;
  padding: 24px 16px 20px;
  border-right: 1px solid #18243a;
  background:
    radial-gradient(circle at 5% 0, rgba(59, 130, 246, .2), transparent 30%),
    linear-gradient(180deg, var(--ink-950), #0d1728 72%);
  color: #cbd5e1;
  scrollbar-width: thin;
}
.logo-line { display: flex; align-items: center; gap: 12px; padding: 3px 8px 28px; color: #fff; text-decoration: none; }
.brand-text { display: grid; gap: 2px; }
.brand-text strong { font-size: 17px; letter-spacing: -.01em; }
.brand-text small { color: #7f8ea6; font: 600 8px var(--font-mono); letter-spacing: .16em; }
.side-caption { padding: 0 10px 9px; color: #7f8ea6; font: 600 9px var(--font-mono); letter-spacing: .15em; }
.side-caption-lower { margin-top: 23px; }
.sidebar nav { display: grid; gap: 3px; }
.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 43px;
  align-items: center;
  gap: 11px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #93a2b8;
  text-align: left;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, .055); color: #e8eef7; }
.nav-item.active {
  border-color: #2a4368;
  background: linear-gradient(90deg, #1a2c48, #16243b);
  color: #fff;
  box-shadow: inset 3px 0 0 #60a5fa, 0 8px 20px rgba(0, 0, 0, .16);
}
.nav-item .icon { width: 18px; height: 18px; color: #73859d; }
.nav-item:hover .icon, .nav-item.active .icon { color: #93c5fd; }
.nav-label { font-size: 13px; font-weight: 550; }
.nav-chip {
  margin-left: auto;
  padding: 3px 6px;
  border: 1px solid #30415b;
  border-radius: 5px;
  background: rgba(255, 255, 255, .035);
  color: #8ca0b9;
  font: 600 8px var(--font-mono);
  letter-spacing: .04em;
}
.nav-chip.admin { border-color: #5b4523; background: rgba(245, 158, 11, .07); color: #fbbf24; }
.side-bottom { margin-top: auto; padding: 20px 8px 0; border-top: 1px solid rgba(255, 255, 255, .08); }
.connection { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.connection-text { display: grid; gap: 1px; }
.connection-text b { color: #dbe6f3; font-size: 11px; }
.connection-text small { color: #7f8ea6; font: 9px var(--font-mono); }
.status-dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52, 211, 153, .1); }
.version { margin-top: 8px; color: #73859d; font: 8px var(--font-mono); letter-spacing: .09em; }

.content { width: calc(100% - var(--sidebar-w)); min-width: 0; padding: 0 38px 32px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0 17px;
  background: rgba(245, 247, 250, .88);
  backdrop-filter: blur(14px);
}
.topbar-title { min-width: 0; }
.topbar-title h1 { margin: 3px 0 0; color: var(--ink-950); font-size: 24px; font-weight: 680; line-height: 1.2; letter-spacing: -.035em; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--success-line);
  border-radius: 999px;
  background: var(--success-soft);
  color: #067647;
  font: 600 9px var(--font-mono);
  letter-spacing: .04em;
  white-space: nowrap;
}
.mode-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.mode-pill.warn { border-color: var(--accent-line); background: var(--accent-soft); color: #b45309; }
.date-pill { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); font: 10px var(--font-mono); white-space: nowrap; }
.user-menu { display: flex; align-items: center; gap: 9px; padding-left: 5px; }
.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #dbeafe, #e0f2fe);
  color: var(--primary-700);
  font-size: 12px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px #bfdbfe;
}
.user-label { display: grid; gap: 0; min-width: 0; }
.user-label b { max-width: 118px; overflow: hidden; color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-label small { color: var(--muted-3); font-size: 9px; }

/* Shared content primitives */
.view { display: none; }
.view.active { display: block; animation: view-in .26s ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 22px; margin: 9px 0 20px; }
.section-intro { min-width: 0; }
.section-head h2, .section-head h3 { margin: 5px 0 0; color: var(--ink-950); font-size: 27px; line-height: 1.2; letter-spacing: -.035em; }
.section-head p { max-width: 720px; margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; margin: 28px 0 14px; }
.section-heading h3 { margin: 5px 0 0; color: var(--ink-950); font-size: 19px; letter-spacing: -.025em; }
.heading-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.heading-line h2 { margin: 0; }
.preview-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: #b45309;
  font: 600 9px var(--font-mono);
  white-space: nowrap;
}
.preview-badge.soft { border-color: var(--primary-line); background: var(--primary-soft); color: var(--primary-700); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar input { width: auto; min-width: 150px; margin: 0; }
.range-separator { color: var(--muted-3); font-size: 11px; }
.field-inline { display: flex; align-items: center; gap: 7px; }
.field-inline > span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.form-divider { display: flex; align-items: center; gap: 12px; margin: 25px 0 14px; color: var(--muted-3); font: 600 9px var(--font-mono); letter-spacing: .1em; }
.form-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  scrollbar-width: thin;
}
table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead { background: var(--surface-2); }
th {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .04em;
  text-align: left;
  white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid #edf1f6; color: var(--text-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .16s ease; }
tbody tr:hover { background: #fafcff; }
td b { display: block; color: var(--text); font-size: 12px; font-weight: 650; }
td small { display: block; margin-top: 3px; color: var(--muted-3); font: 10px var(--font-mono); }
.empty { padding: 52px 24px !important; color: var(--muted-3) !important; text-align: center !important; }
.loading { color: var(--muted) !important; }
.error-text { color: var(--danger) !important; }
.overview-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { display: inline-flex; padding: 4px 7px; border-radius: 6px; font-size: 10px; font-weight: 600; }
.cyan-tag, .blue-tag { border: 1px solid var(--primary-line); background: var(--primary-soft); color: var(--primary-700); }
.tag-stack { display: flex; flex-wrap: wrap; gap: 5px; max-width: 220px; }
.tag-stack span { padding: 4px 7px; border: 1px solid #e6ebf2; border-radius: 5px; background: var(--surface-2); color: var(--text-2); font-size: 10px; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 6px; font-size: 10px; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.complete { background: var(--success-soft); color: #067647; }
.status.pending { background: var(--accent-soft); color: #b45309; }
.level { color: #b45309; font-weight: 650; }

/* Forms and results */
.form-card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.form-grid label { color: var(--text-2); font-size: 11px; font-weight: 600; }
.form-grid input, .form-grid select { margin-top: 7px; }
.check-label { display: flex !important; align-items: center; gap: 8px; align-self: end; min-height: 44px; margin-top: 7px !important; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--muted) !important; }
.check-label input { width: 15px !important; height: 15px !important; flex: 0 0 auto; margin: 0 !important; accent-color: var(--primary); }
.stack-label { display: block; margin: 13px 0; color: var(--text-2); font-size: 11px; font-weight: 600; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-foot p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.form-hint { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.result-banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 12px; }
.result-banner.success { border-color: var(--success-line); background: var(--success-soft); }
.result-banner.error { border-color: var(--danger-line); background: var(--danger-soft); color: #b42318; }
.result-banner.loading { border-color: var(--primary-line); background: var(--primary-soft); color: #1e40af; }
.result-banner.demo { border-color: var(--accent-line); background: var(--accent-soft); color: #9a3412; }
.result-banner b, .result-banner small { display: block; }
.result-banner small { margin-top: 4px; color: inherit; opacity: .78; }
.result-banner code { color: inherit; }
.spinner { display: inline-block; width: 12px; height: 12px; margin-right: 7px; border: 2px solid rgba(37, 99, 235, .2); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Feedback */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  max-width: min(380px, calc(100% - 32px));
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-md);
  color: var(--text-2);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.modal { position: fixed; inset: 0; z-index: 30; display: none; place-items: center; padding: 20px; background: rgba(15, 23, 42, .52); backdrop-filter: blur(6px); }
.modal.open { display: grid; }
.modal-card { position: relative; width: min(540px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 28px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: var(--shadow-lg); }
.modal-close { position: absolute; top: 15px; right: 15px; display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); }
.modal-close:hover { border-color: var(--line); background: var(--surface-2); color: var(--text); }
.modal-close .icon { width: 16px; height: 16px; }
.modal-card h3 { margin: 8px 0 20px; color: var(--ink-950); font-size: 21px; letter-spacing: -.025em; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.result-grid small { display: block; margin-bottom: 6px; color: var(--muted-3); font: 9px var(--font-mono); }
.result-grid b { color: var(--text); font-size: 14px; }
.result-grid p { margin: 0; color: var(--text-2); line-height: 1.65; }
.result-wide { grid-column: 1 / -1; }
.confidence { color: var(--primary) !important; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (pointer: coarse) {
  .primary, .outline, .logout, .row-action, .filter-chip, .modal-close { min-height: 44px; }
  .nav-item { min-height: 48px; }
}

@media (max-width: 1080px) {
  .content { padding-right: 26px; padding-left: 26px; }
  .login-shell { gap: 48px; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 76px; }
  .sidebar { padding: 20px 10px 16px; }
  .logo-line { justify-content: center; padding: 3px 0 26px; }
  .brand-text, .side-caption, .nav-label, .nav-chip, .connection-text, .version { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-item.active { box-shadow: inset 0 -3px 0 #60a5fa; }
  .side-caption-lower { display: block; height: 1px; margin: 18px 10px; padding: 0; background: rgba(255, 255, 255, .08); font-size: 0; }
  .side-bottom { display: grid; place-items: center; padding: 16px 0 0; }
  .connection { padding: 0; }
  .login-shell { grid-template-columns: 1fr; width: min(540px, 100%); gap: 30px; }
  .login-brand { padding: 0; text-align: left; }
  .login-brand h1 { font-size: clamp(38px, 10vw, 54px); }
  .auth-flow, .auth-meta, .register-points { display: none; }
  .login-card { padding: 30px; }
}

@media (max-width: 720px) {
  .login-page { align-items: start; padding: 24px 16px 36px; }
  .auth-brand { margin-bottom: 26px; }
  .brand-copy { font-size: 14px; }
  .login-card input { height: 46px; }
  .content { padding: 0 16px 24px; }
  .topbar { gap: 12px; padding: 16px 0 13px; }
  .topbar-title h1 { font-size: 20px; }
  .mode-pill, .date-pill, .user-label { display: none; }
  .top-actions { gap: 6px; }
  .logout span { display: none; }
  .logout { width: 38px; padding: 0; }
  .section-head { display: block; }
  .section-head h2, .section-head h3 { font-size: 23px; }
  .toolbar { margin-top: 15px; }
  .toolbar input { flex: 1 1 130px; min-width: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .form-foot { display: block; }
  .form-foot .primary { width: 100%; margin-top: 12px; }
  .result-grid { grid-template-columns: 1fr; }
  .toast { right: 16px; bottom: 16px; }
}
