:root {
    --sidebar-width: 248px;
    --ink: #20242c;
    --muted: #697386;
    --surface: #ffffff;
    --page: #f7f8fb;
    --line: #dde3ee;
    --sidebar: #ffffff;
    --sidebar-soft: #f0f4f9;
    --accent: #7c2d3a;
    --accent-dark: #5d1f2b;
    --teal: #0f766e;
    --blue: #2563eb;
    --amber: #b7791f;
    --danger: #b42318;
}

body {
    background: var(--page);
    color: var(--ink);
    margin: 0;
    font-family: Inter, 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
}

img,
svg,
canvas {
    max-width: 100%;
}

.login-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(124, 45, 58, 0.14), transparent 34%),
        radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.13), transparent 32%),
        #f7f8fb;
}

.login-shell {
    width: min(1120px, calc(100% - 32px));
    min-height: 100vh;
    margin-inline: auto;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    align-items: center;
    gap: 28px;
    padding: 32px 0;
}

.login-panel {
    border-radius: 8px;
}

.login-info-panel {
    min-height: 580px;
    padding: 34px;
    background: #211923;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 24px 80px rgba(32, 36, 44, 0.18);
}

.login-brand {
    padding: 0;
    margin: 0;
}

.login-copy h1 {
    max-width: 620px;
    margin: 0 0 14px;
    font-size: clamp(30px, 4vw, 52px);
    line-height: 1.05;
    letter-spacing: 0;
}

.login-copy p {
    max-width: 560px;
    color: rgba(255,255,255,0.72);
    font-size: 16px;
    line-height: 1.7;
    margin: 0;
}

.login-info-panel .page-kicker,
.login-info-panel .brand-block span {
    color: #f4c2cc;
}

.login-preview {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 8px;
    padding: 12px;
    backdrop-filter: blur(10px);
}

.login-preview-header,
.login-preview-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.login-preview-header {
    padding: 6px 6px 12px;
    color: rgba(255,255,255,0.72);
}

.login-preview-header strong {
    color: #fff;
}

.login-preview-row {
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
}

.login-preview-row > div {
    flex: 1;
}

.login-preview-row strong,
.login-preview-row small,
.login-preview-row em {
    display: block;
}

.login-preview-row small {
    color: rgba(255,255,255,0.65);
    font-size: 13px;
}

.login-preview-row em {
    color: #fff2d7;
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
}

.login-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    flex: 0 0 auto;
}

