/* =========================================================
   KATNI MSW UCCMS – Prototype styles
   ========================================================= */
:root {
  --brand: #0b5d4b;
  --brand-strong: #084638;
  --brand-soft: #e3f1ec;
  --accent: #e8891d;
  --accent-soft: #fdf1e2;
  --side-bg: #0f2e27;
  --side-ink: #cfe3dc;
  --side-muted: #8fb0a6;
  --side-active: #18473c;

  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --ink: #1b2421;
  --ink-2: #4c5753;
  --muted: #7a8581;
  --border: #dfe5e2;
  --border-strong: #c7d0cc;

  --info: #2a78d6;
  --info-soft: #e8f1fc;
  --success: #0e7a52;
  --success-soft: #e2f4ec;
  --warning: #9a6200;
  --warning-soft: #fdf3dc;
  --danger: #c23434;
  --danger-soft: #fbe9e9;

  /* chart chrome (dataviz reference palette) */
  --chart-1: #2a78d6;
  --chart-grid: #e1e0d9;
  --chart-axis: #898781;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 40, 32, .06), 0 2px 8px rgba(16, 40, 32, .05);
  --shadow-lg: 0 10px 40px rgba(16, 40, 32, .18);
  --font: "Segoe UI", system-ui, -apple-system, "Noto Sans", "Noto Sans Devanagari", "Nirmala UI", "Kohinoor Devanagari", "Mangal", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--brand); }
a.btn { text-decoration: none; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-size: 12px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }

