/* =========================================================
   Vero Panel — Design System
   GO Platforms • Server Management
   ========================================================= */

/* Alpine.js cloak: hide elements until Alpine initializes */
[x-cloak] { display: none !important; }

/* === FONT FACES === */
@font-face {
    font-family: 'Inter';
    src: url('/static/fonts/Inter-Regular.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'JetBrains Mono';
    src: url('/static/fonts/JetBrainsMono-Regular.woff2') format('woff2');
    font-weight: 400; font-style: normal; font-display: swap;
}

/* === ROOT VARIABLES === */
:root {
    /* Brand */
    --color-primary:          #1a2744;
    --color-primary-light:    #243352;
    --color-primary-dark:     #111b30;
    --color-primary-text:     #e2e8f0;

    /* Menu Groups */
    --color-server:           #1e3456;
    --color-server-bg:        #253d63;
    --color-server-hover:     #2e4a72;
    --color-server-active:    #3b5998;

    --color-customers:        #0d6e4f;
    --color-customers-bg:     #0f7d5a;
    --color-customers-hover:  #14976d;
    --color-customers-active: #17a87a;

    --color-webserver:        #0e7490;
    --color-webserver-bg:     #0891b2;
    --color-webserver-hover:  #06b6d4;
    --color-webserver-active: #22d3ee;

    --color-databases:        #3730a3;
    --color-databases-bg:     #4338ca;
    --color-databases-hover:  #4f46e5;
    --color-databases-active: #6366f1;

    --color-email:            #9f1239;
    --color-email-bg:         #be123c;
    --color-email-hover:      #e11d48;
    --color-email-active:     #f43f5e;

    --color-security:         #991b1b;
    --color-security-bg:      #b91c1c;
    --color-security-hover:   #dc2626;
    --color-security-active:  #ef4444;

    /* Status */
    --color-success:          #059669;
    --color-warning:          #d97706;
    --color-danger:           #dc2626;
    --color-info:             #2563eb;
    --color-muted:            #6b7280;

    /* Backgrounds */
    --bg-page:                #f5f6fa;
    --bg-card:                #ffffff;
    --bg-card-alt:            #f9fafb;
    --bg-sidebar:             #1a2744;
    --bg-header:              #ffffff;
    --bg-input:               #ffffff;
    --bg-input-disabled:      #f3f4f6;
    --bg-code:                #1e293b;

    /* Text */
    --text-primary:           #111827;
    --text-secondary:         #4b5563;
    --text-muted:             #9ca3af;
    --text-light:             #e2e8f0;
    --text-white:             #ffffff;
    --text-link:              #2563eb;
    --text-link-hover:        #1d4ed8;

    /* Borders */
    --border-color:           #e5e7eb;
    --border-focus:           #3b82f6;
    --border-error:           #dc2626;
    --border-radius-sm:       4px;
    --border-radius:          6px;
    --border-radius-lg:       10px;
    --border-radius-full:     9999px;

    /* Shadows */
    --shadow-sm:              0 1px 2px rgba(0,0,0,0.05);
    --shadow:                 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md:              0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg:              0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);

    /* Spacing */
    --space-xs: 4px; --space-sm: 8px; --space-md: 16px;
    --space-lg: 24px; --space-xl: 32px; --space-2xl: 48px;

    /* Layout */
    --sidebar-width:          260px;
    --sidebar-collapsed:      64px;
    --header-height:          60px;
    --content-max-width:      1400px;
    --content-padding:        24px;

    /* Transitions */
    --transition-fast:        150ms ease;
    --transition-normal:      250ms ease;
    --transition-slow:        350ms ease;

    /* Z-Index */
    --z-sidebar: 100; --z-header: 200; --z-dropdown: 300;
    --z-modal-backdrop: 400; --z-modal: 500; --z-toast: 600; --z-tooltip: 700;
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: var(--text-primary); background: var(--bg-page); line-height: 1.5; }
a { color: var(--text-link); text-decoration: none; }
a:hover { color: var(--text-link-hover); }
img { max-width: 100%; }

/* === LAYOUT === */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg-page);
}

/* ── SIDEBAR ── */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: var(--z-sidebar);
    transition: width var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.app-sidebar::-webkit-scrollbar { width: 4px; }
