/* ==========================================================================
   Giftcode VCT (codevct) - chep tu mogo_manager/public/assets/css/app.css ngay
   22/10/2026 de cung mot giao dien. Cac lop rieng cua codevct nam o cuoi file
   (muc "Rieng codevct").
   ========================================================================== */

:root {
    color-scheme: light;

    --surface-1:      #fcfcfb;   /* mat the / bieu do */
    --surface-2:      #f9f9f7;   /* nen trang */
    --surface-3:      #f2f1ed;   /* vung nhan manh nhe */
    --text-primary:   #0b0b0b;
    --text-secondary: #52514e;
    --text-muted:     #898781;
    --gridline:       #e1e0d9;
    --baseline:       #c3c2b7;
    --border:         rgba(11, 11, 11, 0.10);

    --series-1:       #2a78d6;
    --series-2:       #eb6834;

    --good:           #0ca30c;
    --warning:        #fab219;
    --critical:       #d03b3b;
    --delta-up:       #006300;   /* mau chu cho muc tang */
    --delta-down:     #d03b3b;

    --radius:         10px;
    --shadow:         0 1px 2px rgba(11, 11, 11, 0.04), 0 1px 8px rgba(11, 11, 11, 0.03);
    --font:           system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root:where(:not([data-theme="light"])) {
        color-scheme: dark;

        --surface-1:      #1a1a19;
        --surface-2:      #0d0d0d;
        --surface-3:      #232322;
        --text-primary:   #ffffff;
        --text-secondary: #c3c2b7;
        --text-muted:     #898781;
        --gridline:       #2c2c2a;
        --baseline:       #383835;
        --border:         rgba(255, 255, 255, 0.10);

        --series-1:       #3987e5;
        --series-2:       #d95926;

        --delta-up:       #0ca30c;
        --shadow:         0 1px 2px rgba(0, 0, 0, 0.4);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --surface-1:      #1a1a19;
    --surface-2:      #0d0d0d;
    --surface-3:      #232322;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --gridline:       #2c2c2a;
    --baseline:       #383835;
    --border:         rgba(255, 255, 255, 0.10);

    --series-1:       #3987e5;
    --series-2:       #d95926;

    --delta-up:       #0ca30c;
    --shadow:         0 1px 2px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--surface-2);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--series-1); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Khung trang ------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 224px;
    flex: 0 0 224px;
    background: var(--surface-1);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 20px;
    font-size: 16px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--series-1);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 700;
    flex: 0 0 28px;
}

.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }

.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}
.nav a:hover { background: var(--surface-3); color: var(--text-primary); text-decoration: none; }
.nav a.on { background: var(--surface-3); color: var(--text-primary); font-weight: 600; }
.nav a .ico { width: 16px; text-align: center; opacity: 0.85; }

.nav-sep {
    margin: 12px 12px 8px;
    padding: 0 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
}

.sidebar-foot {
    margin-top: auto;
    padding: 16px 20px 0;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
}
.sidebar-foot .who { color: var(--text-secondary); font-weight: 600; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-1);
    flex-wrap: wrap;
}

.page-title { font-size: 17px; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
.page-sub { color: var(--text-secondary); font-size: 13px; margin: 2px 0 0; }
.spacer { flex: 1; }

.content { padding: 24px 28px 40px; }

/* ---------- Bo loc (mot hang, dat tren tat ca thu no chi phoi) ---------- */

.filterbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.seg {
    display: inline-flex;
    background: var(--surface-3);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}
.seg a {
    padding: 5px 12px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 550;
}
.seg a:hover { color: var(--text-primary); text-decoration: none; }
.seg a.on { background: var(--surface-1); color: var(--text-primary); box-shadow: var(--shadow); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-1);
    color: var(--text-primary);
    font: inherit;
    font-weight: 550;
    cursor: pointer;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn-primary {
    background: var(--series-1);
    border-color: transparent;
    color: #fff;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-block { width: 100%; }

.btn-danger { color: var(--critical); border-color: var(--border); }
.btn-danger:hover { background: rgba(208, 59, 59, 0.10); color: var(--critical); }

/* Luoi form hai cot (trang cai dat nguon) */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}
.form-grid .form-row { margin-bottom: 0; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }

.icon-btn {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-1);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text-primary); }

