/* ══════════════════════════════════════════════════════════════════
   SiteBuilder Admin Portal — Hexalabs Theme (Dark + Light)
   ══════════════════════════════════════════════════════════════════ */

:root {
    --accent: #8B3FE8;
    --accent-hover: #7c35d4;
    --accent-gradient: linear-gradient(135deg, #8B3FE8, #6D28D9);

    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    --ease-out: cubic-bezier(.16,1,.3,1);

    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Cascadia Code', 'Fira Code', monospace;
}

/* ── Light theme (default) ───────────────────────────────────── */
[data-theme="light"], :root {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f0f0f3;
    --bg-hover: #ebebf0;

    --text-primary: #1a1a2e;
    --text-secondary: #4a4a5a;
    --text-muted: #8a8a9a;

    --border: #e0e0e8;
    --border-focus: #8B3FE8;

    --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,.1);
}

/* ── Dark theme ──────────────────────────────────────────────── */
[data-theme="dark"] {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a2e;
    --bg-input: #12121a;
    --bg-hover: #22223a;

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border: #2a2a3e;
    --border-focus: #8B3FE8;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,.5);
}

/* Light-specific refinements (also apply to :root default) */
.sidebar {
    box-shadow: 2px 0 8px rgba(0,0,0,.04);
}
.admin-header {
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.admin-table th {
    background: var(--bg-input);
}
.admin-table tbody tr:nth-child(even) {
    background: rgba(0,0,0,.015);
}
.log-box {
    background: var(--bg-input);
}
.login-card {
    box-shadow: var(--shadow-lg);
}
.header-avatar {
    box-shadow: 0 0 0 2px var(--border);
}

/* Dark-specific overrides */
[data-theme="dark"] .sidebar {
    box-shadow: none;
}
[data-theme="dark"] .admin-header {
    box-shadow: none;
}
[data-theme="dark"] .admin-table th {
    background: var(--bg-secondary);
}
[data-theme="dark"] .admin-table tbody tr:nth-child(even) {
    background: rgba(255,255,255,.02);
}
[data-theme="dark"] .log-box {
    background: var(--bg-primary);
}
[data-theme="dark"] .login-card {
    box-shadow: none;
}
[data-theme="dark"] .header-avatar {
    box-shadow: none;
}

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

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── Loading ──────────────────────────────────────────────────── */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem;
}
.loading-progress circle {
    fill: none;
    stroke: var(--border);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}
.loading-progress circle:last-child {
    stroke: var(--accent);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}
.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto;
    color: var(--text-muted);
}
.loading-progress-text::after {
    content: var(--blazor-load-percentage-text, 'Carregando...');
}

/* ══ Layout ═══════════════════════════════════════════════════════ */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    height: 56px;
}
.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0.75rem 0;
    flex: 1;
    overflow-y: auto;
}
.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.sidebar-nav li a,
.sidebar-nav li .nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    border-left: 3px solid transparent;
    transition: all 0.15s var(--ease-out);
}
.sidebar-nav li a:hover,
.sidebar-nav li .nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}
.sidebar-nav li a.active,
.sidebar-nav li .nav-link.active {
    color: var(--accent);
    background: rgba(139, 63, 232, 0.08);
    border-left-color: var(--accent);
    font-weight: 500;
}
.sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
}
.sidebar-logout-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8125rem;
    border-radius: var(--radius-md);
    transition: all 0.15s var(--ease-out);
}
.sidebar-logout-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
}

/* ── Content area (sidebar + header aware) ───────────────────── */
.admin-content-area {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────── */
.admin-header {
    height: 56px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-left { display: flex; align-items: center; gap: 1rem; }
.header-breadcrumb {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

/* ── Theme toggle ────────────────────────────────────────────── */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: transparent;
    cursor: pointer;
    transition: all 0.15s var(--ease-out);
    color: var(--text-secondary);
}
.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}
.theme-icon { width: 16px; height: 16px; }

.header-separator {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 0.25rem;
}

/* ── Header profile ──────────────────────────────────────────── */
.header-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius-md);
    transition: background 0.15s;
}
.header-profile:hover { background: var(--bg-hover); }

.header-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}
.header-avatar.avatar-lg {
    width: 40px;
    height: 40px;
    font-size: 0.8rem;
}
.header-user-email {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}
.header-chevron {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: transform 0.2s var(--ease-out);
}
.header-chevron.rotated { transform: rotate(180deg); }

