/* Relict Design System */
:root {
    --navy-900: #07111F;
    --navy-800: #091827;
    --navy-700: #0D1E31;
    --electric: #28B8F8;
    --cyan: #59D5FF;
    --royal: #3978FF;
    --purple: #7C5CFF;
    --magenta: #D45CFF;
    --white: #F7FAFC;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --surface: #F5F8FC;
    --surface-white: #FFFFFF;
    --border: #DCE5F0;
    --gradient-primary: linear-gradient(135deg, #28B8F8, #3978FF, #7C5CFF);
    --gradient-hero: linear-gradient(135deg, #07111F 0%, #0D1E31 50%, #091827 100%);
    --shadow-sm: 0 1px 2px rgba(7, 17, 31, 0.05);
    --shadow-md: 0 4px 12px rgba(7, 17, 31, 0.08);
    --shadow-lg: 0 8px 24px rgba(7, 17, 31, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Theme: dark */
html[data-theme="dark"] {
    color-scheme: dark;
    --navy-900: #F1F5F9;
    --navy-800: #E2E8F0;
    --navy-700: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #A8B4C4;
    --gray-600: #CBD5E1;
    --surface: #0B1220;
    --surface-white: #121A2A;
    --border: #243247;
    --white: #F8FAFC;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}
html[data-theme="light"] {
    color-scheme: light;
}
html[data-theme="dark"] body,
html[data-theme="dark"] .app-body {
    background: var(--surface);
    color: var(--navy-900);
}
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5 {
    color: var(--navy-900);
}

/* Accent themes */
html[data-accent="electric"] {
    --electric: #22D3EE;
    --cyan: #67E8F9;
    --royal: #06B6D4;
    --purple: #0891B2;
    --gradient-primary: linear-gradient(135deg, #22D3EE, #06B6D4, #0891B2);
}
html[data-accent="purple"] {
    --electric: #8B5CF6;
    --cyan: #A78BFA;
    --royal: #7C5CFF;
    --purple: #A855F7;
    --gradient-primary: linear-gradient(135deg, #7C5CFF, #8B5CF6, #A855F7);
}
html[data-accent="ocean"] {
    --electric: #0EA5E9;
    --cyan: #38BDF8;
    --royal: #0284C7;
    --purple: #0369A1;
    --gradient-primary: linear-gradient(135deg, #0EA5E9, #0284C7, #0369A1);
}

/* Google Material Symbols */
.material-symbols-outlined,
.r-icon {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 1.25rem;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    user-select: none;
    vertical-align: middle;
    flex-shrink: 0;
}
.r-icon-sm { font-size: 1.125rem; }
.r-icon-md { font-size: 1.5rem; }
.r-icon-lg { font-size: 2rem; }
.r-icon-xl { font-size: 3rem; }
.r-icon-fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

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

/* Scroll without visible scrollbars (wheel / trackpad / touch still work) */
* {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
*::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

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

body {
    font-family: var(--font);
    color: var(--navy-900);
    background: var(--surface);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--royal); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--electric); }

img { max-width: 100%; height: auto; }

/* Typography */
h1, h2, h3, h4, h5 { font-weight: 700; line-height: 1.3; color: var(--navy-900); }
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-muted { color: var(--gray-500); }
.text-sm { font-size: 0.875rem; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--radius-sm); font-size: 0.9375rem;
    font-weight: 600; border: none; cursor: pointer; transition: all 0.2s;
    text-decoration: none; white-space: nowrap;
}
.btn-primary {
    background: var(--gradient-primary); color: white;
    box-shadow: 0 2px 8px rgba(40, 184, 248, 0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(40, 184, 248, 0.4); color: white; }
.btn-secondary {
    background: var(--surface-white); color: var(--navy-900);
    border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--electric); color: var(--electric); }
.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: rgba(40, 184, 248, 0.08); color: var(--electric); }
.btn-danger { background: #EF4444; color: white; }
.btn-sm { padding: 6px 14px; font-size: 0.8125rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 6px; color: var(--gray-600); }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 0.9375rem; font-family: var(--font);
    background: var(--surface-white); color: var(--navy-900); transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none; border-color: var(--electric);
    box-shadow: 0 0 0 3px rgba(40, 184, 248, 0.15);
}
.form-textarea { min-height: 100px; resize: vertical; }
.form-error { color: #EF4444; font-size: 0.8125rem; margin-top: 4px; }
.form-hint { color: var(--gray-400); font-size: 0.8125rem; margin-top: 4px; }
.form-checkbox { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; }
.form-checkbox input { width: 18px; height: 18px; accent-color: var(--electric); }

/* Cards */
.card {
    background: var(--surface-white); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm);
    width: 100%; max-width: 100%; box-sizing: border-box;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 1rem; font-weight: 700; }

/* Badges */
.badge {
    display: inline-flex; align-items: center; padding: 3px 10px;
    border-radius: 20px; font-size: 0.75rem; font-weight: 600;
}
.badge-blue { background: rgba(40, 184, 248, 0.12); color: #0E8EC4; }
.badge-purple { background: rgba(124, 92, 255, 0.12); color: #6B4FE0; }
.badge-green { background: rgba(16, 185, 129, 0.12); color: #059669; }
.badge-orange { background: rgba(245, 158, 11, 0.12); color: #D97706; }
.badge-gray { background: rgba(148, 163, 184, 0.15); color: var(--gray-600); }

/* Alerts / Toasts */
.alert {
    padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 16px;
    font-size: 0.9375rem; display: flex; align-items: center; gap: 10px;
}
.alert-success { background: rgba(16, 185, 129, 0.1); color: #059669; border: 1px solid rgba(16, 185, 129, 0.2); }
.alert-error { background: rgba(239, 68, 68, 0.1); color: #DC2626; border: 1px solid rgba(239, 68, 68, 0.2); }
.alert-info { background: rgba(40, 184, 248, 0.1); color: #0E8EC4; border: 1px solid rgba(40, 184, 248, 0.2); }

/* Toast container */
.toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 14px 20px; border-radius: var(--radius-sm); background: var(--surface-white);
    box-shadow: var(--shadow-lg); border-left: 4px solid var(--electric);
    animation: slideIn 0.3s ease; min-width: 300px;
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Tables */
.table-wrapper { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td {
    text-align: center;
    vertical-align: middle;
}
td form {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    vertical-align: middle;
}
th { padding: 12px 16px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-500); background: var(--surface); border-bottom: 1px solid var(--border); }
td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 0.9375rem; }
tr:hover td { background: rgba(40, 184, 248, 0.03); }
tr:last-child td { border-bottom: none; }

/* Avatar */
.avatar {
    width: 40px; height: 40px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-weight: 700;
    font-size: 0.875rem; color: white; flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.25rem; }
.avatar-gradient { background: var(--gradient-primary); }
.avatar.has-image { background: var(--surface); overflow: hidden; }
.avatar img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: inherit; }
.avatar > [hidden] { display: none !important; }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state-icon {
    margin-bottom: 16px;
    opacity: 0.45;
    color: var(--gray-500);
    display: inline-flex;
}
.empty-state-icon .r-icon { font-size: 3rem; }
.empty-state h3 { margin-bottom: 8px; }
.empty-state p { color: var(--gray-500); margin-bottom: 24px; }

/* Utility */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.p-4 { padding: 16px; }
.w-full { width: 100%; }
.hidden { display: none !important; }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
}
