/* ==========================================================================
   ANVAYONESIS CMS — Admin design system
   Emerald / white, clean cards, soft shadows. Inspired by the reference
   visitor-management dashboard.
   ========================================================================== */

:root {
    /* Brand — emerald */
    --brand-900: #06371f;
    --brand-800: #0a4a2c;
    --brand-700: #0c5c38;
    --brand-600: #107a48;
    --brand-500: #159a5a;
    --brand-400: #35b877;
    --brand-100: #d6f2e2;
    --brand-50:  #ebfaf1;

    /* Neutrals */
    --ink:       #0f172a;
    --ink-2:     #334155;
    --muted:     #64748b;
    --muted-2:   #94a3b8;
    --line:      #e6eaf0;
    --line-2:    #eef2f6;
    --bg:        #f6f8fa;
    --surface:   #ffffff;
    --surface-2: #f8fafc;

    /* Accents */
    --amber:   #f59e0b;
    --red:     #e5484d;
    --red-bg:  #fdecec;
    --green-bg: var(--brand-50);
    --blue:    #2563eb;

    /* Shape */
    --radius:    14px;
    --radius-sm: 10px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow:    0 4px 16px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 18px 48px rgba(15, 23, 42, 0.14);

    --sidebar-w: 264px;
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }

/* ---------- App shell ---------- */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 40;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 18px;
}
.brand-logo {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid var(--line);
    display: grid; place-items: center;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    flex-shrink: 0;
}
.brand-logo .brand-mark { height: 30px; width: auto; display: block; }
/* Original ANVAYONESIS lockup on a light card so it reads on the dark login panel */
.lb-logo-card {
    display: inline-flex;
    background: #ffffff;
    border-radius: 14px;
    padding: 14px 20px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.20);
}
.lb-lockup { height: 46px; width: auto; display: block; }
.brand-text { line-height: 1.15; }
.brand-text .name { font-weight: 750; font-size: 15px; color: var(--ink); }
.brand-text .sub { font-size: 11.5px; color: var(--muted); }

.nav {
    flex: 1;
    overflow-y: auto;
    padding: 6px 12px 16px;
}
.nav::-webkit-scrollbar { width: 8px; }
.nav::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 8px; }

