:root {
  color-scheme: light;
  --ink: #172b43;
  --ink-soft: #40566f;
  --muted: #64778c;
  --line: #dce7f1;
  --line-strong: #c5d5e5;
  --surface: #ffffff;
  --canvas: #f5f8fc;
  --nav: #0b63b6;
  --nav-hover: #07549d;
  --nav-muted: #d1e7fa;
  --nav-accent: #91c9f7;
  --blue: #126dc2;
  --blue-dark: #075aa9;
  --blue-soft: #eaf4fe;
  --green: #25775c;
  --green-soft: #eaf5f0;
  --amber: #96621a;
  --amber-soft: #fff5e5;
  --red: #a84444;
  --red-soft: #fbeeee;
  --violet: var(--blue);
  --violet-soft: var(--blue-soft);
  --shadow: 0 12px 34px rgb(23 72 116 / 7%);
  --shadow-high: 0 24px 65px rgb(17 53 86 / 20%);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar: 260px;
  font-family: Inter, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
}

.process-track {
  display: flex;
  gap: .5rem;
  overflow-x: auto;
  padding: .25rem 0 .5rem;
}

.process-track span {
  position: relative;
  flex: 1 0 9rem;
  padding: .7rem .85rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  color: var(--muted);
  background: var(--canvas);
  font-size: .85rem;
  font-weight: 650;
  transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
}

.process-track span.is-current {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 11%, var(--surface));
  color: var(--blue-dark);
  transform: translateY(-2px);
  box-shadow: 0 5px 18px color-mix(in srgb, var(--blue) 15%, transparent);
}

.process-track span.is-done {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  background: color-mix(in srgb, var(--green) 9%, var(--surface));
  color: var(--green);
}

.field input[type="file"] {
  padding: .7rem;
  border-style: dashed;
  background: var(--canvas);
  cursor: pointer;
}

.field input[type="file"]:hover,
.field input[type="file"]:focus-visible {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 6%, var(--surface));
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--blue-dark); text-decoration: none; }
button { color: inherit; }
img, svg { display: block; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
:focus-visible {
  outline: 3px solid #0b72d3;
  outline-offset: 3px;
}

.loading-screen,
.fatal-error {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  padding: 32px;
  text-align: center;
}

.loading-mark {
  width: 46px;
  height: 46px;
  border: 4px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #1475ca 0%, var(--nav) 45%, #08549d 100%);
  color: white;
  box-shadow: 8px 0 30px rgb(9 31 50 / 8%);
}

.brand {
  height: 88px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  color: white;
  border-bottom: 1px solid rgb(255 255 255 / 8%);
}

.brand img,
.auth-brand img {
  width: 42px;
  height: 42px;
  padding: 8px;
  object-fit: contain;
  background: white;
  border-radius: 12px;
}

.brand div { min-width: 0; display: grid; gap: 2px; }
.brand strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand span { color: var(--nav-muted); font-size: 12px; }

.sidebar nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px 24px;
  scrollbar-width: thin;
}

.sidebar-utilities {
  flex: none;
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-top: 1px solid rgb(255 255 255 / 9%);
}
.utility-nav-item {
  min-height: 39px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  color: #d9e3ed;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 650;
  transition: color .16s ease, background .16s ease, transform .16s ease;
}
.utility-nav-item:hover,
.utility-nav-item:focus-visible,
.utility-nav-item.is-current { color: white; background: var(--nav-hover); }
.utility-nav-item:active { transform: scale(.985); }
.utility-nav-item.is-current { box-shadow: inset 3px 0 var(--nav-accent); }

.nav-group { margin-bottom: 3px; }
.nav-item {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  color: #d9e3ed;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  transition: background .16s ease, color .16s ease;
}

.nav-item span { flex: 1; }
.nav-item:hover,
.nav-item.is-current,
.nav-group.is-active > .nav-item { color: white; background: var(--nav-hover); }
.nav-item.is-current { box-shadow: inset 3px 0 var(--nav-accent); }
.nav-children {
  display: none;
  margin: 4px 0 9px 33px;
  padding-left: 12px;
  border-left: 1px solid rgb(255 255 255 / 13%);
}

.nav-group.is-active:not(.is-collapsed) .nav-children,
.nav-group.is-expanded:not(.is-collapsed) .nav-children { display: grid; }
.nav-item[aria-controls] > i:last-child { transition: transform .18s ease; }
.nav-item[aria-expanded="false"] > i:last-child { transform: rotate(-90deg); }
.nav-children a {
  padding: 7px 9px;
  color: var(--nav-muted);
  border-radius: 7px;
  font-size: 13px;
}
.nav-children a:hover,
.nav-children a.is-current { color: white; background: rgb(255 255 255 / 6%); }

