:root {
  --ink-950: #10201b;
  --ink-900: #182b25;
  --ink-800: #263c35;
  --ink-700: #3f554e;
  --ink-600: #63736e;
  --ink-500: #84918d;
  --paper: #f5f7f5;
  --surface: #ffffff;
  --surface-soft: #f8faf8;
  --line: #e3e8e5;
  --line-strong: #d5ddd9;
  --forest-900: #123c32;
  --forest-800: #174b3f;
  --forest-700: #1f6352;
  --forest-100: #dff0e9;
  --forest-50: #eff8f4;
  --blue-700: #336a8a;
  --blue-100: #e4eff6;
  --gold-700: #a26816;
  --gold-100: #f6ead2;
  --red-700: #a8423d;
  --red-100: #f8e3e1;
  --purple-700: #6b5b8f;
  --purple-100: #eee9f6;
  --shadow-sm: 0 1px 2px rgba(16, 32, 27, .04), 0 6px 20px rgba(16, 32, 27, .035);
  --shadow-md: 0 18px 55px rgba(16, 32, 27, .09);
  --sidebar-width: 272px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink-900);
  background: var(--paper);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
svg { display: block; }
.hidden { display: none !important; }
.muted-copy { color: var(--ink-600); }
.text-attention { color: var(--gold-700); }

/* Login */

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(520px, 1.05fr) minmax(480px, .95fr);
  background: var(--surface);
}

