/* Bloom Checkout — dashboard chỉ-xem (BC-DASHBOARD-1110). Không có style nội tuyến: CSP là style-src 'self'. */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --line: #e1e0d9;
  --axis: #c3c2b7;
  --accent: #1c5cab;
  --accent-ink: #ffffff;
  --wash: rgba(11, 11, 11, 0.04);
  --series-1: #2a78d6; /* PayPal */
  --series-2: #eb6834; /* Thẻ */
  --good: #006300;
  --good-bg: #e3f3e3;
  --warn: #7a5200;
  --warn-bg: #fdefc8;
  --bad: #a32020;
  --bad-bg: #fbe3e3;
  --info: #1c5cab;
  --info-bg: #e2edfb;
  --idle-bg: #ecebe6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --line: #2c2c2a;
    --axis: #383835;
    --accent: #6da7ec;
    --accent-ink: #0b0b0b;
    --wash: rgba(255, 255, 255, 0.05);
    --series-1: #3987e5;
    --series-2: #d95926;
    --good: #5fd35f;
    --good-bg: #12300f;
    --warn: #fab219;
    --warn-bg: #3a2c05;
    --bad: #f08a8a;
    --bad-bg: #3d1414;
    --info: #86b6ef;
    --info-bg: #10294a;
    --idle-bg: #2c2c2a;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 20px; margin: 0; line-height: 1.3; }
h2 { font-size: 15px; margin: 0 0 12px; }
.boot { padding: 48px 16px; text-align: center; color: var(--ink-2); }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; overflow-wrap: anywhere; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* Khung */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 650; font-size: 15px; white-space: nowrap; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a {
  padding: 6px 12px; border-radius: 8px;
  color: var(--ink-2); text-decoration: none; font-weight: 550;
}
.nav a:hover { background: var(--wash); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--info-bg); color: var(--info); }
.who { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13px; }
.main { max-width: 1280px; margin: 0 auto; padding: 20px; }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.stack { margin-bottom: 16px; }

/* Ô nhập + nút */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
input, select, button { font: inherit; color: inherit; }
input, select {
  width: 100%; height: 36px; padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--axis); border-radius: 8px;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, tr[tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
button {
  height: 36px; padding: 0 14px;
  border: 1px solid var(--axis); border-radius: 8px;
  background: var(--surface); font-weight: 600; cursor: pointer; white-space: nowrap;
}
button:hover { background: var(--wash); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.08); background: var(--accent); }
button.link { border: 0; background: none; padding: 0; height: auto; color: var(--accent); font-weight: 600; }
button:disabled { opacity: 0.55; cursor: default; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.filters .wide { grid-column: span 2; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.presets button { height: 32px; padding: 0 12px; font-weight: 550; }
.presets button[aria-pressed="true"] { background: var(--info-bg); border-color: transparent; color: var(--info); }

/* Bảng */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; font-weight: 650; color: var(--ink-2); white-space: nowrap; }
th.num { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover { background: var(--wash); }
.empty { padding: 28px 12px; text-align: center; color: var(--ink-2); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }

/* Nhãn trạng thái: có chữ, không chỉ dựa vào màu */
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 650; white-space: nowrap;
  background: var(--idle-bg); color: var(--ink-2);
}
.badge.paid { background: var(--good-bg); color: var(--good); }
.badge.pending { background: var(--warn-bg); color: var(--warn); }
.badge.failed { background: var(--bad-bg); color: var(--bad); }
.badge.refunded, .badge.partially_refunded { background: var(--info-bg); color: var(--info); }
.badge.on { background: var(--good-bg); color: var(--good); }

/* Ô số liệu */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.tile .label { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.tile .value { font-size: 26px; font-weight: 650; line-height: 1.25; margin-top: 2px; overflow-wrap: anywhere; }
.tile .sub { font-size: 12.5px; color: var(--ink-2); }

/* Biểu đồ cột theo ngày */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .base { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; }
.chart .s1 { fill: var(--series-1); }
.chart .s2 { fill: var(--series-2); }
.chart .hit { fill: transparent; }
.chart .hit:hover, .chart .hit.on { fill: var(--wash); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.legend .s1 { background: var(--series-1); }
.legend .s2 { background: var(--series-2); }
.tip {
  position: absolute; z-index: 2; pointer-events: none;
  min-width: 150px; padding: 8px 10px;
  background: var(--surface); border: 1px solid var(--axis); border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14); font-size: 12.5px;
}
.tip b { display: block; margin-bottom: 2px; }
.tip div { display: flex; justify-content: space-between; gap: 14px; }

/* Chi tiết giao dịch */
.kv { display: grid; grid-template-columns: minmax(130px, 200px) 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--ink-2); font-size: 13px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.back { display: inline-block; margin-bottom: 12px; text-decoration: none; font-weight: 600; }

/* Đăng nhập / thiết lập */
.auth { max-width: 420px; margin: 8vh auto 40px; padding: 0 16px; }
.auth.wide { max-width: 520px; }
.auth h1 { margin-bottom: 4px; }
.auth .card { padding: 22px; }
.field { margin-bottom: 14px; }
.auth button.primary { width: 100%; height: 40px; }
.msg { padding: 9px 12px; border-radius: 8px; margin-bottom: 14px; font-size: 13.5px; }
.msg.err { background: var(--bad-bg); color: var(--bad); }
.msg.ok { background: var(--good-bg); color: var(--good); }
.qr { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 10px 0 16px; }
.qr svg { width: 176px; height: 176px; background: #ffffff; border-radius: 8px; flex: none; }
.qr .dark { fill: #000000; }
.steps { margin: 0 0 6px; padding-left: 20px; }
.steps li { margin-bottom: 4px; }

@media (max-width: 640px) {
  .main { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .filters .wide { grid-column: auto; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dd { margin-bottom: 8px; }
}
