/* ============ THEME TOKENS ============ */
:root,
[data-bs-theme="light"] {
    --app-bg: #e8e4fb;
    --card-bg: #ffffff;
    --text: #1c1936;
    --muted: #7d7b96;
    --primary: #6b5bd6;
    --primary-dark: #3d33a6;
    --primary-soft: #efebff;
    --bar-light: #f2f1f8;
    --track: #e6e5ee;
    --border: #ecebf5;
    --icon-bg: #f4f3fa;
    --up-bg: #8ff0a8;
    --up-text: #0d4a1f;
    --down-bg: #f0202c;
    --down-text: #ffffff;
    --tooltip-bg: #14123a;
    --promo-bg: #0f0f14;
    --shadow: 0 6px 24px rgba(76, 58, 190, .07);
    --bs-body-bg: var(--app-bg);
    --bs-body-color: var(--text);

    --teal: #14b8a6;
    --teal-dark: #0d9488;
    --teal-soft: #e6fbf8;
    --rose: #f43f5e;
    --rose-dark: #be123c;
    --rose-soft: #ffe4e9;
    --second: #5b5876;
    --second-dark: #413e5a;
    --second-rgb: 91, 88, 118;
}

[data-bs-theme="dark"] {
    --app-bg: #100e1b;
    --card-bg: #1b1929;
    --text: #ecebf7;
    --muted: #9896b3;
    --primary: #8a7cf2;
    --primary-dark: #5a4fd6;
    --primary-soft: #2a2648;
    --bar-light: #2a2740;
    --track: #2c2943;
    --border: #2a2740;
    --icon-bg: #252238;
    --up-bg: rgba(74, 222, 128, .18);
    --up-text: #6ee7a0;
    --down-bg: rgba(248, 64, 76, .2);
    --down-text: #ff7a84;
    --tooltip-bg: #000000;
    --promo-bg: linear-gradient(145deg, #3a2f9e, #1d1850);
    --shadow: 0 6px 24px rgba(0, 0, 0, .35);
    --bs-body-bg: var(--app-bg);
    --bs-body-color: var(--text);

    --teal: #2dd4bf;
    --teal-dark: #14b8a6;
    --teal-soft: #123330;
    --rose: #fb7185;
    --rose-dark: #f43f5e;
    --rose-soft: #3a1620;
    --second: #7a7799;
    --second-dark: #9492b3;
    --second-rgb: 122, 119, 153;
}

/* ============ BASE ============ */
html, body { height: 100%; }
body {
    font-family: 'Poppins', 'Prompt', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--app-bg);
    color: var(--text);
    transition: background-color .35s ease, color .35s ease;
}
.text-muted-2 { color: var(--muted) !important; }
.card-x {
    background: var(--card-bg);
    border-radius: 18px;
    box-shadow: var(--shadow);
    border: 1px solid transparent;
    transition: background-color .35s ease, transform .25s ease, box-shadow .25s ease;
}
[data-bs-theme="dark"] .card-x { border-color: var(--border); }