.app-sidebar::-webkit-scrollbar-track { background: transparent; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.sidebar-logo {
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.sidebar-logo img { height: 30px; width: auto; }
.sidebar-logo .logo-text {
    font-size: 18px; font-weight: 700; color: var(--text-white);
    letter-spacing: 2px;
}

.sidebar-nav { flex: 1; padding: 8px 0; }

/* Sidebar groups (SERVER, CUSTOMERS, PLATFORMS) */
.sidebar-group { margin-bottom: 2px; }

.sidebar-group-header {
    display: flex; align-items: center;
    padding: 14px 20px;
    color: var(--text-white);
    font-weight: 700; font-size: 11px;
    text-transform: uppercase; letter-spacing: 1.2px;
    cursor: pointer; user-select: none;
    transition: background var(--transition-fast);
}
.sidebar-group-header i { margin-right: 10px; font-size: 14px; opacity: 0.7; }
.sidebar-group-header .chevron { margin-left: auto; font-size: 10px; transition: transform var(--transition-fast); }

.sidebar-group--server .sidebar-group-header {
    background: linear-gradient(135deg, rgba(37,61,99,0.85), rgba(30,52,86,0.95));
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(96,165,250,0.15);
}
.sidebar-group--server .sidebar-group-header:hover { background: linear-gradient(135deg, rgba(46,74,114,0.9), rgba(37,61,99,1)); }
.sidebar-group--customers .sidebar-group-header { background: var(--color-customers); }
.sidebar-group--customers .sidebar-group-header:hover { background: var(--color-customers-hover); }
.sidebar-group--webserver .sidebar-group-header { background: var(--color-webserver); }
.sidebar-group--webserver .sidebar-group-header:hover { background: var(--color-webserver-hover); }
.sidebar-group--databases .sidebar-group-header { background: var(--color-databases); }
.sidebar-group--databases .sidebar-group-header:hover { background: var(--color-databases-hover); }
.sidebar-group--email .sidebar-group-header { background: var(--color-email); }
.sidebar-group--email .sidebar-group-header:hover { background: var(--color-email-hover); }
.sidebar-group--security .sidebar-group-header { background: var(--color-security); }
.sidebar-group--security .sidebar-group-header:hover { background: var(--color-security-hover); }

/* Dashboard top link */
.sidebar-link--top {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 20px;
    color: var(--text-white); font-size: 13px; font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    background: rgba(59, 130, 246, 0.08);
}
.sidebar-link--top:hover {
    background: rgba(59, 130, 246, 0.18);
    color: var(--text-white);
}
.sidebar-link--top.is-active {
    border-left-color: #60a5fa;
    background: rgba(59, 130, 246, 0.22); color: var(--text-white);
}
.sidebar-link--top i { width: 18px; text-align: center; font-size: 14px; color: #60a5fa; }

.sidebar-group.is-open > .sidebar-group-header .chevron { transform: rotate(90deg); }

.sidebar-group-content {
    max-height: 0; overflow: hidden;
    transition: max-height var(--transition-normal);
}
.sidebar-group.is-open > .sidebar-group-content { max-height: 800px; }

/* Accordion level 1 (CONFIG, SECURITY, MONITORING) */
.sidebar-accordion { overflow: hidden; }

.sidebar-accordion-header {
    display: flex; align-items: center;
    padding: 10px 20px 10px 28px;
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
    cursor: pointer; color: var(--text-light); opacity: 0.65;
    transition: all var(--transition-fast);
}
.sidebar-accordion-header:hover { opacity: 1; background: rgba(255,255,255,0.04); }
.sidebar-accordion-header .chevron { margin-left: auto; font-size: 9px; transition: transform var(--transition-fast); }
.sidebar-accordion.is-open > .sidebar-accordion-header { opacity: 0.9; }
.sidebar-accordion.is-open > .sidebar-accordion-header .chevron { transform: rotate(90deg); }

.sidebar-accordion-content {
    max-height: 0; overflow: hidden;
    transition: max-height var(--transition-normal);
}
.sidebar-accordion.is-open > .sidebar-accordion-content { max-height: 600px; }

/* Navigation links (level 2) */
.sidebar-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 20px 9px 44px;
    color: var(--text-light); font-size: 13px; font-weight: 400;
    text-decoration: none; opacity: 0.7;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}
.sidebar-link:hover {
    opacity: 1; background: rgba(255,255,255,0.06);
    color: var(--text-white);
}
.sidebar-link.is-active {
    opacity: 1; border-left-color: var(--color-info);
    background: rgba(255,255,255,0.1); font-weight: 500;
    color: var(--text-white);
}
.sidebar-link i { width: 18px; text-align: center; font-size: 13px; }

/* ── MAIN AREA ── */
.app-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── HEADER ── */
.app-header {
    height: var(--header-height);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    position: sticky; top: 0;
    z-index: var(--z-header);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 var(--content-padding);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.header-left { display: flex; align-items: center; gap: 20px; }
.header-right { display: flex; align-items: center; gap: 16px; }

.header-hostname {
    display: flex; flex-direction: column;
}
.header-hostname-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.header-hostname-value { font-size: 13px; font-weight: 600; color: var(--text-primary); }

/* Resource bars (legacy, kept for compat) */
.header-resources { display: flex; gap: 16px; }
.header-resource { display: flex; align-items: center; gap: 6px; }
.header-resource-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; width: 28px; }
.header-resource-bar { width: 60px; height: 6px; background: var(--border-color); border-radius: var(--border-radius-full); overflow: hidden; }
.header-resource-fill { height: 100%; border-radius: var(--border-radius-full); background: var(--color-success); transition: width 1s ease; }
.header-resource-fill.is-warning { background: var(--color-warning); }
.header-resource-fill.is-danger { background: var(--color-danger); }
.header-resource-value { font-size: 11px; font-weight: 500; color: var(--text-secondary); font-family: 'JetBrains Mono', monospace; min-width: 40px; }

/* Header Services Bar */
.header-services {
    display: flex; align-items: center; gap: 2px;
}
.hdr-svc {
    display: flex; align-items: center; gap: 5px;
    padding: 5px 8px;
    border-radius: var(--border-radius-sm);
    transition: background var(--transition-fast);
    position: relative;
}
.hdr-svc:hover {
    background: var(--bg-card-alt);
}
.hdr-svc-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.hdr-svc-dot--up {
    background: var(--color-success);
    box-shadow: 0 0 4px var(--color-success);
}
.hdr-svc-dot--down {
    background: var(--color-danger);
    box-shadow: 0 0 4px var(--color-danger);
    animation: svc-pulse 1.5s ease-in-out infinite;
}
@keyframes svc-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
.hdr-svc-label {
    font-size: 11px; font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.hdr-svc-restart {
    background: none; border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px; margin: 0;
    font-size: 10px;
    opacity: 0;
    transition: opacity var(--transition-fast), color var(--transition-fast);
    line-height: 1;
}
.hdr-svc:hover .hdr-svc-restart { opacity: 1; }
.hdr-svc-restart:hover { color: var(--color-warning); }

/* Header notification bell */
.header-bell {
    position: relative;
    background: none; border: none; cursor: pointer;
    padding: 8px; border-radius: var(--border-radius-sm);
    color: var(--text-secondary); font-size: 16px;
    transition: all var(--transition-fast);
}
.header-bell:hover { background: var(--bg-card-alt); color: var(--text-primary); }
.header-bell-badge {
    position: absolute; top: 2px; right: 2px;
    background: var(--color-danger); color: var(--text-white);
    font-size: 10px; font-weight: 700;
    width: 16px; height: 16px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    line-height: 1;
}
.header-bell-badge:empty { display: none; }

/* Header user */
.header-user-btn {
    display: flex; align-items: center; gap: 8px;
    background: none; border: none; cursor: pointer;
    padding: 6px 10px; border-radius: var(--border-radius-sm);
    transition: background var(--transition-fast);
}
.header-user-btn:hover { background: var(--bg-card-alt); }
.header-user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--color-primary); color: var(--text-white);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
}
.header-user-info { display: flex; flex-direction: column; text-align: left; }
.header-user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.header-user-role { font-size: 10px; color: var(--text-muted); }

/* ── CONTENT ── */
.app-content {
    flex: 1;
    padding: var(--content-padding);
    max-width: var(--content-max-width);
}

/* === BREADCRUMBS === */
.breadcrumbs {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-muted); margin-bottom: var(--space-lg);
}
.breadcrumbs a { color: var(--text-link); }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs .separator { color: var(--text-muted); font-size: 11px; }
.breadcrumbs .current { color: var(--text-primary); font-weight: 500; }

