/* ISL Portal - Customer Frontend */

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

:root {
    --isl-brand: #0a2540;
    --isl-brand-light: #0a254022;
    --isl-bg: #f4f7fb;
    --isl-surface: #ffffff;
    --isl-border: #dde3ec;
    --isl-text: #1a2332;
    --isl-muted: #6b7a8f;
    --isl-success: #1a7a4a;
    --isl-error: #c0392b;
    --isl-radius: 10px;
    --isl-shadow: 0 2px 12px rgba(10,37,64,0.08);
}

body.isl-portal-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--isl-bg);
    color: var(--isl-text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
}

/* Loading splash */
.isl-portal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 24px;
}

#isl-splash-logo {
    height: 48px;
    width: auto;
}

.isl-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--isl-brand-light);
    border-top-color: var(--isl-brand);
    border-radius: 50%;
    animation: isl-spin 0.8s linear infinite;
}

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

/* Portal shell */
#isl-portal-root { min-height: 100vh; }

.isl-portal-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-rows: 60px 1fr;
    min-height: 100vh;
}

/* Top bar */
.isl-topbar {
    grid-column: 1 / -1;
    background: var(--isl-brand);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    box-shadow: 0 1px 0 rgba(255,255,255,0.08);
}

.isl-topbar-logo {
    height: 32px;
    width: auto;
}

.isl-topbar-name {
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    flex: 1;
}

.isl-topbar-user {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    gap: 12px;
}

.isl-topbar-user button {
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    transition: background 0.15s;
}

.isl-topbar-user button:hover { background: rgba(255,255,255,0.2); }

/* Sidebar */
.isl-sidebar {
    background: var(--isl-surface);
    border-right: 1px solid var(--isl-border);
    padding: 20px 0;
}

.isl-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--isl-muted);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    user-select: none;
}

.isl-nav-item:hover { color: var(--isl-text); background: var(--isl-bg); }
.isl-nav-item.active { color: var(--isl-brand); border-left-color: var(--isl-brand); background: var(--isl-brand-light); font-weight: 600; }

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

/* Main content */
.isl-main {
    padding: 28px;
    overflow-y: auto;
}

.isl-page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--isl-brand);
    margin-bottom: 24px;
}

/* Cards */
.isl-card {
    background: var(--isl-surface);
    border: 1px solid var(--isl-border);
    border-radius: var(--isl-radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--isl-shadow);
}

.isl-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--isl-brand);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--isl-border);
}

/* Stat grid */
.isl-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.isl-stat-card {
    background: var(--isl-brand);
    color: #fff;
    border-radius: var(--isl-radius);
    padding: 20px;
}

.isl-stat-number { font-size: 28px; font-weight: 700; line-height: 1; display: block; }
.isl-stat-label  { font-size: 11px; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-top: 6px; }

/* Tables */
.isl-table-wrap { overflow-x: auto; }

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

.isl-table th {
    text-align: left;
    padding: 9px 14px;
    background: var(--isl-bg);
    color: var(--isl-muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--isl-border);
}

.isl-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--isl-border);
    color: var(--isl-text);
    vertical-align: middle;
}

.isl-table tr:last-child td { border-bottom: none; }
.isl-table tbody tr:hover td { background: var(--isl-bg); }

/* Badges */
.isl-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.isl-badge-in      { background: #e8f5ee; color: #1a7a4a; }
.isl-badge-out     { background: #f0f0f0; color: #555; }
.isl-badge-active  { background: #e8f5ee; color: #1a7a4a; }
.isl-badge-inactive{ background: #f0f0f0; color: #888; }
.isl-badge-pending { background: #fdf0d5; color: #856404; }
.isl-badge-frozen  { background: #e3f0fb; color: #1565c0; }

/* Login screen */
.isl-login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--isl-brand);
}

.isl-login-box {
    background: var(--isl-surface);
    border-radius: 14px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.isl-login-logo {
    display: block;
    height: 44px;
    margin: 0 auto 28px;
}

.isl-login-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--isl-brand);
    text-align: center;
    margin-bottom: 24px;
}

.isl-form-group {
    margin-bottom: 16px;
}

.isl-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--isl-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.isl-input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--isl-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--isl-text);
    background: #fff;
    transition: border-color 0.15s;
    outline: none;
}

.isl-input:focus { border-color: var(--isl-brand); }

.isl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    text-decoration: none;
}

.isl-btn-primary {
    background: var(--isl-brand);
    color: #fff;
    width: 100%;
}

.isl-btn-primary:hover { filter: brightness(1.15); }
.isl-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

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

.isl-btn-outline {
    background: transparent;
    border: 1.5px solid var(--isl-border);
    color: var(--isl-text);
}

.isl-error-msg {
    background: #fdf0ee;
    color: var(--isl-error);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.isl-error-msg.visible { display: block; }

/* Filters bar */
.isl-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.isl-select {
    padding: 8px 12px;
    border: 1.5px solid var(--isl-border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: var(--isl-text);
    background: #fff;
    outline: none;
    cursor: pointer;
}

.isl-select:focus { border-color: var(--isl-brand); }

/* Responsive */
/* ── Mobile hamburger button ─────────────────────────────────────────────── */
.isl-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--isl-navy);
    font-size: 22px;
    line-height: 1;
}

@media (max-width: 768px) {
    .isl-portal-shell {
        grid-template-columns: 1fr;
        grid-template-rows: 60px 1fr;
    }

    .isl-hamburger { display: flex; align-items: center; }

    .isl-sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 80%;
        max-width: 280px;
        height: 100vh;
        z-index: 999;
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
        overflow-y: auto;
    }

    .isl-sidebar.mobile-open { display: flex; }

    .isl-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 998;
    }

    .isl-sidebar-overlay.mobile-open { display: block; }

    .isl-main { padding: 16px; }
}

/* Empty state */
.isl-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--isl-muted);
}

.isl-empty p { margin-top: 8px; font-size: 13px; }

/* Sub-user management */
.isl-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10,37,64,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.isl-modal {
    background: var(--isl-surface);
    border-radius: 14px;
    padding: 32px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.isl-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--isl-brand);
    margin-bottom: 20px;
}

/* Alerts */
.isl-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
}
.isl-alert-warning { background: #fef9e7; color: #7d6608; border-left: 3px solid #d4ac0d; }
.isl-alert-error   { background: #fdf0ee; color: #c0392b; border-left: 3px solid #c0392b; }
.isl-alert-success { background: #e8f5ee; color: #1a7a4a; border-left: 3px solid #1a7a4a; }

/* FAQ */
.isl-faq-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--isl-border);
}
.isl-faq-item:last-child { border-bottom: none; }
.isl-faq-q {
    font-size: 14px;
    font-weight: 600;
    color: var(--isl-brand);
    margin-bottom: 6px;
}
.isl-faq-a {
    font-size: 13px;
    color: var(--isl-muted);
    line-height: 1.6;
}

/* Nav icon */
.isl-nav-icon {
    width: 18px;
    display: inline-block;
    text-align: center;
    font-style: normal;
}

/* Badge inactive */
.isl-badge-inactive { background: #f0f0f0; color: #888; }
