@import url("https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&display=swap");

:root {
    /* ── Base BRAND palette (the ONLY vars a tenant may override — see Tenant.Theme / TenantTheme.AllowedKeys).
       Per-tenant theming injects a <style>:root{…}</style> that overrides these 6; every derived var below +
       every var(--…) reference across the app recomputes automatically. Defaults = the SHIFT brand. */
    --sidebar: #071731;
    --sidebar-2: #0b1f3d;
    --blue: #247cff;
    --blue-2: #0f45bd;
    --cyan: #35a8ff;
    --green: #14b889;
    --icon: #35a8ff;   /* sidebar nav-icon color — its own themeable key (owner's call) */

    /* ── Derived brand surfaces (computed from the base vars → follow the tenant theme, no separate override).
       Tuned so the SHIFT defaults reproduce the previous hardcoded shades closely. */
    --hero-accent: color-mix(in srgb, var(--blue) 82%, var(--sidebar-2));  /* ≈ old #2461d8 hero-end / brand accent */
    --hero: linear-gradient(135deg, var(--sidebar-2), var(--hero-accent)); /* the navy→blue detail-hero gradient */
    --brand-strong: color-mix(in srgb, var(--blue-2) 68%, var(--blue));    /* ≈ old #1b4fc0 dark link/text blue */
    --blue-soft: color-mix(in srgb, var(--blue) 12%, #fff);                /* ≈ old #e3edff active tint */

    /* ── Neutrals + status (NOT themeable — fixed for readability/semantics) */
    --ink: #172033;
    --muted: #7a8496;
    --line: #dce8f6;
    --soft: #f4f8ff;
    --panel: #ffffff;
    --amber: #ffb21e;
    --red: #d94f45;
    --shadow: 0 20px 55px rgba(32, 69, 122, .12);
}

* {
    box-sizing: border-box;
}

html,
body {
    direction: rtl;
    text-align: right;
}

body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 18% 0%, rgba(36, 124, 255, .10), transparent 28%),
        linear-gradient(180deg, #f7fbff 0%, #eef5ff 100%);
    font-family: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
}

a,
.btn-link {
    color: var(--blue);
}

.form-select,
.form-control {
    min-height: 46px;
    border-color: #d9e3ef;
    border-radius: 14px;
    background-color: #fbfdff;
    color: var(--ink);
    font-size: 14px;
    font-weight: 500;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75);
}

/* Dropdowns share the input weight/size — no heavier "selected value" look. */
.form-select {
    font-weight: 500;
}

.form-control:focus,
.form-select:focus {
    border-color: #6fb2ff;
    box-shadow: 0 0 0 .24rem rgba(36, 124, 255, .13);
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.section-title h2 {
    font-size: 20px;
    font-weight: 800;
    margin: 0;
}

.section-title p {
    color: var(--muted);
    margin: 4px 0 0;
}

.setup-hero {
    min-height: 190px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 16px;
    padding: 24px;
    border-radius: 8px;
    color: #fff;
    /* Green→blue identity gradient — themed (follows --green + --blue). */
    background: linear-gradient(135deg, var(--green), var(--blue));
    box-shadow: 0 18px 48px rgba(30, 47, 72, .18);
}

.setup-hero h2 {
    margin: 12px 0 10px;
    font-size: 34px;
    line-height: 1.05;
    font-weight: 850;
}

.setup-hero p {
    max-width: 760px;
    margin: 0;
    color: rgba(255, 255, 255, .86);
}

.module-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, .36);
    border-radius: 999px;
    color: #fff;
    background: rgba(255, 255, 255, .12);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.setup-module-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.setup-module {
    min-height: 160px;
    display: grid;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    text-align: right;
    box-shadow: 0 12px 30px rgba(24, 35, 54, .06);
    color: inherit;
    text-decoration: none;
    transition: border-color .16s ease, transform .16s ease;
}

.setup-module:hover {
    border-color: var(--blue);
    transform: translateY(-1px);
    color: inherit;
    text-decoration: none;
}

.setup-module:focus,
.setup-module:active {
    color: inherit;
    text-decoration: none;
}

