:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --muted-2: #98a2b3;
  --line: #e4e7ec;
  --line-2: #eef1f6;
  --brand: #3b5bdb;
  --brand-2: #5c7cfa;
  --brand-soft: #eef2ff;
  --green: #12b76a;
  --green-soft: #e8f8f0;
  --orange: #f79009;
  --orange-soft: #fff6e6;
  --red: #f04438;
  --red-soft: #fef0ef;
  --purple: #7a5af8;
  --sidebar: #0e1628;
  --sidebar-2: #16223a;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -12px rgba(16, 24, 40, .12);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font-family: inherit; font-size: 13px; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.app { min-height: 100vh; }

/* ---------- sidebar ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 218px;
  background: linear-gradient(180deg, #0e1628 0%, #101c33 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  z-index: 20;
}

.brand { display: flex; gap: 11px; align-items: center; padding: 0 8px 24px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, #5c7cfa, #3b5bdb);
  display: grid; place-items: center;
  font-weight: 700; font-size: 17px;
  box-shadow: 0 6px 16px rgba(59, 91, 219, .45);
}
.brand-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand-text strong { font-size: 13px; letter-spacing: .3px; line-height: 1.35; }
.brand-text span { font-size: 7.5px; letter-spacing: 1.1px; color: #7e8aa3; }
.brand-text .brand-version { color: #8da2fb; letter-spacing: .9px; font-weight: 600; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 11px 12px;
  border: 0; border-radius: 10px;
  background: transparent; color: #aab4c8;
  font-size: 13px; text-align: left;
  transition: .16s ease;
}
.nav-item svg { width: 17px; height: 17px; fill: currentColor; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(92,124,250,.22), rgba(92,124,250,.06));
  color: #fff;
  box-shadow: inset 2px 0 0 #5c7cfa;
}
.nav-item.active svg { fill: #8da2fb; opacity: 1; }

.side-foot { margin-top: auto; padding: 0 4px; }
.sync-mini {
  display: flex; gap: 10px; align-items: flex-start;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 11px; padding: 10px 11px;
}
.sync-mini .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); margin-top: 5px; flex: 0 0 auto;
  box-shadow: 0 0 0 4px rgba(18,183,106,.12);
}
.sync-mini .dot.warn { background: var(--orange); box-shadow: 0 0 0 4px rgba(247,144,9,.14); }
.sync-mini .dot.err { background: var(--red); box-shadow: 0 0 0 4px rgba(240,68,56,.14); }
.sync-mini strong { display: block; font-size: 11px; color: #d5dbe8; font-weight: 500; }
.sync-mini small { display: block; font-size: 10px; color: #7e8aa3; margin-top: 3px; line-height: 1.4; }
.version { margin-top: 12px; font-size: 9px; color: #58647c; text-align: center; letter-spacing: .4px; }

/* ---------- main ---------- */
.main { margin-left: 218px; padding: 0 26px 40px; min-height: 100vh; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 22px 0 16px;
}
.title-wrap h1 { margin: 0; font-size: 21px; letter-spacing: .2px; font-weight: 700; }
.title-wrap p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }

