/* ==========================================================================
   JRS ERP — design system
   Light blue / white surfaces, dark navy sidebar, compact information density.
   ========================================================================== */

:root {
    /* Navy — the sidebar, primary buttons and headings. */
    --navy-950: #071527;
    --navy-900: #0a1c31;
    --navy-800: #102a49;
    --navy-700: #17385f;
    --navy-600: #1f4776;

    /* Blue — links, focus rings and the active state. */
    --blue-800: #1e40af;
    --blue-700: #1d4ed8;
    --blue-600: #2563eb;
    --blue-500: #3b82f6;
    --blue-100: #dbeafe;
    --blue-50: #eff6ff;

    /* Surfaces. */
    --canvas: #f4f7fb;
    --surface: #ffffff;
    --surface-sunk: #f8fafc;
    --border: #e4eaf2;
    --border-strong: #cdd8e6;

    --ink: #0d1526;
    --ink-soft: #34425c;
    --muted: #64748b;
    --muted-light: #94a3b8;

    --green: #047857;
    --green-bg: #d7f5e6;
    --amber: #b45309;
    --amber-bg: #fdf0d0;
    --red: #b42318;
    --red-bg: #fde5e2;
    --slate-bg: #e6ecf4;

    --sidebar-width: 268px;
    --sidebar-collapsed: 74px;
    --topbar-height: 64px;

    --radius-xl: 18px;
    --radius-lg: 14px;
    --radius: 10px;
    --radius-sm: 8px;

    --shadow-xs: 0 1px 2px rgba(13, 21, 38, .05);
    --shadow-card: 0 1px 2px rgba(13, 21, 38, .05), 0 1px 3px rgba(13, 21, 38, .04);
    --shadow-raised: 0 8px 24px -10px rgba(13, 21, 38, .18), 0 2px 6px rgba(13, 21, 38, .05);
    --shadow-pop: 0 18px 42px -18px rgba(13, 21, 38, .3);

    --ring: 0 0 0 3px rgba(37, 99, 235, .18);
    --ease: cubic-bezier(.4, 0, .2, 1);
    --dur: .16s;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--canvas);
    color: var(--ink);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    color: var(--ink);
    font-weight: 650;
    letter-spacing: -0.01em;
}

a {
    color: var(--blue-700);
    text-decoration: none;
}

a:hover {
    color: var(--blue-600);
}

.mono {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: .92em;
    letter-spacing: .01em;
}

/* ---------------------------------------------------------------- shell --- */

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

.app-main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    transition: margin-left .16s ease;
    min-width: 0;
}

html.sidebar-collapsed .app-main {
    margin-left: var(--sidebar-collapsed);
}

/* -------------------------------------------------------------- sidebar --- */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    background: var(--navy-900);
    color: #cbd5e1;
    overflow-x: hidden;
    overflow-y: auto;
    transition: width .16s ease, transform .2s ease;
}

html.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed);
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--topbar-height);
    padding: 0 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    flex: 0 0 auto;
}

.brand-mark {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--blue-600), var(--navy-600));
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.brand-text__name {
    color: #fff;
    font-size: 14px;
    font-weight: 650;
    white-space: nowrap;
}

.brand-text__sub {
    color: var(--muted-light);
    font-size: 11px;
    white-space: nowrap;
}

.sidebar__collapse {
    margin-left: auto;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 7px;
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
}

.sidebar__collapse:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

html.sidebar-collapsed .sidebar__collapse i {
    transform: rotate(180deg);
}

.sidebar__nav {
    flex: 1 1 auto;
    padding: 12px 10px;
}

/* Collapsible module groups (§30). */

.nav-section {
    margin-bottom: 2px;
}

.nav-section__heading {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
}

.nav-section__toggle {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 7px 8px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted-light);
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .09em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
}

.nav-section__toggle:hover {
    background: rgba(255, 255, 255, .05);
    color: #e2e8f0;
}

.nav-section__icon {
    flex: 0 0 auto;
    width: 15px;
    font-size: 13px;
    text-align: center;
}

.nav-section__label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-section__chevron {
    margin-left: auto;
    font-size: 11px;
    transition: transform .16s ease;
}

.nav-section.is-collapsed .nav-section__chevron {
    transform: rotate(-90deg);
}

.nav-section.is-collapsed .nav-list {
    display: none;
}

.nav-section.is-current .nav-section__toggle {
    color: #dbeafe;
}

.nav-list {
    margin: 2px 0 6px;
    padding: 0 0 0 4px;
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 7px 9px;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
    font-size: 13.5px;
    white-space: nowrap;
}

.nav-item i {
    flex: 0 0 auto;
    width: 18px;
    font-size: 15px;
    text-align: center;
}

.nav-item__label {
    overflow: hidden;
    text-overflow: ellipsis;
}

a.nav-item:hover {
    background: rgba(255, 255, 255, .07);
    color: #fff;
}

.nav-item.is-active {
    background: linear-gradient(90deg, rgba(37, 99, 235, .9), rgba(37, 99, 235, .55));
    color: #fff;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}

.nav-item.is-disabled {
    color: #64748b;
    cursor: not-allowed;
}

html.sidebar-collapsed .brand-text,
html.sidebar-collapsed .nav-item__label,
html.sidebar-collapsed .nav-section__label,
html.sidebar-collapsed .nav-section__chevron,
html.sidebar-collapsed .sidebar__footer {
    display: none;
}

html.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 8px 0;
}

/* The rail keeps every icon visible, so a collapsed group still shows its items. */
html.sidebar-collapsed .nav-section__toggle {
    justify-content: center;
    padding: 7px 0;
}

html.sidebar-collapsed .nav-section.is-collapsed .nav-list {
    display: block;
}

.sidebar__footer {
    flex: 0 0 auto;
    padding: 10px 16px 14px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    color: var(--muted-light);
    font-size: 11.5px;
}

.sidebar__footer-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1035;
    border: 0;
    background: rgba(15, 23, 42, .45);
    cursor: pointer;
}

/* --------------------------------------------------------------- topbar --- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--topbar-height);
    padding: 0 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar__toggle {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 17px;
    cursor: pointer;
}

.topbar__toggle:hover {
    background: var(--blue-50);
    border-color: var(--blue-100);
    color: var(--blue-700);
}

.topbar__title {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar__heading {
    font-size: 16px;
    font-weight: 650;
    white-space: nowrap;
}

.topbar__meta {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.topbar__user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 5px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12.5px;
}

.topbar__avatar {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--blue-50);
    color: var(--blue-700);
}

/* ------------------------------------------------------------ page bands --- */

.page {
    flex: 1 1 auto;
    padding: 0 20px 24px;
    min-width: 0;
}

.page-head {
    padding: 12px 0 4px;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--muted);
    font-size: 12.5px;
}

.breadcrumb__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.breadcrumb__item.is-current span {
    color: var(--ink-soft);
    font-weight: 600;
}