/* bilingual helpers */
.hi { display: block; font-size: .8em; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.hi-inline { font-weight: 400; opacity: .85; }
th .hi { font-size: 10.5px; margin-top: 1px; }

/* =================== Buttons =================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #cf7613; border-color: #cf7613; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a52828; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12px; }
.btn-icon { width: 36px; padding: 0; font-size: 16px; }
.btn-block { width: 100%; height: 42px; font-size: 14px; }
.btn-sms { background: var(--info-soft); border-color: #bcd5f5; color: #1d5ea9; }
.btn-sms:hover { background: #d6e7fb; border-color: #8db8ee; }
.btn-link { background: none; border: 0; color: var(--brand); padding: 0; height: auto; font-weight: 600; cursor: pointer; font: inherit; }
.icon-btn { background: none; border: 1px solid transparent; border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font-size: 14px; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); border-color: #f1c4c4; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; color: var(--ink-2);
}
.chip:hover { border-color: var(--brand); color: var(--brand); }

/* =================== Badges =================== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--info-soft); color: #1d5ea9; }
.badge-neutral { background: #eef1f0; color: var(--ink-2); }
.badge-brand { background: var(--brand-soft); color: var(--brand); }

.proto-chip {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  color: var(--accent); background: var(--accent-soft); border: 1px dashed var(--accent);
  border-radius: 999px; padding: 3px 10px; margin-bottom: 14px;
}
.proto-chip-sm { margin: 0; }

/* =================== Login =================== */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art {
  background:
    radial-gradient(circle at 15% 20%, rgba(232,137,29,.18), transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(255,255,255,.08), transparent 45%),
    linear-gradient(150deg, #0b5d4b 0%, #0f2e27 100%);
  color: #fff; display: flex; align-items: center; justify-content: center; padding: 48px;
}
.login-art-inner { max-width: 460px; }
.login-logo { width: 84px; height: 84px; margin-bottom: 18px; }
.login-art h1 { font-size: 30px; font-weight: 700; }
.login-art .hi-big { font-size: 20px; margin: 4px 0 0; color: #f6c27f; }
.login-divider { width: 64px; height: 3px; background: var(--accent); margin: 22px 0; border-radius: 2px; }
.login-art h2 { font-size: 20px; letter-spacing: .04em; }
.login-art p { color: #d6ebe4; margin: 6px 0 0; }
.login-art .hi { color: #a9cfc3; font-size: 13px; }
.login-points { margin: 24px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.login-points li { padding-left: 24px; position: relative; color: #e7f3ef; }
.login-points li::before { content: "✓"; position: absolute; left: 0; color: #f6c27f; font-weight: 700; }
.login-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; background: var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 28px; }
.login-card h3 { font-size: 22px; margin-bottom: 18px; }
.login-foot { color: var(--muted); font-size: 12px; margin-top: 18px; text-align: center; }
.captcha-row { display: flex; gap: 8px; align-items: center; }
.captcha-row input { flex: 1; min-width: 0; }
.captcha {
  user-select: none; font-family: "Courier New", monospace; font-weight: 700; font-size: 20px; letter-spacing: 6px;
  padding: 4px 12px; border-radius: 6px; color: #183c33; font-style: italic;
  background: repeating-linear-gradient(45deg, #e3f1ec, #e3f1ec 6px, #f4ead9 6px, #f4ead9 12px);
  text-decoration: line-through; text-decoration-color: rgba(11,93,75,.35);
}
.demo-creds { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--ink-2); }
.demo-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* =================== App layout =================== */
.app { display: flex; min-height: 100vh; background: linear-gradient(to right, var(--side-bg) 260px, var(--bg) 260px); }
.sidebar {
  width: 260px; flex-shrink: 0; background: var(--side-bg); color: var(--side-ink);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand img { width: 40px; height: 40px; }
.brand strong { display: block; color: #fff; font-size: 14px; letter-spacing: .03em; }
.brand span { font-size: 12px; color: var(--side-muted); }
.nav { padding: 10px 10px 20px; flex: 1; }
.nav-group { margin-top: 14px; }
.nav-group-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--side-muted); padding: 6px 10px; display: flex; justify-content: space-between; }
.nav-group-title span:last-child { text-transform: none; letter-spacing: 0; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--side-ink); text-decoration: none; margin: 1px 0;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav .ico { width: 22px; text-align: center; font-size: 15px; opacity: .9; }
.nav .lbl { display: flex; flex-direction: column; line-height: 1.2; }
.nav .lbl small { color: var(--side-muted); font-size: 11px; }
.nav a.active .lbl small { color: #b9d6cc; }
.sidebar-foot { font-size: 11px; color: var(--side-muted); padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-scrim { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 20px; position: sticky; top: 0; z-index: 30;
}
.menu-toggle { display: none; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title strong { font-size: 15px; }
.topbar-title .hi { font-size: 12px; }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; background: none; border: 1px solid transparent; border-radius: 10px; padding: 5px 8px; cursor: pointer; font: inherit; color: inherit; }
.user-btn:hover { background: var(--surface-2); border-color: var(--border); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.user-meta { display: flex; flex-direction: column; text-align: left; line-height: 1.2; }
.user-meta small { color: var(--muted); font-size: 11.5px; }
.caret { color: var(--muted); font-size: 11px; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 230px; padding: 6px; z-index: 50; }
.dropdown button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; font: inherit; cursor: pointer; color: var(--ink); }
.dropdown button:hover { background: var(--surface-2); }

.page { padding: 22px 24px 32px; flex: 1; outline: none; }
.footer { padding: 14px 24px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); background: var(--surface); }

/* =================== Page header =================== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.page-head h1 { font-size: 22px; font-weight: 700; }
.page-head h1 .hi { font-size: 14px; margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* =================== Cards =================== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h3 { font-size: 15px; }
.card-head h3 .hi { font-size: 12px; }
.card-body { padding: 16px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; } /* let wide tables scroll inside their card instead of stretching the grid */
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.mt { margin-top: 16px; }

/* stat tiles */
.stat { padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; }
.stat-ico { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.stat-ico.res { background: var(--brand-soft); }
.stat-ico.com { background: var(--accent-soft); }
.stat-ico.sms { background: var(--info-soft); }
.stat-ico.month { background: #f1ecfb; }
.stat-label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.stat-label .hi { font-size: 11.5px; }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 6px; letter-spacing: -.01em; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.chart-box { position: relative; height: 300px; }
.chart-box.tall { height: 360px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 12px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.on { background: var(--brand); color: #fff; }

/* =================== Toolbar & filters =================== */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .field { margin: 0; }
.toolbar .grow { flex: 1; min-width: 200px; }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.selbar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--info-soft); border-bottom: 1px solid #cfe0f6; font-size: 13px; }

/* =================== Forms =================== */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field-label .hi { display: inline; font-size: 11.5px; margin-left: 4px; }
.field-label .req { color: var(--danger); margin-left: 2px; }
input:not([type]), input[type=text], input[type=password], input[type=number], input[type=tel], input[type=email], input[type=date], input[type=search], input[type=month], select, textarea {
  height: 36px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 10px;
  font: inherit; font-size: 13.5px; color: var(--ink); background: var(--surface); width: 100%;
}
textarea { height: auto; min-height: 96px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11,93,75,.14); }
input[readonly] { background: var(--surface-2); color: var(--ink-2); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 12px; }
.field-hint { color: var(--muted); font-size: 11.5px; }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 8px 10px; border-radius: 6px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 12px; }
.radio-row { display: flex; gap: 8px; }
.radio-pill { flex: 1; position: relative; }
.radio-pill input { position: absolute; opacity: 0; }
.radio-pill span { display: block; text-align: center; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 8px; cursor: pointer; font-weight: 600; font-size: 13px; }
.radio-pill input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.radio-pill input:focus-visible + span { outline: 2px solid var(--info); outline-offset: 1px; }
.inline-calc { display: flex; align-items: center; gap: 6px; }
.inline-calc input { text-align: center; }
.inline-calc .x { color: var(--muted); font-weight: 700; }
.form-section { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); margin: 4px 0 10px; grid-column: 1 / -1; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: 13px; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 11px; background: #c9d1ce; position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { left: 19px; }

/* =================== Tables =================== */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th {
  text-align: left; font-weight: 700; color: var(--ink-2); background: var(--surface-2);
  padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 12px; vertical-align: bottom;
}
.tbl td { padding: 8px 8px; border-bottom: 1px solid #edf0ef; vertical-align: middle; }
.tbl tbody tr:hover td { background: #fafcfb; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .ctr { text-align: center; }
.tbl .nowrap { white-space: nowrap; }
.tbl .muted { color: var(--muted); }
.tbl .chk { width: 34px; }
.tbl .actions { white-space: nowrap; text-align: right; position: sticky; right: 0; z-index: 1; }
.tbl td.actions { background: var(--surface); box-shadow: -10px 0 10px -10px rgba(16,40,32,.25); }
.tbl th.actions { background: var(--surface-2); box-shadow: -10px 0 10px -10px rgba(16,40,32,.25); }
.trunc { display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--border); }
.tbl tr.row-error td { background: #fff6f6; }
.tbl tr.row-ok td:first-child { box-shadow: inset 3px 0 0 var(--success); }
.tbl tr.row-error td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.cell-main { font-weight: 600; }
.cell-link { font-weight: 600; color: var(--ink); text-decoration: none; border-bottom: 1px dashed var(--border-strong); }
.cell-link:hover { color: var(--brand); border-bottom-color: var(--brand); }
.cell-sub { font-size: 12px; color: var(--muted); }
.err-list { margin: 0; padding-left: 16px; color: var(--danger); font-size: 12px; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.pager-btns { display: flex; gap: 4px; align-items: center; }
.pager-btns button { min-width: 30px; height: 30px; border: 1px solid var(--border); background: var(--surface); border-radius: 6px; cursor: pointer; font: inherit; font-size: 12.5px; }
.pager-btns button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager-btns button:disabled { opacity: .45; cursor: default; }
.pager select { width: auto; height: 30px; }

/* permission matrix */
.perm-tbl td, .perm-tbl th { text-align: center; }
.perm-tbl td:first-child, .perm-tbl th:first-child { text-align: left; }
.perm-tbl input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.perm-tbl input[type=checkbox]:disabled { cursor: not-allowed; }
.perm-group td { background: var(--surface-2); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); }
.role-list { display: flex; flex-direction: column; gap: 8px; }
.role-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; background: var(--surface); text-align: left; font: inherit; color: inherit; }
.role-item:hover { border-color: var(--border-strong); }
.role-item.on { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11,93,75,.12); }
.role-item strong { display: block; }
.role-item small { color: var(--muted); }

/* =================== Tabs =================== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--ink-2); cursor: pointer; margin-bottom: -1px; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.tabs button .hi { display: inline; margin-left: 4px; }

/* =================== Upload =================== */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; }
.step-n { width: 28px; height: 28px; border-radius: 50%; background: #e8ecea; color: var(--ink-2); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.step.done .step-n { background: var(--success); color: #fff; }
.step.cur .step-n { background: var(--brand); color: #fff; }
.step strong { font-size: 13px; display: block; }
.step small { color: var(--muted); font-size: 11.5px; }
.dropzone { display: block; border: 2px dashed var(--border-strong); border-radius: 12px; padding: 34px 16px; text-align: center; background: var(--surface-2); cursor: pointer; transition: background .15s, border-color .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .big { font-size: 34px; }
.summary-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.sum-chip { border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; background: var(--surface); }
.sum-chip strong { font-size: 20px; display: block; }
.sum-chip small { color: var(--muted); }
.sum-chip.ok strong { color: var(--success); }
.sum-chip.bad strong { color: var(--danger); }
.rules { margin: 0; padding-left: 18px; color: var(--ink-2); }
.rules li { margin: 3px 0; }

/* =================== SMS =================== */
.sms-phone { background: #eef2f1; border-radius: 16px; padding: 14px; }
.sms-bubble { background: #fff; border-radius: 14px 14px 14px 4px; padding: 10px 12px; box-shadow: var(--shadow); white-space: pre-wrap; word-wrap: break-word; font-size: 13.5px; }
.sms-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.month-pick { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 8px; }
.last-sms { margin-top: 3px; text-align: right; font-size: 11px; }
.var-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.var-chips .chip { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; padding: 2px 8px; }
.progress { height: 8px; background: #e8ecea; border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; background: var(--brand); width: 0; transition: width .2s; }
.recipients { max-height: 120px; overflow: auto; font-size: 12.5px; color: var(--ink-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--surface-2); }

/* provider cards */
.prov-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.prov { position: relative; border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; background: var(--surface); text-align: left; font: inherit; color: inherit; }
.prov:hover { border-color: var(--border-strong); }
.prov.on { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11,93,75,.12); }
.prov strong { display: block; font-size: 14px; }
.prov small { color: var(--muted); font-size: 11.5px; }
.prov .badge { position: absolute; top: 10px; right: 10px; }
.secret-wrap { display: flex; gap: 6px; }
.secret-wrap input { flex: 1; }
.note { background: var(--warning-soft); border: 1px solid #f1d9a6; color: #6b4a07; border-radius: 8px; padding: 10px 12px; font-size: 12.5px; }
.note.info { background: var(--info-soft); border-color: #cfe0f6; color: #1d4f8c; }

/* =================== Modal =================== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(12, 28, 24, .45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 100; overflow-y: auto; animation: fade .15s ease-out; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; animation: pop .18s ease-out; }
.modal.lg { max-width: 820px; }
.modal.sm { max-width: 420px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; }
.modal-head h3 .hi { font-size: 12.5px; }
.modal-body { padding: 18px 20px 4px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* =================== Toast =================== */
.toast-root { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #17302a; color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13px; max-width: 360px; display: flex; gap: 8px; animation: pop .2s ease-out; }
.toast.success { background: #0e6b49; }
.toast.error { background: #a52828; }
.toast.warn { background: #8a5a00; }

/* misc */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.flex { display: flex; gap: 8px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; margin-right: 4px; }
.print-root { display: none; }

/* =================== Responsive =================== */
@media (max-width: 1500px) {
  .grid-2-1 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prov-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 32px 20px; }
  .app { background: var(--bg); }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .menu-toggle { display: inline-flex; }
  .grid-2, .grid-2-1, .grid-3 { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proto-chip-sm { display: none; }
}
@media (max-width: 640px) {
  .page { padding: 16px; }
  .grid-4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .prov-grid { grid-template-columns: 1fr; }
  .user-meta, .topbar-title .hi { display: none; }
  .steps { grid-template-columns: 1fr; }
  .stat-value { font-size: 24px; }
}

/* =================== Print =================== */
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff; font-size: 11px; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block !important; }
  .print-head { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid #0b5d4b; padding-bottom: 8px; margin-bottom: 10px; }
  .print-head img { width: 44px; height: 44px; }
  .print-head h2 { font-size: 16px; }
  .print-meta { font-size: 10.5px; color: #444; margin-bottom: 10px; }
  .print-root .tbl th { background: #eef2f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-root .tbl td, .print-root .tbl th { padding: 4px 6px; font-size: 10px; }
  .print-root h3 { font-size: 13px; margin: 12px 0 6px; }
  .print-root tr { page-break-inside: avoid; }
}

@media (max-width: 980px) {
  [data-layout] { grid-template-columns: 1fr !important; }
}
