/* ==========================================================================
   MHS TMS — design system
   Built on Bootstrap 5. Tokens first, then shell, then components.
   ========================================================================== */

:root {
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --sidebar-w: 260px;
    --header-h: 64px;

    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e6e9f0;
    --text: #0f172a;
    --muted: #64748b;

    --brand: #2563eb;
    --brand-600: #1d4ed8;
    --brand-50: #eff4ff;

    --side-bg: #0b1324;
    --side-bg-2: #111b31;
    --side-fg: #aab4c8;
    --side-muted: #5b6782;

    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 6px 16px -6px rgba(15, 23, 42, .08);
    --shadow-lg: 0 12px 32px -8px rgba(15, 23, 42, .18);

    --green: #16a34a;  --green-50: #ecfdf3;
    --amber: #d97706;  --amber-50: #fff8eb;
    --red: #dc2626;    --red-50: #fef2f2;
    --blue: #2563eb;   --blue-50: #eff4ff;
    --indigo: #4f46e5; --indigo-50: #eef2ff;
    --violet: #7c3aed; --violet-50: #f5f3ff;
    --slate: #475569;  --slate-50: #f1f5f9;

    --bs-body-font-family: var(--font);
    --bs-primary: var(--brand);
    --bs-primary-rgb: 37, 99, 235;
    --bs-border-color: var(--border);
    --bs-body-color: var(--text);
    --bs-link-color: var(--brand);
    --bs-link-hover-color: var(--brand-600);
}

html { -webkit-text-size-adjust: 100%; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: .9rem;
    letter-spacing: -.003em;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; }
.text-muted { color: var(--muted) !important; }
.fw-medium { font-weight: 500; }
.tabular, .table td, .kpi-value { font-variant-numeric: tabular-nums; }
.text-profit { color: var(--green); }
.text-loss { color: var(--red); }
.small-caps { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }

/* ---- Bootstrap refinements ------------------------------------------------ */
.btn {
    --bs-btn-padding-y: .5rem;
    --bs-btn-padding-x: .95rem;
    --bs-btn-font-size: .875rem;
    --bs-btn-font-weight: 500;
    --bs-btn-border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    transition: all .15s ease;
}
.btn-sm { --bs-btn-padding-y: .32rem; --bs-btn-padding-x: .65rem; --bs-btn-font-size: .8rem; --bs-btn-border-radius: 8px; gap: .35rem; }
.btn-primary {
    --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600);
    --bs-btn-active-bg: var(--brand-600);
    box-shadow: 0 1px 2px rgba(37, 99, 235, .3), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--border); --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-border-color: #d5dae4; }
