:root {
  color-scheme: light;
  --page: #dfe6e3;
  --frame: #f6f8f7;
  --surface: #ffffff;
  --surface-soft: #f0f4f2;
  --surface-strong: #e7eeea;
  --ink: #13231c;
  --ink-muted: #65756c;
  --line: #d9e2dd;
  --line-strong: #c4d1ca;
  --brand: #1c6a4d;
  --brand-strong: #0f4934;
  --brand-soft: #e6f2ec;
  --accent: #d6a84b;
  --danger: #b24649;
  --danger-soft: #f9e9e9;
  --warning: #a06b0b;
  --warning-soft: #fbf2db;
  --success: #277658;
  --shadow-frame: 0 28px 80px rgb(24 53 40 / 18%);
  --shadow-card: 0 12px 32px rgb(24 53 40 / 8%);
  --radius-frame: 1.7rem;
  --radius-card: 1rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  background: var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  padding: clamp(0px, 2vw, 28px);
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 5%, rgb(255 255 255 / 50%), transparent 28rem),
    linear-gradient(145deg, #d4dfe0, #e9eeeb 52%, #d8e0dc);
}

button,
input,
select {
  font: inherit;
}

button,
label[for="backup-file-input"],
select,
input[type="month"],
input[type="date"] {
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: default;
}

.skip-link {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 200;
  padding: 0.75rem 1rem;
  color: white;
  background: var(--brand-strong);
  transform: translateY(-130%);
}

.skip-link:focus {
  transform: translateY(0);
}

.visually-hidden {
  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;
}

.application-frame {
  display: grid;
  width: min(1720px, 100%);
  min-height: calc(100vh - clamp(0px, 4vw, 56px));
  margin-inline: auto;
  grid-template-columns: 238px minmax(0, 1fr);
  overflow: hidden;
  background: var(--frame);
  border: 1px solid rgb(255 255 255 / 62%);
  border-radius: var(--radius-frame);
  box-shadow: var(--shadow-frame);
}

