/* AmzOne Hub ops panel components. Colors and fonts come only from tokens.css. */
*, *::before, *::after { box-sizing: border-box; border-radius: 0; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 17px/1.6 var(--font-body);
       -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
a:hover { border-bottom-color: var(--brand); }
:focus-visible { outline: 1px solid var(--brand); outline-offset: 2px; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 300; letter-spacing: -0.015em; margin: 0; }
h1 { font-size: 36px; line-height: 1.15; }
h2 { font-size: 24px; line-height: 1.25; }
h3 { font-size: 19px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
h1 strong, h2 strong { font-weight: 700; color: var(--brand); }
p { margin: 0 0 var(--s2); color: var(--grey-1); }
code, pre, .mono { font-family: var(--font-mono); }
pre { margin: 0; padding: var(--s2); background: var(--bg); border: 1px solid var(--line); color: var(--grey-1);
      font-size: 12px; line-height: 1.5; overflow-x: auto; white-space: pre-wrap; word-break: break-word; }

.label { font: 400 11px/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: .16em; color: var(--grey-2); }
.accent { color: var(--brand); }
.dim { color: var(--grey-2); }  /* readable secondary text; --dim (3.1-3.2:1) is decoration only */
.g1 { color: var(--grey-1); }
.nowrap { white-space: nowrap; flex-wrap: nowrap; }
.gap-left { margin-left: var(--s1); }

/* ---------------------------------------------------------------- header */
.top { position: sticky; top: 0; z-index: 10; height: 64px; display: flex; align-items: center;
       justify-content: space-between; gap: var(--s3); padding: 0 var(--s4); border-bottom: 1px solid var(--line);
       background: var(--header-bg); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 12px; border: 0; }
.brand:hover { border: 0; }
.brand img { display: block; width: 32px; height: 32px; }
.brand-text { display: flex; align-items: baseline; gap: var(--s2); }
.wordmark { font-family: var(--font-display); font-size: 24px; line-height: 1; text-transform: lowercase; }
.wordmark .amz { font-weight: 700; color: var(--brand); letter-spacing: -0.02em; }
.wordmark .one { font-weight: 200; color: var(--text); letter-spacing: -0.01em; }
.top-meta { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.chips { display: flex; gap: var(--s1); flex-wrap: nowrap; }
.who { color: var(--grey-1); font-size: 14px; white-space: nowrap; }

.nav { display: flex; gap: 0; border-bottom: 1px solid var(--line); padding: 0 var(--s4); overflow-x: auto;
       scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { border: 0; padding: var(--s2); font: 400 11px/1 var(--font-mono); text-transform: uppercase;
         letter-spacing: .16em; color: var(--grey-2); border-bottom: 1px solid transparent; margin-bottom: -1px;
         white-space: nowrap; }
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); border-bottom-color: var(--brand); }

main { padding: var(--s4); max-width: 1440px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s3);
             margin-bottom: var(--s4); }
.page-head p { margin: var(--s1) 0 0; max-width: 760px; }
section { margin-bottom: var(--s5); }
section > .label { display: block; margin-bottom: var(--s2); }

/* ---------------------------------------------------------------- footer */
/* fixed to the viewport bottom, one fixed height on every screen; body reserves the space */
:root { --foot-h: 48px; }
body { padding-bottom: var(--foot-h); }
.foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: var(--foot-h); box-sizing: border-box;
        display: flex; justify-content: space-between; align-items: center; gap: var(--s2);
        padding: 0 var(--s4); border-top: 1px solid var(--line); color: var(--grey-2);
        background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); }
.foot > .label:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foot .label { color: var(--grey-2); }  /* --grey-2 on black is 6.25:1; --dim (3.24:1) fails WCAG at 11px */
.powered { display: inline-flex; align-items: center; gap: var(--s1); }
.powered img { height: 11px; width: auto; display: block; opacity: .55; filter: var(--mark-filter); } /* white mark at 55% reads as --grey-2 */
.forge-link { display: inline-flex; border: 0; padding: 4px 0; }
.forge-link:hover img, .forge-link:focus-visible img { opacity: 1; }

