/* ============================================================
   Dolotech — giao diện trang quản trị
   Giữ nguyên tên lớp cũ để các view không phải sửa theo.
   ============================================================ */

:root {
    /* Màu thương hiệu */
    --a-brand: #2563eb;
    --a-brand-dark: #1d4ed8;
    --a-brand-light: #60a5fa;
    --a-cyan: #06b6d4;
    --a-gradient: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);

    /* Thanh bên */
    --a-sidebar-top: #0b1220;
    --a-sidebar-bottom: #111c30;
    --a-sidebar-hover: rgba(255, 255, 255, .07);

    /* Nền & chữ */
    --a-bg: #f1f5f9;
    --a-surface: #ffffff;
    --a-surface-soft: #f8fafc;
    --a-ink: #0f172a;
    --a-ink-soft: #334155;
    --a-muted: #64748b;
    --a-muted-light: #94a3b8;
    --a-line: #e5e9f0;
    --a-line-soft: #f1f5f9;

    /* Trạng thái */
    --a-success: #059669;
    --a-danger: #dc2626;
    --a-warning: #d97706;
    --a-info: #0284c7;
    --a-violet: #7c3aed;

    /* Hình khối */
    --a-radius-sm: 9px;
    --a-radius: 14px;
    --a-radius-lg: 18px;
    --a-shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
    --a-shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .14);
    --a-shadow-lg: 0 18px 44px -16px rgba(15, 23, 42, .28);
    --a-ring: 0 0 0 3px rgba(37, 99, 235, .16);

    --a-sidebar-w: 264px;
    --a-ease: cubic-bezier(.22, .61, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

body.admin {
    margin: 0;
    font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--a-ink-soft);
    background: var(--a-bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--a-brand); text-decoration: none; transition: color .16s var(--a-ease); }
a:hover { color: var(--a-brand-dark); }

h1, h2, h3, h4 {
    margin: 0 0 .5em;
    line-height: 1.3;
    font-weight: 700;
    color: var(--a-ink);
    letter-spacing: -.01em;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8rem; }

:focus-visible { outline: 2px solid var(--a-brand); outline-offset: 2px; border-radius: 6px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; border: 3px solid var(--a-bg); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---------------------------------------------------------- Bố cục */
.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--a-sidebar-w);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--a-sidebar-top) 0%, var(--a-sidebar-bottom) 100%);
    color: rgba(255, 255, 255, .62);
    z-index: 50;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Vệt sáng mờ ở góc trên cho thanh bên bớt phẳng */
.admin-sidebar::before {
    content: "";
    position: absolute;
    top: -120px;
    left: -60px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, .38), transparent 70%);
    pointer-events: none;
}
.admin-sidebar > * { position: relative; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-color: transparent; }

.admin-brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    color: #fff;
}
.admin-brand:hover { color: #fff; }
.admin-brand svg { width: 36px; height: 36px; flex: none; border-radius: 10px; }
.admin-brand strong { font-size: 1.02rem; font-weight: 800; letter-spacing: .06em; display: block; }
.admin-brand small {
    display: block;
    font-size: .67rem;
    color: rgba(255, 255, 255, .42);
    letter-spacing: .07em;
    text-transform: uppercase;
}

.admin-nav { padding: .9rem .7rem 1.2rem; flex: 1; }
.admin-nav-group {
    padding: 1.15rem .75rem .4rem;
    margin: 0;
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .28);
}
.admin-nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .75rem;
    margin-bottom: 2px;
    border-radius: 10px;
    color: rgba(255, 255, 255, .7);
    font-size: .89rem;
    font-weight: 500;
    transition: background .16s var(--a-ease), color .16s var(--a-ease), transform .16s var(--a-ease);
}
.admin-nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.admin-nav a:hover { background: var(--a-sidebar-hover); color: #fff; transform: translateX(2px); }
.admin-nav a:hover svg { opacity: 1; }
.admin-nav a.is-active {
    background: var(--a-gradient);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 8px 20px -8px rgba(37, 99, 235, .8);
}
.admin-nav a.is-active svg { opacity: 1; }

/* Vạch nhỏ bên trái cho mục đang mở, để mắt bắt nhanh vị trí */
.admin-nav a.is-active::before {
    content: "";
    position: absolute;
    left: -.7rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 22px;
    border-radius: 0 3px 3px 0;
    background: var(--a-brand-light);
}
.admin-nav .count {
    margin-left: auto;
    min-width: 22px;
    padding: 0 7px;
    border-radius: 99px;
    background: #ef4444;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    text-align: center;
    line-height: 22px;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .18);
}
.admin-nav a.is-active .count { background: rgba(255, 255, 255, .25); box-shadow: none; }

