/* Alliance Max admin panel — design system v2 */
:root {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --surface-3: #F2F4F7;
  --border: #E4E7EC;
  --border-strong: #D0D5DD;
  --text: #101828;
  --text-2: #475467;
  --muted: #8A94A6;
  --brand: #4F46E5;
  --brand-2: #4338CA;
  --brand-soft: #EEF0FF;
  --brand-ring: rgba(79, 70, 229, .18);
  --on-brand: #FFFFFF;
  --green: #12A150;
  --green-soft: #E7F6EC;
  --amber: #C27803;
  --amber-soft: #FEF4E2;
  --red: #D92D20;
  --red-soft: #FEECEB;
  --sky: #0E95D3;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 16px 40px -8px rgba(16, 24, 40, .18);
  --radius: 14px;
  --radius-sm: 10px;
  --font: 'Inter', 'Noto Sans Bengali', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-bn: 'Noto Sans Bengali', 'Inter', system-ui, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', 'Cascadia Mono', Consolas, monospace;
  /* type scale (Bangla glyphs look smaller, so the bn page gets a step up) */
  --fs-2xs: 11.5px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 15px;
  --fs-h1: 24px;
  --lh: 1.55;
  --gap: 20px;
  --tg-bg: #C9D9C3;
  --tg-bubble: #FFFFFF;
  --eprev-outline: drop-shadow(0 0 .6px rgba(15, 23, 42, .75)) drop-shadow(0 0 .6px rgba(15, 23, 42, .45));
  color-scheme: light;
}
html[lang="bn"] {
  --fs-xs: 12.5px;
  --fs-sm: 13.5px;
  --fs-md: 14.5px;
  --fs-lg: 15.5px;
  --lh: 1.6;
}
:root[data-theme="dark"] {
  --bg: #0C111D;
  --surface: #121826;
  --surface-2: #161D2D;
  --surface-3: #1B2336;
  --border: #242D40;
  --border-strong: #323C52;
  --text: #EDF0F7;
  --text-2: #A9B2C5;
  --muted: #727C93;
  --brand: #8B93FA;
  --brand-2: #A5ACFC;
  --brand-soft: rgba(139, 147, 250, .14);
  --brand-ring: rgba(139, 147, 250, .28);
  --on-brand: #0C111D;
  --green: #47CD89;
  --green-soft: rgba(71, 205, 137, .13);
  --amber: #FDB022;
  --amber-soft: rgba(253, 176, 34, .13);
  --red: #F97066;
  --red-soft: rgba(249, 112, 102, .13);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, .6);
  --tg-bg: #0E1621;
  --tg-bubble: #182533;
  --eprev-outline: drop-shadow(0 0 .6px rgba(231, 234, 243, .85)) drop-shadow(0 0 .6px rgba(231, 234, 243, .5));
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: var(--fs-md); line-height: var(--lh); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
b, strong { font-weight: 600; }
code, .mono { font-family: var(--mono); font-size: .88em; }
code { background: var(--surface-3); border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px; color: var(--text); white-space: nowrap; }
.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i-sm { width: 16px; height: 16px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-more { font: 600 var(--fs-sm) var(--font-bn); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
::selection { background: var(--brand-ring); }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 30; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 20px; height: 64px; flex: none; }
.brand__logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #4F46E5, #7C3AED); display: grid; place-items: center; color: #fff; flex: none; box-shadow: 0 4px 10px -2px rgba(79, 70, 229, .45); }
.brand__name { font-weight: 700; font-size: 15px; line-height: 1.2; letter-spacing: -.01em; }
.brand__sub { font-size: var(--fs-xs); color: var(--muted); font-family: var(--font-bn); line-height: 1.3; }
.nav { padding: 4px 12px 12px; overflow-y: auto; flex: 1; }
.nav__group { font: 600 var(--fs-2xs) var(--font-bn); color: var(--muted); padding: 18px 12px 6px; }
.nav a { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 12px; margin: 1px 0; border-radius: 9px; color: var(--text-2); font: 500 var(--fs-md) var(--font-bn); line-height: 1.45; }
.nav a .i { color: var(--muted); }
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a:hover .i { color: var(--text-2); }
.nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav a.on .i { color: var(--brand); }
.nav a.on::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav .count { margin-left: auto; font: 600 11px var(--font); background: var(--surface-3); color: var(--text-2); border-radius: 99px; padding: 0 8px; line-height: 20px; font-variant-numeric: tabular-nums; }
.nav a.on .count { background: var(--surface); color: var(--brand); }
.side-foot { margin: 12px; padding: 10px 10px 10px 12px; border: 1px solid var(--border); border-radius: 12px; display: flex; align-items: center; gap: 10px; background: var(--surface-2); }
.side-foot b { display: block; font-size: 13.5px; line-height: 1.3; }
.side-foot small { color: var(--muted); font-size: var(--fs-xs); font-family: var(--font-bn); }
.side-foot .icon-btn { margin-left: auto; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 32px; background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.crumbs { display: flex; align-items: center; gap: 8px; font: 500 var(--fs-sm) var(--font-bn); color: var(--muted); min-width: 0; }
.crumbs b { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { opacity: .6; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.menu-btn { display: none !important; }
.botchip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 10px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: 500 var(--fs-sm) var(--font); white-space: nowrap; text-decoration: none !important; }
.botchip:hover { border-color: var(--border-strong); color: var(--text); }
.botchip .dot { color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.lang-switch { display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: 600 13px var(--font-bn); text-decoration: none !important; white-space: nowrap; }
.lang-switch:hover { color: var(--brand); border-color: var(--brand); }
.lang-switch--corner { position: fixed; top: 16px; right: 16px; z-index: 5; }
.content { padding: 28px 32px 56px; width: 100%; max-width: 1360px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font: 700 var(--fs-h1)/1.3 var(--font-bn); letter-spacing: -.015em; }
.page-head p { margin: 4px 0 0; color: var(--text-2); font: var(--fs-md)/1.55 var(--font-bn); max-width: 720px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.scrim { display: none; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 600 var(--fs-sm) var(--font-bn); cursor: pointer; box-shadow: var(--shadow-xs); white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s, box-shadow .12s, color .12s; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible, .input:focus-visible, .icon-btn:focus-visible, .seg a:focus-visible { outline: 3px solid var(--brand-ring); outline-offset: 1px; }
.btn--primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 1px 2px rgba(16, 24, 40, .1), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn--primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn--danger { color: var(--red); }
.btn--danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn--danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn--danger-solid:hover { background: var(--red); filter: brightness(1.08); }
.btn--ghost { box-shadow: none; border-color: transparent; background: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-3); color: var(--text); border-color: transparent; }
.btn--sm { height: 32px; padding: 0 11px; font-size: var(--fs-xs); border-radius: 8px; gap: 6px; }
.btn--block { width: 100%; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; flex: none; transition: background .12s, color .12s, border-color .12s; }
.icon-btn:hover { color: var(--text); background: var(--surface-3); }
.icon-btn--sm { width: 32px; height: 32px; border-radius: 8px; }
.icon-btn--ghost { border-color: transparent; background: transparent; }
.icon-btn--danger:hover { color: var(--red); background: var(--red-soft); border-color: transparent; }
form.inline { display: inline-flex; margin: 0; }

.field { margin-bottom: 16px; }
.label { display: block; font: 600 var(--fs-sm) var(--font-bn); color: var(--text); margin-bottom: 6px; }
.label .muted { font-weight: 400; }
.help .i { vertical-align: -3px; margin-right: 2px; }
.help { font-size: var(--fs-xs); line-height: 1.55; color: var(--muted); margin-top: 6px; font-family: var(--font-bn); }
.input, .select, .textarea { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: var(--fs-md) var(--font); outline: none; box-shadow: var(--shadow-xs); transition: border-color .12s, box-shadow .12s; }
.textarea { height: auto; min-height: 110px; padding: 10px 12px; line-height: 1.65; resize: vertical; font-family: var(--font-bn); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.input:disabled { background: var(--surface-3); color: var(--text-2); }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A94A6' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }
.input--emoji { font-size: 18px; text-align: center; }
input[type=file].input { padding: 7px 10px; height: auto; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--muted); box-shadow: var(--shadow-xs); }
.search input { border: 0; outline: 0; background: transparent; color: var(--text); font: var(--fs-md) var(--font); width: 100%; min-width: 0; }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font: 500 var(--fs-md) var(--font-bn); user-select: none; position: relative; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { width: 40px; height: 22px; border-radius: 99px; background: var(--border-strong); position: relative; transition: background .15s; flex: none; }
.switch__track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(16, 24, 40, .25); transition: transform .15s; }
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 3px solid var(--brand-ring); outline-offset: 1px; }
.switch--sm .switch__track { width: 34px; height: 20px; }
.switch--sm .switch__track::after { width: 14px; height: 14px; }
.switch--sm input:checked + .switch__track::after { transform: translateX(14px); }
.switch--sm { font-size: var(--fs-sm); gap: 8px; }
.switch__text { color: var(--text-2); }
.switch input:checked ~ .switch__text { color: var(--text); }

/* segmented */
.seg { display: inline-flex; background: var(--surface-3); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; max-width: 100%; }
.seg a, .seg label { border: 0; background: transparent; color: var(--text-2); font: 600 var(--fs-sm) var(--font-bn); padding: 6px 13px; border-radius: 8px; cursor: pointer; text-decoration: none !important; white-space: nowrap; line-height: 1.4; }
.seg a:hover { color: var(--text); }
.seg a.on, .seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg label { padding: 0; }
.seg label span { display: block; padding: 6px 13px; border-radius: 8px; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg .muted { font-weight: 500; margin-left: 2px; font-variant-numeric: tabular-nums; }
.tabs-row { margin-bottom: 18px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); min-width: 0; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; flex-wrap: wrap; }
.card__head--bordered { padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.card__title { font: 600 var(--fs-lg)/1.4 var(--font-bn); color: var(--text); }
.card__sub { font: var(--fs-xs)/1.5 var(--font-bn); color: var(--muted); margin-top: 1px; }
.card__body { padding: 18px 20px 20px; }
.card__foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card--fill { display: flex; flex-direction: column; }
.card--fill > .card__body, .card--fill > .table-wrap { flex: 1; }
.stack > * + * { margin-top: var(--gap); }
.grid { display: grid; gap: var(--gap); }
.mt { margin-top: var(--gap); }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.split-3-2 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.split-main-side { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.cards-auto { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.kpi { padding: 20px; }
.kpi__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi__label { color: var(--text-2); font: 500 var(--fs-sm) var(--font-bn); }
.kpi__icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.kpi__value { font-size: 30px; font-weight: 700; letter-spacing: -.025em; margin-top: 8px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi__foot { margin-top: 8px; font-size: var(--fs-xs); color: var(--muted); display: flex; gap: 6px; align-items: center; font-family: var(--font-bn); flex-wrap: wrap; }
.up { color: var(--green); font-weight: 600; }
.down { color: var(--red); font-weight: 600; }
.delta { display: inline-flex; align-items: center; padding: 0 7px; border-radius: 99px; font: 600 var(--fs-2xs)/20px var(--font); }
.delta.up { background: var(--green-soft); }
.delta.down { background: var(--red-soft); }
.t-brand { background: var(--brand-soft); color: var(--brand); }
.t-green { background: var(--green-soft); color: var(--green); }
.t-amber { background: var(--amber-soft); color: var(--amber); }
.t-red { background: var(--red-soft); color: var(--red); }
.t-gray { background: var(--surface-3); color: var(--text-2); }
.t-sky { background: rgba(14, 149, 211, .1); color: var(--sky); }

.badge { display: inline-flex; align-items: center; gap: 6px; font: 600 var(--fs-2xs) var(--font-bn); padding: 1px 9px; border-radius: 99px; white-space: nowrap; line-height: 21px; }
.badge .i { width: 13px; height: 13px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-xs); font-weight: 500; padding: 4px 11px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); white-space: nowrap; }
.pill .dot { color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

/* chart */
.legend { display: flex; gap: 18px; font-size: var(--fs-xs); color: var(--text-2); font-family: var(--font-bn); flex-wrap: wrap; margin-bottom: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.dash { width: 16px; height: 0; border-top: 2px dashed var(--muted); border-radius: 0; }
.chart { width: 100%; height: 260px; display: block; }
.chart .gridline { stroke: var(--border); stroke-dasharray: 3 4; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }

/* checklist */
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #4F46E5, #7C3AED); }
.checklist { list-style: none; margin: 14px 0 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); }
.checklist li:first-child { border-top: 0; }
.tick { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.tick.done { background: var(--green); color: #fff; }
.tick.todo { border: 2px solid var(--border-strong); }
.checklist .txt { flex: 1; min-width: 0; font-family: var(--font-bn); }
.checklist .txt b { font-weight: 600; display: block; font-size: var(--fs-sm); line-height: 1.4; }
.checklist .txt small { color: var(--muted); font-size: var(--fs-xs); }
.checklist li.is-done b { color: var(--text-2); }
.done-hero { display: flex; gap: 14px; align-items: center; padding: 4px 0 6px; }
.done-hero .kpi__icon { width: 46px; height: 46px; border-radius: 50%; }
.done-hero b { display: block; font: 600 var(--fs-lg) var(--font-bn); }
.done-hero small { color: var(--text-2); font: var(--fs-xs) var(--font-bn); }
.mini-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.mini-stats > div { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.mini-stats b { display: block; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.mini-stats span { color: var(--muted); font: var(--fs-xs) var(--font-bn); }
.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick a { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); background: var(--surface-2); text-decoration: none !important; transition: border-color .12s, background .12s, transform .12s; }
.quick a > .i { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.quick a:hover { border-color: var(--brand); background: var(--surface); transform: translateY(-1px); }
.quick b { display: block; font: 600 var(--fs-sm)/1.4 var(--font-bn); }
.quick small { color: var(--muted); font: var(--fs-xs)/1.45 var(--font-bn); }
.setup-ok { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding: 10px 12px; border-radius: 10px; background: var(--green-soft); color: var(--green); font: 600 var(--fs-xs) var(--font-bn); }
details.more > summary { cursor: pointer; list-style: none; color: var(--brand); font: 600 var(--fs-sm) var(--font-bn); margin-top: 14px; display: inline-flex; gap: 6px; align-items: center; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { margin-bottom: 4px; }

/* table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font: 600 var(--fs-xs) var(--font-bn); color: var(--text-2); padding: 11px 20px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 14px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.is-off td > * { opacity: .6; }
.table tr.is-off td.keep > * { opacity: 1; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.table .col-switch { width: 1%; white-space: nowrap; }
.card > .table-wrap:first-child .table th:first-child { border-top-left-radius: var(--radius); }
.card > .table-wrap:first-child .table th:last-child { border-top-right-radius: var(--radius); }
.card > .card__head--bordered + .table-wrap .table th { border-top: 0; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who > div:last-child { min-width: 0; }
.who b { font: 600 var(--fs-md)/1.35 var(--font-bn); display: block; }
.who small { color: var(--muted); font-size: var(--fs-xs); display: block; line-height: 1.45; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; color: #fff; flex: none; text-transform: uppercase; }
.num { font-variant-numeric: tabular-nums; font-weight: 600; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-3); width: 80px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 10px; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.rank { width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--text-2); }
.rank.r1 { background: #FEF0C7; color: #B54708; }
.rank.r2 { background: #EAECF0; color: #475467; }
.rank.r3 { background: #FDEAD7; color: #B93815; }

/* lists */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); align-items: flex-start; }
.feed li:first-child { border-top: 0; padding-top: 0; }
.feed .fi { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.feed p { margin: 0; font: var(--fs-sm)/1.5 var(--font-bn); }
.feed time { font-size: var(--fs-xs); color: var(--muted); font-family: var(--font-bn); }
.row-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.row-item:first-child { border-top: 0; padding-top: 0; }
.row-item__main { flex: 1; min-width: 0; }
.row-item__main b { font: 600 var(--fs-md)/1.4 var(--font-bn); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item__main small { color: var(--muted); font-size: var(--fs-xs); font-family: var(--font-bn); }
.ic-box { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); font-size: 18px; flex: none; overflow: hidden; }
.task-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.task-tile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); min-width: 0; }

.empty { text-align: center; padding: 44px 20px; color: var(--text-2); font-family: var(--font-bn); }
.empty .ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--brand-soft); color: var(--brand); }
.empty b { display: block; color: var(--text); font-size: var(--fs-lg); margin-bottom: 4px; }
.empty p { margin: 0 auto 18px; max-width: 420px; font-size: var(--fs-sm); }

.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; font: 500 var(--fs-sm)/1.55 var(--font-bn); margin-bottom: var(--gap); border: 1px solid transparent; }
.note .i { margin-top: 2px; }
.note--info { background: var(--brand-soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 18%, transparent); }
.note--warn { background: var(--amber-soft); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 22%, transparent); }
.note--danger { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 20%, transparent); }
.note a { color: inherit; text-decoration: underline; font-weight: 600; }

/* premium emoji preview pictures. "Adaptive" premium emoji are pure white or black
   (Telegram tints them with the text colour), so every picture gets a thin outline. */
.eprev { width: 28px; height: 28px; object-fit: contain; display: block; }
.eprev--lg { width: 44px; height: 44px; }
.eprev, .emoji-grid button img, .pe-img { filter: var(--eprev-outline); }

/* ---------- dialogs (drawer + modal) ---------- */
dialog { border: 0; padding: 0; color: var(--text); background: var(--surface); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(16, 24, 40, .5); backdrop-filter: blur(3px); }
dialog.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; height: 100%; max-height: 100%; width: min(540px, 100vw); border-left: 1px solid var(--border); }
dialog.drawer[open] { display: flex; flex-direction: column; animation: slide .2s ease-out; }
dialog.modal { width: min(440px, calc(100vw - 32px)); border-radius: 16px; }
dialog.modal[open] { animation: pop .15s ease-out; }
@keyframes slide { from { transform: translateX(28px); opacity: .4; } }
@keyframes pop { from { transform: scale(.97); opacity: .4; } }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.dlg-head h2 { font: 600 var(--fs-lg) var(--font-bn); }
.dlg-body { padding: 22px; overflow-y: auto; flex: 1; }
.dlg-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; align-items: center; background: var(--surface-2); }
dialog.modal .dlg-foot { border-radius: 0 0 16px 16px; }
.dlg-foot .spacer { margin-right: auto; }
.modal .dlg-body { font-family: var(--font-bn); }
.modal-ic { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 14px; }

/* toast */
.toasts { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: flex-start; gap: 10px; background: #101828; color: #F9FAFB; padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow-lg); font: 500 var(--fs-sm) var(--font-bn); max-width: 460px; animation: toast-in .2s ease-out; }
:root[data-theme="dark"] .toast { background: #EDF0F7; color: #101828; }
.toast .tick { width: 20px; height: 20px; margin-top: 1px; }
.toast--bad .tick { background: var(--red); color: #fff; }
.toast--ok .tick { background: var(--green); color: #fff; }
.toast button { margin-left: 6px; background: transparent; border: 0; color: inherit; opacity: .6; cursor: pointer; padding: 0; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

/* ---------- telegram preview ---------- */
.side-label { display: flex; align-items: center; gap: 6px; font: 600 var(--fs-xs) var(--font-bn); color: var(--muted); margin: 0 0 10px 4px; }
.phone { border-radius: 28px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; }
.phone__bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.phone__bar b { display: block; font-size: 14px; line-height: 1.25; }
.phone__bar small { color: var(--sky); font-size: 12px; }
.chat { background: var(--tg-bg); min-height: 380px; padding: 16px 12px; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; background-image: radial-gradient(rgba(255,255,255,.18) 1px, transparent 1px); background-size: 14px 14px; }
.bubble { align-self: flex-start; max-width: 94%; background: var(--tg-bubble); color: var(--text); border-radius: 14px 14px 14px 4px; padding: 8px 11px 6px; font: 14px/1.5 var(--font-bn); box-shadow: 0 1px 1px rgba(0,0,0,.08); white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble code { background: transparent; border: 0; padding: 0; color: var(--brand); white-space: pre-wrap; }
.bubble blockquote { margin: 2px 0; padding: 2px 8px; border-left: 3px solid var(--brand); background: var(--brand-soft); border-radius: 4px; }
.bubble a { color: var(--sky); }
.bubble .meta { float: right; font-size: 11px; color: var(--muted); margin: 6px 0 0 10px; }
.bubble .ph { color: var(--muted); font-style: italic; }
.bubble .pe-img, .tg-btn .pe-img { width: 1.25em; height: 1.25em; vertical-align: -0.28em; display: inline-block; object-fit: contain; }
.alert-pop { align-self: center; background: rgba(0,0,0,.72); color: #fff; border-radius: 12px; padding: 10px 14px; font: 13.5px var(--font-bn); max-width: 90%; text-align: center; }
.ikb { display: grid; gap: 4px; max-width: 94%; }
.ikb:empty { display: none; }
.kb-row { display: flex; gap: 4px; }
.tg-btn { flex: 1; min-width: 0; border: 0; border-radius: 9px; padding: 8px 6px; font: 600 13px var(--font-bn); color: #fff; background: rgba(0,0,0,.28); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-btn.success { background: #2FAE5A; }
.tg-btn.primary { background: #3390EC; }
.tg-btn.danger { background: #E5484D; }
.replykb { background: var(--surface); border-top: 1px solid var(--border); padding: 8px; display: grid; gap: 6px; }
.replykb .tg-btn { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.replykb .tg-btn.primary { color: #3390EC; }
.replykb .tg-btn.success { color: #2FAE5A; }
.replykb .tg-btn.danger { color: #E5484D; }
.media-fallback { display: flex; gap: 10px; align-items: center; padding: 10px 11px 0; }

/* message editor */
.editor { display: grid; grid-template-columns: 250px minmax(0, 1fr) 340px; gap: var(--gap); align-items: start; }
.keylist { padding: 8px; max-height: calc(100vh - 120px); overflow-y: auto; position: sticky; top: 84px; }
.keylist .grp { font: 600 var(--fs-2xs) var(--font-bn); color: var(--muted); padding: 12px 10px 4px; }
.keylist .grp:first-child { padding-top: 6px; }
.keylist a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--text-2); font: 500 var(--fs-sm)/1.45 var(--font-bn); }
.keylist a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.keylist a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.keypick { display: none; gap: 8px; align-items: center; }
.keypick .select { flex: 1; min-width: 0; }
.toolbar { display: flex; gap: 2px; flex-wrap: wrap; padding: 6px; border: 1px solid var(--border-strong); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--surface-2); align-items: center; }
.toolbar + .textarea { border-radius: 0 0 10px 10px; min-height: 220px; box-shadow: none; }
.tb { height: 30px; min-width: 32px; padding: 0 8px; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; font: 700 13px var(--font); }
.tb:hover { background: var(--surface); border-color: var(--border); color: var(--text); }
.tb-sep { width: 1px; height: 18px; background: var(--border-strong); margin: 0 6px; }
.toolbar .card__sub { margin: 0 4px 0 0; }
.toolbar .tb-end { margin-left: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 11px; border-radius: 99px; border: 1px dashed var(--border-strong); background: var(--surface); color: var(--text-2); font: var(--fs-xs) var(--mono); cursor: pointer; }
.chip:hover { border-color: var(--brand); color: var(--brand); border-style: solid; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 5px; }
.emoji-grid button { aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: 18px; cursor: pointer; position: relative; display: grid; place-items: center; padding: 4px; }
.emoji-grid button:hover { border-color: var(--brand); background: var(--brand-soft); }
.emoji-grid button img { width: 100%; height: 100%; object-fit: contain; }
.emoji-grid button.prem::after { content: ''; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.sticky-side { position: sticky; top: 84px; }
.sub-block { margin-top: 20px; }
.sub-block > .label { margin-bottom: 8px; }
.epick { border: 1px solid var(--border-strong); border-radius: 12px; overflow: hidden; }
.epick__bar { display: flex; flex-direction: column; gap: 8px; padding: 8px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.epick__search { height: 36px; box-shadow: none; }
.epick__tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; }
.epick__tabs button { flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 99px; padding: 3px 12px; font: 500 var(--fs-xs) var(--font-bn); cursor: pointer; }
.epick__tabs button:hover { border-color: var(--brand); color: var(--brand); }
.epick__tabs button.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.epick__grid { max-height: 196px; overflow-y: auto; padding: 8px; }
.epick__empty { padding: 0 10px 10px; }

/* settings rows */
.set-list > .set-row + .set-row { border-top: 1px solid var(--border); }
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: 12px 32px; padding: 18px 20px; align-items: center; }
.set-row--top { align-items: start; }
.set-row--wide { grid-template-columns: minmax(0, 1fr); }
.set-row__title { font: 600 var(--fs-md)/1.45 var(--font-bn); }
.set-row__help { font: var(--fs-xs)/1.6 var(--font-bn); color: var(--muted); margin-top: 3px; }
.set-row__control { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.set-row__control .input { max-width: 200px; }
.input-suffix { display: flex; align-items: center; gap: 8px; color: var(--muted); font: var(--fs-sm) var(--font-bn); white-space: nowrap; }
.mode-list { display: grid; gap: 8px; margin-top: 4px; }
.mode-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 12px; cursor: pointer; transition: border-color .12s, background .12s; }
.mode-opt:hover { border-color: var(--brand); }
.mode-opt input { margin: 3px 0 0; accent-color: var(--brand); width: 16px; height: 16px; flex: none; }
.mode-opt b { display: block; font: 600 var(--fs-sm) var(--font-bn); }
.mode-opt small { color: var(--muted); font: var(--fs-xs)/1.5 var(--font-bn); }
.mode-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand) inset; }
.sec-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.sec-head { display: flex; gap: 12px; align-items: center; }
.savebar { position: sticky; bottom: 16px; z-index: 10; margin-top: var(--gap); display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 12px 14px 12px 18px; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); box-shadow: var(--shadow-lg); }
.savebar__msg { margin-right: auto; font: 500 var(--fs-sm) var(--font-bn); color: var(--muted); display: flex; align-items: center; gap: 8px; }
.savebar.is-dirty .savebar__msg { color: var(--amber); }
.savebar.is-dirty .savebar__msg .dot { color: var(--amber); }
.savebar .dot { color: var(--green); }

/* catalog grid */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.cat-item { margin: 0; }
.cat-item button { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; color: var(--text-2); font: 11.5px var(--font); transition: border-color .12s, box-shadow .12s, transform .12s; }
.cat-item button:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); transform: translateY(-1px); }
.cat-item button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-item .current { border-color: var(--brand); background: var(--brand-soft); }

/* class / year chips */
.ychips { display: flex; flex-wrap: wrap; gap: 8px; }
.ychip { display: flex; min-width: 108px; align-items: stretch; border: 1px solid var(--border-strong); border-radius: 11px; overflow: hidden; background: var(--surface); transition: border-color .12s; }
.ychip:hover { border-color: var(--brand); }
.ychip form:first-child { flex: 1; min-width: 0; }
.ychip__main { width: 100%; display: flex; flex-direction: column; align-items: flex-start; padding: 7px 10px; border: 0; background: transparent; cursor: pointer; color: var(--text); font: 14px var(--font); line-height: 1.3; text-align: left; }
.ychip__main b { font-weight: 700; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px; }
.ychip__main b .dot { color: var(--green); }
.ychip__main span { font: var(--fs-2xs) var(--font-bn); color: var(--muted); }
.ychip__main:hover { background: var(--brand-soft); }
.ychip__x { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 8px; display: grid; place-items: center; }
.ychip__x:hover { color: var(--red); background: var(--red-soft); }
.ychip.off { border-style: dashed; background: var(--surface-2); }
.ychip.off .ychip__main b { color: var(--muted); }
.ychip.off .ychip__main b .dot { color: var(--border-strong); }
.add-inline { display: flex; gap: 8px; }
.add-inline .input { height: 36px; }
.add-inline .btn { height: 36px; }
.aud-box { border: 1px solid var(--border-strong); border-radius: 12px; padding: 10px 12px; max-height: 260px; overflow-y: auto; }
.aud-cat { padding: 8px 0; border-top: 1px solid var(--border); }
.aud-cat:first-child { border-top: 0; padding-top: 0; }
.aud-cat > label { font-weight: 600; }
.aud-years { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 4px 0 0 24px; }
.check { display: inline-flex; align-items: center; gap: 8px; font: var(--fs-sm) var(--font-bn); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); flex: none; }
.target-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.target { display: flex; gap: 10px; align-items: center; border: 1px solid var(--border-strong); border-radius: 12px; padding: 10px 12px; cursor: pointer; min-width: 0; transition: border-color .12s, background .12s; }
.target:hover { border-color: var(--brand); }
.target:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.target input { width: 16px; height: 16px; accent-color: var(--brand); flex: none; }
.target b { display: block; font: 600 var(--fs-sm) var(--font-bn); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.target small { color: var(--muted); font: var(--fs-xs) var(--font-bn); }

/* group / channel cards (posts) */
.chat-card { display: flex; flex-direction: column; color: var(--text); text-decoration: none !important; transition: border-color .12s, box-shadow .12s, transform .12s; }
.chat-card:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); transform: translateY(-1px); }
.chat-card__top { display: flex; gap: 12px; align-items: center; padding: 18px; color: var(--muted); flex: 1; }
.chat-card__top b { display: block; color: var(--text); font: 600 var(--fs-lg)/1.4 var(--font-bn); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-card__top small { font: var(--fs-xs) var(--font-bn); color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.chat-card__stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.chat-card__stats > div { padding: 12px 16px; border-left: 1px solid var(--border); min-width: 0; }
.chat-card__stats > div:first-child { border-left: 0; }
.chat-card__stats b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-card__stats span { font: var(--fs-2xs) var(--font-bn); color: var(--muted); }

/* reward cards */
.reward-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--gap); }
.reward { display: flex; flex-direction: column; }
.reward.is-off .reward__top, .reward.is-off .reward__meta { opacity: .6; }
.reward__top { display: flex; gap: 12px; padding: 18px 18px 12px; align-items: flex-start; }
.reward__ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.reward__title { font: 600 var(--fs-md)/1.4 var(--font-bn); }
.reward__meta { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 18px 16px; }
.reward__foot { margin-top: auto; border-top: 1px solid var(--border); padding: 10px 12px 10px 18px; display: flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.reward__cost { font-weight: 700; font-size: 17px; margin-right: auto; font-variant-numeric: tabular-nums; }
.reward__cost small { font: 500 var(--fs-xs) var(--font-bn); color: var(--muted); }

.danger-zone { border-color: color-mix(in srgb, var(--red) 30%, var(--border)); }
.danger-zone .card__title { color: var(--red); }
.danger-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.dropzone { border: 2px dashed var(--border-strong); border-radius: 12px; padding: 20px; text-align: center; color: var(--text-2); font-family: var(--font-bn); cursor: pointer; display: block; transition: border-color .12s, background .12s; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone input { display: none; }
.dropzone b { display: block; color: var(--text); font-size: var(--fs-sm); margin-top: 4px; }
.file-row { display: flex; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface-2); }

.pager { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--border); font: var(--fs-sm) var(--font-bn); flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.filters .search { flex: 1 1 260px; }
.filters .select { width: auto; min-width: 150px; }
.toolbar-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }

/* login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 50% -10%, var(--brand-soft), transparent), var(--bg); position: relative; }
.auth-card { width: min(400px, 100%); padding: 32px; box-shadow: var(--shadow-lg); }
.auth-card .brand__logo { width: 46px; height: 46px; border-radius: 13px; margin-bottom: 18px; }
.auth-card h1 { font: 700 22px var(--font-bn); }
.auth-card p { color: var(--text-2); margin: 4px 0 24px; font-family: var(--font-bn); }

/* ---------- responsive ---------- */
@media (max-width: 1440px) {
  .editor { grid-template-columns: minmax(0, 1fr) 340px; }
  .editor .keylist { display: none; }
  .keypick { display: flex; }
}
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-main-side { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 1080px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .editor .phone-col { max-width: 420px; }
  .sticky-side { position: static; }
}
@media (max-width: 960px) {
  .split-2-1, .split-3-2, .split-main-side { grid-template-columns: minmax(0, 1fr); }
  .split-main-side > .sticky-side { max-width: 420px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 25; }
  .menu-btn { display: inline-grid !important; }
  .topbar { padding: 0 20px; }
  .content { padding: 24px 20px 48px; }
  .set-row { grid-template-columns: minmax(0, 1fr); }
  .set-row__control { justify-content: flex-start; }
}
@media (max-width: 640px) {
  :root, html[lang="bn"] { --gap: 14px; --fs-h1: 21px; }
  .topbar { padding: 0 12px; gap: 8px; height: 58px; }
  .crumbs .crumb-group, .crumbs .sep { display: none; }
  .botchip { padding: 0 10px; }
  .botchip .bot-name { display: none; }
  .content { padding: 18px 14px 40px; }
  .page-head { margin-bottom: 18px; align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions > * { flex: 1; }
  .kpi { padding: 14px; }
  .kpi__value { font-size: 24px; }
  .kpi__icon { width: 34px; height: 34px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .hide-sm { display: none !important; }
  .btn-label-sm { display: none; }
  .card__head { padding: 16px 16px 0; }
  .card__head--bordered { padding-bottom: 14px; }
  .card__body { padding: 16px; }
  .card__foot { padding: 12px 16px; }
  .seg { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .filters { padding: 12px; }
  .filters .search { flex-basis: 100%; }
  .filters .select { flex: 1; min-width: 0; }
  .set-row { padding: 16px; }
  .savebar { bottom: 10px; }
  .savebar__msg { display: none; }
  .savebar .btn { flex: 1; }
  /* tables become stacked cards on phones */
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody { display: block; }
  .table--stack tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .table--stack tbody tr:last-child { border-bottom: 0; }
  .table--stack td { display: block; padding: 0; border: 0; }
  .table--stack td:first-child, .table--stack td:has(> .who) { flex: 1 1 100%; min-width: 0; }
  .table--stack td[data-label]::before { content: attr(data-label) ' '; color: var(--muted); font: var(--fs-xs) var(--font-bn); }
  .table--stack td.col-actions { margin-left: auto; }
  .table--stack td.col-switch { width: auto; }
  .table--stack .who { align-items: flex-start; }
  .chat-card__stats > div { padding: 10px 12px; }
  .toasts { right: 12px; left: 12px; bottom: 12px; }
  .toast { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- top referrers ---------- */
.table tr.row-warn td { background: color-mix(in srgb, var(--amber) 7%, transparent); }
.flags { display: flex; flex-wrap: wrap; gap: 4px; }
.day-nav { display: flex; gap: 8px; align-items: center; }
.day-nav .input { width: auto; min-width: 150px; }
.page-actions.day-nav > .btn { flex: 0 0 auto; }
.tips { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font: var(--fs-sm)/1.6 var(--font-bn); color: var(--text-2); }
.btn.is-disabled { pointer-events: none; opacity: .45; }
@media (max-width: 640px) {
  .day-nav { width: 100%; }
  .day-nav .input { flex: 1; min-width: 0; }
  .table--stack tr.row-warn { background: color-mix(in srgb, var(--amber) 7%, transparent); }
  .table--stack tr.row-warn td { background: none; }
}

/* ---------- quiz ---------- */
.opt-row { display: grid; grid-template-columns: 22px 30px minmax(0, 1fr); align-items: center; gap: 10px; margin-bottom: 8px; padding: 6px 10px 6px 12px; border: 1px solid var(--border); border-radius: var(--r-md, 10px); background: var(--surface); cursor: pointer; }
.opt-row:has(input[type="radio"]:checked) { border-color: var(--green); background: color-mix(in srgb, var(--green) 7%, var(--surface)); }
.opt-row input[type="radio"] { width: 18px; height: 18px; accent-color: var(--green); margin: 0; }
.opt-letter { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); font: 600 var(--fs-sm) var(--font-bn); color: var(--text-2); }
.opt-row:has(input[type="radio"]:checked) .opt-letter { background: var(--green); color: #fff; }
.qtext { font: 500 var(--fs-sm)/1.55 var(--font-bn); white-space: pre-line; overflow-wrap: anywhere; }
dialog.modal.modal--wide { width: min(720px, calc(100vw - 32px)); }

/* ---------- settings: jump to a section ---------- */
.set-nav { position: sticky; top: 64px; z-index: 5; display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; padding: 8px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--border); border-radius: 12px; }
.set-nav a { padding: 5px 12px; border-radius: 99px; font: 600 var(--fs-xs) var(--font-bn); color: var(--text-2); text-decoration: none; }
.set-nav a:hover { background: var(--surface-3); color: var(--text); }
.set-nav + .stack > .card { scroll-margin-top: 130px; }
@media (max-width: 640px) { .set-nav { flex-wrap: nowrap; overflow-x: auto; top: 56px; } .set-nav a { white-space: nowrap; } }