.app-sidebar {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  padding: 1.05rem;
  color: rgb(255 255 255 / 88%);
  background:
    linear-gradient(180deg, rgb(255 255 255 / 7%), transparent 22%),
    linear-gradient(160deg, #1e7455, #11513a 58%, #0b3d2c);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.78rem;
  padding: 0.25rem 0.2rem 1.35rem;
}

.brand-mark {
  display: grid;
  width: 2.7rem;
  height: 2.7rem;
  flex: 0 0 auto;
  place-items: center;
  color: var(--brand-strong);
  background: #fff7df;
  border: 2px solid rgb(255 255 255 / 55%);
  border-radius: 0.85rem;
  box-shadow: 0 8px 20px rgb(5 40 28 / 18%);
  font: 800 1.15rem/1 Georgia, serif;
}

.brand-copy strong,
.brand-copy small {
  display: block;
}

.brand-copy strong {
  color: white;
  letter-spacing: 0.14em;
}

.brand-copy small {
  margin-top: 0.15rem;
  color: rgb(255 255 255 / 58%);
  font-size: 0.68rem;
}

.module-nav {
  display: grid;
  gap: 0.35rem;
}

.module-link {
  display: grid;
  width: 100%;
  min-height: 2.9rem;
  grid-template-columns: 1.55rem minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.64rem 0.72rem;
  color: rgb(255 255 255 / 73%);
  background: transparent;
  border: 0;
  border-radius: 0.78rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 650;
  text-align: left;
  text-decoration: none;
}

.module-link:hover:not(:disabled),
.module-link:focus-visible,
.module-link.is-active {
  color: var(--brand-strong);
  background: #fff8e8;
  outline: none;
}

.module-link.is-active {
  box-shadow: 0 9px 24px rgb(3 33 22 / 16%);
}

.module-link:disabled {
  opacity: 0.48;
}

.module-link small {
  font-size: 0.55rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.module-icon {
  display: grid;
  width: 1.55rem;
  height: 1.55rem;
  place-items: center;
  border-radius: 0.45rem;
  font-size: 0.95rem;
}

.module-link.is-active .module-icon {
  color: white;
  background: var(--brand);
}


/* Nested navigation uses native details/summary semantics, so keyboard and
   touch users can explore without inadvertently triggering an attendance write. */
.module-group {
  position: relative;
  min-width: 0;
}

.module-group-toggle {
  list-style: none;
}

.module-group-toggle::-webkit-details-marker {
  display: none;
}

.module-group-toggle::after {
  content: "⌄";
  grid-column: 3;
  font-size: 1rem;
  line-height: 1;
  justify-self: end;
  transition: transform 160ms ease;
}

.module-group[open] .module-group-toggle::after {
  transform: rotate(180deg);
}

.module-group[open] > .module-group-toggle {
  background: rgb(255 255 255 / 13%);
  color: #ffffff;
}

.module-submenu {
  display: grid;
  gap: 0.14rem;
  margin: 0.2rem 0 0.45rem 1.35rem;
  padding-left: 0.7rem;
  border-left: 1px solid rgb(255 255 255 / 30%);
}

.module-sub-link {
  display: flex;
  min-height: 2.65rem;
  align-items: center;
  padding: 0.6rem 0.7rem;
  color: rgb(255 255 255 / 88%);
  border-radius: 0.6rem;
  font-size: 0.79rem;
  font-weight: 550;
  line-height: 1.3;
  text-decoration: none;
}

.module-sub-link:hover,
.module-sub-link:focus-visible {
  color: #102544;
  background: #d9eaff;
  outline: 2px solid transparent;
}

@media (min-width: 761px) and (max-width: 1080px) {
  .module-group-toggle::after { display: none; }

  /* Icon-only sidebar: submenu expands alongside it rather than clipping. */
  .module-submenu {
    position: absolute;
    z-index: 130;
    top: 0;
    left: calc(100% + 0.5rem);
    width: 220px;
    margin: 0;
    padding: 0.55rem;
    border: 1px solid rgb(255 255 255 / 28%);
    border-radius: 0.8rem;
    background: #164a42;
    box-shadow: 0 18px 40px rgb(0 0 0 / 30%);
  }

  html[data-theme="dark"] .module-submenu {
    background: #102b53;
  }
}

@media (max-width: 760px) {
  .app-sidebar {
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

@media (prefers-reduced-motion: reduce) {
  .module-group-toggle::after { transition: none; }
}

.sidebar-spacer {
  flex: 1 1 auto;
  min-height: 2rem;
}

.sidebar-footnote {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0 0.45rem 0.45rem;
  color: rgb(255 255 255 / 58%);
  font-size: 0.7rem;
}

.status-dot {
  width: 0.48rem;
  height: 0.48rem;
  background: #8de1b4;
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgb(141 225 180 / 11%);
}

.module-link-secondary {
  margin-top: 0.2rem;
}

.workspace-shell {
  min-width: 0;
  background:
    radial-gradient(circle at 82% 2%, rgb(214 168 75 / 9%), transparent 25rem),
    var(--frame);
}

.workspace-header {
  display: flex;
  min-height: 74px;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem clamp(1rem, 2.3vw, 2rem);
  border-bottom: 1px solid var(--line);
}

.workspace-kicker {
  margin: 0 0 0.1rem;
  color: var(--ink-muted);
  font-size: 0.63rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.workspace-title {
  font-size: 0.95rem;
}

.header-actions {
  display: flex;
  margin-left: auto;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  justify-content: flex-end;
}

.source-chip,
.version-badge,
.read-only-pill,
.mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.65rem;
  color: var(--brand-strong);
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line));
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 820;
  letter-spacing: 0.055em;
}

.source-chip {
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-toggle {
  display: none;
}

.icon-button {
  display: inline-grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  cursor: pointer;
  font-weight: 800;
}

.icon-button:hover,
.icon-button:focus-visible {
  color: var(--brand-strong);
  border-color: color-mix(in srgb, var(--brand) 42%, var(--line));
  outline: 3px solid color-mix(in srgb, var(--brand) 16%, transparent);
}

.workspace-main {
  padding: clamp(1rem, 2.2vw, 2rem);
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: clamp(1rem, 1.6vw, 1.4rem);
  align-items: start;
}

.dashboard-primary {
  display: grid;
  min-width: 0;
  gap: 1rem;
}

.dashboard-heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.eyebrow,
.card-kicker {
  display: block;
  margin: 0 0 0.38rem;
  color: var(--brand);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.3rem;
  font: 720 clamp(2rem, 3.8vw, 3.4rem) / 0.98 Georgia, serif;
  letter-spacing: -0.04em;
}

.section-copy,
.muted-copy,
.audit-meta {
  color: var(--ink-muted);
}

.section-copy {
  max-width: 70ch;
  margin-bottom: 0;
  font-size: 0.84rem;
  line-height: 1.55;
}

.control-card {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 150px 165px auto;
  gap: 0.72rem;
  align-items: end;
  padding: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.toolbar-field {
  display: grid;
  gap: 0.3rem;
}

.toolbar-field label {
  color: var(--ink-muted);
  font-size: 0.65rem;
  font-weight: 750;
}

.toolbar-field select,
.toolbar-field input {
  width: 100%;
  min-height: 2.45rem;
  padding: 0.5rem 0.62rem;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 0.68rem;
  font-size: 0.78rem;
}

.toolbar-field select:focus-visible,
.toolbar-field input:focus-visible,
.button:focus-visible,
.table-scroll:focus-visible,
.calendar-day:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 24%, transparent);
  outline-offset: 2px;
}

.toolbar-field select:disabled,
.toolbar-field input:disabled {
  opacity: 0.52;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  justify-content: flex-end;
}

.button {
  display: inline-flex;
  min-height: 2.45rem;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.72rem;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 0.68rem;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 760;
  text-decoration: none;
}

.button:hover {
  border-color: color-mix(in srgb, var(--brand) 42%, var(--line));
}

.button-primary {
  color: white;
  background: var(--brand);
  border-color: var(--brand);
}

.button-quiet {
  background: transparent;
}

.runtime-status {
  margin: -0.15rem 0 0;
  color: var(--ink-muted);
  font-size: 0.73rem;
}

.runtime-status::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.42rem;
  background: var(--ink-muted);
  border-radius: 50%;
}

.runtime-status[data-kind="success"]::before { background: var(--success); }
.runtime-status[data-kind="warning"]::before { background: var(--warning); }
.runtime-status[data-kind="error"]::before { background: var(--danger); }

.empty-state {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  padding: 1.35rem;
  color: var(--ink-muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-card);
}

.empty-state > span {
  color: var(--accent);
  font-weight: 850;
}

.empty-state h2 {
  margin-bottom: 0.25rem;
  color: var(--ink);
  font-size: 0.92rem;
}

.empty-state p {
  margin-bottom: 0;
  font-size: 0.78rem;
}

.dashboard-content {
  display: grid;
  gap: 1rem;
}

.dashboard-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(190px, 0.55fr);
  gap: 0.85rem;
}