/* ── Profile dropdown ────────────────────────────────────────── */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    animation: slideUp 0.15s var(--ease-out);
}
.profile-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
}
.profile-dropdown-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}
.profile-dropdown-email {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}
.profile-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0;
}
.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 1.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: all 0.15s;
}
.profile-dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.profile-dropdown-logout:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
}
.profile-dropdown-backdrop {
    position: fixed;
    inset: 0;
    z-index: 150;
}

/* ── Main content ─────────────────────────────────────────────── */
.admin-main {
    flex: 1;
    padding: 2rem 2.5rem;
    overflow-y: auto;
    max-width: 1400px;
}

/* ══ Typography ═══════════════════════════════════════════════════ */
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 1.5rem;
    color: var(--text-primary);
}
.page-header-info .page-title {
    margin-bottom: 0;
}
.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0;
}
.page-subtitle-inline {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 0.15rem;
}

/* ══ Metric Cards ═════════════════════════════════════════════════ */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}
.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.metric-card h3 {
    margin: 0 0 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

/* ══ Tables ═══════════════════════════════════════════════════════ */
.admin-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.admin-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
}
.admin-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--bg-hover); }
.admin-table tbody tr:nth-child(even) { background: rgba(255,255,255,.02); }
.admin-table tbody tr:nth-child(even):hover { background: var(--bg-hover); }

.table-email {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ══ Badges ═══════════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
}
.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-active, .badge-live { background: rgba(34,197,94,.12); color: #4ade80; }
.badge-active::before, .badge-live::before { background: var(--success); }

.badge-suspended, .badge-error { background: rgba(239,68,68,.12); color: #f87171; }
.badge-suspended::before, .badge-error::before { background: var(--danger); }

.badge-draft, .badge-queued { background: rgba(148,163,184,.12); color: var(--text-secondary); }
.badge-draft::before, .badge-queued::before { background: var(--text-muted); }

.badge-building, .badge-running { background: rgba(59,130,246,.12); color: #60a5fa; }
.badge-building::before, .badge-running::before { background: var(--info); }

.badge-success { background: rgba(34,197,94,.12); color: #4ade80; }
.badge-success::before { background: var(--success); }

.badge-failed { background: rgba(239,68,68,.12); color: #f87171; }
.badge-failed::before { background: var(--danger); }

.badge-none { background: rgba(148,163,184,.08); color: var(--text-muted); }
.badge-none::before { background: var(--text-muted); }

.badge-free { background: rgba(34,197,94,.12); color: #4ade80; }
.badge-free::before { background: var(--success); }

.badge-starter { background: rgba(59,130,246,.12); color: #60a5fa; }
.badge-starter::before { background: var(--info); }

.badge-pro { background: rgba(139,63,232,.12); color: #a78bfa; }
.badge-pro::before { background: var(--accent); }

/* ══ Buttons ══════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 2px 8px rgba(139,63,232,.25);
}
.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(139,63,232,.35);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
    background: var(--bg-hover);
}

.btn-danger {
    background: rgba(239,68,68,.12);
    color: #f87171;
    border: 1px solid rgba(239,68,68,.25);
}
.btn-danger:hover {
    background: rgba(239,68,68,.2);
    border-color: rgba(239,68,68,.4);
}

.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.75rem;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ══ Forms / Inputs ═══════════════════════════════════════════════ */
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.15s;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(139,63,232,.15);
}
.form-textarea {
    min-height: 120px;
    resize: vertical;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.6;
}
.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-hover);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* ══ Modal ════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.15s ease-out;
}
.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.2s var(--ease-out);
}
.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 1rem;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

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

/* ══ Pagination ═══════════════════════════════════════════════════ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1.25rem;
}
.pagination-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}
.pagination-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.pagination-btn:disabled { opacity: 0.35; cursor: default; }
.pagination-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.pagination-info {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0 0.5rem;
}

/* ══ Alert / Toast ════════════════════════════════════════════════ */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}
.alert-success { background: rgba(34,197,94,.12); color: #4ade80; border: 1px solid rgba(34,197,94,.25); }
.alert-error { background: rgba(239,68,68,.12); color: #f87171; border: 1px solid rgba(239,68,68,.25); }

/* ══ Empty state ══════════════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state p { margin: 0.5rem 0 0; font-size: 0.875rem; }

/* ══ Logs ═════════════════════════════════════════════════════════ */
.log-box {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.7;
    color: var(--text-secondary);
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ══ Login page ═══════════════════════════════════════════════════ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 1rem;
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}
.login-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}
.login-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1.25rem;
    color: var(--text-secondary);
}
.login-error {
    background: rgba(239,68,68,.12);
    color: #f87171;
    border: 1px solid rgba(239,68,68,.25);
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    margin-bottom: 1rem;
}
.login-field {
    margin-bottom: 1rem;
}
.login-field label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}
.login-field input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color 0.15s;
}
.login-field input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(139,63,232,.15);
}
.login-btn {
    width: 100%;
    padding: 0.65rem;
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: box-shadow 0.2s var(--ease-out);
    margin-top: 0.5rem;
}
.login-btn:hover {
    box-shadow: 0 4px 16px rgba(139,63,232,.35);
}