/* === CARDS === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-md);
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h2 { font-size: 16px; font-weight: 600; color: var(--text-primary); margin: 0; }
.card-body { padding: 20px; }
.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card-alt);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.card--status { border-left: 4px solid var(--color-success); }
.card--status.is-warning { border-left-color: var(--color-warning); }
.card--status.is-danger { border-left-color: var(--color-danger); }
.card--status.is-info { border-left-color: var(--color-info); }

.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }
.stat-icon { font-size: 24px; opacity: 0.3; }

/* === BUTTONS === */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    font-family: 'Inter', sans-serif;
    font-size: 13px; font-weight: 500;
    border: none; border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none; line-height: 1.4;
}
.btn-primary   { background: var(--color-info);    color: #fff; }
.btn-success   { background: var(--color-success); color: #fff; }
.btn-danger    { background: var(--color-danger);  color: #fff; }
.btn-warning   { background: var(--color-warning); color: #fff; }
.btn-secondary { background: var(--border-color);  color: var(--text-primary); }
.btn-ghost     { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-color); }

.btn:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 24px; font-size: 14px; }
.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }
.btn-block { width: 100%; justify-content: center; }

/* === TABLES === */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
    background: var(--bg-card-alt);
    padding: 12px 16px; text-align: left;
    font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}
