:root {
    --admin-sidebar-width: 276px;
    --admin-bg: #f5f7fb;
    --admin-panel: #ffffff;
    --admin-panel-soft: #f9fbfe;
    --admin-line: #d9e2ee;
    --admin-line-soft: #edf1f6;
    --admin-text: #1f2937;
    --admin-muted: #667085;
    --admin-faint: #98a2b3;
    --admin-primary: #078EFF;
    --admin-primary-dark: #056fc8;
    --admin-success: #18a957;
    --admin-warning: #d99a00;
    --admin-danger: #d64242;
    --admin-info: #2166c2;
    --admin-shadow: 0 10px 28px rgba(16, 24, 40, .07);
}

* {
    letter-spacing: 0;
}

body {
    background: var(--admin-bg);
    color: var(--admin-text);
    font-size: .94rem;
}

a {
    color: var(--admin-primary-dark);
}

.login-page {
    background: var(--admin-bg);
}

.admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--admin-sidebar-width);
    background: #111827;
    border-right: 1px solid rgba(255, 255, 255, .08);
    color: #e5e7eb;
    flex-direction: column;
    z-index: 1030;
}

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

@media (min-width: 992px) {
    .admin-shell {
        margin-left: var(--admin-sidebar-width);
    }
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .8rem;
    min-height: 78px;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-logo {
    width: 46px;
    height: 46px;
    object-fit: contain;
    border-radius: 8px;
    background: #ffffff;
}

.brand-kicker {
    color: #9ca3af;
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.sidebar-nav {
    gap: .15rem;
    overflow-y: auto;
    padding: .85rem;
}

.nav-section-label {
    color: #9ca3af;
    font-size: .68rem;
    font-weight: 800;
    margin: 1rem .65rem .4rem;
    text-transform: uppercase;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 42px;
    border-radius: 8px;
    color: #d1d5db;
    font-weight: 700;
    padding: .55rem .65rem;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, .07);
    color: #ffffff;
}

.sidebar-nav .nav-link.active {
    background: #ffffff;
    color: #111827;
}

.sidebar-nav .bi {
    width: 1.25rem;
    text-align: center;
}

.nav-count {
    margin-left: auto;
    min-width: 1.55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    color: #e5e7eb;
    font-size: .7rem;
    font-weight: 800;
    padding: .12rem .42rem;
    text-align: center;
}

.nav-link.active .nav-count {
    background: #eef4ff;
    color: var(--admin-primary-dark);
}

.sidebar-footer {
    margin-top: auto;
    padding: 1rem 1.15rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 78px;
    padding: .9rem 1.25rem;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--admin-line);
}