/* ══ Page header ══════════════════════════════════════════════════ */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.page-header .page-title { margin-bottom: 0; }
.page-header .btn-group { flex-shrink: 0; padding-top: 0.25rem; }

/* ══ Detail panel ═════════════════════════════════════════════════ */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}
.detail-card h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
}
.detail-card p {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
}

/* ══ Section title ════════════════════════════════════════════════ */
.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
    color: var(--text-primary);
}

/* ══ Skeleton loader ══════════════════════════════════════════════ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}
.skeleton-line { height: 1rem; margin-bottom: 0.5rem; }
.skeleton-card { height: 80px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ══ Form card ═══════════════════════════════════════════════════ */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.form-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem;
    color: var(--text-primary);
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem 1rem;
}

/* ══ Utility ══════════════════════════════════════════════════════ */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.8125rem; }
.text-mono { font-family: var(--font-mono); }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* ══ Hamburger button (hidden on desktop) ════════════════════════ */
.hamburger-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s var(--ease-out);
    flex-shrink: 0;
}
.hamburger-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Sidebar close button (hidden on desktop) */
.sidebar-close-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    margin-left: auto;
    transition: all 0.15s var(--ease-out);
}
.sidebar-close-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Sidebar backdrop overlay (hidden on desktop) */
.sidebar-backdrop {
    display: none;
}

/* ══ Responsive: Tables scrollable on small screens ══════════════ */
.admin-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ══ Responsive: Tablet (max-width: 1024px) ══════════════════════ */
@media (max-width: 1024px) {
    .admin-main {
        padding: 1.5rem 1.5rem;
    }

    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }

    .detail-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

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

/* ══ Responsive: Mobile (max-width: 768px) ═══════════════════════ */
@media (max-width: 768px) {
    /* Show hamburger */
    .hamburger-btn {
        display: flex;
    }

    /* Show sidebar close button */
    .sidebar-close-btn {
        display: flex;
    }

    /* Hide sidebar off-screen by default */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s var(--ease-out);
        box-shadow: none;
    }

    /* Show sidebar when open */
    .sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,.2);
    }

    /* Show backdrop when sidebar open */
    .sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 90;
    }

    /* Remove sidebar offset on content area */
    .admin-content-area {
        margin-left: 0;
    }

    /* Reduce main padding */
    .admin-main {
        padding: 1rem;
    }

    /* Header padding */
    .admin-header {
        padding: 0 1rem;
    }

    /* Page title */
    .page-title {
        font-size: 1.25rem;
    }

    /* Page header stacks on mobile */
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .page-header .btn-group {
        padding-top: 0;
    }

    /* Metrics grid: 2 columns on mobile */
    .metrics-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .metric-card {
        padding: 1rem;
    }

    .metric-value {
        font-size: 1.5rem;
    }

    /* Detail grid single column */
    .detail-grid {
        grid-template-columns: 1fr;
    }

    /* Form grid single column */
    .form-grid {
        grid-template-columns: 1fr;
    }

    /* Tables: smaller font, min-width for scroll */
    .admin-table {
        min-width: 600px;
    }

    /* Modal full-width on mobile */
    .modal-card {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }

    /* Profile dropdown */
    .profile-dropdown {
        width: 260px;
        right: -0.5rem;
    }

    /* Hide email in header on mobile */
    .header-user-email {
        display: none;
    }

    /* Button group wraps */
    .btn-group {
        flex-wrap: wrap;
    }

    /* Login page adjustments */
    .login-card {
        padding: 1.5rem;
    }
}

/* ══ Responsive: Small mobile (max-width: 480px) ═════════════════ */
@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .header-breadcrumb {
        font-size: 0.75rem;
    }

    .admin-table {
        min-width: 500px;
        font-size: 0.8125rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.5rem 0.75rem;
    }

    .pagination {
        flex-wrap: wrap;
        gap: 0.35rem;
    }
}