.admin-sidebar-foot {
    padding: .9rem 1rem 1.1rem;
    border-top: 1px solid rgba(255, 255, 255, .07);
    font-size: .82rem;
}
.admin-sidebar-foot a {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .5rem;
    border-radius: 8px;
    color: rgba(255, 255, 255, .55);
}
.admin-sidebar-foot a:hover { background: var(--a-sidebar-hover); color: #fff; }
.admin-sidebar-foot svg { width: 16px; height: 16px; }

.admin-main { flex: 1; margin-left: var(--a-sidebar-w); min-width: 0; display: flex; flex-direction: column; }

/* ---------------------------------------------------------- Thanh trên */
.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .85rem 1.75rem;
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--a-line);
}
.admin-topbar h1 { margin: 0; font-size: 1.16rem; }
.admin-topbar .spacer { margin-left: auto; }
.topbar-crumb {
    display: block;
    font-size: .73rem;
    color: var(--a-muted-light);
    font-weight: 500;
    letter-spacing: .02em;
}

.admin-user { display: flex; align-items: center; gap: .6rem; font-size: .85rem; color: var(--a-ink); font-weight: 500; }
.admin-avatar {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--a-gradient);
    color: #fff;
    font-weight: 700;
    font-size: .88rem;
    box-shadow: 0 4px 12px -4px rgba(37, 99, 235, .6);
}
.admin-user-meta { line-height: 1.25; }
.admin-user-meta span { display: block; font-size: .72rem; color: var(--a-muted); font-weight: 400; }

.admin-content { padding: 1.6rem 1.75rem 3rem; flex: 1; }

.admin-toggle {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--a-line);
    border-radius: 10px;
    background: #fff;
    color: var(--a-ink);
    cursor: pointer;
}

/* ---------------------------------------------------------- Thẻ */
.a-card {
    background: var(--a-surface);
    border: 1px solid var(--a-line);
    border-radius: var(--a-radius);
    box-shadow: var(--a-shadow);
    margin-bottom: 1.4rem;
    overflow: hidden;
}
.a-card-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.05rem 1.4rem;
    border-bottom: 1px solid var(--a-line-soft);
    background: linear-gradient(180deg, #fff 0%, var(--a-surface-soft) 100%);
}
.a-card-head h2 { margin: 0; font-size: 1rem; display: flex; align-items: center; gap: .55rem; }
.a-card-head h2 svg { width: 18px; height: 18px; color: var(--a-brand); }
.a-card-head .spacer { margin-left: auto; }
.a-card-body { padding: 1.4rem; }

/* ---------------------------------------------------------- Nút */
.a-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .58rem 1.1rem;
    border: 1px solid transparent;
    border-radius: 10px;
    font-family: inherit;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .16s var(--a-ease), color .16s var(--a-ease),
                border-color .16s var(--a-ease), box-shadow .16s var(--a-ease), transform .12s var(--a-ease);
}
.a-btn svg { width: 16px; height: 16px; }
.a-btn:active { transform: translateY(1px); }