.calendar-card,
.balance-card,
.rail-card,
.metric-card,
.table-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.calendar-card,
.balance-card,
.rail-card {
  padding: 0.95rem;
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-heading h2,
.calendar-heading h2 {
  margin: 0;
  font-size: 0.96rem;
  letter-spacing: -0.015em;
}

.calendar-nav {
  display: flex;
  gap: 0.35rem;
}

.calendar-nav .icon-button {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.58rem;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  margin-top: 0.8rem;
  color: var(--ink-muted);
  font-size: 0.58rem;
  font-weight: 800;
  text-align: center;
}

.calendar-weekdays span {
  padding: 0.3rem 0;
}

.calendar-grid {
  gap: 0.16rem;
}

.calendar-day {
  position: relative;
  display: grid;
  min-height: 2.55rem;
  place-items: center;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.58rem;
  cursor: pointer;
}

.calendar-day:hover:not(:disabled) {
  background: var(--surface-soft);
}

.calendar-day-outside {
  color: var(--ink-muted);
  opacity: 0.28;
}

.calendar-day.is-selected {
  color: white;
  background: var(--brand);
  box-shadow: 0 6px 14px rgb(31 107 79 / 18%);
}

.calendar-day-number {
  font-size: 0.69rem;
  font-weight: 720;
}

.calendar-day-marker {
  position: absolute;
  right: 0.3rem;
  bottom: 0.27rem;
  width: 0.28rem;
  height: 0.28rem;
  background: var(--ink-muted);
  border-radius: 999px;
}

.calendar-state-good .calendar-day-marker { background: var(--success); }
.calendar-state-danger .calendar-day-marker { background: var(--danger); }
.calendar-state-pending .calendar-day-marker { background: var(--warning); }
.calendar-day.is-selected .calendar-day-marker { background: white; }

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
  color: var(--ink-muted);
  font-size: 0.58rem;
}

