:root {
  --brand: #c62828;
  --brand-light: #ff7058;
  --brand-dark: #8e1c1c;
  --brand-soft: #fff1ee;
  --brand-soft-2: #ffe2dc;
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e6e8ec;
  --text: #20242b;
  --muted: #6b7280;
  --hint: #9aa1ac;
  --ok: #0f7b52;
  --shadow: 0 2px 12px rgba(30, 35, 45, .06);
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
button, input, select { font-family: inherit; font-size: inherit; }
a { color: var(--brand); text-decoration: none; }
.hidden { display: none !important; }

.app-header {
  background: linear-gradient(120deg, var(--brand-light), var(--brand) 58%, var(--brand-dark));
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.hd-logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.5);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 15px; flex: none;
}
.hd-title { font-size: 17px; font-weight: 600; letter-spacing: .5px; }
.hd-sub { font-size: 12px; opacity: .85; margin-top: 1px; }
.hd-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.hd-stat { font-size: 12px; opacity: .9; }
.view-switch {
  display: flex; background: rgba(255,255,255,.16); border-radius: 20px; padding: 3px;
  border: 1px solid rgba(255,255,255,.3);
}
.view-switch button {
  border: 0; background: transparent; color: #fff; opacity: .8;
  padding: 5px 12px; border-radius: 16px; font-size: 12px; cursor: pointer;
}
.view-switch button.on { background: #fff; color: var(--brand); opacity: 1; font-weight: 600; }

.layout { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 16px; padding: 16px 20px 28px; max-width: 1440px; margin: 0 auto; }
.sidebar { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); align-self: start; position: sticky; top: 16px; }
.sidebar h3 { margin: 4px 6px 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.region-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 9px; cursor: pointer; margin-bottom: 3px;
  border: 1px solid transparent;
}
.region-item:hover { background: var(--brand-soft); }
.region-item.on { background: var(--brand-soft); border-color: var(--brand-soft-2); color: var(--brand-dark); font-weight: 600; }
.region-item .nm { flex: 1; }
.region-item .cnt { font-size: 11px; color: var(--hint); }
.badge { font-size: 10px; padding: 1px 6px; border-radius: 8px; white-space: nowrap; }
.badge.ready { background: #e6f4ee; color: var(--ok); }
.badge.none { background: #f0f1f3; color: var(--hint); }
.side-note { margin: 12px 6px 2px; font-size: 11px; color: var(--hint); border-top: 1px solid var(--line); padding-top: 10px; line-height: 1.7; }

.main { min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card h2 .sub { font-size: 12px; font-weight: 400; color: var(--hint); margin-left: auto; }

.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 10px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 12px; color: var(--muted); }
.field input, .field select {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--text); outline: none;
}
.field input:focus, .field select:focus { border-color: var(--brand-light); }
.btn-row { display: flex; gap: 8px; }
.btn {
  height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--text); cursor: pointer; white-space: nowrap;
}
.btn.primary { background: linear-gradient(120deg, var(--brand-light), var(--brand)); color: #fff; border-color: transparent; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.small { height: 30px; padding: 0 12px; font-size: 12px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button {
  border: 0; background: transparent; padding: 8px 14px; cursor: pointer;
  color: var(--muted); border-bottom: 2px solid transparent; font-size: 13px;
}
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 5px 11px; border-radius: 16px; border: 1px solid var(--line);
  background: #fff; color: var(--muted); font-size: 12px; cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand-soft-2); font-weight: 600; }
.chip .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #d8b24a; margin-left: 5px; vertical-align: middle; }
.chip .dot.ok { background: #34a06a; }

.notice {
  background: var(--brand-soft); border: 1px solid var(--brand-soft-2); color: var(--brand-dark);
  border-radius: 8px; padding: 9px 12px; font-size: 12px; margin-bottom: 12px; line-height: 1.7;
}
.stats { font-size: 12px; color: var(--muted); margin-bottom: 10px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #fafbfc; color: var(--muted); font-weight: 500; font-size: 12px; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--brand-soft); }
td.price { text-align: right; color: var(--brand); font-weight: 600; font-variant-numeric: tabular-nums; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: #f2f3f5; color: var(--muted); }
.tag.official { background: #e8f4ee; color: var(--ok); }
.tag.internal { background: #fff2e4; color: #a35b00; }
.empty { text-align: center; color: var(--hint); padding: 30px 10px; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--muted); }

.mobile-cards { display: none; }
.mcard { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.mcard .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.mcard .nm { font-weight: 600; font-size: 14px; }
.mcard .pr { color: var(--brand); font-weight: 600; font-size: 15px; }
.mcard .meta { color: var(--muted); font-size: 12px; margin-top: 5px; }
.mcard .foot { color: var(--hint); font-size: 11px; margin-top: 6px; }

.series-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; }
.spark-bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding: 8px 4px 0; overflow-x: auto; border-bottom: 1px solid var(--line); }
.spark-bars .bar { flex: 1 0 22px; min-width: 22px; background: linear-gradient(180deg, var(--brand-light), var(--brand)); border-radius: 4px 4px 0 0; position: relative; }
.spark-bars .bar span { display: none; }
.series-hint { font-size: 11px; color: var(--hint); margin-top: 6px; }

.region-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.rcard { border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; }
.rcard:hover { border-color: var(--brand-light); }
.rcard .rn { font-weight: 600; margin-bottom: 4px; }
.rcard .rs { font-size: 12px; color: var(--muted); }
.rcard .rr { font-size: 11px; color: var(--hint); margin-top: 6px; }

.footer { font-size: 11px; color: var(--hint); text-align: center; padding: 8px 16px 24px; line-height: 1.8; }
.bottom-nav { display: none; }

body.view-h5 .layout { display: block; max-width: 480px; padding: 12px 12px 78px; }
body.view-h5 .sidebar { display: none; }
body.view-h5 .app-header { padding: 12px 14px; }
body.view-h5 .hd-title { font-size: 16px; }
body.view-h5 .hd-stat { display: none; }
body.view-h5 .h5-regions { display: block !important; }
body.view-h5 .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.view-h5 .filters .btn-row { grid-column: 1 / -1; }
body.view-h5 .btn-row .btn { flex: 1; }
body.view-h5 .table-wrap { display: none; }
body.view-h5 .mobile-cards { display: block; }
body.view-h5 .series-grid { grid-template-columns: 1fr; }
body.view-h5 .card { padding: 13px; }
body.view-h5 .bottom-nav {
  display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: #fff; border-top: 1px solid var(--line);
}
body.view-h5 .bottom-nav button {
  flex: 1; border: 0; background: transparent; padding: 10px 0 8px;
  color: var(--muted); font-size: 11px; cursor: pointer;
}
body.view-h5 .bottom-nav button.on { color: var(--brand); font-weight: 600; }
body.view-h5 .bottom-nav .ico { display: block; font-size: 16px; line-height: 1.2; }
body.view-h5 .region-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.h5-regions { display: none; margin-bottom: 12px; }

@media (max-width: 860px) {
  body.view-pc .layout { grid-template-columns: 1fr; }
  body.view-pc .sidebar { position: static; }
  body.view-pc .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.view-pc .filters .btn-row { grid-column: 1 / -1; }
}
