/* School SMS Panel */
:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --border: #e2e7ec;
    --text: #17212b;
    --muted: #64707d;
    --primary: #c2410c;
    --primary-hover: #9a3412;
    --primary-soft: #fff1e6;
    --ok: #1f7a3d;
    --ok-soft: #e4f4e9;
    --wait: #a15c07;
    --wait-soft: #fdf1df;
    --bad: #b42318;
    --bad-soft: #fde8e6;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg);
}
h1, h2 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 0 20px; height: 60px; overflow: hidden; display: flex; align-items: center; gap: 28px; }
.brand { text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 36px !important; height: 36px !important; max-width: 36px; max-height: 36px; flex: 0 0 36px; display: block; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 700; font-size: 16px; color: #7c2d12; letter-spacing: -.01em; }
.brand-name b { color: var(--primary); font-weight: 800; }
.brand-sub { font-size: 11px; color: var(--muted); font-weight: 500; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.user { display: flex; align-items: center; gap: 12px; }
.user-name { color: var(--muted); }

.container { max-width: 1280px; margin: 0 auto; padding: 24px 20px 48px; }
.page-head { margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.step { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; display: inline-grid; place-items: center; flex: none; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 500; margin-bottom: 6px; }
.input {
    width: 100%; padding: 9px 11px; border: 1px solid #cdd5dd; border-radius: 8px;
    font: inherit; color: inherit; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(194, 65, 12, .16); }
.input[disabled] { background: #f1f3f5; color: var(--muted); }
.input.inline { width: auto; display: inline-block; }
.var-input { border-color: #f6b98c; background: #fffaf5; }
.preview { resize: vertical; background: #f8fafb; color: var(--text); line-height: 1.55; cursor: default; }
.preview-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 12.5px; flex-wrap: wrap; }
.field-error { color: var(--bad); font-size: 12.5px; }
.auto-chip { display: inline-block; padding: 7px 10px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-size: 12.5px; }
.meta-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; font-size: 12.5px; color: var(--muted); }
.tag b { color: var(--text); font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600;
    cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.primary[disabled] { opacity: .6; cursor: progress; }
.btn.secondary { background: var(--primary-soft); color: var(--primary); }
.btn.secondary:hover { background: #ffe2cc; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--bg); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.block { width: 100%; }

/* ---------- alerts ---------- */
.alert { padding: 11px 14px; border-radius: 8px; margin: 0 0 16px; border: 1px solid; }
.alert.error { background: var(--bad-soft); border-color: #f7c6c1; color: var(--bad); }
.alert.success { background: var(--ok-soft); border-color: #bfe3cb; color: var(--ok); }
.alert.info { background: var(--primary-soft); border-color: #fbd0b0; color: var(--primary); }

/* ---------- tables ---------- */
.list-head { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 8px; color: var(--muted); }
.list-head b { color: var(--text); }
.table-scroll { max-height: 420px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.table-scroll.tall { max-height: 640px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
    position: sticky; top: 0; background: #f8fafb; text-align: left; font-weight: 600; color: var(--muted);
    font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 9px 10px; border-bottom: 1px solid var(--border); z-index: 1;
}
.table td { padding: 8px 10px; border-bottom: 1px solid #eef1f4; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafcfc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); }
.table .err { color: var(--bad); font-size: 12px; }
.col-chk { width: 36px; }
.table input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.table td[colspan] { color: var(--muted); padding: 18px; text-align: center; }
.pager td { border: 0; padding: 10px; }
.pager table td { padding: 2px 4px; }
.pager a, .pager span { display: inline-block; padding: 4px 9px; border-radius: 6px; }
.pager span { background: var(--primary); color: #fff; }
.ok-text { color: var(--ok); font-weight: 600; }
.bad-text { color: var(--bad); }

.send-bar { display: flex; justify-content: flex-end; margin-top: 16px; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.wait { background: var(--wait-soft); color: var(--wait); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.muted { background: #eef1f4; color: var(--muted); }

/* ---------- progress ---------- */
.progress-card { border-color: #fbd0b0; }
.bar { height: 12px; background: #e7ecef; border-radius: 999px; overflow: hidden; }
.bar-fill {
    height: 100%; width: 0; border-radius: 999px; transition: width .4s ease;
    background: repeating-linear-gradient(45deg, var(--primary), var(--primary) 10px, #ea7a1c 10px, #ea7a1c 20px);
    background-size: 28px 28px; animation: stripes 1s linear infinite;
}
.progress-card.done .bar-fill { animation: none; background: var(--primary); }
@keyframes stripes { from { background-position: 0 0; } to { background-position: 28px 0; } }
.progress-stats { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); }
.progress-stats b { color: var(--text); }
.progress-stats .ok b { color: var(--ok); }
.progress-stats .bad b { color: var(--bad); }
.progress-actions { display: flex; gap: 8px; margin-top: 14px; }

/* ---------- reports ---------- */
.filter-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.filter-row .field { margin: 0; min-width: 160px; }
.filter-row > label { font-weight: 500; }
.detail-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 16px; flex-wrap: wrap; }
.detail-head h2 { margin: 6px 0 4px; font-size: 18px; }
.detail-head p { margin: 0; }
.detail-actions { display: flex; gap: 8px; }
.back { text-decoration: none; font-size: 13px; }
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.tile span { display: block; color: var(--muted); font-size: 12px; }
.tile b { font-size: 22px; font-variant-numeric: tabular-nums; }
.tile.ok b { color: var(--ok); }
.tile.wait b { color: var(--wait); }
.tile.bad b { color: var(--bad); }
.sample { background: #f8fafb; border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.sample p { margin: 4px 0 0; }

/* ---------- login ---------- */
.login-body { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #fff1e6 0%, var(--bg) 55%); }
.login-wrap { width: 100%; padding: 20px; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 10px 30px rgba(16, 24, 40, .08); padding: 32px 28px; }
.login-card h1 { text-align: center; }
.login-card > p { text-align: center; margin: 4px 0 22px; }
.login-brand { display: grid; place-items: center; margin-bottom: 10px; }
.login-brand img { width: 72px; height: 72px; max-width: 72px; display: block; }
.login-card h1 { color: #7c2d12; }
.login-card h1 b { color: var(--primary); }
.login-card .btn { margin-top: 6px; padding: 11px; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
    .layout { grid-template-columns: 1fr; }
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .topbar-inner { gap: 12px; padding: 0 14px; }
    .nav { gap: 0; overflow-x: auto; }
    .nav a { padding: 6px 8px; font-size: 13px; white-space: nowrap; }
    .brand-text { display: none; }
    .user-name { display: none; }
    .row-2 { grid-template-columns: 1fr; }
    .container { padding: 16px 14px 40px; }
}
.session-tag { margin-left: auto; font-weight: 400; }
.code { background: #f6f8fa; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 0;
        font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; }
.tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mono-b { font-family: ui-monospace, Consolas, monospace; font-size: 15px !important; word-break: break-all; }
