/* ========================================
   IT Support Tool — Dark Theme Design System
   ======================================== */

/* --- CSS Variables (Design Tokens) --- */
:root {
    /* Surfaces */
    --bg-primary: #080b12;
    --bg-secondary: #0f1623;
    --bg-card: #141c2a;
    --bg-card-hover: #182235;
    --bg-input: #0b111d;
    --border: #253044;
    --border-hover: #34445f;

    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #a9b4c4;
    --text-muted: #748196;

    /* Semantic colors */
    --accent-blue: #4f8cff;
    --accent-blue-hover: #3b78e7;
    --accent-blue-glow: rgba(79, 140, 255, 0.14);
    --accent-green: #2fbf71;
    --accent-green-glow: rgba(47, 191, 113, 0.14);
    --accent-orange: #f0a84a;
    --accent-orange-glow: rgba(240, 168, 74, 0.14);
    --accent-purple: #8b7cf6;
    --accent-purple-glow: rgba(139, 124, 246, 0.12);
    --accent-red: #f87171;
    --accent-red-glow: rgba(248, 113, 113, 0.14);
    --accent-cyan: #28b8d8;

    /* Layout */
    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;
    --top-bar-height: 60px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 14px;
    --radius: var(--radius-md);

    /* Effects */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.24);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.38);
    --shadow-glow-blue: 0 0 0 3px var(--accent-blue-glow);
    --focus-ring: 0 0 0 3px var(--accent-blue-glow);

    /* Transitions */
    --ease: cubic-bezier(0.2, 0, 0, 1);
}

html[data-theme="light"] {
    --bg-primary: #f5f7fb;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.92);
    --bg-card-hover: #f7faff;
    --bg-input: #ffffff;
    --border: #d9e1ec;
    --border-hover: #b9c7da;

    --text-primary: #1f2937;
    --text-secondary: #526074;
    --text-muted: #7a8699;

    --accent-blue: #2563eb;
    --accent-blue-hover: #1d4ed8;
    --accent-blue-glow: rgba(37, 99, 235, 0.12);
    --accent-green: #168a4a;
    --accent-green-glow: rgba(22, 138, 74, 0.12);
    --accent-orange: #b7791f;
    --accent-orange-glow: rgba(183, 121, 31, 0.13);
    --accent-purple: #6d5dfc;
    --accent-purple-glow: rgba(109, 93, 252, 0.11);
    --accent-red: #dc2626;
    --accent-red-glow: rgba(220, 38, 38, 0.11);
    --accent-cyan: #047fa3;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.10);
    --shadow-lg: 0 20px 52px rgba(15, 23, 42, 0.16);
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: radial-gradient(circle at top left, rgba(79, 140, 255, 0.08), transparent 32rem), var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

html[data-theme="light"] body {
    background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.10), transparent 34rem), linear-gradient(135deg, #f8fbff 0%, var(--bg-primary) 48%, #eef4ff 100%);
}

button,
a,
input,
select,
textarea,
summary {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: color-mix(in srgb, var(--bg-secondary) 94%, black);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.24s var(--ease);
}

html[data-theme="light"] .sidebar {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(24px);
}

.sidebar-logo {
    min-height: 72px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.logo-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--accent-blue);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.logo-lockup {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.logo-text {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}

.logo-subtitle {
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow-y: auto;
}

.nav-section-label {
    padding: 14px 12px 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.nav-section-label:first-child {
    padding-top: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--text-secondary);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease);
    font-weight: 500;
    position: relative;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-blue-glow);
    color: var(--text-primary);
    border-color: rgba(79, 140, 255, 0.28);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent-blue);
    border-radius: 2px;
}

.nav-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 700;
}

.nav-item.active .nav-icon {
    color: var(--accent-blue);
}

.nav-label { font-size: 13px; }

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.user-avatar {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--accent-blue-glow);
    color: var(--accent-blue);
    font-size: 12px;
    font-weight: 800;
}

.user-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
}

.user-role {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: capitalize;
}

.version {
    font-size: 11px;
    color: var(--text-muted);
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100vw - var(--sidebar-width));
    min-width: 0;
    min-height: 100vh;
    transition: margin-left 0.3s var(--ease), width 0.3s var(--ease);
}

.top-bar {
    position: sticky;
    top: 0;
    height: var(--top-bar-height);
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(8, 11, 18, 0.86);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    z-index: 50;
}

html[data-theme="light"] .top-bar {
    background: rgba(255, 255, 255, 0.74);
    backdrop-filter: blur(24px) saturate(140%);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.menu-toggle:hover { background: var(--bg-card); }

.page-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.page-kicker {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.2;
}

.top-bar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-secondary);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease);
}

.theme-toggle:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.status-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-badge.online {
    background: var(--accent-green-glow);
    color: var(--accent-green);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.page-content {
    width: 100%;
    max-width: none;
    padding: 16px;
}

/* ========================================
   LOADING SPINNER
   ======================================== */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    color: var(--text-muted);
    gap: 16px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ========================================
   DASHBOARD
   ======================================== */
.dash-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 16px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.dash-eyebrow {
    color: var(--accent-blue);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.dash-title {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.dash-subtitle {
    max-width: 760px;
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.dash-health {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 140px;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.dash-health-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-green);
}

.dash-health-label {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dash-health-value {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
}

.dash-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dash-main-grid,
.dash-admin-grid {
    display: grid;
    grid-template-columns: minmax(320px, 0.85fr) minmax(420px, 1.15fr);
    gap: 16px;
    margin-top: 16px;
}

.dash-admin-grid {
    grid-template-columns: 1fr 1fr;
}

.dash-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dash-scroll {
    max-height: 340px;
    overflow-y: auto;
}

@media (max-width: 1024px) {
    .dash-stats,
    .dash-main-grid,
    .dash-admin-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .dash-hero {
        flex-direction: column;
        padding: 16px;
    }

    .dash-title {
        font-size: 20px;
    }

    .dash-health {
        width: 100%;
    }

    .dash-stats,
    .dash-main-grid,
    .dash-admin-grid,
    .dash-actions {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   STAT CARDS
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.18s var(--ease), background 0.18s var(--ease), transform 0.18s var(--ease);
}

.stat-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.stat-card.blue::before { background: var(--accent-blue); }
.stat-card.green::before { background: var(--accent-green); }
.stat-card.orange::before { background: var(--accent-orange); }
.stat-card.purple::before { background: var(--accent-purple); }

.stat-icon {
    font-size: 28px;
    margin-bottom: 12px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   CARDS & PANELS
   ======================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}

.card:hover { border-color: var(--border-hover); }

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body { padding: 20px; }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

/* ========================================
   SYSTEM INFO
   ======================================== */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.info-item-icon { font-size: 18px; }

.info-item-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.info-item-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.info-item-value {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
    border: 1px solid var(--border);
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s var(--ease);
}

.progress-fill.blue { background: var(--accent-blue); }
.progress-fill.green { background: var(--accent-green); }
.progress-fill.orange { background: var(--accent-orange); }
.progress-fill.red { background: var(--accent-red); }

/* ========================================
   FORMS
   ======================================== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s var(--ease);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent-blue);
    box-shadow: var(--focus-ring);
}

.form-input::placeholder { color: var(--text-muted); }

select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 36px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease), transform 0.08s var(--ease);
    text-decoration: none;
    white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--accent-blue);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-blue-hover);
}

.btn-success {
    background: var(--accent-green);
    color: white;
}

.btn-success:hover { background: #16a34a; }

.btn-danger {
    background: var(--accent-red);
    color: white;
}

.btn-danger:hover { background: #dc2626; }

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: var(--accent-blue-glow);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ========================================
   TABLES
   ======================================== */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    padding: 11px 14px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
}

tbody td {
    padding: 10px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

tbody tr {
    transition: background 0.15s var(--ease);
}

tbody tr:hover {
    background: var(--bg-card-hover);
}

tbody tr:last-child td { border-bottom: none; }

/* ========================================
   OPERATIONS PAGES
   ======================================== */
.ops-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ops-page-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

.ops-hero-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ops-toolbar {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 180px 180px;
    gap: 10px;
    align-items: center;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

.ops-search {
    min-width: 0;
}

.ops-table-card .card-body {
    padding: 0;
}

.lic-toolbar {
    grid-template-columns: minmax(320px, 1fr) auto;
}

@media (max-width: 900px) {
    .ops-page-hero {
        flex-direction: column;
        padding: 16px;
    }

    .ops-hero-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .ops-toolbar,
    .lic-toolbar {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   SOFTWARE GRID
   ======================================== */
.soft-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.soft-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.2s var(--ease);
}

.soft-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.soft-icon {
    font-size: 28px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.soft-info { flex: 1; min-width: 0; }

.soft-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.soft-desc {
    font-size: 11px;
    color: var(--text-muted);
}

.soft-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ========================================
   BADGES & STATUS
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 20px;
}

.badge-online {
    background: var(--accent-green-glow);
    color: var(--accent-green);
}

.badge-offline {
    background: var(--accent-red-glow);
    color: var(--accent-red);
}

.badge-warning {
    background: var(--accent-orange-glow);
    color: var(--accent-orange);
}

.badge-info {
    background: var(--accent-blue-glow);
    color: var(--accent-blue);
}

/* ========================================
   CATEGORY HEADER
   ======================================== */
.category-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 12px 0 8px;
    margin-top: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-header:first-child { margin-top: 0; }

/* ========================================
   FILTERS BAR
   ======================================== */
.filters-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search-input .form-input {
    padding-left: 36px;
}

.search-input::before {
    content: '🔍';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    z-index: 1;
}

/* ========================================
   RESULT PANEL
   ======================================== */
.result-panel {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.result-panel.success {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.05);
}

.result-panel.error {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.05);
}

/* ========================================
   QUICK ACTIONS
   ======================================== */
.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s var(--ease);
}

.quick-action-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    transform: translateY(-2px);
}

.quick-action-btn .qa-icon {
    font-size: 24px;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    animation: slideIn 0.3s var(--ease);
    max-width: 360px;
    border: 1px solid;
}

.toast-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--accent-green);
}

.toast-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100vw;
    }

    .menu-toggle {
        display: block;
    }

    .page-content {
        padding: 12px;
    }

    .page-kicker {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .soft-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }
}

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

