:root {
  color-scheme: light;
  --ink: #17211e;
  --ink-soft: #34403c;
  --muted: #69736f;
  --line: #dce1de;
  --line-strong: #c8cfcb;
  --paper: #f4f5f2;
  --panel: #fff;
  --nav: #17201d;
  --nav-muted: #9ba7a2;
  --accent: #b9955a;
  --accent-dark: #796039;
  --green: #297657;
  --red: #a43832;
  --radius: 6px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--ink); background: var(--paper); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid rgba(185, 149, 90, .4); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 1000; top: .75rem; left: .75rem; padding: .7rem 1rem; background: #fff; color: var(--ink); font-weight: 750; transform: translateY(-180%); }
.skip-link:focus { transform: none; }
.eyebrow { margin: 0 0 .65rem; color: var(--accent-dark); font-size: .68rem; font-weight: 800; letter-spacing: .17em; }
.button { display: inline-flex; min-height: 3rem; align-items: center; justify-content: center; gap: 1rem; padding: .75rem 1rem; border: 1px solid transparent; border-radius: 3px; cursor: pointer; font-weight: 750; text-decoration: none; }
.button.primary { background: var(--ink); color: #fff; }
.button.primary:hover { background: #27332f; }
.button.secondary { border-color: var(--line-strong); background: #fff; color: var(--ink); }

/* Authentication */
.auth-body { background: #eceeea; }
.auth-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(18rem, 38%) minmax(0, 1fr); }
.auth-brand { position: relative; display: flex; min-height: 100%; flex-direction: column; justify-content: space-between; overflow: hidden; padding: clamp(2rem, 6vw, 5rem); background: var(--nav); color: #fff; }
.auth-brand::before { content: ""; position: absolute; inset: 0; opacity: .3; background: linear-gradient(135deg, transparent 0 48%, rgba(185,149,90,.16) 48.2% 48.5%, transparent 48.7%), radial-gradient(circle at 15% 75%, rgba(185,149,90,.2), transparent 32%); }
.auth-brand::after { content: "SECURE WORKSPACE"; position: relative; color: var(--nav-muted); font-size: .62rem; font-weight: 750; letter-spacing: .22em; }
.auth-brand span, .auth-brand small { position: relative; z-index: 1; }
.auth-brand span { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.1rem, 4vw, 4rem); letter-spacing: .13em; }
.auth-brand small { margin-top: .6rem; color: #bdc5c1; font-size: .65rem; font-weight: 700; letter-spacing: .3em; }
.auth-card { align-self: center; width: min(100% - 2rem, 29rem); margin: 2rem auto; padding: clamp(1.4rem, 4vw, 2.4rem); }
.auth-card h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.5rem, 6vw, 4.2rem); font-weight: 400; letter-spacing: -.045em; line-height: .98; }
.auth-intro { margin: 1rem 0 2rem; color: var(--muted); line-height: 1.65; }
.auth-form { display: grid; gap: 1.1rem; }
.field { display: grid; gap: .48rem; }
.field label { color: var(--ink-soft); font-size: .77rem; font-weight: 750; }
.field input { width: 100%; min-height: 3.2rem; padding: .75rem .85rem; border: 1px solid var(--line-strong); border-radius: 3px; background: #fff; color: var(--ink); }
.field input:hover { border-color: #9da9a3; }
.field input:focus { border-color: var(--accent-dark); box-shadow: 0 0 0 1px var(--accent-dark); outline: none; }
.auth-form .button { margin-top: .15rem; }
.alert { padding: .8rem .9rem; border-left: 3px solid var(--red); background: #f8eae8; color: #792822; font-size: .83rem; line-height: 1.5; }
.local-mode { margin: 0; padding: .7rem .85rem; border: 1px solid #d5c7a9; background: #f6f0e4; color: #665231; font-size: .75rem; }
.auth-footnote { margin: 1.6rem 0 0; color: #7b8581; font-size: .7rem; line-height: 1.5; }
.auth-back { display: inline-block; margin-top: 1.5rem; color: var(--muted); font-size: .78rem; font-weight: 700; text-decoration: none; }
.cf-turnstile { min-height: 65px; }

/* Application shell */
.panel-grid { display: grid; min-height: 100vh; grid-template-columns: 16rem minmax(0, 1fr); }
.sidebar { position: sticky; z-index: 50; top: 0; display: flex; height: 100vh; flex-direction: column; padding: 1.8rem 1rem 1.2rem; background: var(--nav); color: #eef1ef; }
.brand { display: flex; flex-direction: column; padding: .2rem .85rem 2rem; text-decoration: none; }
.brand span { font-family: Georgia, "Times New Roman", serif; font-size: 1.5rem; letter-spacing: .14em; }
.brand small { margin-top: .35rem; color: var(--nav-muted); font-size: .53rem; font-weight: 750; letter-spacing: .27em; }
.sidebar nav { display: grid; gap: .25rem; }
.sidebar nav a { display: grid; min-height: 2.85rem; grid-template-columns: .45rem minmax(0, 1fr) auto; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: 3px; color: #b8c1bd; font-size: .82rem; font-weight: 650; text-decoration: none; }
.sidebar nav a:hover { background: rgba(255,255,255,.055); color: #fff; }
.sidebar nav a[aria-current="page"] { background: rgba(255,255,255,.09); color: #fff; }
.nav-mark { width: .34rem; height: .34rem; border: 1px solid #6e7b75; border-radius: 50%; }
.sidebar nav a[aria-current="page"] .nav-mark { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 3px rgba(185,149,90,.14); }
.sidebar nav small { color: #79857f; font-size: .55rem; letter-spacing: .06em; text-transform: uppercase; }
.sidebar-note { display: flex; align-items: center; gap: .55rem; margin: auto .75rem 0; color: #7e8a84; font-size: .65rem; }
.sidebar-note span { width: .42rem; height: .42rem; border-radius: 50%; background: #68a789; box-shadow: 0 0 0 3px rgba(104,167,137,.1); }
.panel-stage { min-width: 0; }
.topbar { position: sticky; z-index: 30; top: 0; display: flex; min-height: 4.4rem; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem clamp(1rem, 3vw, 2.5rem); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.topbar-context { display: flex; flex-direction: column; gap: .18rem; }
.topbar-context span { color: var(--muted); font-size: .62rem; }
.topbar-context strong { font-size: .84rem; }
.account { display: flex; align-items: center; gap: .7rem; }
.account-mark { display: grid; width: 2rem; height: 2rem; place-items: center; border: 1px solid #c9b88f; border-radius: 50%; background: #eee7d7; color: var(--accent-dark); font-family: Georgia, serif; font-size: .85rem; }
.account-name { display: flex; min-width: 6rem; flex-direction: column; font-size: .72rem; font-weight: 750; }
.account-name small { margin-top: .12rem; color: var(--muted); font-size: .57rem; font-weight: 600; }
.quiet-button { padding: .45rem .6rem; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: .7rem; font-weight: 700; }
.quiet-button:hover { color: var(--ink); }
.menu-button { display: none; width: 2.6rem; height: 2.6rem; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.menu-button span:not(.sr-only), .menu-button span:not(.sr-only)::before, .menu-button span:not(.sr-only)::after { display: block; width: 1rem; height: 1px; margin: auto; background: var(--ink); content: ""; }
.menu-button span:not(.sr-only)::before { transform: translateY(-5px); }
.menu-button span:not(.sr-only)::after { transform: translateY(4px); }
.content { width: min(100%, 94rem); margin: 0 auto; padding: clamp(2rem, 5vw, 4.5rem) clamp(1rem, 4vw, 3.5rem) 5rem; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; padding-bottom: 2rem; border-bottom: 1px solid var(--line); }
.page-heading h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.3rem, 5vw, 4.5rem); font-weight: 400; letter-spacing: -.045em; line-height: 1; }
.page-heading > div > p:last-child { margin: .8rem 0 0; color: var(--muted); font-size: .87rem; }
.page-heading.compact { align-items: start; }
.status-chip, .unavailable { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .65rem; border: 1px solid #bcd4c8; background: #edf5f1; color: var(--green); font-size: .65rem; font-weight: 750; white-space: nowrap; }
.status-chip i { width: .4rem; height: .4rem; border-radius: 50%; background: var(--green); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.metric { min-width: 0; padding: 1.7rem 1.5rem 1.7rem 0; border-right: 1px solid var(--line); }
.metric + .metric { padding-left: 1.5rem; }
.metric:last-child { border-right: 0; }
.metric p { margin: 0; color: var(--muted); font-size: .7rem; font-weight: 700; }
.metric strong { display: block; margin: .7rem 0 .6rem; font-family: Georgia, serif; font-size: 2.3rem; font-weight: 400; }
.metric small { display: block; color: #89918e; font-size: .62rem; line-height: 1.45; }
.dashboard-columns { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(18rem, .8fr); gap: 1rem; margin-top: 1rem; }
.surface { padding: clamp(1.3rem, 3vw, 2rem); border: 1px solid var(--line); background: var(--panel); }
.surface-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.surface h2, .coming-soon h2 { margin: 0; font-family: Georgia, serif; font-size: 1.7rem; font-weight: 400; letter-spacing: -.025em; }
.unavailable { border-color: var(--line); background: var(--paper); color: var(--muted); }
.status-list { margin: 1.6rem 0 0; }
.status-list div { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(10rem, 1.4fr); gap: 1rem; padding: .9rem 0; border-top: 1px solid var(--line); }
.status-list dt { font-size: .75rem; font-weight: 750; }
.status-list dd { margin: 0; color: var(--muted); font-size: .72rem; text-align: right; }
.focus-surface { background: var(--ink); color: #fff; }
.focus-surface .eyebrow { color: #d5bc8e; }
.focus-surface > p:not(.eyebrow) { color: #b7c1bc; font-size: .8rem; line-height: 1.65; }
.focus-surface small { color: #8f9b96; font-size: .62rem; }
.progress-track { height: 3px; margin: 1.8rem 0 .65rem; background: #3c4944; }
.progress-track span { display: block; width: 100%; height: 100%; background: var(--accent); }
.coming-soon { max-width: 43rem; margin: 4rem auto; padding: clamp(1.5rem, 5vw, 3rem); border: 1px solid var(--line); background: var(--panel); text-align: center; }
.coming-soon > p:not(.eyebrow) { margin: 1rem auto 1.8rem; color: var(--muted); line-height: 1.65; }
.coming-mark { display: grid; width: 3rem; height: 3rem; place-items: center; margin: 0 auto 1.5rem; border: 1px solid #cfbd98; color: var(--accent-dark); font-family: Georgia, serif; font-size: 1.4rem; }
.error-page { width: min(100% - 2rem, 34rem); margin: 15vh auto; }
.error-page h1 { font-family: Georgia, serif; font-size: 2.6rem; font-weight: 400; }
.error-page p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }

@media (max-width: 920px) {
  .panel-grid { grid-template-columns: 1fr; }
  .sidebar { position: static; width: 100%; height: auto; }
  body[data-nav-ready="true"] .sidebar { position: fixed; left: 0; width: min(17rem, 85vw); height: 100vh; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 12px 0 45px rgba(0,0,0,.22); }
  body[data-nav-ready="true"][data-nav-open="true"] .sidebar { transform: translateX(0); }
  body[data-nav-ready="true"] .menu-button { display: block; }
  .topbar-context { margin-right: auto; }
  .nav-backdrop { position: fixed; z-index: 40; inset: 0; border: 0; background: rgba(10,16,14,.52); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .dashboard-columns { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { min-height: auto; padding: 1.3rem 1.5rem; }
  .auth-brand::after { display: none; }
  .auth-brand span { font-size: 1.45rem; }
  .auth-card { padding: 1.3rem .4rem; }
  .topbar { gap: .6rem; }
  .topbar-context span, .account-name { display: none; }
  .account { gap: .25rem; }
  .account-mark { display: none; }
  .content { padding-top: 2.5rem; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 1.3rem; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric, .metric + .metric { padding: 1.3rem 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .metric:last-child { border-bottom: 0; }
  .status-list div { grid-template-columns: 1fr; gap: .35rem; }
  .status-list dd { text-align: left; }
}

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