:root {
    --bg: #f6f3eb;
    --shell: #fcfbf7;
    --panel: #ffffff;
    --panel-soft: #f8f6ef;
    --line: #e8e1d4;
    --line-strong: #ddd3c0;
    --ink: #191c21;
    --muted: #787468;
    --navy: #253d74;
    --navy-soft: #eaf0fb;
    --blue: #3f5198;
    --green: #2fa45e;
    --orange: #dd9a31;
    --red: #de5b45;
    --shadow: 0 22px 60px rgba(28, 39, 66, 0.08);
    --radius-xl: 30px;
    --radius-lg: 24px;
    --radius-md: 18px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: Inter, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top left, rgba(63, 81, 152, 0.08), transparent 22%),
        linear-gradient(180deg, #faf8f2 0%, var(--bg) 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

.app-body {
    min-height: 100vh;
}

.app-shell {
    width: min(1480px, calc(100vw - 28px));
    margin: 14px auto;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 18px;
}

.sidebar,
.workspace {
    background: rgba(252, 251, 247, 0.92);
    border: 1px solid rgba(232, 225, 212, 0.9);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.sidebar {
    border-radius: var(--radius-xl);
    padding: 22px 18px;
    position: sticky;
    top: 14px;
    height: calc(100vh - 28px);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.brand-block {
    padding: 6px 6px 18px;
    border-bottom: 1px solid var(--line);
}

.brand-mark {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--navy);
}

.brand-caption {
    margin-top: 4px;
    color: var(--muted);
    font-size: 14px;
}

.side-nav {
    display: grid;
    gap: 10px;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    color: #53595f;
    font-weight: 600;
}

.side-link.active {
    background: var(--navy);
    color: #fff;
    box-shadow: 0 12px 30px rgba(37, 61, 116, 0.24);
}

.side-link-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #d8deea;
}

.side-link.active .side-link-dot {
    background: #fff;
}

.side-link-dot--soft {
    background: #95b4fb;
}

.side-link-dot--warm {
    background: #f0b057;
}

.sidebar-card {
    padding: 18px;
    border-radius: 22px;
    background: var(--panel);
    border: 1px solid var(--line);
}

.sidebar-card--accent {
    background: linear-gradient(180deg, #273d77 0%, #31498c 100%);
    color: #fff;
    border-color: transparent;
}

.sidebar-card-label {
    font-size: 13px;
    color: inherit;
    opacity: 0.72;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-card-name,
.sidebar-card-strong {
    margin-top: 10px;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.1;
}

.sidebar-card-meta {
    margin-top: 8px;
    color: inherit;
    opacity: 0.74;
    font-size: 14px;
}

.workspace {
    border-radius: 34px;
    overflow: hidden;
}

.workspace-topbar {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    padding: 30px 34px 24px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.75) 0%, rgba(255, 255, 255, 0.35) 100%);
}

.workspace-eyebrow,
.section-kicker,
.hero-kicker {
    color: var(--navy);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.workspace-topbar h1,
.hero-panel h2,
.section-header h2,
.login-card h1 {
    margin: 0;
    font-size: 38px;
    line-height: 1.02;
    letter-spacing: -0.04em;
}

.workspace-topbar p,
.section-header p,
.hero-panel p,
.subtitle,
.panel-muted {
    margin: 8px 0 0;
    color: var(--muted);
}

.workspace-actions {
    display: flex;
    gap: 14px;
    align-items: center;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 20px;
    background: var(--panel);
    border: 1px solid var(--line);
    min-width: 260px;
}

.user-badge-avatar {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: var(--navy-soft);
    color: var(--navy);
    font-weight: 800;
}

.user-badge strong {
    display: block;
    font-size: 15px;
}

.user-badge div:last-child div {
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
}

.workspace-content {
    padding: 26px 30px 32px;
}

.hero-panel {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    padding: 28px 30px;
    border-radius: 30px;
    background: linear-gradient(135deg, #24457b 0%, #3757a2 100%);
    color: #fff;
    box-shadow: 0 22px 60px rgba(37, 61, 116, 0.2);
}

.hero-panel .hero-kicker,
.hero-panel p {
    color: rgba(255, 255, 255, 0.78);
}

.hero-panel p {
    max-width: 680px;
}

.hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.hero-pill {
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    font-weight: 700;
    white-space: nowrap;
}

.hero-pill--accent {
    background: #fff;
    color: var(--navy);
    border-color: transparent;
}

.section-block {
    margin-top: 22px;
    padding: 24px;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(232, 225, 212, 0.9);
}

.section-header,
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 18px;
    margin-bottom: 18px;
}

.section-header h2,
.panel-card h3 {
    margin: 6px 0 0;
    font-size: 28px;
    letter-spacing: -0.03em;
}

.metric-grid,
.content-grid--thirds,
.mini-grid {
    display: grid;
    gap: 14px;
}

.metric-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.content-grid {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

.content-grid--wide {
    grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr);
}

.content-grid--thirds {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card,
.panel-card,
.calendar-shell,
.clients-shell,
.login-card {
    background: var(--panel);
    border: 1px solid rgba(232, 225, 212, 0.9);
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(28, 39, 66, 0.05);
}

.metric-card {
    padding: 18px 18px 16px;
}

.metric-label {
    color: var(--muted);
    font-size: 14px;
    min-height: 38px;
}

.metric-value {
    margin-top: 8px;
    font-size: 44px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -0.05em;
}

.metric-trend {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
    color: var(--muted);
    font-size: 14px;
}

.trend-positive,
.diff.positive {
    color: var(--green);
    font-weight: 700;
}

.trend-warning,
.diff.warning {
    color: var(--orange);
    font-weight: 700;
}

.trend-negative,
.diff.negative {
    color: var(--red);
    font-weight: 700;
}

.panel-card {
    padding: 22px;
}

.legend,
.toolbar,
.tabs {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.legend {
    color: var(--muted);
    font-size: 14px;
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    margin-right: 6px;
}

.line-chart {
    margin-top: 24px;
    height: 260px;
    border-radius: 22px;
    position: relative;
    background: linear-gradient(180deg, rgba(61, 77, 152, 0.06) 0%, rgba(61, 77, 152, 0) 100%),
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent 48px,
            rgba(231, 225, 213, 0.72) 48px,
            rgba(231, 225, 213, 0.72) 49px
        );
}

.line-chart svg {
    width: 100%;
    height: 100%;
}

.month-strip,
.axis-labels {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
}

.donut-layout {
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 18px;
    align-items: center;
    margin-top: 12px;
}

.donut-ring {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: conic-gradient(var(--green) 0 78%, var(--orange) 78% 95%, var(--red) 95% 100%);
    display: grid;
    place-items: center;
}

.donut-hole {
    width: 98px;
    height: 98px;
    border-radius: 50%;
    background: #fff;
    display: grid;
    place-items: center;
    text-align: center;
}

.donut-total {
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -0.05em;
}

.stats-list p {
    margin: 0 0 12px;
}

.stack-bars,
.bar-chart {
    display: flex;
    align-items: end;
    gap: 12px;
    min-height: 180px;
    margin-top: 20px;
}

.stack-item,
.bar-item {
    flex: 1;
}

.stack-column,
.bar-column {
    border-radius: 14px 14px 0 0;
}

.stack-column {
    background: linear-gradient(180deg, var(--red) 0 12%, var(--orange) 12% 30%, var(--green) 30% 100%);
}

.bar-column {
    background: color-mix(in srgb, var(--navy) 28%, #fff);
}

.bar-column.current {
    background: var(--navy);
}

.risk-row + .risk-row {
    margin-top: 16px;
}

.risk-title {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    font-weight: 600;
}

.progress {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #efebe2;
    overflow: hidden;
}

.progress > span {
    display: block;
    height: 100%;
}

.mini-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 18px;
}

.mini-card {
    padding: 18px;
    border-radius: 18px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
}

.mini-value {
    font-size: 36px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.nav-pill,
.tab-pill,
.ghost-button,
.primary-button,
.secondary-button {
    border-radius: 16px;
    font: inherit;
    font-weight: 700;
}

.nav-pill,
.tab-pill,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: 1px solid var(--line);
    background: #fff;
    color: #5d6167;
}

.nav-pill.active,
.tab-pill.active {
    color: var(--ink);
    box-shadow: 0 10px 24px rgba(28, 39, 66, 0.08);
}

.ghost-button--dark {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

.calendar-shell,
.clients-shell {
    overflow: hidden;
}

.calendar-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
    background: #fcfaf4;
}

.toolbar-left {
    display: flex;
    gap: 10px;
    align-items: center;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-head,
.calendar-day {
    min-height: 116px;
    padding: 12px;
    border-right: 1px solid #efe8dd;
    border-bottom: 1px solid #efe8dd;
}

.calendar-head {
    min-height: auto;
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 800;
    background: #fcfaf4;
}

.calendar-day {
    background: #fff;
}

.calendar-day--focus {
    background: rgba(63, 81, 152, 0.06);
}

.day-number {
    margin-bottom: 8px;
    font-weight: 700;
}

.day-number--focus {
    display: inline-grid;
    place-items: center;
    min-width: 28px;
    height: 28px;
    border-radius: 999px;
    background: var(--navy);
    color: #fff;
}

.day-chip {
    display: inline-block;
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.chip-blue {
    background: #e7efff;
    color: #3460c8;
}

.chip-green {
    background: #e6f7ed;
    color: #258954;
}

.chip-purple {
    background: #efe8ff;
    color: #7153c4;
}

.chip-orange {
    background: #fff2df;
    color: #b36b12;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 20px;
    border-bottom: 1px solid var(--line);
}

.search-box {
    flex: 1 1 280px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
}

.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 18px 16px;
    text-align: left;
    white-space: nowrap;
    border-top: 1px solid #f1ebe0;
}

th {
    background: #fcfaf4;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.client-name {
    font-weight: 700;
}

.client-id {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

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

.login-card form {
    display: grid;
    gap: 14px;
    margin-top: 24px;
}

.field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 700;
}

.field input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    font: inherit;
}

.primary-button,
.secondary-button {
    width: 100%;
    padding: 14px 18px;
    cursor: pointer;
}

.primary-button {
    border: none;
    background: var(--navy);
    color: #fff;
}

.secondary-button {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
}

.error-box,
.info-box {
    margin-top: 16px;
    border-radius: 16px;
    padding: 12px 14px;
}

.error-box {
    border: 1px solid rgba(222, 91, 69, 0.24);
    background: rgba(222, 91, 69, 0.08);
    color: #99392c;
}

.info-box {
    border: 1px solid rgba(37, 61, 116, 0.18);
    background: rgba(37, 61, 116, 0.08);
    color: var(--navy);
}

.otp-input {
    letter-spacing: 0.25em;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
}

.inline-form,
.logout-form {
    margin: 0;
}

@media (max-width: 1240px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        top: 0;
        height: auto;
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .content-grid--wide,
    .content-grid--thirds {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .app-shell {
        width: min(100vw, calc(100vw - 12px));
        margin: 6px auto;
    }

    .workspace-topbar,
    .workspace-content,
    .section-block {
        padding-left: 18px;
        padding-right: 18px;
    }

    .workspace-topbar,
    .hero-panel,
    .section-header,
    .workspace-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .metric-grid,
    .mini-grid {
        grid-template-columns: 1fr;
    }

    .donut-layout {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .calendar-head,
    .calendar-day {
        min-height: 92px;
        padding: 10px;
    }

    th,
    td {
        padding: 14px 12px;
    }
}