/* ========================================
   NAV DIVIDER
   ======================================== */
.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 12px;
}

/* ========================================
   DATA TABLE (reusable — Network, Tools)
   ======================================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-input);
    border-bottom: 1px solid var(--border);
}

.data-table tbody td {
    padding: 10px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr {
    transition: background 0.15s var(--ease);
}

.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ========================================
   BUTTON DISABLED
   ======================================== */
.btn:disabled, .btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ========================================
   RESULT PANEL WARNING
   ======================================== */
.result-panel.warning {
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.05);
}

/* ========================================
   DETAILS SUMMARY (collapsible)
   ======================================== */
details summary {
    cursor: pointer;
    user-select: none;
}

details summary:hover {
    color: var(--accent-blue);
}

/* ========================================
   PULSE ANIMATION (live indicator)
   ======================================== */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ========================================
   MODAL
   ======================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s var(--ease);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.3s var(--ease);
    box-shadow: var(--shadow-lg);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s var(--ease);
}

.modal-close:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ========================================
   AI WRITER LAYOUT
   ======================================== */
.ai-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--top-bar-height) - 48px);
    min-height: 500px;
}

.ai-settings-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 16px;
}

.ai-settings-header {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s var(--ease);
}

.ai-settings-header:hover {
    background: var(--bg-card-hover);
}

.ai-settings-toggle {
    color: var(--text-muted);
    font-size: 11px;
}

.ai-settings-body {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.ai-templates {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

/* Chat Area */
.ai-chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-welcome {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

/* Chat Bubbles */
.ai-bubble {
    display: flex;
    gap: 12px;
    padding: 0 4px;
    animation: bubbleIn 0.3s var(--ease);
}

@keyframes bubbleIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-bubble-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
}

.ai-bubble-user .ai-bubble-avatar {
    background: var(--accent-blue-glow);
    border-color: rgba(59, 130, 246, 0.2);
}

.ai-bubble-assistant .ai-bubble-avatar {
    background: var(--accent-purple-glow);
    border-color: rgba(168, 85, 247, 0.2);
}

.ai-bubble-body {
    flex: 1;
    min-width: 0;
}

.ai-bubble-role {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.ai-bubble-content {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-primary);
    word-wrap: break-word;
}

.ai-bubble-user .ai-bubble-content {
    background: var(--bg-card);
    padding: 12px 16px;
    border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
    border: 1px solid var(--border);
    white-space: pre-wrap;
}

.ai-bubble-actions {
    margin-top: 8px;
    gap: 6px;
}

.ai-typing {
    color: var(--text-muted);
    animation: pulse 1.5s ease-in-out infinite;
}

/* AI Code Blocks */
.ai-code-block {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin: 10px 0;
    overflow-x: auto;
    font-size: 12px;
    font-family: 'Consolas', 'Courier New', monospace;
    line-height: 1.6;
}

.ai-inline-code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Consolas', 'Courier New', monospace;
    border: 1px solid var(--border);
}

/* Input Area */
.ai-input-area {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.ai-input-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.2s var(--ease);
}

.ai-input-wrapper:focus-within {
    border-color: var(--accent-blue);
    box-shadow: var(--focus-ring);
}

.ai-textarea {
    border: none !important;
    border-radius: 0 !important;
    resize: none;
    min-height: 56px;
    box-shadow: none !important;
}

.ai-input-actions {
    padding: 8px 14px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ========================================
   AI WRITER RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .ai-layout {
        height: calc(100vh - var(--top-bar-height) - 32px);
    }

    .ai-templates {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }

    .ai-bubble-avatar {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}

/* ========================================
   AI POPUP WIDGET — Floating Chatbot
   ======================================== */

/* FAB Button */
.ai-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1px solid rgba(79, 140, 255, 0.35);
    background: var(--accent-blue);
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: transform 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.ai-fab:hover {
    transform: translateY(-1px);
    background: var(--accent-blue-hover);
    box-shadow: var(--shadow-lg);
}

.ai-fab.active {
    animation: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.ai-fab-icon {
    transition: transform 0.3s var(--ease);
    line-height: 1;
}

.ai-fab.active .ai-fab-icon {
    font-size: 18px;
}

.ai-fab-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: var(--accent-red);
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
}


/* Popup Panel */
.ai-popup-panel {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 380px;
    height: 520px;
    background: rgba(26, 31, 46, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    z-index: 8999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s var(--ease);
}

.ai-popup-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.ai-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-secondary) 78%, transparent);
}

.ai-popup-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-popup-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.ai-popup-subtitle {
    font-size: 11px;
    color: var(--text-muted);
}

.ai-popup-header-actions {
    display: flex;
    gap: 4px;
}

.ai-popup-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.2s var(--ease);
}

.ai-popup-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* Messages */
.ai-popup-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-popup-welcome {
    text-align: center;
    padding: 30px 16px;
}

.ai-popup-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.ai-popup-suggestions button {
    padding: 6px 12px;
    font-size: 11px;
    font-family: inherit;
    font-weight: 500;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.ai-popup-suggestions button:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: var(--accent-blue-glow);
}

/* Bubbles */
.ai-popup-bubble {
    display: flex;
    gap: 8px;
    animation: bubbleIn 0.3s var(--ease);
}

.ai-popup-bubble-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
}

.ai-popup-bubble-user .ai-popup-bubble-avatar {
    background: var(--accent-blue-glow);
    border-color: rgba(59, 130, 246, 0.2);
}

.ai-popup-bubble-assistant .ai-popup-bubble-avatar {
    background: var(--accent-purple-glow);
    border-color: rgba(168, 85, 247, 0.2);
}

.ai-popup-bubble-text {
    flex: 1;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-primary);
    min-width: 0;
    word-wrap: break-word;
}

.ai-popup-bubble-user .ai-popup-bubble-text {
    background: var(--bg-card);
    padding: 8px 12px;
    border-radius: 0 10px 10px 10px;
    border: 1px solid var(--border);
    white-space: pre-wrap;
}

/* Code blocks inside popup */
.ai-popup-code {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    margin: 6px 0;
    overflow-x: auto;
    font-size: 11px;
    font-family: 'Consolas', 'Courier New', monospace;
    line-height: 1.5;
}

