:root {
  color-scheme: light;
  --canvas: #f1f3ef;
  --surface: #fffefa;
  --ink: #262e2d;
  --muted: #566461;
  --line: #d7dfd9;
  --brand: #355751;
  --brand-deep: #243e39;
  --tint: #e8eee8;
  --sidebar: #293533;
  --sidebar-ink: #f4f1e9;
  --sidebar-muted: #bfccc5;
  --accent-rule: #bd8266;
  --danger: #8d2d2a;
  --radius: 5px;
  --heading-font: Georgia, 'Times New Roman', serif;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; min-height: 100vh; }
h1, h2, h3, p { margin: 0; }
h1 { font: 500 clamp(2rem, 4.3vw, 3.1rem)/1.08 var(--heading-font); letter-spacing: -.037em; }
h2 { font: 500 1.3rem/1.2 var(--heading-font); letter-spacing: -.02em; }
h3 { line-height: 1.25; font-size: 1rem; }
a { color: var(--brand-deep); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .56; }
strong { font-weight: 670; }
:focus-visible { outline: 3px solid #3b806e; outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
.skip-link { position: absolute; top: -90px; left: 12px; z-index: 5; padding: 8px 12px; border-radius: 8px; background: var(--surface); }
.skip-link:focus { top: 10px; }

.workspace { display: grid; grid-template-columns: 222px minmax(0, 1fr); min-height: 100vh; }
.sidebar { color: var(--sidebar-ink); background: var(--sidebar); display: flex; flex-direction: column; gap: 25px; padding: 26px 16px 19px; min-width: 0; position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font: 500 1.08rem/1.15 var(--heading-font); letter-spacing: -.015em; }
.sidebar .brand { margin-left: 6px; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sidebar .nav-toggle { display: none; }
.brand-mark { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; border: 1px solid #c9a18b; color: #a36040; }
.sidebar .brand-mark, .guest-header .brand-mark { color: #f3d5c5; }
.brand-mark span { position: relative; width: 13px; height: 20px; border: 1px solid currentColor; border-radius: 8px 8px 0 0; }
.brand-mark span::before, .brand-mark span::after { content: ''; position: absolute; }
.brand-mark span::before { bottom: 6px; left: 0; right: 0; border-top: 1px solid currentColor; }
.brand-mark span::after { top: 4px; bottom: 0; left: 5px; border-left: 1px solid currentColor; }
.sidebar nav { display: grid; gap: 15px; }
.nav-section { display: grid; gap: 1px; border-top: 1px solid #ffffff25; padding-top: 9px; }
.nav-start { padding-top: 0; border-top: 0; }
.nav-heading { color: var(--sidebar-muted); margin: 0 10px 3px; font-size: .76rem; }
.nav-link { color: var(--sidebar-ink); padding: 7px 10px; border-left: 2px solid transparent; text-decoration: none; font-size: .92rem; font-weight: 540; }
.nav-link:hover { background: #ffffff0d; }
.nav-link[aria-current="page"] { color: #fffdfa; background: #ffffff15; border-left-color: #dfab91; font-weight: 640; }
.sidebar-footer { display: flex; align-items: center; gap: 8px; margin: auto 10px 0; color: var(--sidebar-muted); font-size: .82rem; }
.local-dot { display: inline-block; width: 6px; height: 6px; transform: rotate(45deg); background: #dfab91; }
.workspace-body { min-width: 0; }
.topbar { min-height: 56px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 9px; padding: 8px clamp(15px, 4vw, 48px); border-bottom: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .9rem; }
.workspace-path { display: flex; align-items: center; gap: 8px; }
.workspace-path [data-current-area]:empty { display: none; }
.workspace-path [data-current-area]::after { content: '/'; color: var(--muted); margin-inline-start: 8px; }
.workspace-path [data-current-screen] { color: var(--ink); font-weight: 620; }
.topbar-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.pilot-notice { padding: 8px clamp(15px, 4vw, 48px); background: #f6ecdb; color: #684a23; font-size: .86rem; }
.login-card .pilot-notice { padding: 8px 10px; border-radius: var(--radius); }
.content { max-width: 1390px; margin: 0 auto; padding: clamp(19px, 3.8vw, 45px); }
.feature { min-width: 0; }
.feature > * + * { margin-top: 16px; }
.feature > .page-header + * { margin-top: 19px; }
.page-header { display: flex; justify-content: space-between; align-items: end; gap: 14px; flex-wrap: wrap; border-bottom: 2px solid var(--brand); padding-bottom: clamp(11px, 2.5vw, 21px); }
.workspace-body[data-area="Finance"] .page-header { border-color: var(--accent-rule); }
.page-description, .page-header p { color: var(--muted); margin-top: 7px; max-width: 62ch; }
.section-title { margin-bottom: 11px; }

.panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 16px; }
.panel-grid > * { min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(13px, 2vw, 20px); min-width: 0; }
.card > * + * { margin-top: 12px; }
.card > h2 + p, .card > h3 + p { margin-top: 5px; }
.stack { display: grid; gap: 11px; min-width: 0; }
.stack > * { min-width: 0; }
.row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.detail { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.list { list-style: none; padding: 0; margin-bottom: 0; }
.list > * { padding-block: 10px; }
.list > * + * { border-top: 1px solid var(--line); }
.today-list { margin-top: 4px; }
.today-list > li { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 14px; }
.today-record { font-weight: 650; text-underline-offset: 3px; }
.today-task-group + .today-task-group { border-top: 1px solid var(--line); padding-top: 14px; }
.today-task-group > p { margin-top: 5px; }
.muted, .subtle { color: var(--muted); }
.subtle { font-size: .85rem; }
.badge { display: inline-flex; align-items: center; border-radius: 3px; background: var(--tint); color: var(--brand-deep); padding: 2px 7px; font-weight: 630; font-size: .79rem; line-height: 1.5; }
.badge.pending { background: #f6ecdb; color: #684a23; }
.badge.inactive { background: #edf1ef; color: var(--muted); }
.badge.danger { background: #f8e9e6; color: var(--danger); }
.empty, .working { display: grid; gap: 9px; padding: 22px; color: var(--muted); }
.empty .button, .working .button { justify-self: start; }
.error-state h1 { color: var(--ink); }

.button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 38px; padding: 6px 12px; border: 1px solid #cddbd4; border-radius: 4px; background: var(--surface); color: var(--ink); text-decoration: none; text-align: center; line-height: 1.3; font-size: .9rem; font-weight: 625; }
.button:hover:not(:disabled) { background: #edf5f0; border-color: #a8c3b4; }
.button.primary { background: var(--brand); border-color: var(--brand); color: white; }
.button.primary:hover:not(:disabled) { background: var(--brand-deep); border-color: var(--brand-deep); }
.button.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.button.danger { color: var(--danger); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.tabbar { display: flex; flex-wrap: wrap; gap: 7px; }
.tabbar [aria-pressed="true"], .tabbar [aria-selected="true"] { background: var(--tint); color: var(--brand-deep); border-color: #a8c3b4; }

.field { display: grid; align-content: start; gap: 5px; min-width: 0; color: var(--ink); font-size: .91rem; font-weight: 600; }
.field:has(input[type="checkbox"]) { display: flex; align-items: center; gap: 7px; font-weight: 500; }
.field small { color: var(--muted); font-weight: 400; }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea, input[type="search"] {
  width: 100%; min-width: 0; min-height: 41px; padding: 8px 10px; border: 1px solid #c7d6ce; border-radius: 4px; background: var(--surface); color: var(--ink); font-weight: 450;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }
.field textarea { resize: vertical; min-height: 84px; }
.field input::placeholder, .field textarea::placeholder { color: #63756c; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.form-grid > .full, .form-grid > .actions, .form-grid > .form-error { grid-column: 1 / -1; }
.form-error { color: var(--danger); font-size: .9rem; }
.form-error:empty { display: none; }
.status-text { color: var(--brand-deep); font-size: .9rem; }
.ministry-series-assignments { display: grid; gap: 5px; min-width: 0; margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; }
.ministry-series-assignments legend { padding-inline: 3px; font-size: .91rem; font-weight: 600; }
.ministry-shift-list { max-height: 28rem; overflow-y: auto; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { font-size: .82rem; color: var(--muted); font-weight: 640; background: #f1f3ed; }
.data-table td, .data-table th { border-bottom: 1px solid var(--line); padding: 10px 8px; overflow-wrap: anywhere; }
.data-table tbody tr:last-child td { border-bottom: 0; }

.opening { padding: 38px; color: var(--muted); }
.login-layout { max-width: 1120px; padding: 22px clamp(16px, 4vw, 44px); margin: 0 auto; }
.login-card { max-width: 440px; padding: clamp(19px, 4vw, 36px); margin: clamp(40px, 10vh, 95px) auto 36px; border-top: 3px solid var(--accent-rule); }
.login-card form { margin-top: 22px; }
.login-card .button { justify-self: start; }
.guest-header { background: var(--sidebar); color: var(--sidebar-ink); padding: 17px clamp(16px, 5vw, 45px); }
.guest-content { max-width: 800px; margin: auto; padding: clamp(20px, 4vw, 42px); }
.notifications { position: fixed; z-index: 8; right: 20px; bottom: 20px; max-width: min(370px, calc(100% - 40px)); padding: 11px 14px; border-radius: 9px; background: var(--sidebar); color: var(--sidebar-ink); pointer-events: none; opacity: 0; transition: opacity 140ms ease; }
.notifications.visible { opacity: 1; }

@media (max-width: 850px) {
  .workspace { grid-template-columns: 184px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .sidebar .brand { margin-left: 6px; }
}
@media (max-width: 690px) {
  .workspace { display: block; }
  .sidebar { gap: 11px; padding: 12px; position: static; height: auto; overflow-y: visible; }
  .sidebar .nav-toggle { display: inline-flex; background: transparent; color: var(--sidebar-ink); border-color: #ffffff55; }
  .sidebar .nav-toggle:hover { color: var(--ink); }
  .sidebar nav, .sidebar-footer { display: none; }
  .sidebar[data-menu-open] nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 15px; }
  .nav-start { grid-column: 1 / -1; }
  .nav-section { align-content: start; }
  .nav-link { padding: 7px 8px; }
  .topbar { min-height: 44px; padding-block: 5px; }
}
@media (max-width: 530px) {
  .panel-grid, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .data-table th, .data-table td { padding-inline: 3px; font-size: .84rem; }
}
@media (pointer: coarse) {
  .button, .nav-link { min-height: 44px; }
  .nav-link { display: inline-flex; align-items: center; }
}
@media (prefers-reduced-motion: reduce) { .notifications { transition: none; } }
.forms-message { white-space: pre-wrap; overflow-wrap: anywhere; }