.breadcrumb__sep {
    color: var(--muted-light);
    font-size: 10px;
}

.page-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 12px;
}

.page-intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #ffffff 0%, var(--blue-50) 100%);
    box-shadow: var(--shadow-card);
}

.page-intro__title {
    font-size: 19px;
    margin-bottom: 4px;
}

.page-intro__text {
    margin: 0;
    max-width: 74ch;
    color: var(--muted);
    font-size: 13px;
}

/* --------------------------------------------------------------- cards --- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.card__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
}

.card__title {
    font-size: 14.5px;
    font-weight: 650;
}

.card__title-code {
    margin-left: 6px;
    color: var(--muted);
    font-weight: 500;
}

.card__meta {
    margin-left: auto;
    color: var(--muted);
    font-size: 12px;
}

.card__header .badge {
    margin-left: auto;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
    gap: 12px;
}

.metric-card {
    position: relative;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.metric-card__icon {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--blue-50);
    color: var(--blue-700);
}

.metric-card__label {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.metric-card__value {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--navy-800);
    line-height: 1.1;
}

.metric-card__hint {
    margin: 6px 0 0;
    color: var(--muted-light);
    font-size: 11.5px;
}

.panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

/* ------------------------------------------------------------- checklist --- */

.checklist {
    margin: 0;
    padding: 12px 16px 16px;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.checklist__item {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 13px;
}

.checklist__item i {
    color: var(--muted-light);
    font-size: 14px;
}

.checklist__item.is-done {
    color: var(--ink-soft);
}

.checklist__item.is-done i {
    color: var(--green);
}

/* --------------------------------------------------------- quick actions --- */

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px 16px;
}

.quick-action {
    display: grid;
    grid-template-columns: 34px 1fr;
    grid-template-rows: auto auto;
    column-gap: 12px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    transition: border-color .14s ease, background .14s ease;
}

.quick-action:hover {
    background: var(--blue-50);
    border-color: var(--blue-100);
}

.quick-action i {
    grid-row: span 2;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--blue-50);
    color: var(--blue-700);
    font-size: 16px;
}

.quick-action__label {
    color: var(--ink);
    font-weight: 600;
    font-size: 13.5px;
}

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

/* --------------------------------------------------------- module grid --- */

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 10px;
    padding: 14px 16px 18px;
}

.module-tile {
    display: grid;
    grid-template-columns: 20px 1fr;
    align-items: center;
    gap: 8px 10px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
}

.module-tile i {
    color: var(--muted-light);
    font-size: 15px;
}

.module-tile__state {
    grid-column: 2;
    color: var(--muted-light);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.module-tile.is-ready {
    border-color: var(--blue-100);
    background: var(--blue-50);
    color: var(--ink);
    font-weight: 600;
}

.module-tile.is-ready i {
    color: var(--blue-700);
}

.module-tile.is-ready .module-tile__state {
    color: var(--green);
}

/* ---------------------------------------------------- dashboard panels --- */

.metric-card__value.is-pending {
    color: var(--muted-light);
    font-weight: 600;
}

.quick-action.is-planned {
    border-style: dashed;
    background: transparent;
    cursor: not-allowed;
}

.quick-action.is-planned i {
    background: var(--slate-bg);
    color: var(--muted);
}

.quick-action__state {
    grid-column: 2;
    margin-top: 4px;
    color: var(--muted-light);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.activity-list {
    margin: 0;
    padding: 6px 0;
    list-style: none;
}

.activity-item {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    border-bottom: 1px solid var(--border);
}

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

.activity-item__icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--blue-50);
    color: var(--blue-700);
    font-size: 13px;
}

.activity-item__main {
    min-width: 0;
}

.activity-item__title {
    margin: 0;
    color: var(--ink-soft);
    font-size: 13px;
}

.activity-item__actor {
    color: var(--muted);
    font-weight: 600;
}

.activity-item__time {
    color: var(--muted-light);
    font-size: 11.5px;
    white-space: nowrap;
}

.fact-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px 18px;
    margin: 0;
    padding: 14px 16px 16px;
}

.fact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.fact-item__icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--blue-50);
    color: var(--blue-700);
    font-size: 14px;
}

.fact-item__text {
    min-width: 0;
}

.fact-item__label {
    display: block;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.fact-item__value {
    display: block;
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 600;
}

.empty-state {
    margin: 0;
    padding: 22px 16px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

/* ------------------------------------------------------------- details --- */

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px 20px;
    margin: 0;
    padding: 16px;
}

.detail-grid--tight {
    gap: 12px 18px;
    padding: 14px 16px 16px;
}

.detail-grid__item dt {
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.detail-grid__item dd {
    margin: 0;
    color: var(--ink-soft);
    font-size: 13.5px;
    word-break: break-word;
}

.detail-grid__item--wide {
    grid-column: 1 / -1;
}

.branch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 16px;
}

.branch-card .detail-grid {
    border-top: 0;
}

/* -------------------------------------------------------------- badges --- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .02em;
    white-space: nowrap;
}

.badge-draft {
    background: var(--slate-bg);
    color: var(--ink-soft);
}

.badge-pending {
    background: var(--amber-bg);
    color: var(--amber);
}

.badge-approved,
.badge-paid,
.badge-completed {
    background: var(--green-bg);
    color: var(--green);
}

.badge-rejected,
.badge-overdue {
    background: var(--red-bg);
    color: var(--red);
}

/* ------------------------------------------------------------- buttons --- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 36px;
    padding: 7px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .14s ease, border-color .14s ease, color .14s ease;
}

.btn-sm {
    min-height: 32px;
    padding: 5px 11px;
    font-size: 12.5px;
}

.btn-primary-navy {
    background: var(--navy-800);
    color: #fff;
}

.btn-primary-navy:hover {
    background: var(--navy-700);
    color: #fff;
}

.btn-outline-navy {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--ink-soft);
}

.btn-outline-navy:hover {
    background: var(--blue-50);
    border-color: var(--blue-100);
    color: var(--blue-700);
}

/* ---------------------------------------------------------------- note --- */

.note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 11px 14px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--muted);
    font-size: 12.5px;
}

.note i {
    color: var(--blue-700);
}

/* --------------------------------------------------------------- error --- */

.error-panel {
    max-width: 620px;
    margin: 40px auto;
    padding: 32px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-raised);
}

.error-panel__code {
    margin: 0;
    color: var(--blue-100);
    font-size: 64px;
    font-weight: 800;
    line-height: 1;
}

.error-panel__title {
    margin: 10px 0 8px;
    font-size: 20px;
}

.error-panel__message {
    margin: 0 0 20px;
    color: var(--muted);
}

/* -------------------------------------------------------------- footer --- */

.app-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px 18px;
    color: var(--muted-light);
    font-size: 12px;
}

/* ---------------------------------------------------------- responsive --- */