.ai-popup-inline-code {
    background: var(--bg-input);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 11px;
    font-family: 'Consolas', 'Courier New', monospace;
    border: 1px solid var(--border);
}

/* Input Area */
.ai-popup-input-area {
    padding: 10px 14px 14px;
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-secondary) 64%, transparent);
}

.ai-popup-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 4px 4px 4px 16px;
    transition: border-color 0.2s var(--ease);
}

.ai-popup-input-wrap:focus-within {
    border-color: var(--accent-blue);
    box-shadow: var(--focus-ring);
}

.ai-popup-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    padding: 8px 0;
}

.ai-popup-input::placeholder {
    color: var(--text-muted);
}

.ai-popup-send {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: var(--accent-blue);
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.16s var(--ease), transform 0.08s var(--ease);
}

.ai-popup-send:hover {
    background: var(--accent-blue-hover);
    transform: translateY(-1px);
}

.ai-popup-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Popup Responsive */
@media (max-width: 480px) {
    .ai-popup-panel {
        right: 8px;
        left: 8px;
        bottom: 80px;
        width: auto;
        height: 70vh;
        border-radius: var(--radius-lg);
    }

    .ai-fab {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
        font-size: 22px;
    }
}

/* ========================================
   DOWNLOAD CENTER — CNET-Style
   ======================================== */

/* Download Page */
.dl-page-single {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: calc(100vh - var(--top-bar-height) - 32px);
}

.dl-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.dl-toolbar {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.dl-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: 32px;
    padding: 0 4px;
}

.dl-view-toggle {
    display: inline-flex;
    padding: 3px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.dl-view-btn {
    min-height: 28px;
    padding: 4px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.dl-view-btn.active {
    background: var(--accent-blue);
    color: white;
}

/* ── Horizontal Category Pills ── */
.dl-cat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin: 0;
}

.dl-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease);
    white-space: nowrap;
}

.dl-pill:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
    background: rgba(59,130,246,0.06);
}

.dl-pill.active {
    background: var(--accent-blue-glow);
    border-color: rgba(79, 140, 255, 0.35);
    color: var(--text-primary);
    font-weight: 700;
}

.dl-pill-count {
    font-size: 10px;
    background: rgba(255,255,255,0.08);
    color: var(--text-muted);
    padding: 1px 7px;
    border-radius: 8px;
    font-weight: 600;
}

.dl-pill.active .dl-pill-count {
    background: rgba(59,130,246,0.15);
    color: var(--accent-cyan);
}

/* ── Sort Bar ── */
.dl-sort-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
    gap: 8px;
}

.dl-sort-bar .dl-sort-tabs {
    display: flex;
    gap: 4px;
    padding: 0;
    border: none;
}

.dl-sort-bar .dl-sort-tab {
    padding: 6px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    white-space: nowrap;
}

.dl-sort-bar .dl-sort-tab:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
}

.dl-sort-bar .dl-sort-tab.active {
    background: var(--accent-blue);
    color: white;
    font-weight: 600;
}

.dl-sort-bar .dl-sort-right {
    flex-shrink: 0;
}

.dl-result-count {
    font-size: 12px;
    color: var(--text-muted);
}

/* Cards Grid */
.dl-grid {
    flex: 1;
    padding: 0;
    overflow: visible;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
    align-content: start;
}

.dl-grid-list {
    grid-template-columns: 1fr;
}

.dl-grid-list .dl-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
}

.dl-grid-list .dl-card-top {
    min-width: 0;
}

.dl-grid-list .dl-card-actions {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    justify-content: flex-end;
}

/* (sidebar styles removed — replaced by horizontal category pills above) */

/* ── Search Bar ── */
.dl-search-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 16px 20px 12px;
}

.dl-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
    width: 100%;
}

.dl-search-icon {
    position: absolute;
    left: 14px;
    font-size: 16px;
    opacity: 0.5;
    pointer-events: none;
}

.dl-search-input {
    width: 100%;
    padding: 12px 40px 12px 42px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font);
    transition: all 0.2s var(--ease);
}

.dl-search-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.dl-search-input::placeholder {
    color: var(--text-muted);
}

.dl-search-clear {
    position: absolute;
    right: 10px;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(255,255,255,0.08);
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s var(--ease);
}

.dl-search-clear:hover {
    background: rgba(255,255,255,0.15);
    color: var(--text-primary);
}

/* (sort-tabs moved to .dl-sort-bar above) */

.dl-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all 0.25s var(--ease);
    animation: dlCardSlideIn 0.3s ease-out both;
}

.dl-card .dl-card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

@keyframes dlCardSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dl-card:hover {
    border-color: rgba(59,130,246,0.3);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2), 0 0 0 1px rgba(59,130,246,0.1);
    transform: translateY(-1px);
}

/* Card icon */
.dl-card-left {
    flex-shrink: 0;
}

.dl-card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(168,85,247,0.06));
    border: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

/* Card body */
.dl-card-body {
    flex: 1;
    min-width: 0;
}

.dl-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.dl-card-badges {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.dl-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dl-card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dl-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dl-card-category {
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.04);
    padding: 2px 10px;
    border-radius: 10px;
}

/* Pricing badges */
.dl-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.dl-badge-free {
    background: rgba(34,197,94,0.12);
    color: #22c55e;
    border: 1px solid rgba(34,197,94,0.2);
}

.dl-badge-trial {
    background: rgba(234,179,8,0.12);
    color: #eab308;
    border: 1px solid rgba(234,179,8,0.2);
}

.dl-badge-paid {
    background: rgba(239,68,68,0.12);
    color: #ef4444;
    border: 1px solid rgba(239,68,68,0.2);
}

.dl-badge-homepage {
    background: rgba(59,130,246,0.12);
    color: #3b82f6;
    border: 1px solid rgba(59,130,246,0.2);
    cursor: default;
    font-size: 12px;
    padding: 2px 6px;
}

/* Card actions */
.dl-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.dl-btn-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 8px 16px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.16s var(--ease), transform 0.08s var(--ease);
    white-space: nowrap;
}

.dl-btn-download:hover {
    background: var(--accent-blue-hover);
    transform: translateY(-1px);
}

.dl-btn-icon {
    font-size: 14px;
}

.dl-btn-unavailable {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 16px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}

/* Star favorite button */
.dl-btn-star {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius);
    transition: all 0.2s var(--ease);
    color: var(--text-muted);
    opacity: 0.6;
    line-height: 1;
}
.dl-btn-star:hover {
    opacity: 1;
    transform: scale(1.2);
    background: rgba(250, 204, 21, 0.1);
}
.dl-btn-star.dl-star-active {
    opacity: 1;
    color: #facc15;
    animation: dl-star-pop 0.3s var(--ease);
}
@keyframes dl-star-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* Favorites count badge on tab */
.dl-fav-badge {
    display: inline-block;
    background: linear-gradient(135deg, #facc15, #eab308);
    color: #1a1a2e;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    padding: 0 5px;
    margin-left: 4px;
    vertical-align: middle;
}

/* Empty state */
.dl-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    gap: 12px;
}

.dl-empty-icon {
    font-size: 48px;
    opacity: 0.5;
}

.dl-empty p {
    font-size: 14px;
    margin: 0;
}

/* ── Download Responsive ── */
@media (max-width: 1024px) {
    .dl-toolbar {
        grid-template-columns: 1fr;
    }

    .dl-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .dl-hero {
        flex-direction: column;
        padding: 16px;
    }

    .dl-sort-tabs {
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .dl-grid {
        grid-template-columns: 1fr;
    }

    .dl-card-icon {
        width: 44px;
        height: 44px;
        font-size: 22px;
    }

    .dl-grid-list .dl-card {
        display: flex;
    }

    .dl-card-actions {
        width: 100%;
    }

    .dl-btn-download {
        width: 100%;
        justify-content: center;
    }
}

/* ── Download Center CRUD ── */

/* Add button */
.dl-btn-add {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    white-space: nowrap;
    flex-shrink: 0;
}

.dl-btn-add:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 4px 12px rgba(16,185,129,0.4);
    transform: translateY(-1px);
}