.btn-soft { background: var(--brand-50); color: var(--brand); border: 0; }
.btn-soft:hover { background: #dfe9ff; color: var(--brand-600); }
.btn-icon { width: 34px; height: 34px; padding: 0; }

.form-control, .form-select {
    border-radius: 10px;
    border-color: #dfe3eb;
    padding: .55rem .8rem;
    font-size: .9rem;
    background-color: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus { border-color: #93b4f8; box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
.form-control-sm, .form-select-sm { padding: .35rem .6rem; font-size: .82rem; border-radius: 8px; }
.form-label, .control-label { font-weight: 500; font-size: .82rem; color: #334155; margin-bottom: .35rem; }
.form-text, .hint-block { font-size: .76rem; color: var(--muted); }
.invalid-feedback { font-size: .78rem; }
.has-error .form-control, .has-error .form-select { border-color: var(--red); }
.required > .form-label::after, .required > label::after { content: " *"; color: var(--red); }
.input-group-text { background: var(--surface-2); border-color: #dfe3eb; border-radius: 10px; color: var(--muted); }

.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header { background: transparent; border-bottom: 1px solid var(--border); padding: .9rem 1.15rem; font-weight: 600; }
.card-body { padding: 1.15rem; }
.card-footer { background: var(--surface-2); border-top: 1px solid var(--border); }
.card-title-sm { font-size: .95rem; font-weight: 600; margin: 0; display: flex; align-items: center; gap: .5rem; }
.card-title-sm i { color: var(--muted); }

.alert { border-radius: 12px; border: 1px solid transparent; font-size: .875rem; }
.alert-success { background: var(--green-50); border-color: #bbf7d0; color: #14532d; }
.alert-danger { background: var(--red-50); border-color: #fecaca; color: #7f1d1d; }
.alert-warning { background: var(--amber-50); border-color: #fde68a; color: #78350f; }
.alert-info { background: var(--blue-50); border-color: #c7d7fe; color: #1e3a8a; }

.dropdown-menu { border-radius: 12px; border-color: var(--border); box-shadow: var(--shadow-lg); padding: .4rem; font-size: .875rem; }
.dropdown-item { border-radius: 8px; padding: .45rem .7rem; display: flex; align-items: center; gap: .55rem; }
.nav-tabs { border-bottom: 1px solid var(--border); gap: .25rem; }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 500; padding: .65rem .9rem; }
.nav-tabs .nav-link:hover { color: var(--text); }
.nav-tabs .nav-link.active { color: var(--brand); border-bottom-color: var(--brand); background: transparent; }
.nav-tabs .nav-link .count { background: var(--slate-50); color: var(--slate); border-radius: 99px; font-size: .7rem; padding: .05rem .45rem; margin-left: .3rem; }
.modal-content { border-radius: 16px; border: 0; box-shadow: var(--shadow-lg); }
.modal-header, .modal-footer { border-color: var(--border); }
.breadcrumb { --bs-breadcrumb-divider: "›"; font-size: .8rem; margin-bottom: .75rem; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }

/* ---- Shell: sidebar ------------------------------------------------------- */
.app-sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg-2) 100%);
    color: var(--side-fg); overflow-y: auto; overflow-x: hidden; z-index: 1040;
    overscroll-behavior: contain; /* scrolling the menu never scrolls the page */
    transition: transform .25s ease; scrollbar-width: thin; scrollbar-color: #3b4a6b transparent;
}
.app-sidebar::-webkit-scrollbar { width: 8px; }
.app-sidebar::-webkit-scrollbar-track { background: transparent; }
.app-sidebar::-webkit-scrollbar-thumb { background: #33415f; border-radius: 99px; border: 2px solid var(--side-bg); }
.app-sidebar:hover::-webkit-scrollbar-thumb { background: #4b5b80; }
.app-brand {
    display: flex; align-items: center; gap: .7rem; height: var(--header-h); padding: 0 1.25rem;
    color: #fff; font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em;
    /* logo stays pinned while the menu scrolls under it */
    position: sticky; top: 0; z-index: 2; background: var(--side-bg); border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.app-brand:hover { color: #fff; }
.app-brand-mark {
    width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
    background: linear-gradient(135deg, #3b82f6, #6366f1); color: #fff; font-size: 1.15rem;
    box-shadow: 0 6px 16px -4px rgba(59, 130, 246, .6);
}
.app-brand small { display: block; font-weight: 500; font-size: .68rem; color: var(--side-muted); letter-spacing: .04em; text-transform: uppercase; }
.app-nav { padding: .5rem .75rem 2rem; }
.app-nav-title { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; color: var(--side-muted); padding: 1.1rem .75rem .4rem; font-weight: 600; }
.app-nav-link {
    display: flex; align-items: center; gap: .75rem; padding: .55rem .75rem; border-radius: 10px;
    color: var(--side-fg); margin-bottom: 2px; font-weight: 500; font-size: .875rem; position: relative;
}
.app-nav-link i { font-size: 1.05rem; width: 1.25rem; text-align: center; opacity: .85; }
.app-nav-link:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.app-nav-link.active { background: rgba(59, 130, 246, .16); color: #fff; }
.app-nav-link.active::before { content: ""; position: absolute; left: -.75rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #3b82f6; }
.app-nav-link.active i { color: #60a5fa; opacity: 1; }
.app-nav-link .nav-count { margin-left: auto; background: #ef4444; color: #fff; font-size: .68rem; border-radius: 99px; padding: .05rem .45rem; font-weight: 600; }

/* ---- Shell: header + content --------------------------------------------- */
.app-main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.app-header {
    position: sticky; top: 0; z-index: 1030; height: var(--header-h);
    display: flex; align-items: center; gap: .9rem; padding: 0 1.5rem;
    background: rgba(255, 255, 255, .85); backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
}
.app-sidebar-toggle { display: none; }
.app-mobile-brand { display: none; align-items: center; gap: .5rem; color: var(--text); font-size: .95rem; }
.app-mobile-brand .app-brand-mark { width: 30px; height: 30px; border-radius: 8px; font-size: .95rem; box-shadow: none; }
.app-search { position: relative; max-width: 380px; flex: 1; }
.app-search i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.app-search input { padding-left: 2.2rem; background: var(--surface-2); border-color: transparent; }
.app-search input:focus { background: #fff; }
.app-search kbd { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); background: #fff; color: var(--muted); border: 1px solid var(--border); font-size: .68rem; box-shadow: none; }
.header-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--slate); border: 1px solid var(--border); background: #fff; }
.header-btn:hover { color: var(--brand); border-color: #c9d6f3; }
.header-btn .dot { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; border-radius: 99px; background: var(--red); color: #fff; font-size: .65rem; font-weight: 700; display: grid; place-items: center; padding: 0 4px; border: 2px solid #fff; }
.user-chip { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem .25rem .25rem; border-radius: 99px; color: var(--text); }
.user-chip:hover { background: var(--surface-2); color: var(--text); }
.user-chip .who { line-height: 1.15; }
.user-chip .who small { color: var(--muted); font-size: .72rem; display: block; }

.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; background: linear-gradient(135deg, #dbeafe, #e0e7ff); color: var(--brand-600); font-weight: 700; font-size: .78rem; flex: none; }
.avatar.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar.avatar-sm { width: 26px; height: 26px; font-size: .65rem; }

.app-content { padding: 1.5rem; flex: 1; width: 100%; max-width: 1600px; }
.app-footer { display: flex; justify-content: space-between; padding: 1rem 1.5rem; color: var(--muted); font-size: .78rem; border-top: 1px solid var(--border); }

/* ---- Page header ------------------------------------------------------------ */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head-text { display: flex; gap: .9rem; align-items: center; min-width: 0; }
.page-head-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-size: 1.3rem; flex: none; }
.page-head-title { font-size: 1.35rem; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.page-head-sub { color: var(--muted); font-size: .85rem; margin-top: .15rem; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.page-head-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---- Status pills ------------------------------------------------------------ */
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem .2rem .5rem; border-radius: 99px; font-size: .74rem; font-weight: 600; white-space: nowrap; line-height: 1.4; }
.pill i { font-size: .78rem; }
.pill-green { background: var(--green-50); color: #15803d; box-shadow: inset 0 0 0 1px #bbf7d0; }
.pill-amber { background: var(--amber-50); color: #b45309; box-shadow: inset 0 0 0 1px #fde68a; }
.pill-red { background: var(--red-50); color: #b91c1c; box-shadow: inset 0 0 0 1px #fecaca; }
.pill-blue { background: var(--blue-50); color: #1d4ed8; box-shadow: inset 0 0 0 1px #c7d7fe; }
.pill-indigo { background: var(--indigo-50); color: #4338ca; box-shadow: inset 0 0 0 1px #c7d2fe; }
.pill-violet { background: var(--violet-50); color: #6d28d9; box-shadow: inset 0 0 0 1px #ddd6fe; }
.pill-slate { background: var(--slate-50); color: #334155; box-shadow: inset 0 0 0 1px #e2e8f0; }
.tag { display: inline-block; padding: .1rem .5rem; border-radius: 6px; background: var(--slate-50); color: var(--slate); font-size: .74rem; font-weight: 500; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }
.id-link { font-weight: 600; color: var(--brand); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }

/* ---- KPI cards ------------------------------------------------------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { display: flex; gap: .9rem; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow-sm); color: var(--text); transition: transform .15s, box-shadow .15s; }
.kpi-link:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--text); }
.kpi-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; flex: none; }
.kpi-blue { background: var(--blue-50); color: var(--blue); }
.kpi-green { background: var(--green-50); color: var(--green); }
.kpi-amber { background: var(--amber-50); color: var(--amber); }
.kpi-red { background: var(--red-50); color: var(--red); }
.kpi-violet { background: var(--violet-50); color: var(--violet); }
.kpi-indigo { background: var(--indigo-50); color: var(--indigo); }
.kpi-slate { background: var(--slate-50); color: var(--slate); }
.kpi-label { font-size: .78rem; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.kpi-hint { font-size: .74rem; color: var(--muted); margin-top: .1rem; }

/* ---- Data tables / grids --------------------------------------------------- */
.grid-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.data-table { font-size: .86rem; }
.data-table thead th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); padding: .75rem 1rem; white-space: nowrap; }
.data-table thead th a { color: var(--muted); }
.data-table thead th a.asc::after { content: " ↑"; } .data-table thead th a.desc::after { content: " ↓"; }
.data-table td { padding: .75rem 1rem; border-color: #eef1f6; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { --bs-table-hover-bg: #f8faff; }
.data-table .filters td { padding: .5rem 1rem; background: #fcfdff; }
.data-table .filters .form-control, .data-table .filters .form-select { padding: .3rem .55rem; font-size: .8rem; border-radius: 8px; }
.data-table tfoot td { background: var(--surface-2); font-weight: 600; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { font-size: .76rem; color: var(--muted); }
.row-actions { display: flex; gap: .25rem; justify-content: flex-end; }
.row-actions a { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.row-actions a:hover { background: var(--brand-50); color: var(--brand); }
.grid-foot { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; gap: .5rem; }
.grid-summary { font-size: .8rem; color: var(--muted); }
.pagination { --bs-pagination-border-radius: 8px; --bs-pagination-color: var(--slate); --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand); gap: 3px; }
.pagination .page-link { border-radius: 8px !important; }

/* ---- Filter bar ------------------------------------------------------------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; margin-bottom: 1rem; box-shadow: var(--shadow-sm); }
.filter-bar .fb-item { min-width: 150px; flex: 1 1 150px; max-width: 240px; }
.filter-bar .fb-item.fb-wide { max-width: 340px; flex-basis: 240px; }
.filter-bar label { font-size: .72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .25rem; }
.filter-bar .fb-actions { display: flex; gap: .4rem; }
.quick-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.quick-tabs a { padding: .4rem .85rem; border-radius: 99px; background: #fff; border: 1px solid var(--border); color: var(--slate); font-size: .8rem; font-weight: 500; }
.quick-tabs a:hover { border-color: #c9d6f3; color: var(--brand); }
.quick-tabs a.active { background: var(--text); color: #fff; border-color: var(--text); }
.quick-tabs a .n { opacity: .65; margin-left: .3rem; }

/* ---- Detail pages ------------------------------------------------------------ */
.detail-list { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: .55rem 1rem; margin: 0; font-size: .875rem; }
.detail-list dt { color: var(--muted); font-weight: 500; }
.detail-list dd { margin: 0; word-break: break-word; }
.hero-card { background: linear-gradient(135deg, #ffffff 0%, #f6f9ff 100%); }
.route { display: flex; gap: 1rem; align-items: stretch; }
.route-points { display: flex; flex-direction: column; align-items: center; padding-top: .3rem; }
.route-points .rp { width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--brand); background: #fff; }
.route-points .rp.end { border-color: var(--green); }
.route-points .rl { flex: 1; width: 2px; background: repeating-linear-gradient(var(--border) 0 4px, transparent 4px 8px); margin: 4px 0; min-height: 28px; }
.route-stops { flex: 1; display: flex; flex-direction: column; gap: 1rem; }
.route-stop .city { font-weight: 600; }
.route-stop .addr { color: var(--muted); font-size: .82rem; }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.stat-strip > div { padding: .8rem 1rem; border-right: 1px solid var(--border); }
.stat-strip > div:last-child { border-right: 0; }
.stat-strip .s-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat-strip .s-value { font-size: 1.1rem; font-weight: 700; margin-top: .15rem; }

/* ---- Trip stepper ------------------------------------------------------------ */
.stepper { list-style: none; display: flex; padding: 0; margin: 0; counter-reset: s; }
.step { flex: 1; position: relative; text-align: center; padding: 0 .25rem; }
.step::before { content: ""; position: absolute; top: 15px; left: -50%; right: 50%; height: 3px; background: var(--border); z-index: 0; }
.step:first-child::before { display: none; }
.step-done::before, .step-current::before { background: var(--brand); }
.step-dot { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; background: #fff; border: 2px solid var(--border); color: var(--muted); font-weight: 700; font-size: .8rem; }
.step-done .step-dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.step-current .step-dot { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 5px rgba(37, 99, 235, .15); }
.step-label { display: block; font-size: .78rem; font-weight: 600; margin-top: .45rem; color: var(--text); }
.step-todo .step-label { color: var(--muted); font-weight: 500; }
.step-time { display: block; font-size: .7rem; color: var(--muted); }
.stepper-cancelled .step-done .step-dot { background: var(--slate); border-color: var(--slate); }
.stepper-cancelled .step::before { background: var(--border); }

/* ---- Timeline (status history / activity) ------------------------------------ */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 1.1rem 46px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-icon { position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--border); color: var(--muted); font-size: .85rem; }
.tl-item.tone-green .tl-icon { border-color: #86efac; color: var(--green); background: var(--green-50); }
.tl-item.tone-blue .tl-icon { border-color: #a5c0fb; color: var(--blue); background: var(--blue-50); }
.tl-item.tone-violet .tl-icon { border-color: #c4b5fd; color: var(--violet); background: var(--violet-50); }
.tl-item.tone-indigo .tl-icon { border-color: #a5b4fc; color: var(--indigo); background: var(--indigo-50); }
.tl-item.tone-red .tl-icon { border-color: #fca5a5; color: var(--red); background: var(--red-50); }
.tl-item.tone-amber .tl-icon { border-color: #fcd34d; color: var(--amber); background: var(--amber-50); }
.tl-title { font-weight: 600; font-size: .875rem; }
.tl-meta { font-size: .76rem; color: var(--muted); }
.tl-body { font-size: .84rem; margin-top: .25rem; background: var(--surface-2); border-radius: 8px; padding: .45rem .65rem; }

/* ---- Documents ------------------------------------------------------------------ */
.doc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .65rem; }
.doc-item { display: flex; gap: .65rem; align-items: center; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: 10px; background: #fff; min-width: 0; }
.doc-item:hover { border-color: #c9d6f3; box-shadow: var(--shadow-sm); }
.doc-thumb { width: 40px; height: 40px; border-radius: 8px; flex: none; display: grid; place-items: center; font-size: 1.2rem; background: var(--slate-50); color: var(--slate); overflow: hidden; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-thumb.pdf { background: var(--red-50); color: var(--red); }
.doc-meta { min-width: 0; flex: 1; }
.doc-name { font-weight: 600; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); display: block; }
.doc-sub { font-size: .72rem; color: var(--muted); }
.dropzone { border: 2px dashed #d5dbe7; border-radius: 12px; padding: 1rem; text-align: center; background: var(--surface-2); color: var(--muted); cursor: pointer; transition: all .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }
.dropzone input[type=file] { display: none; }
.dropzone .dz-files { font-size: .78rem; color: var(--text); margin-top: .35rem; }

/* ---- Forms -------------------------------------------------------------------- */
.form-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1rem; box-shadow: var(--shadow-sm); }
.form-section-head { padding: .9rem 1.15rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .65rem; }
.form-section-head .fs-icon { width: 32px; height: 32px; border-radius: 9px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; }
.form-section-head h3 { font-size: .95rem; font-weight: 600; margin: 0; }
.form-section-head p { font-size: .78rem; color: var(--muted); margin: 0; }
.form-section-body { padding: 1.15rem; }
.form-actions {
    position: sticky; bottom: 0; z-index: 10; display: flex; gap: .5rem; justify-content: flex-end; align-items: center;
    padding: .85rem 1.15rem; margin: 0 -1.5rem -1.5rem; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
}
.form-actions .fa-note { margin-right: auto; font-size: .8rem; color: var(--muted); }
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
.choice-card { position: relative; }
.choice-card input { position: absolute; opacity: 0; }
.choice-card label { display: block; border: 1.5px solid var(--border); border-radius: 12px; padding: .75rem .9rem; cursor: pointer; background: #fff; transition: all .15s; }
.choice-card label b { display: block; font-size: .88rem; }
.choice-card label span { font-size: .75rem; color: var(--muted); }
.choice-card input:checked + label { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.calc-box { background: linear-gradient(135deg, #eff4ff, #f5f3ff); border: 1px solid #dbe4ff; border-radius: 12px; padding: .9rem 1rem; }
.calc-box .calc-value { font-size: 1.5rem; font-weight: 700; color: var(--brand-600); }

/* ---- Empty states ------------------------------------------------------------ */
.empty-state { text-align: center; padding: 2.75rem 1rem; }
.empty-state .empty-icon { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto .9rem; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); font-size: 1.6rem; }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: .3rem; }
.empty-state p { color: var(--muted); font-size: .85rem; max-width: 380px; margin: 0 auto 1rem; }

/* ---- Alerts list (dashboard) ------------------------------------------------- */
.alert-row { display: flex; gap: .75rem; align-items: center; padding: .65rem 0; border-bottom: 1px solid #eef1f6; }
.alert-row:last-child { border-bottom: 0; }
.alert-row .ar-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.alert-row .ar-text { flex: 1; min-width: 0; font-size: .84rem; }
.alert-row .ar-text b { display: block; font-weight: 600; }
.alert-row .ar-text span { color: var(--muted); font-size: .76rem; }
.expiry { display: inline-flex; gap: .3rem; align-items: center; white-space: nowrap; }
.expiry-red { color: var(--red); font-weight: 600; }
.expiry-amber { color: var(--amber); font-weight: 600; }
.progress-thin { height: 6px; border-radius: 99px; background: var(--slate-50); }
.progress-thin .progress-bar { border-radius: 99px; }
.chart-box { position: relative; height: 260px; }

/* ---- Auth -------------------------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art {
    background: radial-gradient(1200px 600px at 10% 10%, #1e3a8a 0%, transparent 60%), radial-gradient(900px 600px at 90% 90%, #4c1d95 0%, transparent 60%), #0b1324;
    color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.auth-art h1 { font-size: 2.3rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; max-width: 480px; }
.auth-art p { color: #aab4c8; max-width: 440px; font-size: 1rem; }
.auth-art .auth-feats { display: grid; gap: .8rem; max-width: 420px; }
.auth-art .auth-feat { display: flex; gap: .8rem; align-items: center; color: #dbe3f3; font-size: .9rem; }
.auth-art .auth-feat i { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .08); color: #93c5fd; }
.auth-art .truck-lines { position: absolute; right: -60px; bottom: 40px; font-size: 16rem; color: rgba(255, 255, 255, .04); }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2rem; background: #fff; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h2 { font-weight: 700; letter-spacing: -.02em; }

/* ---- Print / documents -------------------------------------------------------- */
.app-print { background: #e9edf3; }
.app-print-page { background: #fff; max-width: 210mm; margin: 1.5rem auto; padding: 14mm; box-shadow: var(--shadow-lg); font-size: 12px; }
.doc-title { font-size: 20px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--brand-600); }
.doc-table { width: 100%; border-collapse: collapse; }
.doc-table th, .doc-table td { border: 1px solid #cfd6e2; padding: 5px 7px; vertical-align: top; }
.doc-table th { background: #f1f5f9; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.doc-box { border: 1px solid #cfd6e2; border-radius: 6px; padding: 8px 10px; height: 100%; }
.doc-box .lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.sign-box { border-top: 1px solid #94a3b8; padding-top: 4px; text-align: center; font-size: 11px; color: var(--muted); margin-top: 48px; }
@media print {
    body, .app-print { background: #fff; }
    .app-print-page { box-shadow: none; margin: 0; padding: 0; max-width: none; }
    .app-sidebar, .app-header, .app-footer, .form-actions { display: none !important; }
    .app-main { margin: 0; }
}

/* ---- Responsive ------------------------------------------------------------------ */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .app-sidebar-open .app-sidebar { transform: none; }
    .app-sidebar-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1035; display: none; }
    .app-sidebar-open .app-sidebar-backdrop { display: block; }
    .app-main { margin-left: 0; }
    .app-sidebar-toggle { display: inline-grid; }
    .app-mobile-brand { display: inline-flex; }
    .app-search { display: none; }
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-art { display: none; }
}
@media (max-width: 575.98px) {
    .app-content { padding: 1rem; }
    .app-header { padding: 0 1rem; }
    .page-head-title { font-size: 1.15rem; }
    .page-head-icon { display: none; }
    .page-head-actions { width: 100%; }
    .page-head-actions > .btn, .page-head-actions > .btn-group { flex: 1; }
    .form-actions { margin: 0 -1rem -1rem; }
    .form-actions .btn { flex: 1; }
    .form-actions .fa-note { display: none; }
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: .6rem; }
    .kpi { flex-direction: column; align-items: flex-start; padding: .85rem; gap: .5rem; }
    .kpi-value { font-size: 1.15rem; }
    .stepper { flex-direction: column; gap: .5rem; }
    .step { text-align: left; display: flex; align-items: center; gap: .6rem; }
    .step::before { display: none; }
    .step-label { margin: 0; }
    .detail-list { grid-template-columns: 1fr; gap: .1rem; }
    .detail-list dd { margin-bottom: .55rem; }
    .filter-bar .fb-item { max-width: none; flex-basis: 100%; }
    .data-table td, .data-table th { padding: .6rem .7rem; }
    .user-chip .who { display: none; }
}

/* IDs (TRP-000001, INV-…) never wrap mid-number in tables */
.data-table td:first-child, .data-table .id-link, .id-link { white-space: nowrap; }

/* ---- Login: centred brand block (icon / name / company) ----------------------- */
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .35rem; color: #fff; }
.auth-brand .app-brand-mark { width: 56px; height: 56px; border-radius: 16px; font-size: 1.6rem; margin-bottom: .35rem; }
.auth-brand b { font-size: 1.35rem; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.auth-brand small { font-size: .78rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: #94a3b8; }
.auth-brand-light { color: var(--text); margin-bottom: 1.75rem; }
.auth-brand-light small { color: var(--muted); }
