/* AegisConfig — Cybersecurity-Inspired Administration & Platform UI */
:root {
    --bg-canvas: #09090b;
    --bg-sidebar: #0c0c0f;
    --bg-surface: rgba(18, 18, 22, 0.88);
    --bg-surface-solid: #121216;
    --bg-elevated: #18181d;
    --bg-hover: rgba(255, 255, 255, 0.045);
    --bg-active: rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #38bdf8;
    --accent-indigo: #6366f1;
    --accent-soft: rgba(56, 189, 248, 0.14);
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.14);
    --warning: #eab308;
    --warning-bg: rgba(234, 179, 8, 0.16);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.16);
    --shadow-card: 0 8px 30px rgba(0, 0, 0, 0.35);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --sidebar-width: 248px;
}

[data-theme="light"] {
    --bg-canvas: #f4f5f7;
    --bg-sidebar: #ffffff;
    --bg-surface: rgba(255, 255, 255, 0.92);
    --bg-surface-solid: #ffffff;
    --bg-elevated: #f8fafc;
    --bg-hover: rgba(15, 23, 42, 0.04);
    --bg-active: rgba(15, 23, 42, 0.07);
    --border-subtle: rgba(15, 23, 42, 0.09);
    --border-strong: rgba(15, 23, 42, 0.16);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent: #0284c7;
    --accent-indigo: #4f46e5;
    --accent-soft: rgba(2, 132, 199, 0.12);
    --shadow-card: 0 6px 24px rgba(15, 23, 42, 0.06);
}

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

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-canvas);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { opacity: 0.9; }

code, pre, .font-mono {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Glassmorphic Card */
.card {
    background: var(--bg-surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 20px;
    transition: border-color 0.2s ease, transform 0.2s ease;
}
.card:hover { border-color: var(--border-strong); }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.card-subtitle {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--text-muted);
}

/* Layout Shell (Admin) */
.admin-shell {
    display: flex;
    min-height: 100vh;
}
.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    transition: transform 0.25s ease, width 0.25s ease;
}
.admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--border-subtle);
}
.admin-brand img { width: 32px; height: 32px; }
.admin-brand-title { font-weight: 700; font-size: 15px; color: var(--text-primary); line-height: 1.15; }
.admin-brand-sub { font-size: 11.5px; color: var(--text-muted); }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 10px;
}
.nav-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 12px 10px 6px;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-link.active {
    background: var(--bg-active);
    color: var(--text-primary);
    box-shadow: inset 0 0 0 1px var(--border-subtle);
}
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }

.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-indigo));
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.user-meta { min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.admin-topbar {
    height: 58px;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; max-width: 440px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.admin-content {
    padding: 26px 28px 48px;
    max-width: 1480px;
    width: 100%;
    margin: 0 auto;
}
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 22px;
}
.page-title { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.page-desc { margin: 4px 0 0; font-size: 13.5px; color: var(--text-secondary); }

/* Stat Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--text-secondary); font-size: 13px; font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; color: var(--text-primary); line-height: 1.1; }
.stat-sub { font-size: 12px; color: var(--text-muted); }

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.chart-wrap { position: relative; height: 240px; width: 100%; }

/* Two-column utility */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); background: var(--bg-active); }
.btn-primary {
    background: linear-gradient(135deg, #0ea5e9, #4f46e5);
    border-color: transparent;
    color: #ffffff;
}
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, #0ea5e9, #4f46e5); }
.btn-success { background: var(--success-bg); color: var(--success); border-color: rgba(34,197,94,0.3); }
.btn-warning { background: var(--warning-bg); color: var(--warning); border-color: rgba(234,179,8,0.3); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(239,68,68,0.3); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; width: 34px; height: 34px; }

/* Inputs & Forms */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-control, .form-select {
    width: 100%;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 13.5px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea.form-control { min-height: 110px; resize: vertical; }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    text-align: left;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}
.data-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--bg-hover); }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-info    { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--bg-active); color: var(--text-secondary); }

/* Alerts / Flash */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 13.5px;
    border: 1px solid var(--border-subtle);
}
.alert-success { background: var(--success-bg); border-color: rgba(34,197,94,0.35); color: var(--success); }
.alert-danger  { background: var(--danger-bg); border-color: rgba(239,68,68,0.35); color: var(--danger); }
.alert-warning { background: var(--warning-bg); border-color: rgba(234,179,8,0.35); color: var(--warning); }
.alert-info    { background: var(--info-bg); border-color: rgba(59,130,246,0.35); color: var(--info); }