/* Download buttons */
.dl-btn-edit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(59,130,246,0.08);
    border: 1px solid rgba(59,130,246,0.15);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s var(--ease);
    flex-shrink: 0;
}

.dl-btn-edit:hover {
    background: rgba(59,130,246,0.2);
    border-color: rgba(59,130,246,0.4);
    box-shadow: 0 2px 8px rgba(59,130,246,0.3);
    transform: scale(1.05);
}

/* Delete button on card */
.dl-btn-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.15);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s var(--ease);
    flex-shrink: 0;
}

.dl-btn-delete:hover {
    background: rgba(239,68,68,0.2);
    border-color: rgba(239,68,68,0.4);
    box-shadow: 0 2px 8px rgba(239,68,68,0.3);
    transform: scale(1.05);
}

/* Homepage toggle button */
.dl-btn-homepage {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(34,197,94,0.08);
    border: 1px solid rgba(34,197,94,0.15);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s var(--ease);
    flex-shrink: 0;
}
.dl-btn-homepage:hover {
    background: rgba(34,197,94,0.2);
    border-color: rgba(34,197,94,0.4);
    box-shadow: 0 2px 8px rgba(34,197,94,0.3);
    transform: scale(1.05);
}
.dl-btn-homepage.off {
    opacity: 0.35;
    background: rgba(255,255,255,0.03);
    border-color: var(--border);
}
.dl-btn-homepage.off:hover {
    opacity: 0.7;
    background: rgba(34,197,94,0.1);
    border-color: rgba(34,197,94,0.2);
}


/* ── Modal Overlay ── */
.dl-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: dlFadeIn 0.2s ease;
}

@keyframes dlFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.dl-modal {
    background: var(--card-bg, #1e1e2e);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 540px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: dlSlideUp 0.25s ease;
    overflow: hidden;
}

.dl-modal-sm {
    max-width: 420px;
}

@keyframes dlSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.dl-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.dl-modal-header h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary, #e0e0e0);
}

.dl-modal-header-danger h2 {
    color: #ef4444;
}

.dl-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}

.dl-modal-close:hover {
    color: var(--text-primary, #fff);
}

.dl-modal-body {
    padding: 20px 24px;
}

.dl-modal-body p {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--text-secondary, #aaa);
}

.dl-delete-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary, #e0e0e0) !important;
    padding: 8px 0;
}

.dl-delete-warn {
    color: #f59e0b !important;
    font-size: 13px !important;
    margin-top: 8px !important;
}

/* ── Form Styles ── */
.dl-form-group {
    padding: 0 24px;
    margin-bottom: 16px;
}

.dl-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #aaa);
    margin-bottom: 6px;
}

.dl-required {
    color: #ef4444;
}

.dl-form-group input,
.dl-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary, #e0e0e0);
    font-size: 14px;
    font-family: var(--font);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.dl-form-group input:focus,
.dl-form-group textarea:focus {
    outline: none;
    border-color: var(--accent-blue, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.dl-form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.dl-form-row {
    display: flex;
    gap: 0;
}

.dl-form-row .dl-form-group {
    flex: 1;
}

.dl-form-row .dl-form-group:last-child {
    flex: 0 0 100px;
}

/* Form Actions */
.dl-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.dl-btn-cancel {
    padding: 10px 20px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary, #aaa);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.dl-btn-cancel:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary, #fff);
}

.dl-btn-submit {
    padding: 10px 24px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.dl-btn-submit:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 4px 12px rgba(16,185,129,0.4);
}

.dl-btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.dl-btn-danger {
    padding: 10px 24px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.dl-btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 4px 12px rgba(239,68,68,0.4);
}

.dl-btn-danger:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── Toast Notifications ── */
.dl-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    z-index: 10000;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.dl-toast-show {
    transform: translateY(0);
    opacity: 1;
}

.dl-toast-success {
    background: linear-gradient(135deg, #065f46, #064e3b);
    color: #6ee7b7;
    border: 1px solid rgba(16,185,129,0.3);
}

.dl-toast-error {
    background: linear-gradient(135deg, #7f1d1d, #991b1b);
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,0.3);
}

.dl-toast-info {
    background: linear-gradient(135deg, #1e3a5f, #1e40af);
    color: #93c5fd;
    border: 1px solid rgba(59,130,246,0.3);
}

/* ── Responsive for CRUD ── */
@media (max-width: 768px) {
    .dl-btn-add span:last-child {
        display: none;
    }
    
    .dl-btn-add {
        padding: 10px 12px;
    }

    .dl-modal {
        width: 95%;
        margin: 16px;
    }

    .dl-form-row {
        flex-direction: column;
    }

    .dl-form-row .dl-form-group:last-child {
        flex: 1;
    }

    .dl-card-actions {
        width: 100%;
        justify-content: space-between;
    }

    .dl-btn-download {
        flex: 1;
    }

    .dl-toast {
        right: 12px;
        left: 12px;
        max-width: none;
    }
}

/* ========================================
   ABOUT & SETUP GUIDE
   ======================================== */

.about-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 8px;
}

/* Hero */
.about-hero {
    text-align: center;
    padding: 40px 20px 32px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 28px;
}

.about-hero-icon {
    font-size: 52px;
    margin-bottom: 12px;
}

.about-hero-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--text-primary);
}

.about-hero-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0 0 16px;
}

.about-hero-badges {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.about-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.about-badge.blue { background: rgba(59,130,246,0.12); color: #3b82f6; border: 1px solid rgba(59,130,246,0.2); }
.about-badge.green { background: rgba(34,197,94,0.12); color: #22c55e; border: 1px solid rgba(34,197,94,0.2); }
.about-badge.purple { background: rgba(168,85,247,0.12); color: #a855f7; border: 1px solid rgba(168,85,247,0.2); }
.about-badge.orange { background: rgba(245,158,11,0.12); color: #f59e0b; border: 1px solid rgba(245,158,11,0.2); }

/* Sections */
.about-section {
    margin-bottom: 28px;
}

.about-section-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

/* Intro card */
.about-intro-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
}

.about-intro-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 14px;
    line-height: 1.6;
}

.about-feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.about-feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.about-fl-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Architecture grid */
.about-arch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.about-arch-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    transition: all 0.2s var(--ease);
}

.about-arch-card:hover {
    border-color: rgba(59,130,246,0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.about-arch-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.about-arch-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--text-primary);
}

.about-arch-card p {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* Steps */
.about-step {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.about-step-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-blue);
    color: white;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.about-step-body {
    flex: 1;
    min-width: 0;
}

.about-step-body h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--text-primary);
}

.about-step-body p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 8px;
}

/* Code blocks */
.about-code-block {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 8px;
}

.about-code-header {
    padding: 6px 14px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.about-code-block pre {
    padding: 14px;
    margin: 0;
    font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-primary);
    overflow-x: auto;
    white-space: pre;
}

.about-code-block code {
    font-family: inherit;
}

/* Config grid */
.about-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.about-config-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.about-config-card:hover {
    border-color: rgba(59,130,246,0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.about-config-icon {
    font-size: 28px;
    margin-bottom: 10px;
}

.about-config-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--text-primary);
}

.about-config-card p {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0 0 10px;
    line-height: 1.5;
}

.about-config-card code {
    font-size: 11px;
    background: rgba(255,255,255,0.06);
    padding: 1px 5px;
    border-radius: 3px;
}

.about-config-link {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-cyan);
}

/* Schema grid */
.about-schema-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 12px;
}

/* API table */
.about-api-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.about-api-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.about-api-table thead {
    background: rgba(255,255,255,0.03);
}

