:root {
    --navy: #0f172a;
    --navy-2: #16213b;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --surface: #ffffff;
    --background: #f4f7fb;
    --border: #e5eaf1;
    --muted: #64748b;
    --text: #172033;
    --success: #16a34a;
    --danger: #dc2626;
    --shadow: 0 16px 45px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--background);
}

button, input { font: inherit; }
a { color: inherit; text-decoration: none; }

.guest-body { background: #fff; }

.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(420px, 47%) 1fr;
}

.login-panel {
    display: grid;
    place-items: center;
    padding: 48px;
    background: #fff;
}

.login-card { width: min(440px, 100%); }

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 62px;
}

.login-logo,
.brand-mark {
    display: grid;
    place-items: center;
    color: white;
    font-weight: 800;
    letter-spacing: -.5px;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    box-shadow: 0 12px 30px rgba(37, 99, 235, .28);
}

.login-logo {
    width: 52px;
    height: 52px;
    border-radius: 16px;
}

.login-brand span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
}

.login-brand h1 {
    margin: 4px 0 0;
    font-size: 18px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .14em;
}

.login-heading h2 {
    margin: 0;
    font-size: clamp(28px, 3vw, 38px);
    line-height: 1.15;
    letter-spacing: -.035em;
}

.login-heading > p:last-child {
    margin: 16px 0 30px;
    color: var(--muted);
    line-height: 1.7;
}

.login-form { display: grid; gap: 20px; }

.login-form label > span {
    display: block;
    margin-bottom: 9px;
    font-size: 13px;
    font-weight: 700;
}

.login-form input[type="text"],
.login-form input[type="password"],
.login-form input[type="search"] {
    width: 100%;
    height: 52px;
    padding: 0 15px;
    border: 1px solid #d9e0ea;
    border-radius: 12px;
    outline: none;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}

.login-form input:focus {
    border-color: #7da3f7;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .1);
}

.password-field { position: relative; }

.password-field input { padding-right: 84px !important; }

.password-field button {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
}

.form-options a { color: var(--primary); font-weight: 700; }

.remember {
    display: flex !important;
    align-items: center;
    gap: 8px;
}

.remember span { margin: 0 !important; font-weight: 500 !important; }

.primary-button {
    min-height: 52px;
    border: 0;
    border-radius: 12px;
    color: white;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 13px 25px rgba(37, 99, 235, .24);
    transition: transform .2s, box-shadow .2s;
}

.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(37, 99, 235, .31);
}

.login-footer-copy {
    margin-top: 28px;
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
}

.alert {
    margin-bottom: 22px;
    padding: 13px 15px;
    border-radius: 11px;
    font-size: 13px;
    line-height: 1.5;
}