@media (max-width: 991.98px) {
    .app-main,
    html.sidebar-collapsed .app-main {
        margin-left: 0;
    }

    .sidebar,
    html.sidebar-collapsed .sidebar {
        width: var(--sidebar-width);
        transform: translateX(-100%);
    }

    html.sidebar-collapsed .sidebar__collapse i {
        transform: none;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(15, 23, 42, .35);
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

    html.sidebar-collapsed .brand-text,
    html.sidebar-collapsed .nav-item__label,
    html.sidebar-collapsed .nav-section__label,
    html.sidebar-collapsed .nav-section__chevron,
    html.sidebar-collapsed .sidebar__footer {
        display: revert;
    }

    html.sidebar-collapsed .nav-item {
        justify-content: flex-start;
        padding: 7px 9px;
    }

    html.sidebar-collapsed .nav-section__toggle {
        justify-content: flex-start;
        padding: 7px 8px;
    }

    .btn-label {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .page {
        padding: 0 12px 20px;
    }

    .topbar {
        padding: 0 12px;
    }

    .metric-card__value {
        font-size: 21px;
    }
}

/* --------------------------------------------------------------- forms --- */

.form-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field__label {
    color: var(--ink-soft);
    font-size: 12.5px;
    font-weight: 600;
}

.field__input {
    width: 100%;
    min-height: 38px;
    padding: 8px 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font-family: inherit;
    font-size: 13.5px;
}

.field__input:focus {
    outline: none;
    border-color: var(--blue-600);
    box-shadow: 0 0 0 3px var(--blue-100);
}

.field__hint {
    margin: 0;
    color: var(--muted);
    font-size: 11.5px;
}

.btn-block {
    width: 100%;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
}

.alert i {
    flex: 0 0 auto;
    margin-top: 1px;
}

.card__body {
    padding: 16px;
}

.card__body .form-grid {
    margin-top: 4px;
}

.empty-state {
    margin: 0;
    padding: 18px 16px;
    color: var(--muted);
    font-size: 13px;
}

/* ------------------------------------------------------------- account --- */

.account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 16px;
}

.history-list {
    margin: 0;
    padding: 4px 16px 14px;
    list-style: none;
}

.history-list__item {
    display: grid;
    grid-template-columns: 132px 148px 1fr;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.history-list__item:last-child {
    border-bottom: 0;
}

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

.history-list__meta {
    color: var(--muted-light);
    font-size: 11.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ------------------------------------------------------- topbar account --- */

.topbar__usermenu {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar__logout {
    margin: 0;
}

.topbar__userinfo {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}

.topbar__username {
    color: var(--ink);
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}

.topbar__userrole {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

a.topbar__user {
    background: var(--surface);
}

a.topbar__user:hover {
    background: var(--blue-50);
    border-color: var(--blue-100);
    color: var(--blue-700);
}

/* -------------------------------------------------- topbar notifications --- */

.topbar__bell {
    position: relative;
}

.topbar__bellbutton {
    position: relative;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 17px;
    cursor: pointer;
}

.topbar__bellbutton:hover {
    background: var(--blue-50);
    border-color: var(--blue-100);
    color: var(--blue-700);
}

.topbar__bellcount {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
}

.topbar__panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 1040;
    display: none;
    width: 340px;
    max-width: calc(100vw - 32px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-raised);
    overflow: hidden;
}

.topbar__bell.is-open .topbar__panel {
    display: block;
}

.topbar__panelheader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.topbar__paneltitle {
    font-size: 12.5px;
    font-weight: 650;
    color: var(--ink);
}

.topbar__panellist {
    max-height: 340px;
    overflow-y: auto;
}

.topbar__panelitem {
    display: block;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: inherit;
}

.topbar__panelitem:hover {
    background: var(--blue-50);
}

.topbar__panelitem.is-unread {
    background: var(--blue-50);
}

.topbar__panelitem-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
}

.topbar__panelitem-body {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.4;
}

.topbar__panelmeta {
    margin-top: 4px;
    color: var(--muted);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.topbar__panelfooter {
    display: block;
    padding: 10px 14px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--blue-700);
}

.topbar__panelfooter:hover {
    background: var(--blue-50);
}

.topbar__empty {
    padding: 22px 14px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}

/* ----------------------------------------------------------------- auth --- */

.auth-body {
    background: var(--canvas);
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    min-height: 100vh;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    gap: 26px;
    padding: 44px 40px;
    background: linear-gradient(160deg, var(--navy-900) 0%, var(--navy-700) 100%);
    color: #cbd5e1;
}

.auth-brand__logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-brand__mark {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--blue-600), var(--navy-600));
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .04em;
}

.auth-brand__names {
    display: flex;
    flex-direction: column;
}

.auth-brand__name {
    color: #fff;
    font-size: 17px;
    font-weight: 650;
}

.auth-brand__sub {
    color: var(--muted-light);
    font-size: 12px;
}

.auth-brand__title {
    margin: 0 0 10px;
    max-width: 24ch;
    color: #fff;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.28;
    letter-spacing: -0.015em;
}

.auth-brand__text {
    margin: 0;
    max-width: 46ch;
    color: #cbd5e1;
    font-size: 13.5px;
}

.auth-brand__facts {
    display: grid;
    gap: 10px;
    margin: auto 0 0;
    padding: 0;
    list-style: none;
}

.auth-brand__facts li {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #e2e8f0;
    font-size: 12.5px;
}

.auth-brand__facts i {
    color: var(--blue-100);
}

.auth-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 26px;
    padding: 40px 24px;
    background: var(--surface);
}

.auth-card {
    width: 100%;
    max-width: 392px;
}

.auth-card__title {
    margin-bottom: 6px;
    font-size: 22px;
}

.auth-card__text {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 13px;
}

.auth-card .alert {
    margin-bottom: 14px;
}

.auth-card .form-grid {
    margin-bottom: 16px;
}

.auth-card__alt {
    margin: 0;
    text-align: center;
    font-size: 13px;
}

.auth-panel__footer {
    margin: 0;
    color: var(--muted-light);
    font-size: 12px;
    text-align: center;
}

@media (max-width: 991.98px) {
    .auth-shell {
        grid-template-columns: minmax(0, 1fr);
        min-height: 0;
    }

    .auth-brand {
        gap: 18px;
        padding: 28px 22px;
    }

    .auth-brand__title {
        max-width: none;
        font-size: 21px;
    }

    .auth-brand__facts {
        margin-top: 6px;
    }

    .auth-panel {
        gap: 20px;
        padding: 30px 20px 40px;
    }
}

/* --------------------------------------------------- forms & field states --- */

.form-grid--columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px 18px;
}

.field--grow {
    flex: 1 1 220px;
}

.field__optional {
    color: var(--muted-light);
    font-weight: 500;
    font-size: 11px;
}

.field__error {
    margin: 0;
    color: var(--red);
    font-size: 11.5px;
    font-weight: 600;
}