.about-api-table th {
    padding: 10px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.about-api-table td {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: var(--text-secondary);
}

.about-api-table tr:last-child td {
    border-bottom: none;
}

.about-api-table tr:hover td {
    background: rgba(255,255,255,0.02);
}

.about-api-table td:nth-child(2) {
    font-family: 'Menlo', monospace;
    font-size: 12px;
    color: var(--accent-cyan);
}

.about-method {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.about-method.get { background: rgba(34,197,94,0.12); color: #22c55e; }
.about-method.post { background: rgba(59,130,246,0.12); color: #3b82f6; }
.about-method.put { background: rgba(245,158,11,0.12); color: #f59e0b; }
.about-method.delete { background: rgba(239,68,68,0.12); color: #ef4444; }

/* Footer */
.about-footer {
    text-align: center;
    padding: 24px 0;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

.about-footer p {
    margin: 0;
}

/* Responsive */
@media (max-width: 600px) {
    .about-hero { padding: 24px 16px; }
    .about-hero-title { font-size: 22px; }
    .about-schema-grid { grid-template-columns: 1fr; }
    .about-step { gap: 12px; }
    .about-step-num { width: 30px; height: 30px; font-size: 14px; }
}

/* ═══════════════════════════════════════════════════════════════
   Knowledge Base Page
   ═══════════════════════════════════════════════════════════════ */

.kb-page { width: 100%; max-width: none; margin: 0; }

.kb-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}

.kb-stats {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
    margin-bottom: 16px;
}

.kb-stat-card {
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: 10px; padding: 16px; text-align: center;
}
.kb-stat-num { font-size: 24px; font-weight: 700; color: var(--accent-blue); }
.kb-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.kb-search-bar { margin-bottom: 16px; }
.kb-search-bar .form-input { width: 100%; }

.kb-list { display: flex; flex-direction: column; gap: 10px; }

.kb-item {
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: 10px; padding: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.kb-item:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.08);
}

.kb-item-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px;
}
.kb-item-title {
    font-weight: 600; font-size: 15px; color: var(--text-primary);
}
.kb-item-actions { display: flex; gap: 6px; }
.kb-btn-delete:hover { border-color: var(--accent-red); color: var(--accent-red); }

.kb-item-category {
    font-size: 12px; color: var(--accent-blue);
    margin-bottom: 8px; font-weight: 500;
}

.kb-item-preview {
    font-size: 13px; color: var(--text-secondary); line-height: 1.5;
    margin-bottom: 8px; word-break: break-word;
}

.kb-item-meta {
    display: flex; justify-content: space-between;
    font-size: 11px; color: var(--text-muted);
}

.kb-empty { text-align: center; padding: 60px 20px; }

.kb-textarea {
    min-height: 200px; resize: vertical; font-family: 'Inter', monospace;
    line-height: 1.6;
}

@media (max-width: 640px) {
    .kb-stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
    .kb-stat-card { padding: 12px; }
    .kb-stat-num { font-size: 18px; }
}



.faq-page { width: 100%; max-width: none; }

.faq-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}

.faq-stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px; margin-bottom: 20px;
}

.faq-filter-bar {
    display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}

.faq-list { display: flex; flex-direction: column; gap: 8px; }

.faq-item {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px; overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.faq-item:hover { border-color: var(--border-hover); }
.faq-item-pinned { border-left: 3px solid var(--accent, #6366f1); }

.faq-item-header {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px; cursor: pointer; user-select: none;
    transition: background 0.15s;
}
.faq-item-header:hover { background: var(--bg-card-hover); }

.faq-item-icon { font-size: 20px; flex-shrink: 0; }

.faq-item-title {
    flex: 1; font-size: 14px; font-weight: 500;
    color: var(--text-primary); line-height: 1.4;
}

.faq-item-chevron {
    font-size: 11px; color: var(--text-muted);
    transition: transform 0.2s; flex-shrink: 0;
}
.faq-item-expanded .faq-item-chevron { transform: rotate(180deg); }

.faq-pin-badge {
    font-size: 12px; flex-shrink: 0;
}

.faq-cat-badge {
    font-size: 11px; padding: 2px 8px; border-radius: 10px;
    background: rgba(99, 102, 241, 0.15); color: #818cf8;
    white-space: nowrap; flex-shrink: 0;
}

.faq-item-actions {
    display: flex; gap: 4px; flex-shrink: 0;
}

.faq-item-body {
    padding: 0 16px 16px 46px;
    border-top: 1px solid var(--border);
}

.faq-item-content {
    color: var(--text-secondary); font-size: 13px; line-height: 1.7;
    padding-top: 12px;
}
.faq-item-content h2,
.faq-item-content h3,
.faq-item-content h4 {
    color: var(--text-primary); margin: 12px 0 6px;
}
.faq-item-content code {
    background: rgba(99,102,241,0.1); padding: 2px 6px;
    border-radius: 4px; font-size: 12px; color: #a78bfa;
}
.faq-item-content ul {
    margin: 6px 0; padding-left: 20px;
}
.faq-item-content li {
    margin: 4px 0;
}

@media (max-width: 640px) {
    .faq-filter-bar { flex-direction: column; }
    .faq-filter-bar select { width: 100% !important; }
    .faq-item-body { padding-left: 16px; }
}


/* ========================================
   License Management Styles
   ======================================== */

.lic-page { width: 100%; max-width: none; }

.lic-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}

.lic-stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px; margin-bottom: 20px;
}

/* Alert banners */
.lic-alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; border-radius: 10px; margin-bottom: 12px;
    font-size: 13px; line-height: 1.5;
}
.lic-alert-danger {
    background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}
.lic-alert-warning {
    background: rgba(234, 179, 8, 0.1); border: 1px solid rgba(234, 179, 8, 0.3);
    color: #fde68a;
}
.lic-alert-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

/* Table */
.lic-table-scroll { overflow-x: auto; }

.lic-table {
    width: 100%; border-collapse: collapse;
    font-size: 13px;
}
.lic-table th {
    text-align: left; padding: 10px 12px;
    background: var(--bg-secondary); color: var(--text-muted);
    font-weight: 500; font-size: 12px; text-transform: uppercase;
    letter-spacing: 0.5px; border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.lic-table td {
    padding: 12px; border-bottom: 1px solid var(--border);
    color: var(--text-secondary); vertical-align: middle;
}
.lic-table tbody tr {
    transition: background 0.15s;
}
.lic-table tbody tr:hover { background: var(--bg-card-hover); }

.lic-row-expired { opacity: 0.75; }
.lic-row-expired td:first-child { border-left: 3px solid var(--danger); }
.lic-row-expiring_soon td:first-child { border-left: 3px solid #eab308; }
.lic-row-active td:first-child { border-left: 3px solid var(--success); }

.lic-sw-name {
    font-weight: 600; color: var(--text-primary); font-size: 13px;
}
.lic-vendor {
    font-size: 11px; color: var(--text-muted); margin-top: 2px;
}

.lic-key {
    font-family: 'Courier New', monospace; font-size: 11px;
    background: rgba(99,102,241,0.08); padding: 3px 7px;
    border-radius: 4px; color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* Status badges */
.lic-badge {
    display: inline-block; padding: 3px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 500; white-space: nowrap;
}
.lic-badge-active { background: rgba(34,197,94,0.15); color: #4ade80; }
.lic-badge-warning { background: rgba(234,179,8,0.15); color: #facc15; }
.lic-badge-expired { background: rgba(239,68,68,0.15); color: #f87171; }
.lic-badge-perpetual { background: rgba(99,102,241,0.15); color: #818cf8; }

/* Seats progress bar */
.lic-seats { font-size: 12px; font-weight: 500; color: var(--text-primary); }

.lic-seats-bar {
    width: 60px; height: 5px; background: var(--bg-input);
    border-radius: 3px; margin-top: 4px; overflow: hidden;
}
.lic-seats-fill {
    height: 100%; border-radius: 3px;
    transition: width 0.3s ease;
}

/* Wide modal for license form */
.dl-modal-wide { max-width: 640px; }

@media (max-width: 768px) {
    .lic-table { font-size: 12px; }
    .lic-table th, .lic-table td { padding: 8px; }
    .lic-stats { grid-template-columns: repeat(3, 1fr); }
    .dl-modal-wide { max-width: 95vw; }
}

@media (max-width: 640px) {
    .lic-stats { grid-template-columns: 1fr 1fr; }
}

/* ═══════════════════════════════════════
   FAQ Page Styles
   ═══════════════════════════════════════ */

.faq-page { padding: 0; }

.faq-toolbar {
    display: flex; gap: 12px; align-items: center;
    flex-wrap: wrap; margin-bottom: 16px;
}

.faq-category-tabs {
    display: flex; gap: 8px; flex-wrap: wrap;
    margin-bottom: 20px;
}

.faq-cat-tab {
    padding: 6px 16px; border-radius: 20px;
    background: var(--bg-card); color: var(--text-secondary);
    border: 1px solid var(--border); cursor: pointer;
    font-size: 13px; transition: all 0.2s;
}
.faq-cat-tab:hover { border-color: var(--accent-blue); color: var(--text-primary); }
.faq-cat-tab.active {
    background: var(--accent-blue); color: #fff;
    border-color: var(--accent-blue);
}

.faq-list { display: flex; flex-direction: column; gap: 8px; }

.faq-item {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px; overflow: hidden;
    transition: border-color 0.2s;
    animation: fadeInUp 0.3s ease forwards; opacity: 0;
}
.faq-item:hover { border-color: var(--border-hover); }
.faq-item.open { border-color: var(--accent-blue); }

.faq-question {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px; cursor: pointer;
    transition: background 0.2s;
}
.faq-question:hover { background: var(--bg-card-hover); }

.faq-q-icon { font-size: 18px; flex-shrink: 0; }
.faq-q-text { flex: 1; font-weight: 500; color: var(--text-primary); font-size: 14px; }

.faq-cat-badge {
    font-size: 11px; padding: 2px 10px; border-radius: 12px;
    background: var(--accent-purple-glow); color: var(--accent-purple);
    flex-shrink: 0;
}

.faq-arrow {
    font-size: 12px; color: var(--text-muted);
    transition: transform 0.3s; flex-shrink: 0;
}
.faq-item.open .faq-arrow { transform: rotate(180deg); }

.faq-answer {
    max-height: 0; overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease;
    padding: 0 20px;
}
.faq-item.open .faq-answer {
    max-height: 1000px;
    padding: 0 20px 16px;
}

.faq-answer-content {
    font-size: 13px; line-height: 1.7;
    color: var(--text-secondary);
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.faq-answer-content a { color: var(--accent-blue); }

.faq-admin-actions {
    display: flex; gap: 8px; margin-top: 12px;
    padding-top: 10px; border-top: 1px dashed var(--border);
}

/* ─── FAQ Animations ────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── FAQ Rich Editor ───────────────────── */
.dl-modal-lg {
    max-width: 720px;
    width: 95vw;
}

.faq-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    flex-wrap: wrap;
}

.faq-tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 30px;
    padding: 0 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}
.faq-tb-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border);
    color: var(--text-primary);
}
.faq-tb-btn:active {
    background: var(--accent-blue-glow);
}

.faq-tb-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}

.faq-tb-ai {
    background: linear-gradient(135deg, var(--accent-purple-glow), var(--accent-blue-glow));
    color: var(--accent-purple);
    font-weight: 600;
    font-size: 12px;
    border: 1px solid var(--accent-purple);
    border-radius: 6px;
    padding: 0 12px;
    gap: 4px;
}
.faq-tb-ai:hover {
    background: var(--accent-purple);
    color: #fff;
}
.faq-tb-ai-loading {
    opacity: 0.6;
    cursor: not-allowed;
}

.faq-editor-content {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.7;
    outline: none;
    transition: border-color 0.2s;
}
.faq-editor-content:focus {
    border-color: var(--accent-blue);
}
.faq-editor-content:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    pointer-events: none;
}
.faq-editor-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 8px 0;
}
.faq-editor-content h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 12px 0 6px;
}

/* AI Status Bar */
.faq-ai-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--accent-purple-glow);
    border: 1px solid var(--accent-purple);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    margin-top: -1px;
    font-size: 12px;
    color: var(--accent-purple);
}