.login-dot.danger { background: #f97066; }
.login-dot.teal { background: #5fe9d0; }
.login-dot.amber { background: #f6c768; }

.login-form-panel {
    display: flex;
    justify-content: center;
}

.login-card {
    width: min(100%, 430px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 24px 70px rgba(31, 41, 51, 0.12);
}

.login-card-mark {
    margin: 0 auto 14px;
}

.navbar {
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-weight: 600;
    letter-spacing: 0.5px;
}

.nav-link {
    font-weight: 500;
    color: #ddd !important;
}

.nav-link:hover {
    color: #fff !important;
}

.nav-link.active {
    color: #fff !important;
    border-bottom: 2px solid #fff;
}

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    inset: 0 auto 0 0;
    background: var(--sidebar);
    color: var(--ink);
    padding: 18px 14px;
    border-right: 1px solid var(--line);
    overflow-y: auto;
    z-index: 1030;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 20px;
    margin-bottom: 8px;
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: #fff2d7;
    color: #7c4a03;
    font-weight: 800;
    letter-spacing: 0;
}

.brand-block h5 {
    margin: 0;
    font-size: 18px;
    line-height: 1.1;
    font-weight: 800;
}

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

.sidebar a {
    display: flex;
    align-items: center;
    color: #4b5565;
    padding: 11px 12px;
    text-decoration: none;
    border-radius: 7px;
    margin: 4px 0;
    font-weight: 600;
    letter-spacing: 0;
    transition: background .15s ease, color .15s ease;
    min-height: 42px;
}

.sidebar a:hover,
.sidebar a.active {
    background: var(--sidebar-soft);
    color: var(--accent);
}

.sidebar a.active {
    box-shadow: inset 3px 0 0 var(--accent);
}

.content {
    margin-left: var(--sidebar-width);
    padding: 24px;
    min-height: calc(100vh - 104px);
}

.topbar {
    background: rgba(255,255,255,0.92);
    padding: 14px 24px;
    border-bottom: 1px solid var(--line);
    margin-left: var(--sidebar-width);
    min-height: 64px;
    position: sticky;
    top: 0;
    z-index: 1020;
    backdrop-filter: blur(10px);
    gap: 12px;
}

.topbar-title {
    font-size: 13px;
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.topbar-user {
    color: var(--ink);
    margin-top: 2px;
}

.topbar-user span {
    color: var(--muted);
}

.card {
    border-radius: 8px;
    border: 1px solid var(--line) !important;
    box-shadow: 0 8px 24px rgba(31, 41, 51, 0.06) !important;
}

.btn {
    border-radius: 6px;
    padding: 6px 14px;
    font-weight: 700;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
}

.btn-success {
    background: var(--teal);
    border-color: var(--teal);
}

.btn-warning {
    background: #f6c768;
    border-color: #f6c768;
    color: #31250a;
}

.form-control {
    border-color: #cfd7cc;
    border-radius: 6px;
}

.form-select {
    border-color: #cfd7cc;
    border-radius: 6px;
}

.form-label {
    color: #465249;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 6px;
}

table {
    background: var(--surface);
}

.table > :not(caption) > * > * {
    padding: 12px 14px;
    white-space: nowrap;
}

.table-light th {
    background: #f1f5fb;
    color: #3f4858;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.page-kicker {
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.workspace-header {
    background: #fff;
    border: 1px solid var(--line);
    border-left: 5px solid var(--accent);
    border-radius: 8px;
    padding: 18px 20px;
}

.workspace-header h3 {
    font-size: 24px;
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 12px;
}

.metric-tile {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    min-height: 112px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.metric-tile .metric-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    margin-bottom: 12px;
}

.metric-tile small {
    color: var(--muted);
    font-weight: 800;
}

.metric-tile h2,
.metric-tile h3 {
    margin: 0;
    color: var(--ink);
    font-weight: 800;
}

.metric-clients .metric-icon { background: #e0f2fe; color: #0369a1; }
.metric-total .metric-icon { background: #ede9fe; color: #6d28d9; }
.metric-pending .metric-icon { background: #fff7ed; color: #c2410c; }
.metric-upcoming .metric-icon { background: #ecfeff; color: #0e7490; }
.metric-overdue .metric-icon { background: #fee2e2; color: var(--danger); }

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 16px;
}

.work-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.work-panel-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.work-panel-title {
    font-weight: 800;
}

.due-list {
    padding: 8px 0;
}

.due-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eef2f7;
}

.due-item:last-child {
    border-bottom: 0;
}

.due-client {
    font-weight: 800;
}

.due-meta {
    color: var(--muted);
    font-size: 13px;
}

.chart-panel {
    padding: 16px;
    min-height: 100%;
}

.chart-canvas-wrap {
    height: 300px;
    max-width: 420px;
    margin: 0 auto;
}

.chart-canvas-wrap canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.report-workbench {
    background: #fff;
    border: 1px solid var(--line);
    border-top: 4px solid var(--teal);
    border-radius: 8px;
    padding: 16px;
}

.report-filter-bar {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.report-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.report-kpi {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #fff;
}

.report-kpi h3 {
    margin: 4px 0 0;
    font-weight: 800;
}

.report-table-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.report-table-panel .table {
    font-size: 13px;
}

.datatable-surface {
    overflow: hidden;
}

.datatable-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.datatable-server-paged {
    justify-content: flex-end;
}

.datatable-server-paged .datatable-length {
    display: none;
}

.datatable-length,
.datatable-search,
.datatable-pages {
    display: flex;
    align-items: center;
    gap: 8px;
}

.datatable-length {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.datatable-length .form-select {
    width: 86px;
}

.datatable-search {
    width: min(100%, 300px);
}

.datatable-search .form-control {
    min-width: 220px;
}

.datatable-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--line);
    background: #fff;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.page-item {
    display: inline-flex;
}

.page-link,
.datatable-pages .btn {
    min-width: 34px;
    height: 34px;
    padding: 6px 10px;
    border: 1px solid #d7dee8;
    border-radius: 6px;
    background: #fff;
    color: #344054;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.page-link:hover,
.datatable-pages .btn:hover:not(:disabled) {
    border-color: #7c2d3a;
    color: #7c2d3a;
    background: #fff7f8;
}

.page-item.active .page-link {
    border-color: #7c2d3a;
    background: #7c2d3a;
    color: #fff;
    box-shadow: 0 6px 14px rgba(124, 45, 58, 0.18);
}

.page-item.disabled .page-link,
.datatable-pages .btn:disabled {
    cursor: not-allowed;
    color: #98a2b3;
    background: #f8fafc;
    border-color: #e4e7ec;
    box-shadow: none;
    opacity: 1;
}

.pagination + .pagination,
nav[role="navigation"] p {
    margin: 0;
}

.card > .p-3,
.report-table-panel > .p-3 {
    border-top: 1px solid var(--line);
    background: #fff;
}

.datatable-info,
.datatable-page-status {
    color: var(--muted);
    font-size: 13px;
}

.datatable-page-status {
    min-width: 48px;
    text-align: center;
}

.badge {
    border-radius: 999px;
    font-weight: 700;
}

.app-footer {
    margin-left: var(--sidebar-width);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    background: #fff;
}

@media (max-width: 991.98px) {
    .login-shell {
        grid-template-columns: 1fr;
        align-items: stretch;
        padding: 18px 0;
    }

    .login-info-panel {
        min-height: auto;
        gap: 28px;
    }

    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        padding: 12px;
    }

    .brand-block {
        grid-column: 1 / -1;
        padding: 0 4px 8px;
        margin-bottom: 0;
    }

    .sidebar a {
        margin: 0;
        padding: 10px;
    }

    .content,
    .topbar,
    .app-footer {
        margin-left: 0;
    }

    .content {
        padding: 16px;
    }

    .topbar {
        position: relative;
        flex-wrap: wrap;
        padding: 12px 16px;
    }

    .workspace-header,
    .work-panel-header,
    .report-workbench > .d-flex,
    .d-flex.justify-content-between.align-items-center.mb-4,
    .datatable-footer {
        align-items: flex-start !important;
        flex-direction: column;
    }

    .datatable-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .datatable-search {
        width: 100%;
    }

    .datatable-search .form-control {
        min-width: 0;
        width: 100%;
    }

    .pagination {
        justify-content: flex-start;
    }

    .card > .p-3 nav,
    .report-table-panel > .p-3 nav {
        width: 100%;
    }

    .app-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .metric-strip,
    .dashboard-grid,
    .report-kpi-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    body {
        font-size: 13px;
    }

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

    .brand-mark {
        width: 36px;
        height: 36px;
    }

    .brand-block h5 {
        font-size: 16px;
    }

    .content {
        padding: 12px;
    }

    .login-shell {
        width: min(100% - 24px, 1120px);
    }

    .login-info-panel {
        padding: 20px;
    }

    .login-card {
        padding: 20px;
    }

    .workspace-header,
    .report-workbench,
    .card-body {
        padding: 14px;
    }

    .metric-tile {
        min-height: 96px;
    }

    .due-item {
        grid-template-columns: 1fr;
    }

    .app-footer {
        padding: 12px;
    }
}
