:root {
  --bg: #080808;
  --panel: #121212;
  --panel-2: #191919;
  --line: #303030;
  --text: #f8f8f8;
  --muted: #a9a9a9;
  --yellow: #f7d000;
  --yellow-soft: rgba(247, 208, 0, .12);
  --red: #d94b4b;
  --red-soft: rgba(217, 75, 75, .15);
  --green: #5ecb8a;
  --blue: #7ea7ff;
  --radius: 16px;
  --shadow: 0 20px 60px rgba(0, 0, 0, .28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 75% -20%, rgba(247, 208, 0, .11), transparent 34rem), var(--bg); color: var(--text); }
a { color: inherit; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 99; background: var(--yellow); color: #000; padding: .75rem 1rem; border-radius: 10px; font-weight: 800; }
.skip-link:focus { top: 1rem; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr); align-items: center; gap: 1.5rem; min-height: 76px; padding: .85rem clamp(1rem, 3vw, 3rem); border-bottom: 1px solid var(--line); background: rgba(8, 8, 8, .92); backdrop-filter: blur(18px); }
.brand { display: inline-flex; align-items: center; gap: .8rem; width: max-content; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--yellow); color: #050505; font-weight: 900; letter-spacing: -.04em; }
.brand strong, .brand small, .operator-menu strong, .operator-menu small { display: block; }
.brand small, .operator-menu small { color: var(--muted); margin-top: .15rem; font-size: .72rem; }
.topbar nav { display: flex; align-items: center; gap: .25rem; padding: .25rem; border: 1px solid var(--line); border-radius: 13px; background: #0c0c0c; }
.topbar nav a { padding: .65rem .85rem; border-radius: 9px; color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 700; white-space: nowrap; }
.topbar nav a:hover, .topbar nav a[aria-current="page"] { color: #050505; background: var(--yellow); }
.operator-menu { justify-self: end; display: flex; align-items: center; gap: 1rem; text-align: right; }
.operator-menu form { margin: 0; }

.main { width: min(1440px, 100%); margin: 0 auto; padding: clamp(1.5rem, 4vw, 4rem) clamp(1rem, 4vw, 4rem); flex: 1; }
.main-auth { display: grid; place-items: center; width: min(720px, 100%); }
.footer { padding: 1.5rem clamp(1rem, 4vw, 4rem) 2.5rem; border-top: 1px solid #202020; color: #777; text-align: center; font-size: .78rem; }
.footer p { margin: .35rem auto; max-width: 900px; }
.footer a { color: #b4b4b4; }
.fine-print { line-height: 1.5; }

h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: .35rem 0 .65rem; font-size: clamp(2rem, 5vw, 4.8rem); line-height: .96; letter-spacing: -.055em; max-width: 980px; }
h2 { margin: 0; font-size: clamp(1.35rem, 2.3vw, 2rem); letter-spacing: -.03em; }
p { color: var(--muted); line-height: 1.65; }
.eyebrow { color: var(--yellow); font-size: .75rem; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.lede { font-size: 1.06rem; }
.muted { color: var(--muted); }
.mono, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: clamp(2rem, 5vw, 4rem); }
.page-heading.compact h1 { font-size: clamp(2rem, 4vw, 3.5rem); }
.page-heading p { max-width: 760px; margin: 0; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin: 2.5rem 0 1.1rem; }
.section-heading p { margin: .35rem 0 0; }
.button-row { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.button-row form { margin: 0; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .72rem 1rem; border: 1px solid transparent; border-radius: 11px; text-decoration: none; font-weight: 850; cursor: pointer; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--yellow); color: #050505; }
.button-secondary { border-color: var(--line); background: var(--panel-2); color: var(--text); }
.button-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.button-danger { background: var(--red); color: #fff; }
.button-full { width: 100%; }
.text-link { color: var(--yellow); font-weight: 800; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.metric-card, .summary-card, .panel, .form-card, .auth-card, .approval-panel, .hash-panel, .empty-state { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(255,255,255,.025), transparent), var(--panel); box-shadow: var(--shadow); }
.metric-card { padding: 1.25rem; min-height: 148px; display: flex; flex-direction: column; justify-content: space-between; }
.metric-card span, .summary-card span, .hash-panel span { color: var(--muted); font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.metric-card strong { font-size: clamp(1.35rem, 2.4vw, 2.3rem); text-transform: capitalize; overflow-wrap: anywhere; }
.metric-card small, .summary-card small { color: var(--muted); line-height: 1.45; }
.summary-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1rem; }
.summary-card { padding: 1.3rem; display: grid; align-content: start; gap: .6rem; min-width: 0; }
.summary-card.wide strong { font-size: 1.2rem; line-height: 1.35; }
.summary-card a { color: var(--yellow); overflow-wrap: anywhere; }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 1rem 1.1rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; }
td strong, td small { display: block; }
td small { color: var(--muted); margin-top: .25rem; }
tr:last-child td { border-bottom: 0; }
.wrap-value { max-width: 740px; white-space: normal; overflow-wrap: anywhere; font-size: .86rem; line-height: 1.45; }
.progress { width: 150px; max-width: 100%; height: 6px; overflow: hidden; border-radius: 999px; background: #2b2b2b; }
.progress span { display: block; height: 100%; background: var(--yellow); border-radius: inherit; }
.status { display: inline-flex; align-items: center; width: max-content; max-width: 100%; padding: .28rem .55rem; border-radius: 999px; background: #2a2a2a; color: #d4d4d4; font-size: .72rem; font-weight: 850; text-transform: capitalize; overflow-wrap: anywhere; }
.status-ready, .status-succeeded, .status-complete, .status-ok { background: rgba(94, 203, 138, .15); color: var(--green); }
.status-approved, .status-active, .status-applying, .status-verifying { background: var(--yellow-soft); color: var(--yellow); }
.status-failed, .status-error, .status-compensation_failed { background: var(--red-soft); color: #ff9292; }
.status-draft, .status-unchanged, .status-viewer { background: rgba(126, 167, 255, .12); color: var(--blue); }
.count-badge { display: grid; place-items: center; min-width: 52px; min-height: 36px; padding: 0 .7rem; border-radius: 999px; background: var(--yellow); color: #050505; font-weight: 900; }

.auth-card { width: min(620px, 100%); padding: clamp(1.5rem, 5vw, 3.5rem); }
.auth-card h1 { font-size: clamp(2.2rem, 7vw, 4.4rem); }
.stack { display: grid; gap: 1rem; }
label { display: grid; gap: .45rem; color: #dedede; font-size: .87rem; font-weight: 760; }
input, textarea { width: 100%; border: 1px solid #3a3a3a; border-radius: 10px; padding: .78rem .85rem; background: #0b0b0b; color: var(--text); }
input:disabled { color: #777; background: #161616; }
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
input:focus, textarea:focus { border-color: var(--yellow); }
.security-note { margin-bottom: 0; font-size: .78rem; }
.divider { display: flex; align-items: center; gap: 1rem; margin: 1.2rem 0; color: #777; font-size: .75rem; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.form-card { max-width: 1000px; margin: 0 auto; padding: clamp(1.2rem, 4vw, 2.5rem); display: grid; gap: 1.25rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid-one { grid-template-columns: 1fr; }
.locked-field { padding: 1rem; border-left: 4px solid var(--yellow); background: var(--yellow-soft); }
.locked-field span, .locked-field strong { display: block; }
.locked-field span { color: var(--yellow); font-size: .75rem; font-weight: 850; text-transform: uppercase; }
.locked-field strong { margin-top: .4rem; line-height: 1.4; }
.details-panel { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; background: #0c0c0c; }
.details-panel summary { cursor: pointer; font-weight: 850; }
.details-panel[open] summary { margin-bottom: 1rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .7rem; }

.alert, .callout { border-radius: 12px; padding: 1rem; margin-bottom: 1.25rem; border: 1px solid var(--line); }
.alert-success { background: rgba(94,203,138,.12); border-color: rgba(94,203,138,.4); }
.alert-error, .callout.warning { background: var(--red-soft); border-color: rgba(217,75,75,.45); }
.alert-info { background: var(--yellow-soft); border-color: rgba(247,208,0,.4); }
.callout p { margin: .35rem 0 0; }

.two-column { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .7fr); gap: 1.25rem; align-items: start; }
.panel { padding: 1.15rem; margin-bottom: 1rem; }
.panel .section-heading { margin-top: 0; }
.checklist { display: grid; gap: .65rem; }
.check-row { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: .8rem; align-items: center; padding: .85rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.check-row.complete { border-color: rgba(94,203,138,.4); background: rgba(94,203,138,.06); }
.check-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: #0b0b0b; color: var(--yellow); cursor: pointer; font-size: 1.15rem; }
.check-row label strong { line-height: 1.35; }
.check-row input { padding: .55rem .65rem; font-size: .8rem; }
.link-list { margin: 0; display: grid; }
.link-list > div { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.link-list > div:last-child { border-bottom: 0; }
.link-list dt { color: var(--muted); }
.link-list a { color: var(--yellow); }
.chip-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip-list span { padding: .32rem .55rem; background: #252525; border-radius: 999px; color: #bebebe; font-size: .72rem; }

.hash-panel { display: grid; gap: .75rem; padding: 1rem; margin-bottom: 1.25rem; }
.hash-panel > div { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 1rem; }
.hash-panel code { color: #d3d3d3; font-size: .76rem; }
.diff-list { display: grid; gap: 1rem; }
.diff-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.diff-card header, .diff-card footer { display: flex; align-items: center; gap: .8rem; padding: .9rem 1rem; }
.diff-card header { border-bottom: 1px solid var(--line); }
.diff-card header strong, .diff-card header small { display: block; }
.diff-card header small { color: var(--muted); margin-top: .2rem; }
.sequence { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--yellow); color: #050505; font-weight: 900; }
.diff-grid { display: grid; grid-template-columns: 1fr 1fr; }
.diff-grid > div { min-width: 0; padding: 1rem; }
.diff-grid > div + div { border-left: 1px solid var(--line); background: rgba(247,208,0,.035); }
.diff-grid span { color: var(--muted); font-size: .72rem; font-weight: 850; text-transform: uppercase; }
.diff-grid pre { margin: .55rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: .78rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.diff-card footer { justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: .72rem; }
.approval-panel { margin-top: 1.5rem; padding: clamp(1.2rem, 4vw, 2rem); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 2rem; }
.approval-panel h2 { margin-top: .4rem; }
.approval-form { display: grid; align-content: center; gap: 1rem; }
.confirm-row { grid-template-columns: 22px 1fr; align-items: start; }
.confirm-row input { width: 18px; height: 18px; margin-top: .1rem; }

.empty-state { padding: clamp(2rem, 7vw, 5rem); text-align: center; }
.empty-state h2, .empty-state p { max-width: 620px; margin-left: auto; margin-right: auto; }
.safety-band { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-top: 2rem; padding: 1.2rem; border: 1px solid rgba(247,208,0,.35); border-radius: var(--radius); background: var(--yellow-soft); }
.safety-band p { margin: .35rem 0 0; }
.tabs { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem; }
.tabs a { padding: .6rem .85rem; border-radius: 9px; text-decoration: none; color: var(--muted); }
.tabs a.active { background: var(--yellow); color: #050505; font-weight: 850; }
.timeline { display: grid; gap: 0; }
.timeline article { display: grid; grid-template-columns: 28px 1fr; position: relative; min-height: 90px; }
.timeline article::before { content: ""; position: absolute; left: 7px; top: 15px; bottom: -10px; width: 1px; background: var(--line); }
.timeline article:last-child::before { display: none; }
.timeline-dot { width: 15px; height: 15px; margin-top: .35rem; border-radius: 50%; background: var(--yellow); z-index: 1; }
.timeline header { display: flex; align-items: center; gap: .6rem; }
.timeline p, .timeline small { margin: .3rem 0; color: var(--muted); }

.value-disclosure summary { color: var(--yellow); cursor: pointer; font-weight: 750; list-style-position: inside; }
.value-disclosure code { display: block; margin-top: .65rem; padding: .75rem; border: 1px solid var(--line); border-radius: .55rem; background: #090909; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .78rem; line-height: 1.55; overflow-wrap: anywhere; white-space: normal; }

@media (max-width: 980px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topbar nav { grid-column: 1 / -1; grid-row: 2; overflow-x: auto; justify-content: flex-start; }
  .operator-menu { grid-column: 2; grid-row: 1; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-card.wide { grid-column: 1 / -1; }
  .two-column, .approval-panel { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .topbar { position: static; grid-template-columns: 1fr; gap: .8rem; }
  .topbar nav, .operator-menu { grid-column: 1; grid-row: auto; justify-self: stretch; }
  .topbar nav { width: 100%; }
  .topbar nav a { flex: 1; text-align: center; padding: .65rem .45rem; }
  .operator-menu { justify-content: space-between; text-align: left; }
  .main { padding-top: 1.5rem; }
  .page-heading, .section-heading, .safety-band { align-items: stretch; flex-direction: column; }
  .page-heading .button, .page-heading form, .page-heading form .button { width: 100%; }
  .button-row { width: 100%; display: grid; }
  .metric-grid, .summary-grid, .form-grid { grid-template-columns: 1fr; }
  .summary-card.wide { grid-column: auto; }
  .metric-card { min-height: 120px; }
  .form-actions { display: grid; grid-template-columns: 1fr; }
  .form-actions .button { width: 100%; }
  .hash-panel > div { grid-template-columns: 1fr; gap: .35rem; }
  .diff-grid { grid-template-columns: 1fr; }
  .diff-grid > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .diff-card footer { align-items: flex-start; flex-direction: column; }
  .table-wrap { border: 0; background: transparent; overflow: visible; }
  table, thead, tbody, tr, th, td { display: block; min-width: 0; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tbody { display: grid; gap: .75rem; }
  tr { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: .35rem .85rem; }
  td { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: .8rem; border-bottom: 1px solid var(--line); padding: .75rem 0; overflow-wrap: anywhere; }
  td::before { content: attr(data-label); color: var(--muted); font-size: .7rem; font-weight: 850; text-transform: uppercase; }
  td:last-child { border-bottom: 0; }
  .progress { width: 100%; }
}

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