:root {
  font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  color:#e2edf9;
  background:#071827;
  font-synthesis:none;
  --navy:#091f32;
  --teal:#169deb;
  --line:#1b405b;
  --muted:#9ab2c9;
  --warn:#f6bb51;
  --danger:#ff7284;
  --shadow:0 5px 22px #020b1555;
}

* {
  box-sizing:border-box;
}

body {
  margin:0;
}

button,input,select,textarea {
  font:inherit;
}

button,a,input,select,textarea {
  touch-action:manipulation;
}

button {
  cursor:pointer;
  min-height:44px;
  border:1px solid #285575;
  border-radius:7px;
  padding:9px 15px;
  background:#102a40;
  color:#d8e9f8;
  font-weight:600;
}

button:hover:not(:disabled) {
  background:#153c57;
  border-color:var(--teal);
}

button:disabled {
  cursor:not-allowed;
  background:#152b3c;
  color:#8a9eaf;
  border-color:#294050;
}

button.primary {
  background:var(--teal);
  color:#fff;
  border-color:var(--teal);
}

button.danger {
  color:var(--danger);
  border-color:#713448;
}

button.pending {
  background:#362d20;
  color:var(--warn);
  border-color:#765629;
}

a {
  color:#62c6ff;
  text-underline-offset:3px;
}

a:hover {
  text-decoration:underline;
}

h1,h2,h3,p {
  margin-top:0;
}

h1 {
  font-size:29px;
  letter-spacing:-.7px;
  margin-bottom:10px;
}

h2 {
  font-size:19px;
  margin-bottom:16px;
}

h3 {
  font-size:16px;
  margin-bottom:12px;
}

p {
  line-height:1.65;
}

small,.hint {
  font-size:12px;
  line-height:1.6;
  color:var(--muted);
}

.muted {
  color:var(--muted);
}

.eyebrow {
  font-size:11px;
  letter-spacing:1.6px;
  font-weight:700;
  color:var(--teal);
  margin-bottom:10px;
}

[hidden] {
  display:none!important;
}

:focus-visible {
  outline:3px solid #26a7b8;
  outline-offset:3px;
}

.skip-link {
  position:fixed;
  left:10px;
  top:-100px;
  background:#102a40;
  padding:14px;
  z-index:50;
}

.skip-link:focus {
  top:10px;
}

.app-shell {
  display:grid;
  grid-template-columns:250px minmax(0,1fr);
  min-height:100vh;
}

.sidebar {
  background:var(--navy);
  color:#d9e6eb;
  padding:30px 16px;
  position:sticky;
  top:0;
  height:100vh;
  display:flex;
  flex-direction:column;
}

.brand {
  color:white;
  display:flex;
  gap:12px;
  align-items:center;
  text-decoration:none;
  margin:0 8px 36px;
  font-size:19px;
  font-weight:700;
}

.brand small {
  display:block;
  color:#96b5c4;
  font-size:9px;
  letter-spacing:1.4px;
  margin-top:5px;
}

.brand-mark {
  width:40px;
  height:40px;
  display:inline-grid;
  place-items:center;
  background:#138fd1;
  color:#fff;
  border:1px solid #52cbf5;
  border-radius:10px;
  font-weight:800;
  font-size:18px;
  flex-shrink:0;
}

nav {
  display:grid;
  gap:7px;
}

nav a {
  color:#bbceda;
  text-decoration:none;
  display:flex;
  gap:17px;
  align-items:center;
  border-radius:7px;
  min-height:47px;
  padding:11px 14px;
  font-size:14px;
}

nav a span {
  color:#87aabf;
  font-size:11px;
}

nav a[aria-current=page] {
  background:#133f60;
  color:white;
}

nav a[aria-current=page] span {
  color:#6fd0c8;
}

.sidebar-note {
  margin-top:auto;
  padding:24px 12px 0;
  font-size:12px;
  color:#a4bfcc;
  line-height:1.8;
}

.workspace {
  min-width:0;
}