/* ---------- O so lieu (stat tile) -------------------------------------- */

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.tile {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
    min-width: 0;
}
.tile .label {
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 550;
    margin-bottom: 6px;
}
.tile .value {
    font-size: 26px;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.15;
    /* So dung mot minh -> chu so ty le, KHONG tabular-nums */
}
.tile .value .unit { font-size: 15px; font-weight: 550; color: var(--text-secondary); margin-left: 2px; }

.tile .delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 7px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
}
.delta.up   { color: var(--delta-up); }
.delta.down { color: var(--delta-down); }
.delta .vs  { color: var(--text-muted); font-weight: 500; }

/* O dan dat cua trang - dung DUY NHAT mot cai moi man hinh */
.tile-hero { grid-column: span 2; }
.tile-hero .value {
    font-size: 48px;
    font-weight: 680;
    letter-spacing: -0.03em;
}
@media (max-width: 720px) { .tile-hero { grid-column: span 1; } }

/* ---------- The chua bieu do ------------------------------------------- */

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 0;
    overflow: hidden;
}

.card-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px 10px;
}
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; }
.card-head p  { margin: 2px 0 0; font-size: 12.5px; color: var(--text-secondary); }

.card-body { padding: 0 18px 16px; }

/* Nut chuyen bieu do <-> bang so (moi bieu do deu phai co ban bang) */
.view-toggle {
    display: inline-flex;
    background: var(--surface-3);
    border-radius: 7px;
    padding: 2px;
    gap: 2px;
    flex: 0 0 auto;
}
.view-toggle button {
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 12px;
    font-weight: 550;
    padding: 4px 10px;
    border-radius: 5px;
    cursor: pointer;
}
.view-toggle button:hover { color: var(--text-primary); }
.view-toggle button.on {
    background: var(--surface-1);
    color: var(--text-primary);
    box-shadow: var(--shadow);
}

/* ---------- Chu giai (legend) ------------------------------------------ */

.legend {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 0 0 10px;
    font-size: 12.5px;
    color: var(--text-secondary);   /* chu KHONG bao gio mang mau chuoi */
    font-weight: 550;
}
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch {
    width: 10px; height: 10px;
    border-radius: 3px;
    flex: 0 0 10px;
}
.legend .swatch.line {
    width: 14px; height: 3px;
    border-radius: 2px;
}

/* ---------- Bieu do ----------------------------------------------------- */

.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }

.tooltip {
    position: absolute;
    z-index: 20;
    pointer-events: none;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
    padding: 8px 10px;
    font-size: 12.5px;
    min-width: 128px;
    opacity: 0;
    transition: opacity 0.09s ease;
}
.tooltip.show { opacity: 1; }
.tooltip .tt-title {
    font-weight: 650;
    margin-bottom: 5px;
    color: var(--text-primary);
    white-space: nowrap;
}
.tooltip .tt-row {
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    color: var(--text-secondary);
}
.tooltip .tt-row + .tt-row { margin-top: 3px; }
.tooltip .tt-dot { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 8px; }
.tooltip .tt-val {
    margin-left: auto;
    font-weight: 650;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* ---------- Bang du lieu ------------------------------------------------ */

.table-scroll { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.data th, table.data td {
    padding: 9px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.data th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--surface-1);
    position: sticky;
    top: 0;
    z-index: 1;
}
table.data tbody tr:hover { background: var(--surface-3); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;   /* cot so -> can thang cot */
}
table.data td.strong { font-weight: 600; }
table.data .muted { color: var(--text-muted); }

/* Ban bang so cua bieu do */
.table-view { display: none; max-height: 320px; overflow: auto; }
.table-view.on { display: block; }
.chart-view.off { display: none; }

/* ---------- Nhan trang thai -------------------------------------------- */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--surface-3);
    color: var(--text-secondary);
}
.pill::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 6px;
}
/* Mau trang thai luon di kem chu, khong bao gio dung mau mot minh */
.pill.ok   { color: var(--good); }
.pill.warn { color: #8a6100; }
.pill.bad  { color: var(--critical); }
:root[data-theme="dark"] .pill.warn { color: var(--warning); }
@media (prefers-color-scheme: dark) {
    :root:where(:not([data-theme="light"])) .pill.warn { color: var(--warning); }
}

/* ---------- Thanh loc / tim kiem --------------------------------------- */

.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.field {
    display: flex;
    align-items: center;
    gap: 6px;
}
.field label { color: var(--text-secondary); font-size: 12.5px; font-weight: 550; }

input[type="text"], input[type="password"], input[type="date"], select {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-1);
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
    min-width: 0;
}
input[type="text"]:focus, input[type="password"]:focus,
input[type="date"]:focus, select:focus {
    outline: 2px solid var(--series-1);
    outline-offset: -1px;
    border-color: transparent;
}
input::placeholder { color: var(--text-muted); }

/* ---------- Phan trang -------------------------------------------------- */

.pager {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 2px 0;
    flex-wrap: wrap;
}
.pager-info { color: var(--text-secondary); font-size: 12.5px; }
.pager-links { margin-left: auto; display: flex; gap: 4px; }
.pg {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    display: inline-grid;
    place-items: center;
    border-radius: 7px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 550;
    background: var(--surface-1);
}
.pg:hover { background: var(--surface-3); color: var(--text-primary); text-decoration: none; }
.pg-cur { background: var(--series-1); border-color: transparent; color: #fff; }

/* ---------- Thong bao --------------------------------------------------- */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 14px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface-1);
    font-size: 13px;
    margin-bottom: 14px;
}
.alert.bad  { border-left: 3px solid var(--critical); }
.alert.ok   { border-left: 3px solid var(--good); }
.alert.warn { border-left: 3px solid var(--warning); }

.empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13.5px;
}

/* ---------- Trang dang nhap -------------------------------------------- */

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--surface-2);
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 30px 30px 26px;
}
.login-card .brand { padding: 0 0 22px; font-size: 17px; }
.login-card h1 { font-size: 19px; margin: 0 0 4px; font-weight: 650; letter-spacing: -0.015em; }
.login-card .sub { color: var(--text-secondary); font-size: 13px; margin: 0 0 20px; }
.form-row { margin-bottom: 14px; }
.form-row label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
}
.form-row input { width: 100%; padding: 9px 11px; font-size: 14px; }
.login-foot {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* ---------- Man hinh hep ------------------------------------------------ */

@media (max-width: 860px) {
    .shell { flex-direction: column; }
    .sidebar {
        width: 100%;
        flex: none;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        padding: 14px 0;
    }
    .nav { flex-direction: row; overflow-x: auto; padding: 0 12px 4px; }
    .nav a { white-space: nowrap; }
    .nav-sep, .sidebar-foot { display: none; }
    .content { padding: 18px 16px 32px; }
    .topbar { padding: 14px 16px; }
}

@media print {
    .sidebar, .filterbar, .view-toggle, .pager-links { display: none; }
    .card, .tile { box-shadow: none; break-inside: avoid; }
}

/* ---------- Rieng mogo_manager ------------------------------------------ */

.grow { flex: 1; min-width: 0; }

.tile-note { margin-top: 6px; font-size: 12px; color: var(--text-muted); }

/* The moi ket noi o trang tong quan */
.conn-card { margin-bottom: 16px; }
.card-head h3 .pill { margin-left: 6px; vertical-align: 2px; }
.card-head .actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex: 0 0 auto;
}
form.inline { display: inline; margin: 0; }