.calendar-legend span {
  display: inline-flex;
  gap: 0.32rem;
  align-items: center;
}

.legend-dot {
  display: inline-block;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
}

.legend-good { background: var(--success); }
.legend-danger { background: var(--danger); }
.legend-pending { background: var(--warning); }

.balance-card {
  display: grid;
  min-height: 100%;
  align-content: start;
}

.balance-card h2 {
  font: 760 1.45rem/1 Georgia, serif;
}

.balance-orbit {
  position: relative;
  display: grid;
  width: 7.4rem;
  height: 7.4rem;
  margin: 1.2rem auto 1rem;
  place-items: center;
}

.balance-orbit-track {
  position: absolute;
  inset: 0;
  border: 0.8rem solid var(--brand-soft);
  border-top-color: var(--brand);
  border-right-color: var(--accent);
  border-radius: 50%;
  transform: rotate(18deg);
}

.balance-orbit-core {
  display: grid;
  width: 3.1rem;
  height: 3.1rem;
  place-items: center;
  color: white;
  background: var(--brand-strong);
  border-radius: 50%;
  font: 800 1rem/1 Georgia, serif;
}

.balance-card .muted-copy {
  margin: auto 0 0;
  font-size: 0.7rem;
  line-height: 1.5;
}

.mini-badge {
  padding: 0.28rem 0.48rem;
  font-size: 0.52rem;
}

.mini-badge-good,
.state-good {
  color: var(--brand-strong);
  background: var(--brand-soft);
  border-color: color-mix(in srgb, var(--brand) 18%, var(--line));
}

.mini-badge-warning,
.state-pending {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: color-mix(in srgb, var(--warning) 20%, var(--line));
}

.mini-badge-danger,
.state-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 20%, var(--line));
}

.mini-badge-muted,
.state-muted {
  color: var(--ink-muted);
  background: var(--surface-soft);
  border-color: var(--line);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.65rem;
}

.metric-card {
  display: grid;
  min-height: 6.9rem;
  align-content: start;
  gap: 0.25rem;
  padding: 0.85rem;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  width: 1.7rem;
  height: 0.2rem;
  margin-bottom: 0.15rem;
  background: var(--line-strong);
  border-radius: 99px;
}

.metric-good::before { background: var(--success); }
.metric-warning::before { background: var(--warning); }
.metric-danger::before { background: var(--danger); }

.metric-label {
  color: var(--ink-muted);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.metric-value {
  margin-top: 0.2rem;
  font: 760 1.42rem/1 Georgia, serif;
  letter-spacing: -0.025em;
}

.metric-card small {
  margin-top: 0.18rem;
  color: var(--ink-muted);
  font-size: 0.62rem;
  line-height: 1.35;
}

.audit-issues {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.audit-issues li {
  padding: 0.65rem 0.75rem;
  border-radius: 0.7rem;
  font-size: 0.72rem;
}

.issue-error {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent);
}

.issue-warning {
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid color-mix(in srgb, var(--warning) 22%, transparent);
}

.attendance-section {
  display: grid;
  gap: 0.75rem;
  padding-top: 0.45rem;
  scroll-margin-top: 1rem;
}

.audit-section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.audit-section-header h2 {
  margin-bottom: 0.25rem;
  font: 720 clamp(1.35rem, 2.3vw, 2rem) / 1.05 Georgia, serif;
  letter-spacing: -0.025em;
}

.audit-meta {
  margin-bottom: 0;
  font-size: 0.69rem;
}

.table-card {
  overflow: hidden;
}

.table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.95rem;
  border-bottom: 1px solid var(--line);
}

.table-card-header h3 {
  margin-bottom: 0.15rem;
  font-size: 0.86rem;
}

.table-card-header p {
  margin-bottom: 0;
  color: var(--ink-muted);
  font-size: 0.65rem;
}

.table-scroll {
  max-height: 36rem;
  overflow: auto;
}

.attendance-table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
  font-size: 0.69rem;
}

.attendance-table th,
.attendance-table td {
  padding: 0.6rem 0.65rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.attendance-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--ink-muted);
  background: var(--surface-soft);
  font-size: 0.58rem;
  font-weight: 820;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.attendance-table tbody tr:last-child td {
  border-bottom: 0;
}