.topbar {
  min-height:78px;
  border-bottom:1px solid var(--line);
  background:#102a40;
  padding:14px 32px;
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:center;
  flex-wrap:wrap;
}

.status-strip,.toolbar {
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.status-strip {
  font-size:13px;
}

.badge {
  display:inline-flex;
  align-items:center;
  line-height:1.4;
  padding:5px 9px;
  border-radius:5px;
  font-size:12px;
  overflow-wrap:anywhere;
  border:1px solid transparent;
}

.badge.neutral {
  color:#a8bfd4;
  background:#18344b;
}

.badge.good {
  color:#45e3ba;
  background:#113e38;
  border-color:#267866;
}

.badge.warning {
  color:#ffd06c;
  background:#302b20;
  border-color:#786035;
}

.badge.bad {
  color:#ff8696;
  background:#382433;
  border-color:#733646;
}

.runtime-banner {
  padding:10px 32px;
  background:#102f46;
  border-bottom:1px solid var(--line);
  font-size:13px;
  line-height:1.65;
}

.runtime-banner.paper {
  background:#352c20;
  color:#ffd06c;
}

main {
  max-width:1800px;
  margin:auto;
  padding:24px 24px 45px;
}

.page-heading {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:23px;
}

.page-heading p:last-child {
  margin-bottom:0;
  font-size:13px;
}

footer {
  padding:20px 32px;
  border-top:1px solid var(--line);
  font-size:12px;
  color:var(--muted);
}

.notice {
  margin:15px 32px 0;
  padding:13px 16px;
  background:#103a37;
  border:1px solid #267866;
  border-radius:7px;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  line-height:1.6;
}

.notice.error {
  color:#ff8696;
  background:#382433;
  border-color:#733646;
}

.notice.warning {
  color:#ffd06c;
  background:#352c20;
  border-color:#786035;
}

.panel {
  background:#102a40;
  border:1px solid var(--line);
  border-radius:10px;
  padding:23px;
  margin-bottom:20px;
  box-shadow:var(--shadow);
  min-width:0;
}

.panel-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:18px;
  flex-wrap:wrap;
}

.panel-heading h2,.panel-heading h3 {
  margin:0;
}

.grid-two {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:20px;
}

.metrics {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  margin-bottom:22px;
}

.metric {
  background:#102a40;
  border:1px solid var(--line);
  padding:20px;
  border-radius:9px;
  min-width:0;
}

.metric p {
  font-size:12px;
  color:var(--muted);
  margin-bottom:12px;
}

.metric strong {
  font-size:24px;
  display:block;
  font-variant-numeric:tabular-nums;
  overflow-wrap:anywhere;
}

.metric small {
  display:block;
  margin-top:8px;
}

.definition-grid {
  display:grid;
  grid-template-columns:minmax(130px,1fr) minmax(0,2fr);
  gap:0;
  margin:0;
}

.definition-grid dt,.definition-grid dd {
  margin:0;
  padding:10px 0;
  border-bottom:1px solid #18324a;
  line-height:1.55;
  overflow-wrap:anywhere;
}

.definition-grid dt {
  font-size:13px;
  color:var(--muted);
  padding-right:16px;
}

.definition-grid dd {
  font-size:14px;
}

.empty {
  padding:30px 18px;
  text-align:center;
  border:1px dashed #285575;
  background:#0c2336;
  border-radius:7px;
  color:var(--muted);
  line-height:1.8;
}

.table-scroll {
  overflow:auto;
  max-width:100%;
  border:1px solid var(--line);
  border-radius:7px;
}

table {
  width:100%;
  border-collapse:collapse;
  text-align:left;
  font-size:13px;
}

th {
  background:#122e44;
  color:#a8bfd4;
  font-size:12px;
  font-weight:600;
  white-space:nowrap;
}

th,td {
  padding:12px 14px;
  border-bottom:1px solid #224358;
  vertical-align:top;
}

td {
  max-width:350px;
  min-width:100px;
  overflow-wrap:anywhere;
  line-height:1.6;
}

tbody tr:last-child td {
  border-bottom:0;
}

tbody tr:hover {
  background:#0b2337;
}

