:root {
  --paper: #eef1f5;
  --white: #fff;
  --ink: #1d1d1b;
  --muted: #72736f;
  --line: #d8dee6;
  --soft: #ecece7;
  --orange: #f15b35;
  --accent: #ff4f00;
  --accent-soft: #fff4ef;
  --green: #26815c;
  --sidebar: #162033;
  --yellow: #ffe600;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 14px;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.app-shell {
  height: 100%;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  overflow: hidden;
}
.sidebar {
  background: var(--sidebar);
  color: #f9f9f5;
  padding: 28px 17px 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 24px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--yellow); color: #111;
  font-weight: 800; font-size: 12px; letter-spacing: -.04em;
  flex-shrink: 0;
}
.brand strong { display: block; font-size: 15px; line-height: 1.25; }
.eyebrow { margin: 0; color: #99a6b9; font-size: 10px; letter-spacing: .13em; text-transform: uppercase; }
.nav { padding-top: 12px; }
.nav-label { margin: 0 9px 8px; color: #8491a5; font-size: 10px; letter-spacing: .13em; text-transform: uppercase; }
.nav-item {
  width: 100%; border: 0; background: transparent; color: #aeb9c9;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 10px; margin: 2px 0; text-align: left; font-size: 13px;
}
.nav-item:hover { color: #fff; }
.nav-item.active { background: var(--orange); color: #fff; }
.nav-item:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
.nav-number { width: 23px; color: #777a73; font-size: 10px; font-variant-numeric: tabular-nums; }
.nav-item.active .nav-number { color: #fff; }
.sidebar-foot { margin-top: auto; padding: 16px 9px 0; border-top: 1px solid #354258; }
.security-note { font-size: 11px; color: #d9e0ea; }
.sidebar-foot > p { font-size: 11px; line-height: 1.5; color: #8f9caf; margin: 9px 0 0; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: #91948d; vertical-align: 1px; margin-right: 6px; }
.status-dot.green { background: #52bb87; }

.main-content { min-width: 0; min-height: 0; height: 100%; display: flex; flex-direction: column; overflow: hidden; background: var(--paper); }
.topbar {
  height: 88px; padding: 20px 46px; display: flex; justify-content: space-between; align-items: center;
  background: var(--white); border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.breadcrumb { margin: 0 0 8px; color: #8993a1; font-size: 11px; }
.topbar h1 { margin: 0; font-size: 24px; line-height: 1.05; font-weight: 700; letter-spacing: -.02em; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.environment { color: var(--muted); font-size: 11px; }
.outline-button, .primary-button {
  height: 38px; border: 1px solid var(--line); background: var(--white); color: var(--ink);
  padding: 0 15px; font-weight: 600;
}
.outline-button:hover { border-color: var(--orange); color: var(--orange); }
.primary-button { border-color: var(--orange); background: var(--orange); color: #fff; }
.primary-button:hover { background: #d94b1f; }
.outline-button:focus-visible, .primary-button:focus-visible, .chip:focus-visible, .nav-item:focus-visible {
  outline: 2px solid var(--orange); outline-offset: 2px;
}

.page-body { flex: 1; min-height: 0; overflow: auto; padding: 0 0 48px; }
.page-lead { margin: 0 42px 18px; max-width: 820px; color: var(--muted); line-height: 1.55; }
#view-root { padding: 0 42px; }
.echotik-bind {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 16px 42px; margin-bottom: 18px;
  border-bottom: 1px solid var(--line); background: var(--accent-soft);
}
.echotik-bind p { margin: 0 0 6px; }
.token-guide-hint { color: var(--muted); font-size: 12px; line-height: 1.5; }
.token-guide-hint a { color: var(--orange); }
.echotik-fields { display: flex; align-items: end; gap: 10px; flex: 0 0 auto; flex-wrap: wrap; }
.echotik-fields label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.echotik-fields input { min-width: 160px; height: 36px; border: 1px solid var(--line); padding: 0 10px; background: #fff; }
.view-pad { padding: 0 42px; }
.thumb { width: 40px; height: 40px; object-fit: cover; background: #eee; border-radius: 6px; flex: 0 0 40px; }
.title-cell { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.title-cell span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.loading { padding: 36px; text-align: center; color: var(--muted); background: #fff; border: 1px dashed var(--line); }

.admin-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.admin-stats article { background: #fff; border: 1px solid var(--line); padding: 14px 16px; }
.admin-stats span { color: var(--muted); font-size: 11px; }
.admin-stats strong { display: block; font-size: 22px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.admin-stats small { display: block; margin-top: 6px; color: #8993a1; font-size: 11px; }

.chart-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 12px; margin-bottom: 16px; }
.chart-card, .panel-card {
  background: #fff; border: 1px solid var(--line); padding: 16px 18px;
}
.chart-card h2, .panel-card h2, .board-head h2 {
  margin: 0 0 12px; font-size: 16px;
}
.chart-box { height: 280px; position: relative; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px; }
.filters label { color: var(--muted); font-size: 11px; }
.filters input, .filters select {
  display: block; height: 38px; margin-top: 6px; border: 1px solid var(--line);
  padding: 0 10px; background: #fff; min-width: 180px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 6px 12px; color: var(--ink); min-height: 32px;
}
.chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.table-wrap { overflow: auto; background: #fff; border: 1px solid var(--line); }
table.data { width: 100%; border-collapse: collapse; min-width: 720px; }
table.data th, table.data td { padding: 11px 12px; border-bottom: 1px solid #e7ebf0; text-align: left; vertical-align: middle; }
table.data th {
  background: #f7f8fa; color: #8993a1; font-size: 11px; font-weight: 600;
  position: sticky; top: 0; white-space: nowrap;
}
table.data td { font-size: 13px; }
table.data td:last-child, table.data th:last-child { white-space: nowrap; width: 64px; }
table.data tbody tr:hover { background: #fbfbfc; }
table.data a { color: var(--orange); text-decoration: none; font-weight: 600; }
table.data a:hover { text-decoration: underline; }
.bar {
  display: block; height: 6px; background: #edf0f4; border-radius: 99px; overflow: hidden; min-width: 80px;
}
.bar > i { display: block; height: 100%; background: var(--orange); }
.muted { color: var(--muted); font-size: 12px; }
.pill {
  display: inline-block; padding: 3px 8px; font-size: 10px; font-weight: 700; letter-spacing: .04em;
  background: #f2f2ee; color: var(--muted); white-space: nowrap;
}
.pill.p0 { background: #fff4ef; color: #c2410c; }
.pill.p1 { background: #edf8f1; color: #276a4c; }
.pill.p2 { background: #eef2ff; color: #3730a3; }
.pill.go { background: #edf8f1; color: #276a4c; }
.pill.wait { background: #fff7ed; color: #9a3412; }
.pill.stop { background: #f2f2ee; color: var(--muted); }

.model-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.model-card { background: #fff; border: 1px solid var(--line); padding: 16px 18px; }
.model-card h3 { margin: 0 0 8px; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.model-card p { margin: 0 0 10px; color: var(--muted); line-height: 1.5; }
.tag { display: inline-block; margin: 0 6px 6px 0; padding: 4px 8px; background: #f7f8fa; border: 1px solid var(--line); font-size: 12px; }
.pick-list { display: grid; gap: 10px; }
.pick-item {
  background: #fff; border: 1px solid var(--line); padding: 14px 16px;
  display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 12px; align-items: start;
}
.pick-item b { display: block; margin-bottom: 4px; }
.empty { padding: 36px; text-align: center; color: var(--muted); background: #fff; border: 1px dashed var(--line); }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .topbar, .page-body { padding-left: 20px; padding-right: 20px; }
  .admin-stats, .chart-grid, .model-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  body { overflow: auto; }
  .app-shell { display: block; height: auto; overflow: visible; }
  .main-content { height: auto; overflow: visible; }
  .sidebar { height: auto; }
  .nav { display: flex; overflow: auto; gap: 4px; padding-top: 8px; }
  .nav-label { display: none; }
  .nav-item { min-width: max-content; }
  .nav-number { display: none; }
  .sidebar-foot { display: none; }
  .topbar { height: auto; }
  .top-actions .environment { display: none; }
  .filters input, .filters select { min-width: 0; width: 100%; }
  .pick-item { grid-template-columns: 1fr; }
}