.attendance-table tbody tr:hover {
  background: color-mix(in srgb, var(--brand-soft) 58%, transparent);
}

.future-row {
  opacity: 0.48;
}

.date-cell {
  min-width: 7.3rem;
}

.date-cell strong,
.date-cell span {
  display: block;
}

.date-cell span {
  margin-top: 0.1rem;
  color: var(--ink-muted);
  font-size: 0.6rem;
}

.state-badge {
  display: inline-flex;
  padding: 0.28rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.57rem;
  font-weight: 780;
  white-space: nowrap;
}

.number-cell,
.segment-cell {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.number-positive { color: var(--success); font-weight: 750; }
.number-negative { color: var(--danger); font-weight: 750; }
.number-neutral { color: var(--ink-muted); }
.note-cell { min-width: 10rem; max-width: 20rem; }

.dashboard-rail {
  display: grid;
  gap: 0.85rem;
  position: sticky;
  top: 1rem;
}

.rail-card {
  display: grid;
  gap: 0.85rem;
}

.source-card {
  gap: 0.25rem;
}

.source-card strong {
  color: var(--brand-strong);
  font-size: 0.86rem;
}

.source-card small {
  color: var(--ink-muted);
  font-size: 0.63rem;
  line-height: 1.45;
}

.day-card h2,
.tasks-card h2 {
  margin: 0;
  font-size: 0.92rem;
}

.day-timeline,
.task-placeholder-list {
  display: grid;
  gap: 0.25rem;
}

.timeline-item,
.task-placeholder {
  position: relative;
  display: grid;
  grid-template-columns: 0.75rem minmax(0, 1fr);
  gap: 0.55rem;
  padding: 0.58rem 0.5rem;
  border-radius: 0.68rem;
}

.timeline-item:hover {
  background: var(--surface-soft);
}

.timeline-marker,
.task-marker {
  width: 0.48rem;
  height: 0.48rem;
  margin-top: 0.22rem;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.timeline-danger .timeline-marker {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.timeline-item strong,
.timeline-item small,
.task-placeholder strong,
.task-placeholder small {
  display: block;
}

.timeline-item strong,
.task-placeholder strong {
  font-size: 0.7rem;
}

.timeline-item small,
.task-placeholder small {
  margin-top: 0.14rem;
  color: var(--ink-muted);
  font-size: 0.61rem;
  line-height: 1.4;
}

.task-placeholder {
  background: var(--surface-soft);
  opacity: 0.78;
}

.task-marker {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgb(214 168 75 / 14%);
}

.muted-copy {
  margin-bottom: 0;
  font-size: 0.7rem;
  line-height: 1.5;
}

.workspace-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 2rem 1.15rem;
  color: var(--ink-muted);
  font-size: 0.58rem;
}

.sidebar-scrim {
  display: none;
}

@media (max-width: 1320px) {
  .dashboard-layout {
    grid-template-columns: minmax(0, 1fr) 250px;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .control-card {
    grid-template-columns: minmax(150px, 1fr) 140px 155px;
  }

  .toolbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 1080px) {
  .application-frame {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .app-sidebar {
    padding-inline: 0.65rem;
  }

  .brand-copy,
  .module-link > span:not(.module-icon),
  .module-link small,
  .sidebar-footnote span:last-child {
    display: none;
  }

  .sidebar-brand {
    justify-content: center;
  }

  .module-link {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-rail {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    padding: 0;
  }

  .application-frame {
    min-height: 100vh;
    grid-template-columns: 1fr;
    border: 0;
    border-radius: 0;
  }

  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 120;
    width: min(82vw, 280px);
    padding: 1rem;
    transform: translateX(-104%);
    transition: transform 180ms ease;
  }

  .app-sidebar[data-open="true"] {
    transform: translateX(0);
  }

  .brand-copy,
  .module-link > span:not(.module-icon),
  .module-link small,
  .sidebar-footnote span:last-child {
    display: block;
  }

  .module-link {
    grid-template-columns: 1.55rem minmax(0, 1fr) auto;
    justify-items: initial;
  }

  .sidebar-toggle {
    display: inline-grid;
  }

  .sidebar-scrim:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: block;
    background: rgb(6 25 18 / 38%);
    backdrop-filter: blur(2px);
  }

  .workspace-header {
    position: sticky;
    top: 0;
    z-index: 80;
    background: color-mix(in srgb, var(--frame) 92%, transparent);
    backdrop-filter: blur(14px);
  }

  .header-actions .source-chip {
    display: none;
  }

  .workspace-main {
    padding: 1rem;
  }

  .dashboard-heading-row {
    align-items: flex-start;
  }

  .control-card {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-field:first-child,
  .toolbar-actions {
    grid-column: 1 / -1;
  }

  .dashboard-top-grid {
    grid-template-columns: 1fr;
  }

  .balance-card {
    grid-template-columns: 1fr auto;
    column-gap: 1rem;
  }

  .balance-orbit {
    grid-column: 2;
    grid-row: 1 / span 2;
    width: 5.6rem;
    height: 5.6rem;
    margin: 0;
  }

  .balance-orbit-core {
    width: 2.4rem;
    height: 2.4rem;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-rail {
    grid-template-columns: 1fr;
  }

  .audit-section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace-footer {
    padding-inline: 1rem;
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .version-badge {
    display: none;
  }

  .control-card,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .toolbar-field:first-child,
  .toolbar-actions {
    grid-column: auto;
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .button-primary {
    grid-column: 1 / -1;
  }

  .calendar-day {
    min-height: 2.25rem;
  }

  .dashboard-heading-row .read-only-pill {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* Selected theme drives the whole app independently of the OS. */
  /* Midnight Navy — consistent semantic colors across the complete PWA. */
:root[data-theme="dark"] {
    --page: #071426;
    --frame: #0c1b30;
    --surface: #12243c;
    --surface-soft: #192f4b;
    --surface-strong: #223b59;
    --ink: #f2f7ff;
    --ink-muted: #b9cbe1;
    --line: #38516f;
    --line-strong: #567295;
    --brand: #2458aa;
    --brand-strong: #b4d6ff;
    --brand-soft: #18395e;
    --accent: #80b7ff;
    --danger: #ff91a0;
    --danger-soft: #482c43;
    --warning: #ffd183;
    --warning-soft: #423629;
    --success: #85dfc5;
    --shadow-frame: 0 28px 80px rgb(0 4 14 / 48%);
    --shadow-card: 0 12px 32px rgb(0 4 14 / 25%);
  }

html[data-theme="dark"] body {
    background:
      radial-gradient(circle at 12% 3%, rgb(73 138 225 / 17%), transparent 32rem),
      radial-gradient(circle at 90% 87%, rgb(23 71 144 / 14%), transparent 38rem),
      linear-gradient(148deg, #061020, #0b1b31 54%, #060f1e);
  }

html[data-theme="dark"] .application-frame {
    border-color: #304666;
  }

html[data-theme="dark"] .app-sidebar {
    background:
      linear-gradient(180deg, rgb(179 211 255 / 9%), transparent 26%),
      linear-gradient(160deg, #173d73, #102b53 60%, #0a203d);
  }

html[data-theme="dark"] .workspace-shell {
    background:
      radial-gradient(circle at 85% 2%, rgb(115 174 253 / 8%), transparent 25rem),
      var(--frame);
  }

html[data-theme="dark"] .brand-mark,
html[data-theme="dark"] .module-link:hover:not(:disabled),
html[data-theme="dark"] .module-link:focus-visible,
html[data-theme="dark"] .module-link.is-active {
    color: #102544;
    background: #d9eaff;
  }

html[data-theme="dark"] .calendar-day.is-selected {
    color: #ffffff;
  }

  /* White labels must never be paired with light semantic brand colors. */
html[data-theme="dark"] .skip-link {
    color: #ffffff;
    background: #194581;
  }

html[data-theme="dark"] .balance-orbit-core {
    color: #ffffff;
    background: #2458aa;
  }

html[data-theme="dark"] .toolbar-field select,
html[data-theme="dark"] .toolbar-field input,
html[data-theme="dark"] .editor-field input,
html[data-theme="dark"] .editor-field select,
html[data-theme="dark"] .editor-field textarea {
    color-scheme: dark;
  }

html[data-theme="dark"] ::selection {
    color: #ffffff;
    background: #285fba;
  }