.a-btn-primary { background: var(--a-gradient); color: #fff; box-shadow: 0 8px 20px -10px rgba(37, 99, 235, .9); }
.a-btn-primary:hover { color: #fff; box-shadow: 0 12px 26px -10px rgba(37, 99, 235, 1); }

.a-btn-light { background: #fff; border-color: var(--a-line); color: var(--a-ink); box-shadow: var(--a-shadow-xs); }
.a-btn-light:hover { border-color: var(--a-brand); color: var(--a-brand); background: #f8fbff; }

.a-btn-danger { background: #fff; border-color: #fecaca; color: var(--a-danger); }
.a-btn-danger:hover { background: var(--a-danger); border-color: var(--a-danger); color: #fff; }

.a-btn-sm { padding: .35rem .75rem; font-size: .8rem; border-radius: 8px; }
.a-btn-block { width: 100%; }

.a-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--a-line);
    border-radius: 9px;
    background: #fff;
    color: var(--a-muted);
    cursor: pointer;
    transition: color .16s var(--a-ease), border-color .16s var(--a-ease), background .16s var(--a-ease);
}
.a-icon-btn:hover { color: var(--a-brand); border-color: var(--a-brand); background: #f8fbff; }
.a-icon-btn.danger:hover { color: #fff; background: var(--a-danger); border-color: var(--a-danger); }
.a-icon-btn svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------- Bảng */
.a-table-wrap { overflow-x: auto; }
.a-table { width: 100%; border-collapse: collapse; font-size: .885rem; }
.a-table th, .a-table td { padding: .85rem 1.1rem; text-align: left; vertical-align: middle; }
.a-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--a-muted);
    background: var(--a-surface-soft);
    border-bottom: 1px solid var(--a-line);
    white-space: nowrap;
}
.a-table tbody td { border-bottom: 1px solid var(--a-line-soft); }
.a-table tbody tr { transition: background .14s var(--a-ease); }
.a-table tbody tr:hover { background: #f8fbff; }
.a-table tbody tr:last-child td { border-bottom: 0; }
.a-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.a-table .actions { display: flex; gap: .35rem; justify-content: flex-end; }
.a-table .thumb {
    width: 54px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--a-line);
    background: var(--a-surface-soft);
}
.a-table .sub { display: block; font-size: .78rem; color: var(--a-muted); font-weight: 400; margin-top: .1rem; }
.a-table code {
    font-size: .76rem;
    color: var(--a-muted);
    background: var(--a-surface-soft);
    border: 1px solid var(--a-line-soft);
    border-radius: 6px;
    padding: .1rem .4rem;
}

/* ---------------------------------------------------------- Nhãn trạng thái */
.a-badge {
    display: inline-flex;
    align-items: center;
    gap: .32rem;
    padding: .2rem .62rem;
    border-radius: 99px;
    font-size: .74rem;
    font-weight: 600;
    white-space: nowrap;
}
.a-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.a-badge-on { background: #ecfdf5; color: #047857; }
.a-badge-off { background: #f1f5f9; color: #64748b; }
.a-badge-new { background: #eff6ff; color: #1d4ed8; }
.a-badge-progress { background: #fffbeb; color: #b45309; }
.a-badge-done { background: #ecfdf5; color: #047857; }
.a-badge-archived { background: #f1f5f9; color: #64748b; }
.a-badge-star { background: #fef3c7; color: #a16207; }
.a-badge-star::before { display: none; }

/* ---------------------------------------------------------- Biểu mẫu */
.a-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.1rem 1.25rem; }
.a-form-grid.full { grid-template-columns: 1fr; }

.a-field { margin-bottom: 1.15rem; }
.a-field:last-child { margin-bottom: 0; }
.a-field label { display: block; margin-bottom: .4rem; font-size: .82rem; font-weight: 600; color: var(--a-ink); }
.a-field .hint { display: block; margin-top: .35rem; font-size: .77rem; color: var(--a-muted); line-height: 1.5; }

.a-field input[type=text], .a-field input[type=email], .a-field input[type=url],
.a-field input[type=tel], .a-field input[type=number], .a-field input[type=date],
.a-field input[type=password], .a-field input[type=search], .a-field input[type=color],
.a-field select, .a-field textarea {
    width: 100%;
    padding: .62rem .85rem;
    border: 1px solid var(--a-line);
    border-radius: 10px;
    background: #fff;
    font-family: inherit;
    font-size: .9rem;
    color: var(--a-ink);
    transition: border-color .16s var(--a-ease), box-shadow .16s var(--a-ease), background .16s var(--a-ease);
}
.a-field input::placeholder, .a-field textarea::placeholder { color: var(--a-muted-light); }
.a-field input[type=color] { padding: .22rem; height: 44px; cursor: pointer; }
.a-field textarea { resize: vertical; min-height: 96px; line-height: 1.65; }
.a-field input:hover, .a-field select:hover, .a-field textarea:hover { border-color: #cbd5e1; }
.a-field input:focus, .a-field select:focus, .a-field textarea:focus {
    outline: none;
    border-color: var(--a-brand);
    box-shadow: var(--a-ring);
}
.a-field textarea.code {
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: .83rem;
    min-height: 240px;
    background: var(--a-surface-soft);
    line-height: 1.7;
}
.a-field input[type=file] {
    width: 100%;
    font-size: .84rem;
    padding: .55rem;
    border: 1px dashed var(--a-line);
    border-radius: 10px;
    background: var(--a-surface-soft);
    cursor: pointer;
}
.a-field input[type=file]:hover { border-color: var(--a-brand); background: #f8fbff; }

.a-check {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .55rem .85rem;
    border: 1px solid var(--a-line);
    border-radius: 10px;
    background: var(--a-surface-soft);
    font-size: .87rem;
    font-weight: 500;
    color: var(--a-ink);
    cursor: pointer;
    transition: border-color .16s var(--a-ease), background .16s var(--a-ease);
}
.a-check:hover { border-color: var(--a-brand-light); background: #f8fbff; }
.a-check input { width: 18px; height: 18px; accent-color: var(--a-brand); cursor: pointer; margin: 0; }
.a-check:has(input:checked) { border-color: var(--a-brand); background: #eff6ff; color: var(--a-brand-dark); }

.input-validation-error { border-color: var(--a-danger) !important; background: #fef2f2 !important; }
.field-validation-error { display: block; margin-top: .35rem; color: var(--a-danger); font-size: .79rem; font-weight: 500; }
.validation-summary-errors {
    margin-bottom: 1.1rem;
    padding: .8rem 1rem;
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: #fef2f2;
    color: #991b1b;
    font-size: .85rem;
}
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }
.validation-summary-valid { display: none; }

.a-form-actions {
    display: flex;
    gap: .6rem;
    align-items: center;
    padding: 1rem 1.4rem;
    border-top: 1px solid var(--a-line-soft);
    background: var(--a-surface-soft);
}

/* ---------------------------------------------------------- Thẻ tab VI / EN */
.a-tabs {
    display: inline-flex;
    gap: .25rem;
    padding: 4px;
    margin-bottom: 1.4rem;
    border-radius: 11px;
    background: var(--a-surface-soft);
    border: 1px solid var(--a-line);
}
.a-tab {
    padding: .45rem 1.1rem;
    border: 0;
    border-radius: 8px;
    background: none;
    font-family: inherit;
    font-size: .86rem;
    font-weight: 600;
    color: var(--a-muted);
    cursor: pointer;
    transition: background .16s var(--a-ease), color .16s var(--a-ease), box-shadow .16s var(--a-ease);
}
.a-tab:hover { color: var(--a-ink); }
.a-tab.is-active { background: #fff; color: var(--a-brand); box-shadow: var(--a-shadow-xs); }
.a-tab-panel[hidden] { display: none; }

/* ---------------------------------------------------------- Bảng điều khiển */
.a-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.1rem; margin-bottom: 1.5rem; }
.a-stat {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.35rem;
    background: var(--a-surface);
    border: 1px solid var(--a-line);
    border-radius: var(--a-radius);
    box-shadow: var(--a-shadow);
    overflow: hidden;
    transition: transform .2s var(--a-ease), box-shadow .2s var(--a-ease);
}
.a-stat:hover { transform: translateY(-2px); box-shadow: var(--a-shadow-lg); }

/* Vạch màu trên đỉnh thẻ, mỗi loại số liệu một màu để phân biệt nhanh */
.a-stat::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: var(--stat-color, var(--a-brand));
}
.a-stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    flex: none;
    border-radius: 13px;
    background: color-mix(in srgb, var(--stat-color, var(--a-brand)) 12%, transparent);
    color: var(--stat-color, var(--a-brand));
}
.a-stat-icon svg { width: 22px; height: 22px; }
.a-stat strong {
    display: block;
    font-size: 1.65rem;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    color: var(--a-ink);
    letter-spacing: -.02em;
}
.a-stat span { font-size: .8rem; color: var(--a-muted); }

.a-columns { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 1.4rem; align-items: start; }

/* Biểu đồ cột */
.a-chart { display: flex; align-items: flex-end; gap: 7px; height: 170px; padding: 0 .2rem; }
.a-chart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: .45rem;
    height: 100%;
}
.a-chart-bar {
    width: 100%;
    max-width: 34px;
    min-height: 4px;
    border-radius: 6px 6px 3px 3px;
    background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
    transition: filter .16s var(--a-ease), transform .16s var(--a-ease);
}
.a-chart-col:hover .a-chart-bar { filter: saturate(1.4) brightness(1.08); transform: scaleY(1.03); transform-origin: bottom; }
.a-chart-bar.is-empty { background: var(--a-line); }
.a-chart-label { font-size: .66rem; color: var(--a-muted-light); white-space: nowrap; }

.a-list { list-style: none; margin: 0; padding: 0; }
.a-list li { padding: .75rem 0; border-bottom: 1px solid var(--a-line-soft); font-size: .87rem; }
.a-list li:first-child { padding-top: 0; }
.a-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.a-list .meta { display: block; font-size: .77rem; color: var(--a-muted); margin-top: .15rem; }

/* Lối tắt dạng ô */
.a-quick { display: grid; gap: .6rem; }
.a-quick a {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .75rem .9rem;
    border: 1px solid var(--a-line);
    border-radius: 11px;
    background: #fff;
    color: var(--a-ink);
    font-size: .875rem;
    font-weight: 600;
    transition: border-color .16s var(--a-ease), background .16s var(--a-ease), transform .16s var(--a-ease);
}
.a-quick a:hover { border-color: var(--a-brand); background: #f8fbff; color: var(--a-brand-dark); transform: translateX(3px); }
.a-quick a svg { width: 18px; height: 18px; color: var(--a-brand); flex: none; }
.a-quick a .arrow { margin-left: auto; color: var(--a-muted-light); }

/* ---------------------------------------------------------- Thông báo */
.a-alert {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    padding: .9rem 1.15rem;
    border-radius: 11px;
    font-size: .875rem;
    margin-bottom: 1.3rem;
    box-shadow: var(--a-shadow-xs);
}
.a-alert svg { width: 19px; height: 19px; flex: none; margin-top: .1rem; }
.a-alert-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.a-alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.a-alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.a-alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

/* ---------------------------------------------------------- Thanh công cụ */
.a-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    margin-bottom: 1.3rem;
}
.a-toolbar .spacer { margin-left: auto; }
.a-toolbar .count-note { margin: 0; color: var(--a-muted); font-size: .86rem; }
.a-toolbar input[type=search], .a-toolbar select {
    padding: .55rem .85rem;
    border: 1px solid var(--a-line);
    border-radius: 10px;
    background: #fff;
    font-family: inherit;
    font-size: .86rem;
    color: var(--a-ink);
    box-shadow: var(--a-shadow-xs);
    transition: border-color .16s var(--a-ease), box-shadow .16s var(--a-ease);
}
.a-toolbar input[type=search]:focus, .a-toolbar select:focus {
    outline: none;
    border-color: var(--a-brand);
    box-shadow: var(--a-ring);
}
.a-toolbar input[type=search] { min-width: 230px; }

/* ---------------------------------------------------------- Trạng thái rỗng */
.a-empty { padding: 3.5rem 1.5rem; text-align: center; color: var(--a-muted); }
.a-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    border-radius: 18px;
    background: var(--a-surface-soft);
    border: 1px solid var(--a-line);
    color: var(--a-muted-light);
}
.a-empty-icon svg { width: 28px; height: 28px; }
.a-empty h3 { margin: 0 0 .3rem; font-size: 1rem; color: var(--a-ink); }
.a-empty p { margin: 0 auto 1.2rem; max-width: 42ch; font-size: .875rem; }

/* ---------------------------------------------------------- Phân trang */
.a-pagination { display: flex; gap: .35rem; justify-content: center; margin-top: 1.4rem; }
.a-pagination a, .a-pagination span {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 .65rem;
    border: 1px solid var(--a-line);
    border-radius: 9px;
    background: #fff;
    font-size: .85rem;
    font-weight: 500;
    color: var(--a-ink);
    box-shadow: var(--a-shadow-xs);
}
.a-pagination a:hover { border-color: var(--a-brand); color: var(--a-brand); }
.a-pagination .is-active { background: var(--a-gradient); border-color: transparent; color: #fff; font-weight: 600; }
.a-pagination .is-disabled { opacity: .45; pointer-events: none; }

/* ---------------------------------------------------------- Ảnh xem trước */
.a-image-preview {
    display: block;
    max-width: 220px;
    margin-bottom: .6rem;
    border: 1px solid var(--a-line);
    border-radius: 11px;
    overflow: hidden;
    background: var(--a-surface-soft);
}
.a-image-preview img { display: block; width: 100%; }

/* ---------------------------------------------------------- Hàng tính năng */
.feature-rows { display: grid; gap: .75rem; }
.feature-row {
    display: grid;
    grid-template-columns: 160px 1fr 1fr 40px;
    gap: .65rem;
    align-items: start;
    padding: .9rem;
    border: 1px solid var(--a-line);
    border-radius: 12px;
    background: var(--a-surface-soft);
    transition: border-color .16s var(--a-ease), background .16s var(--a-ease);
}
.feature-row:hover { border-color: #cbd5e1; background: #fff; }
.feature-row input, .feature-row select, .feature-row textarea {
    width: 100%;
    margin-bottom: .4rem;
    padding: .5rem .7rem;
    border: 1px solid var(--a-line);
    border-radius: 8px;
    font-family: inherit;
    font-size: .85rem;
    background: #fff;
    color: var(--a-ink);
}
.feature-row input:focus, .feature-row select:focus, .feature-row textarea:focus {
    outline: none;
    border-color: var(--a-brand);
    box-shadow: var(--a-ring);
}
.feature-row textarea { resize: vertical; min-height: 54px; }
.feature-row input:last-child, .feature-row textarea:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------- Trang đăng nhập */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
    background: linear-gradient(160deg, #060b16 0%, #101b2f 50%, #16294a 100%);
    position: relative;
    overflow: hidden;
}
.login-page::before, .login-page::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
}
.login-page::before {
    width: 460px;
    height: 460px;
    top: -150px;
    right: -110px;
    background: radial-gradient(circle, rgba(37, 99, 235, .5), transparent 70%);
}
.login-page::after {
    width: 400px;
    height: 400px;
    bottom: -180px;
    left: -120px;
    background: radial-gradient(circle, rgba(6, 182, 212, .35), transparent 70%);
}
.login-card {
    position: relative;
    width: min(100%, 430px);
    padding: 2.4rem;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 34px 80px -20px rgba(2, 8, 23, .65);
}
.login-card .admin-brand {
    justify-content: center;
    padding: 0 0 1.5rem;
    border-bottom: 0;
    color: var(--a-ink);
}
.login-card .admin-brand small { color: var(--a-muted); }
.login-head { text-align: center; margin-bottom: 1.7rem; }
.login-head h1 { font-size: 1.35rem; margin-bottom: .35rem; }
.login-head p { color: var(--a-muted); font-size: .875rem; margin: 0; }
.login-foot { margin-top: 1.5rem; text-align: center; font-size: .84rem; color: var(--a-muted); }

/* ---------------------------------------------------------- Màn hình nhỏ */
.admin-backdrop { display: none; }

@media (max-width: 1100px) {
    .a-columns { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .admin-sidebar { transform: translateX(-100%); transition: transform .25s var(--a-ease); box-shadow: none; }
    .admin-sidebar.is-open { transform: none; box-shadow: var(--a-shadow-lg); }
    .admin-main { margin-left: 0; }
    .admin-toggle { display: inline-flex; }
    .admin-topbar { padding: .75rem 1rem; gap: .7rem; }
    .admin-topbar h1 { font-size: 1.02rem; }
    .admin-content { padding: 1.1rem 1rem 2.5rem; }
    .admin-user-meta { display: none; }
    .feature-row { grid-template-columns: 1fr; }
    .a-card-body, .a-card-head, .a-form-actions { padding-inline: 1.05rem; }
    .a-table th, .a-table td { padding: .7rem .8rem; }

    /* Lớp phủ khi mở menu, bấm ra ngoài là đóng */
    .admin-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 45;
        background: rgba(15, 23, 42, .45);
        opacity: 0;
        visibility: hidden;
        transition: opacity .22s var(--a-ease), visibility .22s;
    }
    .admin-backdrop.is-open { opacity: 1; visibility: visible; }
    body.admin.nav-open { overflow: hidden; }
}

@media (max-width: 640px) {
    .a-toolbar input[type=search] { min-width: 0; flex: 1; }
    .a-toolbar > form { display: flex; gap: .5rem; flex: 1 1 100%; }
    .a-stat { padding: 1rem 1.1rem; }
    .a-stat strong { font-size: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Ẩn nhãn chữ trên màn hình hẹp, chỉ giữ lại icon */
@media (max-width: 760px) {
    .hide-sm { display: none; }
}

/* ---------------------------------------------------------- Trình soạn thảo nội dung */
.rte {
    border: 1px solid var(--a-line);
    border-radius: 11px;
    overflow: hidden;
    background: #fff;
    transition: border-color .16s var(--a-ease), box-shadow .16s var(--a-ease);
}
.rte:focus-within { border-color: var(--a-brand); box-shadow: var(--a-ring); }

.rte-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    padding: .45rem .5rem;
    border-bottom: 1px solid var(--a-line);
    background: var(--a-surface-soft);
}
.rte-btn {
    min-width: 32px;
    height: 30px;
    padding: 0 .45rem;
    border: 1px solid transparent;
    border-radius: 7px;
    background: none;
    font-family: inherit;
    font-size: .82rem;
    line-height: 1;
    color: var(--a-ink-soft);
    cursor: pointer;
    transition: background .14s var(--a-ease), border-color .14s var(--a-ease), color .14s var(--a-ease);
}
.rte-btn:hover { background: #fff; border-color: var(--a-line); color: var(--a-brand); }
.rte-btn:active { background: #eff6ff; }
.rte-sep { width: 1px; height: 18px; margin: 0 .3rem; background: var(--a-line); }

.rte-area {
    min-height: 260px;
    max-height: 560px;
    overflow-y: auto;
    padding: 1rem 1.15rem;
    font-size: .93rem;
    line-height: 1.75;
    color: var(--a-ink-soft);
    outline: none;
}
.rte-area:empty::before {
    content: attr(data-placeholder);
    color: var(--a-muted-light);
}
.rte-area > *:first-child { margin-top: 0; }
.rte-area h2 { font-size: 1.2rem; margin: 1.3rem 0 .5rem; }
.rte-area h3 { font-size: 1.05rem; margin: 1.15rem 0 .45rem; }
.rte-area p { margin: 0 0 .75rem; }
.rte-area ul, .rte-area ol { margin: 0 0 .75rem; padding-left: 1.4rem; }
.rte-area li { margin-bottom: .3rem; }
.rte-area a { color: var(--a-brand); text-decoration: underline; }
.rte-area img { max-width: 100%; border-radius: 8px; margin: .6rem 0; }
.rte-area blockquote {
    margin: .9rem 0;
    padding: .3rem 0 .3rem 1rem;
    border-left: 3px solid var(--a-brand-light);
    color: var(--a-muted);
    font-style: italic;
}

/* Chế độ xem mã: giấu vùng trực quan, hiện textarea gốc */
.rte .rte-source { display: none; border: 0; border-radius: 0; }
.rte.is-source .rte-area { display: none; }
.rte.is-source .rte-source {
    display: block;
    min-height: 260px;
    border-radius: 0;
    box-shadow: none;
}
.rte.is-source .rte-source:focus { box-shadow: none; }