td.actions {
  position:sticky;
  right:0;
  background:#102a40;
  min-width:120px;
  border-left:1px solid var(--line);
}

td.actions .toolbar {
  gap:6px;
}

td.actions button {
  font-size:12px;
  padding:8px 10px;
}

.pagination {
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:12px;
  margin-top:16px;
  font-size:12px;
}

.filters {
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  align-items:end;
  margin-bottom:18px;
}

.filters label {
  min-width:140px;
  max-width:220px;
  flex:1;
}

.filters label span {
  display:block;
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;
}

.filters input,.filters select {
  width:100%;
}

input:not([type=checkbox]),select,textarea {
  border:1px solid #52708a;
  border-radius:6px;
  background:#102a40;
  padding:10px 11px;
  min-height:44px;
  color:#e1edf8;
  min-width:0;
  max-width:100%;
}

textarea {
  width:100%;
  resize:vertical;
  line-height:1.6;
}

input[readonly] {
  background:#102c42;
}

input[type=checkbox] {
  width:20px;
  height:20px;
  accent-color:var(--teal);
  flex-shrink:0;
}

.check-label {
  display:flex;
  align-items:center;
  gap:9px;
  min-height:44px;
  line-height:1.5;
}

.check-label input {
  margin:0;
}

.field-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:20px;
}

.field {
  display:flex;
  flex-direction:column;
  gap:7px;
  min-width:0;
}

.field label {
  font-size:13px;
  font-weight:600;
}

.field .hint {
  margin:0;
}

.field.wide {
  grid-column:1/-1;
}

.field-error {
  color:#ff7284;
  font-size:12px;
  white-space:pre-wrap;
}

.field.has-error {
  border-left:3px solid #ff7284;
  padding-left:12px;
}

.field.has-error input,.field.has-error select {
  border-color:#ff7284;
}

.field input:not([type=checkbox]),.field select {
  width:100%;
}

.field button {
  align-self:start;
  font-size:12px;
}

.field-set {
  border:0;
  padding:0;
  margin:0;
  min-width:0;
}

.field-set:disabled {
  opacity:.8;
}

.group-tabs {
  display:flex;
  gap:7px;
  flex-wrap:wrap;
  margin-bottom:18px;
}

.group-tabs button[aria-pressed=true] {
  background:var(--navy);
  border-color:var(--navy);
  color:#fff;
}

.sticky-actions {
  position:sticky;
  bottom:0;
  z-index:3;
  background:#0b2238f5;
  padding:14px 16px;
  border:1px solid var(--line);
  border-radius:8px;
  box-shadow:0 -5px 16px #18374609;
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
}

.config-meta {
  font-size:12px;
  color:var(--muted);
}

.row-editor input {
  min-width:100px;
  max-width:190px;
  width:100%;
}

.row-editor td {
  padding:8px;
  min-width:90px;
}

.row-editor td:last-child {
  min-width:70px;
}

.strategy-choice {
  border:1px solid var(--line);
  border-radius:6px;
  padding:10px 12px;
  margin-bottom:7px;
  display:flex;
  gap:10px;
  align-items:flex-start;
}

.strategy-choice p {
  margin:3px 0 0;
  font-size:12px;
  color:var(--muted);
}

.strategy-choice label {
  flex:1;
  overflow-wrap:anywhere;
}

.choice-list {
  max-height:340px;
  overflow:auto;
}

.details-json {
  font-family:ui-monospace,SFMono-Regular,Consolas,monospace;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  max-height:420px;
  overflow:auto;
  padding:14px;
  background:#102c42;
  border:1px solid var(--line);
  border-radius:6px;
  font-size:12px;
  line-height:1.65;
}

.action-stack {
  display:grid;
  gap:8px;
}

.action-stack .hint {
  margin:0;
}

.op-grid {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}

.op-item {
  padding:12px;
  border:1px solid var(--line);
  border-radius:6px;
  display:flex;
  justify-content:space-between;
  align-items:start;
  gap:12px;
}

.op-item p {
  margin:4px 0 0;
  font-size:12px;
  color:var(--muted);
}