.top-actions { display: flex; align-items: center; gap: 9px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff;
  display: grid; place-items: center; color: var(--muted);
  transition: .15s ease;
}
.icon-btn:hover { color: var(--brand); border-color: #c7d2fe; background: #f8faff; }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 8px 14px; border-radius: 9px; font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 7px;
  transition: .15s ease;
}
.btn:hover { border-color: #c7d2fe; color: var(--brand); background: #f8faff; }
.btn.primary {
  background: linear-gradient(135deg, #4c6ef5, #3b5bdb);
  border-color: #3b5bdb; color: #fff;
  box-shadow: 0 5px 12px -4px rgba(59,91,219,.55);
}
.btn.primary:hover { filter: brightness(1.05); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: #fff; border-color: var(--line); }
.btn.danger { color: var(--red); border-color: #fecdca; background: #fff; }
.btn.danger:hover { background: var(--red-soft); }
.btn.small { padding: 5px 10px; font-size: 11px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.export-wrap { position: relative; }
.export-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 6px);
  width: 178px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 12px 30px -8px rgba(16,24,40,.18);
  padding: 5px; z-index: 30;
}
.export-menu.open { display: block; }
.export-menu button {
  display: block; width: 100%; text-align: left;
  border: 0; background: transparent; padding: 9px 10px;
  border-radius: 7px; color: var(--ink-2); font-size: 12px;
}
.export-menu button:hover { background: var(--brand-soft); color: var(--brand); }

/* ---------- filters ---------- */
.filterbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 14px;
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.filterbar.hidden { display: none; }
.filter-group { display: flex; align-items: center; gap: 7px; }
.filter-group label { color: var(--muted); font-size: 11px; white-space: nowrap; }
.filter-group select, .filter-group input[type=date] {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 6px 8px; border-radius: 7px; font-size: 12px; outline: none;
}
.filter-group select:focus, .filter-group input:focus { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(92,124,250,.12); }
.filter-group .dash { color: var(--muted-2); }
.period-dates { display: none; align-items: center; gap: 5px; }
.period-dates.visible { display: inline-flex; }
.period-past-hint {
  display: inline-flex; align-items: center; padding: 2px 6px;
  border-radius: 99px; background: var(--orange-soft); color: #b54708;
  font-size: 9.5px; font-weight: 600; white-space: nowrap;
}
.period-past-hint[hidden] { display: none; }
.filter-spacer { flex: 1; }
.snapshot-tag { font-size: 10px; color: var(--muted-2); white-space: nowrap; }
.snapshot-tag b { color: var(--brand); font-weight: 500; }

/* ---------- multi-select ---------- */
.multi-select { position: relative; min-width: 0; }
.multi-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 7px;
  min-width: 122px; max-width: 178px; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: 7px; background: #fff;
  color: var(--ink-2); font-size: 11.5px; line-height: 1.35; text-align: left;
  transition: .15s ease;
}
.multi-btn:hover { border-color: #c7d2fe; background: #f8faff; }
.multi-select.open .multi-btn { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(92,124,250,.12); }
.multi-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.multi-caret { color: var(--muted-2); font-size: 9px; flex: 0 0 auto; }
.multi-menu {
  display: none; position: absolute; left: 0; top: calc(100% + 5px);
  width: 232px; max-width: 82vw; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 14px 34px -10px rgba(16,24,40,.28);
  z-index: 80; overflow: hidden;
}
.multi-select.open .multi-menu { display: block; }
.multi-menu-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-bottom: 1px solid var(--line-2);
  color: var(--muted); font-size: 10px;
}
.multi-menu-head button { border: 0; background: transparent; color: var(--brand); font-size: 10px; padding: 0; }
.multi-options { max-height: 286px; overflow: auto; padding: 4px; }
.multi-options label {
  display: flex; align-items: flex-start; gap: 7px; padding: 6px 7px;
  border-radius: 6px; color: var(--ink-2); font-size: 11px; line-height: 1.45; cursor: pointer;
}
.multi-options label:hover { background: #f5f7ff; }
.multi-options input { margin: 1px 0 0; accent-color: var(--brand); flex: 0 0 auto; }
.multi-options span { overflow-wrap: anywhere; }
.multi-select.compact .multi-btn { min-width: 104px; max-width: 158px; padding: 5px 8px; font-size: 10.5px; }
.multi-select.compact .multi-menu { width: 224px; }
.multi-empty { padding: 10px; color: var(--muted-2); font-size: 10.5px; }

/* ---------- table tools / sorting ---------- */
.card.table-card { overflow: visible; }
.table-tools {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 2px 0 10px;
}
.table-search {
  width: 220px; max-width: 100%; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: 7px; outline: none;
  font-size: 11px; color: var(--ink-2); background: #fff;
}
.table-search:focus { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(92,124,250,.12); }
.table-multis, .inline-multis, .chip-filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.table-count { color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.table-tools .spacer { flex: 1; }
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--brand); background: #f3f6ff; }
table.data th.sortable::after {
  content: "↕"; display: inline-block; margin-left: 4px;
  color: var(--muted-2); font-size: 8px; opacity: .7;
}
table.data th[data-order="asc"]::after { content: "↑"; color: var(--brand); opacity: 1; }
table.data th[data-order="desc"]::after { content: "↓"; color: var(--brand); opacity: 1; }
table.data th.num.sortable::after { margin-left: 3px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--brand); background: #f3f6ff; }
th.sortable::after {
  content: "↕"; display: inline-block; margin-left: 3px;
  color: var(--muted-2); font-size: 8px; opacity: .7;
}
th[data-order="asc"]::after { content: "↑"; color: var(--brand); opacity: 1; }
th[data-order="desc"]::after { content: "↓"; color: var(--brand); opacity: 1; }
.col-filter-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; margin-left: 3px; padding: 0;
  border: 0; border-radius: 4px; background: transparent;
  color: #98a2b3; vertical-align: middle; line-height: 1;
}
.col-filter-btn svg { width: 10px; height: 10px; fill: currentColor; }
.col-filter-btn:hover { background: #e8edff; color: var(--brand); }
.col-filter-btn.active { background: var(--brand); color: #fff; }
.col-filter-pop {
  position: fixed; z-index: 180; background: #fff; border: 1px solid #d9e0ee;
  border-radius: 10px; box-shadow: 0 18px 44px -12px rgba(16,24,40,.32);
  padding: 8px; font-size: 11px; color: var(--ink-2);
}
.col-filter-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 3px 7px; }
.col-filter-head strong { font-size: 11px; font-weight: 600; color: var(--ink); }
.col-filter-close { border: 0; background: transparent; color: var(--muted); font-size: 17px; line-height: 1; padding: 0 2px; }
.col-filter-search {
  width: 100%; padding: 5px 7px; margin-bottom: 6px;
  border: 1px solid var(--line); border-radius: 6px; outline: none; font-size: 10.5px;
}
.col-filter-search:focus { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(92,124,250,.12); }
.col-filter-all, .col-filter-option {
  display: flex; align-items: flex-start; gap: 7px; padding: 5px 6px;
  border-radius: 5px; cursor: pointer; line-height: 1.45;
}
.col-filter-all { border-bottom: 1px solid var(--line-2); margin-bottom: 2px; font-weight: 600; }
.col-filter-all:hover, .col-filter-option:hover { background: #f5f7ff; }
.col-filter-option span { overflow-wrap: anywhere; }
.col-filter-all input, .col-filter-option input { margin: 1px 0 0; accent-color: var(--brand); flex: 0 0 auto; }
.col-filter-options { max-height: 248px; overflow: auto; padding: 0 1px; }
.col-filter-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 3px 1px; border-top: 1px solid var(--line-2); margin-top: 4px; }
.col-filter-tip { color: var(--muted-2); font-size: 9px; line-height: 1.35; }
.col-filter-foot .btn { padding: 4px 8px; font-size: 10px; }
.chip-filter { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.chip-filter > span { color: var(--muted-2); font-size: 9.5px; margin-right: 1px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 99px; padding: 2px 7px; font-size: 9.5px; line-height: 1.6;
}
.chip:hover { border-color: #c7d2fe; color: var(--brand); }
.chip.active { border-color: #c7d2fe; background: var(--brand-soft); color: var(--brand); font-weight: 600; }

/* ---------- layout ---------- */
.content { min-height: 400px; }
.loading {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 80px 0; color: var(--muted); font-size: 12px;
}
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid #dbe2f0; border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid + .grid { margin-top: 14px; }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 16px 18px 0;
}
.card-title { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .2px; }
.card-sub { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.card-body { padding: 10px 14px 14px; }
.card-tools { display: flex; gap: 6px; align-items: center; }

.chart { width: 100%; height: 300px; }
.chart-lg { height: 360px; }
.chart-sm { height: 250px; }
.mini-select {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 5px 7px; border-radius: 7px; font-size: 10.5px; outline: none;
}
.mini-select:focus { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(92,124,250,.12); }
.mini-label { color: var(--muted-2); font-size: 9.5px; white-space: nowrap; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi-card {
  position: relative; overflow: hidden;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 15px; box-shadow: var(--shadow);
}
.kpi-card::after {
  content: ""; position: absolute; right: -22px; top: -22px;
  width: 86px; height: 86px; border-radius: 50%;
  background: var(--brand-soft); opacity: .65;
}
.kpi-card.green::after { background: var(--green-soft); }
.kpi-card.orange::after { background: var(--orange-soft); }
.kpi-card.purple::after { background: #f1edff; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; }
.kpi-label { color: var(--muted); font-size: 11px; }
.kpi-icon {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center;
}
.kpi-icon svg { width: 16px; height: 16px; fill: currentColor; }
.kpi-card.green .kpi-icon { background: var(--green-soft); color: var(--green); }
.kpi-card.orange .kpi-icon { background: var(--orange-soft); color: var(--orange); }
.kpi-card.purple .kpi-icon { background: #f1edff; color: var(--purple); }
.kpi-value {
  margin: 12px 0 2px; font-size: 30px; line-height: 1.1;
  font-weight: 700; letter-spacing: -.5px; position: relative; z-index: 1;
}
.kpi-value small { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.kpi-sub { color: var(--muted); font-size: 10.5px; position: relative; z-index: 1; }
.kpi-sub b { color: var(--ink-2); font-weight: 600; }

/* ---------- capacity strip ---------- */
.cap-panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 15px 18px; margin-bottom: 14px;
}
.cap-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cap-panel-head h3 { margin: 0; font-size: 13px; }
.cap-panel-head span { color: var(--muted); font-size: 10.5px; }
.cap-rows { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.cap-row { min-width: 0; }
.cap-row-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.cap-row-top strong { font-size: 11.5px; font-weight: 600; }
.cap-row-top span { font-size: 10px; color: var(--muted); }
.cap-row-top b { font-size: 12px; font-weight: 600; }
.bar { height: 7px; border-radius: 99px; background: #eef1f6; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #5c7cfa, #3b5bdb); transition: width .5s ease; }
.bar-fill.ok { background: linear-gradient(90deg, #32d583, #12b76a); }
.bar-fill.warn { background: linear-gradient(90deg, #fdb022, #f79009); }
.bar-fill.danger { background: linear-gradient(90deg, #f97066, #f04438); }
.cap-row-foot { display: flex; justify-content: space-between; margin-top: 5px; font-size: 9.5px; color: var(--muted-2); }
.cap-hint { font-size: 10.5px; color: var(--orange); margin-top: 10px; }

/* ---------- chart extras ---------- */
.legend-note { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 10px; padding: 0 18px 6px; }
.legend-note i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 4px; vertical-align: -1px; }
.legend-note .line { width: 14px; height: 2px; border-radius: 2px; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; max-height: 520px; border-radius: 10px; }
table.data { width: 100%; border-collapse: collapse; font-size: 11.5px; }
table.data thead th {
  position: sticky; top: 0; z-index: 2;
  background: #f8f9fc; color: var(--muted); font-weight: 500;
  text-align: left; padding: 9px 10px; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.data tbody td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); color: var(--ink-2); vertical-align: middle; }
table.data tbody tr:hover { background: #fafbff; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .strong { color: var(--ink); font-weight: 600; }
table.data .muted { color: var(--muted); }
table.data .nowrap { white-space: nowrap; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 99px;
  font-size: 9.5px; line-height: 1.6; white-space: nowrap;
  background: #f2f4f7; color: var(--muted);
}
.badge.blue { background: var(--brand-soft); color: var(--brand); }
.badge.green { background: var(--green-soft); color: #087443; }
.badge.orange { background: var(--orange-soft); color: #b54708; }
.badge.red { background: var(--red-soft); color: #b42318; }
.badge.purple { background: #f1edff; color: #5b3fd6; }
.badge.dot::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 46px 20px; text-align: center; color: var(--muted);
}
.empty svg { width: 40px; height: 40px; fill: #cfd6e4; margin-bottom: 10px; }
.empty strong { color: var(--ink-2); font-size: 12px; font-weight: 500; margin-bottom: 4px; }
.empty p { margin: 0; font-size: 11px; max-width: 360px; line-height: 1.7; }
.empty .btn { margin-top: 14px; }

/* ---------- capacity page ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.seg { display: inline-flex; background: #eef1f6; border-radius: 9px; padding: 3px; }
.seg button {
  border: 0; background: transparent; color: var(--muted);
  padding: 6px 13px; border-radius: 7px; font-size: 11.5px;
}
.seg button.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(16,24,40,.1); font-weight: 600; }
.toolbar .spacer { flex: 1; }
.sim-badge { font-size: 10px; color: var(--orange); background: var(--orange-soft); padding: 4px 8px; border-radius: 6px; }

.baseline-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.baseline-table th {
  text-align: left; color: var(--muted); font-weight: 500; font-size: 10.5px;
  padding: 8px 8px; border-bottom: 1px solid var(--line); background: #f8f9fc;
}
.baseline-table td { padding: 7px 8px; border-bottom: 1px solid var(--line-2); }
.baseline-table input {
  width: 78px; padding: 5px 7px; border: 1px solid var(--line);
  border-radius: 6px; text-align: right; font-size: 11px; color: var(--ink-2);
  background: #fff; outline: none;
}
.baseline-table input:focus { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(92,124,250,.12); }
.baseline-table input.changed { border-color: #fdb022; background: #fffcf5; }
.baseline-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.baseline-table .ok { color: var(--green); }
.baseline-table .danger { color: var(--red); }
.baseline-table .muted { color: var(--muted-2); }

/* ---------- projects ---------- */
.filters-inline { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filters-inline input[type=search] {
  width: 240px; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: 8px; outline: none; font-size: 11.5px;
}
.filters-inline input[type=search]:focus { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(92,124,250,.12); }
.filters-inline .count { color: var(--muted); font-size: 11px; }
.filters-inline .spacer { flex: 1; }
.table-toolbar { align-items: flex-start; }
.table-toolbar .table-multis { padding-top: 1px; }
.attach-card .card-body { padding-top: 8px; }
.attach-summary {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 9px;
  background: #fbfcff; margin-bottom: 8px;
}
.attach-summary .grow { flex: 1; min-width: 120px; }
.attach-summary strong { font-size: 11px; font-weight: 500; color: var(--ink-2); }
.attach-summary small { display: block; color: var(--muted-2); font-size: 9.5px; margin-top: 1px; }
.attachment-panel[hidden] { display: none; }
.attachment-list.compact {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 7px; margin-bottom: 8px;
}
.attachment-item.compact { padding: 6px 8px; gap: 7px; background: #fff; }
.attachment-item.compact .ic { width: 24px; height: 24px; border-radius: 6px; font-size: 8.5px; }
.attachment-item.compact .meta strong { font-size: 10px; }
.attachment-item.compact .meta small { font-size: 9px; margin-top: 1px; }
.attachment-item.compact .attachment-actions { gap: 4px; }
.attachment-item.compact .btn.small { padding: 3px 6px; font-size: 9.5px; }
.upload-details {
  border: 1px dashed #c7d2e3; border-radius: 9px; background: #fbfcff;
  padding: 0 10px; margin-top: 6px;
}
.upload-details > summary {
  cursor: pointer; color: var(--muted); font-size: 10.5px; padding: 8px 0;
  list-style: none;
}
.upload-details > summary::-webkit-details-marker { display: none; }
.upload-details > summary::before { content: "＋"; color: var(--brand); margin-right: 6px; }
.upload-details[open] > summary::before { content: "－"; }
.upload-details .upload-zone { border: 0; background: transparent; padding: 2px 0 10px; }
.upload-details .upload-zone p { margin-bottom: 8px; }
.detail-toolbar {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin: 0 0 6px;
}
.detail-toolbar .table-search { width: 160px; padding: 4px 7px; font-size: 10px; }
.detail-toolbar .table-count { font-size: 9.5px; }
.detail-toolbar .chip-filter > span { font-size: 9px; }
.detail-toolbar .chip { font-size: 9px; padding: 1px 6px; }
.detail-table th.sortable { cursor: pointer; user-select: none; }
.detail-table th.sortable:hover { color: var(--brand); }
.detail-table th.sortable::after {
  content: "↕"; display: inline-block; margin-left: 3px;
  color: var(--muted-2); font-size: 7px; opacity: .7;
}
.detail-table th[data-order="asc"]::after { content: "↑"; color: var(--brand); opacity: 1; }
.detail-table th[data-order="desc"]::after { content: "↓"; color: var(--brand); opacity: 1; }

/* ---------- standards ---------- */
.upload-zone {
  border: 1px dashed #b9c3d6; border-radius: 12px;
  background: #fbfcff; padding: 22px; text-align: center;
  transition: .15s ease;
}
.upload-zone:hover { border-color: #93a4c8; background: #f8faff; }
.upload-zone strong { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 4px; }
.upload-zone p { margin: 0 0 12px; color: var(--muted); font-size: 10.5px; }
.attachment-list { display: flex; flex-direction: column; gap: 8px; }
.attachment-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 9px;
  background: #fbfcff;
}
.attachment-item .ic {
  width: 30px; height: 30px; border-radius: 8px; background: #e8f8f0;
  color: #087443; display: grid; place-items: center; flex: 0 0 auto;
  font-size: 10px; font-weight: 700;
}
.attachment-item .meta { min-width: 0; flex: 1; }
.attachment-item .meta strong { display: block; font-size: 11px; font-weight: 500; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-item .meta small { display: block; color: var(--muted-2); font-size: 9.5px; margin-top: 2px; }
.stock-input { width: 68px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; text-align: right; font-size: 10.5px; }
.stock-input:focus { border-color: #a5b4fc; outline: none; }

.cap-config-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; max-width: 760px; }
.drive-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line-2);
  background: #fbfcff; margin-bottom: 10px;
}
.drive-banner.ok { border-color: #b9ead2; background: #f3fcf7; }
.drive-banner.warn { border-color: #f6d6a8; background: #fffaf2; }
.drive-banner .drive-icon {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--green-soft); color: #087443;
}
.drive-banner.warn .drive-icon { background: var(--orange-soft); color: #b54708; }
.drive-banner .grow { flex: 1; min-width: 0; }
.drive-banner strong { display: block; font-size: 11.5px; color: var(--ink-2); }
.drive-banner small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; line-height: 1.55; }
.filter-summary {
  padding: 8px 10px; margin-bottom: 10px; border-radius: 8px;
  background: var(--soft); color: var(--muted); font-size: 10.5px; line-height: 1.6;
}
.attachment-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.std-table-wrap { max-height: 640px; }
.std-table { min-width: 1280px; }
.std-table th { font-size: 10px; }
.std-table td { font-size: 10.5px; }
.std-table .stock-input { width: 60px; }
.std-table tr.detail-row td {
  padding: 0; background: #f8faff; border-bottom: 1px solid var(--line);
}
.std-table tr.detail-row:hover { background: transparent; }
.std-detail-wrap { padding: 12px 14px 14px 28px; }
.std-detail-head { font-size: 10.5px; color: var(--muted); margin-bottom: 7px; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.detail-table th {
  text-align: left; padding: 5px 7px; color: var(--muted-2); font-weight: 500;
  border-bottom: 1px solid var(--line); background: #f2f5fc;
}
.detail-table td { padding: 5px 7px; border-bottom: 1px solid #edf1f8; color: var(--ink-2); vertical-align: top; }
.detail-table tr:last-child td { border-bottom: 0; }
.detail-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.detail-table .nowrap { white-space: nowrap; }
.detail-table .strong { font-weight: 600; color: var(--ink); }
.detail-table .muted { color: var(--muted); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
@media (max-width: 860px) {
  .cap-config-grid { grid-template-columns: 1fr; }
  .attachment-item { align-items: flex-start; flex-wrap: wrap; }
  .attachment-actions { justify-content: flex-start; width: 100%; }
}

/* ---------- data page ---------- */
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.sync-hero { display: flex; gap: 16px; align-items: center; padding: 4px 2px 14px; }
.sync-hero .ring {
  width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center; flex: 0 0 auto;
  background: var(--green-soft); color: var(--green);
}
.sync-hero .ring.warn { background: var(--orange-soft); color: var(--orange); }
.sync-hero .ring.err { background: var(--red-soft); color: var(--red); }
.sync-hero .ring svg { width: 24px; height: 24px; fill: currentColor; }
.sync-hero h3 { margin: 0 0 3px; font-size: 14px; }
.sync-hero p { margin: 0; color: var(--muted); font-size: 11px; }
.sync-hero .actions { margin-left: auto; display: flex; gap: 8px; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 7px 12px; font-size: 11px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink-2); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { color: var(--muted); font-size: 10.5px; }
.field input, .field select {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px;
  font-size: 12px; outline: none; background: #fff;
}
.field input:focus, .field select:focus { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(92,124,250,.12); }
.field .hint { color: var(--muted-2); font-size: 9.5px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.quality-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow: auto; }
.quality-item { display: flex; gap: 9px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; background: #fbfcff; border: 1px solid var(--line-2); }
.quality-item .tag { flex: 0 0 auto; margin-top: 1px; }
.quality-item .txt { font-size: 10.5px; color: var(--ink-2); line-height: 1.55; }
.quality-item .txt small { display: block; color: var(--muted-2); font-size: 9.5px; margin-top: 2px; }

.snapshot-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; }
.snapshot-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line-2); }
.snapshot-item.current { background: var(--brand-soft); border-color: #c7d2fe; }
.snapshot-item .meta { flex: 1; }
.snapshot-item strong { display: block; font-size: 10.5px; font-weight: 500; }
.snapshot-item small { color: var(--muted-2); font-size: 9.5px; }

/* ---------- modal ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(10, 18, 35, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100; backdrop-filter: blur(2px);
}
.modal {
  width: min(560px, 100%); max-height: 86vh; overflow: auto;
  background: #fff; border-radius: 16px;
  box-shadow: 0 24px 60px -12px rgba(10,18,35,.4);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(8px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 0; }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-head button { border: 0; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; padding: 4px; }
.modal-body { padding: 16px 20px 20px; }
.modal-body p { color: var(--muted); font-size: 11.5px; line-height: 1.8; margin: 0 0 12px; }
.modal-body .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal .detail-grid { display: grid; grid-template-columns: 92px 1fr; gap: 8px 14px; font-size: 11.5px; }
.modal .detail-grid dt { color: var(--muted); }
.modal .detail-grid dd { margin: 0; color: var(--ink-2); }
.modal .step { display: flex; gap: 10px; margin-bottom: 10px; }
.modal .step b { width: 20px; height: 20px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 10px; flex: 0 0 auto; }
.modal .step span { font-size: 11.5px; color: var(--ink-2); line-height: 1.6; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px);
  background: #101828; color: #fff; padding: 10px 16px;
  border-radius: 9px; font-size: 12px; opacity: 0; pointer-events: none;
  transition: .22s ease; z-index: 200; max-width: 80vw;
  box-shadow: 0 10px 30px -6px rgba(0,0,0,.35);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #b42318; }
.toast.ok { background: #087443; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2, .span3 { grid-column: span 2; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { width: 64px; padding: 18px 8px; }
  .brand { padding: 0 0 18px; justify-content: center; }
  .brand-text, .nav-item span, .side-foot { display: none; }
  .nav-item { justify-content: center; padding: 12px 0; }
  .main { margin-left: 64px; padding: 0 14px 30px; }
  .topbar { padding: 16px 0 12px; }
  .title-wrap h1 { font-size: 17px; }
  .title-wrap p { display: none; }
  .filterbar { padding: 10px; gap: 8px; }
  .filter-group label { display: none; }
  .filter-spacer, .snapshot-tag { display: none; }
  .grid { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: span 1; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .cap-rows { grid-template-columns: 1fr; gap: 14px; }
  .chart { height: 260px; }
  .export-menu { right: 0; }
  .attachment-list.compact { grid-template-columns: 1fr; }
  .multi-btn { max-width: 150px; }
}
