/* =========================================================
   BEP.ROI Pro — Design System
   ธีมพรีเมียม: glassmorphism + gradient + soft shadow
   ========================================================= */

:root {
  /* พื้นหลัง */
  --bg-0: #0b0f1a;
  --bg-1: #121829;
  --bg-grad: radial-gradient(1200px 600px at 15% -10%, #1b2748 0%, transparent 55%),
             radial-gradient(900px 500px at 110% 10%, #27194a 0%, transparent 50%),
             linear-gradient(180deg, #0b0f1a 0%, #0a0d16 100%);

  /* การ์ด / กระจก */
  --glass: rgba(255, 255, 255, 0.055);
  --glass-strong: rgba(255, 255, 255, 0.09);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-border-strong: rgba(255, 255, 255, 0.18);

  /* ตัวอักษร */
  --text: #eef2fb;
  --text-dim: #aab3cc;
  --text-faint: #727d99;

  /* แบรนด์ */
  --brand: #6ea8ff;
  --brand-2: #9b7bff;
  --brand-grad: linear-gradient(135deg, #6ea8ff 0%, #9b7bff 100%);
  --brand-glow: 0 0 0 1px rgba(110, 168, 255, 0.4), 0 8px 30px rgba(110, 168, 255, 0.25);

  /* สถานะ */
  --green: #3ddc97;
  --green-dim: #1f6b4e;
  --yellow: #ffcf5c;
  --yellow-dim: #6b5a24;
  --red: #ff6b81;
  --red-dim: #6b2834;
  --orange: #ff9f5a;

  /* เส้น / เงา */
  --line: rgba(255, 255, 255, 0.08);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 10px 40px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.45);

  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Sarabun", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg-grad) fixed;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(155, 123, 255, 0.35); }

/* สกรอลล์บาร์ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); background-clip: content-box; }

/* ============ Layout Shell ============ */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(10, 13, 22, 0.6);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px 22px;
}
.brand-logo {
  width: 42px; height: 42px;
  border-radius: 13px;
  background: var(--brand-grad);
  display: grid; place-items: center;
  font-weight: 800; font-size: 18px; color: #0b0f1a;
  box-shadow: var(--brand-glow);
  flex: none;
}
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: 0.3px; }
.brand-sub { font-size: 11px; color: var(--text-dim); letter-spacing: 1.5px; text-transform: uppercase; }

.nav-group-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.3px;
  color: var(--text-faint); padding: 16px 14px 6px; font-weight: 700;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px;
  color: var(--text-dim); cursor: pointer; font-weight: 600; font-size: 14px;
  border: 1px solid transparent;
  transition: all 0.18s ease;
  user-select: none;
}
.nav-item .ico { width: 20px; text-align: center; font-size: 16px; flex: none; }
.nav-item:hover { background: var(--glass); color: var(--text); }
.nav-item.active {
  background: var(--glass-strong);
  color: var(--text);
  border-color: var(--glass-border-strong);
  box-shadow: inset 0 0 0 1px rgba(110,168,255,0.15);
}
.nav-item.active .ico { color: var(--brand); }

.sidebar-foot { margin-top: auto; padding: 14px; font-size: 11px; color: var(--text-faint); line-height: 1.7; }

/* ---------- Main ---------- */
.main { min-width: 0; padding: 0 0 80px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 34px;
  background: rgba(11, 15, 26, 0.65);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 20px; font-weight: 800; }
.topbar .page-sub { margin: 2px 0 0; font-size: 13px; color: var(--text-dim); }

/* สลับแพลตฟอร์ม */
.seg {
  display: inline-flex; padding: 4px; gap: 4px;
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: 14px;
}
.seg button {
  border: none; background: transparent; color: var(--text-dim);
  padding: 8px 16px; border-radius: 10px; cursor: pointer;
  font-weight: 700; font-size: 13px; font-family: inherit;
  transition: all 0.16s ease;
}
.seg button.active { background: var(--brand-grad); color: #0b0f1a; box-shadow: var(--shadow-sm); }

.content { padding: 30px 34px; max-width: 1200px; }

/* ---------- Page switching ---------- */
.page { display: none; animation: fadeIn 0.35s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ Cards ============ */
.card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 22px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.card-icon {
  width: 40px; height: 40px; flex: none; border-radius: 12px;
  display: grid; place-items: center; font-size: 19px;
  background: var(--glass-strong); border: 1px solid var(--glass-border);
}
.card-title { font-size: 17px; font-weight: 800; margin: 0; }
.card-desc { font-size: 13px; color: var(--text-dim); margin: 3px 0 0; line-height: 1.6; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-cards { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 22px; align-items: start; }

/* ============ Form controls ============ */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 7px; font-weight: 600; }
.field .hint { font-size: 11.5px; color: var(--text-faint); margin-top: 5px; line-height: 1.5; }

input[type="text"], input[type="number"], select {
  width: 100%; padding: 12px 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-border);
  border-radius: 11px; color: var(--text);
  font-size: 15px; font-family: inherit;
  transition: border-color 0.16s, box-shadow 0.16s;
}
input:focus, select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(110, 168, 255, 0.15);
}
input::placeholder { color: var(--text-faint); }
select { cursor: pointer; }
option { background: var(--bg-1); }

.input-combo { display: flex; gap: 8px; }
.input-combo input { flex: 1; }
.input-combo select { width: 96px; flex: none; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border: none; border-radius: 12px; cursor: pointer;
  font-size: 14.5px; font-weight: 700; font-family: inherit;
  background: var(--brand-grad); color: #0b0f1a;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s, filter 0.16s, box-shadow 0.16s;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn-ghost {
  background: var(--glass); color: var(--text);
  border: 1px solid var(--glass-border); box-shadow: none;
}
.btn-ghost:hover { background: var(--glass-strong); filter: none; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-danger-ghost {
  background: transparent; color: var(--red);
  border: 1px solid rgba(255,107,129,0.4); box-shadow: none;
  padding: 5px 12px; font-size: 12px; border-radius: 9px;
}
.btn-danger-ghost:hover { background: var(--red); color: #fff; filter: none; }

/* ============ Hero result (BEP + ROAS) ============ */
.result-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 4px 0 20px; }
.stat {
  position: relative; overflow: hidden;
  padding: 22px; border-radius: var(--radius);
  background: var(--glass-strong); border: 1px solid var(--glass-border);
  text-align: center;
}
.stat::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(400px 120px at 50% -40%, rgba(110,168,255,0.22), transparent 70%);
  pointer-events: none;
}
.stat.accent-green::before { background: radial-gradient(400px 120px at 50% -40%, rgba(61,220,151,0.22), transparent 70%); }
.stat .stat-val { font-size: 46px; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.stat .stat-val.sm { font-size: 30px; }
.stat.accent-blue .stat-val { color: var(--brand); }
.stat.accent-green .stat-val { color: var(--green); }
.stat .stat-unit { font-size: 18px; font-weight: 700; opacity: 0.7; margin-left: 4px; }
.stat .stat-label { font-size: 12.5px; color: var(--text-dim); margin-top: 10px; }

/* ============ Gauge / Scale ============ */
.scale-wrap { margin: 26px 0 10px; }
.scale-title { font-size: 13px; font-weight: 700; color: var(--text-dim); margin-bottom: 40px; }
.scale {
  position: relative; height: 14px; border-radius: 20px;
  background: linear-gradient(90deg, #ff6b81 0%, #ffcf5c 38%, #3ddc97 72%, #22c55e 100%);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.4);
}
.scale-pin { position: absolute; top: 50%; transform: translate(-50%, -50%); transition: left 0.5s cubic-bezier(.4,1.3,.5,1); }
.scale-pin .dot {
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  border: 4px solid var(--bg-0); box-shadow: 0 0 0 2px rgba(255,255,255,0.5), var(--shadow-md);
}
.scale-pin .tag {
  position: absolute; left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-size: 11.5px; text-align: center;
}
.scale-pin.pin-bep .tag { bottom: 24px; }
.scale-pin.pin-target .tag { top: 24px; }
.scale-pin .tag .k { color: var(--text-dim); }
.scale-pin .tag .v { display: block; font-size: 15px; font-weight: 800; color: var(--text); }
.scale-ends { display: flex; justify-content: space-between; margin-top: 14px; }
.scale-ends .end { font-size: 11px; color: var(--text-faint); line-height: 1.5; }
.scale-ends .end b { color: var(--text-dim); font-size: 12.5px; }

/* ============ Zones ============ */
.zones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 10px; }
.zone { padding: 16px; border-radius: var(--radius-sm); text-align: center; border: 1px solid; }
.zone .z-label { font-size: 11.5px; color: var(--text-dim); min-height: 32px; }
.zone .z-val { font-size: 20px; font-weight: 800; margin-top: 6px; }
.zone.z-loss { background: rgba(255,107,129,0.08); border-color: rgba(255,107,129,0.3); }
.zone.z-loss .z-val { color: var(--red); }
.zone.z-even { background: rgba(255,207,92,0.08); border-color: rgba(255,207,92,0.3); }
.zone.z-even .z-val { color: var(--yellow); }
.zone.z-profit { background: rgba(61,220,151,0.08); border-color: rgba(61,220,151,0.3); }
.zone.z-profit .z-val { color: var(--green); }

/* ============ Callout / summary ============ */
.callout {
  padding: 18px 20px; border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border); background: var(--glass);
  margin: 18px 0; line-height: 1.9;
}
.callout.good { border-color: rgba(61,220,151,0.35); background: linear-gradient(135deg, rgba(61,220,151,0.1), rgba(61,220,151,0.03)); }
.callout.warn { border-color: rgba(255,207,92,0.35); background: linear-gradient(135deg, rgba(255,207,92,0.1), rgba(255,207,92,0.03)); }
.callout.bad  { border-color: rgba(255,107,129,0.35); background: linear-gradient(135deg, rgba(255,107,129,0.1), rgba(255,107,129,0.03)); }
.callout b { color: var(--yellow); font-size: 1.05em; }
.callout .big { font-size: 20px; font-weight: 800; color: #fff; }

/* ============ Tables ============ */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.table-scroll { max-height: 540px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: rgba(18, 24, 41, 0.95); backdrop-filter: blur(8px);
  color: var(--text-dim); font-weight: 700; font-size: 12px;
  padding: 12px 12px; text-align: right; white-space: nowrap;
  border-bottom: 1px solid var(--line); cursor: pointer; user-select: none;
}
thead th:first-child, tbody td:first-child { text-align: left; }
thead th.no-sort { cursor: default; }
tbody td { padding: 11px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr { transition: background 0.12s; }
tbody tr:hover td { background: rgba(255,255,255,0.03); }
tbody tr.clickable { cursor: pointer; }
td.name, th.name { text-align: left; white-space: normal; min-width: 220px; }
.cell-strong { font-weight: 800; }

.data-table { font-size: 14px; }
.data-table th, .data-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: center; }
.data-table th { color: var(--text-dim); font-weight: 700; font-size: 12.5px; }
.data-table td:first-child, .data-table th:first-child { text-align: left; }
.data-table .lead { font-weight: 700; }
.data-table .big-num { font-size: 16px; font-weight: 800; color: var(--brand); }

/* ============ Pills / badges ============ */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 20px; font-size: 12px; font-weight: 700;
  white-space: nowrap;
}
.pill-safe { background: rgba(110,168,255,0.14); color: #8fc0ff; border: 1px solid rgba(110,168,255,0.3); }
.pill-good { background: rgba(61,220,151,0.14); color: var(--green); border: 1px solid rgba(61,220,151,0.3); }
.pill-ok   { background: rgba(255,207,92,0.14); color: var(--yellow); border: 1px solid rgba(255,207,92,0.3); }
.pill-bad  { background: rgba(255,107,129,0.14); color: var(--red); border: 1px solid rgba(255,107,129,0.3); }
.badge-new { background: var(--green); color: #04150d; padding: 1px 8px; border-radius: 20px; font-size: 10.5px; font-weight: 800; margin-left: 6px; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; margin-right: 2px; }
.dot-safe { background: #8fc0ff; } .dot-good { background: var(--green); } .dot-ok { background: var(--yellow); } .dot-bad { background: var(--red); }

/* ============ Steps ============ */
.steps { margin-top: 16px; display: flex; flex-direction: column; gap: 2px; }
.step { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.step:last-child { border-bottom: none; }
.step-num {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand-grad); color: #0b0f1a; font-weight: 800; font-size: 14px;
  display: grid; place-items: center;
}
.step-text { font-size: 14px; line-height: 1.65; padding-top: 3px; }
.step-text b { color: var(--yellow); }

/* ============ Toolbar ============ */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input[type="text"] { flex: 1; min-width: 200px; }
.toolbar select { max-width: 230px; }
.count-badge { font-size: 12.5px; color: var(--text-dim); margin-left: auto; }

/* ============ Misc ============ */
.section-label { font-size: 13px; font-weight: 800; color: var(--text-dim); margin: 24px 0 10px; text-transform: uppercase; letter-spacing: 0.6px; }
.note { font-size: 12px; color: var(--text-faint); line-height: 1.75; margin-top: 14px; }
.pos { color: var(--green); } .neg { color: var(--red); } .warn-c { color: var(--yellow); }
.help {
  display: inline-grid; place-items: center; width: 16px; height: 16px;
  border-radius: 50%; background: var(--glass-strong); border: 1px solid var(--glass-border);
  color: var(--text-dim); font-size: 10px; cursor: help; margin-left: 4px; vertical-align: middle;
}
.inline-link { color: var(--brand); cursor: pointer; text-decoration: none; font-weight: 600; }
.inline-link:hover { text-decoration: underline; }

.msg-ok { color: var(--green); font-weight: 600; }
.msg-err { color: var(--red); font-weight: 600; }

/* campaign calendar */
.camp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-top: 4px; }
.camp {
  position: relative; padding: 14px 15px; border-radius: var(--radius-sm);
  background: var(--glass); border: 1px solid var(--glass-border);
  transition: transform 0.14s, border-color 0.14s;
}
.camp:hover { transform: translateY(-2px); }
.camp.mega { border-color: rgba(255,159,90,0.5); background: linear-gradient(135deg, rgba(255,159,90,0.1), transparent); }
.camp.soon { border-color: rgba(61,220,151,0.5); }
.camp .c-date { font-size: 20px; font-weight: 800; color: var(--brand); }
.camp.mega .c-date { color: var(--orange); }
.camp .c-name { font-size: 13px; margin-top: 2px; }
.camp .c-tag { font-size: 11px; color: var(--text-dim); margin-top: 8px; }
.camp .c-badge {
  position: absolute; top: 10px; right: 10px; font-size: 10px; font-weight: 800;
  padding: 2px 8px; border-radius: 20px; background: var(--green); color: #04150d;
}
.camp .c-badge.mega-b { background: var(--orange); color: #2a1304; }

/* ============ Responsive ============ */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 100;
    transform: translateX(-100%); transition: transform 0.25s ease; width: 260px;
  }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-grid !important; }
  .grid-cards { grid-template-columns: 1fr; }
  .backdrop.show { display: block; }
}
@media (min-width: 961px) { .menu-toggle { display: none; } }
@media (max-width: 680px) {
  .grid-2, .grid-3, .result-hero, .zones { grid-template-columns: 1fr; }
  .content, .topbar { padding-left: 18px; padding-right: 18px; }
  .stat .stat-val { font-size: 38px; }
}

.menu-toggle {
  display: none; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 11px; background: var(--glass); border: 1px solid var(--glass-border);
  color: var(--text); cursor: pointer; font-size: 18px;
}
.backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90; backdrop-filter: blur(2px); }