.faq-ai-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--accent-purple);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.faq-ai-stop {
    margin-left: auto;
    padding: 2px 10px;
    background: transparent;
    border: 1px solid var(--accent-purple);
    border-radius: 4px;
    color: var(--accent-purple);
    cursor: pointer;
    font-size: 11px;
    transition: all 0.15s;
}
.faq-ai-stop:hover {
    background: var(--accent-purple);
    color: #fff;
}

/* ─── FAQ Answer Media ──────────────────── */
.faq-answer-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 10px 0;
}

.faq-answer-content h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 12px 0 6px;
}

.faq-answer-content ul,
.faq-answer-content ol {
    padding-left: 20px;
    margin: 6px 0;
}

.faq-media-block {
    margin: 10px 0;
}

.faq-video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}
.faq-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.faq-answer-content .faq-video-wrapper {
    max-width: 560px;
}

/* ═══════════════════════════════════════
   License Page Styles
   ═══════════════════════════════════════ */

.license-page { padding: 0; }

.license-stats {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 12px; margin-bottom: 20px;
}

.license-stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px; padding: 16px 20px; text-align: center;
}
.license-stat-card.stat-active { border-left: 3px solid var(--accent-green); }
.license-stat-card.stat-expired { border-left: 3px solid var(--accent-red); }
.license-stat-card.stat-unused { border-left: 3px solid var(--text-muted); }

.license-stat-value {
    font-size: 28px; font-weight: 700; color: var(--text-primary);
}
.license-stat-label {
    font-size: 12px; color: var(--text-secondary); margin-top: 4px;
}

.license-filter-group {
    display: flex; gap: 6px;
}

.license-table-wrap { overflow-x: auto; }

.license-table {
    width: 100%; border-collapse: collapse;
    background: var(--bg-card); border-radius: 10px;
    overflow: hidden;
}

.license-table thead { background: var(--bg-secondary); }
.license-table th {
    padding: 12px 16px; font-size: 12px; font-weight: 600;
    color: var(--text-secondary); text-align: left;
    text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.license-table td {
    padding: 12px 16px; font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
}
.license-table tr:hover td { background: var(--bg-card-hover); }
.license-table .text-center { text-align: center; }

.lic-key {
    font-family: 'Courier New', monospace; font-size: 12px;
    padding: 2px 8px; background: var(--bg-input);
    border-radius: 4px; cursor: pointer;
    transition: background 0.2s;
}
.lic-key:hover { background: var(--accent-blue-glow); color: var(--accent-blue); }

.lic-badge {
    display: inline-block; padding: 3px 10px; border-radius: 12px;
    font-size: 11px; font-weight: 600;
}
.lic-badge-active { background: var(--accent-green-glow); color: var(--accent-green); }
.lic-badge-expired { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.lic-badge-unused { background: rgba(107,114,128,0.15); color: var(--text-muted); }

.lic-warn { font-size: 11px; display: block; margin-top: 2px; }
.lic-warn-expired { color: var(--accent-red); }
.lic-warn-soon { color: var(--accent-orange); }

.lic-actions { white-space: nowrap; }

@media (max-width: 768px) {
    .license-stats { grid-template-columns: repeat(2, 1fr); }
    .license-table th, .license-table td { padding: 8px 10px; font-size: 12px; }
    .license-filter-group { flex-wrap: wrap; }
}

/* ─── License Expand / Sub-table ──────────────────────────────── */

.lic-expand-arrow { font-size: 10px; margin-right: 6px; color: var(--text-muted); display: inline-block; width: 12px; }

.lic-row { transition: background 0.15s; }
.lic-row-expanded td { background: var(--bg-card-hover) !important; }

.lic-expand-row td { padding: 0 !important; background: var(--bg-secondary); border-bottom: 1px solid var(--border); }

.lic-sub-wrap { padding: 12px 20px 16px; }

.lic-sub-header { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 10px; }

.lic-sub-table { width: 100%; border-collapse: collapse; }
.lic-sub-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.lic-sub-table td { padding: 6px 10px; font-size: 13px; color: var(--text-secondary); border-bottom: 1px solid rgba(37,48,68,0.4); }

.lic-sub-val { white-space: nowrap; }

.lic-sub-input { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); padding: 4px 8px; font-size: 12px; outline: none; width: 100%; box-sizing: border-box; }
.lic-sub-input:focus { border-color: var(--accent-blue); }

.lic-sub-add { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.lic-sub-add .lic-sub-input { flex: 1; }

.lic-sub-btn { padding: 3px 8px; font-size: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--bg-card); color: var(--text-secondary); }
.lic-sub-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.lic-sub-btn-add { background: var(--accent-blue); border-color: var(--accent-blue); color: #fff; white-space: nowrap; }
.lic-sub-btn-add:hover { background: var(--accent-blue-hover); border-color: var(--accent-blue-hover); color: #fff; }
.lic-sub-btn-save { color: var(--accent-green); border-color: var(--accent-green); }
.lic-sub-btn-del { color: var(--accent-red); }
.lic-sub-actions { white-space: nowrap; text-align: right; }

.lic-sub-td { vertical-align: middle; }

/* ═══════════════════════════════════════
   Email Settings Page
   ═══════════════════════════════════════ */

.email-page { width: 100%; max-width: none; }

.email-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}

.email-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px;
}

.em-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}
.em-section-header .email-section-title { margin: 0; }

