:root {
  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --bg-sidebar: rgba(246, 246, 248, 0.86);
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.12);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --green: #34c759;
  --yellow: #ff9f0a;
  --red: #ff3b30;
  --purple: #af52de;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
  --sidebar-w: 220px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--accent); text-decoration: none; }
::selection { background: var(--accent-soft); }

/* ——— Login ——— */
.login-body {
  min-height: 100%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(0, 113, 227, 0.12), transparent 60%),
    radial-gradient(900px 500px at 100% 100%, rgba(52, 199, 89, 0.08), transparent 50%),
    var(--bg);
  padding: 24px;
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px 28px;
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin-top: 14px; }
.login-brand p { color: var(--ink-2); font-size: 13px; margin-top: 6px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); }
.field .input { width: 100%; }
.hint.center { text-align: center; font-size: 12px; color: var(--ink-3); line-height: 1.5; }

/* ——— Shell ——— */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px calc(16px + var(--safe-bottom));
  background: var(--bg-sidebar);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(145deg, #42a1ec, #0071e3);
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.35);
  flex-shrink: 0;
}
.brand-mark.lg { width: 52px; height: 52px; border-radius: 14px; font-size: 22px; margin: 0 auto; }
.brand-title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--ink-3); margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  opacity: 0.88;
  transition: background 0.15s ease, opacity 0.15s ease;
  text-align: left;
}
.nav-item:hover { background: rgba(0, 0, 0, 0.05); opacity: 1; }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  opacity: 1;
  font-weight: 600;
}
.nav-icon { width: 18px; text-align: center; opacity: 0.9; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.sidebar-foot .hint { padding: 0 8px; }

.main {
  padding: 28px 32px 48px;
  max-width: 1180px;
  width: 100%;
}
.view { display: none; animation: fadeIn 0.18s ease; }
.view.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ——— Type & layout ——— */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}
.page-head h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.muted { color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.hint { font-size: 12px; color: var(--ink-3); line-height: 1.55; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.toolbar .input.grow { flex: 1; min-width: 180px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat-label { color: var(--ink-2); font-size: 12px; font-weight: 500; }
.stat-value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat-value.red { color: var(--red); }
.stat-value.yellow { color: var(--yellow); }
.stat-value.green { color: var(--green); }
.stat-value.accent { color: var(--accent); }

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  min-height: 120px;
}
.panel.span2 { grid-column: 1 / -1; }
.panel h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.list-item .title { font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em; }
.list-item .meta { color: var(--ink-3); font-size: 11.5px; margin-top: 3px; line-height: 1.45; }
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover {
  border-color: rgba(0, 113, 227, 0.35);
  background: var(--accent-soft);
}
.empty {
  color: var(--ink-3);
  font-size: 13px;
  padding: 12px 4px;
}

/* ——— Controls ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 980px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}
.btn:hover { background: rgba(0, 0, 0, 0.08); }
.btn:active { transform: scale(0.98); }
.btn.primary {
  background: var(--accent);
  color: #fff;
}
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--red); background: rgba(255, 59, 48, 0.1); }
.btn.ghost { background: transparent; border-color: var(--line-strong); }
.btn.block { width: 100%; }
.btn.lg { padding: 12px 18px; font-size: 15px; }
.btn.sm { padding: 6px 10px; font-size: 12px; }

.input,
select.input,
textarea.input {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--bg-elevated);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea.input { resize: vertical; min-height: 72px; line-height: 1.5; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 980px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink-2);
  white-space: nowrap;
}
.badge.green { color: #1d7a3e; background: rgba(52, 199, 89, 0.14); }
.badge.yellow { color: #a85d00; background: rgba(255, 159, 10, 0.16); }
.badge.red { color: #c42c24; background: rgba(255, 59, 48, 0.12); }
.badge.blue { color: var(--accent); background: var(--accent-soft); }
.badge.purple { color: var(--purple); background: rgba(175, 82, 222, 0.12); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.card-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.card h3 { font-size: 15px; font-weight: 650; letter-spacing: -0.015em; }
.card .desc { color: var(--ink-2); font-size: 12.5px; line-height: 1.55; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.list-panel { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 0.7fr 0.7fr 0.8fr auto;
  gap: 10px;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.row .title { font-size: 13.5px; font-weight: 600; }
.row .meta { color: var(--ink-3); font-size: 11.5px; margin-top: 2px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

.briefing {
  margin: 0 0 12px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(0, 113, 227, 0.04), transparent 40%), var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
  max-height: 360px;
  overflow: auto;
}

/* ——— Modal ——— */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 100;
  backdrop-filter: blur(6px);
}
.modal.hidden, .hidden { display: none !important; }
.modal-card {
  width: min(620px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  background: var(--bg-elevated);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}
.modal-head {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  z-index: 1;
}
.modal-head h3 { font-size: 16px; font-weight: 650; letter-spacing: -0.02em; }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  font-size: 20px;
  line-height: 1;
  color: var(--ink-2);
}
.icon-btn:hover { background: rgba(0, 0, 0, 0.08); }

.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ——— Search palette ——— */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  z-index: 120;
  display: none;
  padding: 12vh 16px 16px;
  justify-content: center;
  align-items: flex-start;
  backdrop-filter: blur(8px);
}
.search-overlay.open { display: flex; }
.search-panel {
  width: min(560px, 100%);
  background: var(--bg-elevated);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.search-panel input {
  width: 100%;
  border: 0;
  padding: 16px 18px;
  font-size: 16px;
  outline: none;
  background: transparent;
}
.search-results { max-height: 50vh; overflow: auto; border-top: 1px solid var(--line); }
.search-group-title {
  padding: 10px 16px 4px;
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 600;
}
.search-hit {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
}
.search-hit:hover { background: var(--accent-soft); }
.search-hit .t { font-size: 13px; font-weight: 550; }
.search-hit .m { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

/* ——— Misc ——— */
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--line);
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}
.progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin: 6px 0 4px;
}
.progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 0.25s ease;
}
.theme-btn.active {
  background: var(--accent);
  color: #fff;
}