/* ============ Verdict (ROAS checker) ============ */
.verdict {
  display: flex; align-items: center; gap: 18px;
  padding: 20px 22px; border-radius: var(--radius);
  border: 1px solid var(--glass-border); background: var(--glass);
  margin: 16px 0; transition: border-color 0.2s, background 0.2s;
}
.verdict-light { font-size: 44px; line-height: 1; flex: none; transition: color 0.2s, text-shadow 0.2s; }
.verdict-title { font-size: 18px; font-weight: 800; }
.verdict-detail { font-size: 13.5px; color: var(--text-dim); margin-top: 4px; line-height: 1.65; }
.verdict-detail b { color: var(--text); }

.verdict.v-good { border-color: rgba(61,220,151,0.45); background: linear-gradient(135deg, rgba(61,220,151,0.12), transparent); }
.verdict.v-good .verdict-light { color: var(--green); text-shadow: 0 0 18px rgba(61,220,151,0.6); }
.verdict.v-good .verdict-title { color: var(--green); }

.verdict.v-ok { border-color: rgba(255,207,92,0.45); background: linear-gradient(135deg, rgba(255,207,92,0.12), transparent); }
.verdict.v-ok .verdict-light { color: var(--yellow); text-shadow: 0 0 18px rgba(255,207,92,0.6); }
.verdict.v-ok .verdict-title { color: var(--yellow); }

