/* Chokdee Complaints — CI โชคดีติ่มซำ (v1.1.0) */

:root {
  /* CI สีจากโลโก้ */
  --brand: #c60001; --brand-d: #a60018; --brand-dd: #7a0012;
  --brand-50: #fff1f0; --brand-100: #ffe0dd; --brand-200: #fbbdb7;
  --gold: #f9cf00; --gold-d: #d9b000; --gold-50: #fff8d6;
  --cream: #fbf7f2; --card: #ffffff;
  --line: #efe7df; --line-2: #e2d6cb;
  --ink: #1f1916; --ink-2: #5f544e; --ink-3: #978b84;
  --grid: #f1ebe5;
  --good: #0f7a3d; --good-50: #e8f6ee;
  --font: 'Noto Sans Thai', 'Leelawadee UI', 'Sarabun', Tahoma, sans-serif;
  --font-h: 'Prompt', 'Noto Sans Thai', 'Leelawadee UI', sans-serif;
  --r: 18px; --r-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(60, 20, 10, .05);
  --shadow: 0 1px 2px rgba(60, 20, 10, .04), 0 8px 24px -6px rgba(60, 20, 10, .08);
  --shadow-lg: 0 24px 60px -12px rgba(60, 10, 0, .28);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  --side: 256px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.65; color: var(--ink); background: var(--cream);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  word-break: normal; line-break: auto; overflow-wrap: break-word;
}
h1, h2, h3, h4 { font-family: var(--font-h); line-height: 1.35; text-wrap: balance; margin: 0; letter-spacing: 0; }
p { text-wrap: pretty; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-underline-offset: 3px; }
::selection { background: var(--gold); color: var(--ink); }
img { display: block; }
.muted { color: var(--ink-2); } .small { font-size: 13.5px; } .tiny { font-size: 12.5px; color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- boot ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; background: var(--brand); }
.boot img { width: 96px; height: 96px; border-radius: 26px; box-shadow: var(--shadow-lg); animation: pulse 1.4s var(--ease) infinite; }
@keyframes pulse { 50% { transform: scale(.94); opacity: .85; } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 22px 16px 18px;
  background: linear-gradient(170deg, var(--brand) 0%, var(--brand-d) 70%, var(--brand-dd) 100%); color: #fff; overflow: hidden; z-index: 20;
}
.side::after { /* ไอน้ำแบบในโลโก้ */
  content: ''; position: absolute; right: -40px; bottom: 70px; width: 230px; height: 190px; pointer-events: none; opacity: .14;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 100'%3E%3Cpath d='M8 4C-2 16 4 30 40 36s66 8 62 58c18-30 4-52-30-60S8 26 8 4z' fill='%23f9cf00'/%3E%3Cpath d='M34 46c-6 8 0 18 24 24s30 6 30 26c14-14 6-30-20-34S36 60 34 46z' fill='%23f9cf00'/%3E%3C/svg%3E");
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 6px 20px; position: relative; z-index: 1; }
.brand img { width: 52px; height: 52px; border-radius: 15px; box-shadow: 0 6px 18px rgba(0, 0, 0, .25), 0 0 0 2px rgba(255, 255, 255, .18); }
.brand b { display: block; font-family: var(--font-h); font-size: 17px; font-weight: 600; line-height: 1.3; }
.brand span { display: block; font-size: 12.5px; color: var(--gold); font-weight: 500; letter-spacing: .02em; }
.nav { display: grid; gap: 4px; position: relative; z-index: 1; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px;
  color: rgba(255, 255, 255, .82); text-decoration: none; font-family: var(--font-h); font-weight: 500; font-size: 15px;
  transition: background .2s var(--ease), color .2s, transform .2s var(--ease);
}
.nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; transform: translateX(2px); }
.nav a.on { background: #fff; color: var(--brand); box-shadow: 0 6px 16px rgba(0, 0, 0, .18); }
.nav a.on::before { content: ''; position: absolute; left: -16px; top: 10px; bottom: 10px; width: 5px; border-radius: 0 5px 5px 0; background: var(--gold); }
.nav svg { width: 20px; height: 20px; flex: none; }
.side .foot { margin-top: auto; position: relative; z-index: 1; background: rgba(0, 0, 0, .16); border-radius: 16px; padding: 12px 14px; font-size: 13px; }
.who { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; min-width: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: var(--brand-dd); display: grid; place-items: center; font-family: var(--font-h); font-weight: 600; flex: none; }
.who-t { min-width: 0; line-height: 1.35; }
.who-t b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-t span { display: block; color: rgba(255, 255, 255, .65); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foot .row { display: flex; gap: 6px; }
.foot .row button { flex: 1; border: 0; border-radius: 10px; padding: 6px 8px; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; font-size: 12.5px; transition: background .15s; }
.foot .row button:hover { background: rgba(255, 255, 255, .22); }
.ver { margin-top: 8px; color: rgba(255, 255, 255, .5); font-size: 11.5px; text-align: center; }
.topbar { display: none; }

.main { padding: 30px 34px 64px; max-width: 1320px; width: 100%; margin: 0 auto; min-width: 0; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-h h2 { font-size: 28px; font-weight: 600; position: relative; padding-bottom: 8px; }
.page-h h2::after { content: ''; position: absolute; left: 0; bottom: 0; width: 44px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--brand), var(--gold)); }
.page-h p { margin: 8px 0 0; color: var(--ink-2); font-size: 14px; }

/* ---------- controls ---------- */
.btn {
  border: 1px solid var(--line-2); background: #fff; color: var(--ink); text-decoration: none;
  padding: 9px 16px; border-radius: 12px; cursor: pointer; font-family: var(--font-h); font-weight: 500; font-size: 14px; line-height: 1.4;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .2s, transform .12s var(--ease);
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover { background: var(--cream); border-color: var(--brand-200); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(180deg, #d80a0b, var(--brand)); border-color: var(--brand-d); color: #fff; box-shadow: 0 6px 16px -6px rgba(198, 0, 1, .6), inset 0 1px 0 rgba(255, 255, 255, .2); }
.btn.primary:hover { background: linear-gradient(180deg, var(--brand), var(--brand-d)); }
.btn.gold { background: var(--gold); border-color: var(--gold-d); color: var(--brand-dd); }
.btn.gold:hover { background: #ffd91a; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--brand-50); color: var(--brand); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 10px; }
.btn.danger { color: var(--brand); }
.btn.danger:hover { background: var(--brand-50); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.link { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font-size: inherit; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  border: 1px solid var(--line-2); background: #fff; border-radius: 12px; padding: 9px 12px; font-size: 14.5px; min-width: 0; line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
}
select { appearance: none; padding-right: 34px; cursor: pointer;
  background: #fff no-repeat right 11px center/14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23978b84' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
textarea { width: 100%; resize: vertical; line-height: 1.65; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(198, 0, 1, .12); }
.btn:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid rgba(249, 207, 0, .8); outline-offset: 2px; }
label.f { display: grid; gap: 6px; font-size: 13.5px; color: var(--ink-2); font-weight: 500; }
label.f > input, label.f > select, label.f > textarea { color: var(--ink); font-weight: 400; }
label.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14.5px; }
input[type=checkbox] { accent-color: var(--brand); width: 17px; height: 17px; }

.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center; background: #fff; border: 1px solid var(--line);
  border-radius: var(--r); padding: 10px 12px; margin-bottom: 18px; box-shadow: var(--shadow-sm); position: relative; z-index: 2;
}
.seg { display: inline-flex; background: var(--cream); border: 1px solid var(--line); border-radius: 13px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 13px; border-radius: 10px; cursor: pointer; font-size: 13.5px; color: var(--ink-2); font-family: var(--font-h); font-weight: 500; white-space: nowrap; transition: background .2s var(--ease), color .2s; }
.seg button:hover { color: var(--brand); }
.seg button.on { background: var(--brand); color: #fff; box-shadow: 0 4px 10px -3px rgba(198, 0, 1, .5); }
.filters .sep { width: 1px; height: 28px; background: var(--line); }
.f-dates { display: inline-flex; gap: 6px; align-items: center; }
.f-sel { display: contents; }

/* ---------- cards / kpi ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { font-size: 16.5px; font-weight: 600; }
.card .sub { margin: 2px 0 16px; font-size: 13px; color: var(--ink-3); line-height: 1.5; }
.card-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi { position: relative; overflow: hidden; padding: 18px 20px 16px; transition: transform .25s var(--ease), box-shadow .25s; }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 14px 32px -10px rgba(60, 20, 10, .16); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi .l { font-size: 14px; color: var(--ink-2); font-weight: 500; font-family: var(--font-h); }
.kpi .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex: none; }
.kpi .ic svg { width: 20px; height: 20px; }
.kpi.hero { background: linear-gradient(140deg, var(--brand) 0%, var(--brand-d) 100%); border-color: transparent; color: #fff; }
.kpi.hero .l { color: rgba(255, 255, 255, .85); }
.kpi.hero .ic { background: rgba(255, 255, 255, .16); color: var(--gold); }
.kpi.hero::after { content: ''; position: absolute; right: -30px; bottom: -40px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, rgba(249, 207, 0, .35), transparent 65%); }
.kpi .v { font-family: var(--font-h); font-size: 34px; font-weight: 600; line-height: 1.2; margin: 10px 0 6px; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 16px; color: var(--ink-3); font-weight: 500; margin-left: 2px; }
.delta { font-size: 12.5px; display: inline-flex; gap: 5px; align-items: center; padding: 2px 9px; border-radius: 99px; background: var(--cream); color: var(--ink-3); line-height: 1.6; }
.delta.up-bad, .delta.down-bad { background: var(--brand-50); color: var(--brand); }
.delta.up-good, .delta.down-good { background: var(--good-50); color: var(--good); }
.kpi.hero .delta { background: rgba(255, 255, 255, .16); color: #fff; }
.grid2 { display: grid; grid-template-columns: 1.65fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gl { stroke: var(--grid); stroke-width: 1; }
.chart .gl0 { stroke: var(--line-2); }
.chart .ax { fill: var(--ink-3); font-size: 11.5px; font-family: var(--font); }
.chart .ln { fill: none; stroke: var(--brand); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.1s var(--ease) .15s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart .ar { fill: url(#gArea); opacity: 0; animation: fade .8s ease .5s forwards; }
@keyframes fade { to { opacity: 1; } }
.chart .dot { fill: #fff; stroke: var(--brand); stroke-width: 2; }
.chart .peak { fill: var(--gold); stroke: var(--brand); stroke-width: 2; }
.chart .peak-l { fill: var(--brand); font-size: 12px; font-weight: 600; font-family: var(--font-h); }
.chart .xh { stroke: var(--brand-200); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .bar { transition: opacity .2s; transform-origin: center bottom; transform-box: fill-box; animation: grow .7s var(--spring) both; }
.chart .bar.c { fill: var(--brand); } .chart .bar.n { fill: #d9cfc6; }
.chart .bar.dim { opacity: .3; }
@keyframes grow { from { transform: scaleY(0); } }
.chart .vl { fill: var(--ink); font-size: 12px; font-family: var(--font-h); font-weight: 500; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 10px; justify-content: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.hbars { display: grid; gap: 11px; }
.hb { display: grid; grid-template-columns: minmax(104px, 40%) 1fr auto; gap: 12px; align-items: center; font-size: 14px; border-radius: 8px; padding: 2px 4px; margin: 0 -4px; transition: background .15s; }
.hb.click { cursor: pointer; }
.hb.click:hover { background: var(--brand-50); }
.hb.click:hover .hb-l { color: var(--brand); }
.hb-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); line-height: 1.5; }
.hb-t { height: 12px; background: var(--grid); border-radius: 0 6px 6px 0; overflow: hidden; }
.hb-f { height: 100%; background: linear-gradient(90deg, var(--brand-d), var(--brand)); border-radius: 0 6px 6px 0; min-width: 3px; transform-origin: left; animation: growX .8s var(--ease) both; }
.hb:nth-child(1) .hb-f { background: linear-gradient(90deg, var(--brand), #e8302b); }
@keyframes growX { from { transform: scaleX(0); } }
.hb-v { font-variant-numeric: tabular-nums; color: var(--ink); text-align: right; min-width: 76px; font-family: var(--font-h); font-weight: 500; }
.hb-v span { color: var(--ink-3); font-size: 12px; font-weight: 400; }
.empty { color: var(--ink-3); text-align: center; padding: 34px 12px; font-size: 14.5px; line-height: 1.7; }
.empty .ei { width: 56px; height: 56px; border-radius: 18px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; margin: 0 auto 12px; }
.empty .ei svg { width: 26px; height: 26px; }
.tip { position: fixed; z-index: 80; pointer-events: none; background: rgba(31, 25, 22, .96); color: #fff; padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.55; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); max-width: 260px; backdrop-filter: blur(6px); border-top: 3px solid var(--gold); }
.tip b { font-family: var(--font-h); font-weight: 600; }
.tablev { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.tablev th, .tablev td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.tablev th:first-child, .tablev td:first-child { text-align: left; }
details.tv summary { cursor: pointer; font-size: 12.5px; color: var(--ink-3); margin-top: 12px; width: max-content; }
details.tv summary:hover { color: var(--brand); }

/* ---------- skeleton ---------- */
.sk { border-radius: 14px; background: linear-gradient(90deg, #f1ebe5 0%, #faf6f2 40%, #f1ebe5 80%); background-size: 1200px 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { from { background-position: -600px 0; } to { background-position: 600px 0; } }

/* ---------- review items ---------- */
.rv { display: flex; gap: 14px; padding: 16px 2px; border-bottom: 1px solid var(--line); }
.rv-b { flex: 1; min-width: 0; display: grid; gap: 6px; align-content: start; }
.rv:last-child { border-bottom: 0; }
.rv-av { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-family: var(--font-h); font-weight: 600; font-size: 17px; color: #fff; background: var(--c, var(--brand)); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12); }
.rv-h { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.rv-h b { color: var(--ink); font-weight: 600; font-size: 14.5px; font-family: var(--font-h); }
.rv-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 12.5px; color: var(--ink-3); }
.rv-meta .dotsep::before { content: '•'; margin-right: 10px; color: var(--line-2); }
.rv-t { white-space: pre-line; line-height: 1.75; font-size: 15px; color: var(--ink); max-width: 72ch; }
.rv-reply { font-size: 13.5px; color: var(--ink-2); background: var(--cream); border-radius: 10px; padding: 8px 12px; white-space: pre-line; border-left: 3px solid var(--gold); line-height: 1.6; max-width: 72ch; }
.rv-f { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 2px; }
.rv-f .btn { margin-left: auto; }
.stars { color: var(--gold-d); letter-spacing: 1px; font-size: 13.5px; line-height: 1; }
.stars i { color: var(--line-2); font-style: normal; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: 12px; background: var(--cream); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; line-height: 1.7; }
.chip.src::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c, #999); }
.chip.cat { background: var(--brand-50); color: var(--brand-d); border-color: var(--brand-100); font-weight: 500; }
.chip.ok { background: var(--good-50); color: var(--good); border-color: #cbe9d5; }
.chip.gold { background: var(--gold-50); color: #7a5b00; border-color: #f3e2a0; }
.pager { display: flex; gap: 10px; justify-content: center; align-items: center; padding-top: 16px; }

/* ---------- forms / tables ---------- */
.tbl-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; line-height: 1.5; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: #fdfaf7; }
.tbl input, .tbl select { width: 100%; }
.tbl .r { text-align: right; } .tbl .act { text-align: right; white-space: nowrap; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-row > * { flex: 1 1 170px; }
.form-row > .btn, .form-row > .auto { flex: 0 0 auto; }
.stack { display: grid; gap: 16px; }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; background: var(--cream); padding: 5px; border-radius: 14px; border: 1px solid var(--line); width: max-content; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 8px 16px; cursor: pointer; color: var(--ink-2); font-family: var(--font-h); font-weight: 500; border-radius: 10px; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; transition: background .2s var(--ease), color .2s; }
.tabs button svg { width: 17px; height: 17px; }
.tabs button.on { background: #fff; color: var(--brand); box-shadow: var(--shadow); }
.note { background: var(--gold-50); border: 1px solid #f3e2a0; color: #5e4600; padding: 12px 14px; border-radius: 14px; font-size: 14px; line-height: 1.75; }
.note.info { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--brand); color: var(--ink-2); }
.note b { color: var(--ink); }
.note ul { margin: 6px 0 0; padding-left: 20px; }
.note li { margin: 2px 0; }
code, .code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; background: var(--cream); padding: 2px 6px; border-radius: 6px; word-break: break-all; border: 1px solid var(--line); }
pre.code { padding: 12px 14px; white-space: pre-wrap; display: block; line-height: 1.6; margin: 0; }
.preview { max-height: 380px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.preview table { font-size: 13px; }
.preview td { max-width: 380px; }
.preview th { position: sticky; top: 0; background: #fff; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); margin-right: 8px; vertical-align: 1px; }
.status-dot.on { background: #1fa055; box-shadow: 0 0 0 3px rgba(31, 160, 85, .15); } .status-dot.off { background: var(--brand); box-shadow: 0 0 0 3px rgba(198, 0, 1, .12); }
.file-btn { position: relative; overflow: hidden; }
.drop { border: 2px dashed var(--line-2); border-radius: 16px; padding: 20px; text-align: center; color: var(--ink-3); transition: border-color .2s, background .2s; }
.drop.over { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }
.sec-h { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 4px; }
.sec-h .ic { width: 36px; height: 36px; border-radius: 11px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; flex: none; }
.sec-h .ic svg { width: 19px; height: 19px; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--cream); }
.auth-hero {
  position: relative; overflow: hidden; color: #fff; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 48px;
  background: radial-gradient(900px 500px at 20% 0%, #e0120f 0%, transparent 60%), linear-gradient(160deg, var(--brand), var(--brand-dd));
}
.auth-hero .logo { width: 200px; height: 200px; border-radius: 52px; box-shadow: 0 30px 70px -15px rgba(0, 0, 0, .55), 0 0 0 6px rgba(255, 255, 255, .1); animation: float 5s ease-in-out infinite; position: relative; z-index: 1; }
@keyframes float { 50% { transform: translateY(-10px); } }
.auth-hero h1 { font-size: 34px; font-weight: 600; margin-top: 34px; position: relative; z-index: 1; }
.auth-hero p { margin: 10px 0 0; color: rgba(255, 255, 255, .85); max-width: 26em; font-size: 15.5px; line-height: 1.75; position: relative; z-index: 1; }
.auth-hero .pills { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 26px; position: relative; z-index: 1; }
.auth-hero .pills span { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); padding: 4px 12px; border-radius: 99px; font-size: 12.5px; }
.steam { position: absolute; width: 300px; height: 250px; opacity: .13; pointer-events: none; fill: var(--gold); animation: drift 9s ease-in-out infinite; }
@keyframes drift { 50% { transform: translate(10px, -14px) rotate(3deg); } }
.steam.s1 { left: -60px; bottom: -40px; } .steam.s2 { right: -50px; top: 40px; width: 220px; height: 180px; animation-delay: -4s; transform: scaleX(-1); }
.nw { white-space: nowrap; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .hi { font-size: 26px; font-weight: 600; }
.auth-card .hi + p { margin: 6px 0 0; color: var(--ink-2); }
.auth-card form { display: grid; gap: 16px; margin-top: 28px; }
.auth-card .btn.primary { padding: 13px; font-size: 15.5px; border-radius: 14px; margin-top: 4px; }
.auth-foot { margin-top: 28px; color: var(--ink-3); font-size: 12.5px; text-align: center; }
.pw { position: relative; }
.pw input { width: 100%; padding-right: 44px; }
.pw button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; padding: 6px; cursor: pointer; color: var(--ink-3); border-radius: 8px; }
.pw button:hover { color: var(--brand); }
.pw button svg { width: 19px; height: 19px; display: block; }
.auth-mlogo { display: none; }

/* ---------- toast / modal ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 90; }
.toast { display: flex; gap: 10px; align-items: flex-start; background: #1f1916; color: #fff; padding: 12px 16px 12px 14px; border-radius: 14px; font-size: 14px; line-height: 1.55; box-shadow: 0 14px 34px rgba(0, 0, 0, .25); animation: tin .35s var(--spring); max-width: 380px; }
.toast .ti { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; background: rgba(255, 255, 255, .15); font-size: 13px; margin-top: 1px; }
.toast.ok .ti { background: #1fa055; } .toast.err .ti { background: var(--brand); }
.toast.out { animation: tout .25s ease forwards; }
@keyframes tin { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes tout { to { opacity: 0; transform: translateY(8px); } }
.modal { position: fixed; inset: 0; background: rgba(40, 10, 5, .45); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 70; padding: 16px; animation: fin .2s; }
@keyframes fin { from { opacity: 0; } }
.modal-box { background: #fff; border-radius: 22px; padding: 24px; width: 100%; max-width: 540px; max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lg); animation: pop .3s var(--spring); }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(10px); } }
.modal-box h3 { margin: 0 0 18px; font-size: 19px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.modal-box h3::before { content: ''; width: 6px; height: 22px; border-radius: 4px; background: linear-gradient(var(--brand), var(--gold)); }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); border-radius: 99px; padding: 5px 12px; font-size: 13.5px; cursor: pointer; transition: background .15s, border-color .15s; }
.checks label:has(input:checked) { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-d); }

/* ---------- motion ---------- */
@keyframes up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.main > *, .rise { animation: up .5s var(--ease) both; }
.main > *:nth-child(2) { animation-delay: .04s; } .main > *:nth-child(3) { animation-delay: .08s; } .main > *:nth-child(4) { animation-delay: .12s; }
.kpis > * { animation: up .5s var(--ease) both; }
.kpis > *:nth-child(2) { animation-delay: .05s; } .kpis > *:nth-child(3) { animation-delay: .1s; } .kpis > *:nth-child(4) { animation-delay: .15s; }
.grid2 > *, .grid3 > * { animation: up .55s var(--ease) both; animation-delay: .12s; }
.grid3 > * { animation-delay: .18s; }

/* ---------- tablet ---------- */
@media (max-width: 1180px) {
  .grid3 { grid-template-columns: 1fr 1fr; }
  .grid3 > :last-child { grid-column: span 2; }
}
@media (max-width: 1080px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  body { font-size: 15px; }
  .shell { grid-template-columns: 1fr; }
  .topbar {
    display: flex; position: sticky; top: 0; z-index: 25; align-items: center; gap: 10px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
    background: linear-gradient(120deg, var(--brand), var(--brand-d)); color: #fff; box-shadow: 0 6px 18px -8px rgba(122, 0, 18, .6);
  }
  .topbar img { width: 36px; height: 36px; border-radius: 11px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .18); }
  .topbar .tt { flex: 1; min-width: 0; line-height: 1.25; }
  .topbar .tt b { display: block; font-family: var(--font-h); font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .tt span { display: block; font-size: 11.5px; color: var(--gold); }
  .topbar .avatar { width: 34px; height: 34px; border: 0; cursor: pointer; }
  .side {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; padding: 6px 8px; padding-bottom: max(6px, env(safe-area-inset-bottom));
    flex-direction: row; background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(60, 20, 10, .06);
  }
  .side::after, .side .brand, .side .foot { display: none; }
  .nav { display: flex; width: 100%; gap: 2px; }
  .nav a { flex: 1; flex-direction: column; gap: 3px; font-size: 11.5px; padding: 7px 2px 6px; text-align: center; color: var(--ink-3); border-radius: 14px; line-height: 1.3; }
  .nav a:hover { transform: none; background: transparent; color: var(--brand); }
  .nav a.on { background: var(--brand-50); color: var(--brand); box-shadow: none; }
  .nav a.on::before { left: 30%; right: 30%; top: -6px; bottom: auto; width: auto; height: 3px; border-radius: 0 0 4px 4px; }
  .nav svg { width: 22px; height: 22px; }
  .main { padding: 18px 14px calc(96px + env(safe-area-inset-bottom)); }
  .page-h { margin-bottom: 14px; align-items: center; }
  .page-h h2 { font-size: 23px; }
  .page-h p { font-size: 13px; }
  .page-h .btn { padding: 8px 12px; }
  .filters { padding: 10px; gap: 8px; }
  .filters .seg { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .filters .seg::-webkit-scrollbar { display: none; }
  .filters .seg button { flex: 1; padding: 7px 8px; }
  .filters .sep { display: none; }
  .filters select, .filters input[type=search], .f-dates { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .f-dates { flex-basis: 100%; }
  .f-dates input { flex: 1; min-width: 0; }
  .filters input[type=search] { flex-basis: 100%; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
  .kpi { padding: 14px 14px 12px; }
  .kpi .ic { width: 32px; height: 32px; border-radius: 10px; }
  .kpi .ic svg { width: 17px; height: 17px; }
  .kpi .l { font-size: 13px; }
  .kpi .v { font-size: 26px; margin: 6px 0 4px; }
  .delta { font-size: 11px; padding: 1px 7px; }
  .grid2, .grid3 { grid-template-columns: 1fr; gap: 12px; margin-bottom: 12px; }
  .grid3 > :last-child { grid-column: auto; }
  .card { padding: 16px; border-radius: 16px; }
  .hb { grid-template-columns: 1fr auto; grid-template-areas: 'l v' 't t'; gap: 4px 8px; font-size: 14px; }
  .hb-l { grid-area: l; } .hb-v { grid-area: v; min-width: 0; } .hb-t { grid-area: t; height: 10px; }
  .hbars { gap: 12px; }
  .rv { gap: 12px; }
  .rv-av { width: 38px; height: 38px; border-radius: 12px; font-size: 15px; }
  .rv-t { font-size: 14.5px; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; justify-content: center; padding: 8px 10px; font-size: 13.5px; }
  .toasts { left: 14px; right: 14px; bottom: calc(84px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .modal { align-items: end; padding: 0; }
  .modal-box { border-radius: 22px 22px 0 0; max-height: 88vh; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); animation: sheet .35s var(--ease); }
  @keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
  .modal-f .btn { flex: 1; }
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-hero { padding: 40px 20px 72px; }
  .auth-hero .logo { width: 116px; height: 116px; border-radius: 32px; }
  .auth-hero h1 { font-size: 23px; margin-top: 18px; }
  .auth-hero p { font-size: 14px; }
  .auth-hero .pills { display: none; }
  .auth-form { padding: 0 16px 32px; margin-top: -44px; align-items: start; }
  .auth-card { background: #fff; border-radius: 22px; padding: 24px 20px; box-shadow: var(--shadow-lg); position: relative; z-index: 2; }
  .auth-card .hi { font-size: 21px; }
  .steam.s1 { width: 200px; height: 170px; left: -50px; bottom: 30px; }
  .tbl { font-size: 13.5px; }
  .tbl td, .tbl th { padding: 9px 6px; }
  .hide-m { display: none; }
}
@media (max-width: 380px) {
  .kpi .v { font-size: 23px; }
  .nav a { font-size: 10.5px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .chart .ln { stroke-dashoffset: 0; } .chart .ar { opacity: 1; } }
@media print { .side, .topbar, .filters, .btn { display: none !important; } .shell { display: block; } .card { box-shadow: none; break-inside: avoid; } }
