/* VinaTV — painel (cores e estilos do sistema VinaTV) */
:root {
  --bg: #F4F4F6;
  --surface: #FFFFFF;
  --subtle: #FAFAFA;
  --line: #E5E7EB;
  --line-2: #F1F2F4;
  --ink: #1A1A1A;
  --ink-2: #4F5660;
  --muted: #6F7782;
  --faint: #94A3B8;
  --brand: #FF3D10;
  --brand-hover: #E83208;
  --brand-soft: rgba(255, 61, 16, .18);
  --purple: #5D1674;
  --grad: linear-gradient(100deg, #B91C1C 0%, #DC2626 40%, #EA580C 75%, #FF3D10 100%);
  --side: #FFFFFF;
  --side-2: #F3F4F6;
  --side-3: #E5E7EB;
  --side-ink: #565D66;
  --side-muted: #6F7782;
  --ok: #0F7B4B;
  --ok-soft: #E7F6EE;
  --warn: #A15C00;
  --warn-soft: #FFF4E0;
  --bad: #B42318;
  --bad-soft: #FEECEB;
  --info: #1D4ED8;
  --info-soft: #E8F1FE;
  --r: 8px;
  --shadow: 0 1px 3px rgba(27, 31, 35, .10);
  --shadow-card: 0 7px 18px rgba(27, 31, 35, .16);
  --shadow-field: 0 5px 15px rgba(0, 0, 0, .12);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);
  --font: Arial, Helvetica, sans-serif, "Segoe UI Emoji", "Noto Color Emoji", "Apple Color Emoji";
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button { font-family: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.r { text-align: right; }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }

svg.i {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
svg.i.sm { width: 16px; height: 16px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font: 700 13.5px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
  box-shadow: var(--shadow); transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--subtle); border-color: #D9DCE3; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--brand-soft); border-color: var(--brand); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: #F6C9C5; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; gap: 6px; }
.btn.lg { height: 44px; font-size: 15px; width: 100%; }
.btn.icon { width: 32px; height: 32px; padding: 0; border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); }
.btn.icon:hover { background: var(--line-2); color: var(--ink); }
.btn.icon.on-dark { color: var(--side-muted); }
.btn.icon.on-dark:hover { background: var(--brand); color: #fff; }

/* ---------- form controls ---------- */
input, select, textarea {
  font: 14.5px var(--font); color: var(--ink); background: var(--surface);
  border: 1px solid transparent; border-radius: 5px; padding: 0 12px; height: 40px; width: 100%;
  box-shadow: var(--shadow-field); transition: border-color .12s, box-shadow .12s;
}
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; padding: 0; box-shadow: none; accent-color: var(--brand); }
textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.45; }
select { appearance: none; padding-right: 34px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(255, 61, 16, .28); outline-offset: 0; border-color: transparent; }
input[type=date], input[type=month] { min-width: 0; }