.alert-error {
    color: #991b1b;
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.alert-success {
    color: #166534;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.login-visual {
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 70px;
    color: white;
    background:
        radial-gradient(circle at 80% 20%, rgba(59, 130, 246, .43), transparent 29%),
        radial-gradient(circle at 18% 82%, rgba(79, 70, 229, .32), transparent 27%),
        linear-gradient(145deg, #0b1224, #111c36 60%, #172554);
}

.visual-grid {
    position: absolute;
    inset: 0;
    opacity: .11;
    background-image:
        linear-gradient(rgba(255,255,255,.22) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.22) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
}

.visual-content {
    position: relative;
    max-width: 620px;
}

.visual-badge {
    display: inline-flex;
    padding: 9px 13px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 999px;
    color: #cbd5e1;
    background: rgba(255,255,255,.07);
    backdrop-filter: blur(10px);
    font-size: 12px;
    font-weight: 700;
}

.visual-content h2 {
    margin: 25px 0 18px;
    font-size: clamp(38px, 5vw, 64px);
    line-height: 1.06;
    letter-spacing: -.05em;
}

.visual-content > p {
    max-width: 550px;
    color: #b9c5d8;
    font-size: 16px;
    line-height: 1.8;
}

.visual-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 52px;
}

.visual-stats div {
    padding: 20px;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 16px;
    background: rgba(255,255,255,.06);
    backdrop-filter: blur(10px);
}

.visual-stats strong {
    display: block;
    font-size: 25px;
}

.visual-stats span {
    display: block;
    margin-top: 6px;
    color: #aebbd0;
    font-size: 12px;
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: 270px;
    overflow-y: auto;
    color: #cbd5e1;
    background: linear-gradient(180deg, #111a2f, #0d1528);
    transition: transform .25s ease;
}

.brand {
    min-height: 82px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    flex: 0 0 auto;
}

.brand-copy strong {
    display: block;
    color: #fff;
    font-size: 14px;
}

.brand-copy span {
    display: block;
    margin-top: 4px;
    color: #8190aa;
    font-size: 10px;
}

.nav-menu { padding: 22px 14px; }

.nav-label {
    display: block;
    margin: 20px 12px 9px;
    color: #60708e;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .13em;
}

.nav-label:first-child { margin-top: 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 46px;
    margin: 4px 0;
    padding: 0 13px;
    border-radius: 10px;
    color: #9facbf;
    font-size: 13px;
    font-weight: 600;
    transition: background .2s, color .2s;
}

.nav-item:hover,
.nav-item.active {
    color: #fff;
    background: rgba(59, 130, 246, .13);
}

.nav-item.active {
    box-shadow: inset 3px 0 0 #4f8df7;
}

.nav-icon {
    width: 22px;
    color: #6ea1ff;
    text-align: center;
    font-size: 18px;
}

.app-main {
    width: calc(100% - 270px);
    min-height: 100vh;
    margin-left: 270px;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 82px;
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(12px);
}

.menu-toggle {
    display: none;
    border: 0;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
}

.topbar-search {
    width: min(420px, 42vw);
    height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #f8fafc;
}

.topbar-search input {
    width: 100%;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
}

.icon-button {
    position: relative;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fff;
    cursor: pointer;
}

.notification-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 7px;
    height: 7px;
    border: 2px solid white;
    border-radius: 50%;
    background: #ef4444;
}

.user-summary {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    font-weight: 800;
}

.user-copy strong {
    display: block;
    font-size: 12px;
}

.user-copy span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.logout-button {
    height: 38px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: #475569;
    background: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.content {
    flex: 1;
    padding: 28px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 25px;
}

.page-heading h1 {
    margin: 0;
    font-size: 25px;
    letter-spacing: -.025em;
}

.breadcrumb {
    color: var(--muted);
    font-size: 12px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 130px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 7px 22px rgba(15, 23, 42, .04);
}

.stat-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 15px;
    font-size: 21px;
    font-weight: 800;
}

.stat-icon.blue { color: #2563eb; background: #eff6ff; }
.stat-icon.green { color: #16a34a; background: #f0fdf4; }
.stat-icon.violet { color: #7c3aed; background: #f5f3ff; }
.stat-icon.amber { color: #d97706; background: #fffbeb; }

.stat-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.stat-card strong {
    display: block;
    margin: 5px 0;
    font-size: 28px;
    letter-spacing: -.04em;
}

.stat-card small {
    color: #94a3b8;
    font-size: 10px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 18px;
    margin-top: 18px;
}

.panel-card {
    min-height: 360px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 7px 22px rgba(15, 23, 42, .04);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 18px;
    border-bottom: 1px solid #edf1f5;
}

.panel-header span {
    color: var(--muted);
    font-size: 11px;
}

.panel-header h3 {
    margin: 5px 0 0;
    font-size: 16px;
}

.panel-header button {
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--muted);
    font-size: 11px;
}

.empty-chart {
    height: 270px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 18px;
    color: var(--muted);
    text-align: center;
}

.donut {
    width: 145px;
    height: 145px;
    border: 25px solid #e9eef7;
    border-top-color: #2563eb;
    border-right-color: #4f46e5;
    border-radius: 50%;
}

.activity-list { padding-top: 8px; }

.activity-item {
    display: grid;
    grid-template-columns: 12px 1fr auto;
    gap: 12px;
    padding: 18px 0;
    border-bottom: 1px solid #edf1f5;
}

.activity-dot {
    width: 9px;
    height: 9px;
    margin-top: 5px;
    border-radius: 50%;
    background: #3b82f6;
    box-shadow: 0 0 0 5px #eff6ff;
}

.activity-item strong {
    display: block;
    font-size: 12px;
}

.activity-item span {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.activity-item small {
    color: #94a3b8;
    font-size: 10px;
}

.footer {
    padding: 20px 28px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    background: #fff;
    font-size: 11px;
}

.error-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 30px;
    text-align: center;
    background: #f8fafc;
}

.error-page span {
    color: #dbe4f1;
    font-size: 120px;
    font-weight: 800;
}

.error-page h1 { margin: 0 0 12px; }
.error-page p { color: var(--muted); }

.inline-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 18px;
    padding: 0 22px;
}

@media (max-width: 1180px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
    .login-page { grid-template-columns: 1fr; }
    .login-visual { display: none; }
    .login-panel { padding: 30px 20px; }
    .login-brand { margin-bottom: 42px; }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: 20px 0 40px rgba(15, 23, 42, .18);
    }

    .sidebar.open { transform: translateX(0); }

    .app-main {
        width: 100%;
        margin-left: 0;
    }

    .menu-toggle { display: block; }

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

@media (max-width: 720px) {
    .topbar { padding: 0 16px; }
    .topbar-search { display: none; }
    .user-copy { display: none; }
    .content { padding: 20px 16px; }
    .page-heading { align-items: flex-start; }
    .breadcrumb { display: none; }
    .stat-grid { grid-template-columns: 1fr; }
    .visual-stats { grid-template-columns: 1fr; }
}