.op-item strong {
  font-size:13px;
}

.divider {
  border:0;
  border-top:1px solid var(--line);
  margin:22px 0;
}

.sparkline {
  width:100%;
  height:170px;
  display:block;
}

.series-caption {
  font-size:12px;
  color:var(--muted);
}

.login-screen {
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:24px;
  background:linear-gradient(145deg,#15324a,#102c42 60%,#103a37);
}

.login-card {
  width:min(420px,100%);
  padding:34px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#102a40;
  box-shadow:var(--shadow);
  display:grid;
  gap:12px;
}

.login-card .brand-mark {
  margin-bottom:12px;
}

.login-card h1 {
  font-size:26px;
}

.login-card p {
  margin-bottom:2px;
}

.login-card label {
  font-size:13px;
}

.login-card button {
  margin-top:8px;
}

.login-card #login-status {
  font-size:13px;
  white-space:pre-wrap;
}

.login-card .hint {
  margin-top:12px;
}

dialog {
  width:min(900px,calc(100% - 30px));
  max-height:90dvh;
  border:1px solid #285575;
  border-radius:12px;
  padding:26px;
  box-shadow:0 20px 80px #061e3d45;
  overflow:auto;
  color:#e1edf8;
}

dialog::backdrop {
  background:#102a3c77;
}

.dialog-heading {
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  position:sticky;
  top:-26px;
  background:#102a40;
  z-index:2;
  padding:4px 0 14px;
}

.dialog-heading h2 {
  font-size:21px;
  margin:7px 0;
}

#dialog-status {
  margin:14px 0 0;
  white-space:pre-wrap;
  font-size:13px;
  color:#ffc371;
}

.dialog-form {
  display:grid;
  gap:16px;
}

.dialog-form label {
  display:grid;
  gap:7px;
}

.dialog-form .check-label {
  display:flex;
}

.confirm-summary {
  border-left:3px solid #d08828;
  padding:14px;
  background:#352c20;
  line-height:1.7;
  font-size:13px;
}

.receipt-status {
  margin:15px 0;
  font-size:14px;
  line-height:1.7;
}

.binding-editor .toolbar,
#combination-bindings .toolbar {
  margin: 10px 0 14px;
}

.bindings-matrix {
  margin: 14px 0;
}

.bindings-matrix td {
  min-width: 230px;
  max-width: 340px;
}

.bindings-matrix td:first-child {
  min-width: 170px;
  position: sticky;
  left: 0;
  background: #fff;
  border-right: 1px solid var(--line);
}

.binding-cell select {
  width: 100%;
  max-width: 300px;
  min-height: 44px;
}

.binding-cell p {
  margin: 9px 0 0;
  line-height: 1.6;
}

.developer-info > summary {
  cursor: pointer;
  padding: 10px 0;
  min-height: 44px;
  color: var(--muted);
  font-size: 13px;
}

.developer-info[open] > summary {
  margin-bottom: 12px;
}

.scope-notice {
  margin: 16px 0;
  padding: 16px;
  border: 1px solid #285575;
  border-left: 4px solid var(--teal);
  border-radius: 7px;
  background: #103a37;
}

.scope-notice button {
  margin: 4px 8px 0 0;
}

.scope-choices {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  max-height: 340px;
  overflow: auto;
}

.scope-choices legend {
  color: var(--muted);
  font-size: 13px;
}