.field { display: grid; gap: 8px; font-size: 13px; font-weight: 700; color: var(--purple); }
.field small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stack { display: grid; gap: 16px; }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; color: var(--ink); font-size: 14px; }
.switch input { appearance: none; width: 36px; height: 22px; padding: 0; border: 0; border-radius: 99px; background: #D5D9E0; position: relative; cursor: pointer; flex: none; box-shadow: none; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(14px); }
.switch input:focus-visible { box-shadow: 0 0 0 4px var(--ok-soft); }

/* ---------- small pieces ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }

.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 12.5px; flex: none; letter-spacing: .02em; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #C4C9D2; flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.logo .mark { width: 30px; height: 30px; border-radius: 6px; background: var(--grad); display: grid; place-items: center; flex: none; }
.logo .mark svg { width: 17px; height: 17px; stroke: #fff; }

kbd { font: 600 11px var(--font); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; background: #fff; color: var(--muted); }
code.copy { display: flex; align-items: center; justify-content: space-between; gap: 10px; font: 500 13.5px ui-monospace, SFMono-Regular, Consolas, monospace; background: var(--subtle); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; word-break: break-all; color: var(--ink); }
code.copy a { color: var(--ink); text-decoration: none; }
code.copy a:hover { text-decoration: underline; }

/* ---------- login ---------- */
.login { display: grid; grid-template-columns: minmax(420px, 1fr) 1.15fr; min-height: 100vh; background: var(--surface); }
.login-form { display: flex; flex-direction: column; padding: 40px 56px; }
.login-box { margin: auto 0; width: 100%; max-width: 380px; align-self: center; display: grid; gap: 16px; }
.login-box h1 { font-size: 28px; letter-spacing: -.02em; line-height: 1.2; }
.login-box .sub { color: var(--muted); font-size: 15px; margin: -8px 0 10px; }
.login-box input { height: 44px; font-size: 15px; }
.login-box .error { color: var(--bad); font-size: 13.5px; font-weight: 500; min-height: 0; }
.login-box .error:empty { display: none; }
.login-box .hint { color: var(--muted); font-size: 13px; text-align: center; }
.login-foot { color: var(--faint); font-size: 12.5px; }
.login-art { background: #F4F4F6; border-left: 1px solid #E5E7EB; color: #1A1A1A; padding: 48px 56px; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.login-art::before { content: ""; position: absolute; inset: 0; background: radial-gradient(800px 420px at 85% 10%, rgba(255,255,255,.9), transparent 60%), radial-gradient(600px 400px at 0% 100%, rgba(255,61,16,.06), transparent 60%); }
.login-art > * { position: relative; }
.kicker { font-size: 12.5px; font-weight: 700; color: #FF3D10; letter-spacing: .06em; text-transform: uppercase; }
.login-art h2 { font-size: 34px; line-height: 1.15; letter-spacing: -.02em; margin: 14px 0 12px; max-width: 520px; }
.login-art p { color: #6F7782; font-size: 15.5px; max-width: 480px; }
.tv { margin-top: 40px; width: 100%; max-width: 640px; }
.tv .frame { background: #050505; border-radius: 14px; padding: 10px; box-shadow: 0 30px 80px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.06); }
.tv img { display: block; width: 100%; border-radius: 6px; }
.tv .stand { width: 22%; height: 10px; margin: 0 auto; background: linear-gradient(#222, #111); border-radius: 0 0 8px 8px; }
.facts { display: flex; gap: 28px; margin-top: 34px; color: #6F7782; font-size: 13.5px; }
.facts b { display: block; color: #1A1A1A; font-size: 20px; letter-spacing: -.02em; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 0 0 12px; overflow-y: auto; border-right: 1px solid #D7D9DE; box-shadow: 5px 0 14px rgba(0, 0, 0, .12); z-index: 5; }
.side .logo { color: #fff; padding: 0 18px; height: 64px; flex: none; margin-bottom: 14px; background: var(--grad); box-shadow: 0 5px 16px rgba(0, 0, 0, .22); }
.side .logo .mark, .mtop .logo .mark { background: rgba(255, 255, 255, .2); }
.side-ctx { margin: 0 12px 6px; padding: 10px 12px; border-radius: 8px; background: var(--side-2); border: 1px solid var(--side-3); }
.side-ctx small { display: block; color: var(--side-muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.side-ctx b { display: block; color: var(--purple); font-weight: 700; margin: 2px 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-ctx .btn { width: 100%; background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: none; }
.side-ctx .btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 16px 18px 6px; }
#nav a { display: flex; align-items: center; gap: 11px; min-height: 45px; padding: 0 18px; color: var(--side-ink); text-decoration: none; font-size: 13px; font-weight: 700; text-transform: uppercase; cursor: pointer; transition: background .16s ease, color .16s ease; }
#nav a:hover, #nav a.on { background: var(--brand); color: #fff; }
#nav a .count { margin-left: auto; font-size: 11.5px; font-weight: 700; background: var(--side-3); color: var(--ink-2); border-radius: 99px; padding: 1px 7px; }
#nav a .count.alert { background: var(--brand); color: #fff; }
#nav a:hover .count, #nav a.on .count { background: #fff; color: var(--brand); }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 12px 4px 18px; border-top: 1px solid var(--line); }
.me .avatar { background: var(--purple); color: #fff; }
.me-text { flex: 1; min-width: 0; }
.me-text b { display: block; color: var(--ink); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { display: block; color: var(--side-muted); font-size: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.content { width: 100%; max-width: 1240px; padding: 28px 32px 48px; display: grid; gap: 20px; align-content: start; }
.mtop, .bnav { display: none; }

/* page header */
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ph h1 { font-size: 22px; letter-spacing: -.02em; line-height: 1.25; }
.ph p { color: var(--muted); margin-top: 3px; }
.ph .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* banners */
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r); border: 1px solid; font-weight: 500; }
.banner .grow b { font-weight: 600; }
.banner.warn { background: var(--warn-soft); border-color: #F6D9A8; color: #6B3D00; }
.banner.bad { background: var(--bad-soft); border-color: #F6C9C5; color: #7A1A12; }
.banner.info { background: var(--info-soft); border-color: #C7DBFB; color: #1E3A8A; }
.only-m { display: none !important; }
#bars:empty { display: none; }
#bars { padding: 20px 32px 0; max-width: 1240px; display: grid; gap: 10px; }

/* ---------- cards / kpis ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-card); }
.card.clip { overflow: hidden; overflow-x: auto; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h3 { font-size: 15px; font-weight: 700; color: var(--purple); }
.card-head p { color: var(--muted); font-size: 13px; }
.card-body { padding: 18px; display: grid; gap: 16px; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow-card); min-width: 0; }
.kpi .h { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-weight: 500; font-size: 13px; gap: 8px; }
.kpi .ic { width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; background: rgba(255, 61, 16, .10); color: var(--brand); }
.kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -.025em; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v small { font-size: 16px; font-weight: 600; color: var(--muted); }
.kpi .d { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi.attn .ic { background: var(--warn-soft); color: var(--warn); }
.kpi.attn .v { color: var(--warn); }

/* toolbar + segmented filter */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: transparent; height: 28px; padding: 0 12px; border-radius: 6px; font: 600 13px var(--font); color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.1); }
.seg button.on span { color: rgba(255,255,255,.8); }
.seg button span { color: var(--faint); margin-left: 5px; font-weight: 500; }
.searchbox { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.searchbox svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; }
.searchbox input { padding-left: 34px; height: 34px; background: var(--subtle); box-shadow: none; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 16px; background: var(--subtle); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; white-space: nowrap; }
.table td.wrap { white-space: normal; }
.table-wrap { overflow-x: auto; }
.table .clip-text { display: inline-block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--subtle); }
.table .r { text-align: right; }
.table .actions-cell { text-align: right; white-space: nowrap; width: 1%; }
.table .actions-cell .btn + .btn { margin-left: 6px; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who > div { min-width: 0; }
.who b { display: block; font-weight: 600; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { display: block; color: var(--muted); font-size: 12.5px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-cell { display: grid; gap: 3px; justify-items: start; }
.status-cell small { color: var(--muted); font-size: 12.5px; }
.tvs { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.bar { width: 64px; height: 6px; border-radius: 99px; background: var(--line-2); overflow: hidden; flex: none; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }

.empty { padding: 48px 24px; text-align: center; color: var(--muted); display: grid; justify-items: center; gap: 10px; }
.empty .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--bg); display: grid; place-items: center; color: var(--ink-2); }
.empty b { color: var(--ink); font-size: 15px; }

/* ---------- prices ---------- */
.ctabs { display: flex; gap: 22px; padding: 0 18px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.ctabs button { border: 0; background: none; padding: 13px 0 11px; font: 600 14px var(--font); color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.ctabs button:hover { color: var(--ink); }
.ctabs button.on { color: var(--brand); border-color: var(--brand); }
.ctabs button span { color: var(--faint); font-weight: 500; margin-left: 4px; }
.cat-bar { display: flex; align-items: center; gap: 8px; padding: 10px 18px; background: var(--subtle); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cat-bar .title { flex: 1; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.prod { display: flex; align-items: center; gap: 14px; padding: 10px 18px; border-bottom: 1px solid var(--line-2); }
.prod:last-child { border-bottom: 0; }
.prod:hover { background: var(--subtle); }
.prod .n { flex: 1; min-width: 0; }
.prod .n b { display: block; font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod .n small { color: var(--muted); font-size: 12.5px; }
.prod.off .n b { color: var(--faint); }
.prod .cat-tag { color: var(--faint); font-size: 12.5px; }
.price-input { position: relative; width: 124px; flex: none; }
.price-input span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 12.5px; pointer-events: none; }
.price-input input { padding-left: 34px; text-align: right; font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; height: 38px; }
.price-input input.saved { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.price-input input.failed { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }

/* ---------- offers ---------- */
.offers { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.offer { overflow: hidden; cursor: pointer; transition: box-shadow .15s, transform .15s; display: flex; flex-direction: column; }
.offer:hover { box-shadow: 0 8px 24px rgba(16,24,40,.1); transform: translateY(-1px); }
.offer .thumb { height: 150px; position: relative; display: grid; place-items: center; padding: 14px; background: radial-gradient(circle at 50% 60%, #FFF6A8 0, #FFD400 55%, #FFBF00 100%); }
.offer .thumb img { max-width: 100%; max-height: 122px; object-fit: contain; filter: drop-shadow(0 8px 10px rgba(0,0,0,.2)); }
.offer .thumb .pill { position: absolute; top: 10px; left: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.offer .thumb .pill:not(.ok):not(.warn):not(.bad) { background: #fff; }
.offer .body { padding: 14px 16px; display: grid; gap: 2px; }
.offer .title { font-weight: 600; font-size: 15px; }
.offer .prices { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.offer .price { color: var(--brand); font-weight: 700; font-size: 20px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.offer .old { color: var(--faint); text-decoration: line-through; font-size: 13px; }
.offer .meta { color: var(--muted); font-size: 12.5px; margin-top: 6px; display: flex; gap: 6px; align-items: center; }

/* ---------- screens ---------- */
.pair { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; }
.pair-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.pair-form .field { flex: 1; min-width: 160px; }
.code-input { text-transform: uppercase; letter-spacing: .2em; font-weight: 700; font-size: 18px !important; font-family: ui-monospace, Consolas, monospace !important; }
.screen-row td:first-child { width: 40%; }

/* ---------- settings sections ---------- */
.section { display: grid; grid-template-columns: 280px 1fr; gap: 32px; padding: 24px 0; border-top: 1px solid var(--line); }
.section:first-of-type { border-top: 0; padding-top: 4px; }
.section > div:first-child h3 { font-size: 15px; font-weight: 600; }
.section > div:first-child p { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.section .card-body { display: grid; gap: 16px; }

.image-field { display: flex; gap: 14px; align-items: center; }
.image-field .preview { width: 96px; height: 72px; border-radius: 8px; border: 1px dashed #D5D9E0; background: var(--subtle) center / contain no-repeat; flex: none; display: grid; place-items: center; color: var(--faint); }
.image-field .preview.has svg { display: none; }
.image-field .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.image-field .help { color: var(--muted); font-size: 12.5px; font-weight: 400; margin-top: 4px; }

.weekdays { display: flex; gap: 6px; flex-wrap: wrap; }
.weekdays label { position: relative; }
.weekdays input { position: absolute; opacity: 0; width: 0; height: 0; }
.weekdays span { display: inline-grid; place-items: center; min-width: 46px; height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); font-weight: 600; font-size: 13px; color: var(--ink-2); cursor: pointer; background: var(--surface); }
.weekdays input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.weekdays input:focus-visible + span { box-shadow: 0 0 0 4px var(--brand-soft); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font: 600 13px var(--font); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 8px; height: 32px; padding: 0 12px; cursor: pointer; }
.chip:hover { border-color: #D5D9E0; background: var(--subtle); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- dialog ---------- */
dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(14, 17, 22, .5); backdrop-filter: blur(2px); }
dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.dlg-head { padding: 20px 24px 0; }
.dlg-head h2 { font-size: 18px; letter-spacing: -.01em; color: var(--purple); }
.dlg-head p { color: var(--muted); margin-top: 4px; }
.dlg-body { padding: 18px 24px 4px; display: grid; gap: 16px; overflow-y: auto; }
.dlg-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 16px 24px 20px; margin-top: 8px; border-top: 1px solid var(--line-2); }
.dlg-foot .spacer { flex: 1; }
.dlg-note { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }
.dlg-note svg { color: var(--warn); margin-top: 1px; }
.cred { display: grid; gap: 8px; }
.cred div { display: grid; grid-template-columns: 74px 1fr; align-items: center; gap: 10px; }
.cred span { color: var(--muted); font-size: 13px; font-weight: 600; }
.cred code { background: var(--subtle); border: 1px solid var(--line); padding: 8px 10px; border-radius: 8px; font: 600 14.5px ui-monospace, Consolas, monospace; user-select: all; word-break: break-all; }

/* ---------- toast ---------- */
.snack {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; font-weight: 500;
  display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px);
  animation: snack-in .18s ease-out;
}
.snack svg { stroke: #4ADE80; }
.snack.err svg { stroke: #FCA5A5; }
@keyframes snack-in { from { opacity: 0; transform: translate(-50%, 6px); } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section { grid-template-columns: 1fr; gap: 12px; }
}

@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-form { padding: 28px 20px; min-height: 100vh; }

  .only-m { display: flex !important; }
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .mtop { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between; gap: 10px; height: 56px; padding: 0 12px 0 16px; background: var(--grad); color: #fff; box-shadow: 0 5px 16px rgba(0, 0, 0, .22); }
  .mtop .btn.icon { color: #fff; }
  .mtop .btn.icon:hover { background: rgba(255, 255, 255, .18); color: #fff; }
  .mtop .logo { font-size: 15px; min-width: 0; }
  .mtop .logo span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .content { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); gap: 16px; }
  #bars { padding: 14px 16px 0; }
  .bnav { display: grid; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; grid-template-columns: repeat(var(--n, 4), 1fr); background: var(--surface); border-top: 1px solid var(--line); padding: 6px 0 calc(8px + env(safe-area-inset-bottom)); }
  .bnav a { display: grid; justify-items: center; gap: 3px; padding: 4px 0; font-size: 11px; font-weight: 600; color: var(--faint); text-decoration: none; cursor: pointer; position: relative; }
  .bnav a.on { color: var(--brand); }
  .bnav a .count { position: absolute; top: 0; left: calc(50% + 6px); background: var(--brand); color: #fff; font-size: 10px; border-radius: 99px; padding: 0 5px; line-height: 16px; }
  .snack { bottom: calc(84px + env(safe-area-inset-bottom)); }

  .ph h1 { font-size: 20px; }
  .ph .actions { width: 100%; }
  .ph .actions .btn { flex: 1; }
  .kpi { padding: 14px; }
  .kpi .v { font-size: 22px; }
  .searchbox { max-width: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .pair { grid-template-columns: 1fr; }

  /* tables become stacked cards */
  .table.stack-m thead { display: none; }
  .table.stack-m, .table.stack-m tbody, .table.stack-m tr, .table.stack-m td { display: block; width: 100%; }
  .table.stack-m tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table.stack-m tr:last-child { border-bottom: 0; }
  .table.stack-m td, .table.stack-m .who b, .table.stack-m .who small { white-space: normal; max-width: none; }
  .table.stack-m td { padding: 3px 0; border: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
  .table.stack-m td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; font-weight: 500; text-align: left; }
  .table.stack-m td.lead { padding-bottom: 8px; text-align: left; }
  .table.stack-m td.lead::before { display: none; }
  .table.stack-m td.actions-cell { padding-top: 10px; justify-content: flex-start; flex-wrap: wrap; gap: 6px; width: 100%; }
  .table.stack-m td.actions-cell .btn + .btn { margin-left: 0; }
  .table.stack-m tbody tr:hover td { background: transparent; }

  .prod { padding: 10px 14px; gap: 10px; }
  .price-input { width: 108px; }
  dialog { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  dialog form { max-height: 92vh; }
  .dlg-head { padding: 18px 18px 0; }
  .dlg-body { padding: 16px 18px 4px; }
  .dlg-foot { padding: 14px 18px calc(16px + env(safe-area-inset-bottom)); }
}

/* VinaTV logo */
.login-logo img { height: 78px; width: auto; display: block; }
.logo-pill { display: inline-flex; align-items: center; background: #fff; border-radius: 10px; padding: 7px 13px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.logo-pill img { height: 30px; width: auto; display: block; }
.logo-ico { width: 32px; height: 32px; border-radius: 8px; flex: none; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
@media (max-width: 900px) { .login-logo img { height: 60px; } }

/* login: TV cycles through the segment templates */
.tv .frame.slides { position: relative; }
.tv .frame.slides img { opacity: 0; animation: tv-slide 16s infinite; }
.tv .frame.slides img + img { position: absolute; top: 10px; left: 10px; width: calc(100% - 20px); }
.tv .frame.slides img:nth-child(2) { animation-delay: 4s; }
.tv .frame.slides img:nth-child(3) { animation-delay: 8s; }
.tv .frame.slides img:nth-child(4) { animation-delay: 12s; }
@keyframes tv-slide { 0% { opacity: 0; } 4% { opacity: 1; } 25% { opacity: 1; } 29% { opacity: 0; } 100% { opacity: 0; } }
.tv .frame.slides img:first-child { animation-name: tv-slide-first; }
@keyframes tv-slide-first { 0% { opacity: 1; } 25% { opacity: 1; } 29% { opacity: 0; } 96% { opacity: 0; } 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tv .frame.slides img { animation: none; } .tv .frame.slides img:first-child { opacity: 1; } }