/* ---------------------------------------------------------------- metrics */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); border: 1px solid var(--line);
           margin-bottom: var(--s5); }
.metric { padding: var(--s3); border-right: 1px solid var(--line); background: var(--surface); }
.metric:last-child { border-right: 0; }
.metric .value { font: 300 40px/1.1 var(--font-display); letter-spacing: -0.02em; margin-top: var(--s2); }
.metric .value.mono { font: 400 30px/1.25 var(--font-mono); letter-spacing: 0; }
.metric .value.accent { color: var(--brand); }
.metric .value.warn { color: var(--warn); }
.metric .sub { margin-top: var(--s1); color: var(--grey-2); font-size: 14px; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: var(--s2); border-bottom: 1px solid var(--line-strong); white-space: nowrap;
     font: 400 11px/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: .16em; color: var(--grey-2); }
td { padding: var(--s2); border-bottom: 1px solid var(--line); color: var(--grey-1); vertical-align: top; font-size: 15px; }
tbody tr:hover td, tr:hover > td { background: var(--surface-2-hover); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-family: var(--font-mono); }
td.num { color: var(--text); font-size: 14px; white-space: nowrap; }
td.mono { font-family: var(--font-mono); font-size: 13px; color: var(--text); }
td .err { font-family: var(--font-mono); font-size: 12px; color: var(--grey-2); max-width: 420px; display: block;
          overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td .err.narrow { max-width: 260px; }
.empty { padding: var(--s5); text-align: center; color: var(--grey-2); border: 1px solid var(--line); }

/* ---------------------------------------------------------------- chips */
.chip { display: inline-block; padding: 2px var(--s1); border: 1px solid var(--grey-2); background: transparent;
        font: 400 11px/1.6 var(--font-mono); text-transform: uppercase; letter-spacing: .16em; color: var(--grey-1);
        white-space: nowrap; }
.chip.ok { border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand); }
.chip.warn { border-color: var(--warn); color: var(--warn); }
.chip.danger { border-color: var(--danger); color: var(--danger); }
.chip.mute { border-color: var(--line-strong); color: var(--grey-2); }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-block; cursor: pointer; padding: 12px 30px 12px var(--s3); border: 1px solid var(--brand);
       background: var(--brand); color: var(--bg); font: 400 11px/1 var(--font-mono); text-transform: uppercase;
       letter-spacing: .16em;
       clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%); }
.btn:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.secondary { background: transparent; color: var(--brand); border-color: var(--brand-line); clip-path: none;
                 padding: 11px var(--s3); }
.btn.secondary:hover { border-color: var(--brand); background: var(--brand-soft); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); clip-path: none;
              padding: 11px var(--s3); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.btn.small { padding: 8px 24px 8px var(--s2); }
.btn.secondary.small, .btn.danger.small { padding: 7px var(--s2); }
.actions { display: flex; gap: var(--s1); flex-wrap: wrap; align-items: center; }
.actions.stack { flex-direction: column; align-items: stretch; }
.actions.stack .btn { width: 100%; text-align: center; }
form.inline { display: inline; margin: 0; }