.field__input.is-invalid {
    border-color: var(--red);
    background: var(--red-bg);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.inline-actions form {
    margin: 0;
}

/* Action buttons inside a table row, so .inline-actions' top margin never
   nudges them out of line with the row's text. */
.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.row-actions form {
    margin: 0;
}

.muted-text {
    color: var(--muted-light);
    font-weight: 400;
}

.card--danger {
    border-color: var(--red-bg);
}

.btn-danger {
    background: var(--red);
    color: #fff;
}

.btn-danger:hover {
    background: #991b1b;
    color: #fff;
}

/* ------------------------------------------------------------ filter bar --- */

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--blue-50);
}

.filter-bar .field {
    min-width: 160px;
}

.filter-bar__actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* ---------------------------------------------------------- data tables --- */

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

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

.data-table th,
.data-table td {
    padding: 10px 14px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background: var(--blue-50);
}

.data-table tbody tr:last-child th,
.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table__wrap {
    max-width: 380px;
    color: var(--muted);
    white-space: normal;
}

.data-table__actions-col {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

.data-table__actions-col .btn {
    margin-left: 6px;
}

.cell-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cell-stack__primary {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 600;
}

.cell-stack__secondary {
    color: var(--muted);
    font-size: 11.5px;
    word-break: break-word;
}

/* ------------------------------------------------------------ pagination --- */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.page-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 12.5px;
    font-weight: 600;
}

.page-link:hover {
    background: var(--blue-50);
    border-color: var(--blue-100);
    color: var(--blue-700);
}

.page-link.is-disabled {
    pointer-events: none;
    opacity: .5;
}

.pagination__status {
    color: var(--muted);
    font-size: 12.5px;
}

/* ------------------------------------------------------ permission matrix --- */

.matrix-table th,
.matrix-table td {
    padding: 8px 10px;
}

.matrix-table__module-col {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 230px;
    background: var(--surface);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
}

.matrix-table thead .matrix-table__module-col {
    z-index: 3;
}

.matrix-table tbody tr:hover .matrix-table__module-col {
    background: var(--blue-50);
}

.matrix-table__module-col .mono {
    display: block;
    font-weight: 400;
}

.matrix-table__action-col {
    width: 1%;
    text-align: center;
    white-space: nowrap;
}

.matrix-table__cell {
    width: 1%;
    text-align: center;
}

.matrix-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    cursor: pointer;
    font-weight: 500;
}

.matrix-toggle input,
.matrix-check input {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--blue-600);
}

.matrix-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin: 0;
    border-radius: 6px;
    cursor: pointer;
}

.matrix-check input:disabled {
    cursor: not-allowed;
    opacity: .55;
}

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

@media (max-width: 767.98px) {
    .filter-bar__actions {
        margin-left: 0;
        width: 100%;
    }

    .matrix-table__module-col {
        min-width: 170px;
    }
}

/* ============================================== HR & employees (§6) ========= */

.page-intro__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.card--attention {
    border-left: 3px solid var(--amber);
}

.field--wide {
    grid-column: 1 / -1;
}

.check-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    color: var(--ink-soft);
    font-size: 12.5px;
    cursor: pointer;
}

.check-inline input {
    width: 15px;
    height: 15px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--blue-600);
}

.check-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
}

.check-list .check-inline {
    margin-top: 0;
}

/* -------------------------------------------------- avatar & name cell --- */

.person {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.person__photo,
.person__initials {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.person__initials {
    display: grid;
    place-items: center;
    background: var(--blue-100);
    color: var(--blue-700);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .02em;
}

/* ------------------------------------------------------- profile header --- */

.profile-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-card);
}

.profile-head__identity {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.profile-head__photo,
.profile-head__initials {
    flex: 0 0 auto;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-head__initials {
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--blue-100), var(--blue-50));
    color: var(--blue-700);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: .02em;
    border: 1px solid var(--border);
}

.profile-head__details {
    min-width: 0;
}

.profile-head__name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 8px;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.profile-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--ink-soft);
    font-size: 12.5px;
}

.profile-facts li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.profile-facts i {
    color: var(--muted-light);
}

.profile-head__actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.photo-preview {
    margin-bottom: 16px;
}

.photo-preview__image {
    width: 96px;
    height: 96px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    object-fit: cover;
}

/* --------------------------------------------------------------- tabs --- */

.tabs {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tabs__list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-card);
}

.tabs__tab {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 14px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink-soft);
    font: inherit;
    font-weight: 550;
    cursor: pointer;
    transition: background .14s ease, color .14s ease;
}

.tabs__tab:hover {
    background: var(--blue-50);
    color: var(--blue-700);
}

.tabs__tab.is-active {
    background: var(--navy-900);
    color: #fff;
}

.tabs__panel {
    display: none;
}

.tabs__panel.is-active {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tabs__panel .card {
    margin: 0;
}

@media (max-width: 767.98px) {
    .profile-head__actions {
        align-items: flex-start;
    }
}

/* ============================================================ point 10 --- */
/* The element list builder, and the paper documents it produces. */

.data-table__sr {
    width: 44px;
    text-align: center;
}

.builder-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.builder {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 16px;
    align-items: start;
}

.builder__main {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.builder__sections {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.builder__aside {
    position: sticky;
    top: calc(var(--topbar-height) + 12px);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.builder__add {
    align-self: flex-start;
}

.builder-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.builder-section__head {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 14px;
    background: var(--blue-50);
    border-bottom: 1px solid var(--border);
}

.builder-section__handle {
    color: var(--muted-light);
    padding-bottom: 9px;
    line-height: 1;
}

.builder-section__title {
    font-weight: 650;
}

.builder-section__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: #fbfdff;
    border-top: 1px solid var(--border);
}

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

.builder-table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
}

.builder-table th,
.builder-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 12px;
    vertical-align: middle;
}

.builder-table thead th {
    background: var(--surface);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.builder-table__sr {
    width: 38px;
    text-align: center;
    color: var(--muted);
}

.builder-table__qty {
    width: 70px;
}

.builder-table__unit {
    width: 92px;
}

.builder-table__rate {
    width: 104px;
}

.builder-table__amount {
    width: 112px;
}

.builder-table__actions {
    width: 48px;
    text-align: center;
}

.builder-cell-wrap {
    padding: 4px 6px;
}

.builder-cell {
    width: 100%;
    padding: 6px 8px;
    font-size: 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
}

.builder-cell:hover {
    background: var(--surface);
    border-color: var(--border-strong);
}

.builder-cell:focus {
    background: var(--surface);
    border-color: var(--blue-600);
    outline: none;
    box-shadow: 0 0 0 3px var(--blue-100);
}

.builder-cell--number,
.builder-cell--money {
    text-align: right;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.builder-row__index {
    text-align: center;
    color: var(--muted);
    font-size: 11px;
}

.builder-row__remove {
    padding: 4px 7px;
    line-height: 1;
}

.builder-totals__list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0 0 12px;
    padding: 0;
}

.builder-totals__list > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
}

.builder-totals__list dt {
    color: var(--muted);
}

.builder-totals__list dd {
    margin: 0;
    font-weight: 600;
}

.builder-totals__grand {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin: 4px 0 12px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.builder-totals__grand strong {
    font-size: 16px;
    color: var(--navy-900);
}

@media (max-width: 1100px) {
    .builder {
        grid-template-columns: minmax(0, 1fr);
    }

    .builder__aside {
        position: static;
    }
}

/* ------------------------------------------------------- paper documents --- */

.paper-body {
    background: #e8edf4;
    padding-bottom: 40px;
}

.paper-toolbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 18px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-card);
}

