:root {
  --navy: #07182d;
  --navy-2: #102943;
  --blue: #2563eb;
  --blue-soft: #eaf2ff;
  --ink: #132033;
  --muted: #68758a;
  --line: #dde4ed;
  --canvas: #f4f7fb;
  --white: #fff;
  --green: #138a59;
  --green-soft: #e5f7ef;
  --red: #c23b45;
  --red-soft: #fdebed;
  --amber: #aa6b08;
  --amber-soft: #fff4db;
  --violet: #6d4bd1;
  --shadow: 0 12px 32px rgba(18, 39, 63, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 14px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }

.shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 242px; color: #dbe7f5; background: linear-gradient(180deg, #061528 0%, #0b223a 100%); display: flex; flex-direction: column; padding: 28px 20px; z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; padding: 0 8px 30px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--blue); font-weight: 900; font-size: 21px; box-shadow: 0 8px 20px rgba(37,99,235,.4); }
.brand strong, .brand small { display: block; letter-spacing: .08em; }
.brand strong { font-size: 17px; }
.brand small { color: #8ea7c1; font-size: 9px; margin-top: -2px; }
nav { display: grid; gap: 7px; }
.nav-link { color: #a9bdd1; text-decoration: none; padding: 12px 14px; border-radius: 9px; display: flex; gap: 12px; align-items: center; font-weight: 650; }
.nav-link span { width: 19px; text-align: center; font-size: 17px; }
.nav-link:hover, .nav-link.active { color: #fff; background: rgba(255,255,255,.09); }
.nav-link.active { box-shadow: inset 3px 0 var(--blue); }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding: 22px 8px 0; display: flex; gap: 10px; align-items: center; }
.sidebar-foot strong, .sidebar-foot small { display: block; }
.sidebar-foot strong { color: #eaf2fa; font-size: 12px; }
.sidebar-foot small { color: #7f98b1; font-size: 11px; }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: #30c885; box-shadow: 0 0 0 5px rgba(48,200,133,.13); }

main { margin-left: 242px; min-height: 100vh; padding: 0 42px 30px; }
.topbar { height: 96px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 24px; letter-spacing: -.025em; }
h2 { margin-bottom: 8px; font-size: 27px; letter-spacing: -.035em; }
h3 { margin-bottom: 5px; }
.eyebrow { margin: 0 0 2px; color: #8491a4; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.eyebrow.blue { color: var(--blue); }
.muted { color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); background: var(--white); border-radius: 9px; color: var(--navy-2); font-size: 20px; }
.icon-button.loading { animation: spin .9s linear infinite; }

.notice { margin-top: 20px; padding: 13px 16px; border-radius: 9px; color: #174d37; background: var(--green-soft); border: 1px solid #bde8d4; }
.notice.error { color: #812d34; background: var(--red-soft); border-color: #f5c7cb; }
.section { scroll-margin-top: 18px; }
.hero { padding: 38px 0 28px; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.hero h2 { font-size: 32px; margin-bottom: 7px; }
.hero-copy { color: var(--muted); max-width: 690px; margin-bottom: 0; }
.primary-button, .secondary-button { border-radius: 9px; font-weight: 750; padding: 11px 17px; border: 1px solid transparent; transition: transform .15s ease, box-shadow .15s ease; }
.primary-button { color: #fff; background: var(--blue); box-shadow: 0 8px 18px rgba(37,99,235,.22); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(37,99,235,.3); }
.primary-button:disabled { opacity: .48; cursor: not-allowed; transform: none; box-shadow: none; }
.secondary-button { background: #fff; color: #263750; border-color: var(--line); }
.secondary-button:disabled { color: #99a5b5; background: #f5f7fa; cursor: not-allowed; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.metric-card { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 19px; display: flex; gap: 13px; min-height: 113px; box-shadow: 0 5px 16px rgba(18,39,63,.035); }
.metric-card p { color: var(--muted); margin-bottom: 4px; font-size: 12px; }
.metric-card strong, .metric-card small { display: block; }
.metric-card strong { font-size: 18px; line-height: 1.2; margin-bottom: 6px; }
.metric-card small { color: #7c899b; line-height: 1.35; }
.metric-icon { flex: 0 0 auto; width: 35px; height: 35px; display: grid; place-items: center; border-radius: 9px; font-weight: 900; }
.metric-icon.cobalt { color: var(--blue); background: var(--blue-soft); }
.metric-icon.green { color: var(--green); background: var(--green-soft); }
.metric-icon.amber { color: var(--amber); background: var(--amber-soft); }
.metric-icon.violet { color: var(--violet); background: #f0ebff; }

.block { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 26px; margin-bottom: 22px; box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: start; justify-content: space-between; gap: 22px; margin-bottom: 22px; }
.section-heading h2 { font-size: 22px; margin-bottom: 3px; }
.section-heading p:last-child { color: var(--muted); margin: 0; }
.status-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 74px; border-radius: 999px; padding: 5px 10px; font-size: 10px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.status-pill.pass { color: #0b7347; background: var(--green-soft); }
.status-pill.fail { color: #a12d38; background: var(--red-soft); }
.status-pill.running { color: #8b5b00; background: var(--amber-soft); }
.status-pill.neutral { color: #617086; background: #edf1f6; }

.exchange-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.exchange-card { border: 1px solid var(--line); border-radius: 12px; padding: 20px; background: #fbfcfe; }
.exchange-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.exchange-logo { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: var(--blue); font-weight: 900; letter-spacing: -.03em; }
.exchange-logo.dark { background: var(--navy-2); }
.exchange-card > p { color: var(--muted); min-height: 44px; }
.bid-meta { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px 16px; margin: 15px 0 0; }
.bid-meta div { border-top: 1px solid #e7ebf1; padding-top: 8px; overflow: hidden; }
.bid-meta dt { color: #8a96a7; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.bid-meta dd { margin: 2px 0 0; font-weight: 700; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }

.table-wrap { border-top: 1px solid var(--line); padding-top: 21px; overflow-x: auto; }
.table-title { display: flex; align-items: baseline; justify-content: space-between; }
.table-title h3 { font-size: 15px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th { color: #7d8a9b; text-align: left; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; padding: 11px 10px; border-bottom: 1px solid var(--line); }
td { padding: 13px 10px; border-bottom: 1px solid #edf0f4; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.table-message { color: var(--muted); max-width: 360px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.empty-cell { text-align: center; color: var(--muted); padding: 32px; }

.empty-state { border: 1px dashed #bdc9d8; background: #f9fbfe; border-radius: 12px; text-align: center; padding: 36px 20px; }
.empty-icon { margin: 0 auto 12px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--blue); background: var(--blue-soft); font-size: 23px; }
.empty-state p { color: var(--muted); max-width: 620px; margin: 0 auto 22px; }
.placeholder-row { display: inline-grid; grid-template-columns: auto auto auto auto auto auto; gap: 9px 18px; align-items: center; padding: 10px 18px; border-radius: 9px; background: #fff; border: 1px solid var(--line); color: var(--muted); }
.placeholder-row strong { color: var(--ink); }

.logs-block pre { margin: 0; max-height: 390px; overflow: auto; padding: 20px; border-radius: 10px; color: #cbd8e7; background: #07182d; font: 12px/1.65 "Cascadia Code", Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
footer { display: flex; justify-content: space-between; color: #8793a4; font-size: 11px; padding: 10px 4px 2px; }

dialog { width: min(460px, calc(100vw - 32px)); border: 0; border-radius: 15px; padding: 0; box-shadow: 0 24px 80px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(2,13,27,.68); backdrop-filter: blur(3px); }
dialog form { padding: 28px; }
.dialog-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: var(--blue); margin-bottom: 17px; }
dialog h2 { font-size: 22px; }
dialog p { color: var(--muted); }
dialog label { display: block; font-size: 12px; margin: 20px 0 7px; }
dialog input { width: 100%; padding: 11px 12px; border: 1px solid #bdc7d5; border-radius: 8px; outline: none; }
dialog input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.13); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 1050px) { .metric-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .sidebar { position: static; width: 100%; padding: 16px; flex-direction: row; align-items: center; overflow-x: auto; }
  .brand { padding: 0 10px 0 0; }
  .brand small, .sidebar-foot { display: none; }
  nav { display: flex; }
  .nav-link { white-space: nowrap; }
  main { margin-left: 0; padding: 0 18px 24px; }
  .topbar { height: 80px; }
  .topbar .eyebrow { display: none; }
  .hero { align-items: flex-start; flex-direction: column; }
  .metric-grid, .exchange-grid { grid-template-columns: 1fr; }
  .placeholder-row { grid-template-columns: auto auto; }
  footer { flex-direction: column; gap: 3px; }
}
@media (max-width: 440px) {
  .metric-grid { grid-template-columns: 1fr; }
  .block { padding: 20px 16px; }
  .section-heading { flex-direction: column; }
  #lastUpdated { display: none; }
}
