﻿/* ===== Base ===== */
:root {
    --bg: #f6f3ee;
    --card: #ffffff;
    --ink: #1c2430;
    --muted: #64707d;
    --line: #e4ded4;
    --brand: #0f6e64;
    --brand-dark: #0b544c;
    --brand-soft: #e2f1ee;
    --accent: #e8913a;
    --accent-soft: #fdf0e1;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --ok: #157f3c;
    --ok-soft: #e5f5ea;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(28, 36, 48, .06), 0 8px 24px rgba(28, 36, 48, .06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Be Vietnam Pro", "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 17px;
    line-height: 1.55;
}

a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
code { background: #f1ede6; padding: 2px 6px; border-radius: 6px; font-size: .95em; word-break: break-all; }

.container { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.container-wide { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ===== Public header ===== */
.site-header {
    background: var(--brand);
    color: #fff;
    padding: 18px 0 64px;
}
.site-header .brand { font-weight: 700; font-size: 1.15rem; letter-spacing: .2px; }
.site-header .tagline { opacity: .85; font-size: .95rem; margin: 2px 0 0; }
.logo-box { display: inline-flex; align-items: center; margin-bottom: 6px; }
.logo-box img { display: block; height: 64px; width: auto; max-width: 260px; object-fit: contain; border-radius: 8px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .25)); }
@media (max-width: 420px) {
    .logo-box img { height: 48px; max-width: 200px; }
}
.page { margin-top: -48px; padding-bottom: 48px; }
.site-footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 0 16px 32px; }

/* ===== Cards ===== */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 18px;
}
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-title h2 { margin: 0; }

