:root {
    --navy: #0f1b33;
    --navy-2: #162544;
    --accent: #2f6fed;
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #1c2434;
    --muted: #667085;
    --danger: #c03737;
    --ok: #16794c;
    --shadow: 0 18px 40px rgba(15, 27, 51, 0.08);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Tahoma, sans-serif; color: var(--text); background: var(--bg); }

.auth-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f1b33 0%, #1d3a73 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-shell {
    width: min(920px, 100%);
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    background: var(--card);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.auth-brand {
    background: var(--navy);
    color: white;
    padding: 48px 40px;
}

.eyebrow { letter-spacing: .18em; font-size: 12px; opacity: .8; }
.auth-brand h1 { font-size: 34px; line-height: 1.15; margin: 12px 0 16px; }
.lede { color: #c9d6ef; }

.auth-card { padding: 40px; }
.auth-card h2 { margin: 0 0 8px; }
.muted { color: var(--muted); margin-top: 0; }
label { display: block; margin: 16px 0 8px; font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"] {
    width: 100%;
    border: 1px solid #d7deea;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 15px;
}
.remember { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.btn-primary, .btn-secondary {
    border: 0;
    border-radius: 12px;
    padding: 12px 18px;
    font-weight: 700;
    cursor: pointer;
}
.btn-primary { width: 100%; margin-top: 20px; background: var(--accent); color: white; }
.btn-secondary { background: #e8eef8; color: var(--navy); }
.forgot { display: inline-block; margin-top: 16px; color: var(--accent); text-decoration: none; }
.alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.alert.danger { background: #fdecec; color: var(--danger); }
.alert.success { background: #e8f7ef; color: var(--ok); }

.app-body {
    display: grid;
    grid-template-columns: 248px 1fr;
    min-height: 100vh;
    font-family: Inter, "Segoe UI", sans-serif;
    background: #f5f7fb;
}
.sidebar {
    background: #101b33;
    color: white;
    padding: 22px 16px 16px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 20px; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 12px;
    background: #2f6fed; display: grid; place-items: center; flex-shrink: 0;
}
.brand strong { display: block; font-size: 15px; letter-spacing: .04em; }
.brand span { color: #93a4c7; font-size: 10px; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar a, .sidebar summary {
    color: #c9d6ef;
    text-decoration: none;
    padding: 11px 14px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}
.sidebar svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar a.active { background: #2f6fed; color: white; }
.sidebar a:hover:not(.active), .sidebar summary:hover { background: #182644; color: white; }
.nav-group { color: #c9d6ef; }
.nav-group summary { list-style: none; position: relative; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: "▾"; margin-left: auto; font-size: 11px; opacity: .7; }
.nav-group a { margin-left: 18px; font-size: 13px; font-weight: 500; }
.sidebar-help {
    margin-top: auto;
    background: #182644;
    border-radius: 16px;
    padding: 14px;
    display: flex;
    gap: 12px;
    align-items: center;
    color: #c9d6ef;
    font-size: 12px;
}
.help-icon {
    width: 36px; height: 36px; border-radius: 12px;
    background: #2f6fed; color: white; display: grid; place-items: center; font-weight: 800;
}
.sidebar-help strong { display: block; color: white; }
.sidebar-help a { color: #7eb0ff; padding: 0; display: inline; }

.app-main { display: flex; flex-direction: column; min-width: 0; }
.app-header {
    background: white;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid #eef1f6;
    position: sticky;
    top: 0;
    z-index: 8;
}
.header-search {
    flex: 1;
    background: #f4f7fb;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    height: 44px;
}
.header-search svg { width: 18px; height: 18px; color: #8b97ab; }
.header-search input {
    border: 0; background: transparent; width: 100%; outline: none; font-size: 14px;
}
.header-right { display: flex; align-items: center; gap: 12px; }
.header-date, .icon-btn, .header-user summary {
    background: #f4f7fb;
    border: 0;
    border-radius: 12px;
    height: 44px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    color: #1c2434;
    font-weight: 600;
    font-size: 13px;
}
.header-date svg, .icon-btn svg { width: 16px; height: 16px; }
.header-bell { position: relative; width: 44px; justify-content: center; padding: 0; }
.bell-dot {
    position: absolute; top: 6px; right: 6px;
    background: #ef4444; color: white; font-size: 10px;
    width: 16px; height: 16px; border-radius: 50%;
    display: grid; place-items: center;
}
.header-user { position: relative; }
.header-user summary { list-style: none; cursor: pointer; }
.header-user summary::-webkit-details-marker { display: none; }
.header-user strong, .header-user small { display: block; line-height: 1.15; }
.header-user small { color: var(--muted); font-weight: 500; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: #101b33; color: white; display: grid; place-items: center;
    font-size: 11px; font-weight: 800;
}
.user-menu {
    position: absolute; right: 0; top: 50px; background: white;
    border-radius: 12px; box-shadow: var(--shadow); min-width: 160px; padding: 8px;
    z-index: 20;
}
.user-menu a, .user-menu button {
    display: block; width: 100%; text-align: left; border: 0; background: none;
    padding: 8px 10px; border-radius: 8px; color: #1c2434; text-decoration: none;
}
.user-menu a:hover, .user-menu button:hover { background: #f4f7fb; }

.workspace { padding: 24px 28px 12px; flex: 1; }
.page-heading h1 { margin: 0 0 4px; font-size: 28px; }
.page-heading p { color: var(--muted); margin: 0 0 18px; }
.card { background: var(--card); border-radius: 20px; padding: 24px; box-shadow: 0 10px 30px rgba(15, 27, 51, 0.05); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat-card span { color: var(--muted); display: block; }
.stat-card strong { font-size: 32px; }
.inner-card { background: #f7f9fc; border-radius: 16px; padding: 16px; }
.table { background: white; }
textarea, select, .form-select, .form-control {
    width: 100%;
    border: 1px solid #d7deea;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 15px;
}
.btn-primary.w-auto { width: auto; }
.timeline { padding-left: 18px; }
.timeline li { margin-bottom: 10px; }
.watermark {
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    font-size: 28px;
    font-weight: 700;
    color: rgba(15, 27, 51, 0.045);
    transform: rotate(-18deg);
}

.dash-welcome { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 22px; }
.dash-welcome h1 { margin: 0; font-size: 32px; font-weight: 800; letter-spacing: -.03em; }
.dash-welcome p { margin: 6px 0 0; color: var(--muted); }
.quote-chip {
    background: #eef4ff;
    color: #3b6eea;
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.kpi-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi-card {
    background: white; border-radius: 18px; padding: 16px 16px 14px;
    box-shadow: 0 10px 30px rgba(15, 27, 51, 0.05);
    display: flex; gap: 12px; align-items: flex-start;
}
.kpi-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.kpi-card strong { display: block; font-size: 26px; margin-top: 4px; letter-spacing: -.03em; }
.kpi-card em { font-style: normal; font-size: 11px; color: #16a34a; font-weight: 600; }
.kpi-card em.down { color: #ef4444; }
.kpi-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; font-weight: 800; }
.kpi-icon svg { width: 20px; height: 20px; }
.kpi-icon.purple { background: #eee8ff; color: #6d5efc; }
.kpi-icon.blue { background: #e8f1ff; color: #2f6fed; }
.kpi-icon.green { background: #e7f8ee; color: #16a34a; }
.kpi-icon.orange { background: #fff4e5; color: #f59e0b; }
.kpi-icon.red { background: #ffecec; color: #ef4444; font-size: 18px; }

.section-head { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 12px; }
.section-head h2 { margin: 0; font-size: 18px; font-weight: 800; }
.section-head a { color: #2f6fed; text-decoration: none; font-weight: 700; font-size: 13px; }
.company-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; }
.company-tile {
    background: white; border-radius: 18px; padding: 16px;
    box-shadow: 0 10px 30px rgba(15, 27, 51, 0.05);
    display: flex; gap: 12px; text-decoration: none; color: inherit;
}
.company-logo {
    width: 40px; height: 40px; border-radius: 12px; color: white;
    display: grid; place-items: center; font-weight: 800;
}
.company-tile strong { display: block; font-size: 14px; }
.company-tile span { color: var(--muted); font-size: 12px; }
.company-tile b { display: block; margin-top: 8px; font-size: 18px; }
.add-tile {
    border: 1.5px dashed #c9d6ef; box-shadow: none; background: #fbfcfe;
    align-items: center; justify-content: center; color: #2f6fed; font-weight: 700; flex-direction: column;
}
.add-tile .plus { font-size: 28px; line-height: 1; }

.panel {
    background: white; border-radius: 20px; padding: 16px 18px 8px;
    box-shadow: 0 10px 30px rgba(15, 27, 51, 0.05);
    margin-bottom: 16px;
}
.panel h3 { font-size: 16px; font-weight: 800; margin: 6px 4px 12px; }
.panel-tabs { display: flex; gap: 18px; align-items: center; border-bottom: 1px solid #eef1f6; padding: 4px 4px 0; }
.tab-btn {
    border: 0; background: none; padding: 10px 0 12px; font-weight: 700; color: #8b97ab; cursor: pointer;
}
.tab-btn.active { color: #2f6fed; box-shadow: inset 0 -2px 0 #2f6fed; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dash-table th { color: #8b97ab; font-weight: 700; padding: 12px 8px; border-bottom: 1px solid #eef1f6; }
.dash-table td { padding: 12px 8px; border-bottom: 1px solid #f3f5f9; }
.dash-table a { color: #1c2434; font-weight: 700; text-decoration: none; }
.co-pill { font-weight: 800; }
.summary-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; padding: 16px 8px 20px; }
.summary-grid span { display: block; color: var(--muted); font-size: 12px; }
.summary-grid b { font-size: 22px; }

.dash-bottom { display: grid; grid-template-columns: 1.2fr .9fr .8fr; gap: 14px; }
.donut-wrap { position: relative; max-width: 220px; margin: 0 auto; }
.donut-center {
    position: absolute; inset: 0; display: grid; place-items: center;
    font-weight: 800; font-size: 18px; pointer-events: none;
}
.donut-legend { list-style: none; padding: 0 8px 12px; margin: 8px 0 0; }
.donut-legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.donut-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.donut-legend b { margin-left: auto; }
.quick-grid { display: grid; gap: 10px; padding: 4px 4px 16px; }
.quick {
    display: block; text-align: center; text-decoration: none; font-weight: 800;
    border-radius: 14px; padding: 16px 12px; color: #1c2434;
}
.quick.blue { background: #e8f1ff; color: #2f6fed; }
.quick.green { background: #e7f8ee; color: #16794c; }
.quick.purple { background: #eee8ff; color: #6d5efc; }
.quick.orange { background: #fff4e5; color: #c05621; }
.final-formula {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.final-box {
    background: white;
    border-radius: 16px;
    padding: 16px 20px;
    min-width: 160px;
    box-shadow: 0 10px 30px rgba(15, 27, 51, 0.05);
}
.final-box span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.final-box strong { font-size: 22px; }
.final-box.result { background: #101b33; color: white; }
.final-box.result span { color: #9db0d6; }
.final-op { font-size: 22px; font-weight: 800; color: #8b97ab; }
.dr-sheet-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; gap: 12px;
}
.dr-sheet-head strong { letter-spacing: .04em; }
.dr-sheet-foot {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
    padding-top: 16px; border-top: 1px solid #edf1f6; margin-top: 12px;
}
.dr-sheet-foot p { margin: 0 0 6px; }
.app-footer {
    display: flex; justify-content: space-between; color: #8b97ab;
    font-size: 12px; padding: 8px 28px 18px;
}

@media (max-width: 1200px) {
    .kpi-row, .company-summary, .dash-bottom { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 840px) {
    .app-body { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .sidebar.open { display: flex; position: absolute; z-index: 20; min-height: 100vh; }
    .kpi-row, .company-summary, .dash-bottom, .summary-grid { grid-template-columns: 1fr; }
    .quote-chip { display: none; }
    .header-date { display: none; }
}