.nav-section {
    padding: 16px 10px 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted-2);
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    margin: 2px 0;
    border-radius: 10px;
    color: var(--ink-2);
    font-weight: 500;
    transition: background 0.14s, color 0.14s;
    position: relative;
}
.nav-item svg { width: 18px; height: 18px; stroke-width: 1.9; color: var(--muted); flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item:hover svg { color: var(--ink-2); }
.nav-item.active {
    background: var(--brand-50);
    color: var(--brand-700);
    font-weight: 600;
}
.nav-item.active svg { color: var(--brand-600); }
.nav-item .count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface-2);
    border-radius: 20px;
    padding: 1px 8px;
}
.nav-item.active .count { background: #fff; color: var(--brand-700); }

.sidebar-foot {
    border-top: 1px solid var(--line);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-foot .avatar { flex-shrink: 0; }
.sidebar-foot .who { line-height: 1.2; min-width: 0; }
.sidebar-foot .who .n { font-weight: 650; font-size: 13px; color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who .r { font-size: 11px; color: var(--muted); }
.logout-btn {
    margin-left: auto;
    display: grid; place-items: center;
    width: 34px; height: 34px;
    border-radius: 9px;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
}
.logout-btn:hover { color: var(--red); background: var(--red-bg); }
.logout-btn svg { width: 17px; height: 17px; }

/* ---------- Avatar ---------- */
.avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(150deg, var(--brand-500), var(--brand-700));
    color: #fff;
    display: grid; place-items: center;
    font-weight: 700; font-size: 14px;
}
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }

/* ---------- Main / topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255,255,255,0.86);
    backdrop-filter: saturate(160%) blur(8px);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 26px;
    min-height: 66px;
}
.topbar h1 {
    font-size: 19px;
    color: var(--brand-700);
    font-weight: 700;
}
.topbar .spacer { flex: 1; }
.icon-btn {
    display: none;
    width: 40px; height: 40px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-2);
    place-items: center;
    cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }

.content { padding: 26px; flex: 1; }
.content-narrow { max-width: 1120px; margin: 0 auto; }

/* ---------- Topbar account dropdown ---------- */
.user-menu { position: relative; }
.user-trigger {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 10px 5px 5px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    font-family: inherit;
}
.user-trigger:hover { border-color: var(--muted-2); background: var(--surface-2); }
.user-trigger-name {
    font-size: 13px; font-weight: 600; color: var(--ink);
    max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-trigger .chev { width: 15px; height: 15px; color: var(--muted); transition: transform 0.18s; }
.user-menu.open .user-trigger .chev { transform: rotate(180deg); }
@media (max-width: 620px) { .user-trigger-name { display: none; } }

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 232px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 60;
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top right;
    pointer-events: none;
    transition: opacity 0.16s, transform 0.16s;
}
.user-menu.open .user-dropdown { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.user-dropdown-head {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 10px 12px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--line-2);
}
.user-dropdown-head .udh-info { min-width: 0; }
.user-dropdown-head .udh-name {
    font-weight: 650; font-size: 13.5px; color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-dropdown-head .udh-role { font-size: 11.5px; color: var(--muted); }
.user-dropdown-form { margin: 0; }
.user-dropdown-item {
    width: 100%;
    display: flex; align-items: center; gap: 10px;
    padding: 9px 11px;
    border-radius: 9px;
    font-size: 13.5px; font-weight: 550;
    color: var(--ink-2);
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}
.user-dropdown-item svg { width: 17px; height: 17px; color: var(--muted); stroke-width: 1.9; }
.user-dropdown-item:hover { background: var(--surface-2); color: var(--ink); }
.user-dropdown-item:hover svg { color: var(--ink-2); }
.user-dropdown-item.danger:hover { background: var(--red-bg); color: var(--red); }
.user-dropdown-item.danger:hover svg { color: var(--red); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 11px;
    font-weight: 600;
    font-size: 13.5px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s, transform 0.05s, border-color 0.15s;
    white-space: nowrap;
    font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; stroke-width: 2; }
.btn-primary {
    background: var(--brand-600);
    color: #fff;
    box-shadow: 0 6px 16px rgba(16, 122, 72, 0.25);
}
.btn-primary:hover { background: var(--brand-700); }
.btn-outline {
    background: #fff;
    border-color: var(--line);
    color: var(--ink-2);
}
.btn-outline:hover { border-color: var(--muted-2); background: var(--surface-2); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(0.94); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* icon-only action button (table rows) */
.act {
    display: inline-grid; place-items: center;
    width: 34px; height: 34px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.14s;
}
.act svg { width: 16px; height: 16px; stroke-width: 1.9; }
.act:hover { color: var(--brand-700); border-color: var(--brand-100); background: var(--brand-50); }
.act.danger:hover { color: var(--red); border-color: #f6cccc; background: var(--red-bg); }
.act-group { display: inline-flex; gap: 7px; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line-2);
}
.card-head h3 { font-size: 15px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 20px; }
.card-pad { padding: 20px; }

/* ---------- Stat cards ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 18px 16px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat .ico {
    position: absolute; top: 16px; right: 16px;
    width: 38px; height: 38px; border-radius: 11px;
    display: grid; place-items: center;
    background: var(--brand-50); color: var(--brand-600);
}
.stat .ico svg { width: 19px; height: 19px; stroke-width: 1.9; }
.stat .label { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.stat .value { font-size: 30px; font-weight: 750; margin-top: 8px; letter-spacing: -0.02em; color: var(--ink); }
.stat .foot { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat .foot strong { color: var(--brand-600); font-weight: 650; }

/* accent variants for icons */
.stat.amber .ico { background: #fef3e2; color: var(--amber); }
.stat.blue  .ico { background: #e7effe; color: var(--blue); }
.stat.violet .ico { background: #efe9fe; color: #7c3aed; }

/* ---------- Toolbar / search ---------- */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.search {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 460px;
}
.search svg {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; color: var(--muted-2); pointer-events: none;
}
.search input {
    width: 100%;
    padding: 11px 14px 11px 42px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search input::placeholder { color: var(--muted-2); }
.search input:focus {
    outline: none;
    border-color: var(--brand-400);
    box-shadow: 0 0 0 3px var(--brand-50);
}

/* ---------- Filter pills ---------- */
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
    padding: 8px 15px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fff;
    color: var(--ink-2);
    font-size: 12.5px;
    font-weight: 550;
    cursor: pointer;
    transition: all 0.14s;
    white-space: nowrap;
}
.pill:hover { border-color: var(--brand-100); background: var(--brand-50); color: var(--brand-700); }
.pill.active { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }

/* ---------- Tables ---------- */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.table-scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl thead th {
    text-align: left;
    padding: 13px 18px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
table.tbl tbody td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line-2);
    vertical-align: middle;
    color: var(--ink-2);
}
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl .primary { font-weight: 600; color: var(--ink); }
.cell-user { display: flex; align-items: center; gap: 11px; }
.cell-user .meta .e { font-size: 12px; color: var(--muted); }
.thumb {
    width: 46px; height: 46px; border-radius: 9px; object-fit: cover;
    border: 1px solid var(--line); background: var(--surface-2);
}

/* ---------- Badges / chips ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px; font-weight: 600;
    border: 1px solid transparent;
}
.badge.green { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.badge.gray  { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.badge.amber { background: #fef5e7; color: #b45309; border-color: #fce4bd; }
.badge.red   { background: var(--red-bg); color: #b42318; border-color: #f6cfcf; }
.badge.blue  { background: #eaf1fe; color: #1d4ed8; border-color: #d5e2fd; }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.chip {
    display: inline-block;
    padding: 3px 9px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 7px;
    font-size: 11.5px;
    color: var(--ink-2);
    margin: 2px 3px 2px 0;
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 18px;
    border-top: 1px solid var(--line-2);
    justify-content: space-between;
    flex-wrap: wrap;
}
.pagination .info { font-size: 12.5px; color: var(--muted); }
.pagination .pages { display: flex; align-items: center; gap: 6px; }
.page-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 13px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: var(--ink-2);
    font-size: 13px; font-weight: 550;
    cursor: pointer;
}
.page-btn svg { width: 15px; height: 15px; }
.page-btn:hover:not([aria-disabled="true"]) { border-color: var(--brand-100); background: var(--brand-50); color: var(--brand-700); }
.page-btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.page-now { font-size: 13px; color: var(--muted); padding: 0 6px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 18px; }
.form-2col { grid-template-columns: 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group.col-span { grid-column: 1 / -1; }
.form-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.form-label .req { color: var(--red); }
.form-hint { font-size: 12px; color: var(--muted); }
.form-control {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.form-control { resize: vertical; min-height: 84px; }
.form-control:focus {
    outline: none;
    border-color: var(--brand-400);
    box-shadow: 0 0 0 3px var(--brand-50);
}
.form-control.is-invalid { border-color: var(--red); }
.field-error { font-size: 12px; color: var(--red); }
select.form-control { appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px; }

.count-hint { font-size: 12px; color: var(--muted); text-align: right; }
.count-hint.over { color: var(--red); }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track {
    width: 42px; height: 24px; border-radius: 20px;
    background: #cbd5e1; position: relative; transition: background 0.18s;
}
.switch .track::after {
    content: ""; position: absolute; top: 3px; left: 3px;
    width: 18px; height: 18px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: transform 0.18s;
}
/* Use ~ (general sibling), not + : Thymeleaf injects a hidden `_field` input
   between the checkbox and .track, which breaks the adjacent-sibling selector. */
.switch input:checked ~ .track { background: var(--brand-500); }
.switch input:checked ~ .track::after { transform: translateX(18px); }
.switch .switch-label { font-size: 13.5px; color: var(--ink-2); font-weight: 550; }

/* File / image picker */
.uploader {
    border: 1.5px dashed var(--line);
    border-radius: 14px;
    padding: 18px;
    text-align: center;
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.uploader:hover { border-color: var(--brand-400); background: var(--brand-50); }
.uploader svg { width: 26px; height: 26px; color: var(--brand-500); margin: 0 auto 8px; }
.uploader .u-title { font-weight: 600; font-size: 13.5px; }
.uploader .u-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.uploader input[type=file] { display: none; }
.img-preview {
    margin-top: 14px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    max-width: 320px;
}
.img-preview img { width: 100%; display: block; }

.form-actions {
    display: flex; gap: 10px; justify-content: flex-end;
    padding-top: 20px; margin-top: 4px;
    border-top: 1px solid var(--line-2);
}

/* ---------- Permission editor ---------- */
.perm-module { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.perm-module-head {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 16px; background: var(--surface-2);
    border-bottom: 1px solid var(--line-2);
    font-weight: 650; font-size: 13.5px;
}
.perm-module-head .count { margin-left: auto; font-size: 11.5px; color: var(--muted); font-weight: 550; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px; padding: 12px 16px; }
.perm-check {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 9px 11px; border-radius: 9px; cursor: pointer;
}
.perm-check:hover { background: var(--surface-2); }
.perm-check input { margin-top: 2px; accent-color: var(--brand-600); width: 16px; height: 16px; }
.perm-check .pn { font-weight: 550; font-size: 13px; color: var(--ink); }
.perm-check .pd { font-size: 11.5px; color: var(--muted); }

/* ---------- Alerts ---------- */
.alert {
    display: flex; align-items: flex-start; gap: 11px;
    padding: 13px 16px; border-radius: 12px;
    font-size: 13.5px; font-weight: 500;
    margin-bottom: 18px;
    border: 1px solid transparent;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert.success { background: var(--brand-50); color: var(--brand-800); border-color: var(--brand-100); }
.alert.error { background: var(--red-bg); color: #b42318; border-color: #f6cfcf; }
.alert .close { margin-left: auto; cursor: pointer; opacity: 0.6; }
.alert .close:hover { opacity: 1; }

/* ---------- Gallery grid ---------- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}
.g-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.18s, transform 0.18s;
}
.g-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.g-thumb { aspect-ratio: 4 / 3; background: var(--surface-2); position: relative; }
.g-thumb img { width: 100%; height: 100%; object-fit: cover; }
.g-thumb .status { position: absolute; top: 10px; left: 10px; }
.g-thumb .g-play {
    position: absolute; inset: 0; margin: auto;
    width: 48px; height: 48px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.55);
    color: #fff;
    pointer-events: none;
}
.g-thumb .g-play svg { width: 22px; height: 22px; margin-left: 2px; }
.g-body { padding: 13px 14px 14px; }
.g-cat { font-size: 11px; font-weight: 650; letter-spacing: 0.03em; text-transform: uppercase; color: var(--brand-600); }
.g-title { font-size: 14px; font-weight: 700; color: var(--ink-1); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.g-desc { font-size: 13px; color: var(--ink-2); margin-top: 5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- FAQ list ---------- */
.faq-item { display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.faq-item:last-child { border-bottom: 0; }
.faq-main { flex: 1; min-width: 0; }
.faq-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.faq-order { font-size: 11px; color: var(--ink-3, #94a3b8); }
.faq-q { font-size: 15px; font-weight: 650; color: var(--ink-1); line-height: 1.4; }
.faq-a { font-size: 13px; color: var(--ink-2); margin-top: 4px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.g-foot { display: flex; align-items: center; gap: 7px; margin-top: 12px; }
.g-foot .act-group { margin-left: auto; }

/* ---------- Empty state ---------- */
.empty {
    text-align: center;
    padding: 56px 20px;
    color: var(--muted);
}
.empty .ico {
    width: 58px; height: 58px; border-radius: 16px;
    background: var(--brand-50); color: var(--brand-500);
    display: grid; place-items: center; margin: 0 auto 16px;
}
.empty .ico svg { width: 26px; height: 26px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.empty p { max-width: 340px; margin: 0 auto 18px; }

/* ---------- Page heading (inside content) ---------- */
.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .ph-text h2 { font-size: 20px; }
.page-head .ph-text p { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.page-head .ph-actions { margin-left: auto; display: flex; gap: 10px; }
.breadcrumb { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.breadcrumb a:hover { color: var(--brand-600); }

/* ---------- Quill ---------- */
.editor-shell { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.editor-shell .ql-toolbar.ql-snow { border: none; border-bottom: 1px solid var(--line-2); background: var(--surface-2); }
.editor-shell .ql-container.ql-snow { border: none; font-family: var(--font); font-size: 15px; }
.editor-shell .ql-editor { min-height: 320px; line-height: 1.7; color: var(--ink); }
.editor-shell .ql-editor.ql-blank::before { color: var(--muted-2); font-style: normal; }

/* ---------- Login (centered card on emerald gradient) ---------- */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 20px;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(900px 520px at 14% 8%, rgba(53, 184, 119, 0.40), transparent 60%),
        radial-gradient(820px 620px at 88% 92%, rgba(6, 55, 31, 0.60), transparent 58%),
        linear-gradient(140deg, var(--brand-500) 0%, var(--brand-700) 46%, var(--brand-900) 100%);
}
/* soft floating light blobs */
.login-page::before,
.login-page::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(10px);
    pointer-events: none;
}
.login-page::before {
    width: 320px; height: 320px; top: -90px; left: -70px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.16), transparent 70%);
}
.login-page::after {
    width: 260px; height: 260px; bottom: -80px; right: -60px;
    background: radial-gradient(circle, rgba(53, 184, 119, 0.30), transparent 70%);
}

.login-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 424px;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 22px;
    padding: 38px 36px 30px;
    box-shadow: 0 30px 80px rgba(3, 30, 18, 0.42);
    text-align: center;
}
.login-logo { display: flex; justify-content: center; margin-bottom: 22px; }
.login-logo img { height: 44px; width: auto; }
.login-card h1 { font-size: 24px; }
.login-card .sub { color: var(--muted); margin: 8px 0 26px; font-size: 14px; }
.login-card form { text-align: left; }
.login-card .form-group { margin-bottom: 18px; }
.login-card .form-label { font-size: 12.5px; }
.login-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.remember { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.remember input { accent-color: var(--brand-600); width: 16px; height: 16px; }
.seed-note {
    margin-top: 22px; padding: 12px 14px; border-radius: 11px;
    background: var(--surface-2); border: 1px solid var(--line);
    font-size: 12.5px; color: var(--muted); text-align: left;
}
.seed-note code { color: var(--brand-700); font-weight: 600; }

/* ---------- 403 ---------- */
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.forbidden { text-align: center; max-width: 420px; }
.forbidden .code { font-size: 74px; font-weight: 800; color: var(--brand-600); letter-spacing: -0.03em; }
.forbidden h2 { font-size: 22px; margin-top: 6px; }
.forbidden p { color: var(--muted); margin: 12px 0 24px; }

/* ---------- Utility ---------- */
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- Sidebar backdrop (mobile) ---------- */
.backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.4);
    z-index: 39;
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; left: 0; top: 0;
        width: var(--sidebar-w);
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: var(--shadow-lg);
    }
    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open .backdrop { display: block; }
    .icon-btn { display: grid; }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .content { padding: 18px 16px; }
    .topbar { padding: 12px 16px; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .form-2col { grid-template-columns: 1fr; }
    .stat .value { font-size: 25px; }
    .page-head .ph-actions { margin-left: 0; width: 100%; }
}