/* ---------------------------------------------------------------- forms */
.filters { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: flex-end; margin-bottom: var(--s3); }
.field { display: flex; flex-direction: column; gap: var(--s1); }
input, select, textarea { background: var(--bg); color: var(--text); border: 1px solid var(--line-strong);
                          font: 400 14px/1.4 var(--font-mono); padding: 10px var(--s2); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
textarea { width: 100%; min-height: 120px; resize: vertical; }

/* ---------------------------------------------------------------- PO stage timeline */
.timeline { display: flex; min-width: 640px; }
.timeline.compact { min-width: 300px; }
.timeline.compact .step { flex: 1 1 0; min-width: 0; padding-right: 0; }
.timeline.compact .step > span { visibility: hidden; white-space: nowrap; }
.timeline.compact .step.current > span { visibility: visible; }
.step { position: relative; flex: 1; padding-top: 18px; padding-right: var(--s1); color: var(--grey-2);
        font: 400 10px/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: .12em; }
.step::before { content: ""; position: absolute; top: 0; left: 0; width: 10px; height: 10px;
                border: 1px solid var(--line-strong); background: transparent; }
.step::after { content: ""; position: absolute; top: 5px; left: 14px; right: 4px; height: 1px; background: var(--line-strong); }
.step:last-child::after { display: none; }
.step.done { color: var(--grey-1); }
.step.done::before { background: var(--brand); border-color: var(--brand); }
.step.done::after { background: var(--brand-line); }
.step.current { color: var(--text); }
.step.current::before { border-color: var(--brand); }
.step.current.stuck { color: var(--warn); }
.step.current.stuck::before { border-color: var(--warn); }

/* ---------------------------------------------------------------- cards */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.card { border: 1px solid var(--line); background: var(--surface); padding: var(--s3); }
.card h3 { margin-bottom: var(--s2); }
.card.approval { border-left: 2px solid var(--brand); }
.block-title { margin: var(--s4) 0 var(--s2); }
.card + .grid-2, .grid-2 + .block-title { margin-top: var(--s3); }
.card.approval .vendor { font: 600 19px/1.3 var(--font-display); color: var(--text); }
.amount { font-family: var(--font-mono); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--s1) var(--s3); margin: 0; }
dl.kv dt { font: 400 11px/1.8 var(--font-mono); text-transform: uppercase; letter-spacing: .16em; color: var(--grey-2); }
dl.kv dd { margin: 0; color: var(--text); }
ul.reasons { margin: 0; padding-left: var(--s2); color: var(--grey-1); }
ul.reasons li { margin-bottom: 4px; }
details summary { cursor: pointer; }

.flash { border: 1px solid var(--brand-line); background: var(--brand-soft); color: var(--text);
         padding: var(--s2) var(--s3); margin-bottom: var(--s3); }

/* ---------------------------------------------------------------- reports (shared header and footer) */
.report-head { display: flex; align-items: center; gap: var(--s2); padding-bottom: var(--s2);
               border-bottom: 1px solid var(--brand); margin-bottom: var(--s4); }
.report-head img { width: 28px; height: 28px; display: block; }
.report-head .print-only { display: none; }
body.report main { max-width: 880px; margin: 0 auto; padding: var(--s5) var(--s4); }
body.report section { margin-bottom: var(--s4); }
body.report ol, body.report ul { color: var(--grey-1); padding-left: var(--s3); }
body.report li { margin-bottom: 4px; }
.report-head h1 { font-size: 28px; }
.report-foot { margin-top: var(--s5); padding-top: var(--s2); border-top: 1px solid var(--line); color: var(--grey-2); }

/* ---------------------------------------------------------------- legacy class names (pre-rebrand templates) */
.status { display: inline-block; padding: 2px var(--s1); border: 1px solid var(--grey-2);
          font: 400 11px/1.6 var(--font-mono); text-transform: uppercase; letter-spacing: .16em; color: var(--grey-1);
          white-space: nowrap; }
.status.attention { border-color: var(--warn); color: var(--warn); }
.status.live { border-color: var(--brand-line); background: var(--brand-soft); color: var(--brand); }
.btn.ghost { background: transparent; color: var(--brand); border-color: var(--brand-line); clip-path: none;
             padding: 11px var(--s3); }
.btn.ghost:hover { border-color: var(--brand); background: var(--brand-soft); }
.btn.ghost.small { padding: 7px var(--s2); }