.scope-choices .check-label {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.scope-diff {
  margin: 12px 0;
  min-width: 0;
}

.scope-diff summary {
  cursor: pointer;
  padding: 12px 0;
  color: #62c6ff;
  min-height: 44px;
}

.live-boundary {
  border:1px solid #786035;
  background:#352c20;
  border-radius:7px;
  padding:13px;
  line-height:1.6;
  color:#f4c681;
  font-size:13px;
}

@media(min-width:1600px) {
  .field-grid {
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
}

@media(max-width:1150px) {
  .app-shell {
    grid-template-columns:190px minmax(0,1fr);
  }
  .metrics {
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .grid-two {
    grid-template-columns:1fr;
  }
  .topbar,main {
    padding-left:22px;
    padding-right:22px;
  }
  .op-grid {
    grid-template-columns:1fr;
  }
}

@media(max-width:760px) {
  .app-shell {
    display:block;
  }
  .sidebar {
    height:auto;
    position:static;
    padding:14px 12px 10px;
  }
  .brand {
    margin:0 6px 15px;
    font-size:17px;
  }
  .brand-mark {
    width:33px;
    height:33px;
    font-size:15px;
  }
  .brand small {
    font-size:8px;
  }
  .sidebar-note {
    display:none;
  }
  nav {
    display:flex;
    overflow:auto;
    gap:6px;
    padding-bottom:5px;
  }
  nav a {
    white-space:nowrap;
    min-height:44px;
    padding:10px 12px;
    flex-shrink:0;
  }
  nav a span {
    display:none;
  }
  .topbar {
    padding:12px 16px;
    gap:10px;
  }
  .topbar .toolbar {
    width:100%;
    justify-content:flex-end;
  }
  #identity {
    margin-right:auto;
    font-size:12px;
  }
  .runtime-banner {
    padding:10px 16px;
  }
  main {
    padding:23px 14px 28px;
  }
  .page-heading {
    display:block;
  }
  .page-heading>.badge {
    margin-top:12px;
  }
  h1 {
    font-size:25px;
  }
  .metrics {
    gap:10px;
  }
  .metric {
    padding:15px;
  }
  .metric strong {
    font-size:21px;
  }
  .panel {
    padding:16px;
    margin-bottom:15px;
  }
  .field-grid {
    grid-template-columns:1fr;
  }
  .group-tabs {
    flex-wrap:nowrap;
    overflow:auto;
    padding-bottom:9px;
  }
  .group-tabs button {
    white-space:nowrap;
    flex-shrink:0;
  }
  .field.wide {
    grid-column:auto;
  }
  .notice {
    margin:12px 14px 0;
  }
  .definition-grid {
    grid-template-columns:minmax(110px,1fr) minmax(0,1.5fr);
  }
  .sticky-actions {
    bottom:0;
    gap:12px;
    padding:12px;
  }
  .sticky-actions .toolbar {
    width:100%;
  }
  .sticky-actions button {
    flex:1;
    min-width:110px;
  }
  .filters label {
    max-width:none;
    min-width:120px;
  }
  .pagination {
    justify-content:space-between;
  }
  .op-grid {
    grid-template-columns:1fr;
  }
  .op-item {
    flex-wrap:wrap;
  }
  .op-item>.badge {
    margin-left:0;
  }
  dialog {
    padding:18px;
  }
  .dialog-heading {
    top:-18px;
  }
  td {
    max-width:250px;
  }
  footer {
    padding:20px 16px;
  }
  .login-card {
    padding:26px;
  }
}

@media(prefers-reduced-motion:reduce) {
  * {
    scroll-behavior:auto!important;
  }
}

/* Visual language from the supplied 01–24 reference set. Facts remain API-owned. */
.sidebar {border-right:1px solid var(--line);background:linear-gradient(165deg,#0a2236,#071a2b 70%,#0d3249);}
.brand {font-size:17px;margin-left:0;margin-right:0;}
nav a[aria-current=page] {box-shadow:inset 3px 0 #24b1ff;background:linear-gradient(90deg,#174c70,#10334c);}
.topbar {background:linear-gradient(110deg,#132e45,#0a2033);}
.panel,.metric {background:linear-gradient(135deg,#102c43,#0b2236);border-color:#1a405b;}
button.primary {background:linear-gradient(120deg,#1298e3,#0872c7);border-color:#24a4ed;}
.weights-editor input {max-width:130px;margin-left:auto;}
.weights-editor .check-label {justify-content:space-between;gap:12px;padding:8px 0;}
.login-screen {background:radial-gradient(ellipse at 20% 20%,#123c59,#061624 65%);}
.login-card {border:1px solid #23506d;box-shadow:0 20px 80px #0007;}
