:root {
  color-scheme: light;
  --navy: #102e50;
  --navy-deep: #0b223b;
  --blue: #1375ce;
  --blue-dark: #075da9;
  --ink: #17283a;
  --muted: #6e7e90;
  --line: #e3eaf1;
  --surface: #fff;
  --canvas: #f3f6fa;
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
}

body { min-width: 320px; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #78b6ed;
  outline-offset: 2px;
}

header {
  position: relative;
  z-index: 4;
  height: 76px;
  padding: 0 clamp(16px, 3vw, 40px);
  background: linear-gradient(112deg, var(--navy-deep), #103b68 70%, #174b7f);
  box-shadow: 0 5px 24px #0c2e4d1c;
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 18px; line-height: 1.15; letter-spacing: 0; }
.brand small { display: block; margin-top: 4px; font-size: 11px; font-weight: 500; letter-spacing: .18em; color: #b9d2ea; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: #ffffff24; color: #bfe2ff; font-size: 20px; }
.toplinks { gap: 6px; }
.toplinks button { padding: 10px 16px; border-radius: 10px; font-weight: 600; color: #dfebf7; }
.toplinks button.active, .toplinks button:hover { background: #ffffff20; color: #fff; }

.layout { grid-template-columns: 244px minmax(0, 1fr); min-height: calc(100vh - 76px); }
aside { border-color: var(--line); box-shadow: 2px 0 14px #17365505; }
.group-picker { padding: 23px 18px 19px; border-color: var(--line); }
.group-picker label { margin-bottom: 9px; color: #718198; font-weight: 700; letter-spacing: .04em; }
.group-picker select { border-radius: 10px; padding: 11px 13px; border-color: #d8e1eb; font-weight: 600; }
nav { padding: 10px 11px 22px; }
.nav-heading { padding: 20px 13px 7px; font-size: 11px; font-weight: 800; color: #92a0af; letter-spacing: .14em; }
nav button { min-height: 42px; gap: 12px; margin: 2px 0; padding: 10px 13px; border-radius: 10px; color: #34475a; font-weight: 600; transition: background .15s, color .15s; }
nav button .icon { width: 21px; flex: 0 0 21px; color: #4a83bb; font-size: 17px; }
nav button:hover { background: #f2f7fc; color: #0d5da6; }
nav button.active { background: #eaf4ff; color: #075da9; box-shadow: inset 3px 0 #1979d0; }
nav button.active .icon { color: #0b69bd; }
.aside-foot { border-top: 1px solid var(--line); }
.aside-foot button { width: 100%; padding: 10px 12px; border-radius: 9px; text-align: left; }
.aside-foot button:hover { background: #f2f6fa; color: #34475a; }

main { padding: clamp(22px, 3vw, 38px); }
.page-heading { max-width: 1360px; align-items: flex-end; gap: 16px; margin: 0 0 24px; }
.page-heading h1 { font-size: clamp(23px, 2.4vw, 30px); font-weight: 750; letter-spacing: -.025em; }
.page-heading .eyebrow { margin: 0 0 8px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
#page-subtitle { margin: 7px 0 0; color: var(--muted); line-height: 1.5; }
#status { max-width: 50%; text-align: right; line-height: 1.5; font-size: 12px; color: #60758a; }
#content { max-width: 1360px; }
.card, .stat { border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 5px 24px #24415e0b; }
.card { margin-bottom: 18px; }
.card h2 { padding: 18px 23px; border-color: #edf1f6; font-size: 16px; font-weight: 750; }
.card-body { padding: 23px; }
.card-body > p:first-child { margin-top: 0; }
.card-body > p:last-child { margin-bottom: 0; }
.hint, .field small { color: var(--muted); line-height: 1.65; }
.hint { margin-bottom: 18px; }

.dashboard-intro { display: flex; align-items: center; justify-content: space-between; min-height: 172px; margin-bottom: 18px; padding: 28px 34px; border-radius: 17px; color: white; background: linear-gradient(120deg, #10365f, #1765ad); overflow: hidden; }
.dashboard-intro h2 { margin: 9px 0 6px; font-size: clamp(22px, 2.6vw, 30px); }
.dashboard-intro p { margin: 0; color: #d9eafa; line-height: 1.5; }
.intro-kicker { font-size: 12px; color: #b8dcfb; font-weight: 700; letter-spacing: .12em; }
.intro-orb { display: grid; place-items: center; width: 110px; height: 110px; flex: 0 0 110px; border-radius: 50%; background: #ffffff18; color: #d8eeff; font-size: 62px; transform: rotate(-16deg); }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { min-height: 154px; padding: 23px; }
.stat .label { color: #64788d; font-size: 13px; font-weight: 600; }
.stat strong { margin-top: 12px; color: var(--blue); font-size: 38px; line-height: 1; font-weight: 750; }
.stat small { display: block; margin-top: 13px; color: #94a1ad; }

form[data-form] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; align-items: start; }
form[data-form] .field:has(textarea), form[data-form] .field:has(input[type=password]), form[data-form] .check { grid-column: 1 / -1; }
form[data-form] > button, form[data-form] > .actions { justify-self: start; grid-column: 1 / -1; }
.field { gap: 8px; margin-bottom: 18px; }
.field label { color: #354b60; font-size: 13px; font-weight: 700; }
.field input, .field textarea, .field select, .group-picker select { transition: border-color .16s, box-shadow .16s; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local], textarea, select { min-height: 42px; padding: 10px 13px; border: 1px solid #d7e0e9; border-radius: 9px; }
textarea { min-height: 112px; line-height: 1.55; }
input:focus, textarea:focus, select:focus { border-color: #3893df; box-shadow: 0 0 0 3px #3893df1c; }
.check { padding: 10px 0; color: #33485d; font-weight: 650; }
.check input { accent-color: var(--blue); }
.actions { align-items: center; }
.primary, .secondary, .danger { min-height: 38px; padding: 9px 16px; border-radius: 9px; transition: background .15s, transform .15s, border-color .15s; }
.primary { background: var(--blue); box-shadow: 0 4px 11px #1375ce22; }
.primary:hover { background: var(--blue-dark); }
.secondary { border-color: #c7d9eb; background: #f8fbfe; }
.secondary:hover { background: #e9f4ff; border-color: #8bbde9; }
.danger:hover { background: #fff3f2; }
.primary:active, .secondary:active, .danger:active { transform: translateY(1px); }

.table-wrap { margin: -4px -23px -23px; border-radius: 0 0 15px 15px; }
table { min-width: 620px; }
th { background: #f8fafc; color: #718294; font-size: 12px; font-weight: 750; letter-spacing: .02em; }
th, td { padding: 13px 19px; border-color: #edf1f5; line-height: 1.5; }
tbody tr:hover { background: #f9fbfe; }
tbody tr:last-child td { border-bottom: 0; }
.empty { color: #8290a0; }
.pill { font-weight: 650; }
code { padding: 5px 9px; border-radius: 7px; background: #edf5fc; color: #095d9f; font-family: inherit; font-weight: 700; white-space: nowrap; }
.command-chips { display: flex; flex-wrap: wrap; gap: 9px; }
.speech-target[hidden] { display: none; }
.entry-mode-field { grid-column: 1 / -1; }
.field-title { color: #354b60; font-size: 13px; font-weight: 700; }
.entry-mode-options { display: flex; gap: 10px; flex-wrap: wrap; }
.entry-mode-options label { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 9px 13px; border: 1px solid #d7e0e9; border-radius: 9px; background: #fff; cursor: pointer; }
.entry-mode-options label:has(input:checked) { border-color: #3993dc; background: #edf7ff; color: #075da9; }
.entry-mode-options input { accent-color: var(--blue); }
.period-tabs { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 20px; padding: 5px; width: fit-content; border: 1px solid var(--line); border-radius: 11px; background: #f3f7fb; }
.period-tabs button { min-width: 56px; padding: 8px 15px; border: 0; border-radius: 8px; background: transparent; color: #657b90; font-weight: 700; }
.period-tabs button.active { background: #fff; color: var(--blue-dark); box-shadow: 0 2px 9px #18375516; }
.speech-date { max-width: 240px; }

.login-overlay { background: #0b284bd6; backdrop-filter: blur(5px); }
.login-card { width: min(420px, calc(100vw - 32px)); padding: 34px; border-radius: 18px; box-shadow: 0 28px 75px #06172c55; }
.login-card h2 { font-size: 23px; }
.login-card .primary, .login-card .secondary { width: 100%; }
#toast { max-width: min(380px, calc(100vw - 30px)); border-radius: 10px; box-shadow: 0 10px 30px #0a25443a; }

@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .brand { display: flex; } .brand small { display: none; } .brand-mark { width: 34px; height: 34px; } }
@media (max-width: 560px) {
  header { height: 66px; padding: 0 12px; gap: 7px; }
  header #menu { display: block; padding: 8px 10px; }
  .brand { gap: 7px; font-size: 14px; }
  .brand-mark { width: 29px; height: 29px; font-size: 16px; }
  .toplinks button { padding: 8px 7px; font-size: 12px; }
  aside { top: 66px; width: min(274px, 82vw); }
  main { padding: 20px 14px 44px; }
  .page-heading { display: block; margin-bottom: 19px; }
  #status { display: block; max-width: none; margin-top: 10px; text-align: left; }
  .card h2 { padding: 15px 17px; }
  .card-body { padding: 17px; }
  .dashboard-intro { min-height: 140px; padding: 23px; }
  .intro-orb { width: 62px; height: 62px; flex-basis: 62px; font-size: 38px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { min-height: 122px; padding: 17px; }
  .stat strong { font-size: 31px; }
  form[data-form] { grid-template-columns: 1fr; }
  form[data-form] .field:has(textarea), form[data-form] .field:has(input[type=password]), form[data-form] .check { grid-column: 1; }
  .table-wrap { margin: 0 -17px -17px; }
  th, td { padding: 11px 13px; }
  #toast { right: 15px; bottom: 15px; }
}