.login-brand-panel {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: clamp(36px, 5vw, 72px);
  overflow: hidden;
  color: white;
  background:
    radial-gradient(circle at 87% 14%, rgba(132, 203, 172, .28), transparent 26%),
    radial-gradient(circle at 10% 92%, rgba(211, 170, 93, .17), transparent 28%),
    linear-gradient(145deg, #153e34 0%, #102f28 58%, #0b2721 100%);
}

.login-brand-panel::before,
.login-brand-panel::after {
  position: absolute;
  z-index: -1;
  content: "";
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 50%;
}

.login-brand-panel::before { width: 560px; height: 560px; right: -330px; top: 11%; }
.login-brand-panel::after { width: 360px; height: 360px; right: -214px; top: 23%; }

.login-brand,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-symbol {
  width: 52px;
  height: 52px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 16px;
  color: var(--forest-900);
  background: #e8f2ec;
  font-family: Georgia, "Songti SC", serif;
  font-size: 24px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(5, 20, 16, .18);
}

.brand-symbol.small { width: 42px; height: 42px; border-radius: 13px; font-size: 19px; }
.login-brand strong, .login-brand small, .sidebar-brand strong, .sidebar-brand small { display: block; }
.login-brand strong { font-size: 17px; letter-spacing: .08em; }
.login-brand small { margin-top: 3px; color: rgba(255,255,255,.52); font-size: 9px; letter-spacing: .2em; }

.login-message { max-width: 730px; margin: auto 0; padding: 72px 0 56px; }
.eyebrow { margin: 0 0 11px; color: var(--forest-700); font-size: 10px; font-weight: 800; letter-spacing: .2em; }
.eyebrow.light { color: #91c9b0; }
.login-message h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(46px, 4.2vw, 72px); font-weight: 500; line-height: 1.18; letter-spacing: -.04em; }
.login-message > p:last-child { max-width: 650px; margin: 28px 0 0; color: rgba(255,255,255,.63); font-size: 16px; line-height: 1.9; }

.rhythm-track { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 700px; border-top: 1px solid rgba(255,255,255,.14); }
.rhythm-track div { position: relative; padding: 20px 12px 0 0; }
.rhythm-track div::before { position: absolute; width: 7px; height: 7px; top: -4px; left: 0; content: ""; border-radius: 50%; background: #8bc6ac; box-shadow: 0 0 0 5px rgba(139,198,172,.12); }
.rhythm-track span, .rhythm-track strong { display: block; }
.rhythm-track span { color: #8bc6ac; font-family: Georgia, serif; font-size: 20px; }
.rhythm-track strong { margin-top: 7px; color: rgba(255,255,255,.72); font-size: 12px; font-weight: 600; }
.login-brand-foot { margin: 38px 0 0; color: rgba(255,255,255,.35); font-size: 11px; letter-spacing: .12em; }

.login-form-panel { min-height: 100vh; display: grid; align-content: center; justify-items: center; padding: 56px; background: #f7f9f7; }
.login-card { width: min(480px, 100%); padding: 44px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-md); }
.login-card-head { display: flex; align-items: center; gap: 15px; }
.login-card-head h2 { margin: 0; color: var(--ink-950); font-size: 26px; letter-spacing: -.03em; }
.login-card-head .eyebrow { margin-bottom: 6px; }
.login-icon { width: 48px; height: 48px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 15px; color: var(--forest-700); background: var(--forest-50); }
.login-icon svg { width: 24px; fill: currentColor; }
.login-intro { margin: 22px 0 28px; color: var(--ink-600); font-size: 13px; line-height: 1.75; }
.login-form { display: grid; gap: 11px; }
.login-form label { color: var(--ink-700); font-size: 12px; font-weight: 700; }
.secure-input { position: relative; }
.secure-input svg { position: absolute; width: 19px; left: 15px; top: 15px; fill: var(--ink-500); }
.secure-input input { padding-left: 45px; }
.login-button { width: 100%; margin-top: 4px; justify-content: space-between; }
.form-error { min-height: 18px; margin: 0; color: var(--red-700); font-size: 12px; }
.form-disabled { opacity: .45; pointer-events: none; }
.login-status-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 17px; padding-top: 17px; border-top: 1px solid var(--line); color: var(--ink-500); font-size: 10px; }
.service-state { display: inline-flex; align-items: center; gap: 6px; }
.service-state i, .system-state > i { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--gold-700); box-shadow: 0 0 0 4px var(--gold-100); }
.service-state.online i, .system-state > i { background: #2c8a6b; box-shadow: 0 0 0 4px #dcefe8; }
.service-state.offline i { background: var(--red-700); box-shadow: 0 0 0 4px var(--red-100); }
.login-help { max-width: 480px; margin: 18px 0 0; color: var(--ink-500); font-size: 11px; text-align: center; }
.protocol-notice { display: grid; gap: 8px; margin: 0 0 22px; padding: 16px; border: 1px solid #ead29f; border-radius: 13px; color: #78511a; background: #fff8e9; font-size: 12px; line-height: 1.55; }
.protocol-notice strong { color: #69420d; font-size: 13px; }
.protocol-notice code { padding: 7px 9px; border-radius: 7px; color: var(--ink-800); background: rgba(255,255,255,.8); }
.protocol-notice a { color: var(--forest-700); font-weight: 700; }
.server-mode .protocol-notice { display: none; }

/* Form controls and buttons */

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--ink-900);
  background: var(--surface);
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
input, select { height: 46px; padding: 0 13px; }
textarea { min-height: 118px; padding: 13px; resize: vertical; line-height: 1.65; }
input:focus, textarea:focus, select:focus { border-color: var(--forest-700); box-shadow: 0 0 0 3px rgba(31,99,82,.1); }
.primary-button, .secondary-button, .ghost-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: transform .14s ease, box-shadow .14s ease, background .14s ease;
}
.primary-button { border: 1px solid var(--forest-800); color: white; background: var(--forest-800); box-shadow: 0 7px 18px rgba(23,75,63,.16); }
.secondary-button { border: 1px solid var(--forest-700); color: white; background: var(--forest-700); }
.ghost-button { border: 1px solid var(--line-strong); color: var(--ink-700); background: var(--surface); }
.primary-button:hover:not(:disabled), .secondary-button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 9px 22px rgba(23,75,63,.2); }
.ghost-button:hover:not(:disabled) { color: var(--forest-700); border-color: #a8c3b8; background: var(--forest-50); }

/* Application shell */

.app-layout { min-height: 100vh; }
.sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 25px 18px 20px;
  color: rgba(255,255,255,.82);
  background: linear-gradient(180deg, #143d33 0%, #102f28 100%);
  box-shadow: 12px 0 40px rgba(15,42,35,.08);
}
.sidebar-brand { min-height: 54px; padding: 0 10px 17px; border-bottom: 1px solid rgba(255,255,255,.09); }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand strong { color: white; font-size: 15px; }
.sidebar-brand small { margin-top: 4px; color: rgba(255,255,255,.4); font-size: 9px; letter-spacing: .15em; }
.sidebar-nav { flex: 1; padding-top: 26px; }
.nav-label { margin: 0 11px 9px; color: rgba(255,255,255,.34); font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.nav-label-spaced { margin-top: 27px; }
.nav-item { position: relative; width: 100%; min-height: 62px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 12px; color: rgba(255,255,255,.64); background: transparent; text-align: left; }
.nav-item::after { position: absolute; width: 3px; height: 25px; right: -18px; top: 50%; content: ""; border-radius: 3px 0 0 3px; background: transparent; transform: translateY(-50%); }
.nav-item:hover { color: white; background: rgba(255,255,255,.055); }
.nav-item.active { color: white; background: rgba(255,255,255,.1); box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.nav-item.active::after { background: #8dd0b2; }
.nav-item svg { width: 19px; flex: 0 0 auto; fill: currentColor; }
.nav-item span, .nav-item strong, .nav-item small { display: block; }
.nav-item strong { font-size: 13px; font-weight: 700; }
.nav-item small { margin-top: 4px; color: rgba(255,255,255,.35); font-size: 9px; }
.nav-item.active small { color: rgba(255,255,255,.52); }
.sidebar-footer { display: grid; gap: 13px; padding: 17px 10px 0; border-top: 1px solid rgba(255,255,255,.09); }
.system-state { display: flex; align-items: center; gap: 11px; }
.system-state strong, .system-state small { display: block; }
.system-state strong { color: rgba(255,255,255,.82); font-size: 11px; }
.system-state small { margin-top: 3px; color: rgba(255,255,255,.35); font-size: 9px; }
.privacy-compact { color: rgba(255,255,255,.28); font-size: 9px; line-height: 1.6; }
.sidebar-scrim { position: fixed; z-index: 25; inset: 0; border: 0; background: rgba(8,24,19,.55); backdrop-filter: blur(2px); }

.workspace { min-height: 100vh; margin-left: var(--sidebar-width); }
.workspace-topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 clamp(24px, 3vw, 46px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(12px); }
.topbar-leading, .topbar-actions, .user-summary { display: flex; align-items: center; }
.topbar-leading { gap: 12px; }
.breadcrumb { display: flex; align-items: center; gap: 9px; font-size: 11px; }
.breadcrumb span { color: var(--ink-500); }
.breadcrumb b { color: var(--line-strong); }
.breadcrumb strong { color: var(--ink-800); }
.topbar-actions { gap: 13px; }
.today-label { padding-right: 14px; border-right: 1px solid var(--line); color: var(--ink-500); font-size: 10px; }
.user-summary { gap: 9px; }
.user-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: white; background: var(--forest-700); font-size: 12px; font-weight: 800; }
.user-badge strong, .user-badge small { display: block; }
.user-badge strong { color: var(--ink-800); font-size: 11px; }
.user-badge small { margin-top: 2px; color: var(--ink-500); font-size: 9px; }
.icon-button { width: 38px; height: 38px; display: grid; flex: 0 0 auto; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 10px; color: var(--ink-600); background: var(--surface); font-size: 22px; }
.icon-button svg { width: 19px; fill: currentColor; }
.menu-button { display: none; }

.workspace-content { width: min(1480px, 100%); margin: 0 auto; padding: 38px clamp(24px, 3vw, 46px) 72px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 29px; }
.heading-meta { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; color: var(--forest-700); font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.heading-meta i { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-500); }
.heading-meta span:last-child { color: var(--ink-500); font-weight: 600; letter-spacing: 0; }
.page-heading h2 { margin: 0; color: var(--ink-950); font-family: Georgia, "Songti SC", serif; font-size: clamp(32px, 3vw, 46px); font-weight: 500; letter-spacing: -.04em; }
.page-heading p { margin: 10px 0 0; color: var(--ink-600); font-size: 13px; }
.page-heading-note { display: grid; justify-items: end; gap: 5px; padding: 13px 0 13px 22px; border-left: 2px solid var(--forest-100); }
.page-heading-note span { color: var(--ink-500); font-size: 9px; letter-spacing: .12em; }
.page-heading-note strong { color: var(--ink-700); font-size: 12px; }

.view-section { min-width: 0; }
.toolbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 17px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow-sm); }
.toolbar-title { display: flex; align-items: center; gap: 11px; }
.toolbar-title strong, .toolbar-title small { display: block; }
.toolbar-title strong { color: var(--ink-800); font-size: 12px; }
.toolbar-title small { margin-top: 4px; color: var(--ink-500); font-size: 9px; }
.toolbar-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: var(--forest-700); background: var(--forest-50); font-size: 12px; font-weight: 800; }
.toolbar-fields { display: flex; align-items: end; gap: 9px; }
.toolbar label { width: 165px; color: var(--ink-500); font-size: 9px; font-weight: 700; }
.toolbar input, .toolbar select { height: 38px; margin-top: 5px; padding: 0 10px; border-radius: 9px; font-size: 11px; }

/* Dashboard */

.content-stack { display: grid; gap: 17px; }
.loading-panel, .error-panel { min-height: 260px; display: flex; align-items: center; justify-content: center; gap: 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); color: var(--ink-500); background: rgba(255,255,255,.56); font-size: 12px; }
.error-panel { color: var(--red-700); border-color: #edc7c4; background: #fff8f7; }
.error-icon { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--red-700); font-weight: 800; }
.loader { width: 18px; height: 18px; border: 2px solid var(--line-strong); border-top-color: var(--forest-700); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.metric-card { position: relative; min-height: 138px; padding: 19px 20px 17px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
.metric-card::before { position: absolute; width: 66px; height: 66px; right: -28px; bottom: -28px; content: ""; border-radius: 50%; background: var(--forest-50); }
.metric-topline { display: flex; align-items: center; justify-content: space-between; }
.metric-label { color: var(--ink-600); font-size: 10px; font-weight: 700; }
.metric-mark { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-500); box-shadow: 0 0 0 4px #eef1ef; }
.metric-value { display: block; margin-top: 16px; color: var(--ink-950); font-family: Georgia, serif; font-size: 31px; font-weight: 500; line-height: 1; }
.metric-detail { display: block; margin-top: 11px; color: var(--ink-500); font-size: 9px; line-height: 1.45; }
.metric-forest .metric-mark { background: var(--forest-700); box-shadow: 0 0 0 4px var(--forest-100); }
.metric-blue .metric-mark { background: var(--blue-700); box-shadow: 0 0 0 4px var(--blue-100); }
.metric-gold .metric-mark { background: var(--gold-700); box-shadow: 0 0 0 4px var(--gold-100); }
.metric-purple .metric-mark { background: var(--purple-700); box-shadow: 0 0 0 4px var(--purple-100); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr); gap: 17px; }
.dashboard-main { grid-row: span 1; }
.weekly-grid { align-items: start; }
.panel { min-width: 0; padding: 21px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
.panel.full { grid-column: 1 / -1; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.panel-header h3 { margin: 0; color: var(--ink-900); font-size: 14px; }
.panel-kicker { margin: 0 0 5px; color: var(--ink-500); font-size: 8px; font-weight: 800; letter-spacing: .16em; }
.count-pill { flex: 0 0 auto; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-500); background: var(--surface-soft); font-size: 9px; }
.attention-pill { color: var(--gold-700); border-color: #ead6ad; background: #fff9ed; }
.success-pill { color: var(--forest-700); border-color: #cce4da; background: var(--forest-50); }
.table-scroll { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 9px 8px; color: var(--ink-500); font-size: 9px; font-weight: 700; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.data-table td { padding: 13px 8px; border-bottom: 1px solid #edf0ee; color: var(--ink-700); font-size: 11px; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfcfb; }
.table-empty { padding: 25px; color: var(--ink-500); text-align: center; }
.person-name { display: block; color: var(--ink-900); font-weight: 750; white-space: nowrap; }
.person-meta { display: block; max-width: 220px; margin-top: 4px; overflow: hidden; color: var(--ink-500); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.status-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 25px; padding: 4px 8px; border: 0; border-radius: 999px; font-size: 9px; white-space: nowrap; }
.status-chip::before { width: 5px; height: 5px; content: ""; border-radius: 50%; background: currentColor; }
.status-chip.ok { color: var(--forest-700); background: var(--forest-50); }
.status-chip.missing { color: #8c6b35; background: #faf3e5; }
.report-button { cursor: pointer; }
.report-button:hover { box-shadow: inset 0 0 0 1px #a8ccbd; }
.work-status-select { min-width: 82px; height: 31px; padding: 0 7px; border-radius: 8px; font-size: 9px; }

.health-card { position: relative; min-height: 100%; display: flex; flex-direction: column; padding: 23px; overflow: hidden; border-radius: var(--radius-md); color: white; background: linear-gradient(145deg, #194b3f, #12372f); box-shadow: var(--shadow-sm); }
.health-card::before, .health-card::after { position: absolute; content: ""; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; }
.health-card::before { width: 190px; height: 190px; right: -95px; top: -85px; }
.health-card::after { width: 120px; height: 120px; right: -55px; top: -42px; }
.health-card.level-yellow { background: linear-gradient(145deg, #815b22, #5f431c); }
.health-card.level-red { background: linear-gradient(145deg, #833d39, #5c2d2a); }
.health-card-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; }
.health-label { display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,.72); font-size: 10px; }
.health-date { color: rgba(255,255,255,.38); font-size: 8px; letter-spacing: .12em; }
.health-dot { width: 7px; height: 7px; border-radius: 50%; background: #78d2ab; box-shadow: 0 0 0 5px rgba(120,210,171,.12); }
.health-dot.yellow { background: #f1c46d; }
.health-dot.red { background: #ff938b; }
.health-title { position: relative; z-index: 1; display: block; margin: 25px 0 10px; font-family: Georgia, "Songti SC", serif; font-size: 30px; font-weight: 500; }
.health-card p { position: relative; z-index: 1; margin: 0; color: rgba(255,255,255,.64); font-size: 11px; line-height: 1.7; }
.health-divider { position: relative; z-index: 1; width: 100%; height: 1px; margin: auto 0 12px; background: rgba(255,255,255,.12); }
.health-footnote { position: relative; z-index: 1; color: rgba(255,255,255,.35); font-size: 8px; line-height: 1.5; }

.list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.list-item { padding: 12px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-soft); }
.list-item strong, .list-item span { display: block; }
.list-item strong { color: var(--ink-800); font-size: 11px; }
.list-item span { margin-top: 5px; color: var(--ink-500); font-size: 9px; line-height: 1.55; }
.list-item.attention { border-left: 3px solid var(--gold-700); }
.list-item.decision { border-left: 3px solid var(--red-700); }
.signal-item { border-left: 3px solid var(--forest-700); }
.empty-state { min-height: 92px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; border: 1px dashed var(--line); border-radius: var(--radius-sm); color: var(--ink-500); background: var(--surface-soft); font-size: 10px; }
.empty-state-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; color: var(--forest-700); background: var(--forest-100); font-size: 11px; font-weight: 800; }

/* Weekly and admin */

.meeting-form { display: grid; gap: 14px; }
.meeting-form label, .compact-form label { color: var(--ink-600); font-size: 10px; font-weight: 700; }
.meeting-form input, .meeting-form textarea, .compact-form input, .compact-form select { margin-top: 6px; }
.form-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.meeting-actions { display: flex; justify-content: flex-end; gap: 9px; }
.admin-overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.admin-stat { min-height: 112px; padding: 17px 19px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
.admin-stat span, .admin-stat strong, .admin-stat small { display: block; }
.admin-stat span { color: var(--ink-600); font-size: 10px; }
.admin-stat strong { margin-top: 11px; color: var(--ink-950); font-family: Georgia, serif; font-size: 25px; font-weight: 500; }
.admin-stat small { margin-top: 5px; color: var(--ink-500); font-size: 8px; }
.admin-grid { display: grid; grid-template-columns: minmax(320px, .72fr) minmax(0, 1.55fr); gap: 17px; }
.admin-stack { display: grid; gap: 17px; align-content: start; }
.compact-form { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.compact-form .full-row { grid-column: 1 / -1; }
.compact-form button { min-height: 42px; margin-top: 16px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.mini-button { min-height: 28px; padding: 3px 8px; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--ink-700); background: var(--surface); font-size: 9px; }
.mini-button:hover:not(:disabled) { border-color: #a8c3b8; color: var(--forest-700); background: var(--forest-50); }
.mini-button.danger { color: var(--red-700); }
.inactive-row { opacity: .5; }
.audit-detail { max-width: 300px; overflow: hidden; color: var(--ink-500); text-overflow: ellipsis; white-space: nowrap; }

/* Dialogs and feedback */

.modal { width: min(780px, calc(100% - 32px)); max-height: min(86vh, 900px); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 21px; color: var(--ink-900); background: var(--surface); box-shadow: 0 35px 100px rgba(9,30,23,.28); }
.modal::backdrop { background: rgba(9,27,22,.58); backdrop-filter: blur(4px); }
.modal-header { display: flex; align-items: start; justify-content: space-between; padding: 21px 24px 17px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.modal-header h3 { margin: 0; color: var(--ink-950); font-family: Georgia, "Songti SC", serif; font-size: 25px; font-weight: 500; }
.modal-header .eyebrow { margin-bottom: 6px; }
.modal-content { max-height: calc(86vh - 92px); padding: 22px 24px 27px; overflow: auto; }
.modal-content.loading-panel { min-height: 260px; }
.report-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.report-meta span { padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-500); background: var(--surface-soft); font-size: 8px; }
.report-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.report-section { margin-bottom: 16px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.report-section h4 { margin: 0 0 9px; color: var(--ink-800); font-size: 10px; }
.report-section p { margin: 0; color: var(--ink-600); font-size: 11px; line-height: 1.7; white-space: pre-wrap; }
.report-focus { border-left: 3px solid var(--forest-700); background: var(--forest-50); }
.token-modal { width: min(580px, calc(100% - 32px)); }
.security-callout { display: grid; gap: 5px; padding: 13px; border: 1px solid #ead6ad; border-radius: 11px; color: #77501b; background: #fff9ed; font-size: 10px; line-height: 1.55; }
.security-callout strong { font-size: 12px; }
.token-display { display: block; margin: 17px 0; padding: 15px; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 11px; color: var(--forest-700); background: var(--surface-soft); font-size: 12px; }
.modal-action { min-height: 41px; }
.toast { position: fixed; z-index: 100; right: 25px; bottom: 25px; max-width: min(390px, calc(100% - 30px)); padding: 13px 16px; border-radius: 11px; color: white; background: var(--ink-900); box-shadow: var(--shadow-md); font-size: 11px; }
.toast[data-tone="success"] { background: var(--forest-700); }
.toast[data-tone="warning"] { background: #80571b; }
.toast[data-tone="error"] { background: var(--red-700); }

@media (max-width: 1180px) {
  :root { --sidebar-width: 244px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .health-card { min-height: 230px; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-wide { min-width: 0; }
}

@media (max-width: 920px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand-panel { min-height: auto; padding: 34px 30px 40px; }
  .login-message { margin: 60px 0 48px; padding: 0; }
  .login-message h1 { font-size: clamp(40px, 8vw, 60px); }
  .login-form-panel { min-height: auto; padding: 55px 24px 70px; }
  .sidebar { transform: translateX(-105%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .workspace { margin-left: 0; }
  .menu-button { display: grid; }
  .page-heading-note { display: none; }
  .toolbar { align-items: flex-start; }
  .toolbar-fields { flex-wrap: wrap; justify-content: flex-end; }
}

@media (max-width: 680px) {
  .login-brand-panel { padding: 25px 22px 31px; }
  .login-message { margin: 50px 0 38px; }
  .login-message h1 { font-size: 38px; }
  .login-message > p:last-child { font-size: 14px; }
  .rhythm-track span { font-size: 17px; }
  .login-form-panel { padding: 35px 16px 55px; }
  .login-card { padding: 29px 22px; border-radius: 20px; }
  .login-status-row { align-items: flex-start; flex-direction: column; }
  .workspace-topbar { height: 67px; padding: 0 16px; }
  .breadcrumb span, .breadcrumb b, .today-label, .user-badge { display: none; }
  .topbar-actions { gap: 8px; }
  .workspace-content { padding: 27px 15px 50px; }
  .page-heading { margin-bottom: 22px; }
  .page-heading h2 { font-size: 33px; }
  .page-heading p { font-size: 12px; line-height: 1.65; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-fields { align-items: stretch; flex-direction: column; }
  .toolbar label { width: 100%; }
  .metrics-grid, .admin-overview, .form-columns, .report-columns { grid-template-columns: 1fr; }
  .metric-card { min-height: 125px; }
  .compact-form { grid-template-columns: 1fr; }
  .compact-form .full-row { grid-column: auto; }
  .panel { padding: 17px; }
  .data-table { min-width: 680px; }
  .meeting-actions { align-items: stretch; flex-direction: column-reverse; }
  .modal-header, .modal-content { padding-left: 18px; padding-right: 18px; }
  .toast { right: 15px; bottom: 15px; }
}

@media print {
  body { background: white; }
  .sidebar, .workspace-topbar, .page-heading, .toolbar, #dailyView, #adminView, .meeting-actions { display: none !important; }
  .workspace { margin: 0; }
  .workspace-content { width: 100%; padding: 0; }
  #weeklyView { display: block !important; }
  .panel, .metric-card, .health-card { box-shadow: none; break-inside: avoid; }
}