.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary); vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(59, 130, 246, 0.03); }
.table .col-check { width: 40px; text-align: center; }
.table .col-actions { width: 120px; text-align: right; white-space: nowrap; }

/* === FORMS === */
.form-group { margin-bottom: var(--space-md); }
.form-label {
    display: block; font-size: 13px; font-weight: 500;
    color: var(--text-primary); margin-bottom: var(--space-xs);
}
.form-label .required { color: var(--color-danger); margin-left: 2px; }

.form-input, .form-select, .form-textarea {
    width: 100%; padding: 9px 12px;
    font-family: 'Inter', sans-serif; font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-input); color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.form-input.is-error { border-color: var(--border-error); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--color-danger); margin-top: 4px; }
.form-input--ip { font-family: 'JetBrains Mono', monospace; letter-spacing: 0.5px; }

/* === BADGES === */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; font-size: 11px; font-weight: 600;
    border-radius: var(--border-radius-full);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-muted   { background: #f3f4f6; color: #6b7280; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot--active { background: var(--color-success); box-shadow: 0 0 4px var(--color-success); }
.status-dot--stopped { background: var(--color-danger); }
.status-dot--warning { background: var(--color-warning); animation: pulse 2s infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* === FORMS === */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.form-group small {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}
.form-control {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-input, var(--bg-page));
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 18px;
    padding-right: 32px;
}
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* === MODALS === */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal-backdrop);
    opacity: 0; transition: opacity var(--transition-normal);
    pointer-events: none;
}
.modal-backdrop.is-open { opacity: 1; pointer-events: auto; }

.modal {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-modal);
    width: 90%; max-width: 640px; max-height: 85vh;
    overflow-y: auto; opacity: 0;
    transition: all var(--transition-normal);
    pointer-events: none;
}
.modal-backdrop.is-open .modal { opacity: 1; transform: translate(-50%, -50%) scale(1); pointer-events: auto; }

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 600; margin: 0; }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex; gap: 8px; justify-content: flex-end;
}

/* === TOASTS === */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + var(--space-sm));
    right: var(--content-padding);
    z-index: var(--z-toast);
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    font-size: 13px;
    min-width: 320px; max-width: 480px;
    animation: slideIn 0.3s ease;
}
.toast-success { background: #dcfce7; color: #166534; border-left: 4px solid var(--color-success); }
.toast-danger  { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--color-danger); }
.toast-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--color-warning); }
.toast-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid var(--color-info); }

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