.btn-main { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-main:hover, .btn-main:focus { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-outline-main { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline-main:hover, .btn-outline-main:focus { background: var(--primary); border-color: var(--primary); color: #fff; }

.btn-teal { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-teal:hover, .btn-teal:focus { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.btn-outline-teal { background: transparent; border-color: var(--teal); color: var(--teal); }
.btn-outline-teal:hover, .btn-outline-teal:focus { background: var(--teal); border-color: var(--teal); color: #fff; }

.btn-rose { background: var(--rose); border-color: var(--rose); color: #fff; }
.btn-rose:hover, .btn-rose:focus { background: var(--rose-dark); border-color: var(--rose-dark); color: #fff; }
.btn-outline-rose { background: transparent; border-color: var(--rose); color: var(--rose); }
.btn-outline-rose:hover, .btn-outline-rose:focus { background: var(--rose); border-color: var(--rose); color: #fff; }

/* second — ใช้ตัวแปรของ Bootstrap ครบทุก state จึงใช้ได้ทั้ง <a class="btn"> และ <button class="btn"> (รวม :active / .active / :disabled / .disabled) */
.btn-second {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--second);
    --bs-btn-border-color: var(--second);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--second-dark);
    --bs-btn-hover-border-color: var(--second-dark);
    --bs-btn-focus-shadow-rgb: var(--second-rgb);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--second-dark);
    --bs-btn-active-border-color: var(--second-dark);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--second);
    --bs-btn-disabled-border-color: var(--second);
}
.btn-outline-second {
    --bs-btn-color: var(--second);
    --bs-btn-bg: transparent;
    --bs-btn-border-color: var(--second);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--second);
    --bs-btn-hover-border-color: var(--second);
    --bs-btn-focus-shadow-rgb: var(--second-rgb);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--second-dark);
    --bs-btn-active-border-color: var(--second-dark);
    --bs-btn-disabled-color: var(--second);
    --bs-btn-disabled-bg: transparent;
    --bs-btn-disabled-border-color: var(--second);
}


/* pill shape — ตั้งผ่านตัวแปรของ Bootstrap เพื่อให้ใช้ได้กับ .btn-sm / .btn-lg ด้วย */
.btn-main, .btn-outline-main,
.btn-teal, .btn-outline-teal,
.btn-rose, .btn-outline-rose,
.btn-second, .btn-outline-second { --bs-btn-border-radius: 50rem; }

/* ============ LAYOUT ============ */
.app {
    display: flex;
    gap: 1.5rem;
    padding: 1.25rem;
    min-height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
}
.main { flex: 1; min-width: 0; }

/* ============ SIDEBAR ============ */
.sidebar { --bs-offcanvas-width: 270px; --bs-offcanvas-bg: var(--card-bg); }
.sidebar-inner {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    transition: background-color .35s ease;
}
@media (min-width: 992px) {
    .sidebar {
    width: 240px;
    flex-shrink: 0;
    position: sticky;
    top: 1.25rem;
    height: calc(100vh - 2.5rem);
    }
    .sidebar .offcanvas-body { height: 100%; }
    .sidebar-inner { box-shadow: var(--shadow); overflow-y: auto; }
    [data-bs-theme="dark"] .sidebar-inner { border: 1px solid var(--border); }
}
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.05rem; padding: 0 .75rem; margin-bottom: 2rem; color: var(--text); text-decoration: none; }
.brand-logo {
    width: 32px; height: 32px; border-radius: 9px;
    display: grid; place-items: center;
    background: var(--primary); color: #fff; font-size: 1rem;
}
.nav-title { font-size: .78rem; font-weight: 600; letter-spacing: .06em; color: var(--muted); padding: 0 .75rem; margin: 1.25rem 0 .5rem; text-transform: uppercase; }
.nav-title:first-child { margin-top: 0; }
.sidebar-nav { position: relative; }
.nav-indicator {
    position: absolute; left: 0; right: 0; top: 0; height: 0;
    background: var(--primary);
    border-radius: 10px;
    box-shadow: 0 6px 16px rgba(107, 91, 214, .35);
    z-index: 0;
}
.side-link {
    position: relative; z-index: 1;
    display: flex; align-items: center; gap: .8rem;
    padding: .62rem .9rem; margin-bottom: .2rem;
    border-radius: 10px;
    color: var(--text); text-decoration: none; font-size: .9rem; font-weight: 500;
    transition: color .25s ease, background-color .2s ease;
}
.side-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.side-link:hover { background: var(--primary-soft); color: var(--text); }
.side-link.active, .side-link.active:hover { color: #fff; background: transparent; }

/* dropdown ในเมนู sidebar (Bootstrap collapse) */
.side-toggle { width: 100%; border: 0; background: transparent; text-align: left; font-family: inherit; }
.side-caret { margin-left: auto; font-size: .75rem !important; transition: transform .25s ease; }
.side-toggle[aria-expanded="true"] .side-caret { transform: rotate(180deg); }
.side-sub { position: relative; padding: .15rem 0 .4rem 2.95rem; }
.side-sub::before { content: ''; position: absolute; left: 1.52rem; top: .3rem; bottom: .6rem; width: 1px; background: var(--border); }
.side-sublink {
    display: block; position: relative;
    padding: .45rem .9rem; margin-bottom: .1rem;
    border-radius: 9px;
    color: var(--muted); text-decoration: none; font-size: .85rem;
    transition: color .2s ease, background-color .2s ease;
}
.side-sublink:hover { background: var(--primary-soft); color: var(--text); }
.side-sublink.active { color: var(--primary); font-weight: 600; }
.side-sublink.active::before { content: ''; position: absolute; left: -1.62rem; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--primary); }

.promo {
    margin-top: auto;
    background: var(--promo-bg);
    color: #fff;
    border-radius: 14px;
    padding: 1rem;
}
.promo-icon { width: 36px; height: 36px; border-radius: 9px; background: #e9e7f3; color: #111; display: grid; place-items: center; margin-bottom: .7rem; }
.promo h6 { font-weight: 600; font-size: 1.05rem; margin-bottom: .25rem; }
.promo p { font-size: .75rem; opacity: .8; margin-bottom: .8rem; }
.btn-promo { background: var(--primary); color: #fff; border: 0; width: 100%; border-radius: 9px; font-size: .85rem; padding: .5rem; }
.btn-promo:hover { background: var(--primary-dark); color: #fff; }

/* ============ TOPBAR ============ */
.topbar { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-title { font-weight: 700; font-size: clamp(1.3rem, 2.4vw, 1.9rem); margin: 0; letter-spacing: -.01em; }
.page-sub { color: var(--muted); font-size: .85rem; margin: 0; }
.icon-btn {
    width: 46px; height: 46px; border-radius: 50%;
    border: 0; background: var(--card-bg); color: var(--text);
    display: grid; place-items: center; font-size: 1.1rem;
    box-shadow: var(--shadow); position: relative;
    transition: background-color .35s ease, color .2s ease;
    flex-shrink: 0;
}
.icon-btn:hover { color: var(--primary); }
.notif-dot { position: absolute; top: 11px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: #f0202c; border: 2px solid var(--card-bg); }
.search-box { display: flex; align-items: center; background: var(--card-bg); border-radius: 50px; box-shadow: var(--shadow); height: 46px; overflow: hidden; }
.search-box .icon-btn { box-shadow: none; }
.search-box input { width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: .9rem; padding: 0; }
.avatar {
    width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, #f7a88b, #e8577b);
    color: #fff; font-weight: 600; display: grid; place-items: center;
}
.profile-name { font-weight: 600; font-size: 1rem; line-height: 1.2; }
.profile-role { font-size: .8rem; color: var(--muted); }
.dropdown-menu { --bs-dropdown-bg: var(--card-bg); --bs-dropdown-link-color: var(--text); --bs-dropdown-link-hover-bg: var(--primary-soft); --bs-dropdown-link-active-bg: var(--primary); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); font-size: .88rem; }

/* ============ STAT CARDS ============ */
.stat { padding: 1.3rem 1.3rem 1.2rem; height: 100%; }
.stat:hover { transform: translateY(-3px); }
.stat-icon { width: 42px; height: 42px; border-radius: 50%; background: var(--icon-bg); display: grid; place-items: center; font-size: 1.1rem; }
.stat-label { font-size: .82rem; color: var(--muted); margin: .7rem 0 .15rem; }
.stat-value { font-weight: 700; font-size: clamp(1.35rem, 2.2vw, 1.7rem); letter-spacing: -.01em; }
.stat-note { font-size: .7rem; color: var(--muted); line-height: 1.3; max-width: 110px; }
.stat.featured { background: var(--primary); color: #fff; }
.stat.featured .stat-icon { background: rgba(255,255,255,.95); color: var(--primary); }
.stat.featured .stat-label, .stat.featured .stat-note { color: rgba(255,255,255,.85); }

.pill { display: inline-flex; align-items: center; gap: .15rem; font-size: .74rem; font-weight: 600; padding: .28rem .7rem; border-radius: 50px; white-space: nowrap; }
.pill-up { background: var(--up-bg); color: var(--up-text); }
.pill-down { background: var(--down-bg); color: var(--down-text); }
.pill-wait { background: var(--icon-bg); color: var(--muted); border: 1px solid var(--border); }

/* ============ SECTION CARDS ============ */
.panel { padding: 1.4rem 1.5rem; height: 100%; }
.panel-title { font-weight: 600; font-size: 1.2rem; margin: 0; }
.panel-sub { font-size: .8rem; color: var(--muted); margin: 0; }
.range-btn { background: transparent; border: 0; color: var(--muted); font-size: .82rem; display: flex; align-items: center; gap: .6rem; padding: .25rem .25rem; }
.range-btn i { width: 26px; height: 26px; border-radius: 50%; background: var(--icon-bg); display: grid; place-items: center; color: var(--text); font-size: .75rem; }
.range-btn::after { display: none; }

/* Bar chart */
.legend { display: flex; gap: 1.5rem; font-size: .82rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .5rem; }
.dot { width: 16px; height: 16px; border-radius: 50%; display: inline-block; }
.dot-seen { background: var(--bar-light); border: 1px solid var(--border); }
.dot-sale { background: var(--primary); }

.chart {
    --plot: 212px;
    position: relative;
    height: 240px;
    padding-left: 44px;
    margin-top: 1rem;
}
.grid-line { position: absolute; left: 44px; right: 0; height: 1px; background: var(--border); }
.y-label { position: absolute; left: 0; font-size: .72rem; color: var(--muted); transform: translateY(50%); }
.bars { position: relative; height: 100%; display: flex; justify-content: space-around; gap: 4px; }
.bar-group { display: flex; flex-direction: column; height: 100%; flex: 1; cursor: pointer; }
.bar-pair { flex: 1; min-height: 0; display: flex; align-items: flex-end; justify-content: center; gap: clamp(4px, 1vw, 10px); }
.bar { width: clamp(9px, 1.6vw, 18px); height: 0; border-radius: 6px 6px 3px 3px; }
.bar-seen { background: var(--bar-light); }
.bar-sale { background: var(--primary); transition: filter .2s ease; }
.bar-group:hover .bar-sale, .bar-group.hovered .bar-sale { filter: brightness(1.15); }
.bar-label { height: 28px; line-height: 28px; text-align: center; font-size: .78rem; color: var(--muted); }
.chart-tooltip {
    position: absolute; display: none; z-index: 5;
    background: var(--tooltip-bg); color: #fff;
    padding: .6rem .9rem; border-radius: 12px;
    font-size: .78rem; pointer-events: none;
    transform: translate(-50%, -100%);
    white-space: nowrap;
    box-shadow: 0 10px 25px rgba(0,0,0,.25);
}
.chart-tooltip .row-t { display: flex; align-items: center; gap: .55rem; }
.chart-tooltip .row-t + .row-t { margin-top: .35rem; }
.chart-tooltip .dot { width: 13px; height: 13px; }
.chart-tooltip .t-seen { background: #fff; }
.chart-tooltip .t-sale { background: #8a7cf2; }
.chart-tooltip small { opacity: .7; }

/* Ring chart */
.ring-wrap { position: relative; max-width: 330px; margin: 1rem auto 1.2rem; height: 210px; }
.ring-wrap svg { width: 210px; height: 210px; display: block; }
.ring-track { fill: none; stroke: var(--track); }
.ring { fill: none; stroke-linecap: round; }
.ring-float {
    position: absolute; right: 0; top: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem 1.3rem;
    box-shadow: 0 12px 30px rgba(40, 30, 110, .12);
    min-width: 150px;
}
.ring-float .big { font-weight: 700; font-size: 1.7rem; line-height: 1.1; }
.cat-row { display: flex; align-items: center; gap: .8rem; padding: .55rem 0; }
.cat-row .name { font-weight: 500; flex: 1; font-size: .95rem; }
.cat-row .val { font-weight: 600; min-width: 56px; text-align: right; }
.cat-row .pill { min-width: 70px; justify-content: center; }

/* Bubbles */
.bubble-box { position: relative; width: 210px; height: 200px; flex-shrink: 0; }
.bubble {
    position: absolute; border-radius: 50%;
    display: grid; place-items: center;
    color: #fff; font-weight: 600;
    transform: scale(0);
    cursor: default;
}
.country { display: flex; align-items: center; gap: .7rem; margin-bottom: 1rem; }
.flag { width: 30px; height: 30px; border-radius: 50%; background: var(--icon-bg); color: var(--muted); display: grid; place-items: center; font-size: .62rem; font-weight: 700; flex-shrink: 0; }
.country .c-name { font-size: .8rem; font-weight: 600; margin-bottom: .2rem; }
.c-track { height: 7px; border-radius: 10px; background: var(--track); overflow: hidden; width: 100%; }
.c-fill { height: 100%; width: 0; background: var(--primary); border-radius: 10px; }

/* ============ TABLE ============ */
.table-x {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-hover-bg: var(--primary-soft);
    --bs-table-hover-color: var(--text);
    --bs-table-border-color: var(--border);
    font-size: .88rem;
}
.table-x thead th {
    font-size: .76rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
    color: var(--muted); background: var(--icon-bg);
    border-bottom: 0; padding: .75rem 1rem; white-space: nowrap;
}
.table-x thead th:first-child { border-radius: 10px 0 0 10px; }
.table-x thead th:last-child  { border-radius: 0 10px 10px 0; }
.table-x tbody td { padding: .7rem 1rem; }
.table-x tbody tr { transition: background-color .2s ease; }
.table-x tbody tr:not(.table-state):hover > * { background: var(--primary-soft); }
.table-x tbody tr:last-child td { border-bottom: 0; }
.table-x .table-state td { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.table-link { color: var(--text); text-decoration: none; transition: color .2s ease; }
.table-link:hover, .table-link:focus-visible { color: var(--primary); text-decoration: underline; }
.member-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0;
    display: grid; place-items: center;
    background: var(--icon-bg); color: var(--muted);
    border: 2px solid var(--card-bg);
    box-shadow: var(--shadow);
}

/* ============ PAGINATION ============ */
.pager-wrap {
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem 1rem; flex-wrap: wrap;
    margin-top: 1.5rem; padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}
.pager-info { font-size: .82rem; color: var(--muted); margin: 0; }
.pager-info strong { color: var(--text); font-weight: 600; }
.pager {
    display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
    list-style: none; margin: 0; padding: .3rem;
    background: var(--icon-bg);
    border-radius: 50rem;
}
.pager-link {
    min-width: 36px; height: 36px; padding: 0 .6rem;
    display: grid; place-items: center;
    border-radius: 50rem;
    color: var(--text); text-decoration: none;
    font-size: .85rem; font-weight: 500;
    transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.pager-link i { font-size: .8rem; }
a.pager-link:hover { background: var(--primary-soft); color: var(--primary); }
a.pager-link:focus-visible { outline: 0; box-shadow: 0 0 0 .22rem rgba(107, 91, 214, .25); }
.pager-link.active {
    background: var(--primary); color: #fff; font-weight: 600;
    box-shadow: 0 6px 16px rgba(107, 91, 214, .35);
}
.pager-link.disabled { color: var(--muted); opacity: .45; cursor: not-allowed; }

/* ============ FORM ============ */
.form-x .form-label { font-size: .82rem; font-weight: 500; color: var(--text); margin-bottom: .4rem; }
.field-x {
    display: flex; align-items: center;
    background: var(--icon-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color .2s ease, box-shadow .2s ease, background-color .35s ease;
}
.field-x:focus-within { border-color: var(--primary); box-shadow: 0 0 0 .22rem rgba(107, 91, 214, .18); }
.field-x > i { padding: 0 0 0 .95rem; color: var(--muted); font-size: 1rem; }
.field-x .form-control {
    background: transparent; border: 0; box-shadow: none;
    color: var(--text); font-size: .92rem;
    padding: .72rem .95rem;
}
.field-x .form-control::placeholder { color: var(--muted); opacity: .75; }
.field-x .form-control:focus { background: transparent; box-shadow: none; color: var(--text); }
.field-x .field-btn {
    border: 0; background: transparent; color: var(--muted);
    padding: 0 .95rem; align-self: stretch; border-radius: 0 12px 12px 0;
}
.field-x .field-btn:hover, .field-x .field-btn:focus-visible { color: var(--primary); }
.field-x.is-invalid { border-color: var(--rose); }
.field-x.is-invalid:focus-within { box-shadow: 0 0 0 .22rem rgba(244, 63, 94, .18); }
.field-error { display: none; font-size: .76rem; color: var(--rose); margin-top: .35rem; }
.field-x.is-invalid + .field-error { display: block; }
.form-x .form-check-input { background-color: var(--icon-bg); border-color: var(--border); }
.form-x .form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-x .form-check-input:focus { border-color: var(--primary); box-shadow: 0 0 0 .22rem rgba(107, 91, 214, .18); }
.form-x .form-check-label { font-size: .85rem; color: var(--muted); }

/* ============ AUTH (login) ============ */
.auth {
    min-height: 100vh;
    display: grid; place-items: center;
    padding: 1.25rem;
}
.auth-card {
    display: grid; grid-template-columns: 1fr 1fr;
    width: 100%; max-width: 960px;
    overflow: hidden;
}
.auth-art {
    position: relative; overflow: hidden;
    background: linear-gradient(150deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 2.5rem;
    display: flex; flex-direction: column;
}
.auth-art .brand { color: #fff; padding: 0; margin-bottom: 0; }
.auth-art .brand-logo { background: rgba(255, 255, 255, .95); color: var(--primary); }
.auth-art h2 { font-weight: 700; font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 1.25; margin: auto 0 .75rem; position: relative; }
.auth-art p { font-size: .88rem; opacity: .85; margin: 0; max-width: 320px; position: relative; }
.auth-art::before, .auth-art::after {
    content: ''; position: absolute; border-radius: 50%;
    background: rgba(255, 255, 255, .08);
}
.auth-art::before { width: 320px; height: 320px; top: -110px; right: -120px; }
.auth-art::after  { width: 200px; height: 200px; bottom: 90px; right: 40px; background: rgba(255, 255, 255, .06); }
.auth-stats { display: flex; gap: .6rem; margin-top: 2rem; position: relative; flex-wrap: wrap; }
.auth-stats .pill { background: rgba(255, 255, 255, .16); color: #fff; font-weight: 500; }
.auth-form { padding: 2.5rem; position: relative; }
.auth-form .auth-title { font-weight: 700; font-size: 1.6rem; margin: 0 0 .3rem; letter-spacing: -.01em; }
.auth-form .auth-sub { color: var(--muted); font-size: .88rem; margin: 0 0 2rem; }
.auth-form .auth-theme { position: absolute; top: 1.25rem; right: 1.25rem; box-shadow: none; background: var(--icon-bg); width: 40px; height: 40px; }
.auth-form .btn-main { padding: .72rem 1rem; font-weight: 500; }
.auth-alert {
    display: none; align-items: center; gap: .6rem;
    background: var(--rose-soft); color: var(--rose);
    border-radius: 12px; padding: .7rem .9rem;
    font-size: .84rem; margin-bottom: 1.25rem;
}
.auth-alert.show { display: flex; }
.auth-foot { text-align: center; font-size: .76rem; color: var(--muted); margin-top: 1.25rem; }

/* ============ ERROR PAGE (404) ============ */
.error-card {
    position: relative; overflow: hidden;
    width: 100%; max-width: 560px;
    padding: 2.5rem 2.5rem 1.75rem;
    text-align: center;
}
.error-card::before, .error-card::after {
    content: ''; position: absolute; border-radius: 50%;
    background: var(--primary-soft);
    pointer-events: none;
}
.error-card::before { width: 260px; height: 260px; top: -130px; left: -110px; }
.error-card::after  { width: 180px; height: 180px; bottom: -90px; right: -70px; }
.error-card > * { position: relative; z-index: 1; }
.error-card .auth-theme { position: absolute; top: 1.25rem; right: 1.25rem; box-shadow: none; background: var(--icon-bg); width: 40px; height: 40px; }
.error-brand { justify-content: center; padding: 0; margin-bottom: 1.75rem; }
.error-art { margin-bottom: 1.25rem; }
.error-code {
    display: inline-flex; align-items: center; gap: .1em;
    font-weight: 700; font-size: clamp(4.5rem, 16vw, 7.5rem);
    line-height: 1; letter-spacing: -.03em;
    background: linear-gradient(150deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.error-zero {
    width: .82em; height: .82em; border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(150deg, var(--primary), var(--primary-dark));
    box-shadow: 0 12px 30px rgba(107, 91, 214, .35);
    color: #fff; font-size: .42em;
}
.error-zero i { display: inline-block; animation: error-spin 6s ease-in-out infinite; }
@keyframes error-spin {
    0%, 100% { transform: rotate(-25deg); }
    50%      { transform: rotate(35deg); }
}
.error-title { font-weight: 700; font-size: clamp(1.25rem, 2.4vw, 1.6rem); margin: 0 0 .5rem; letter-spacing: -.01em; }
.error-sub { color: var(--muted); font-size: .88rem; max-width: 400px; margin: 0 auto 1.75rem; }
.error-actions { display: flex; justify-content: center; gap: .75rem; flex-wrap: wrap; }
.error-actions .btn { padding: .65rem 1.4rem; font-weight: 500; }
@media (prefers-reduced-motion: reduce) {
    .error-zero i { animation: none; }
}

/* ============ COURSE ============ */
.course-thumb {
    width: 72px; height: 48px; border-radius: 10px;
    object-fit: cover; flex-shrink: 0;
    display: grid; place-items: center;
    background: var(--icon-bg); color: var(--muted);
    border: 1px solid var(--border);
}
.vdo-thumb { width: 120px; height: 68px; }
.course-cover {
    width: 100%; aspect-ratio: 16 / 9; border-radius: 14px;
    object-fit: cover; display: block;
    background: var(--icon-bg);
    border: 1px solid var(--border);
}
.img-preview {
    width: 100%; max-width: 360px; aspect-ratio: 16 / 9; border-radius: 12px;
    object-fit: cover; display: block;
    background: var(--icon-bg);
    border: 1px dashed var(--border);
}
.course-desc { color: var(--muted); font-size: .88rem; white-space: pre-line; margin: 0; }
.table-x .table-actions { white-space: nowrap; text-align: right; }

/* ============ RESPONSIVE TWEAKS ============ */
@media (max-width: 991.98px) {
    .app { padding: .9rem; }
    .auth-card { grid-template-columns: 1fr; max-width: 460px; }
    .auth-art { display: none; }
}
@media (max-width: 575.98px) {
    .app { padding: .65rem; }
    .panel { padding: 1.1rem; }
    .auth { padding: .65rem; }
    .auth-form { padding: 2rem 1.35rem; }
    .error-card { padding: 2rem 1.35rem 1.5rem; }
    .error-brand { margin-top: .25rem; font-size: .95rem; }
    .error-actions .btn { flex: 1 1 100%; }
    .pager-wrap { justify-content: center; }
    .pager-link { min-width: 32px; height: 32px; padding: 0 .45rem; font-size: .8rem; }
    .icon-btn, .avatar, .search-box { width: 40px; height: 40px; }
    .search-box { width: auto; }
    .chart { padding-left: 36px; height: 220px; --plot: 192px; }
    .grid-line { left: 36px; }
    .ring-wrap { transform: scale(.9); transform-origin: left top; height: 190px; }
    .ring-float { padding: .75rem 1rem; min-width: 130px; }
    .ring-float .big { font-size: 1.4rem; }
}