@media (max-width: 1100px) {
  .chips { display: none; }
}
@media (max-width: 720px) {
  .top, .nav, main, .foot { padding-left: var(--s2); padding-right: var(--s2); }
  .top-meta .who, .brand-text .label, .top-meta > .label { display: none; }
  .top-meta { gap: var(--s1); }
  .top-meta .btn.small { padding: 7px var(--s1); }
  .page-head { flex-direction: column; align-items: flex-start; }
  .grid-2 { grid-template-columns: 1fr; }
  h1 { font-size: 30px; }
  .foot { padding: 0 var(--s2); }  /* same 48px row on phones; the left label truncates */
  .powered { white-space: nowrap; flex-shrink: 0; }
}

/* ---------------------------------------------------------------- print (reports and any panel page) */
@media print {
  @page { margin: 18mm 16mm; }
  html, body { background: var(--print-bg); color: var(--print-text); }
  .top, .nav, .foot, .actions, form, .btn, [hx-get] > .actions { display: none !important; }
  main, body.report main { max-width: none; padding: 0; }
  h1, h2, h3, dl.kv dd, td.num, td.mono { color: var(--print-text); }
  h1 strong, h2 strong, .accent { color: var(--print-text); }
  p, td, li, ol, ul, .g1, body.report ol, body.report ul { color: var(--print-text); }
  .label, th, dl.kv dt, .dim { color: var(--print-grey); }
  .table-wrap, .card, .metric, .empty, pre { background: transparent; border-color: var(--print-line); }
  th { border-bottom-color: var(--print-grey); }
  td { border-bottom-color: var(--print-line); }
  tr, .card { break-inside: avoid; }
  tbody tr:hover td, tr:hover > td { background: transparent; }
  .chip, .chip.ok, .chip.warn, .chip.danger, .chip.mute { background: transparent; color: var(--print-text);
                                                          border-color: var(--print-grey); }
  .report-head { border-bottom-color: var(--print-text); }
  .report-head .screen-only { display: none; }
  .report-head .print-only { display: block; }
  .report-foot { color: var(--print-grey); border-top-color: var(--print-line); }
}

/* ---------------------------------------------------------------- login */
.login-page { min-height: 100vh; display: flex; flex-direction: column; box-sizing: border-box; }
.login { flex: 1; display: flex; align-items: center; justify-content: center; padding: var(--s5) var(--s2); }
.login-card { width: 100%; max-width: 440px; border: 1px solid var(--line); background: var(--surface);
  padding: var(--s5) var(--s4); border-left: 2px solid var(--brand); }
.login-brand { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s4); }
.login-brand .wordmark { font-size: 30px; }
.login-card h1 { margin: 0 0 var(--s1); }
.login-card > p { margin: 0 0 var(--s3); }
.login-form { display: flex; flex-direction: column; gap: var(--s3); margin: var(--s3) 0; }
.login-form input { width: 100%; }
.login-form .btn { align-self: flex-start; }
.flash.danger { border-color: var(--danger); background: transparent; color: var(--danger); }
.top-meta form { display: inline; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* light and dark switch (same as the Forge Operations site): a chamfered square, half filled */
.theme-switch { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; padding: 0;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); cursor: pointer;
  transition: border-color .3s ease, color .3s ease; }
.theme-switch svg { width: 18px; height: 18px; }
.theme-switch .ts-frame { fill: none; stroke: currentColor; stroke-width: 1.4; }
.theme-switch .ts-fill { fill: currentColor; transform-origin: 10px 10px; transition: transform .6s cubic-bezier(.16, 1, .3, 1); }
.theme-switch[data-theme-state="light"] .ts-fill { transform: rotate(180deg); }
@media (hover: hover) { .theme-switch:hover { border-color: var(--text); color: var(--brand); } }
@media (prefers-reduced-motion: reduce) { .theme-switch .ts-fill { transition: none; } }
/* the new theme grows out of the switch; no default crossfade */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.login-tools { position: absolute; top: var(--s2); right: var(--s2); }
.login-page { position: relative; }
.report-head img.screen-only { filter: var(--mark-filter); }  /* white mono logo turns dark on the light theme */