/* === DROPDOWN === */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; top: 100%; right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: var(--z-dropdown);
    padding: 4px 0;
}
.dropdown-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 16px; font-size: 13px; color: var(--text-primary);
    cursor: pointer; transition: background var(--transition-fast);
    text-decoration: none;
}
.dropdown-item:hover { background: var(--bg-card-alt); color: var(--text-primary); }
.dropdown-item i { width: 16px; text-align: center; color: var(--text-muted); }
.dropdown-divider { height: 1px; background: var(--border-color); margin: 4px 0; }

/* === TAB NAVIGATION === */
.tabs {
    display: flex; gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: var(--space-lg);
}
.tab {
    padding: 10px 20px; font-size: 13px; font-weight: 500;
    color: var(--text-secondary); cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
    background: none; border-top: none; border-left: none; border-right: none;
    text-decoration: none;
}
.tab:hover { color: var(--text-primary); }
.tab.is-active { color: var(--color-info); border-bottom-color: var(--color-info); font-weight: 600; }

/* === ALERTS === */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; border-radius: var(--border-radius);
    font-size: 13px; margin-bottom: var(--space-md);
}
.alert-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid var(--color-info); }
.alert-success { background: #dcfce7; color: #166534; border-left: 4px solid var(--color-success); }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--color-warning); }
.alert-danger  { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--color-danger); }

/* === LOG VIEWER === */
.log-viewer {
    background: var(--bg-code); color: #e2e8f0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px; line-height: 1.6;
    padding: 16px; border-radius: var(--border-radius);
    max-height: 600px; overflow-y: auto;
    white-space: pre-wrap; word-break: break-all;
}
.log-line--error   { color: #f87171; }
.log-line--warning { color: #fbbf24; }
.log-line--info    { color: #60a5fa; }

/* === PROGRESS BAR === */
.progress { height: 8px; background: var(--border-color); border-radius: var(--border-radius-full); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--border-radius-full); transition: width 0.5s ease; }
.progress-fill--success { background: var(--color-success); }
.progress-fill--warning { background: var(--color-warning); }
.progress-fill--danger  { background: var(--color-danger); }
.progress-fill--info    { background: var(--color-info); }

/* === UTILITIES === */
.mt-0 { margin-top: 0; }          .mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }  .mt-3 { margin-top: var(--space-lg); }
.mb-0 { margin-bottom: 0; }       .mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space-md); }  .mb-3 { margin-bottom: var(--space-lg); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-sm); }
.gap-2 { gap: var(--space-md); }
.gap-3 { gap: var(--space-lg); }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-md); }

.text-sm { font-size: 12px; }
.text-mono { font-family: 'JetBrains Mono', monospace; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; clip: rect(0 0 0 0); }
.w-full { width: 100%; }

/* === LOGIN PAGE === */
.login-layout {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1a2744 0%, #111b30 100%);
    padding: var(--space-lg);
}
.login-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%; max-width: 420px;
    padding: 40px;
}
.login-logo {
    text-align: center; margin-bottom: var(--space-xl);
}
.login-logo .logo-text {
    font-size: 28px; font-weight: 700; color: var(--color-primary);
    letter-spacing: 4px;
}
.login-logo .logo-sub {
    font-size: 12px; color: var(--text-muted); margin-top: 4px;
}
.login-footer {
    text-align: center; margin-top: var(--space-xl);
    font-size: 12px; color: var(--text-muted);
}

/* === RESPONSIVE === */
@media (max-width: 1200px) {
    :root { --sidebar-width: 220px; --content-padding: 16px; }
}

@media (max-width: 1024px) {
    .app-sidebar { width: var(--sidebar-collapsed); }
    .app-sidebar .sidebar-link span,
    .app-sidebar .sidebar-accordion-header span,
    .app-sidebar .sidebar-group-header span,
    .app-sidebar .logo-text { display: none; }
    .app-main { margin-left: var(--sidebar-collapsed); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .header-resources { display: none; }
    .header-user-info { display: none; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* === HTMX LOADING === */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-request.htmx-indicator { display: inline-block; }

.spinner {
    width: 16px; height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--color-info);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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