:root {
  color-scheme: dark;
  --ink: #0d1718;
  --ink-2: #132223;
  --ink-3: #1b2d2d;
  --line: #324242;
  --line-soft: rgba(200, 207, 196, .14);
  --paper: #d9d8ce;
  --paper-muted: #9fa7a0;
  --amber: #d6a23b;
  --amber-dark: #3b2d13;
  --mint: #78b99a;
  --danger: #e0715d;
  --white: #f4f3eb;
  --shadow: 0 32px 90px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--ink); }
body { margin: 0; min-height: 100vh; color: var(--paper); background: var(--ink); font-family: "Segoe UI", Arial, sans-serif; }
button, input, select { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; transform: translateY(-140%); padding: 10px 14px; color: var(--ink); background: var(--white); }
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

.boot { min-height: 100vh; display: grid; place-content: center; gap: 14px; justify-items: center; color: var(--paper-muted); font-size: 13px; letter-spacing: .02em; }
.boot-mark { width: 34px; height: 34px; border: 2px solid var(--line); border-top-color: var(--amber); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(390px, .65fr); background: var(--ink); }
.login-story { position: relative; min-height: 100vh; overflow: hidden; padding: clamp(28px, 4vw, 68px); display: flex; flex-direction: column; border-right: 1px solid var(--line); background:
  linear-gradient(120deg, rgba(214,162,59,.07), transparent 40%),
  repeating-linear-gradient(90deg, transparent 0, transparent calc(25% - 1px), rgba(255,255,255,.035) 25%),
  var(--ink-2); }