.paper-toolbar__title {
    margin: 0;
    font-size: 13px;
    font-weight: 650;
    color: var(--navy-900);
}

.paper-toolbar__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.paper {
    width: 210mm;
    max-width: calc(100% - 32px);
    margin: 22px auto;
    padding: 14mm 12mm;
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 2px 18px rgba(15, 23, 42, .14);
}

.paper-doc {
    color: #000;
    font-size: 12px;
    line-height: 1.45;
}

.paper-doc__head {
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 2px solid #000;
}

.paper-doc__brand {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .01em;
    text-transform: uppercase;
}

.paper-doc__line {
    margin: 2px 0;
    font-size: 11.5px;
}

.paper-doc__label {
    font-weight: 600;
}

.paper-doc__title {
    margin: 10px 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .14em;
    text-align: center;
    text-transform: uppercase;
}

.paper-doc__meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 10px 0 12px;
    padding: 8px 10px;
    border: 1px solid #000;
}

.paper-doc__meta-row {
    display: flex;
    gap: 8px;
    font-size: 11.5px;
}

.paper-doc__meta-row .paper-doc__label {
    min-width: 130px;
}

.paper-table {
    width: 100%;
    margin: 0 0 10px;
    border-collapse: collapse;
    font-size: 11.5px;
}

.paper-table th,
.paper-table td {
    padding: 4px 6px;
    border: 1px solid #000;
    vertical-align: top;
}

.paper-table thead th {
    background: #f2f2f2;
    font-size: 11px;
    font-weight: 600;
    text-align: left;
}

.paper-table__sr {
    width: 46px;
    text-align: center;
}

.paper-table__num {
    text-align: right;
    white-space: nowrap;
}

.paper-table__unit {
    width: 56px;
    text-align: center;
}

.paper-table__hsn {
    width: 90px;
    text-align: center;
}

.paper-table__section td {
    background: #f7f7f7;
    font-weight: 700;
}

.paper-table__label {
    font-weight: 600;
    text-align: right;
}

.paper-table__grand td {
    background: #f2f2f2;
    font-weight: 700;
}

.paper-table--summary {
    width: auto;
    min-width: 72%;
}

.paper-doc__words {
    margin: 8px 0;
    font-size: 11.5px;
}

.paper-doc__foot {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-top: 26px;
}

.paper-doc__sign {
    min-width: 170px;
    margin: 0;
    padding-top: 4px;
    border-top: 1px solid #000;
    font-size: 11px;
}

.paper-doc__sign-block {
    text-align: right;
}

.paper-doc__sign-block p {
    margin: 0 0 26px;
}