.sidebar__footer {
  min-height: 62px;
  display: flex;
  align-items: center;
  padding: 10px 12px 12px;
  border-top: 1px solid rgb(255 255 255 / 9%);
}
.sidebar-signout {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  color: #eef7ff;
  background: transparent;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 9px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.sidebar-signout:hover,
.sidebar-signout:focus-visible { background: rgb(255 255 255 / 11%); border-color: rgb(255 255 255 / 32%); }
.sidebar-signout:active { transform: scale(.985); }
.app-frame { min-height: 100vh; margin-left: var(--sidebar); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 30px;
  background: rgb(255 255 255 / 91%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.topbar__context { min-width: 150px; display: grid; }
.topbar__context small { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.topbar__context strong { font-size: 15px; }
.global-search {
  position: relative;
  width: min(620px, 50vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
}
.global-search > span { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.global-search input {
  width: 100%;
  height: 42px;
  padding: 0 46px 0 42px;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 12px;
  color: var(--ink);
  outline: none;
}
.global-search input:focus { border-color: var(--blue); background: white; box-shadow: 0 0 0 3px rgb(8 123 240 / 10%); }
.global-search kbd {
  position: absolute;
  right: 11px;
  padding: 2px 7px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: white;
}
.search-results {
  position: absolute;
  inset: calc(100% + 8px) 0 auto;
  max-height: 420px;
  overflow: auto;
  padding: 8px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-high);
}
.search-results a { display: grid; grid-template-columns: 85px 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 8px; }
.search-results a:hover,
.search-results a[aria-selected="true"] { background: var(--blue-soft); }
.search-results a span,
.search-results a small { color: var(--muted); font-size: 12px; }
.search-results p { padding: 10px; margin: 0; color: var(--muted); }
.mobile-menu { display: none !important; }

.page {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 30px clamp(20px, 3vw, 48px) 64px;
}
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 26px;
}
.page-header > div:first-child { max-width: 780px; }
.eyebrow {
  margin: 0 0 7px;
  color: var(--blue-dark) !important;
  font-size: 11px !important;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.page-header h1,
.record-head h1,
.auth-card h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.1;
  letter-spacing: -.035em;
}
.page-header p,
.record-head p,
.auth-card > p,
.modal-heading p { margin: 9px 0 0; color: var(--muted); line-height: 1.55; }
.page-actions,
.record-head__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }

.button,
.icon-button {
  border: 0;
  cursor: pointer;
  transition: transform .13s ease, background .15s ease, border-color .15s ease, opacity .15s ease;
}
.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}
.button:hover { transform: translateY(-1px); }
.button:disabled,
.icon-button:disabled { cursor: not-allowed; opacity: .48; transform: none; filter: grayscale(.35); }
.button:active:not(:disabled),
.icon-button:active:not(:disabled) { transform: translateY(1px) scale(.98); }
.button--primary { color: white; background: var(--blue); box-shadow: 0 8px 20px rgb(8 123 240 / 16%); }
.button--primary:hover { background: var(--blue-dark); }
.button--secondary { color: var(--ink); background: white; border-color: var(--line-strong); }
.button--secondary:hover,
.button--quiet:hover { background: var(--blue-soft); border-color: #bbd9f8; color: var(--blue-dark); }
.button--quiet { color: var(--ink-soft); background: transparent; border-color: var(--line); }
.button--danger { color: #8f2929; background: var(--red-soft); border-color: #efc4c4; }
.button--danger:hover { color: white; background: #a73636; border-color: #a73636; }
.button[data-sign-out]:hover,
.button[data-sign-out]:focus-visible { color: #8f2929; background: var(--red-soft); border-color: #e7b9b9; }
.sidebar-signout:hover,
.sidebar-signout:focus-visible { color: white; background: rgb(168 68 68 / 48%); border-color: rgb(255 205 205 / 55%); }
.button--small { min-height: 32px; padding: 5px 9px; font-size: 12px; }
.button--compact { min-height: 38px; padding: 8px 13px; }
.button--large { width: 100%; min-height: 48px; font-size: 14px; }
.icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 9px;
}
.icon-button:hover { color: var(--blue-dark); background: var(--blue-soft); }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.metrics-grid--compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric {
  min-height: 135px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 21px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: visible;
  position: relative;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.metric__label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.heading-with-help,
.field-label { display: flex; align-items: center; gap: 7px; min-width: 0; }
.field-label { justify-content: flex-start; }
.help-trigger {
  position: relative;
  z-index: 99;
  flex: none;
  width: 27px;
  height: 27px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: help;
  transition: color .15s ease, background .15s ease, transform .15s ease;
}
.help-trigger svg { width: 15px; height: 15px; }
.help-trigger:hover,
.help-trigger:focus-visible { z-index: 10001; color: var(--blue-dark); background: var(--blue-soft); transform: translateY(-1px); }
.help-trigger:active { transform: scale(.94); }
.help-tooltip {
  position: absolute;
  z-index: 10002;
  left: 50%;
  top: calc(100% + 9px);
  bottom: auto;
  width: min(280px, calc(100vw - 32px));
  padding: 9px 11px;
  color: white;
  background: #10283f;
  border-radius: 8px;
  box-shadow: var(--shadow-high);
  font-size: 11px;
  font-weight: 550;
  line-height: 1.45;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -5px);
  transition: opacity .14s ease, transform .14s ease;
}
.help-tooltip::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  width: 10px;
  height: 10px;
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
}
.help-trigger:hover .help-tooltip,
.help-trigger:focus-visible .help-tooltip { opacity: 1; transform: translate(-50%, 0); }
.metric:hover,
.metric:focus-within { z-index: 10000; }
.page-header:has(.help-trigger:hover),
.page-header:has(.help-trigger:focus-visible),
.panel:has(.help-trigger:hover),
.panel:has(.help-trigger:focus-visible),
.field-label:has(.help-trigger:hover),
.field-label:has(.help-trigger:focus-visible) {
  position: relative;
  z-index: 10000;
}
.help-drawer {
  position: fixed;
  z-index: 95;
  inset: 0 0 0 auto;
  width: min(430px, calc(100vw - 24px));
  padding: 58px 30px 30px;
  overflow: auto;
  color: var(--ink);
  background: white;
  box-shadow: -24px 0 70px rgb(8 29 48 / 22%);
  transform: translateX(105%);
  visibility: hidden;
  transition: transform .24s ease, visibility .24s;
}
.help-drawer[aria-hidden="false"] { transform: translateX(0); visibility: visible; }
.help-drawer__close { position: absolute; top: 16px; right: 16px; background: #f2f5f8; }
.help-drawer h2 { margin: 0; font-size: 28px; letter-spacing: -.025em; }
.help-drawer__lead { margin: 13px 0 25px; color: var(--ink-soft); font-size: 15px; line-height: 1.6; }
.help-drawer__detail { display: grid; gap: 8px; padding-top: 22px; border-top: 1px solid var(--line); }
.help-drawer__detail h3 { margin: 12px 0 0; font-size: 13px; }
.help-drawer__detail p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.help-backdrop { position: fixed; z-index: 94; inset: 0; width: 100%; height: 100%; padding: 0; background: rgb(5 20 32 / 36%); border: 0; cursor: pointer; }
body.help-open { overflow: hidden; }

.login-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 4px;
  padding: 13px;
  background: #f7fafe;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.login-identity > span,
.profile-avatar { width: 43px; height: 43px; display: grid; place-items: center; color: white; background: var(--blue); border-radius: 50%; font-weight: 850; }
.login-identity div,
.profile-summary div { display: grid; gap: 3px; }
.login-identity small,
.profile-summary small { color: var(--muted); font-size: 11px; }

.profile-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 20px; margin-bottom: 20px; }
.profile-layout .panel { margin: 0; }
.profile-summary { display: flex; align-items: center; gap: 13px; padding: 22px; border-bottom: 1px solid var(--line); }
.profile-summary strong { font-size: 16px; }
.profile-form { display: flex; align-items: end; gap: 12px; padding: 22px; }
.profile-form .field { flex: 1; }
.profile-form--stacked { align-items: stretch; flex-direction: column; }
.profile-form--stacked > .button { align-self: flex-end; }
.profile-security-actions { display: flex; flex-wrap: wrap; gap: 9px; padding: 5px 20px 20px; }

.device-chip {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--ink-soft);
  background: white;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.device-chip:hover { transform: translateY(-1px); border-color: #9dc9f2; background: var(--blue-soft); }
.device-chip--connected { color: var(--green); border-color: #b9dfd0; background: var(--green-soft); }
.device-chip--attention { color: var(--amber); border-color: #ead1a4; background: var(--amber-soft); }
.device-chip--error { color: var(--red); border-color: #ecc2c2; background: var(--red-soft); }
.attendance-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.attendance-toolbar { min-height: 65px; display: flex; align-items: end; gap: 10px; padding: 12px 15px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.attendance-toolbar .field { width: 180px; }
.attendance-toolbar__count { margin-left: auto; padding-bottom: 10px; color: var(--muted); font-size: 11px; font-weight: 700; }
.attendance-review-grid { align-items: start; }
.settings-intro { margin: 0; padding: 20px 20px 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.status--connected, .status--matched, .status--applied { color: #0b6b4d; background: var(--green-soft); }
.status--attention, .status--unmatched, .status--unknown, .status--incomplete, .status--needs-review { color: #8c5507; background: var(--amber-soft); }
.status--not-connected { color: var(--muted); background: #edf2f6; }

.about-page { display: grid; gap: 24px; }
.about-page > .page-header { margin-bottom: 0; }
.about-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr);
  gap: 35px;
  padding: clamp(25px, 4vw, 42px);
  color: white;
  background: linear-gradient(135deg, #0b63b6, #1482d6);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.about-stage { display: inline-flex; padding: 6px 10px; color: #cfe7ff; background: rgb(255 255 255 / 10%); border-radius: 999px; font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.about-hero h2 { margin: 17px 0 12px; font-size: clamp(26px, 4vw, 40px); letter-spacing: -.035em; }
.about-hero p { max-width: 760px; margin: 9px 0 0; color: #d9e8f6; font-size: 13px; line-height: 1.7; }
.about-hero dl { margin: 0; display: grid; align-content: center; }
.about-hero dl div { display: grid; grid-template-columns: 1fr 1.2fr; gap: 15px; padding: 12px 0; border-bottom: 1px solid rgb(255 255 255 / 14%); }
.about-hero dt { color: #a9c5df; font-size: 11px; }
.about-hero dd { margin: 0; font-size: 12px; font-weight: 750; text-align: right; }
.about-notice { display: flex; align-items: flex-start; gap: 14px; padding: 19px 21px; color: var(--blue-dark); background: var(--blue-soft); border: 1px solid #c6e0f8; border-radius: 13px; }
.about-notice p { margin: 4px 0 0; font-size: 12px; line-height: 1.55; }
.about-section { padding: clamp(22px, 4vw, 36px); background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section-heading h2 { margin: 0 0 22px; font-size: 24px; }
.roadmap { list-style: none; display: grid; gap: 0; margin: 0; padding: 0; }
.roadmap li { position: relative; display: grid; grid-template-columns: 48px 1fr; gap: 16px; padding: 0 0 28px; }
.roadmap li:last-child { padding-bottom: 0; }
.roadmap li::before { content: ""; position: absolute; left: 23px; top: 47px; bottom: 0; width: 1px; background: var(--line); }
.roadmap li:last-child::before { display: none; }
.roadmap li > span { width: 48px; height: 48px; display: grid; place-items: center; color: var(--muted); background: #f0f3f6; border-radius: 50%; font-size: 11px; font-weight: 850; }
.roadmap li.is-complete > span { color: white; background: var(--blue); }
.roadmap li.is-current > span { color: white; background: var(--blue); box-shadow: 0 0 0 6px var(--blue-soft); }
.roadmap small { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.roadmap .is-complete small { color: var(--blue-dark); }
.roadmap .is-current small { color: var(--blue); }
.roadmap h3 { margin: 4px 0 6px; font-size: 16px; }
.roadmap p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.about-purpose-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.about-purpose-grid article { padding: 20px; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.about-purpose-grid article:hover { transform: translateY(-2px); border-color: #aecfea; box-shadow: 0 10px 25px rgb(21 48 75 / 8%); }
.about-purpose-grid article > span { color: var(--blue); font-size: 10px; font-weight: 850; }
.about-purpose-grid h3 { margin: 8px 0; font-size: 15px; }
.about-purpose-grid p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.about-information { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; background: white; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.about-information div { display: grid; gap: 5px; padding: 18px; border-right: 1px solid var(--line); }
.about-information div:last-child { border: 0; }
.about-information dt { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.about-information dd { margin: 0; font-size: 12px; font-weight: 750; }
.metric::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--blue); }
.metric--green::before,
.metric--amber::before,
.metric--red::before,
.metric--violet::before { background: var(--blue); }
.metric small { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.metric strong { margin: 8px 0 5px; color: var(--ink); font-size: clamp(22px, 2.1vw, 31px); line-height: 1; }
.metric span { color: var(--muted); font-size: 12px; }
.metric:hover { border-color: var(--line-strong); transform: translateY(-1px); }

.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.content-grid--wide { grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); }
.content-grid--record { align-items: start; }
.panel {
  min-width: 0;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 7px 24px rgb(21 48 75 / 4%);
}
.content-grid > .panel { margin-bottom: 0; }
.panel__header {
  min-height: 57px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 14px 19px;
  border-bottom: 1px solid var(--line);
}
.panel__header h2 { margin: 0; font-size: 16px; letter-spacing: -.015em; }
.panel__header > a { font-size: 13px; font-weight: 700; }
.panel__body { min-width: 0; }

.table-wrap { width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-gutter: stable; }
.table-wrap:focus-visible { outline-offset: -3px; }
table { width: 100%; border-collapse: collapse; }
th {
  padding: 11px 16px;
  color: var(--muted);
  background: #f9fbfc;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
th > button { display: inline-flex; align-items: center; gap: 5px; padding: 0; color: inherit; background: transparent; border: 0; cursor: pointer; font: inherit; letter-spacing: inherit; text-transform: inherit; }
th > button svg { width: 12px; height: 12px; }
td { padding: 13px 16px; color: var(--ink-soft); border-bottom: 1px solid #edf1f5; font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfdff; }
tbody tr:focus-within td { background: var(--blue-soft); }
td small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.table-input { width: 88px; min-height: 32px; padding: 5px 7px; color: var(--ink); background: white; border: 1px solid var(--line-strong); border-radius: 7px; }
.table-title { color: var(--ink); font-weight: 700; }
.record-link { color: var(--blue-dark); font-weight: 700; }
.record-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.muted { color: var(--muted); }

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  color: var(--ink-soft);
  background: #edf2f6;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .025em;
  white-space: nowrap;
}
.status--active, .status--paid, .status--completed, .status--confirmed, .status--accepted,
.status--passed, .status--healthy, .status--reconciled, .status--received, .status--delivered {
  color: #0b6b4d;
  background: var(--green-soft);
}
.status--critical, .status--failed, .status--overdue, .status--cancelled, .status--declined,
.status--out-of-service, .status--reorder {
  color: #a43535;
  background: var(--red-soft);
}
.status--high, .status--partially-paid, .status--partially-delivered, .status--partially-received,
.status--late, .status--early-departure, .status--needs-review, .status--unreconciled {
  color: #8c5507;
  background: var(--amber-soft);
}
.status--issued, .status--sent, .status--approved, .status--ordered, .status--dispatched {
  color: #075ea9;
  background: var(--blue-soft);
}
.status--medium, .status--draft, .status--scheduled { color: #6650aa; background: var(--violet-soft); }

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 34px 20px;
  text-align: center;
}
.empty-state > span {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 15px;
}
.empty-state h3 { margin: 5px 0 0; font-size: 16px; }
.empty-state p { max-width: 480px; margin: 0 0 7px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.setup-list { padding: 8px; }
.setup-item {
  min-height: 53px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  color: var(--ink);
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
}
.setup-item > span { display: flex; align-items: center; gap: 10px; }
.setup-item:hover { background: var(--blue-soft); }
.setup-item.is-done { color: var(--green); }
.pulse-grid { display: grid; grid-template-columns: repeat(4, 1fr); padding: 24px; }
.pulse-grid div { display: grid; gap: 5px; text-align: center; border-right: 1px solid var(--line); }
.pulse-grid div:last-child { border: 0; }
.pulse-grid strong { font-size: 25px; }
.pulse-grid span { color: var(--muted); font-size: 11px; }
.activity-list { list-style: none; margin: 0; padding: 12px 20px; }
.activity-list li { display: flex; gap: 11px; padding: 9px 0; }
.activity-list li > span { width: 8px; height: 8px; margin-top: 5px; background: var(--blue); border-radius: 50%; box-shadow: 0 0 0 4px var(--blue-soft); }
.activity-list div { display: grid; gap: 3px; }
.activity-list strong { font-size: 12px; }
.activity-list small { color: var(--muted); font-size: 10px; }

.template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 15px; }
.template-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 13px;
  align-items: start;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.template-card > span { width: 38px; height: 38px; display: grid; place-items: center; color: var(--blue); background: var(--blue-soft); border-radius: 10px; }
.template-card h3 { margin: 3px 0 6px; font-size: 14px; }
.template-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.template-card small { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }

.account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 14px; margin-bottom: 20px; }
.account-card {
  min-height: 155px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 21px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.account-card,
.template-card { transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.account-card:hover,
.account-card:focus-visible,
.template-card:hover,
.template-card:focus-within { transform: translateY(-2px); border-color: #a9cae9; box-shadow: 0 14px 34px rgb(21 48 75 / 10%); }
.account-card > span { width: 36px; height: 36px; display: grid; place-items: center; margin-bottom: 5px; color: var(--blue); background: var(--blue-soft); border-radius: 10px; }
.account-card small { color: var(--muted); }
.account-card h3 { margin: 0; font-size: 14px; }
.account-card strong { margin-top: 4px; font-size: 22px; }

.record-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  margin-bottom: 22px;
}
.back-link { align-self: start; display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.record-head h1 { font-size: clamp(27px, 3vw, 38px); }
.record-banner {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 10px 15px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 11px;
}
.record-banner span:last-child { color: var(--muted); font-size: 12px; }
.definition-list { margin: 0; padding: 8px 20px 15px; }
.definition-list > div { display: grid; grid-template-columns: minmax(110px, .7fr) 1fr; gap: 20px; padding: 12px 0; border-bottom: 1px solid #edf1f5; }
.definition-list > div:last-child { border: 0; }
.definition-list dt { color: var(--muted); font-size: 12px; }
.definition-list dd { margin: 0; color: var(--ink); font-size: 13px; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.prose { margin: 0; padding: 20px; color: var(--ink-soft); line-height: 1.65; white-space: pre-wrap; }
.alert { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 20px; padding: 16px 18px; border-radius: 12px; }
.alert--danger { color: #8f3030; background: var(--red-soft); border: 1px solid #f5cccc; }
.alert--success { color: #0c704f; background: var(--green-soft); border: 1px solid #cbeadb; }
.alert--warning { color: #744807; background: var(--amber-soft); border: 1px solid #efd7ab; }
.alert strong { font-size: 14px; }
.alert p { margin: 4px 0 0; font-size: 12px; line-height: 1.5; }

.field { min-width: 0; display: grid; gap: 7px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.field--wide { grid-column: 1 / -1; }
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
  font-weight: 500;
}
.field .select-filter { min-height: 34px; padding-left: 30px; background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235f7088' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 9px center; font-size: 11px; }
.field textarea { min-height: 82px; resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgb(8 123 240 / 10%); }
.field input:user-invalid,
.field select:user-invalid,
.field textarea:user-invalid { border-color: var(--red); background: #fffafa; box-shadow: 0 0 0 3px rgb(181 65 65 / 10%); }
.field input:disabled,
.field select:disabled,
.field textarea:disabled { color: var(--muted); background: #eef2f5; cursor: not-allowed; }
.field small { color: var(--muted); font-size: 10px; font-weight: 500; }
.field--checkbox {
  grid-template-columns: auto 1fr;
  align-items: center;
  align-self: end;
  min-height: 42px;
  padding: 9px 0;
}
.field--checkbox input { width: 17px; min-height: 17px; accent-color: var(--blue); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-notice { padding: 12px 14px; color: #795108; background: var(--amber-soft); border-radius: 9px; font-size: 12px; }
.settings-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.settings-layout .panel { margin: 0; }
.settings-layout .panel__body { padding: 20px; }
.settings-save { grid-column: 1 / -1; display: flex; justify-content: flex-end; margin-bottom: 12px; }

.modal {
  width: min(760px, calc(100vw - 28px));
  max-height: min(880px, calc(100vh - 28px));
  padding: 0;
  overflow: visible;
  color: var(--ink);
  background: transparent;
  border: 0;
}
.modal::backdrop { background: rgb(7 24 39 / 62%); backdrop-filter: blur(5px); }
.modal__surface {
  position: relative;
  max-height: min(880px, calc(100vh - 28px));
  padding: 27px;
  overflow: auto;
  background: white;
  border-radius: 18px;
  box-shadow: var(--shadow-high);
}
.modal__close { position: absolute; z-index: 2; top: 15px; right: 15px; background: #f2f5f8; }
.modal-heading { padding-right: 45px; margin-bottom: 22px; }
.modal-heading h2 { margin: 0; font-size: 25px; letter-spacing: -.025em; }
.modal-form > .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.line-editor { padding: 15px; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; }
.line-editor__controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(115px, 1fr)); gap: 9px; align-items: end; }
.line-editor__controls--template { grid-template-columns: repeat(4, minmax(110px, 1fr)); }
.line-editor__controls--template .button { min-height: 42px; }
.line-draft { margin-top: 13px; color: var(--muted); font-size: 12px; }
.line-draft > p { margin: 5px; text-align: center; }
.line-draft .table-wrap { background: white; border: 1px solid var(--line); border-radius: 9px; }
.allocation-list { padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.allocation-list legend { font-weight: 800; }
.allocation-list > p { margin: 0 0 10px; color: var(--muted); font-size: 11px; }
.allocation-list label { display: flex; align-items: center; gap: 8px; padding: 7px; background: #f8fafc; border-radius: 7px; }
.quick-create { display: grid; gap: 20px; }
.quick-create section h3 { margin: 0 0 8px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.quick-create section > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.quick-create button { min-height: 75px; display: flex; align-items: center; gap: 10px; padding: 14px; color: var(--ink); background: #f8fafc; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; font-weight: 700; text-align: left; }
.quick-create button svg { color: var(--blue); }
.quick-create button:hover { background: var(--blue-soft); border-color: #bfdcf8; }
.quick-create button:active { transform: scale(.985); }

.table-tools {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 14px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
}
.table-tools > label { position: relative; width: min(340px, 100%); }
.table-tools > label svg { position: absolute; left: 10px; top: 50%; width: 16px; height: 16px; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.table-tools input { width: 100%; min-height: 36px; padding: 7px 10px 7px 34px; color: var(--ink); background: white; border: 1px solid var(--line-strong); border-radius: 8px; }
.table-tools > div { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.table-tools .icon-button { width: 32px; height: 32px; }
.row-actions { display: flex; align-items: center; gap: 4px; }
.split-records { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; padding: 20px; }
.split-records h3 { margin: 0 0 12px; font-size: 13px; }
.compact-list { list-style: none; display: grid; gap: 8px; margin: 0 0 12px; padding: 0; }
.compact-list li { display: grid; gap: 2px; padding: 9px 11px; background: #f8fafc; border: 1px solid var(--line); border-radius: 9px; }
.compact-list strong { font-size: 12px; }
.compact-list span { color: var(--muted); font-size: 11px; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 9px; padding: 20px 20px 8px; }
.settings-help { margin: 0; padding: 5px 20px 20px; color: var(--muted); font-size: 12px; }
.danger-zone { padding: 20px; }
.danger-zone p { margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.55; }

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px;
  background:
    radial-gradient(circle at 15% 10%, rgb(18 109 194 / 16%), transparent 32%),
    radial-gradient(circle at 90% 85%, rgb(101 177 235 / 13%), transparent 28%),
    #f2f7fc;
}
.auth-card {
  width: min(470px, 100%);
  padding: clamp(28px, 5vw, 46px);
  background: white;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-high);
}
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 32px; color: var(--ink); font-weight: 800; }
.auth-form { display: grid; gap: 15px; margin-top: 25px; }
.auth-note { padding-top: 20px; text-align: center; font-size: 10px !important; }
.recovery-panel { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.recovery-panel summary { color: var(--blue-dark); cursor: pointer; font-size: 12px; font-weight: 700; }
.recovery-panel > p { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.recovery-panel .auth-form { margin-top: 14px; }

.toast-region { position: fixed; z-index: 100; right: 22px; bottom: 22px; display: grid; gap: 8px; }
.toast {
  min-width: 260px;
  max-width: 430px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  color: white;
  background: #143552;
  border-radius: 11px;
  box-shadow: var(--shadow-high);
  font-size: 13px;
  font-weight: 700;
  animation: toast-in .22s ease-out;
}
.toast--error { background: #a33838; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
.spinner { width: 15px; height: 15px; border: 2px solid rgb(255 255 255 / 40%); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }
.sidebar-backdrop { display: none; }

@media (max-width: 1180px) {
  :root { --sidebar: 228px; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 120px; }
  .topbar { gap: 13px; padding-inline: 20px; }
  .topbar__context { display: none; }
  .global-search { width: auto; flex: 1; }
  .template-grid { grid-template-columns: 1fr; }
  .attendance-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .about-information { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 840px) {
  body.sidebar-open { overflow: hidden; }
  .sidebar { transform: translateX(-105%); transition: transform .25s ease; }
  .sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; z-index: 35; inset: 0; width: 100%; height: 100%; padding: 0; background: rgb(4 19 31 / 55%); border: 0; }
  .sidebar-open .sidebar-backdrop { display: block; }
  .app-frame { margin-left: 0; }
  .mobile-menu { display: inline-grid !important; }
  .topbar { height: 64px; }
  .page { padding-top: 22px; }
  .page-header { align-items: flex-start; flex-direction: column; gap: 16px; }
  .page-actions { justify-content: flex-start; }
  .content-grid,
  .content-grid--wide,
  .settings-layout { grid-template-columns: 1fr; }
  .settings-save { grid-column: auto; }
  .record-head { grid-template-columns: 1fr; gap: 10px; }
  .profile-layout,
  .about-hero { grid-template-columns: 1fr; }
  .record-head__actions { justify-content: flex-start; }
  .back-link { margin-bottom: 4px; }
  .table-wrap { background: linear-gradient(to right, white 30%, rgb(255 255 255 / 0)), linear-gradient(to left, white 30%, rgb(255 255 255 / 0)), radial-gradient(farthest-side at 0 50%, rgb(16 35 63 / 16%), transparent), radial-gradient(farthest-side at 100% 50%, rgb(16 35 63 / 16%), transparent); background-repeat: no-repeat; background-color: white; background-size: 40px 100%, 40px 100%, 12px 100%, 12px 100%; background-position: left center, right center, left center, right center; background-attachment: local, local, scroll, scroll; }
}

/* Short desktop screens need less framing so the business content remains usable
   after the browser and operating system consume part of a 720p display. */
@media (min-width: 841px) and (max-height: 800px) {
  :root { --sidebar: 212px; }
  .brand { height: 60px; padding: 9px 13px; gap: 9px; }
  .brand img { width: 34px; height: 34px; padding: 6px; border-radius: 9px; }
  .brand strong { font-size: 13px; }
  .brand span { font-size: 10px; }
  .sidebar nav { padding: 7px 8px 10px; }
  .nav-group { margin-bottom: 1px; }
  .nav-item { min-height: 32px; padding: 5px 9px; gap: 9px; font-size: 12px; }
  .nav-children { margin: 1px 0 5px 29px; padding-left: 9px; }
  .nav-children a { padding: 4px 7px; font-size: 11px; }
  .sidebar-utilities { padding: 5px 8px; }
  .utility-nav-item { min-height: 30px; padding: 4px 9px; gap: 9px; font-size: 11px; }
  .sidebar__footer { min-height: 46px; padding: 5px 8px; }
  .sidebar-signout { min-height: 32px; padding: 5px 9px; gap: 9px; font-size: 11px; }

  .topbar { height: 54px; padding-inline: 18px; }
  .topbar__context small { font-size: 9px; }
  .topbar__context strong { font-size: 13px; }
  .global-search input { height: 36px; border-radius: 10px; font-size: 12px; }
  .global-search kbd { font-size: 10px; }
  .search-results a,
  .search-results p { font-size: 11px; }
  .search-results a span,
  .search-results a small { font-size: 10px; }
  .page { padding: 12px clamp(18px, 2vw, 28px) 30px; }
  .page-header { gap: 16px; margin-bottom: 12px; }
  .page-header h1,
  .record-head h1 { font-size: clamp(25px, 2.25vw, 30px); }
  .page-header p,
  .record-head p { margin-top: 4px; font-size: 12px; line-height: 1.35; }
  .eyebrow { margin-bottom: 3px; font-size: 10px !important; }
  .button { min-height: 36px; padding: 7px 12px; font-size: 12px; }
  .button--compact { min-height: 34px; padding-block: 6px; }
  .icon-button { width: 34px; height: 34px; }

  .metrics-grid { gap: 10px; margin-bottom: 10px; }
  .metric { min-height: 86px; padding: 12px 15px; border-radius: 13px; }
  .metric small { font-size: 10px; }
  .metric strong { margin-block: 5px 2px; font-size: clamp(20px, 1.85vw, 24px); }
  .metric span { font-size: 11px; }
  .content-grid { gap: 10px; margin-bottom: 10px; }
  .panel { margin-bottom: 10px; border-radius: 13px; }
  .panel__header { min-height: 44px; padding: 8px 14px; }
  .panel__header h2 { font-size: 14px; }
  .panel__header > a { font-size: 11px; }
  .empty-state { min-height: 135px; padding: 18px; }
  .empty-state > span { width: 42px; height: 42px; }
  .empty-state h3 { font-size: 14px; }
  .empty-state p { font-size: 11px; }
  .setup-item { min-height: 44px; padding-block: 7px; font-size: 11px; }
  .pulse-grid { padding-block: 14px; }
  .pulse-grid strong { font-size: 21px; }
  .pulse-grid span { font-size: 10px; }
  .activity-list { padding-block: 6px; }
  .activity-list li { padding-block: 6px; }
  .activity-list strong { font-size: 11px; }
  .activity-list small { font-size: 9px; }
  .attendance-toolbar { min-height: 54px; padding: 8px 12px; }
  .attendance-toolbar__count { font-size: 10px; }
  .account-card { min-height: 130px; padding: 16px; }
  .account-card small { font-size: 10px; }
  .account-card h3 { font-size: 12px; }
  .account-card strong { font-size: 18px; }
  .template-card h3 { font-size: 12px; }
  .template-card p { font-size: 11px; }
  .template-card small { font-size: 9px; }
  .profile-summary strong { font-size: 14px; }
  .profile-summary small { font-size: 10px; }
  .device-chip { font-size: 11px; }
  .settings-intro,
  .settings-help,
  .danger-zone p { font-size: 11px; }
  .field input,
  .field select { min-height: 38px; }
  .field { gap: 5px; font-size: 11px; }
  .field input,
  .field select,
  .field textarea { padding: 7px 9px; font-size: 12px; }
  .field small { font-size: 9px; }
  .form-grid { gap: 12px; }
  .form-notice { font-size: 11px; }
  .definition-list dt { font-size: 10px; }
  .definition-list dd { font-size: 11px; }
  .definition-list > div { padding-block: 9px; }
  .record-banner span:last-child,
  .back-link { font-size: 10px; }
  .alert strong { font-size: 12px; }
  .alert p { font-size: 11px; }
  .prose { font-size: 12px; }
  th { padding-block: 8px; font-size: 9px; }
  td { padding-block: 8px; font-size: 11px; }
  td small { font-size: 9px; }
  .status { min-height: 21px; padding: 2px 7px; font-size: 9px; }
  .table-tools { min-height: 46px; padding-block: 6px; }
  .table-tools input { min-height: 32px; font-size: 11px; }
  .table-tools > div { font-size: 10px; }
  .compact-list strong { font-size: 11px; }
  .compact-list span { font-size: 10px; }

  .about-hero h2 { font-size: clamp(24px, 3vw, 32px); }
  .about-hero p { font-size: 11px; }
  .about-hero dt { font-size: 10px; }
  .about-hero dd,
  .about-notice p,
  .roadmap p,
  .about-purpose-grid p,
  .about-information dd { font-size: 11px; }
  .section-heading h2 { font-size: 20px; }
  .roadmap h3 { font-size: 14px; }
  .about-purpose-grid h3 { font-size: 13px; }

  .help-drawer h2 { font-size: 24px; }
  .help-drawer__lead { font-size: 13px; }
  .help-drawer__detail h3,
  .help-drawer__detail p { font-size: 11px; }
  .modal-heading h2 { font-size: 22px; }
  .line-draft,
  .form-notice { font-size: 11px; }
  .quick-create section h3 { font-size: 10px; }
  .quick-create button { min-height: 62px; padding: 11px; font-size: 11px; }

  .auth-page { padding: 12px; }
  .auth-card { max-height: calc(100svh - 24px); padding: 22px 30px; overflow-y: auto; }
  .auth-brand { margin-bottom: 14px; }
  .login-identity { margin-top: 12px; }
  .auth-form { margin-top: 14px; }
  .auth-note { padding-top: 10px; }
  .recovery-panel { margin-top: 11px; padding-top: 10px; }
}

@media (max-width: 620px) {
  .topbar { padding: 0 12px; }
  .topbar .button--compact span,
  .global-search kbd { display: none; }
  .topbar .button--compact { width: 40px; padding: 0; }
  .global-search input { padding-right: 12px; }
  .page { padding: 18px 12px 45px; }
  .metrics-grid,
  .metrics-grid--compact { grid-template-columns: 1fr; gap: 10px; }
  .metric { min-height: 105px; }
  .pulse-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; }
  .pulse-grid div { border: 0; }
  .form-grid,
  .modal-form > .form-grid { grid-template-columns: 1fr; }
  .field--wide { grid-column: auto; }
  .modal__surface { padding: 22px 16px; }
  .line-editor__controls { grid-template-columns: 1fr 1fr; }
  .line-editor__controls .field:first-child { grid-column: 1 / -1; }
  .line-editor__controls .button { grid-column: 1 / -1; }
  .line-editor__controls--template { grid-template-columns: 1fr 1fr; }
  .quick-create section > div { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .definition-list > div { grid-template-columns: 1fr; gap: 4px; }
  .definition-list dd { text-align: left; }
  .toast-region { inset: auto 12px 12px; }
  .toast { min-width: 0; max-width: none; }
  .auth-page { min-height: 100svh; padding: 0; place-items: stretch; background: white; }
  .auth-card { width: 100%; min-height: 100svh; display: flex; flex-direction: column; justify-content: center; padding: 32px 24px; border: 0; border-radius: 0; box-shadow: none; }
  .table-tools { align-items: stretch; flex-direction: column; }
  .table-tools > label { width: 100%; }
  .split-records { grid-template-columns: 1fr; }
  .attendance-toolbar { align-items: stretch; flex-direction: column; }
  .attendance-toolbar .field { width: 100%; }
  .attendance-toolbar__count { margin: 0; padding: 0; }
  .about-purpose-grid,
  .about-information { grid-template-columns: 1fr; }
  .about-information div { border-right: 0; border-bottom: 1px solid var(--line); }
  .profile-form { align-items: stretch; flex-direction: column; }
  .help-tooltip { display: none; }
}

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

@media print {
  :root { --canvas: white; --line: #c9c9c9; }
  body { background: white; color: black; }
  .sidebar,
  .topbar,
  .page-actions,
  .record-head__actions,
  .back-link,
  .table-tools,
  .toast-region,
  .modal,
  button { display: none !important; }
  .app-frame { margin: 0; }
  .page { width: 100%; padding: 0; }
  .panel,
  .metric { break-inside: avoid; box-shadow: none; }
  .table-wrap { overflow: visible; }
  table { font-size: 9pt; }
  th { position: static; color: black; background: #eee !important; }
  a { color: black; text-decoration: none; }
  .status { border: 1px solid #999; color: black; background: white !important; }
}

@media (forced-colors: active) {
  .button,
  .icon-button,
  .panel,
  .metric,
  .status,
  .field input,
  .field select,
  .field textarea { border: 1px solid CanvasText; }
  .nav-item.is-current { outline: 2px solid Highlight; }
  .metric::before { background: Highlight; }
}

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