.login-story::after { content: ""; position: absolute; width: 55vw; height: 55vw; right: -26vw; bottom: -34vw; border: 1px solid rgba(214,162,59,.24); border-radius: 50%; box-shadow: 0 0 0 6vw rgba(214,162,59,.025), 0 0 0 12vw rgba(214,162,59,.018); pointer-events: none; }
.brand-lockup { display: inline-flex; align-items: center; gap: 13px; font-family: Bahnschrift, "Arial Narrow", sans-serif; font-weight: 700; letter-spacing: .08em; color: var(--white); }
.brand-symbol { width: 34px; height: 34px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; transform: skew(-9deg); }
.brand-symbol i { display: block; background: var(--amber); }
.brand-symbol i:nth-child(2) { height: 72%; align-self: end; }
.brand-symbol i:nth-child(3) { height: 45%; align-self: end; }
.story-copy { position: relative; z-index: 1; max-width: 750px; margin: auto 0 9vh; }
.status-line { display: flex; align-items: center; gap: 10px; margin: 0 0 30px; color: var(--mint); font-size: 13px; }
.status-line span, .live-badge i, .system-dot, .shield-line i { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 5px rgba(120,185,154,.12); }
.story-copy h1 { margin: 0; max-width: 720px; color: var(--white); font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: clamp(52px, 6.5vw, 108px); font-weight: 500; line-height: .92; letter-spacing: -.055em; }
.story-copy > p:last-child { max-width: 610px; margin: 30px 0 0; color: var(--paper-muted); font-size: clamp(15px, 1.4vw, 19px); line-height: 1.65; }
.process-rail { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, minmax(100px, 1fr)); max-width: 760px; border-top: 1px solid var(--line); }
.process-rail div { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 20px 12px 0 0; }
.process-rail div::before { content: ""; position: absolute; width: 9px; height: 9px; top: -5px; left: 0; border: 2px solid var(--ink-2); border-radius: 50%; background: var(--amber); }
.process-rail span { color: var(--paper-muted); font: 11px/1 Bahnschrift, sans-serif; }
.process-rail b { color: var(--paper); font-size: 13px; font-weight: 600; }
.story-foot { margin: auto 0 0; color: #6f7b76; font-size: 11px; }

.login-panel { min-height: 100vh; padding: 44px clamp(28px, 5vw, 72px); display: flex; flex-direction: column; justify-content: center; background: #101b1c; }
.login-box { width: 100%; max-width: 430px; margin: auto; }
.login-heading > p, .section-head p, .access-ledger > p, .page-head p { margin: 0 0 11px; color: var(--amber); font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: 12px; letter-spacing: .08em; }
.login-heading h2 { margin: 0; color: var(--white); font: 500 clamp(34px, 4vw, 50px)/1 Bahnschrift, "Arial Narrow", sans-serif; letter-spacing: -.035em; }
.login-heading > span { display: block; max-width: 360px; margin-top: 17px; color: var(--paper-muted); line-height: 1.6; }
#login-form { margin-top: 40px; }
.field { display: grid; gap: 9px; margin-bottom: 20px; }
.field label { color: var(--paper); font-size: 13px; font-weight: 600; }
.field input, .field select { min-width: 0; width: 100%; height: 50px; padding: 0 14px; border: 1px solid #425151; border-radius: 3px; color: var(--white); background: #172526; transition: border-color .16s, box-shadow .16s; }
.field input:hover, .field select:hover { border-color: #657675; }
.field input:focus, .field select:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(214,162,59,.12); outline: none; }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.password-field { position: relative; }
.password-field input { padding-right: 76px; }
.password-field button { position: absolute; right: 8px; top: 7px; height: 36px; padding: 0 10px; border: 0; color: var(--paper-muted); background: transparent; cursor: pointer; }
.form-error { min-height: 20px; margin: -3px 0 13px; color: #ff9d8b; font-size: 13px; line-height: 1.45; }
.primary-action { width: 100%; min-height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border: 1px solid var(--amber); border-radius: 3px; color: #171207; background: var(--amber); font-weight: 700; cursor: pointer; transition: background .16s, transform .16s; }
.primary-action:hover { background: #e4b653; }
.primary-action:active { transform: translateY(1px); }
.primary-action:disabled { cursor: wait; opacity: .66; }
.security-note { display: flex; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.security-note svg { width: 21px; flex: 0 0 auto; fill: var(--mint); }
.security-note p { margin: 0; color: var(--paper-muted); font-size: 12px; line-height: 1.55; }
.panel-foot { max-width: 430px; width: 100%; margin: auto auto 0; color: #697571; font-size: 11px; }

.portal { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); background: #e9e8e0; color: #152223; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 20px; display: flex; flex-direction: column; background: var(--ink); color: var(--paper); border-right: 1px solid #263536; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 30px; border-bottom: 1px solid var(--line-soft); }
.brand-symbol.compact { width: 27px; height: 27px; }
.sidebar-brand div { display: grid; gap: 2px; }
.sidebar-brand strong { color: var(--white); font: 600 16px/1 Bahnschrift, sans-serif; }
.sidebar-brand span { color: #74807c; font-size: 10px; }
.sidebar nav { display: grid; gap: 5px; margin-top: 28px; }
.nav-item { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border: 1px solid transparent; border-radius: 3px; color: #9aa49f; background: transparent; text-align: left; cursor: pointer; }
.nav-item > span { width: 22px; color: #75827d; font-size: 18px; text-align: center; }
.nav-item:hover { color: var(--white); background: #162526; }
.nav-item.active { color: #161307; border-color: var(--amber); background: var(--amber); font-weight: 700; }
.nav-item.active > span { color: #161307; }
.sidebar-system { margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 16px 10px 0; border-top: 1px solid var(--line-soft); }
.sidebar-system div { display: grid; gap: 3px; }
.sidebar-system strong { color: var(--paper); font-size: 11px; }
.sidebar-system span:not(.system-dot) { color: #6f7c77; font-size: 10px; }

.workspace { min-width: 0; }
.topbar { position: sticky; z-index: 20; top: 0; min-height: 70px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 3.5vw, 52px); border-bottom: 1px solid #c8c8bf; background: rgba(233,232,224,.94); backdrop-filter: blur(12px); }
.breadcrumb { display: flex; gap: 10px; align-items: center; font-size: 12px; }
.breadcrumb span, .breadcrumb b { color: #8a8e89; font-weight: 400; }
.account { display: flex; align-items: center; gap: 12px; }
.account > div { display: grid; justify-items: end; gap: 2px; }
.account strong { font-size: 12px; }
.account span { color: #777d78; font-size: 10px; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #211a0a !important; background: var(--amber); font-weight: 800; }
.account button { min-height: 34px; padding: 0 10px; border: 1px solid #bfc0b8; border-radius: 3px; color: #3a4747; background: transparent; cursor: pointer; }
.account button:hover { border-color: #1b2d2d; }
.menu-button { display: none; width: 42px; height: 42px; border: 1px solid #c6c6bd; background: transparent; cursor: pointer; }

.content { max-width: 1560px; margin: 0 auto; padding: clamp(28px, 4vw, 60px); }
.view { display: none; }
.view.active { display: block; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.page-head h1 { margin: 0; color: #102021; font: 500 clamp(38px, 4vw, 64px)/.98 Bahnschrift, "Arial Narrow", sans-serif; letter-spacing: -.045em; }
.page-head p { color: #8e6720; }
.live-badge { display: inline-flex; align-items: center; gap: 10px; padding: 8px 11px; border: 1px solid #b7b9b1; border-radius: 999px; color: #42514b; font-size: 11px; white-space: nowrap; }
.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 28px; border: 1px solid #c4c4bc; background: #f1f0e8; }
.metric-strip article { min-height: 142px; padding: 23px; border-right: 1px solid #c4c4bc; }
.metric-strip article:last-child { border-right: 0; }
.metric-strip span, .metric-strip small { display: block; color: #707773; font-size: 11px; }
.metric-strip strong { display: block; margin: 13px 0 7px; color: #102021; font: 500 43px/1 Bahnschrift, sans-serif; letter-spacing: -.04em; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 28px; }
.process-board, .access-ledger, .config-grid > section { border: 1px solid #c4c4bc; background: #f1f0e8; }
.section-head { min-height: 85px; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px 22px; border-bottom: 1px solid #c4c4bc; }
.section-head p { margin-bottom: 4px; color: #8e6720; }
.section-head h2, .access-ledger h2, .config-grid h2 { margin: 0; color: #132324; font: 500 24px/1.1 Bahnschrift, sans-serif; }
.section-head > span { color: #737a75; font-size: 11px; }
.feedstock-list { display: grid; }
.feedstock-row { min-height: 78px; display: grid; grid-template-columns: 46px minmax(140px, .7fr) minmax(220px, 1.5fr) 90px; align-items: center; gap: 18px; padding: 14px 22px; border-bottom: 1px solid #d2d1c8; }
.feedstock-row:last-child { border-bottom: 0; }
.feedstock-code { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid #b9bab2; border-radius: 50%; color: #6b5529; font: 700 11px Bahnschrift, sans-serif; }
.feedstock-row strong { display: block; color: #152526; font-size: 13px; }
.feedstock-row small { color: #747b76; font-size: 10px; }
.feedstock-route { color: #59635f; font-size: 11px; line-height: 1.45; }
.feedstock-row b { justify-self: end; color: #172727; font: 500 22px Bahnschrift, sans-serif; }
.feedstock-row b small { display: block; margin-top: 3px; text-align: right; }
.access-ledger { padding: 24px; background: var(--ink-2); color: var(--paper); border-color: var(--ink-2); }
.access-ledger > p { color: var(--amber); }
.access-ledger h2 { color: var(--white); }
.access-ledger dl { margin: 30px 0; }
.access-ledger dl div { display: flex; justify-content: space-between; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.access-ledger dt { color: #8d9994; font-size: 11px; }
.access-ledger dd { margin: 0; color: var(--paper); font-size: 11px; font-weight: 600; }
.shield-line { display: flex; align-items: center; gap: 10px; color: var(--mint); font-size: 10px; line-height: 1.4; }

.filter-bar { display: grid; grid-template-columns: minmax(220px, 1fr) 280px; gap: 14px; margin-bottom: 18px; padding: 16px; border: 1px solid #c4c4bc; background: #f1f0e8; }
.compact-field { margin: 0; }
.compact-field label { color: #4e5955; font-size: 11px; }
.compact-field input, .compact-field select { height: 42px; color: #142323; border-color: #bfc0b8; background: #fff; }
.table-wrap { overflow-x: auto; border: 1px solid #c4c4bc; background: #f4f3ec; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 13px 16px; color: #68716c; background: #dfded5; text-align: left; font-size: 10px; letter-spacing: .035em; white-space: nowrap; }
td { padding: 14px 16px; border-top: 1px solid #d4d3ca; color: #47534f; vertical-align: top; }
td:first-child { color: #76591e; font-weight: 800; }
td strong { color: #152323; font-size: 12px; }
td small { display: block; margin-top: 4px; color: #828984; }
.empty-state { padding: 34px; border: 1px solid #c4c4bc; color: #68716c; background: #f4f3ec; text-align: center; }
.roles-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid #c4c4bc; background: #f4f3ec; }
.role-row { min-height: 122px; display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 18px; padding: 22px; border-right: 1px solid #d0cfc6; border-bottom: 1px solid #d0cfc6; }
.role-row:nth-child(2n) { border-right: 0; }
.role-color { width: 8px; height: 36px; margin-top: 2px; background: var(--role-color, var(--amber)); }
.role-row h2 { margin: 0 0 8px; color: #172526; font: 500 19px Bahnschrift, sans-serif; }
.role-row p { margin: 0; color: #6b746f; font-size: 11px; line-height: 1.55; }
.role-row b { color: #75591f; font: 500 24px Bahnschrift, sans-serif; }
.role-row b small { display: block; color: #858b86; font: 10px "Segoe UI", sans-serif; text-align: right; }
.config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.config-grid > section { padding: 24px; }
.config-grid h2 { padding-bottom: 18px; border-bottom: 1px solid #cfcec5; }
.config-grid dl { margin: 0; }
.config-grid dl div { display: flex; justify-content: space-between; gap: 24px; padding: 13px 0; border-bottom: 1px solid #dcdbd2; }
.config-grid dt { color: #69726d; font-size: 11px; }
.config-grid dd { margin: 0; color: #172626; font-size: 11px; font-weight: 700; text-align: right; }

.toast { position: fixed; z-index: 80; right: 24px; bottom: 24px; max-width: 360px; padding: 14px 17px; border: 1px solid var(--line); border-left: 4px solid var(--mint); border-radius: 3px; color: var(--paper); background: var(--ink-2); box-shadow: var(--shadow); font-size: 12px; }

@media (max-width: 1050px) {
  .login-shell { grid-template-columns: 1fr 420px; }
  .story-copy h1 { font-size: clamp(48px, 7vw, 72px); }
  .portal { grid-template-columns: 220px minmax(0, 1fr); }
  .overview-grid { grid-template-columns: 1fr; }
  .access-ledger { min-height: auto; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .metric-strip article:nth-child(2) { border-right: 0; }
  .metric-strip article:nth-child(-n+2) { border-bottom: 1px solid #c4c4bc; }
}

@media (max-width: 760px) {
  .login-shell { display: block; }
  .login-story { min-height: 48vh; padding: 26px 22px 34px; border-right: 0; border-bottom: 1px solid var(--line); }
  .story-copy { margin: 70px 0 45px; }
  .story-copy h1 { font-size: clamp(44px, 13vw, 70px); }
  .story-copy > p:last-child { font-size: 14px; }
  .process-rail { grid-template-columns: repeat(2, 1fr); row-gap: 24px; }
  .login-panel { min-height: 52vh; padding: 42px 22px; }
  .portal { display: block; }
  .sidebar { position: fixed; z-index: 50; inset: 0 auto 0 0; width: min(84vw, 280px); transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .portal.menu-open .sidebar { transform: translateX(0); }
  .menu-button { display: grid; place-items: center; }
  .breadcrumb { display: none; }
  .topbar { padding: 0 16px; }
  .account > div { display: none; }
  .content { padding: 28px 16px 50px; }
  .page-head h1 { font-size: 40px; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .metric-strip article { min-height: 124px; padding: 18px; }
  .metric-strip strong { font-size: 34px; }
  .feedstock-row { grid-template-columns: 42px 1fr 60px; gap: 12px; }
  .feedstock-route { display: none; }
  .filter-bar, .config-grid { grid-template-columns: 1fr; }
  .roles-list { grid-template-columns: 1fr; }
  .role-row, .role-row:nth-child(2n) { border-right: 0; }
}

@media (max-width: 430px) {
  .process-rail { grid-template-columns: 1fr 1fr; }
  .metric-strip { grid-template-columns: 1fr; }
  .metric-strip article { border-right: 0; border-bottom: 1px solid #c4c4bc; }
  .metric-strip article:last-child { border-bottom: 0; }
  .live-badge { display: none; }
  .account { gap: 7px; }
}

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