/* Thanh ty le dung luong: ve bang SVG, KHONG dung style="width:..." (CSP chan) */
.bar-col { width: 210px; }
.bar {
    display: inline-block;
    width: 130px;
    height: 8px;
    vertical-align: middle;
}
.bar svg { display: block; width: 100%; height: 8px; }
.bar-bg { fill: var(--surface-3); }
.bar-fg { fill: var(--series-1); }
.bar-pct {
    display: inline-block;
    min-width: 52px;
    margin-left: 8px;
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* Nhan nho canh ten database: he thong / rong */
.tag {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 4px;
    background: var(--surface-3);
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 600;
    vertical-align: 1px;
}

table.data tfoot td {
    font-weight: 650;
    border-top: 1px solid var(--baseline);
    border-bottom: 0;
    white-space: nowrap;
}
table.data tfoot td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.wrap { white-space: normal; }

/* Form them / sua ket noi */
.form-card { max-width: 760px; margin-bottom: 16px; }
.form-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.danger-zone .card-head { align-items: center; padding-bottom: 16px; }

/* Nut trong nhu duong link (dang xuat o thanh ben) */
.link-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--series-1);
    font: inherit;
    cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.sidebar-foot form { margin: 0; }

@media (max-width: 860px) {
    .bar-col { width: auto; }
    .bar { width: 80px; }
}

/* CAPTCHA o trang dang nhap (anh SVG nen sang co dinh, doc duoc o ca hai che do mau) */
.captcha-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.captcha-img {
    display: block;
    width: 200px;
    height: 64px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #f4f3ee;
}
.form-row input.captcha-input {
    text-transform: uppercase;
    letter-spacing: 0.25em;
}
.form-row input.captcha-input::placeholder {
    text-transform: none;
    letter-spacing: normal;
}

/* ---------- Check log Phong Than (logs.php, logview.php, servers.php) ---- */

/* The bo loc: o dropdown datalist/select khong bi cat */
.filter-card { margin-bottom: 16px; overflow: visible; }
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px 14px;
    padding-top: 16px;
}
.filters .f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filters .f label, .filter-actions label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}
.filters .f input, .filters .f select { width: 100%; }
.filters .f-wide { grid-column: 1 / -1; }

.filter-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    padding-bottom: 14px;
}
.filter-actions .f-inline { display: flex; align-items: center; gap: 6px; }

/* Bang ket qua */
table.data.logs th { text-transform: none; letter-spacing: 0; }
table.data.logs th .sub {
    display: block;
    font-weight: 500;
    font-size: 11px;
    color: var(--text-muted);
}
table.data.logs td { vertical-align: top; }
table.data td.detail {
    white-space: normal;
    min-width: 340px;
    max-width: 780px;
    line-height: 1.65;
}
table.data td.cell-wrap {
    white-space: normal;
    min-width: 120px;
    max-width: 440px;
    overflow-wrap: anywhere;
}
table.data td.rawlog, pre.rawlog {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
}
table.data td.rawlog { min-width: 420px; max-width: 920px; }
pre.rawlog {
    margin: 0;
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--surface-3);
    line-height: 1.55;
}

.rawlog .tab { color: var(--text-muted); padding: 0 4px; }

.tag.cat { margin-left: 0; font-size: 11px; color: var(--text-secondary); }