.verdict.v-bad { border-color: rgba(255,107,129,0.45); background: linear-gradient(135deg, rgba(255,107,129,0.12), transparent); }
.verdict.v-bad .verdict-light { color: var(--red); text-shadow: 0 0 18px rgba(255,107,129,0.6); }
.verdict.v-bad .verdict-title { color: var(--red); }

/* ============ Risk grid ============ */
.risk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.risk-box {
  padding: 16px 18px; border-radius: var(--radius-sm);
  background: var(--glass); border: 1px solid var(--glass-border);
}
.risk-k { font-size: 12px; color: var(--text-dim); }
.risk-v { font-size: 24px; font-weight: 800; margin-top: 6px; line-height: 1.15; }
.risk-v.c-good { color: var(--green); } .risk-v.c-ok { color: var(--yellow); } .risk-v.c-bad { color: var(--red); }
.risk-sub { font-size: 11.5px; color: var(--text-faint); margin-top: 6px; line-height: 1.5; }
@media (max-width: 680px) { .risk-grid { grid-template-columns: 1fr; } }

/* ============ Monthly summary ============ */
.month-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.m-stat {
  padding: 18px 16px; border-radius: var(--radius-sm); text-align: center;
  background: var(--glass-strong); border: 1px solid var(--glass-border);
}
.m-stat .m-val { font-size: 26px; font-weight: 800; line-height: 1.1; letter-spacing: -0.5px; }
.m-stat .m-val.c-good { color: var(--green); } .m-stat .m-val.c-ok { color: var(--yellow); } .m-stat .m-val.c-bad { color: var(--red); }
.m-stat .m-val.accent { color: var(--brand); }
.m-stat .m-lbl { font-size: 12px; color: var(--text-dim); margin-top: 7px; line-height: 1.4; }
@media (max-width: 760px) { .month-stats { grid-template-columns: 1fr 1fr; } }