/* Toggle password */
.em-toggle-pw {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    opacity: 0.6;
}
.em-toggle-pw:hover { opacity: 1; }

/* Checkbox label */
.em-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    margin-top: 8px;
}
.em-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-blue);
}

/* Recipients */
.em-recipients-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    min-height: 32px;
    padding: 6px 0;
}

.em-recipient-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 12px;
    background: var(--accent-blue-glow, rgba(59,130,246,0.12));
    color: var(--accent-blue);
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}
.em-recipient-tag button {
    background: none;
    border: none;
    color: var(--accent-blue);
    cursor: pointer;
    font-size: 12px;
    padding: 0 2px;
    opacity: 0.7;
    line-height: 1;
}
.em-recipient-tag button:hover { opacity: 1; color: var(--accent-red); }

.em-no-recipients {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

.em-add-recipient {
    display: flex;
    gap: 8px;
    align-items: center;
}
.em-add-recipient input {
    flex: 1;
}
.em-btn-add-sm {
    flex-shrink: 0;
    padding: 6px 12px !important;
    font-size: 14px !important;
}

/* Action buttons */
.em-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.em-btn-test {
    background: transparent !important;
    border: 1px solid var(--accent-blue) !important;
    color: var(--accent-blue) !important;
}
.em-btn-test:hover {
    background: var(--accent-blue-glow, rgba(59,130,246,0.1)) !important;
}

.em-btn-send {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: #fff !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    cursor: pointer;
    transition: opacity 0.2s;
}
.em-btn-send:hover { opacity: 0.9; }
.em-btn-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* Expiry table */
.em-summary-bar {
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.em-expiry-table tbody tr.em-status-expired { background: rgba(239,68,68,0.06); }
.em-expiry-table tbody tr.em-status-today { background: rgba(245,158,11,0.06); }
.em-expiry-table tbody tr.em-status-warning { background: transparent; }

.em-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.em-badge.em-status-expired { background: rgba(239,68,68,0.15); color: #f87171; }
.em-badge.em-status-today { background: rgba(245,158,11,0.15); color: #fbbf24; }
.em-badge.em-status-warning { background: rgba(234,179,8,0.15); color: #facc15; }

/* Empty state */
.em-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}
.em-empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}
.em-empty-state p {
    font-size: 14px;
    margin: 0;
}

@media (max-width: 640px) {
    .email-section { padding: 16px; }
    .em-actions { flex-direction: column; }
    .em-section-header { flex-direction: column; align-items: flex-start; }
}

/* ========================================
   FAQ ADMIN — Hướng Dẫn IT
   ======================================== */

.faq-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}
.faq-toolbar .dl-search-wrapper { flex: 1; }

.faq-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}
.faq-cat-tab {
    padding: 7px 16px;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    white-space: nowrap;
}
.faq-cat-tab:hover {
    border-color: var(--accent-blue);
    background: var(--accent-blue-glow);
    color: var(--text-primary);
}
.faq-cat-tab.active {
    background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(168,85,247,0.1));
    border-color: rgba(59,130,246,0.3);
    color: var(--accent-blue);
    font-weight: 600;
}

/* FAQ List */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.25s var(--ease);
}
.faq-item:hover {
    border-color: var(--border-hover);
}
.faq-item.faq-pinned {
    border-left: 3px solid var(--accent-orange);
}

.faq-question {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}
.faq-question:hover {
    background: var(--bg-card-hover);
}

.faq-q-icon {
    font-size: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.faq-q-text {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.5;
}

.faq-pin-badge {
    font-size: 10px;
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-orange);
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 500;
    vertical-align: middle;
    margin-left: 6px;
}

.faq-cat-badge {
    font-size: 11px;
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    padding: 4px 12px;
    border-radius: 8px;
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 500;
}

.faq-arrow {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    color: var(--text-muted);
    font-size: 11px;
    transition: all 0.3s var(--ease);
    flex-shrink: 0;
}

.faq-item.open .faq-arrow {
    transform: rotate(180deg);
    background: var(--accent-blue-glow);
    color: var(--accent-blue);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-item.open .faq-answer {
    max-height: 5000px;
}

.faq-answer-content {
    padding: 0 20px 16px 74px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-secondary);
}

.faq-answer-content strong, .faq-answer-content b { color: var(--text-primary); }
.faq-answer-content h3 {
    color: var(--text-primary);
    font-size: 15px;
    margin: 16px 0 8px;
    font-weight: 700;
    border-left: 3px solid var(--accent-blue);
    padding-left: 12px;
}
.faq-answer-content ul, .faq-answer-content ol { padding-left: 20px; margin: 8px 0; }
.faq-answer-content li { margin: 4px 0; }
.faq-answer-content code {
    background: var(--bg-input);
    color: var(--accent-blue);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}
.faq-answer-content pre {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    margin: 8px 0;
    overflow-x: auto;
}
.faq-answer-content a { color: var(--accent-blue); }
.faq-answer-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 8px 0;
    border: 1px solid var(--border);
}
.faq-answer-content .faq-video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    margin: 8px 0;
    border-radius: var(--radius-md);
    overflow: hidden;
}
.faq-answer-content .faq-video-wrapper iframe {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
}

/* Admin actions */
.faq-admin-actions {
    padding: 8px 20px 16px 74px;
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--border);
    margin-top: 12px;
    padding-top: 12px;
}

/* Editor toolbar */
.faq-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.faq-tb-btn {
    padding: 6px 10px;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}
.faq-tb-btn:hover {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}
.faq-tb-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
    flex-shrink: 0;
}
.faq-tb-ai {
    margin-left: auto;
    background: linear-gradient(135deg, rgba(59,130,246,0.1), rgba(168,85,247,0.08));
    border-color: rgba(59,130,246,0.15);
    color: var(--accent-blue);
    font-weight: 600;
}
.faq-tb-ai:hover {
    background: linear-gradient(135deg, rgba(59,130,246,0.2), rgba(168,85,247,0.15));
    border-color: rgba(59,130,246,0.3);
    box-shadow: 0 0 16px rgba(59,130,246,0.1);
}
.faq-tb-ai-loading {
    opacity: 0.6;
    pointer-events: none;
}

.faq-editor-content {
    min-height: 180px;
    max-height: 400px;
    overflow-y: auto;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.7;
    outline: none;
}
.faq-editor-content:focus {
    border-color: var(--accent-blue);
}
.faq-editor-content:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    pointer-events: none;
}
.faq-editor-content img { max-width: 100%; border-radius: 8px; margin: 8px 0; }

.faq-ai-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(59,130,246,0.05);
    border: 1px solid rgba(59,130,246,0.15);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    font-size: 12px;
    color: var(--accent-blue);
}
.faq-ai-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(59,130,246,0.15);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: faqAiSpin 0.6s linear infinite;
    flex-shrink: 0;
}
@keyframes faqAiSpin { to { transform: rotate(360deg); } }
.faq-ai-stop {
    margin-left: auto;
    padding: 4px 12px;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 6px;
    color: var(--accent-red);
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}
.faq-ai-stop:hover {
    background: rgba(239,68,68,0.2);
}

.faq-media-block {
    margin: 8px 0;
}

/* Modal large variant */
.dl-modal-lg {
    max-width: 720px;
}

@media (max-width: 768px) {
    .faq-question { padding: 12px 16px; gap: 10px; }
    .faq-q-icon { width: 34px; height: 34px; font-size: 17px; }
    .faq-q-text { font-size: 13px; }
    .faq-cat-badge { display: none; }
    .faq-answer-content { padding: 0 16px 12px 16px; }
    .faq-admin-actions { padding: 8px 16px 12px; }
    .faq-editor-toolbar { gap: 2px; padding: 6px 8px; }
    .faq-tb-btn { padding: 4px 8px; font-size: 12px; }
}