.setup-module i {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--blue), var(--green));
    font-style: normal;
    font-size: 12px;
    font-weight: 900;
}

.setup-module strong {
    font-size: 15px;
}

.setup-module span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.65;
}

/* Not-yet-built modules: visible but inert (no destination yet). */
.setup-module.is-soon {
    opacity: .6;
    cursor: not-allowed;
    box-shadow: none;
    background: #fbfcfe;
}

.setup-module.is-soon:hover {
    border-color: var(--line);
    transform: none;
}

/* ===== KPI / summary cards (page overview strip — reusable across list pages) ===== */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 0 0 16px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(24, 35, 54, .06);
}

.stat-card-icon {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    font-size: 20px;
    background: linear-gradient(135deg, var(--blue), var(--blue-2));
}

.stat-card-icon.green { background: linear-gradient(135deg, #21c08a, #129b6e); }
.stat-card-icon.cyan  { background: linear-gradient(135deg, var(--cyan), #1e7fe0); }
.stat-card-icon.amber { background: linear-gradient(135deg, #ffb21e, #ef9509); }

.stat-card-body {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.stat-card-value {
    font-size: 24px;
    font-weight: 900;
    color: var(--ink);
    line-height: 1.1;
}

.stat-card-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
}

.stat-card-sub {
    font-size: 12px;
    color: var(--muted);
}

@media (max-width: 900px) {
    .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
    .stat-cards { grid-template-columns: 1fr; }
}

.setup-module.is-soon i {
    background: linear-gradient(135deg, #9aa6b8, #c3ccd8);
}

.soon-badge {
    display: inline-block;
    margin-inline-start: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    background: #eef1f6;
    vertical-align: middle;
}

/* ===== Standalone auth (login / change-password): split hero + form ===== */
.auth-split {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    direction: rtl;
    background: var(--soft);
}

/* Brand hero panel */
.auth-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 24px;
    padding: 48px 52px;
    color: #eaf2ff;
    background: linear-gradient(155deg, var(--sidebar) 0%, var(--sidebar-2) 45%, var(--hero-accent) 100%);
}

.auth-hero::before,
.auth-hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.auth-hero::before {
    width: 360px;
    height: 360px;
    top: -120px;
    inset-inline-start: -90px;
    background: radial-gradient(circle, rgba(53, 168, 255, .45), transparent 70%);
}

.auth-hero::after {
    width: 440px;
    height: 440px;
    bottom: -170px;
    inset-inline-end: -130px;
    background: radial-gradient(circle, rgba(36, 124, 255, .38), transparent 70%);
}

.auth-hero-top,
.auth-hero-mid,
.auth-hero-foot {
    position: relative;
    z-index: 1;
}

.auth-hero-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

.auth-mark {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    font-size: 28px;
    font-weight: 900;
    color: #fff;
    background: linear-gradient(135deg, #2aa7ff, #1e54df);
    box-shadow: 0 16px 38px rgba(36, 124, 255, .45);
}

.auth-hero-name {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: .5px;
}

.auth-hero-sub {
    font-size: 13px;
    color: #aebfdc;
}

.auth-hero-title {
    font-size: 30px;
    font-weight: 900;
    line-height: 1.35;
    margin: 0 0 12px;
}

.auth-hero-lead {
    font-size: 15px;
    line-height: 1.9;
    color: #c4d2ec;
    margin: 0 0 22px;
    max-width: 44ch;
}

.auth-hero-points {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.auth-hero-points li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #dce7fb;
}

.auth-hero-points i {
    color: #5ad1a0;
    font-size: 17px;
}

.auth-hero-foot {
    font-size: 12px;
    color: #8ea1c4;
}

/* Form side */
.auth-main {
    display: grid;
    place-items: center;
    padding: 40px 24px;
    direction: rtl;
}

.auth-form {
    width: 100%;
    max-width: 400px;
    display: grid;
    gap: 15px;
}

.auth-form-head {
    margin-bottom: 2px;
}

.auth-form-head h2 {
    margin: 0 0 6px;
    font-size: 26px;
    font-weight: 900;
    color: var(--ink);
}

.auth-form-head p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

/* password input + eye-toggle row (shared by both auth pages) */
.pw-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.pw-row .form-control {
    flex: 1 1 auto;
}

.pw-row .btn-ghost {
    flex: 0 0 auto;
    min-height: 50px;
}

.login-submit {
    justify-content: center;
    width: 100%;
    margin-top: 6px;
}

.login-tenant {
    background: #eef4ff;
    color: #1b3a6b;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    text-align: center;
}

.topbar-auth {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

@media (max-width: 920px) {
    .auth-split {
        grid-template-columns: 1fr;
    }

    .auth-hero {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 14px;
        padding: 22px 24px;
    }

    .auth-hero-mid,
    .auth-hero-foot {
        display: none;
    }

    .auth-main {
        padding: 28px 20px;
    }
}

.panel {
    min-width: 0;
    padding: 18px;
    margin-top: 16px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
}

.panel-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.split-grid {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 16px;
}

.split-grid.no-margin {
    margin: 0;
}

.split-grid > * {
    min-width: 0;
}

.project-logo-field {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    margin-bottom: 14px;
    border: 1px solid #e7edf5;
    border-radius: 8px;
    background: #fbfdff;
}

.project-logo-preview {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 8px;
    color: #fff;
    font-size: 18px;
    font-weight: 850;
    letter-spacing: .04em;
    background: linear-gradient(135deg, var(--sidebar), var(--blue));
    box-shadow: 0 10px 24px rgba(24, 35, 54, .16);
}

.project-logo-preview.large {
    width: 86px;
    height: 86px;
    flex: 0 0 86px;
    font-size: 26px;
}

.project-logo-field small,
.field-hint {
    display: block;
    color: var(--muted);
    margin-top: 6px;
    font-size: 12px;
}

.tenant-logo-field .form-control[type="file"] {
    margin-bottom: 12px;
}

.form-label {
    color: #4b5563;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

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

.form-grid.one {
    grid-template-columns: 1fr;
}

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

.form-grid .span-2 {
    grid-column: span 2;
}

.form-grid .span-3 {
    grid-column: span 3;
}

/* A checkbox styled to match a form control, so it lines up with selects/inputs on the same grid row. */
.check-control {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 50px;
    padding: 0 14px;
    border: 1px solid #d9e3ef;
    border-radius: 14px;
    background-color: #fbfdff;
    color: var(--ink);
    font-weight: 600;
    cursor: pointer;
}

.check-control input {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

/* Employee modal: two side-by-side panels — master data (wide) | system account (narrow). */
.emp-cols {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.emp-col-main {
    flex: 2 1 0;
    min-width: 0;
}

.emp-col-side {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    border-inline-start: 1px solid var(--line);
    padding-inline-start: 24px;
}

.emp-col-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 12px;
}

.emp-col-subtitle {
    font-size: 13px;
    font-weight: 800;
    color: var(--ink);
    border-top: 1px dashed var(--line);
    padding-top: 12px;
    margin-top: 2px;
}

.emp-col-note {
    margin-top: 4px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #fff8e6;
    border: 1px solid #f4e3b3;
    color: #7a6a3a;
    font-size: 12px;
    line-height: 1.55;
}

.filters {
    display: grid;
    grid-template-columns: repeat(5, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.filters-six {
    grid-template-columns: repeat(6, minmax(120px, 1fr));
}

.table {
    margin: 0;
    border-color: #d9e3ef;
}

.table th {
    background: #edf4fb;
    color: #23618f;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.table td,
.table th {
    vertical-align: middle;
    white-space: nowrap;
    border-color: #d9e3ef;
}

.comment-note {
    padding: 12px;
    margin-top: 14px;
    border-left: 4px solid var(--amber);
    border-radius: 6px;
    color: #634600;
    background: #fff9e8;
}

/* Keep this a real table-cell (NOT display:flex/inline-flex — that wraps the <td> in an anonymous cell,
   so its border-bottom only spans the buttons, breaking the row's horizontal line). Buttons flow inline. */
.row-actions {
    white-space: nowrap;
}
.row-actions .icon-btn + .icon-btn { margin-inline-start: 6px; }

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

.capability-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 11px 12px;
    border: 1px solid #dce8f6;
    border-radius: 14px;
    background: #fff;
    color: #334155;
    font-size: 13px;
    font-weight: 750;
}

.capability-grid input {
    width: 16px;
    height: 16px;
    accent-color: var(--blue);
}

/* Grouped feature sections (tenant create + detail toggle screens) */
.feature-group { margin-bottom: 18px; }
.feature-group:last-child { margin-bottom: 0; }

.feature-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    margin: 0 2px 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eef3f9;
}

.feature-group-title i { color: var(--blue); font-size: 13px; }

.feature-group-count {
    margin-inline-start: auto;
    font-size: 11px;
    font-weight: 700;
    color: var(--blue-2);
    background: #f0f8ff;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    padding: 1px 9px;
}

.site-modal {
    border: 0;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 28px 80px rgba(9, 26, 57, .24);
}

.site-modal .modal-header {
    color: #fff;
    border: 0;
    padding: 18px 22px;
    background: linear-gradient(90deg, var(--brand-strong), var(--blue));
}

.site-modal .modal-title {
    font-weight: 700;
}

.site-modal .btn-close {
    filter: invert(1) grayscale(1);
    opacity: .9;
}

.site-modal .modal-body {
    padding: 22px;
    background: #f7fbff;
}

.site-modal .modal-footer {
    border-top: 1px solid var(--line);
    padding: 14px 22px;
}

.site-modal .form-control,
.site-modal .form-select {
    font-size: 15px;
}

.modal-kicker {
    display: block;
    color: rgba(255, 255, 255, .75);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.geofence-map {
    position: relative;
    min-height: 210px;
    display: grid;
    place-items: center;
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f8fbff;
    overflow: hidden;
    text-align: center;
}

.range-circle {
    position: absolute;
    width: 150px;
    height: 150px;
    border: 3px solid rgba(36, 124, 255, .55);
    border-radius: 50%;
    background: rgba(36, 124, 255, .10);
}

.range-circle.small {
    width: 110px;
    height: 110px;
}

.map-pin {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50% 50% 50% 0;
    background: var(--red);
    transform: rotate(-45deg);
}

.project-location-pin {
    left: 50%;
    top: 42%;
}

.geofence-map strong,
.geofence-map small {
    position: relative;
    z-index: 1;
    display: block;
}

.geofence-map small {
    max-width: 420px;
    margin-top: 72px;
    color: var(--muted);
}

.page-heading {
    margin-bottom: 16px;
}

.page-heading h2 {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 800;
}

.page-heading p {
    margin: 0;
    color: var(--muted);
}

.note-text {
    margin: 0;
    color: var(--muted);
}

.blazor-error-boundary {
    padding: 1rem;
    color: white;
    background: #b32121;
}

.validation-message {
    color: #b32121;
}

@media (max-width: 1200px) {
    .setup-module-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .setup-module-grid,
    .split-grid,
    .filters,
    .filters-six,
    .capability-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .emp-cols {
        flex-direction: column;
    }

    .emp-col-side {
        border-inline-start: none;
        padding-inline-start: 0;
        border-top: 1px solid var(--line);
        padding-top: 16px;
    }
}

@media (max-width: 640px) {
    .section-title,
    .setup-hero {
        flex-direction: column;
        align-items: stretch;
    }

    .setup-module-grid {
        grid-template-columns: 1fr;
    }

    .split-grid,
    .filters,
    .filters-six,
    .capability-grid,
    .form-grid,
    .form-grid.three {
        grid-template-columns: 1fr;
    }

    .form-grid .span-2,
    .form-grid .span-3 {
        grid-column: auto;
    }

    .project-logo-field,
    .panel-header,
    .panel-actions {
        align-items: stretch;
        flex-direction: column;
    }
}

@keyframes shift-spin { to { transform: rotate(360deg); } }

/* Google Places Autocomplete dropdown must sit above the branch modal (z-index 1050). */
.pac-container {
    z-index: 1200 !important;
}

/* ============================================================
   Shared list/table pattern — used by every setup screen.
   Toolbar (search + filters) + sortable headers + grid table.
   ============================================================ */

/* Toolbar: search + filters */
.table-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.toolbar-search {
    position: relative;
    flex: 1 1 280px;
    min-width: 220px;
}

.toolbar-search i {
    position: absolute;
    inset-inline-start: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 14px;
    pointer-events: none;
}

.toolbar-search .form-control {
    padding-inline-start: 34px;
}

.table-toolbar .form-select {
    flex: 0 0 auto;
    width: auto;
    min-width: 150px;
}

.btn-link-clear {
    background: none;
    border: none;
    color: var(--blue-2);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
}

.btn-link-clear:hover { background: #eef4ff; }

.toolbar-result {
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
}

/* Sortable column headers */
.th-sort {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
}

.th-sort:hover { color: var(--blue-2); }

.sort-ind {
    font-size: 10px;
    color: var(--blue-2);
    min-width: 8px;
}

.no-match {
    text-align: center;
    color: var(--muted);
    padding: 24px 16px;
    font-size: 13px;
}

/* Pagination */
.table-pager {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.pager-info {
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
}

.pager-controls {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-inline-start: auto;
}

.pager-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink, #172033);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
}

.pager-btn:hover:not(:disabled):not(.active) { background: var(--soft); color: var(--blue-2); }
.pager-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.pager-btn:disabled { opacity: .45; cursor: default; }

.pager-size {
    flex: 0 0 auto;
    width: auto;
    min-width: 110px;
}

/* Grid table */
.table-wrap {
    border: 1px solid var(--line);
    border-radius: 14px;
    /* clip rounded corners (Y) but let wide tables scroll horizontally instead of clipping */
    overflow-x: auto;
    overflow-y: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    color: var(--ink);
    font-variant-numeric: tabular-nums;   /* dates / hours / distances / counts align in their columns */
}

.data-table thead tr {
    background: linear-gradient(180deg, #f8fbff 0%, #eef4fc 100%);
    border-bottom: 1.5px solid #cbdcf2;
}

.data-table th {
    padding: 12px 16px;
    font-weight: 700;
    color: #63708a;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
}

.data-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    transition: background .12s ease;
}

/* Grid: vertical separators between cells match the horizontal rules for a complete grid
   (outer edge comes from .table-wrap) */
.data-table th,
.data-table td {
    border-inline-end: 1px solid var(--line);
}

.data-table th:last-child,
.data-table td:last-child {
    border-inline-end: none;
}

.data-table tbody tr:last-child td { border-bottom: none; }

/* Whisper-quiet zebra for scan-ability; hover wins over it (declared after). */
.data-table tbody tr:nth-child(even) td { background: #f9fbff; }
.data-table tbody tr:hover td { background: #e9f2ff; }

/* A soft brand accent on the row's start edge while hovered — RTL start = the first cell's outer edge. */
.data-table tbody tr:hover td:first-child { box-shadow: inset -3px 0 0 0 var(--blue); }

/* Fee-entry table inside a modal: distance-type label + a value input per row */
.fee-grid td .form-control { margin: 0; }
.fee-grid th:last-child,
.fee-grid td:last-child { width: 220px; }

.code-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 7px;
    background: #eef4ff;
    color: var(--blue-2);
    font-size: 12px;
    font-weight: 700;
    font-family: "SF Mono", "Fira Code", monospace;
}

/* Clickable entity-name in a list row → opens its page (shared standard-list affordance). */
.link-name {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    font-weight: 700;
    color: var(--blue-2);
    cursor: pointer;
    text-align: start;
}

.link-name:hover { text-decoration: underline; }

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
}

.status-active   { background: #e6faf4; color: var(--green); }
.status-trial    { background: #fff8e6; color: #b87a00; }
.status-suspended { background: #fff0ef; color: var(--red); }

/* Row action icon buttons */
.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    transition: all .15s;
}

.icon-btn:hover { background: var(--soft); color: var(--blue-2); }
.icon-btn-danger:hover { background: #fff0ef; color: var(--red); border-color: var(--red); }

/* ============================================================
   Shared screen chrome — tenant bar, modal, toast, confirm,
   buttons, alerts. Used by every setup screen.
   ============================================================ */

.tenant-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
}

.tenant-bar-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    white-space: nowrap;
}

.tenant-select {
    max-width: 360px;
    min-height: 42px;
}

.empty-hint {
    padding: 48px 0;
    text-align: center;
    color: var(--muted);
    font-size: 15px;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--muted);
    padding: 56px 0;
    font-size: 14px;
    font-weight: 600;
}

/* Designed spinner ring (the inline bi-arrow-repeat icon is hidden in favour of this). */
.loading-state i { display: none; }

.loading-state::before {
    content: "";
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid #e3ebf5;
    border-top-color: var(--blue);
    animation: shift-spin .7s linear infinite;
}

.spinning { animation: shift-spin .8s linear infinite; }
.muted { color: var(--muted); font-size: 13px; }

/* Primary save button */
.btn-save {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 10px;
    border: none;
    background: var(--blue);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}

.btn-save:hover:not(:disabled) { background: var(--blue-2); }
.btn-save:disabled { opacity: .6; cursor: default; }

/* Ghost / danger buttons */
.btn-ghost {
    padding: 8px 18px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.btn-ghost:hover:not(:disabled) { background: var(--soft); }

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: 10px;
    border: none;
    background: var(--red);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.btn-danger:hover:not(:disabled) { filter: brightness(.93); }
.btn-danger:disabled { opacity: .6; cursor: default; }

/* Alerts */
.alert-success {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 14px;
    border-radius: 10px;
    background: #e6faf4;
    color: var(--green);
    font-size: 13px;
    font-weight: 600;
}

.alert-error-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 14px;
    border-radius: 10px;
    background: #fff0ef;
    color: var(--red);
    font-size: 13px;
    font-weight: 600;
}

.alert-error-bar button {
    margin-right: auto;
    padding: 4px 12px;
    border-radius: 7px;
    border: 1px solid var(--red);
    background: transparent;
    color: var(--red);
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
}

/* Required marker + locked select */
.req { color: var(--red); font-weight: 700; }

.form-select:disabled {
    background-color: var(--soft);
    color: var(--ink, #1f2a44);
    opacity: 1;
    cursor: not-allowed;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    cursor: pointer;
    font-size: 14px;
}

.check-row input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Modal (gradient-header style) */
.modal-backdrop-shift {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 1040;
}

.modal-shift {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(960px, 96vw);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .35);
    z-index: 1050;
    overflow: hidden;
}

/* Wider variant for dense modals (e.g. the 3-column employee form). */
.modal-shift.wide {
    width: min(1160px, 96vw);
}

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

.modal-shift-header h3 { margin: 0; font-size: 16px; font-weight: 800; }

.modal-shift-header.gradient {
    background: linear-gradient(90deg, var(--brand-strong), var(--blue));
    border-bottom: none;
    padding: 18px 22px;
}

.modal-shift-header.gradient h3 { color: #fff; }

.icon-btn-light {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .35);
    background: rgba(255, 255, 255, .15);
    color: #fff;
    cursor: pointer;
    transition: background .15s;
}

.icon-btn-light:hover { background: rgba(255, 255, 255, .28); }

.modal-shift-body {
    padding: 18px 20px;
    overflow-y: auto;
}

.modal-shift-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--line);
}

/* Confirm dialog */
.confirm-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(420px, 92vw);
    padding: 24px;
    text-align: center;
    background: var(--panel);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .35);
    z-index: 1110;
}

.confirm-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: #fff0ef;
    color: var(--red);
    font-size: 24px;
}

.confirm-dialog h4 { margin: 0 0 6px; font-size: 17px; font-weight: 800; }
.confirm-dialog p { margin: 0 0 18px; font-size: 14px; color: var(--muted); }

.confirm-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* Toast */
.shift-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 90vw;
    padding: 12px 18px;
    border-radius: 12px;
    background: #fff0ef;
    color: var(--red);
    border: 1px solid var(--red);
    box-shadow: 0 12px 30px rgba(15, 23, 42, .25);
    font-size: 14px;
    font-weight: 700;
    z-index: 1100;
    animation: toast-in .2s ease-out;
}

.shift-toast i { font-size: 18px; }

.toast-close {
    margin-inline-start: 6px;
    border: none;
    background: transparent;
    color: var(--red);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ===== Topbar sidebar toggle + collapsible rail (desktop) ===== */
.topbar-lead {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.sidebar-toggle {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-size: 18px;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}

.sidebar-toggle:hover {
    background: var(--soft);
    border-color: var(--blue);
    color: var(--blue);
}

/* Collapsed rail: only on desktop — mobile keeps the existing hamburger menu. */
@media (min-width: 981px) {
    html.sidebar-collapsed .app-shell {
        grid-template-columns: minmax(0, 1fr) 76px;
    }

    html.sidebar-collapsed .sidebar {
        padding: 18px 10px;
    }

    /* hide text, keep icons */
    html.sidebar-collapsed .nav-text,
    html.sidebar-collapsed .nav-section-title,
    html.sidebar-collapsed .brand-name,
    html.sidebar-collapsed .brand-subtitle {
        display: none;
    }

    html.sidebar-collapsed .brand,
    html.sidebar-collapsed .brand-link {
        justify-content: center;
        gap: 0;
    }

    /* center the nav icons in the rail (.nav-item bumps specificity over the scoped base) */
    html.sidebar-collapsed .nav-item .nav-link-btn {
        justify-content: center;
        gap: 0;
        padding-inline: 0;
    }

    html.sidebar-collapsed .nav-item .nav-link-btn i {
        font-size: 17px;
    }
}

@media (max-width: 980px) {
    .sidebar-toggle {
        display: none;
    }
}

/* ===== Projects: long single page with a sticky anchor nav ===== */
.proj-form-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.proj-top-actions,
.proj-bottom-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.proj-bottom-actions {
    justify-content: flex-end;
    padding-top: 4px;
}

.proj-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    margin-top: 12px;
}

.proj-anchor-nav {
    position: sticky;
    top: 88px;
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(24, 35, 54, .06);
}

.proj-anchor-nav button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 12px;
    border: none;
    background: none;
    border-radius: 10px;
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: start;
    cursor: pointer;
    transition: background .14s, color .14s;
}

.proj-anchor-nav button:hover {
    background: var(--soft);
    color: var(--blue);
}

.proj-anchor-nav button i {
    color: var(--blue);
    font-size: 15px;
}

.proj-sections {
    display: grid;
    gap: 16px;
    min-width: 0;
}

/* each section is a .panel; clear the sticky topbar when jumped to via anchor */
.proj-section {
    scroll-margin-top: 88px;
    margin-top: 0;
}

.proj-logo-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.proj-logo-stub {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: #fff;
    font-weight: 900;
    font-size: 20px;
    background: linear-gradient(135deg, var(--blue), var(--blue-2));
}

@media (max-width: 900px) {
    .proj-layout {
        grid-template-columns: 1fr;
    }

    .proj-anchor-nav {
        position: static;
        grid-auto-flow: column;
        grid-auto-columns: max-content;
        overflow-x: auto;
    }
}

/* Role multi-select chips (employee modal) + inline empty hint */
.role-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.role-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 13px; border-radius: 999px; cursor: pointer;
    background: #eef2f7; color: #475569; border: 1px solid transparent;
    font-size: 13px; font-weight: 700; transition: background .12s, color .12s, border-color .12s;
}
.role-chip:hover { background: #e2e8f0; }
.role-chip.on { background: var(--blue-soft); color: var(--brand-strong); border-color: color-mix(in srgb, var(--blue) 30%, transparent); }
.role-chip .chip-inactive { font-size: 11px; font-weight: 700; color: #94a3b8; }
.empty-inline { color: var(--muted); font-size: 13px; padding: 6px 2px; }