/* ===== Guide steps ===== */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.steps li { display: flex; gap: 14px; align-items: flex-start; }
.step-num {
    flex: 0 0 36px; height: 36px; border-radius: 50%;
    background: var(--brand-soft); color: var(--brand);
    font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.steps b { display: block; }
.steps span { color: var(--muted); font-size: .95rem; }

/* ===== Forms ===== */
.field { margin-bottom: 20px; }
.field > label, .field-label { display: block; font-weight: 600; margin-bottom: 8px; }
.hint { color: var(--muted); font-size: .9rem; margin: 6px 0 0; }

input[type=text], input[type=password], input[type=email], input[type=number], input[type=month], input[type=date], select, textarea {
    width: 100%;
    font: inherit;
    font-size: 1.05rem;
    color: var(--ink);
    background: #fff;
    border: 2px solid var(--line);
    border-radius: 12px;
    padding: 13px 14px;
    min-height: 54px;
    transition: border-color .15s;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }

.money-input { position: relative; }
.money-input input { font-size: 1.35rem; font-weight: 700; padding-right: 44px; }
.money-input .unit { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }

/* Course check cards */
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check-card { position: relative; display: block; cursor: pointer; }
.check-card input { position: absolute; opacity: 0; pointer-events: none; }
.check-card span {
    display: flex; align-items: center; gap: 10px;
    border: 2px solid var(--line); border-radius: 12px;
    padding: 14px; font-weight: 600; min-height: 54px; background: #fff;
}
.check-card span::before {
    content: ""; flex: 0 0 22px; height: 22px; border-radius: 6px; border: 2px solid #c9c1b4; background: #fff;
}
.check-card input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.check-card input:checked + span::before { background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/14px no-repeat; border-color: var(--brand); }
.check-card input:focus-visible + span { outline: 3px solid rgba(15, 110, 100, .3); }

.fee-hint { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-dark); font-size: .95rem; }
.fee-hint.warn { background: var(--accent-soft); color: #8a4b0f; }

.note-box { border: 2px dashed var(--accent); background: var(--accent-soft); border-radius: 14px; padding: 16px; }
.js .note-box.is-hidden { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip { font: inherit; font-size: .9rem; border: 1px solid #e2c49d; background: #fff; color: #8a4b0f; border-radius: 999px; padding: 7px 12px; cursor: pointer; }
.chip:hover { background: #fff7ec; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
    border: 2px solid transparent; border-radius: 12px;
    padding: 11px 18px; min-height: 46px;
    background: #fff; color: var(--ink); border-color: var(--line);
}
.btn:hover { border-color: #cfc6b8; }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-danger { color: var(--danger); border-color: #f2c7c2; }
.btn-big { width: 100%; font-size: 1.15rem; min-height: 60px; border-radius: 14px; }
.btn-sm { min-height: 34px; padding: 5px 10px; font-size: .88rem; border-radius: 9px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ===== Alerts ===== */
.alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: .97rem; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-info { background: var(--brand-soft); color: var(--brand-dark); }
.alert-warn { background: var(--accent-soft); color: #8a4b0f; }

/* ===== QR page ===== */
.qr-wrap { text-align: center; }
.bank-head {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    margin: 0 auto 14px; padding: 10px 14px; max-width: 340px;
    border-radius: 14px; background: #faf8f4; text-align: left;
}
.bank-logo { height: 40px; width: auto; max-width: 110px; object-fit: contain; flex: 0 0 auto; }
.bank-name { font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.bank-acc { color: var(--muted); font-size: .9rem; word-break: break-word; }
.logo-preview { height: 48px; width: auto; max-width: 160px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: #fff; }
.qr-frame { display: inline-block; padding: 12px; border-radius: 18px; border: 2px solid var(--brand-soft); background: #fff; }
.qr-frame img { display: block; width: 100%; max-width: 300px; height: auto; image-rendering: pixelated; }
.qr-amount { font-size: 1.8rem; font-weight: 800; color: var(--brand-dark); margin: 12px 0 2px; }
.qr-caption { color: var(--muted); font-size: .95rem; }

.info-list { margin: 0; padding: 0; list-style: none; }
.info-list li { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.info-list li:last-child { border-bottom: 0; }
.info-list .k { flex: 0 0 120px; color: var(--muted); font-size: .92rem; }
.info-list .v { flex: 1; font-weight: 600; word-break: break-word; }
.copy-btn { flex: 0 0 auto; }

.big-check { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }

input[type=file] { width: 100%; font: inherit; font-size: .95rem; padding: 12px; border: 2px dashed var(--line); border-radius: 12px; background: #fcfbf8; }

/* ===== Admin ===== */
.admin-body { background: #f4f2ee; font-size: 15px; }
.admin-nav { background: #17312d; color: #fff; }
.admin-nav .container-wide { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.admin-nav .brand { font-weight: 700; margin-right: 14px; white-space: nowrap; }
.admin-nav a, .admin-nav button { color: #d6e6e2; text-decoration: none; padding: 8px 10px; border-radius: 8px; font: inherit; font-size: .93rem; background: none; border: 0; cursor: pointer; }
.admin-nav a:hover, .admin-nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-nav a.active { background: rgba(255,255,255,.14); color: #fff; }
.admin-nav .spacer { flex: 1; }
.admin-main { padding: 22px 0 48px; }
.admin-main h1 { font-size: 1.4rem; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { min-height: 40px; padding: 7px 10px; font-size: .95rem; width: auto; border-radius: 9px; }
.toolbar select { padding-right: 34px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.45rem; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: .85rem; }
.stat.ok .value { color: var(--ok); }
.stat.warn .value { color: #b4620f; }

.table-wrap { overflow-x: auto; background: #fff; border-radius: 14px; box-shadow: var(--shadow); }
table.grid { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.grid th { text-align: left; font-weight: 600; color: var(--muted); background: #faf8f4; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td { padding: 10px 12px; border-bottom: 1px solid #f0ece5; vertical-align: top; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid .desc { max-width: 380px; word-break: break-word; }
table.grid .empty { text-align: center; color: var(--muted); padding: 28px; }
.diff { color: #b4620f; font-size: .85rem; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--accent-soft); color: #9a5410; }
.badge-info { background: var(--brand-soft); color: var(--brand-dark); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: #eeeae3; color: var(--muted); }

.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline-form input[type=text] { min-height: 34px; padding: 4px 8px; font-size: .9rem; width: 90px; border-radius: 8px; border-width: 1px; }

.row-form { display: grid; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid #f0ece5; margin: 0; }
.row-form:last-child { border-bottom: 0; }
.row-form input[type=text], .row-form input[type=number], .row-form select { min-height: 40px; padding: 7px 10px; font-size: .95rem; border-radius: 9px; }
.row-form.head { background: #faf8f4; color: var(--muted); font-weight: 600; font-size: .85rem; padding-top: 8px; padding-bottom: 8px; }
.row-form.new { background: #fbfaf6; }
.cols-class { grid-template-columns: .8fr 1.1fr 2.2fr .6fr .7fr auto; }
.cols-course { grid-template-columns: 2fr .7fr .7fr auto; }
.cols-student { grid-template-columns: 2fr 1fr .7fr auto; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.settings-grid .field { margin-bottom: 14px; }
.settings-grid input, .settings-grid select { min-height: 44px; padding: 9px 12px; font-size: 1rem; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* Error log page */
.main-xl .container-wide { max-width: 1440px; }
.stat.bad .value { color: var(--danger); }
.log-stats { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
.log-empty { text-align: center; padding: 48px 24px; }
.log-empty-icon { font-size: 2.6rem; }
.log-empty h2 { margin: 8px 0 6px; }
.logs-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 20px; align-items: start; }
.row-active td { background: var(--brand-soft); }

.log-days { position: sticky; top: 12px; background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 10px; max-height: calc(100vh - 24px); display: flex; flex-direction: column; }
.log-days-head { font-weight: 700; padding: 6px 8px 10px; }
.log-days nav { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.log-day { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.log-day:hover { background: #f6f3ee; }
.log-day.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.log-day-name { font-variant-numeric: tabular-nums; font-size: .92rem; }
.log-day-name small { display: block; color: var(--muted); font-size: .76rem; font-weight: 500; }
.log-day-counts { display: flex; gap: 4px; }
.log-day-counts .count { min-width: 28px; text-align: center; padding: 1px 6px; border-radius: 999px; font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.count.err { background: var(--danger-soft); color: var(--danger); }
.count.warn { background: var(--accent-soft); color: #9a5410; }
.count.zero { background: #f1eee8; color: #a5a09a; }
.log-days-note { margin: 10px 8px 4px; font-size: .78rem; }
.log-days-note code { white-space: nowrap; }

.log-main { min-width: 0; }
.log-toolbar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; background: var(--bg); padding: 4px 0 12px; }
.log-title { display: flex; align-items: baseline; gap: 10px; margin-right: auto; }
.log-title h2 { margin: 0; font-size: 1.15rem; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg a { padding: 7px 12px; color: var(--ink); text-decoration: none; font-size: .88rem; border-right: 1px solid var(--line); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--brand); color: #fff; }
.seg a b { margin-left: 4px; font-variant-numeric: tabular-nums; }
.seg a.on b { color: #fff; }
.seg b.err { color: var(--danger); }
.seg b.warn { color: #9a5410; }
.log-search input[type=search] { min-height: 36px; padding: 6px 10px; width: 260px; border: 1px solid var(--line); border-radius: 9px; font: inherit; font-size: .9rem; }
.log-actions { display: flex; gap: 6px; }

.log-table { background: #fff; border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.log-row { display: grid; grid-template-columns: 82px 92px 96px minmax(0, 2fr) minmax(190px, 1fr); gap: 12px; align-items: center; padding: 9px 14px; font-size: .88rem; }
.log-head { background: #faf8f4; color: var(--muted); font-weight: 600; font-size: .8rem; border-bottom: 1px solid var(--line); }
.log-entry { border-bottom: 1px solid #f0ece5; }
.log-entry:last-child { border-bottom: 0; }
.log-entry summary { cursor: pointer; list-style: none; }
.log-entry summary::-webkit-details-marker { display: none; }
.log-entry summary:hover { background: #fbfaf7; }
.log-entry[open] summary { background: var(--brand-soft); }
.log-entry.hit summary { box-shadow: inset 4px 0 0 var(--accent); background: var(--accent-soft); }
.log-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.log-id { font-family: Consolas, monospace; font-weight: 700; }
.log-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-location { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .8rem; font-family: Consolas, monospace; }
.log-detail { padding: 10px 14px 14px; background: #fbfaf7; }
.log-detail-actions { display: flex; gap: 6px; margin-bottom: 8px; }
.log-detail pre { margin: 0; padding: 12px 14px; max-height: 400px; overflow: auto; font-size: .8rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word;
    font-family: Consolas, "Courier New", monospace; background: #fff; border: 1px solid var(--line); border-radius: 10px; }

@media (max-width: 760px) {
    .detail-grid { grid-template-columns: 1fr; }
    .cols-class, .cols-course, .cols-student { grid-template-columns: 1fr 1fr; }
    .row-form.head { display: none; }
}

@media (max-width: 420px) {
    body { font-size: 16px; }
    .card { padding: 18px; }
    .check-grid { grid-template-columns: 1fr; }
    .info-list .k { flex-basis: 100px; }
}

@media (max-width: 900px) {
    .logs-layout { grid-template-columns: 1fr; }
    .log-days { position: static; max-height: 260px; }
    .log-stats { grid-template-columns: repeat(2, 1fr); }
    .log-toolbar { position: static; }
    .log-search input[type=search] { width: 100%; }
    .log-row { grid-template-columns: 70px 80px minmax(0, 1fr); }
    .log-row > :nth-child(4), .log-row > :nth-child(5) { grid-column: 1 / -1; }
    .log-head { display: none; }
}

/* Student list + edit form */
.student-name { font-weight: 600; }
.student-sub { color: var(--muted); font-size: .82rem; }
.row-inactive td { opacity: .55; }
.edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.edit-grid .full { grid-column: 1 / -1; }
.edit-grid input, .edit-grid select, .edit-grid textarea { min-height: 44px; padding: 9px 12px; font-size: 1rem; }
@media (max-width: 640px) { .edit-grid { grid-template-columns: 1fr; } }

/* ----- Student name suggestions (parent form) ----- */
.suggest-wrap { position: relative; }
.suggest-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 6px; list-style: none;
    background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: 340px; overflow-y: auto; }
.suggest-list.is-hidden, .student-status.is-hidden { display: none; }
.suggest-list li { padding: 11px 12px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.suggest-list li.active, .suggest-list li:hover { background: var(--brand-soft); }
.suggest-list .s-name { font-weight: 500; }
.suggest-list .s-name mark { background: none; color: var(--brand-dark); font-weight: 700; }
.suggest-list .s-approx { margin-left: 8px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: #8a4b0f; font-size: .75rem; font-weight: 600; }
.suggest-list .s-class { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.suggest-list li.s-empty { cursor: default; display: block; color: #8a4b0f; background: var(--accent-soft); font-size: .93rem; }
.student-status { margin-top: 8px; padding: 10px 12px; border-radius: 10px; font-size: .93rem; }
.student-status.ok { background: var(--ok-soft); color: var(--ok); }
.student-status.warn { background: var(--accent-soft); color: #8a4b0f; }
.student-status .btn { margin-top: 8px; }
.badge-new { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: #8a4b0f; font-size: .78rem; font-weight: 600; }

/* ----- Admin grid: filters, sorting, paging ----- */
.grid-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; }
.grid-info { color: var(--muted); font-size: .88rem; }
.grid-toggle { display: none; }
table.grid tr.grid-filter th { padding: 6px 6px 8px; background: #faf8f4; font-weight: 400; vertical-align: top; }
table.grid tr.grid-filter input, table.grid tr.grid-filter select { width: 100%; min-width: 80px; min-height: 32px; height: 32px; padding: 4px 8px; font-size: .85rem; border: 1px solid var(--line); border-radius: 8px; background-color: #fff; }
table.grid tr.grid-filter select { padding-right: 24px; background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; background-size: 5px 5px; }
table.grid tr.grid-filter input[type=date] { min-width: 120px; padding: 2px 6px; }
.grid-size select { min-height: 32px; height: 32px; padding: 2px 26px 2px 8px; font-size: .88rem; background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; background-size: 5px 5px; }
table.grid tr.grid-filter .is-active { border-color: var(--brand); background: var(--brand-soft); }
.grid-date { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
table.grid th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
table.grid th.sortable:hover { color: var(--brand-dark); }
table.grid th.sort-asc::after { content: " ▲"; font-size: .7em; color: var(--brand); }
table.grid th.sort-desc::after { content: " ▼"; font-size: .7em; color: var(--brand); }
table.grid tfoot .grid-total td { font-weight: 700; background: #faf8f4; border-top: 2px solid var(--line); }
.grid-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0 18px; }
.grid-pages { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.grid-pages .btn { min-width: 34px; }
.grid-pages .btn:disabled { opacity: .4; cursor: default; }
.grid-gap { padding: 0 4px; color: var(--muted); }
.grid-size { font-size: .88rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.grid-size select { border: 1px solid var(--line); border-radius: 8px; }
/* Grid inside a narrow box */
.grid-bar.grid-compact .grid-toggle { display: inline-block; }
table.grid.grid-compact tr.grid-filter { display: none; }
table.grid.grid-compact.filters-open tr.grid-filter { display: table-row; }
.grid-pager.grid-compact { justify-content: flex-start; gap: 6px; }
.grid-pager.grid-compact .grid-info { width: 100%; }
.grid-size { white-space: nowrap; }
@media (max-width: 760px) {
    .grid-toggle { display: inline-block; }
    table.grid tr.grid-filter { display: none; }
    table.grid.filters-open tr.grid-filter { display: table-row; }
}

/* ----- Study day picker (T2 ... CN) ----- */
.day-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.day-chip { position: relative; cursor: pointer; }
.day-chip input { position: absolute; opacity: 0; pointer-events: none; }
.day-chip span { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; min-height: 46px; padding: 0 10px;
    border: 2px solid var(--line); border-radius: 10px; background: #fff; font-weight: 600; color: var(--muted); user-select: none; }
.day-chip input:checked + span { border-color: var(--brand); background: var(--brand); color: #fff; }
.day-chip input:focus-visible + span { outline: 3px solid rgba(15, 110, 100, .3); }