/* Toolbar */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.toolbar .search-input { flex: 1; min-width: 220px; }

/* Code / JSON Editor */
.json-editor-container {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #0b0b0e;
}
[data-theme="light"] .json-editor-container { background: #0f172a; }
.json-editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255,255,255,0.04);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 12px;
    color: #a1a1aa;
}
.json-editor-textarea {
    width: 100%;
    min-height: 340px;
    padding: 14px;
    background: transparent;
    color: #e4e4e7;
    border: none;
    outline: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    tab-size: 2;
    resize: vertical;
}
.json-preview-code {
    margin: 0;
    padding: 14px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    line-height: 1.55;
    background: #0b0b0e;
    color: #e4e4e7;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}
.json-key { color: #7dd3fc; }
.json-string { color: #86efac; }
.json-number { color: #fca5a5; }
.json-boolean { color: #fcd34d; }
.json-null { color: #c4b5fd; }

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal-dialog {
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.55);
}

/* Public Landing & Auth */
.public-nav {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-subtle);
}
[data-theme="light"] .public-nav { background: rgba(255,255,255,0.85); }
.container { max-width: 1180px; margin: 0 auto; padding: 0 22px; }
.public-nav-inner {
    height: 66px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.hero-section {
    padding: 84px 0 64px;
    background:
        radial-gradient(60% 50% at 50% 0%, rgba(56, 189, 248, 0.14), transparent 70%),
        radial-gradient(40% 40% at 80% 20%, rgba(99, 102, 241, 0.12), transparent 65%);
}
.hero-title {
    font-size: clamp(32px, 5vw, 52px);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin: 14px 0 18px;
}
.hero-lead {
    font-size: 16.5px;
    color: var(--text-secondary);
    max-width: 680px;
    margin: 0 0 28px;
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    display: inline-block;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
}

/* Auth Card */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(50% 45% at 50% 10%, rgba(56,189,248,0.12), transparent 70%),
        var(--bg-canvas);
}
.auth-card { width: 100%; max-width: 420px; padding: 30px; }

/* Responsive */
.mobile-menu-btn { display: none; }
@media (max-width: 1024px) {
    .charts-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .mobile-menu-btn { display: inline-flex; }
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .admin-content { padding: 18px 16px 36px; }
}

/* === ONYX Live Control Center Enhancements === */
@keyframes onyxPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.88); }
}
@keyframes onyxFlash {
    0% { background: rgba(56, 189, 248, 0.22); }
    100% { background: transparent; }
}
.live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    background: var(--success);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.75);
    animation: onyxPulse 1.4s ease-in-out infinite;
}
.live-dot.warn { background: var(--warning); box-shadow: 0 0 10px rgba(234, 179, 8, 0.7); }
.live-dot.err  { background: var(--danger); box-shadow: 0 0 10px rgba(239, 68, 68, 0.75); }
.live-dot.paused { animation: none; opacity: 0.55; }