/* ============ Monthly compare (delta) ============ */
.cmp { padding: 16px; border-radius: var(--radius-sm); background: var(--glass); border: 1px solid var(--glass-border); text-align: center; }
.cmp .cmp-lbl { font-size: 12px; color: var(--text-dim); }
.cmp .cmp-now { font-size: 20px; font-weight: 800; margin-top: 5px; }
.cmp .cmp-delta { font-size: 13px; font-weight: 700; margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 20px; }
.cmp .cmp-delta.up { color: var(--green); background: rgba(61,220,151,0.12); }
.cmp .cmp-delta.down { color: var(--red); background: rgba(255,107,129,0.12); }
.cmp .cmp-delta.flat { color: var(--text-dim); background: var(--glass-strong); }
.cmp .cmp-prev { font-size: 11px; color: var(--text-faint); margin-top: 5px; }

/* ============ How-to box ============ */
.howto {
  padding: 18px 20px; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(110,168,255,0.08), rgba(155,123,255,0.04));
  border: 1px solid rgba(110,168,255,0.25); margin-bottom: 20px;
}
.howto-head { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.howto-badge {
  background: var(--brand-grad); color: #0b0f1a; font-size: 12px; font-weight: 800;
  padding: 3px 12px; border-radius: 20px;
}
.howto .steps { margin-top: 6px; }
.howto .step { border-bottom: 1px dashed rgba(255,255,255,0.07); }
.howto-tip {
  margin-top: 12px; padding: 10px 14px; border-radius: 10px;
  background: rgba(255,255,255,0.03); font-size: 13px; color: var(--text-dim); line-height: 1.6;
}
.howto-tip b { color: var(--text); }
.th-hint { font-size: 10.5px; color: var(--text-faint); font-weight: 400; display: block; margin-top: 2px; }

/* คำเตือนค่าธรรมเนียมเป็นค่าประมาณ */
.fee-warn {
  margin-top: 12px; padding: 9px 13px; border-radius: 10px;
  background: rgba(255,207,92,0.08); border: 1px solid rgba(255,207,92,0.25);
  font-size: 12px; color: var(--text-dim); line-height: 1.5;
}
.fee-warn b { color: var(--yellow); }

/* กล่องข้อควรรู้เวลายิงจริง */
.realworld-note {
  margin-top: 16px; padding: 16px 18px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(155,123,255,0.08), rgba(110,168,255,0.04));
  border: 1px solid rgba(155,123,255,0.25);
}
.realworld-note .rw-title { font-size: 13.5px; font-weight: 800; color: var(--brand-2); margin-bottom: 10px; }
.realworld-note .rw-item { font-size: 13px; color: var(--text-dim); line-height: 1.7; margin-bottom: 7px; }
.realworld-note .rw-item:last-child { margin-bottom: 0; }
.realworld-note .rw-item b { color: var(--text); }