.topbar h1 {
    color: var(--admin-text);
    font-size: 1.25rem;
    font-weight: 850;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.admin-search {
    align-items: center;
    background: var(--admin-panel-soft);
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    gap: .55rem;
    min-height: 40px;
    padding: 0 .75rem;
    width: min(340px, 28vw);
}

.admin-search .bi {
    color: var(--admin-muted);
}

.admin-search input {
    background: transparent;
    border: 0;
    color: var(--admin-text);
    font-size: .86rem;
    min-width: 0;
    outline: 0;
    width: 100%;
}

.topbar-meta {
    color: var(--admin-muted);
    font-size: .8rem;
    text-align: right;
}

.admin-content {
    padding: 1.25rem;
}

@media (min-width: 768px) {
    .admin-content,
    .topbar {
        padding-left: 1.75rem;
        padding-right: 1.75rem;
    }
}

@media (max-width: 767.98px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .topbar-meta {
        display: none;
    }
}

.card,
.admin-card {
    background: var(--admin-panel);
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    box-shadow: none;
}

.card.border-0 {
    border: 1px solid var(--admin-line) !important;
}

.shadow-sm {
    box-shadow: none !important;
}

.rounded-4 {
    border-radius: 8px !important;
}

.card-header,
.admin-card-header {
    background: var(--admin-panel);
    border-bottom: 1px solid var(--admin-line-soft);
    padding: 1rem 1.1rem;
}

.admin-card-title {
    color: var(--admin-text);
    font-size: .98rem;
    font-weight: 850;
    margin: 0;
}

.admin-card-subtitle {
    color: var(--admin-muted);
    font-size: .78rem;
    margin-top: .15rem;
}

.btn {
    border-radius: 7px;
    font-weight: 750;
}

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

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

.btn-dark {
    background: #111827;
    border-color: #111827;
}

.table {
    color: var(--admin-text);
}

.table thead th {
    background: var(--admin-panel-soft);
    border-bottom: 1px solid var(--admin-line);
    color: var(--admin-muted);
    font-size: .72rem;
    font-weight: 850;
    padding-bottom: .72rem;
    padding-top: .72rem;
    text-transform: uppercase;
}

.table td {
    border-bottom-color: var(--admin-line-soft);
    padding-bottom: .85rem;
    padding-top: .85rem;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: #fbfdff;
}

.table td,
.table th {
    white-space: nowrap;
}

.record-title {
    color: var(--admin-text);
    font-weight: 850;
}

.record-meta {
    color: var(--admin-muted);
    font-size: .78rem;
    margin-top: .1rem;
}

.driver-documents {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    min-width: 220px;
}

.metric-card {
    border-left: 4px solid var(--metric-color, var(--admin-primary));
    min-height: 138px;
}

.metric-label {
    color: var(--admin-muted);
    font-size: .76rem;
    font-weight: 850;
    text-transform: uppercase;
}

.metric-value {
    color: var(--admin-text);
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
    margin-top: .75rem;
}

.metric-note {
    color: var(--admin-muted);
    font-size: .78rem;
    margin-top: .45rem;
}

.metric-icon,
.section-icon {
    display: grid;
    place-items: center;
    border-radius: 8px;
    height: 38px;
    width: 38px;
}

.metric-icon {
    background: #eef4ff;
    color: var(--metric-color, var(--admin-primary));
}

.section-icon {
    background: #eef4ff;
    color: var(--admin-primary-dark);
}

.status-badge {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    display: inline-flex;
    font-size: .72rem;
    font-weight: 850;
    gap: .35rem;
    line-height: 1;
    padding: .35rem .55rem;
    text-transform: capitalize;
}

.status-badge::before {
    border-radius: 999px;
    content: "";
    height: .42rem;
    width: .42rem;
}

.status-success {
    background: #ecfdf3;
    border-color: #abefc6;
    color: #067647;
}

.status-success::before {
    background: #17b26a;
}

.status-warning {
    background: #fffaeb;
    border-color: #fedf89;
    color: #b54708;
}

.status-warning::before {
    background: #f79009;
}

.status-danger {
    background: #fef3f2;
    border-color: #fecdca;
    color: #b42318;
}

.status-danger::before {
    background: #f04438;
}

.status-info {
    background: #eff8ff;
    border-color: #b2ddff;
    color: #175cd3;
}

.status-info::before {
    background: #2e90fa;
}

.status-muted {
    background: #f2f4f7;
    border-color: #e4e7ec;
    color: #475467;
}

.status-muted::before {
    background: #98a2b3;
}

.ops-list {
    display: grid;
    gap: .75rem;
}

.ops-item {
    align-items: center;
    border: 1px solid var(--admin-line-soft);
    border-radius: 8px;
    display: flex;
    gap: .8rem;
    justify-content: space-between;
    padding: .85rem;
}

.ops-item:hover {
    background: var(--admin-panel-soft);
}

.media-thumb {
    background: #eef3fa;
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    height: 58px;
    object-fit: cover;
    width: 58px;
}

.detail-grid {
    display: grid;
    gap: .85rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.detail-card {
    background: var(--admin-panel-soft);
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    padding: .9rem;
}

.detail-card h4 {
    color: var(--admin-muted);
    font-size: .72rem;
    font-weight: 850;
    margin-bottom: .35rem;
    text-transform: uppercase;
}

.detail-card p {
    color: var(--admin-text);
    margin-bottom: 0;
}

.form-control,
.form-select {
    border-color: var(--admin-line);
    border-radius: 7px;
}

.form-label {
    color: var(--admin-text);
    font-size: .82rem;
}

.modal-content {
    border: 1px solid var(--admin-line);
    border-radius: 8px;
}

.stat-card h2 {
    color: var(--admin-text);
    font-weight: 900;
}

.stat-icon {
    display: grid;
    height: 40px;
    place-items: center;
    width: 40px;
    border-radius: 8px;
}

.finance-chart {
    align-items: stretch;
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    min-height: 300px;
}

.finance-chart-group {
    display: grid;
    gap: .65rem;
    grid-template-rows: 190px auto auto;
    min-width: 0;
}

.finance-bars {
    align-items: end;
    background:
        linear-gradient(to top, var(--admin-line-soft) 1px, transparent 1px) 0 0 / 100% 25%,
        var(--admin-panel-soft);
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    display: grid;
    gap: .35rem;
    grid-template-columns: repeat(2, minmax(14px, 1fr));
    padding: .75rem .65rem;
}

.finance-bar {
    border-radius: 6px 6px 2px 2px;
    min-height: 0;
    transition: height .25s ease;
}

.finance-bar-payment {
    background: var(--admin-primary);
}

.finance-bar-refund {
    background: var(--admin-danger);
}

.finance-bar-payout {
    background: var(--admin-success);
}

.finance-period {
    color: var(--admin-text);
    font-size: .82rem;
    font-weight: 850;
    text-align: center;
}

.finance-values {
    color: var(--admin-muted);
    display: grid;
    font-size: .72rem;
    gap: .15rem;
    line-height: 1.25;
    min-width: 0;
    text-align: center;
}

.finance-values span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.finance-legend {
    align-items: center;
    color: var(--admin-muted);
    display: flex;
    flex-wrap: wrap;
    font-size: .78rem;
    font-weight: 750;
    gap: .9rem;
}

.finance-dot {
    border-radius: 999px;
    display: inline-block;
    height: .65rem;
    margin-right: .35rem;
    vertical-align: middle;
    width: .65rem;
}

.finance-dot-payment {
    background: var(--admin-primary);
}

.finance-dot-refund {
    background: var(--admin-danger);
}

.finance-dot-payout {
    background: var(--admin-success);
}

.offcanvas .sidebar-brand {
    display: none;
}

/* Shared workflow and accessible interaction styles. */
:root { --admin-primary: #0758a6; --admin-primary-dark: #064782; }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 2000; padding: 12px 18px; background: white; border: 2px solid var(--admin-primary); border-radius: 8px; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 3px solid #0758a6; outline-offset: 3px; }
.admin-search[hidden] { display: none !important; }
.form-control, .form-select { min-height: 44px; }
.btn { min-height: 40px; }
.table th { white-space: nowrap; }
.table td { vertical-align: middle; }
.offcanvas .sidebar-nav .nav-link { color: #334155; }
.offcanvas .sidebar-nav .nav-link.active { color: white; background: var(--admin-primary); }
@media (max-width: 767px) {
    .topbar { flex-wrap: wrap; gap: 12px; }
    .topbar-actions { width: 100%; flex-wrap: wrap; justify-content: flex-end; }
    .admin-content { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* ==========================================================================
   Design layer v2 - typography, elevation and polish.
   Loaded last on purpose: it refines the rules above rather than replacing
   them, so every page picks it up without markup changes.
   ========================================================================== */
:root {
    --admin-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bs-body-font-family: var(--admin-font);
    --admin-radius: 14px;
    --admin-radius-sm: 10px;
    --admin-ring: 0 0 0 4px rgba(7, 88, 166, .14);
    --admin-hairline: rgba(16, 24, 40, .07);
    --admin-shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px rgba(16, 24, 40, .05);
    --admin-shadow-md: 0 12px 32px rgba(16, 24, 40, .10);
    --admin-nav-bg: linear-gradient(180deg, #0c2340 0%, #091a30 100%);
    --admin-nav-text: #b8c5d6;
    --admin-nav-icon: #7f93ad;
    --admin-nav-accent: #3ea1ff;
    --admin-nav-accent-rgb: 62, 161, 255;
}

/* Role theming: the platform owner gets a violet accent and a darker rail, a
   company admin keeps the brand blue, so the two workspaces are never confused. */
body.role-super {
    --admin-nav-bg: linear-gradient(180deg, #1a1440 0%, #0d0b28 100%);
    --admin-nav-accent: #a596ff;
    --admin-nav-accent-rgb: 165, 150, 255;
    --admin-nav-icon: #8f88b8;
    --admin-nav-text: #c3c0dd;
}

body {
    background: #f3f6fb;
    font-family: var(--admin-font);
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 { letter-spacing: -.01em; }

/* ---------- Sidebar ---------- */
.admin-sidebar {
    background: var(--admin-nav-bg);
    border-right: 0;
    box-shadow: 1px 0 0 rgba(255, 255, 255, .04);
}

.sidebar-brand { border-bottom-color: rgba(255, 255, 255, .07); }

.brand-logo {
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .28);
    padding: 3px;
}

.brand-kicker { color: #7f93ad; letter-spacing: .08em; }
.nav-section-label { color: #6f849f; letter-spacing: .1em; }
/* Bootstrap's .nav wraps by default, which spilled links into a second column on
   short windows. Keep one column and let it scroll instead. */
.sidebar-nav { flex: 1 1 auto; flex-wrap: nowrap; min-height: 0; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
.sidebar-nav .nav-link { flex-shrink: 0; }
.status-badge { white-space: nowrap; }

.sidebar-nav .nav-link {
    border-radius: var(--admin-radius-sm);
    color: var(--admin-nav-text);
    font-weight: 600;
    position: relative;
    transition: background .15s ease, color .15s ease;
}

.sidebar-nav .nav-link .bi { color: var(--admin-nav-icon); transition: color .15s ease; }
.sidebar-nav .nav-link:hover { background: rgba(255, 255, 255, .06); color: #ffffff; }
.sidebar-nav .nav-link:hover .bi { color: #cfe0f5; }

.sidebar-nav .nav-link.active {
    background: linear-gradient(90deg, rgba(var(--admin-nav-accent-rgb), .24), rgba(var(--admin-nav-accent-rgb), .06));
    color: #ffffff;
}

.sidebar-nav .nav-link.active .bi { color: #74bcff; }

.sidebar-nav .nav-link.active::before {
    background: var(--admin-nav-accent);
    border-radius: 0 4px 4px 0;
    bottom: 9px;
    content: "";
    left: -.85rem;
    position: absolute;
    top: 9px;
    width: 4px;
}

.nav-count { background: rgba(var(--admin-nav-accent-rgb), .22); color: #ffffff; }
.nav-link.active .nav-count { background: var(--admin-nav-accent); color: #ffffff; }
.sidebar-footer { border-top-color: rgba(255, 255, 255, .07); }

/* The mobile drawer is a light surface: keep its links legible. */
.offcanvas .sidebar-nav .nav-link .bi { color: #64748b; }
.offcanvas .sidebar-nav .nav-link.active .bi { color: #ffffff; }
.offcanvas .sidebar-nav .nav-link.active::before { display: none; }
.offcanvas .nav-count { background: #e3eefa; color: var(--admin-primary); }
.offcanvas .nav-link.active .nav-count { background: rgba(255, 255, 255, .25); color: #ffffff; }

/* ---------- Top bar ---------- */
.topbar {
    background: rgba(255, 255, 255, .82);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    backdrop-filter: saturate(160%) blur(12px);
    border-bottom-color: var(--admin-hairline);
}

.topbar h1 { font-weight: 800; letter-spacing: -.02em; }

.admin-search {
    background: #f1f5fa;
    border-color: transparent;
    border-radius: 12px;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.admin-search:focus-within {
    background: #ffffff;
    border-color: var(--admin-primary);
    box-shadow: var(--admin-ring);
}

.topbar .btn-dark { border-radius: 12px; }
.topbar-meta { white-space: nowrap; }

/* ---------- Cards ---------- */
.card,
.admin-card {
    border-color: var(--admin-hairline);
    border-radius: var(--admin-radius);
    box-shadow: var(--admin-shadow-sm);
}

.card.border-0 { border: 1px solid var(--admin-hairline) !important; }
.shadow-sm { box-shadow: var(--admin-shadow-sm) !important; }
.rounded-4 { border-radius: var(--admin-radius) !important; }

.card-header,
.admin-card-header {
    background: transparent;
    border-bottom-color: var(--admin-line-soft);
    border-radius: var(--admin-radius) var(--admin-radius) 0 0;
    padding: 1.1rem 1.25rem;
}

.card-body { padding: 1.25rem; }
.card-body.p-0 { padding: 0; }
.admin-card-title { font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }

/* ---------- Metric tiles ---------- */
.metric-card {
    border-left: 1px solid var(--admin-hairline);
    min-height: 132px;
    overflow: hidden;
    position: relative;
    transition: transform .18s ease, box-shadow .18s ease;
}

.metric-card::before {
    background: var(--metric-color, var(--admin-primary));
    content: "";
    height: 3px;
    inset: 0 0 auto 0;
    opacity: .9;
    position: absolute;
}

.metric-card:hover { box-shadow: var(--admin-shadow-md); transform: translateY(-2px); }
.metric-label { font-size: .7rem; font-weight: 700; letter-spacing: .06em; }
.metric-value { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; }

.metric-icon {
    border-radius: 12px;
    font-size: 1.15rem;
    height: 44px;
    width: 44px;
}

@supports (background: color-mix(in srgb, red 10%, white)) {
    .metric-icon { background: color-mix(in srgb, var(--metric-color, #078eff) 14%, #ffffff); }
}

/* ---------- Tables ---------- */
.table thead th {
    background: #f7f9fc;
    border-bottom: 1px solid var(--admin-line);
    letter-spacing: .06em;
}

.table > :not(caption) > * > * { padding-left: 1.1rem; padding-right: 1.1rem; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: #f6f9fd; }
.table-responsive { border-radius: 0 0 var(--admin-radius) var(--admin-radius); }

/* ---------- Buttons ---------- */
.btn {
    border-radius: var(--admin-radius-sm);
    font-weight: 650;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease, transform .05s ease;
}

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

.btn-primary { box-shadow: 0 1px 2px rgba(7, 88, 166, .25), 0 4px 10px rgba(7, 88, 166, .16); }
.btn-primary:hover { box-shadow: 0 2px 4px rgba(7, 88, 166, .28), 0 6px 14px rgba(7, 88, 166, .22); }

.btn-outline-primary {
    --bs-btn-color: var(--admin-primary);
    --bs-btn-border-color: rgba(7, 88, 166, .38);
    --bs-btn-hover-bg: var(--admin-primary);
    --bs-btn-hover-border-color: var(--admin-primary);
    --bs-btn-hover-color: #ffffff;
    --bs-btn-active-bg: var(--admin-primary-dark);
    --bs-btn-active-border-color: var(--admin-primary-dark);
    --bs-btn-active-color: #ffffff;
}

.btn-light { background: #ffffff; border-color: var(--admin-line); }
.btn-light:hover { background: #f5f8fc; border-color: #c5d2e3; }

/* ---------- Forms ---------- */
.form-control,
.form-select {
    border-color: #d5dde9;
    border-radius: var(--admin-radius-sm);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--admin-primary);
    box-shadow: var(--admin-ring);
}

.input-group-text { background: #f7f9fc; border-color: #d5dde9; }
.form-label { font-weight: 600; }

/* ---------- Workflow strip ---------- */
/* An ops-console toolbar under the page title: a label cell, then one tab per
   task. Each tab carries its own pending count, so the strip doubles as a
   queue monitor - amber count when work is waiting, a quiet check when clear,
   and an underlined, tinted tab for the page you are already on. Flat, squared
   and hairline-ruled on purpose: it should read as tooling, not decoration. */
.workflow-strip {
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    margin-bottom: 24px;
    background: var(--admin-panel);
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    box-shadow: 0 1px 0 rgba(16, 24, 40, .04);
    overflow: hidden;
}

.workflow-strip-label {
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: var(--admin-panel-soft);
    border-right: 1px solid var(--admin-line);
    color: var(--admin-muted);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    white-space: nowrap;
}

.workflow-steps {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
}

.workflow-steps > li { display: flex; border-right: 1px solid var(--admin-line-soft); }

.workflow-step {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 18px;
    color: var(--admin-text);
    font-size: .84rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color .12s ease, color .12s ease, box-shadow .12s ease;
}

.workflow-step > .bi { color: var(--admin-faint); font-size: .95rem; transition: color .12s ease; }

.workflow-step:hover { background: var(--admin-panel-soft); color: var(--admin-primary-dark); }
.workflow-step:hover > .bi { color: var(--admin-primary-dark); }

/* Step numbers only appear in the super admin's ordered workflow. */
.workflow-step-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1px solid var(--admin-line);
    border-radius: 4px;
    color: var(--admin-muted);
    font-size: .7rem;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

/* Queue depth: amber, squared, tabular so the digits never jitter. */
.workflow-step-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    background: #fef0c7;
    border: 1px solid #fedf89;
    border-radius: 4px;
    color: #93370d;
    font-size: .72rem;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.workflow-step.has-pending > .bi { color: var(--admin-warning); }
.workflow-step-clear { color: var(--admin-success) !important; font-size: .95rem; }

/* The page you are on: tinted tab with a solid underline, like an active tab
   in an admin console. Declared after the pending rules so it always wins. */
.workflow-step.is-current,
.workflow-step.is-current:hover {
    background: #f1f7fe;
    box-shadow: inset 0 -2px 0 var(--admin-primary);
    color: var(--admin-primary-dark);
}

.workflow-step.is-current > .bi,
.workflow-step.is-current:hover > .bi { color: var(--admin-primary); }
.workflow-step.is-current .workflow-step-index { background: var(--admin-primary); border-color: var(--admin-primary); color: #ffffff; }

/* Not a step: context about what lives outside this console. */
.workflow-strip-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 0 auto;
    padding: 0 16px;
    border-left: 1px solid var(--admin-line-soft);
    color: var(--admin-muted);
    font-size: .78rem;
}

.workflow-strip-note .bi { color: var(--admin-faint); }

@media (max-width: 991px) {
    .workflow-strip-label { width: 100%; min-height: 36px; border-right: 0; border-bottom: 1px solid var(--admin-line); }
    /* Tabs stay on one swipeable line instead of stacking into a wall. */
    .workflow-steps { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; }
    .workflow-steps::-webkit-scrollbar { display: none; }
    .workflow-step { white-space: nowrap; }
    .workflow-strip-note { width: 100%; min-height: 36px; margin-left: 0; border-left: 0; border-top: 1px solid var(--admin-line-soft); }
}

/* ---------- Chips, lists, badges ---------- */
.status-badge { padding: .38rem .65rem; }
.detail-card { border-radius: 12px; }
.ops-item { border-radius: 12px; transition: background .12s ease, border-color .12s ease; }
.ops-item:hover { border-color: #cfdcec; }
.progress { background: #e8eef6; border-radius: 999px; }
.progress-bar { background: linear-gradient(90deg, var(--admin-primary), #3ea1ff); border-radius: 999px; }

/* ---------- Overlays ---------- */
.modal-content {
    border: 0;
    border-radius: 18px;
    box-shadow: var(--admin-shadow-md), 0 0 0 1px var(--admin-hairline);
}

.modal-header { border-bottom-color: var(--admin-line-soft); }

.dropdown-menu {
    border-color: var(--admin-hairline);
    border-radius: 12px;
    box-shadow: var(--admin-shadow-md);
    padding: .4rem;
}

.dropdown-item { border-radius: 8px; font-weight: 500; }

/* ---------- Sign-in ---------- */
.login-page {
    background:
        radial-gradient(1100px 520px at 12% -10%, rgba(62, 161, 255, .22), transparent 60%),
        radial-gradient(900px 500px at 100% 110%, rgba(34, 197, 94, .14), transparent 55%),
        #f3f6fb;
}

.login-page .brand-logo {
    border-radius: 18px;
    box-shadow: var(--admin-shadow-md);
    height: 68px;
    padding: 5px;
    width: 68px;
}

.login-page h1 { font-weight: 800; letter-spacing: -.02em; }
.login-page .card { border-radius: 20px; box-shadow: var(--admin-shadow-md) !important; }
.login-page .input-group-text { background: #f7f9fc !important; }
.login-page .btn-primary { min-height: 46px; }

/* ---------- Role identity (sidebar card + top-bar chip) ---------- */
.role-card {
    align-items: center;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
    display: flex;
    gap: .75rem;
    margin: .85rem .85rem 0;
    padding: .65rem .75rem;
}

.role-avatar {
    align-items: center;
    background: rgba(var(--admin-nav-accent-rgb), .22);
    border-radius: 10px;
    color: #ffffff;
    display: inline-grid;
    flex: 0 0 38px;
    font-weight: 800;
    height: 38px;
    overflow: hidden;
    place-items: center;
    width: 38px;
}

.role-avatar { position: relative; }
.role-avatar img { background: #ffffff; height: 100%; inset: 0; object-fit: contain; padding: 3px; position: absolute; width: 100%; }
.status-plain { text-transform: none; white-space: nowrap; }
.role-copy { display: grid; min-width: 0; }
.role-label { color: rgb(var(--admin-nav-accent-rgb)); font-size: .66rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.role-name { color: #ffffff; font-size: .86rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.offcanvas .role-card { background: #f3f6fb; border-color: var(--admin-hairline); }
.offcanvas .role-name { color: var(--admin-text); }

.role-chip {
    align-items: center;
    background: #eef4ff;
    border-radius: 999px;
    color: var(--admin-primary);
    font-size: .74rem;
    font-weight: 750;
    gap: .4rem;
    padding: .38rem .75rem;
    white-space: nowrap;
}

body.role-super .role-chip { background: #efecff; color: #5b47d6; }

/* ---------- Super admin: platform hero + directory ---------- */
.platform-hero {
    background:
        radial-gradient(600px 240px at 90% -20%, rgba(165, 150, 255, .45), transparent 65%),
        linear-gradient(135deg, #1a1440 0%, #2b2170 100%);
    border-radius: 18px;
    box-shadow: var(--admin-shadow-md);
    color: #ffffff;
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    padding: 1.75rem;
}

.platform-eyebrow { color: #c9c1ff; font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.platform-hero h2 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; margin: .5rem 0 .4rem; }
.platform-hero p { color: #d3cef5; margin-bottom: 1rem; max-width: 34rem; }
.platform-kpis { display: grid; gap: .75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }

.platform-kpi {
    background: rgba(255, 255, 255, .09);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 14px;
    display: grid;
    gap: .15rem;
    padding: .9rem 1rem;
}

.platform-kpi .kpi-value { font-size: 1.85rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.platform-kpi .kpi-value small { color: #b3abee; font-size: 1rem; font-weight: 650; }
.platform-kpi .kpi-label { color: #cfc9f3; font-size: .74rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.platform-kpi.is-alert { background: rgba(240, 68, 56, .22); border-color: rgba(255, 140, 130, .5); }

.company-mark {
    align-items: center;
    background: #eef1f8;
    border-radius: 10px;
    color: var(--admin-primary);
    display: inline-grid;
    flex: 0 0 38px;
    font-weight: 800;
    height: 38px;
    overflow: hidden;
    place-items: center;
    width: 38px;
}

.company-mark { position: relative; }
.company-mark img { background: #ffffff; height: 100%; inset: 0; object-fit: contain; padding: 3px; position: absolute; width: 100%; }

.count-dot {
    background: #fff4d6;
    border-radius: 999px;
    color: #8a5a00;
    font-size: .7rem;
    font-weight: 800;
    margin-left: .35rem;
    padding: .1rem .45rem;
}

/* Opt-in wrapping for wide tables so long names and emails are not clipped. */
.table-wrap td { white-space: normal; }
.table-wrap td.text-end, .table-wrap th { white-space: nowrap; }
.table-wrap td { overflow-wrap: anywhere; }
.table-wrap .record-meta { overflow-wrap: anywhere; }

.roster-chips { display: flex; flex-wrap: nowrap; gap: .4rem; }
.roster-chips span {
    align-items: center;
    background: #f1f5fa;
    border-radius: 999px;
    color: var(--admin-text);
    display: inline-flex;
    font-size: .78rem;
    font-weight: 700;
    gap: .3rem;
    padding: .25rem .55rem;
    white-space: nowrap;
}
.roster-chips .bi { color: var(--admin-muted); }

/* ---------- Company admin: attention queue + plan ---------- */
/* Status tiles: flat, squared, with a left status rail (green = clear, amber =
   work waiting) and a tabular count, so a row of them reads like a monitor. */
.attention-card {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--admin-line);
    border-left: 3px solid var(--admin-success);
    border-radius: 8px;
    box-shadow: 0 1px 0 rgba(16, 24, 40, .04);
    color: var(--admin-text);
    display: flex;
    gap: .85rem;
    height: 100%;
    padding: .85rem 1rem;
    text-decoration: none;
    transition: background-color .12s ease, border-color .12s ease;
}

.attention-card:hover { background: var(--admin-panel-soft); border-color: #c5d2e3; border-left-color: var(--admin-success); color: var(--admin-text); }
.attention-icon { background: var(--admin-panel-soft); border: 1px solid var(--admin-line-soft); border-radius: 6px; color: var(--admin-muted); display: grid; flex: 0 0 36px; font-size: 1rem; height: 36px; place-items: center; }
.attention-copy { display: grid; flex: 1; gap: 1px; min-width: 0; }
.attention-label { font-size: .9rem; font-weight: 600; }
.attention-note { align-items: center; color: var(--admin-muted); display: flex; font-size: .76rem; gap: 6px; }
.attention-note::before { background: var(--admin-success); border-radius: 50%; content: ""; flex: 0 0 6px; height: 6px; }
.attention-value { color: var(--admin-muted); font-size: 1.5rem; font-variant-numeric: tabular-nums; font-weight: 700; line-height: 1; }
.attention-card.has-items { border-left-color: var(--admin-warning); }
.attention-card.has-items:hover { border-left-color: var(--admin-warning); }
.attention-card.has-items .attention-icon { background: #fffaeb; border-color: #fedf89; color: #b54708; }
.attention-card.has-items .attention-note::before { background: var(--admin-warning); }
.attention-card.has-items .attention-value { color: #b54708; }

.plan-strip {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--admin-line);
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: .6rem 1rem;
    padding: .75rem 1.1rem;
}

.plan-strip-label { color: var(--admin-primary); font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }

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