.invoice-order {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.invoice-order__right {
    text-align: right;
}

.invoice-party {
    margin: 8px 0 10px;
    padding: 8px 10px;
    border: 1px solid #000;
}

.invoice-party__label {
    margin: 0;
    font-size: 11px;
}

.invoice-party__name {
    margin: 0 0 2px;
    font-weight: 700;
}

.invoice-line__title {
    margin: 0 0 3px;
    font-weight: 600;
}

.invoice-line__sub {
    margin: 0;
    font-size: 10.5px;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.invoice-bank,
.invoice-terms {
    margin-top: 10px;
    padding-top: 6px;
}

.invoice-bank__title,
.invoice-terms__title {
    margin: 0 0 3px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.invoice-terms__list {
    margin: 2px 0 0;
    padding-left: 18px;
    font-size: 11px;
}

.invoice-terms__list li {
    margin: 1px 0;
}

@media print {
    @page {
        size: A4;
        margin: 10mm;
    }

    .paper-body {
        padding: 0;
        background: #fff;
    }

    .paper-toolbar {
        display: none !important;
    }

    .paper {
        width: auto;
        max-width: none;
        margin: 0;
        padding: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .paper-doc {
        font-size: 10.5pt;
    }

    .paper-table thead {
        display: table-header-group;
    }

    .paper-table tr {
        page-break-inside: avoid;
    }

    .invoice-bank,
    .invoice-terms,
    .paper-doc__foot {
        page-break-inside: avoid;
    }
}

/* --------------------------------------------- attendance & shifts (§7) --- */

/* The day's picture in one line, used by the register and the calendar. */
.tally-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 14px;
}

.register-form .table-wrap {
    margin-bottom: 0;
}

.register-table td {
    vertical-align: middle;
}

/* The register is a working sheet, so the controls inside it are small. */
.register-table .field__input {
    min-width: 86px;
    padding: 4px 6px;
    font-size: 12.5px;
}

.register-table .field__input[type="time"] {
    min-width: 92px;
}

.register-row--marked {
    background: #f8fbff;
}

.register-actions {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    background: var(--canvas);
}

.register-actions .field {
    margin: 0;
}

.calendar__nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 12px 0 4px;
}

.calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    margin-top: 12px;
}

.calendar__weekday {
    padding: 4px 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .04em;
    text-align: center;
    text-transform: uppercase;
}

.calendar__cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 78px;
    padding: 7px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.calendar__cell--empty {
    border-color: transparent;
    background: transparent;
}

.calendar__cell--marked {
    border-color: var(--border-strong);
}

.calendar__cell--today {
    box-shadow: inset 0 0 0 2px var(--blue-600);
}

.calendar__day {
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 650;
}

.calendar__status {
    align-self: flex-start;
    font-size: 10.5px;
}

.calendar__meta {
    font-size: 10.5px;
    line-height: 1.35;
}

@media (max-width: 720px) {
    .calendar__cell {
        min-height: 62px;
        padding: 5px 6px;
    }

    .calendar__status {
        font-size: 9.5px;
        padding: 2px 6px;
    }

    .register-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ------------------------------------------------ masters import (§5) --- */

/* The instructions on the import screen, numbered and spaced so the upload
   form reads as the last step rather than the first thing on the page. */
.import-steps {
    margin: 0;
    padding-left: 20px;
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.6;
}

.import-steps li + li {
    margin-top: 8px;
}

.import-steps strong {
    color: var(--ink);
}

/* ==========================================================================
   Visual refresh
   --------------------------------------------------------------------------
   Refines the component layer above without touching a single template: every
   selector here already exists, so all 33 modules pick the new look up at
   once. Order matters — this block comes last so its rules win, and where two
   rules of the same weight collide inside it (table stripes vs. row hover),
   the later one is the one meant to win.
   ========================================================================== */

/* ----------------------------------------------------------------- base --- */

body {
    background: linear-gradient(180deg, #f8fafd 0%, var(--canvas) 260px);
    letter-spacing: -0.005em;
}

h1,
h2,
h3,
h4 {
    letter-spacing: -0.018em;
}

/* One ring for keyboard users everywhere, so tabbing is always visible. */
:focus-visible {
    outline: 2px solid var(--blue-600);
    outline-offset: 2px;
}

/* Slim scrollbars: a long table should not fight the page for width. */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 999px;
    background: var(--border-strong);
    background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--muted-light);
    background-clip: content-box;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

/* -------------------------------------------------------------- sidebar --- */

.sidebar {
    background: linear-gradient(180deg, var(--navy-950) 0%, var(--navy-900) 40%, var(--navy-800) 100%);
    box-shadow: 12px 0 32px -24px rgba(7, 21, 39, .95);
}

.sidebar__brand {
    height: var(--topbar-height);
    padding: 0 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.brand-mark {
    border-radius: 11px;
    background: linear-gradient(140deg, var(--blue-500), var(--blue-700));
    box-shadow: 0 6px 14px -6px rgba(37, 99, 235, .9), inset 0 1px 0 rgba(255, 255, 255, .28);
}

.brand-text__name {
    font-size: 14.5px;
    letter-spacing: -0.01em;
}

.brand-text__sub {
    color: #8fa3bd;
}

.sidebar__collapse {
    border-color: rgba(255, 255, 255, .16);
    color: #a9bcd4;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.sidebar__nav {
    padding: 14px 12px;
}

/* Section headings read as labels, not links: quieter, tighter, spaced out. */
.nav-section__toggle {
    padding: 6px 10px;
    color: #93a7c2;
    font-size: 10px;
    letter-spacing: .11em;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.nav-section__toggle:hover {
    background: rgba(255, 255, 255, .06);
    color: #e8eef7;
}

.nav-section.is-current .nav-section__toggle {
    color: #bcd3f7;
}

.nav-list {
    margin: 2px 0 8px;
    padding-left: 6px;
}

.nav-item {
    min-height: 38px;
    padding: 8px 10px;
    color: #b7c6da;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

a.nav-item:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

a.nav-item:hover i {
    color: #fff;
}

/* The current page: a filled pill with an inset accent bar, which stays
   readable in the collapsed rail where there is no room for a label. */
.nav-item.is-active {
    background: linear-gradient(100deg, rgba(37, 99, 235, .95), rgba(29, 78, 216, .68));
    color: #fff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 0 #93bbff, 0 8px 18px -12px rgba(37, 99, 235, 1);
}

.sidebar__footer {
    padding: 12px 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, .07);
    color: #8296b1;
}

/* --------------------------------------------------------------- topbar --- */

/* Frosted so the page scrolls under it instead of being cut by a hard line. */
.topbar {
    padding: 0 22px;
    background: rgba(255, 255, 255, .86);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    backdrop-filter: saturate(180%) blur(12px);
    box-shadow: 0 1px 0 rgba(13, 21, 38, .03);
}

.topbar__heading {
    font-size: 16.5px;
    letter-spacing: -0.015em;
}

.topbar__toggle {
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.topbar__user {
    border-radius: 999px;
    background: var(--surface);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.topbar__user:hover {
    border-color: var(--blue-100);
    box-shadow: var(--shadow-xs);
}

.topbar__avatar {
    background: linear-gradient(140deg, var(--blue-500), var(--blue-700));
    color: #fff;
    font-weight: 600;
}

/* ---------------------------------------------------------- page bands --- */

.page {
    padding: 0 22px 28px;
}

.page-body {
    gap: 18px;
    padding-top: 14px;
}

.breadcrumb a {
    color: var(--muted);
}

.breadcrumb a:hover {
    color: var(--blue-700);
}

/* The page header: a tinted panel with an accent edge, so the first thing on
   every screen says what the screen is. */
.page-intro {
    position: relative;
    overflow: hidden;
    padding: 20px 22px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, #ffffff 0%, #f2f7ff 55%, var(--blue-50) 100%);
}

.page-intro::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(180deg, var(--blue-500), var(--blue-700));
}

.page-intro__title {
    font-size: 20px;
    letter-spacing: -0.02em;
}

.page-intro__text {
    font-size: 13.5px;
}

/* --------------------------------------------------------------- cards --- */

.card {
    transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.card__header {
    padding: 14px 18px;
    background: linear-gradient(180deg, #fcfdff, #ffffff);
}

.card__title {
    font-size: 14.5px;
    letter-spacing: -0.01em;
}

.card__body {
    padding: 18px;
}

/* ------------------------------------------------------------- metrics --- */

.metric-grid {
    gap: 14px;
}

/* Clipped so the accent bar above follows the card's rounded corners. */
.metric-card {
    overflow: hidden;
    padding: 16px 18px;
    border-radius: var(--radius-lg);
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.metric-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--blue-500), var(--blue-700));
    opacity: .9;
}

.metric-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-raised);
}

.metric-card__icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(140deg, var(--blue-50), var(--blue-100));
    font-size: 15px;
}

.metric-card__label {
    font-size: 11px;
}

.metric-card__value {
    font-size: 26px;
    letter-spacing: -0.025em;
}

/* ------------------------------------------------- quick actions & tiles --- */

.quick-action {
    padding: 12px 13px;
    transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.quick-action:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-card);
}

.quick-action i {
    border-radius: 10px;
    background: linear-gradient(140deg, var(--blue-50), var(--blue-100));
}

.module-tile {
    border-radius: var(--radius);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.module-tile.is-ready {
    background: linear-gradient(140deg, #ffffff, var(--blue-50));
}

.module-tile.is-ready:hover {
    transform: translateY(-1px);
    border-color: var(--blue-500);
    box-shadow: var(--shadow-card);
}

/* --------------------------------------------------------- data tables --- */

.data-table thead th {
    padding: 11px 16px;
    background: var(--surface-sunk);
    border-bottom: 1px solid var(--border-strong);
    font-size: 10.5px;
    letter-spacing: .07em;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
}

/* Stripes first, hover second — same weight, so the later rule wins and a
   row lights up under the pointer. */
.data-table tbody tr {
    transition: background var(--dur) var(--ease);
}

.data-table tbody tr:nth-child(even) {
    background: #fafcfe;
}

.data-table tbody tr:hover {
    background: var(--blue-50);
}

.filter-bar {
    padding: 15px 18px;
    background: linear-gradient(180deg, var(--surface-sunk), #ffffff);
}

/* --------------------------------------------------------------- badges --- */

.badge {
    padding: 3px 10px;
    border: 1px solid transparent;
    letter-spacing: .015em;
}

.badge-draft {
    border-color: rgba(13, 21, 38, .06);
}

.badge-pending {
    border-color: rgba(180, 83, 9, .16);
}

.badge-approved,
.badge-paid,
.badge-completed {
    border-color: rgba(4, 120, 87, .18);
}

.badge-rejected,
.badge-overdue {
    border-color: rgba(180, 35, 24, .18);
}

/* -------------------------------------------------------------- buttons --- */

.btn {
    min-height: 38px;
    padding: 8px 15px;
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform 80ms var(--ease);
}

.btn:active {
    transform: translateY(1px);
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.btn:disabled,
.btn.is-disabled {
    opacity: .55;
    cursor: not-allowed;
}

.btn-sm {
    min-height: 33px;
    padding: 6px 12px;
}

.btn-primary-navy {
    background: linear-gradient(180deg, var(--navy-700), var(--navy-800));
    box-shadow: 0 1px 2px rgba(13, 21, 38, .18), inset 0 1px 0 rgba(255, 255, 255, .1);
}

.btn-primary-navy:hover {
    background: linear-gradient(180deg, var(--navy-600), var(--navy-700));
}

.btn-outline-navy {
    box-shadow: var(--shadow-xs);
}

.btn-danger {
    background: linear-gradient(180deg, #d92d20, var(--red));
}

.btn-danger:hover {
    background: linear-gradient(180deg, var(--red), #8f1a12);
}

/* ---------------------------------------------------------------- forms --- */

.field__input {
    min-height: 40px;
    padding: 9px 12px;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}

.field__input::placeholder {
    color: var(--muted-light);
}

.field__input:hover:not(:focus) {
    border-color: var(--muted-light);
}

/* A filled field is a long one, so it gets room to breathe. */
textarea.field__input {
    min-height: 92px;
    line-height: 1.55;
}

/* Invalid is flagged by the border and the ring, not by tinting the text the
   reader is trying to correct. */
.field__input.is-invalid {
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(180, 35, 24, .12);
}

/* ------------------------------------------------- alerts & empty states --- */

/* Declared here so alerts match the palette rather than Bootstrap's. */
.alert {
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius);
}

.alert-danger {
    background: var(--red-bg);
    border-color: rgba(180, 35, 24, .18);
    color: var(--red);
}

.alert-success {
    background: var(--green-bg);
    border-color: rgba(4, 120, 87, .2);
    color: var(--green);
}

.alert-warning {
    background: var(--amber-bg);
    border-color: rgba(180, 83, 9, .2);
    color: var(--amber);
}

.note {
    padding: 12px 15px;
    border-radius: var(--radius);
    background: var(--surface-sunk);
}

.empty-state {
    padding: 34px 18px;
}

/* ----------------------------------------------------------- pagination --- */

.page-link {
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

/* ----------------------------------------------------------------- auth --- */

.auth-brand {
    background:
        radial-gradient(900px 460px at 12% 0%, rgba(37, 99, 235, .38), transparent 62%),
        linear-gradient(160deg, var(--navy-950) 0%, var(--navy-800) 100%);
}

.auth-brand__mark {
    border-radius: 14px;
    background: linear-gradient(140deg, var(--blue-500), var(--blue-700));
    box-shadow: 0 10px 24px -10px rgba(37, 99, 235, .95), inset 0 1px 0 rgba(255, 255, 255, .3);
}

.auth-card__title {
    font-size: 24px;
    letter-spacing: -0.02em;
}

.auth-card .btn-block {
    min-height: 42px;
}

/* The narrow-screen rules earlier in this file set these same properties, so
   they have to be restated here — this block is read last and would otherwise
   undo them. */
@media (max-width: 575.98px) {
    .page {
        padding: 0 14px 22px;
    }

    .topbar {
        padding: 0 14px;
    }

    .page-intro {
        padding: 16px;
        border-radius: var(--radius-lg);
    }

    .card__header,
    .card__body {
        padding-left: 14px;
        padding-right: 14px;
    }

    .metric-card__value {
        font-size: 22px;
    }
}

/* ================================================================== charts ===
   The dashboard's figures are drawn from the numbers the server already read,
   so the markup carries the values and app.js only measures them into arcs and
   bar widths. Nothing is fetched, and nothing is invented on the client. */

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 18px;
}

.chart-card {
    --chart-blue: #2563eb;
    --chart-green: #047857;
    --chart-amber: #b45309;
    --chart-red: #b42318;
    --chart-slate: #64748b;
    --chart-violet: #6d28d9;
    display: flex;
    flex-direction: column;
}

.chart-card .card__body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1 1 auto;
    padding-top: 16px;
}

/* The tone each series is painted in, whether it is an arc, a bar or a swatch. */
.chart-donut__arc.is-blue,
.chart-bar__fill.is-blue,
.chart-legend__swatch.is-blue {
    --chart-tone: var(--chart-blue);
}

.chart-donut__arc.is-green,
.chart-bar__fill.is-green,
.chart-legend__swatch.is-green {
    --chart-tone: var(--chart-green);
}

.chart-donut__arc.is-amber,
.chart-bar__fill.is-amber,
.chart-legend__swatch.is-amber {
    --chart-tone: var(--chart-amber);
}

.chart-donut__arc.is-red,
.chart-bar__fill.is-red,
.chart-legend__swatch.is-red {
    --chart-tone: var(--chart-red);
}

.chart-donut__arc.is-slate,
.chart-bar__fill.is-slate,
.chart-legend__swatch.is-slate {
    --chart-tone: var(--chart-slate);
}

.chart-donut__arc.is-violet,
.chart-bar__fill.is-violet,
.chart-legend__swatch.is-violet {
    --chart-tone: var(--chart-violet);
}

/* -------------------------------------------------------------- donut ring --- */

.chart-donut {
    display: flex;
    align-items: center;
    gap: 22px;
}

.chart-donut__figure {
    position: relative;
    flex: 0 0 150px;
    width: 150px;
    height: 150px;
}

.chart-donut__svg {
    width: 100%;
    height: 100%;
    display: block;
    /* The ring starts at twelve o'clock rather than at three. */
    transform: rotate(-90deg);
}

.chart-donut__ring {
    fill: none;
    stroke: var(--surface-sunk);
    stroke-width: 3.8;
}

.chart-donut__arc {
    fill: none;
    stroke: var(--chart-tone, var(--chart-slate));
    stroke-width: 3.8;
    stroke-linecap: butt;
    /* Empty until app.js measures the share and the browser animates to it. */
    stroke-dasharray: 0 100;
    stroke-dashoffset: 100;
    transition: stroke-dasharray .85s var(--ease), stroke-dashoffset .85s var(--ease);
}

.chart-donut.is-drawn .chart-donut__arc {
    stroke-dasharray: var(--chart-seg, 0 100);
    stroke-dashoffset: var(--chart-offset, 100);
}

.chart-donut__center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-align: center;
}

.chart-donut__center strong {
    font-size: 27px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.chart-donut__center small {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--muted);
}

.chart-legend {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.chart-legend__item {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12.5px;
}

.chart-legend__swatch {
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--chart-tone, var(--chart-slate));
}

.chart-legend__label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink-soft);
}

.chart-legend__value {
    font-weight: 650;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------- bar series --- */

.chart-bars {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chart-bar__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
}

.chart-bar__label {
    font-size: 12.5px;
    color: var(--ink-soft);
}

.chart-bar__value {
    font-size: 12.5px;
    font-weight: 650;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.chart-bar__track {
    height: 9px;
    border-radius: 999px;
    background: var(--surface-sunk);
    box-shadow: inset 0 0 0 1px var(--border);
    overflow: hidden;
}

.chart-bar__fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--chart-tone, var(--chart-slate));
    transition: width .85s var(--ease);
}

/* ------------------------------------------------------- utilisation meter --- */

.chart-meter {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.chart-meter__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.chart-meter__label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
}

.chart-meter__value {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.chart-meter__track {
    height: 10px;
    border-radius: 999px;
    background: var(--surface-sunk);
    box-shadow: inset 0 0 0 1px var(--border);
    overflow: hidden;
}

.chart-meter__fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--chart-blue), #60a5fa);
    transition: width .95s var(--ease);
}

/* Spend past the approved estimate is the one figure worth colouring red. */
.chart-meter.is-over .chart-meter__fill {
    background: linear-gradient(90deg, var(--chart-red), #f87171);
}

.chart-meter.is-over .chart-meter__value {
    color: var(--chart-red);
}

.chart-meter__caption,
.chart-note {
    margin: 0;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--muted);
}

.chart-note {
    display: flex;
    align-items: flex-start;
    gap: 7px;
}

.chart-note i {
    flex: none;
    margin-top: 1px;
    color: var(--muted-light);
}

@media (max-width: 575.98px) {
    .chart-donut {
        flex-direction: column;
        gap: 18px;
    }

    .chart-legend {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chart-donut__arc,
    .chart-bar__fill,
    .chart-meter__fill {
        transition: none;
    }
}

/* ======================================================= modern dashboard === */

.dashboard-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 22px;
    overflow: hidden;
    border: 1px solid rgba(37, 99, 235, .14);
    background:
        radial-gradient(520px 220px at 88% 12%, rgba(37, 99, 235, .16), transparent 62%),
        linear-gradient(135deg, #ffffff 0%, #f8fbff 48%, #eef6ff 100%);
}

.dashboard-hero::after {
    content: "";
    position: absolute;
    right: -80px;
    bottom: -115px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(37, 99, 235, .08);
    pointer-events: none;
}

.dashboard-hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
    color: var(--blue-700);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.dashboard-hero__eyebrow::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--green);
    box-shadow: 0 0 0 5px rgba(4, 120, 87, .12);
}