/* ============ Trend charts (ประวัติ) ============ */
.trend-charts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 820px) { .trend-charts { grid-template-columns: 1fr; } }
.trend-chart { background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); padding: 16px; }
.trend-chart-title { font-size: 13px; font-weight: 700; color: var(--text-dim); margin-bottom: 14px; }
.trend-chart .bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar-col .bar { width: 70%; max-width: 46px; border-radius: 6px 6px 0 0; transition: height 0.4s ease; min-height: 4px; }
.bar-col .bar-val { font-size: 10.5px; color: var(--text); margin-bottom: 5px; white-space: nowrap; font-weight: 700; }
.bar-col .bar-lbl { font-size: 10.5px; color: var(--text-faint); margin-top: 6px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ============ Print (รายงาน PDF) ============ */
@media print {
  .sidebar, .topbar, .backdrop, .no-print, .fee-warn { display: none !important; }
  .app { display: block; }
  .main { padding: 0; }
  .content { max-width: 100%; padding: 0; }
  body { background: #fff; color: #111; }
  .page { display: none !important; }
  .page[data-page="data"] { display: block !important; }
  /* ซ่อนการ์ด export เวลาพิมพ์ เหลือแค่รายงาน */
  .page[data-page="data"] > .card:first-child { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ccc; background: #fff; break-inside: avoid; }
  .card-title, .section-label, .trend-chart-title, td, th, .bar-col .bar-val, .bar-col .bar-lbl { color: #111 !important; }
  .trend-chart { border: 1px solid #ddd; background: #fff; }
  .data-table th { background: #f3f3f3; }
}