/* ═══════════════════════════════════════
   LICENSE DASHBOARD WIDGETS
   ═══════════════════════════════════════ */

.lic-dash-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.lic-dash-stat {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    text-align: center;
    transition: border-color 0.2s;
}
.lic-dash-stat:hover { border-color: var(--border-hover); }

.lic-dash-stat-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}
.lic-dash-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.lic-dash-stat.stat-active .lic-dash-stat-value { color: var(--accent-green); }
.lic-dash-stat.stat-expired .lic-dash-stat-value { color: var(--accent-red); }
.lic-dash-stat.stat-unused .lic-dash-stat-value { color: var(--text-muted); }

.lic-dash-chart { margin-top: 8px; }

.lic-chart-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.lic-chart-label {
    width: 100px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
    text-align: right;
}

.lic-chart-track {
    flex: 1;
    height: 22px;
    background: var(--bg-primary);
    border-radius: 11px;
    overflow: hidden;
}

.lic-chart-fill {
    height: 100%;
    border-radius: 11px;
    transition: width 0.8s ease;
    min-width: 0;
}

.lic-chart-count {
    width: 36px;
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
}

.lic-dash-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lic-dash-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color 0.2s;
    cursor: pointer;
}
.lic-dash-item:hover { border-color: var(--border-hover); }

.lic-dash-item-left { min-width: 0; flex: 1; }
.lic-dash-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lic-dash-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.lic-dash-badge {
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 8px;
}

.lic-badge-urgent {
    background: var(--accent-red-glow);
    color: var(--accent-red);
}
.lic-badge-warn {
    background: var(--accent-orange-glow);
    color: var(--accent-orange);
}
.lic-badge-expired {
    background: rgba(107,114,128,0.15);
    color: var(--text-muted);
}

.lic-dash-summary {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 4px 0;
}

.lic-summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.lic-summary-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.lic-summary-dot.green { background: var(--accent-green); }
.lic-summary-dot.red { background: var(--accent-red); }
.lic-summary-dot.gray { background: var(--text-muted); }

.stat-card.cyan {
    background: linear-gradient(135deg, rgba(6,182,212,0.12) 0%, rgba(6,182,212,0.05) 100%);
    border-color: rgba(6,182,212,0.25);
}
.stat-card.cyan .stat-icon { color: #06b6d4; }
.stat-card.cyan .stat-value { color: #22d3ee; }

.stat-card.orange .stat-value { color: var(--accent-orange); }

.lic-dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.lic-dash-col-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

@media (max-width: 768px) {
    .lic-dash-grid { grid-template-columns: 1fr; gap: 24px; }
    .lic-dash-stat-grid { grid-template-columns: repeat(3, 1fr); }
    .lic-chart-label { width: 80px; font-size: 11px; }
}

/* ========================================
   AI CHAT IMAGE UPLOAD
   ======================================== */

/* Image upload button in popup input */
.ai-popup-img-btn {
    width: 30px; height: 30px; border-radius: 50%; border: none;
    background: transparent; color: var(--text-muted); font-size: 16px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all 0.2s var(--ease);
}
.ai-popup-img-btn:hover {
    background: var(--bg-card-hover); color: var(--accent-blue);
}

/* Image preview bar */
.ai-popup-img-preview {
    padding: 6px 14px 0; display: none; gap: 8px;
}
.ai-popup-img-thumb {
    position: relative; display: inline-flex; align-items: center; gap: 6px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 8px; padding: 4px 8px;
}
.ai-popup-img-thumb img {
    width: 36px; height: 36px; object-fit: cover; border-radius: 4px;
}
.ai-popup-img-name {
    font-size: 11px; color: var(--text-muted);
    max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ai-popup-img-remove {
    position: absolute; top: -6px; right: -6px;
    width: 18px; height: 18px; border-radius: 50%; border: none;
    background: var(--accent-red); color: white; font-size: 10px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* Image in popup bubbles */
.ai-popup-bubble-img {
    max-width: 200px; max-height: 160px; border-radius: 8px;
    margin-top: 6px; border: 1px solid var(--border); cursor: pointer; display: block;
}

/* Image upload button for full-page AI Chat */
.ai-chat-img-btn {
    width: 30px; height: 30px; border-radius: 50%; border: none;
    background: transparent; color: var(--text-muted); font-size: 16px;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    transition: all 0.2s var(--ease);
}
.ai-chat-img-btn:hover {
    background: var(--bg-card-hover); color: var(--accent-blue);
}

.ai-chat-img-preview {
    display: none; gap: 8px; padding: 4px 14px;
}
.ai-chat-img-thumb {
    position: relative; display: inline-flex; align-items: center; gap: 6px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 8px; padding: 4px 8px;
}
.ai-chat-img-thumb img {
    width: 36px; height: 36px; object-fit: cover; border-radius: 4px;
}
.ai-chat-img-name {
    font-size: 11px; color: var(--text-muted);
    max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ai-chat-img-remove {
    position: absolute; top: -6px; right: -6px;
    width: 18px; height: 18px; border-radius: 50%; border: none;
    background: var(--accent-red); color: white; font-size: 10px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* Image in full-page chat bubbles */
.ai-bubble-img {
    max-width: 240px; max-height: 180px; border-radius: 8px;
    margin-top: 6px; border: 1px solid var(--border); cursor: pointer; display: block;
}

/* ========================================
   MESSAGE DELETE BUTTON
   ======================================== */
.ai-popup-bubble,
.ai-bubble {
    position: relative;
}

.msg-delete-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    font-size: 11px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: all 0.15s var(--ease);
    line-height: 1;
    padding: 0;
}
.ai-popup-bubble:hover .msg-delete-btn,
.ai-bubble:hover .msg-delete-btn {
    display: flex;
}
.msg-delete-btn:hover {
    background: var(--accent-red);
    color: #fff;
    transform: scale(1.1);
}

/* Bulk action buttons */
.action-btn-xs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    font-family: inherit;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    white-space: nowrap;
}
.action-btn-xs:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.06);
}

/* ========================================
   TOGGLE SWITCH
   ======================================== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--border); border-radius: 24px;
    transition: background 0.3s;
}
.toggle-slider::before {
    content: "";
    position: absolute; left: 3px; bottom: 3px;
    width: 18px; height: 18px; border-radius: 50%;
    background: #fff; transition: transform 0.3s;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* ========================================
   AI HISTORY PAGE
   ======================================== */
.ah-session {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.ah-session:hover { border-color: var(--accent); }

.ah-session-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 14px; cursor: pointer; gap: 8px;
}
.ah-session-info {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    font-size: 13px; flex: 1; min-width: 0;
}
.ah-session-source {
    font-size: 11px; font-weight: 600; padding: 2px 8px;
    border-radius: 4px; background: var(--accent-bg); color: var(--accent);
}
.ah-session-user { color: var(--text-primary); white-space: nowrap; }
.ah-session-time { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.ah-session-count {
    color: var(--text-muted); font-size: 11px;
    background: var(--bg-secondary); padding: 2px 8px; border-radius: 10px;
}
.ah-session-actions { display: flex; align-items: center; gap: 6px; }
.ah-expand-icon { font-size: 11px; color: var(--text-muted); transition: transform 0.2s; }

.ah-session-preview {
    padding: 0 14px 10px; font-size: 12px; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.ah-session-msgs { padding: 0 14px 12px; }

.ah-msg {
    position: relative;
    padding: 10px 12px; margin-bottom: 6px; border-radius: 8px;
    font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.ah-msg-user {
    background: var(--accent-bg); border: 1px solid var(--border);
}
.ah-msg-assistant {
    background: var(--bg-secondary); border: 1px solid var(--border);
}
.ah-msg-role { font-weight: 600; font-size: 12px; margin-bottom: 4px; }
.ah-msg-user .ah-msg-role { color: var(--accent); }
.ah-msg-assistant .ah-msg-role { color: var(--text-secondary); }
.ah-msg-time { font-size: 10px; color: var(--text-muted); margin-top: 6px; }
