:root {
  --bg: #07111d;
  --panel: #0b1928;
  --panel-2: #10243a;
  --line: #1d405f;
  --text: #e8f5ff;
  --muted: #8fa9bd;
  --cyan: #54d6ff;
  --blue: #2791dd;
  --green: #5ce1a0;
  --amber: #f3b857;
  --red: #ff7777;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 50% 0, #102943 0, var(--bg) 42%); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.masthead { display: grid; grid-template-columns: 128px 1fr auto; gap: 22px; align-items: center; max-width: 1380px; margin: 0 auto; padding: 28px 28px 20px; }
.brand-mark { width: 128px; height: 86px; object-fit: cover; border-radius: 16px; border: 1px solid #31546f; box-shadow: 0 10px 32px #0008; }
.eyebrow { margin: 0 0 6px; color: var(--cyan); text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 750; }
h1 { margin: 0; font-size: clamp(25px, 4vw, 42px); letter-spacing: -.035em; }
h2, h3, h4 { margin-top: 0; }
h2 { font-size: 27px; }
h3 { font-size: 19px; }
h4 { margin: 24px 0 10px; color: #cfe9fb; }
.subtitle { margin: 7px 0 0; color: var(--muted); }
.muted, small { color: var(--muted); }
small { display: block; margin-top: 4px; font-size: 11px; overflow-wrap: anywhere; }
.status { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); padding: 10px 14px; border-radius: 999px; color: var(--muted); background: #07111dcc; font-size: 13px; white-space: nowrap; }
.status span { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 12px var(--amber); }
.status-online { color: var(--green); border-color: #246849; }
.status-online span { background: var(--green); box-shadow: 0 0 12px var(--green); }
.status-offline { color: #ff9d9d; border-color: #6f3030; }
.status-offline span { background: var(--red); box-shadow: 0 0 12px var(--red); }
main { max-width: 1380px; margin: 0 auto; padding: 0 28px 50px; }
.auth-card { max-width: 500px; margin: 42px auto; padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: #0b1928ee; box-shadow: 0 22px 70px #0006; }
.form-stack, .mutation-grid form, .upload-card { display: grid; gap: 14px; }
label { display: grid; gap: 7px; color: #bfd5e6; font-size: 13px; font-weight: 650; }
input, select { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #2b4d68; border-radius: 9px; background: #071522; color: var(--text); outline: none; }
input:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px #54d6ff1f; }
button { min-height: 40px; padding: 0 14px; border: 1px solid #2d80b7; border-radius: 9px; background: #0f3855; color: var(--text); font-weight: 680; }
button:hover:not(:disabled) { border-color: var(--cyan); background: #154b70; }
button:disabled { opacity: .55; cursor: wait; }
.button-secondary { background: #101f2e; border-color: #365066; }
.danger { border-color: #874646; background: #482424; color: #ffd8d8; }
.small { min-height: 31px; padding: 0 9px; font-size: 12px; }
.form-error { min-height: 20px; margin: 0; color: #ff9d9d; }
.console-bar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; gap: 16px; padding: 11px; border: 1px solid var(--line); border-radius: 13px; background: #081522f2; backdrop-filter: blur(16px); box-shadow: 0 8px 28px #0005; }
.console-bar nav { display: flex; flex-wrap: wrap; gap: 6px; }
.nav-button { min-height: 35px; border-color: transparent; background: transparent; color: var(--muted); }
.nav-button.active { color: var(--text); border-color: #2d80b7; background: #0f3855; }
.session-copy { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.view { display: none; padding-top: 27px; }
.active-view { display: block; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.section-heading h2 { margin-bottom: 0; }
.flash { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: 480px; padding: 14px 17px; border-radius: 11px; box-shadow: 0 16px 50px #000a; }
.flash-success { color: #d8ffea; background: #143c2a; border: 1px solid #2c865b; }
.flash-error { color: #ffe1e1; background: #482424; border: 1px solid #964747; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 20px 0; }
.metrics article { display: flex; flex-direction: column; padding: 18px; border: 1px solid var(--line); background: linear-gradient(145deg, var(--panel-2), var(--panel)); border-radius: 14px; }
.metrics span, .metrics small { color: var(--muted); }
.metrics strong { margin: 8px 0 3px; font-size: 25px; }
.panel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.panel, .detail-card, .table-card, .upload-card { border: 1px solid var(--line); background: #0b1928e8; border-radius: 15px; box-shadow: 0 18px 45px #0003; }
.panel { min-height: 180px; padding: 21px; }
.panel p { color: #aac0d0; line-height: 1.55; }
.toolbar { display: flex; gap: 8px; max-width: 600px; margin-bottom: 16px; }
.access-card { margin-bottom: 16px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: #0b1928e8; }
.access-card summary { cursor: pointer; color: #cfe9fb; font-weight: 700; }
.access-form { display: grid; grid-template-columns: 1fr auto 1fr 1fr 1fr auto; gap: 9px; align-items: end; margin: 15px 0; }
.or-copy { align-self: center; color: var(--muted); }
.split-view { display: grid; grid-template-columns: minmax(560px, 1.2fr) minmax(360px, .8fr); gap: 16px; align-items: start; }
.detail-card { padding: 20px; margin-top: 16px; }
.split-view .detail-card { margin-top: 0; position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow: auto; }
.detail-card.empty { min-height: 180px; display: grid; place-items: center; color: var(--muted); text-align: center; }
.detail-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.table-card { min-height: 120px; overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 11px 13px; text-align: left; color: var(--muted); background: #0e2031; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
td { padding: 12px 13px; border-top: 1px solid #19344c; vertical-align: top; }
tbody tr[data-profile], tbody tr[data-match] { cursor: pointer; }
tbody tr:hover { background: #102a40; }
.empty-cell, .loading { padding: 25px; text-align: center; color: var(--muted); }
.badge { display: inline-flex; padding: 4px 8px; border: 1px solid #466079; border-radius: 999px; color: #bfd1df; font-size: 11px; text-transform: capitalize; white-space: nowrap; }
.badge-active, .badge-completed, .badge-published { color: var(--green); border-color: #2c7853; background: #153425; }
.badge-suspended, .badge-staged, .badge-reserved { color: var(--amber); border-color: #745b2d; background: #362a15; }
.badge-banned, .badge-failed, .badge-abandoned, .badge-retired { color: #ff9b9b; border-color: #793d3d; background: #371d1d; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--line); }
.facts div { padding: 11px; background: #0a1724; }
.facts dt { color: var(--muted); font-size: 11px; }
.facts dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.mutation-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 18px; }
.mutation-grid form { padding: 13px; border: 1px solid #24445e; border-radius: 10px; background: #0e2030; }
.item-list, .ledger-list, .timeline { display: grid; gap: 8px; }
.item-list > div, .ledger-list > div, .timeline > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px; border: 1px solid #1d3b54; border-radius: 9px; background: #091622; }
.timeline > div { align-items: start; flex-direction: column; }
.positive { color: var(--green); }
.negative { color: #ff9b9b; }
.price-form { display: grid; grid-template-columns: 85px minmax(150px, 1fr) minmax(130px, 1fr) auto; gap: 6px; min-width: 520px; }
.price-form input, .price-form button { min-height: 34px; }
.upload-card { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 12px; padding: 17px; margin-bottom: 17px; }
.upload-card progress { grid-column: 1 / -1; width: 100%; }
.actions { display: flex; gap: 6px; }
.modal-backdrop { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 22px; background: #03080fd9; backdrop-filter: blur(4px); }
.modal-card { width: min(720px, 100%); max-height: 78vh; display: flex; flex-direction: column; border: 1px solid #2d80b7; border-radius: 15px; background: #0b1928; box-shadow: 0 24px 80px #000c; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { flex: 1; margin: 0; padding: 16px 18px; overflow: auto; color: #cfe9fb; font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
footer { max-width: 1380px; margin: 0 auto; padding: 0 28px 30px; color: #6f8799; font-size: 12px; }

@media (max-width: 1050px) {
  .split-view { grid-template-columns: 1fr; }
  .split-view .detail-card { position: static; max-height: none; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .panel-grid { grid-template-columns: 1fr; }
  .upload-card { grid-template-columns: 1fr; }
  .access-form { grid-template-columns: 1fr; }
  .or-copy { display: none; }
}

@media (max-width: 760px) {
  .masthead { grid-template-columns: 80px 1fr; padding: 18px 16px; gap: 13px; }
  .brand-mark { width: 80px; height: 60px; border-radius: 10px; }
  .status { grid-column: 1 / -1; width: fit-content; }
  main { padding: 0 12px 35px; }
  .console-bar, .session-copy { align-items: stretch; flex-direction: column; }
  .console-bar { position: static; }
  .metrics { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; }
  footer { padding: 0 16px 20px; }
}