/* Cot Chi tiet kieu cau giai thich (inc/ptlog_story.php): cau chinh + dong so lieu phu */
.story { color: var(--text-primary); line-height: 1.5; }
.story b { font-weight: 650; }
.story.has-tip { text-decoration: underline dotted var(--baseline); text-underline-offset: 3px; cursor: help; }
.story.warn::before, .story.bad::before {
    display: inline-block;
    margin-right: 6px;
    padding: 0 5px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 700;
    vertical-align: 1px;
    color: #fff;
}
.story.warn::before { content: "CHÚ Ý"; background: #b7791f; }
.story.bad::before { content: "LỖI"; background: var(--critical); }
.facts { margin-top: 3px; font-size: 12px; line-height: 1.6; color: var(--text-secondary); }
.fact { margin-right: 14px; }
.fact i { font-style: normal; color: var(--text-muted); }
.fact.dim { color: var(--text-muted); }
.fact[title] { cursor: help; text-decoration: underline dotted var(--baseline); text-underline-offset: 3px; }
.act-code { display: block; font-size: 11px; color: var(--text-muted); }
.summary .story { font-size: 15px; }
.summary .facts { font-size: 13px; margin-top: 6px; }
.summary p { margin: 10px 0 0; }

.card-body.pager { padding-top: 12px; border-top: 1px solid var(--border); }
.detail-card { margin-top: 16px; }
table.kvtable th { position: static; }
table.kvtable td:first-child { width: 150px; }

.small { font-size: 11.5px; }
.form-row select { width: 100%; padding: 9px 11px; font-size: 14px; }
.wrap-err { white-space: normal; max-width: 260px; }
code {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    padding: 0 4px;
    border-radius: 4px;
    background: var(--surface-3);
}

/* ---------- Nguoi dung / phan quyen (users.php, account.php) -------------- */

input[type="checkbox"], input[type="radio"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--series-1);
    flex: 0 0 16px;
}
.form-row label.check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
}
.form-row label.check .muted { font-weight: 400; }
.form-row input[type="checkbox"], .form-row input[type="radio"] { width: 16px; padding: 0; }
.check-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0 20px;
    padding-left: 24px;
}
.perm-box { margin-top: 14px; }
.perm-box > label:first-child { margin-bottom: 2px; }

.sidebar-foot .role { color: var(--text-muted); font-size: 11.5px; margin: 1px 0 8px; }
.sidebar-foot .foot-links { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sidebar-foot .foot-links a.on { font-weight: 600; }

/* Man hinh hep: van hien ten + Doi mat khau + Dang xuat (truoc day an ca khoi) */
@media (max-width: 860px) {
    .sidebar-foot {
        display: flex;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
        margin-top: 8px;
        padding: 10px 20px 0;
    }
    .sidebar-foot .role { margin: 0; }
}

/* ---------- Token API (users.php) --------------------------------------- */

.token-once code.token {
    display: block;
    margin: 6px 0 8px;
    padding: 8px 10px;
    font-size: 13px;
    overflow-wrap: anywhere;
    user-select: all;
}
.token-form { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ==========================================================================
   Rieng codevct (gen.php)
   ========================================================================== */

/* Danh sach loai code dang o danh dau: luoi o, moi o mot loai */
.type-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
    margin-top: 6px;
}
.form-row label.check.type-item {
    margin: 0;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-1);
    align-items: flex-start;
}
.form-row label.check.type-item input { margin-top: 2px; }
.form-row label.check.type-item .small { display: block; font-weight: 400; }
.form-row label.check.type-item:has(input:checked) {
    border-color: var(--series-1);
    background: var(--surface-3);
}
.perm-box .link-btn { margin-left: 10px; font-weight: 400; }

/* Ket qua gen: ma to, de doc / de chep */
.gen-result { border-color: var(--series-1); }
.gen-result code.acc { font-size: 15px; }
.gen-codes code.gc {
    font-size: 17px;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    user-select: all;
}
.gen-codes td.num { text-align: right; width: 1%; white-space: nowrap; }
.btn.copied { border-color: var(--good); color: var(--good); }
.btn.copy-bad { border-color: var(--critical); color: var(--critical); }

/* O tam de chep khi trinh duyet khong co navigator.clipboard (HTTP thuong) */
.copy-tmp { position: fixed; left: -9999px; top: 0; opacity: 0; }