/* ——— AI Agent ——— */
.agent-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(145deg, #5b8cff, var(--accent));
  color: #fff;
  font-size: 22px;
  box-shadow: var(--shadow-lg);
  z-index: 80;
}
.agent-panel {
  position: fixed;
  right: 18px;
  bottom: 88px;
  width: min(420px, calc(100vw - 24px));
  height: min(560px, 70vh);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  z-index: 90;
  overflow: hidden;
}
.agent-panel.hidden { display: none; }
.agent-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.agent-msgs {
  flex: 1;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.agent-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.agent-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
}
.agent-msg.bot {
  align-self: flex-start;
  background: rgba(0, 0, 0, 0.05);
}
.agent-msg.sys {
  align-self: stretch;
  background: var(--accent-soft);
  color: var(--ink-2);
  font-size: 12px;
}
.agent-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
}
.agent-input {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
}
.contract-col h3 {
  font-size: 12px;
  color: var(--ink-2);
  margin-bottom: 8px;
}

/* Executive dashboard */
.exec-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, var(--accent-soft), transparent 55%), var(--bg-elevated);
  border: 1px solid var(--line);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.exec-banner-tag {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  padding-top: 3px;
}
.exec-banner-text {
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
}
.kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.kpi-card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.kpi-card .k-label {
  font-size: 11px;
  color: var(--ink-2);
  font-weight: 550;
}
.kpi-card .k-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 6px 0 2px;
  font-variant-numeric: tabular-nums;
}
.kpi-card .k-meta {
  font-size: 11px;
  color: var(--ink-3);
}
.kpi-card .k-meta.up { color: var(--green); }
.kpi-card .k-meta.down { color: var(--red); }
.matrix {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  min-height: 220px;
}
.matrix-cell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(0, 0, 0, 0.02);
}
.matrix-cell h4 {
  font-size: 11px;
  color: var(--ink-2);
  margin-bottom: 8px;
  font-weight: 650;
}
.bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  margin: 3px;
  cursor: pointer;
  color: #fff;
}
.bubble.green { background: var(--green); }
.bubble.yellow { background: var(--yellow); }
.bubble.red { background: var(--red); }
.pulse-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pulse-row {
  display: grid;
  grid-template-columns: 72px 1fr 48px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}
.bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}
.bar-fill.yellow { background: var(--yellow); }
.bar-fill.red { background: var(--red); }
.bar-fill.green { background: var(--green); }
.goal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.goal-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--bg-elevated);
}
.goal-item .g-title { font-size: 12px; font-weight: 650; margin-bottom: 8px; }

/* Kanban */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.kanban-col {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  min-height: 280px;
  padding: 10px;
}
.kanban-col h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.kanban-card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.kanban-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}
.kanban-card .kc-title {
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.4;
}
.kanban-card .kc-meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.45;
}
.kanban-card .kc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.module-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.module-tabs .btn.primary {
  background: var(--accent);
  color: #fff;
}
@media (max-width: 1100px) {
  .kanban { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
}
@media (max-width: 700px) {
  .kanban { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .matrix { grid-template-columns: 1fr; }
}

/* ——— Responsive ——— */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 10px calc(8px + var(--safe-bottom));
    border-right: 0;
    border-top: 1px solid var(--line);
    overflow-x: auto;
  }
  .brand, .sidebar-foot { display: none; }
  .nav { flex-direction: row; gap: 4px; width: 100%; }
  .nav-item {
    flex-direction: column;
    gap: 2px;
    font-size: 10px;
    padding: 8px 6px;
    min-width: 64px;
  }
  .main { padding: 18px 14px 96px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr 1fr; }
  .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 520px) {
  .page-head h1 { font-size: 22px; }
  .stat-value { font-size: 22px; }
}