.dashboard-hero__stats {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(78px, 1fr));
    gap: 10px;
    align-self: center;
}

.dashboard-hero__stat {
    min-width: 78px;
    padding: 12px 13px;
    border: 1px solid rgba(37, 99, 235, .13);
    border-radius: 16px;
    background: rgba(255, 255, 255, .72);
    box-shadow: 0 12px 24px -22px rgba(13, 21, 38, .55);
    backdrop-filter: blur(10px);
}

.dashboard-hero__stat strong {
    display: block;
    color: var(--ink);
    font-size: 22px;
    line-height: 1;
    letter-spacing: -.03em;
}

.dashboard-hero__stat span {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.metric-card {
    min-height: 130px;
    border-color: rgba(148, 163, 184, .22);
    background:
        radial-gradient(120px 80px at 100% 0%, rgba(37, 99, 235, .09), transparent 72%),
        linear-gradient(180deg, #ffffff, #fbfdff);
}

.metric-card::before {
    height: 4px;
    background: linear-gradient(90deg, #2563eb, #38bdf8);
}

.metric-card__icon {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72), 0 10px 18px -14px rgba(37, 99, 235, .95);
}

.metric-card__hint {
    max-width: 90%;
    line-height: 1.45;
}

.chart-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.chart-card {
    overflow: hidden;
    border-color: rgba(148, 163, 184, .22);
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.chart-card .card__header {
    border-bottom: 0;
    background: transparent;
    padding-bottom: 6px;
}

.chart-card .card__body {
    padding-top: 8px;
}

.chart-donut__figure {
    flex-basis: 132px;
    width: 132px;
    height: 132px;
}

.chart-legend {
    gap: 7px;
}

.chart-bars {
    gap: 12px;
}

.chart-bar__track {
    height: 8px;
    background: #eef4fb;
}

.dashboard-drawers {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.dashboard-drawer {
    overflow: hidden;
    border-radius: 20px;
    border-color: rgba(148, 163, 184, .24);
    background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.dashboard-drawer--wide {
    grid-column: 1 / -1;
}

.dashboard-drawer__header {
    padding: 0;
    border-bottom: 0;
    background: transparent;
}

.dashboard-drawer__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    width: 100%;
    padding: 16px 18px;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.dashboard-drawer__toggle:hover {
    background: rgba(37, 99, 235, .04);
}

.dashboard-drawer__toggle:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.dashboard-drawer__title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.dashboard-drawer__icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 14px;
    background: linear-gradient(140deg, var(--blue-50), #e0f2fe);
    color: var(--blue-700);
}

.dashboard-drawer__subtitle {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.dashboard-drawer__meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}

.dashboard-drawer__meta i {
    transition: transform var(--dur) var(--ease);
}

.dashboard-drawer.is-open .dashboard-drawer__meta i {
    transform: rotate(180deg);
}

.dashboard-drawer__body {
    border-top: 1px solid var(--border);
}

.dashboard-drawer__body[hidden] {
    display: none;
}

.dashboard-drawer .quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    padding: 14px 16px 16px;
}

.dashboard-drawer .quick-action {
    border-radius: 16px;
    background:
        radial-gradient(90px 60px at 100% 0%, rgba(37, 99, 235, .08), transparent 72%),
        #ffffff;
}

.dashboard-drawer .fact-list {
    padding: 14px 16px 16px;
}

.dashboard-drawer .activity-list {
    padding: 6px 0;
}

.dashboard-drawer .activity-item {
    padding: 11px 18px;
}

@media (max-width: 991.98px) {
    .dashboard-hero {
        grid-template-columns: 1fr;
    }

    .dashboard-hero__stats {
        max-width: 460px;
    }

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

@media (max-width: 575.98px) {
    .dashboard-hero__stats {
        grid-template-columns: 1fr;
    }

    .dashboard-drawer__toggle {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-drawer__meta {
        margin-left: 50px;
    }
}