/* Live Console Developer Terminal */
.terminal-shell {
    background: #07070a;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}
.terminal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 16px;
    background: #101016;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.terminal-stream {
    height: 540px;
    overflow-y: auto;
    padding: 12px 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    line-height: 1.65;
    color: #e4e4e7;
}
.terminal-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 5px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    align-items: baseline;
}
.terminal-line:hover { background: rgba(255,255,255,0.035); }
.terminal-line.fresh { animation: onyxFlash 1.2s ease-out; }
.t-time { color: #71717a; white-space: nowrap; }
.t-cat { font-weight: 700; white-space: nowrap; }
.t-cat-INFO { color: #94a3b8; }
.t-cat-SUCCESS { color: #4ade80; }
.t-cat-WARNING { color: #facc15; }
.t-cat-ERROR { color: #f87171; }
.t-cat-SECURITY { color: #fb7185; }
.t-cat-API { color: #38bdf8; }
.t-cat-CONFIGURATION { color: #a78bfa; }
.t-cat-AI { color: #2dd4bf; }
.t-cat-CLIENT { color: #60a5fa; }
.t-meta { color: #71717a; font-size: 11.5px; margin-left: auto; white-space: nowrap; }
.t-msg { color: #f4f4f5; word-break: break-word; flex: 1; min-width: 220px; }

.widget-hidden { display: none !important; }

/* === ONYX 2.0 Premium Glassmorphism, Animations & Custom Scrollbars === */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.25) transparent;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.22);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(56, 189, 248, 0.45); }

@keyframes ambientDrift {
    0%   { background-position: 0% 0%, 100% 0%, 50% 100%; }
    50%  { background-position: 20% 10%, 80% 20%, 40% 85%; }
    100% { background-position: 0% 0%, 100% 0%, 50% 100%; }
}
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes borderGlow {
    0%, 100% { box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.22), 0 10px 35px rgba(0, 0, 0, 0.42); }
    50%      { box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35), 0 12px 42px rgba(14, 165, 233, 0.12); }
}

[data-theme="dark"] body,
html:not([data-theme="light"]) body {
    background-color: #07080c;
    background-image:
        radial-gradient(600px circle at 18% 8%, rgba(56, 189, 248, 0.09), transparent 60%),
        radial-gradient(520px circle at 88% 12%, rgba(99, 102, 241, 0.10), transparent 60%),
        radial-gradient(700px circle at 50% 96%, rgba(16, 185, 129, 0.05), transparent 65%);
    background-attachment: fixed;
    animation: ambientDrift 22s ease-in-out infinite;
}

.admin-sidebar {
    background: linear-gradient(180deg, rgba(12, 13, 19, 0.96) 0%, rgba(9, 10, 15, 0.98) 100%);
    backdrop-filter: blur(18px);
    border-right: 1px solid rgba(255, 255, 255, 0.07);
}
[data-theme="light"] .admin-sidebar { background: #ffffff; border-right: 1px solid rgba(15, 23, 42, 0.08); }

.admin-topbar {
    background: rgba(11, 12, 18, 0.78);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
[data-theme="light"] .admin-topbar { background: rgba(255, 255, 255, 0.85); }

.card, .stat-card {
    background: linear-gradient(165deg, rgba(22, 24, 34, 0.82) 0%, rgba(14, 15, 22, 0.88) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: fadeSlideUp 0.32s ease both;
}
[data-theme="light"] .card, [data-theme="light"] .stat-card {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(15, 23, 42, 0.09);
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.06);
}
.card:hover, .stat-card:hover {
    border-color: rgba(56, 189, 248, 0.28);
    transform: translateY(-1px);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Collapsible Sidebar Sections */
.nav-group { margin-bottom: 4px; }
.nav-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 10px 10px 6px;
    cursor: pointer;
    transition: color 0.15s ease;
}
.nav-group-toggle:hover { color: var(--text-primary); }
.nav-group-toggle .chev { transition: transform 0.2s ease; font-size: 10px; opacity: 0.7; }
.nav-group.collapsed .nav-group-toggle .chev { transform: rotate(-90deg); }
.nav-group.collapsed .nav-group-items { display: none; }

.nav-link {
    position: relative;
    transition: background 0.18s ease, color 0.18s ease, transform 0.15s ease;
}
.nav-link:hover { transform: translateX(2px); }
.nav-link.active {
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.16), rgba(99, 102, 241, 0.10));
    color: #fff;
    box-shadow: inset 3px 0 0 var(--accent), inset 0 0 0 1px rgba(56, 189, 248, 0.22);
}
[data-theme="light"] .nav-link.active { color: #0f172a; }

/* Primary Button Glow & Polish */
.btn-primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
    box-shadow: 0 4px 18px rgba(56, 189, 248, 0.25);
    font-weight: 600;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.38);
}

/* Custom Styled File Input (replaces ugly native white browser button) */
input[type="file"].form-control {
    padding: 6px 10px;
    cursor: pointer;
}
input[type="file"].form-control::file-selector-button {
    background: linear-gradient(135deg, rgba(56,189,248,0.18), rgba(99,102,241,0.18));
    color: var(--text-primary);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 6px;
    padding: 5px 12px;
    margin-right: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
input[type="file"].form-control::file-selector-button:hover {
    background: linear-gradient(135deg, rgba(56,189,248,0.32), rgba(99,102,241,0.32));
}

/* Plain-English Feature Guide Banner */
.guide-banner {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.08), rgba(99, 102, 241, 0.08));
    border: 1px solid rgba(56, 189, 248, 0.22);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 18px;
    animation: fadeSlideUp 0.28s ease both;
}
.guide-banner summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}
.guide-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.guide-step {
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12.5px;
    color: var(--text-secondary);
}
[data-theme="light"] .guide-step { background: rgba(255, 255, 255, 0.7); }
.guide-step strong { display: block; color: var(--text-primary); margin-bottom: 3px; font-size: 12.5px; }

/* Toast Notification */
.onyx-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    background: linear-gradient(135deg, #0f172a, #1e1b4b);
    color: #f8fafc;
    border: 1px solid rgba(56, 189, 248, 0.45);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    padding: 11px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    animation: fadeSlideUp 0.22s ease;
}

/* Output View Tabs */
.output-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.output-tab-btn {
    padding: 5px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}
.output-tab-btn.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: rgba(56, 189, 248, 0.4);
}

/* ==========================================================================
   ONYX PRO MAX — UI/UX Design System Refinement Layer (WCAG AA+ & 8px Grid)
   ========================================================================== */
:root {
    --bg-canvas: #07090f;
    --bg-sidebar: #0b0f19;
    --bg-surface: rgba(15, 21, 34, 0.86);
    --bg-surface-solid: #0f1522;
    --bg-elevated: #141c2e;
    --border-subtle: rgba(148, 163, 184, 0.13);
    --border-strong: rgba(148, 163, 184, 0.24);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --shadow-card: 0 12px 36px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    --focus-ring: 0 0 0 3px rgba(56, 189, 248, 0.35);
}

[data-theme="light"] {
    --bg-canvas: #f1f5f9;
    --bg-sidebar: #ffffff;
    --bg-surface: rgba(255, 255, 255, 0.96);
    --bg-surface-solid: #ffffff;
    --bg-elevated: #f8fafc;
    --border-subtle: rgba(15, 23, 42, 0.10);
    --border-strong: rgba(15, 23, 42, 0.20);
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #475569;
    --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.07);
}

body {
    background-image:
        radial-gradient(ellipse 80% 50% at 15% -10%, rgba(56, 189, 248, 0.09), transparent 60%),
        radial-gradient(ellipse 65% 45% at 88% 0%, rgba(99, 102, 241, 0.08), transparent 55%);
    background-attachment: fixed;
}

[data-theme="light"] body {
    background-image:
        radial-gradient(ellipse 80% 50% at 15% -10%, rgba(2, 132, 199, 0.06), transparent 60%),
        radial-gradient(ellipse 65% 45% at 88% 0%, rgba(79, 70, 229, 0.05), transparent 55%);
}

/* Crisp focus states (keyboard accessibility) */
:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Stable card elevation (no layout-shifting transform jank) */
.card {
    border-radius: 14px;
    padding: 22px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.card:hover {
    transform: none;
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Stat cards with clean top accent shimmer */
.stat-card {
    border-radius: 14px;
    padding: 18px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    transition: border-color 0.18s ease, background-color 0.18s ease;
}
.stat-card:hover {
    transform: none;
    border-color: rgba(56, 189, 248, 0.32);
}

/* Crisp buttons with tactile feedback */
.btn {
    border-radius: 9px;
    font-weight: 500;
    transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { opacity: 0.88; }
.btn-primary {
    background: linear-gradient(135deg, #0284c7, #4f46e5);
    border-color: rgba(56, 189, 248, 0.4);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.28);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.36);
}

/* Form inputs: crisp contrast & clear focus */
.form-control, .form-select {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 9px;
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

/* Refined Data Tables */
.data-table th {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.55);
    padding: 11px 14px;
}
[data-theme="light"] .data-table th {
    background: #f1f5f9;
}
.data-table td {
    padding: 11px 14px;
    vertical-align: middle;
}
.data-table tbody tr {
    transition: background-color 0.12s ease;
}
.data-table tbody tr:hover {
    background: rgba(56, 189, 248, 0.045);
}

/* Quick Action Tiles (Dashboard) */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.quick-action-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    transition: border-color 0.16s ease, background-color 0.16s ease;
}
.quick-action-tile:hover {
    border-color: rgba(56, 189, 248, 0.42);
    background: rgba(56, 189, 248, 0.07);
    opacity: 1;
}
.quick-action-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(56, 189, 248, 0.14);
    color: var(--accent);
    font-size: 16px;
    flex-shrink: 0;
}

/* Respect user reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
