@import url("https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap");

:root {
    --color-primary: #1e3a5f;
    --color-primary-light: #264b7a;
    --color-primary-dark: #162d4a;
    --color-action: #2563eb;
    --color-action-hover: #1d4ed8;
    --color-silver: #64748b;
    --color-silver-light: #94a3b8;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #0f172a;
    --color-text-heading: #1e293b;
    --color-text-muted: #475569;
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;
    --color-success: #16a34a;
    --color-success-bg: #f0fdf4;
    --color-success-border: #bbf7d0;
    --color-error: #dc2626;
    --color-error-bg: #fef2f2;
    --color-error-border: #fecaca;
    --color-warning: #d97706;
    --color-warning-bg: #fffbeb;
    --color-warning-border: #fde68a;
    --color-info: #2563eb;
    --color-info-bg: #eff6ff;
    --color-info-border: #bfdbfe;
    --sidebar-width: 260px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.04);
    --font-sans:
        "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    --font-brand: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
    --font-stack: var(--font-sans);
    --font-mono:
        "SF Mono", SFMono-Regular, "Cascadia Code", Consolas, "Liberation Mono",
        Menlo, monospace;
    --transition-fast: 120ms ease;
    --transition-base: 180ms ease;
    /* Shared control dimensions (buttons, inputs, selects) */
    --control-padding-y: 0.5625rem;
    --control-font-size: 0.875rem;
    --control-radius: var(--radius-md);
    --control-line-height: 1;
    /* Aliases — templates that use the --text-* / --bg-* / --border-* naming */
    --text-primary: var(--color-text);
    --text-secondary: var(--color-text-muted);
    --text-danger: var(--color-error);
    --bg-secondary: var(--color-border-light);
    --border-color: var(--color-border);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    font-weight: 450;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    overflow: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--color-text-heading);
    font-weight: 650;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 1.75rem;
}
h2 {
    font-size: 1.375rem;
}
h3 {
    font-size: 1.125rem;
}
h4 {
    font-size: 1rem;
}

a {
    color: var(--color-action);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-action-hover);
}

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

table {
    border-collapse: collapse;
    width: 100%;
}

input,
select,
textarea,
button {
    font-family: inherit;
    font-size: inherit;
}

ul,
ol {
    list-style: none;
}

/* ------------------------------------------------------------------ */
/*  Layout                                                            */
/* ------------------------------------------------------------------ */

.layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--color-primary);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
    background: var(--color-bg);
}

.main-content-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 2.5rem 3rem;
}

/* ------------------------------------------------------------------ */
/*  Sidebar                                                           */
/* ------------------------------------------------------------------ */

.sidebar-header {
    padding: 1.5rem 1.25rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #ffffff;
    font-family: var(--font-brand);
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-brand-subtitle {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-top: 1px;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.75rem 0;
}

.sidebar-nav-section {
    padding: 0.5rem 1.25rem 0.375rem;
    font-size: 0.6875rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 0.5rem;
}

.sidebar-nav-section:first-child {
    margin-top: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5625rem 1.25rem;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition:
        background var(--transition-base),
        color var(--transition-base);
    border-radius: 0;
    position: relative;
}

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

.sidebar-link.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
    font-weight: 600;
}

.sidebar-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    background: #ffffff;
    border-radius: 0 2px 2px 0;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
}

.sidebar-link:hover .nav-icon,
.sidebar-link.active .nav-icon {
    opacity: 1;
}

.nav-badge {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 0.6875rem;
    font-weight: 650;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* ── Collapsible nav groups ──────────────────────────────────────── */
.nav-group {
    border: none;
    background: none;
}

.nav-group-label {
    list-style: none;
    display: flex;
    align-items: center;
    padding: 0.4375rem 1.25rem 0.25rem;
    color: rgba(255, 255, 255, 0.38);
    font-size: 0.6875rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    user-select: none;
    margin-top: 0.25rem;
    outline: none;
    transition:
        color var(--transition-base),
        background var(--transition-base);
}

.nav-group-label::-webkit-details-marker {
    display: none;
}

.nav-group-label:hover {
    color: rgba(255, 255, 255, 0.62);
    background: rgba(255, 255, 255, 0.05);
}

.nav-group-label:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.4);
    outline-offset: -2px;
}

.nav-group-chevron {
    width: 11px;
    height: 11px;
    flex-shrink: 0;
    opacity: 0.45;
    margin-left: auto;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition:
        transform 0.18s ease,
        opacity 0.18s ease;
    transform: rotate(-90deg);
}

.nav-group[open] > .nav-group-label .nav-group-chevron {
    transform: rotate(0deg);
    opacity: 0.7;
}

.nav-group[open] > .nav-group-label {
    color: rgba(255, 255, 255, 0.56);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 650;
    font-size: 0.8125rem;
    flex-shrink: 0;
    color: #ffffff;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sidebar-user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.5);
}

.sidebar-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition:
        background var(--transition-fast),
        color var(--transition-fast);
}

.sidebar-logout:hover {
    background: #ffffff;
    color: #1e3a5f;
}

/* ------------------------------------------------------------------ */
/*  Page Header                                                       */
/* ------------------------------------------------------------------ */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}

.page-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.page-title {
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--color-text-heading);
    letter-spacing: -0.015em;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    font-weight: 450;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* ------------------------------------------------------------------ */
/*  Breadcrumbs                                                       */
/* ------------------------------------------------------------------ */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--color-silver);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--color-silver);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

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

.breadcrumb-current {
    color: var(--color-text-heading);
    font-weight: 600;
}

.breadcrumb-sep {
    color: var(--color-silver-light);
    font-size: 0.75rem;
    user-select: none;
}

/* ------------------------------------------------------------------ */
/*  Cards                                                             */
/* ------------------------------------------------------------------ */

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

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.125rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.card-title {
    font-size: 1rem;
    font-weight: 650;
    color: var(--color-text-heading);
}

.card-description {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
    line-height: 1.5;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.625rem;
}

/* ------------------------------------------------------------------ */
/*  Stat Cards                                                        */
/* ------------------------------------------------------------------ */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-card-label {
    font-size: 0.8125rem;
    font-weight: 550;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-card-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-icon svg {
    width: 20px;
    height: 20px;
}

.stat-card-icon.blue {
    background: var(--color-info-bg);
    color: var(--color-action);
}
.stat-card-icon.green {
    background: var(--color-success-bg);
    color: var(--color-success);
}
.stat-card-icon.amber {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}
.stat-card-icon.red {
    background: var(--color-error-bg);
    color: var(--color-error);
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 750;
    color: var(--color-text-heading);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stat-card-delta {
    font-size: 0.75rem;
    font-weight: 600;
}

.stat-card-delta.up {
    color: var(--color-success);
}
.stat-card-delta.down {
    color: var(--color-error);
}
.stat-card-delta.neutral {
    color: var(--color-silver);
}

.stat-card-detail {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

/* ------------------------------------------------------------------ */
/*  Tables                                                            */
/* ------------------------------------------------------------------ */

.table-container {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}

.table-title {
    font-size: 1rem;
    font-weight: 650;
    color: var(--color-text-heading);
}

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

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-silver);
    background: var(--color-border-light);
    border-bottom: 1px solid var(--color-border);
}

thead th:first-child {
    padding-left: 1.5rem;
}
thead th:last-child {
    padding-right: 1.5rem;
}

tbody td {
    padding: 0.8125rem 1rem;
    font-size: 0.875rem;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

tbody td:first-child {
    padding-left: 1.5rem;
}
tbody td:last-child {
    padding-right: 1.5rem;
}

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

tbody tr:nth-child(even) {
    background: rgba(248, 250, 252, 0.5);
}

tbody tr:hover {
    background: #f1f5f9;
}

.table-link {
    color: var(--color-action);
    font-weight: 550;
}

.table-link:hover {
    color: var(--color-action-hover);
    text-decoration: underline;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.th-actions,
.td-actions {
    text-align: right;
    white-space: nowrap;
}

.td-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.375rem;
}

.td-primary {
    font-weight: 550;
    color: var(--color-text-heading);
}

.inline-form {
    display: inline;
}

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.5rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    font-weight: 550;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.pagination-btn:hover {
    background: var(--color-border-light);
    color: var(--color-text);
    border-color: var(--color-silver-light);
}

.pagination-btn.active {
    background: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
}

.pagination-btn:disabled,
.pagination-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ------------------------------------------------------------------ */
/*  Buttons                                                           */
/* ------------------------------------------------------------------ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: var(--control-padding-y) 1.125rem;
    font-size: var(--control-font-size);
    font-weight: 600;
    line-height: var(--control-line-height);
    border-radius: var(--control-radius);
    border: 1px solid transparent;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
}

.btn:focus-visible {
    outline: 2px solid var(--color-action);
    outline-offset: 2px;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

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

.btn-primary:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary-light);
    color: #ffffff;
}

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

.btn-action {
    background: var(--color-action);
    color: #ffffff;
    border-color: var(--color-action);
}

.btn-action:hover {
    background: var(--color-action-hover);
    border-color: var(--color-action-hover);
    color: #ffffff;
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-border-light);
    border-color: var(--color-silver-light);
}

.btn-danger {
    background: var(--color-error);
    color: #ffffff;
    border-color: var(--color-error);
}

.btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #ffffff;
}

.btn-cancel {
    background: transparent;
    color: var(--color-text-muted);
    border-color: transparent;
}

.btn-cancel:hover {
    background: var(--color-border-light);
    color: var(--color-text);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}

.btn-sm svg {
    width: 14px;
    height: 14px;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid transparent;
    color: var(--color-silver);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--color-border-light);
    color: var(--color-text);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-ghost {
    background: transparent;
    color: var(--color-action);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--color-border-light);
    color: var(--color-action-hover);
}

/* ------------------------------------------------------------------ */
/*  Forms                                                             */
/* ------------------------------------------------------------------ */

.form-group {
    margin-bottom: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-heading);
    margin-bottom: 0.375rem;
}

.form-label .required {
    color: var(--color-error);
    margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--control-padding-y) 0.875rem;
    font-size: var(--control-font-size);
    line-height: var(--control-line-height);
    font-weight: 450;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--control-radius);
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast);
    appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-action);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--color-silver-light);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: var(--color-error);
}

.form-input.error:focus,
.form-select.error:focus,
.form-textarea.error:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

.form-help {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.3125rem;
}

.form-error-text {
    display: block;
    font-size: 0.75rem;
    color: var(--color-error);
    margin-top: 0.3125rem;
    font-weight: 500;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-action);
    cursor: pointer;
}

.form-check-label {
    font-size: 0.875rem;
    color: var(--color-text);
    font-weight: 450;
    cursor: pointer;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
}

.card-form {
    padding: 1.5rem;
}

.form-hint {
    font-weight: 400;
    color: var(--color-silver);
    font-size: 0.8125rem;
}

.form-select-sm {
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
}

/* ------------------------------------------------------------------ */
/*  Badges                                                            */
/* ------------------------------------------------------------------ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    padding: 0.1875rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 10px;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-scheduled {
    background: var(--color-info-bg);
    color: var(--color-action);
    border: 1px solid var(--color-info-border);
}

.badge-in_progress {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid var(--color-warning-border);
}

.badge-completed {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid var(--color-success-border);
}

.badge-cancelled {
    background: #f8fafc;
    color: var(--color-silver);
    border: 1px solid var(--color-border);
}

.badge-draft {
    background: #f8fafc;
    color: var(--color-silver);
    border: 1px solid var(--color-border);
}

.badge-sent {
    background: var(--color-info-bg);
    color: var(--color-action);
    border: 1px solid var(--color-info-border);
}

.badge-paid {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid var(--color-success-border);
}

.badge-overdue {
    background: var(--color-error-bg);
    color: var(--color-error);
    border: 1px solid var(--color-error-border);
}

.badge-void {
    background: #f8fafc;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    text-decoration: line-through;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.badge-en-route {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid var(--color-warning-border);
}

.badge-in-progress {
    background: #f5f3ff;
    color: #6d28d9;
    border: 1px solid #ddd6fe;
}

.badge-active {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid var(--color-success-border);
}

.badge-inactive {
    background: #f8fafc;
    color: var(--color-silver);
    border: 1px solid var(--color-border);
}

.badge-info {
    background: var(--color-info-bg);
    color: var(--color-action);
    border: 1px solid var(--color-info-border);
}

/* ------------------------------------------------------------------ */
/*  Service-Type Badge Picker                                         */
/* ------------------------------------------------------------------ */

.st-badge-area {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    min-height: 1.5rem;
    margin-bottom: 0.5rem;
}

.st-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 6px;
    background: var(--color-info-bg);
    color: var(--color-action);
    border: 1px solid var(--color-info-border);
}

.st-badge-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: none;
    color: var(--color-action);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.st-badge-remove:hover {
    opacity: 1;
}

/* ------------------------------------------------------------------ */
/*  Phone Input with Country Code Picker                              */
/* ------------------------------------------------------------------ */

.phone-input-group {
    display: flex;
    width: 100%;
}

.phone-country-select {
    padding: var(--control-padding-y) 0.5rem;
    font-size: var(--control-font-size);
    line-height: var(--control-line-height);
    font-weight: 500;
    color: var(--color-text);
    background: var(--color-border-light);
    border: 1px solid var(--color-border);
    border-right: none;
    border-radius: var(--control-radius) 0 0 var(--control-radius);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.375rem center;
    padding-right: 1.25rem;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 0;
    max-width: 80px;
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.phone-country-select:focus {
    outline: none;
    border-color: var(--color-action);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    z-index: 1;
}

/* ------------------------------------------------------------------ */
/*  Search Bar                                                        */
/* ------------------------------------------------------------------ */

.search-bar {
    position: relative;
    width: 100%;
    max-width: 360px;
}

.search-bar-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--color-silver-light);
    pointer-events: none;
}

.search-bar input {
    width: 100%;
    padding: 0.5rem 0.875rem 0.5rem 2.5rem;
    font-size: 0.875rem;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--color-action);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search-bar input::placeholder {
    color: var(--color-silver-light);
}

/* ------------------------------------------------------------------ */
/*  Filter Bar                                                        */
/* ------------------------------------------------------------------ */

.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem;
    background: var(--color-border-light);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.filter-btn {
    padding: 0.4375rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 550;
    color: var(--color-text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.filter-btn:hover {
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.6);
}

.filter-btn.active {
    color: var(--color-text-heading);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.filter-btn .count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 0.375rem;
    margin-left: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 650;
    background: var(--color-border);
    color: var(--color-text-muted);
    border-radius: 9px;
}

.filter-btn.active .count {
    background: var(--color-action);
    color: #ffffff;
}

.filter-tabs {
    display: contents;
}

.filter-select {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.filter-label {
    font-size: 0.8125rem;
    font-weight: 550;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.date-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--color-text);
    background: var(--color-surface);
    cursor: pointer;
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.date-input:focus {
    outline: none;
    border-color: var(--color-action);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.today-indicator {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    background: var(--color-info-bg);
    color: var(--color-action);
    border: 1px solid var(--color-info-border);
}

/* ------------------------------------------------------------------ */
/*  Dispatch Board                                                    */
/* ------------------------------------------------------------------ */

.dispatch-board {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.dispatch-column {
    min-width: 320px;
    max-width: 380px;
    flex-shrink: 0;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.dispatch-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--color-border);
}

.dispatch-column-title {
    font-weight: 600;
    color: var(--color-text-heading);
    font-size: 0.95rem;
}

.dispatch-column-phone {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.1rem;
}

.dispatch-column-count {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    background: var(--color-border-light);
    border: 1px solid var(--color-border);
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    white-space: nowrap;
}

.dispatch-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 0.875rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-sm);
    border-left: 3px solid transparent;
}

.dispatch-card:last-child {
    margin-bottom: 0;
}

.dispatch-card.status-scheduled {
    border-left-color: var(--color-action);
}

.dispatch-card.status-en-route {
    border-left-color: var(--color-warning);
}

.dispatch-card.status-in-progress {
    border-left-color: #8b5cf6;
}

.dispatch-card.status-completed {
    border-left-color: var(--color-success);
}

.dispatch-card.status-cancelled {
    border-left-color: var(--color-error);
}

.dispatch-card-time {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-action);
    margin-bottom: 0.35rem;
}

.dispatch-card-client {
    font-weight: 600;
    color: var(--color-text-heading);
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.dispatch-card-service {
    font-size: 0.825rem;
    color: var(--color-text-muted);
    margin-bottom: 0.35rem;
}

.dispatch-card-address {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.dispatch-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dispatch-card-nav {
    font-size: 0.8rem;
    color: var(--color-action);
    text-decoration: none;
}

.dispatch-card-nav:hover {
    text-decoration: underline;
}

.dispatch-card-notes {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: var(--color-silver-light);
    font-style: italic;
}

.dispatch-unassigned {
    background: var(--color-warning-bg);
    border-color: var(--color-warning-border);
}

.dispatch-unassigned .dispatch-column-header {
    border-bottom-color: var(--color-warning);
}

.dispatch-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.dispatch-card-link:hover .dispatch-card-client {
    color: var(--color-action);
}

.dispatch-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border);
}

.dispatch-action-form {
    flex: 1;
    min-width: 0;
}

.dispatch-select {
    width: 100%;
    font-size: 0.75rem;
    padding: 0.25rem 0.375rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
}

.dispatch-select:hover {
    border-color: var(--color-action);
}

/* ------------------------------------------------------------------ */
/*  Empty States                                                      */
/* ------------------------------------------------------------------ */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 2rem;
    text-align: center;
}

.empty-state-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 1.25rem;
    color: var(--color-silver-light);
    opacity: 0.6;
}

.empty-state-icon svg {
    width: 100%;
    height: 100%;
    stroke-width: 1.2;
}

.empty-state-title {
    font-size: 1.0625rem;
    font-weight: 650;
    color: var(--color-text-heading);
    margin-bottom: 0.375rem;
}

.empty-state-text {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    max-width: 380px;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* ------------------------------------------------------------------ */
/*  Alerts                                                            */
/* ------------------------------------------------------------------ */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1.25rem;
    border: 1px solid;
}

.alert svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-success {
    background: var(--color-success-bg);
    color: #15803d;
    border-color: var(--color-success-border);
}

.alert-error,
.alert-danger {
    background: var(--color-error-bg);
    border-color: var(--color-error-border);
    color: #b91c1c;
}

.alert-warning {
    background: var(--color-warning-bg);
    color: #92400e;
    border-color: var(--color-warning-border);
}

.alert-info {
    background: var(--color-info-bg);
    color: #1d4ed8;
    border-color: var(--color-info-border);
}

.alert-dismiss {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

.alert-dismiss:hover {
    opacity: 0.8;
}

/* ------------------------------------------------------------------ */
/*  Modal / Dialog                                                    */
/* ------------------------------------------------------------------ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 200ms ease,
        visibility 200ms ease;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(8px) scale(0.98);
    transition: transform 200ms ease;
}

.modal-overlay.open .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.modal-title {
    font-size: 1.0625rem;
    font-weight: 650;
    color: var(--color-text-heading);
}

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--color-silver);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--color-border-light);
    color: var(--color-text);
}

.modal-body {
    padding: 1.5rem;
    font-size: 0.9375rem;
    color: var(--color-text);
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.625rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-border);
}

.modal-danger-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-error-bg);
    color: var(--color-error);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.modal-danger-icon svg {
    width: 24px;
    height: 24px;
}

/* ------------------------------------------------------------------ */
/*  Detail View                                                       */
/* ------------------------------------------------------------------ */

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.detail-field {
    display: flex;
    flex-direction: column;
    gap: 0.1875rem;
}

.detail-field.full-width {
    grid-column: 1 / -1;
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-silver);
}

.detail-value {
    font-size: 0.9375rem;
    color: var(--color-text);
    font-weight: 450;
}

.detail-map-link {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-action);
    text-decoration: none;
    margin-left: 0.5rem;
    white-space: nowrap;
}

.detail-map-link:hover {
    text-decoration: underline;
}

.section {
    margin-top: 2rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 650;
    color: var(--color-text-heading);
}

.secret-display {
    background: var(--color-border-light);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    letter-spacing: 0.15em;
    text-align: center;
    color: var(--color-primary);
    word-break: break-all;
    user-select: all;
    cursor: text;
}

.secret-meta {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--color-silver-light);
    text-align: center;
}

.uri-display {
    margin-top: 0.5rem;
    background: var(--color-border-light);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    word-break: break-all;
    color: var(--color-text-muted);
    user-select: all;
    cursor: text;
}

.qr-wrapper {
    text-align: center;
    margin-bottom: 1.5rem;
}

.qr-wrapper img,
.qr-wrapper svg {
    display: block;
    margin: 0 auto;
    width: 100%;
    height: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 8px;
    background: var(--color-surface);
}

/* ------------------------------------------------------------------ */
/*  Description List                                                  */
/* ------------------------------------------------------------------ */

.dl-horizontal {
    display: grid;
    grid-template-columns: minmax(120px, auto) 1fr;
    gap: 0.625rem 1.5rem;
    font-size: 0.875rem;
}

.dl-horizontal dt {
    color: var(--color-text-muted);
    font-weight: 550;
}

.dl-horizontal dd {
    color: var(--color-text);
}

/* ------------------------------------------------------------------ */
/*  Tabs                                                              */
/* ------------------------------------------------------------------ */

.tabs {
    display: flex;
    align-items: center;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 550;
    color: var(--color-text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
    cursor: pointer;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab:hover {
    color: var(--color-text);
}

.tab.active {
    color: var(--color-action);
    border-bottom-color: var(--color-action);
    font-weight: 650;
}

/* ------------------------------------------------------------------ */
/*  Divider                                                           */
/* ------------------------------------------------------------------ */

.divider {
    height: 1px;
    background: var(--color-border);
    margin: 1.5rem 0;
    border: none;
}

/* ------------------------------------------------------------------ */
/*  Utility Classes                                                   */
/* ------------------------------------------------------------------ */

.text-muted {
    color: var(--color-text-muted);
}
.text-silver {
    color: var(--color-silver);
}
.text-success {
    color: var(--color-success);
}
.text-error {
    color: var(--color-error);
}
.text-warning {
    color: var(--color-warning);
}
.text-action {
    color: var(--color-action);
}
.text-heading {
    color: var(--color-text-heading);
}
.text-sm {
    font-size: 0.8125rem;
}
.text-xs {
    font-size: 0.75rem;
}
.text-lg {
    font-size: 1.0625rem;
}
.text-center {
    text-align: center;
}
.text-right {
    text-align: right;
}
.text-mono {
    font-family: var(--font-mono);
}

.font-medium {
    font-weight: 500;
}
.font-semibold {
    font-weight: 600;
}
.font-bold {
    font-weight: 700;
}

.flex {
    display: flex;
}
.flex-col {
    flex-direction: column;
}
.items-center {
    align-items: center;
}
.items-end {
    align-items: flex-end;
}
.justify-between {
    justify-content: space-between;
}
.justify-end {
    justify-content: flex-end;
}
.gap-xs {
    gap: 0.25rem;
}
.gap-sm {
    gap: 0.5rem;
}
.gap-md {
    gap: 0.75rem;
}
.gap-lg {
    gap: 1rem;
}
.gap-xl {
    gap: 1.5rem;
}
.flex-1 {
    flex: 1;
}
.flex-shrink-0 {
    flex-shrink: 0;
}
.flex-wrap {
    flex-wrap: wrap;
}

.w-full {
    width: 100%;
}
.max-w-sm {
    max-width: 480px;
}
.max-w-md {
    max-width: 640px;
}
.max-w-lg {
    max-width: 800px;
}

.mt-0 {
    margin-top: 0;
}
.mt-1 {
    margin-top: 0.25rem;
}
.mt-2 {
    margin-top: 0.5rem;
}
.mt-3 {
    margin-top: 0.75rem;
}
.mt-4 {
    margin-top: 1rem;
}
.mt-6 {
    margin-top: 1.5rem;
}
.mt-8 {
    margin-top: 2rem;
}

.mb-0 {
    margin-bottom: 0;
}
.mb-1 {
    margin-bottom: 0.25rem;
}
.mb-2 {
    margin-bottom: 0.5rem;
}
.mb-3 {
    margin-bottom: 0.75rem;
}
.mb-4 {
    margin-bottom: 1rem;
}
.mb-6 {
    margin-bottom: 1.5rem;
}
.mb-8 {
    margin-bottom: 2rem;
}

.ml-auto {
    margin-left: auto;
}
.mr-auto {
    margin-right: auto;
}

.p-0 {
    padding: 0;
}
.p-4 {
    padding: 1rem;
}
.p-6 {
    padding: 1.5rem;
}

.hidden {
    display: none;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nowrap {
    white-space: nowrap;
}

.cursor-pointer {
    cursor: pointer;
}

/* ------------------------------------------------------------------ */
/*  Loading / Spinner                                                 */
/* ------------------------------------------------------------------ */

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-action);
    border-radius: 50%;
    animation: spin 600ms linear infinite;
}

.spinner-lg {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

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

.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease;
}

.htmx-request .htmx-indicator {
    opacity: 1;
}

.htmx-request.htmx-indicator {
    opacity: 1;
}

/* ------------------------------------------------------------------ */
/*  Tooltip                                                           */
/* ------------------------------------------------------------------ */

[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.3125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #ffffff;
    background: var(--color-text);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: 50;
}

[data-tooltip]:hover::after {
    opacity: 1;
}

/* ------------------------------------------------------------------ */
/*  Sidebar Mobile Toggle                                             */
/* ------------------------------------------------------------------ */

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 200;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--color-primary);
    color: #ffffff;
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.sidebar-toggle svg {
    width: 22px;
    height: 22px;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 90;
}

/* ── Field Monitor ────────────────────────────────────────────────────── */

.monitor-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 999px;
    animation: live-pulse 2s ease-in-out infinite;
}

@keyframes live-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Urgency indicators on job cards */
.dispatch-card.card-overdue {
    border-left-width: 4px;
    border-left-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.04);
}

.urgency-badge {
    display: inline-block;
    float: right;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.25rem;
}

.dispatch-card.card-warning {
    border-left-color: #f59e0b !important;
    background: rgba(245, 158, 11, 0.04);
}

/* Online/offline indicators for tech columns */
.online-indicator {
    color: #22c55e;
    font-size: 0.75rem;
    margin-left: 0.375rem;
}

.offline-indicator {
    color: var(--color-silver-light);
    font-size: 0.75rem;
    margin-left: 0.375rem;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    color: #fff;
    background: var(--color-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(120%);
    transition: transform 0.3s ease;
    pointer-events: auto;
    max-width: 360px;
}

.toast-visible {
    transform: translateX(0);
}

.toast-success {
    background: #22c55e;
}

.toast-warning {
    background: #f59e0b;
    color: #000;
}

.toast-error {
    background: #ef4444;
}

.toast-info {
    background: var(--color-primary);
}

/* ── Field Monitor — Timeline Swimlane ───────────────────────────────── */

.timeline-container {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.timeline-header-row {
    display: flex;
    align-items: flex-end;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
    padding: 0.5rem 0 0;
    min-width: 1600px;
}

.timeline-label-col {
    flex-shrink: 0;
    width: 160px;
    min-width: 160px;
    position: sticky;
    left: 0;
    z-index: 3;
}

.timeline-header-row .timeline-label-col {
    background: var(--color-bg);
}

.timeline-track-col {
    flex: 1;
    position: relative;
    min-width: 0;
}

.timeline-header-row .timeline-track-col {
    height: 1.75rem;
}

.timeline-hour-label {
    position: absolute;
    transform: translateX(-50%);
    font-size: 0.6875rem;
    color: var(--color-silver-light);
    white-space: nowrap;
    bottom: 0.375rem;
}

/* First label left-align, last label right-align to avoid overflow */
.timeline-hour-label:first-child {
    transform: none;
    left: 0 !important;
}
.timeline-hour-label:last-child {
    transform: translateX(-100%);
}

.timeline-body {
    display: flex;
    flex-direction: column;
    position: relative;
}

.timeline-lane {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--color-border-light);
    min-width: 1600px;
}

.timeline-lane:last-child {
    border-bottom: none;
}

.timeline-lane-label {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.125rem;
    padding: 0.625rem 0.875rem;
    border-right: 1px solid var(--color-border-light);
    background: var(--color-bg);
}

.timeline-lane-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 136px;
}

.timeline-lane-sub {
    font-size: 0.6875rem;
    color: var(--color-silver-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 136px;
}

.timeline-lane-count {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--color-silver-light);
}

.timeline-lane-track {
    position: relative;
    height: 56px;
    background-image: linear-gradient(
        90deg,
        var(--color-border-light) 1px,
        transparent 1px
    );
    background-size: calc(100% / 24) 100%;
}

.timeline-block {
    position: absolute;
    top: 8px;
    bottom: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    overflow: hidden;
    text-decoration: none;
    transition:
        filter 0.15s,
        transform 0.1s;
    cursor: pointer;
    min-width: 4px;
    z-index: 1;
}

.timeline-block:hover {
    filter: brightness(0.88);
    transform: scaleY(1.06);
    z-index: 10;
}

.timeline-block-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #fff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 0.375rem;
}

/* Status-based block colors — higher specificity to beat any inherited link styles */
.timeline-container .timeline-block.status-scheduled {
    background: #f59e0b;
}
.timeline-container .timeline-block.status-en-route {
    background: #3b82f6;
}
.timeline-container .timeline-block.status-in-progress {
    background: rgba(99, 102, 241, 0.45);
    animation: pulse-in-progress 2s ease-in-out infinite;
    border: 1px solid rgba(99, 102, 241, 0.6);
}

.timeline-container .timeline-block.status-in-progress .timeline-block-label {
    color: #312e81 !important;
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
}

@keyframes pulse-in-progress {
    0%,
    100% {
        background: rgba(99, 102, 241, 0.35);
    }
    50% {
        background: rgba(99, 102, 241, 0.6);
    }
}
.timeline-container .timeline-block.status-completed {
    background: #22c55e;
}
.timeline-container .timeline-block.status-cancelled {
    background: #9ca3af;
}

/* NOW indicator */
.timeline-now-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ef4444;
    z-index: 6;
    pointer-events: none;
}

/* ── OperariMap ──────────────────────────────────────────────────── */

.field-map-container {
    height: 480px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.omap-tooltip {
    position: absolute;
    z-index: 20;
    background: var(--color-text-heading);
    color: #fff;
    font-size: 0.75rem;
    line-height: 1.4;
    padding: 0.5rem 0.625rem;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    white-space: nowrap;
    max-width: 260px;
}

.omap-tooltip .omap-status {
    text-transform: capitalize;
    opacity: 0.7;
    font-size: 0.6875rem;
}

.omap-attr {
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: 0.5625rem;
    color: var(--color-silver-light);
    background: rgba(255, 255, 255, 0.7);
    padding: 1px 4px;
    border-radius: 2px;
    z-index: 10;
}

.omap-attr a {
    color: inherit;
    text-decoration: underline;
}

.omap-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 10;
}

.omap-zoom-btn {
    width: 30px;
    height: 30px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 1.125rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    transition: background 0.1s;
}

.omap-zoom-btn:hover {
    background: var(--color-bg);
}

/* ── OperariMap Modal ──────────────────────────────────────────── */

.omap-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.omap-modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.omap-modal-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    position: relative;
}

.omap-modal-title {
    font-size: 1rem;
    font-weight: 650;
    color: var(--color-text-heading);
    flex: 1;
}

.omap-modal-subtitle {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-top: 0.125rem;
}

.omap-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--color-silver-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition:
        color 0.15s,
        background 0.15s;
}

.omap-modal-close:hover {
    color: var(--color-text);
    background: var(--color-bg);
}

.omap-modal-map {
    height: 450px;
    position: relative;
    overflow: hidden;
}

/* ------------------------------------------------------------------ */
/*  Responsive                                                        */
/* ------------------------------------------------------------------ */

@media (max-width: 1024px) {
    .main-content-inner {
        padding: 1.5rem 1.5rem 2rem;
    }

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

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

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

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 250ms ease;
        z-index: 150;
    }

    .sidebar.open {
        transform: translateX(0);
    }

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

    .sidebar-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0;
    }

    .main-content-inner {
        padding: 4rem 1rem 2rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header-actions,
    .page-header-right {
        width: 100%;
    }

    .page-header-actions .btn,
    .page-header-right .btn {
        flex: 1;
    }

    .page-title {
        font-size: 1.375rem;
    }

    .stat-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card-value {
        font-size: 1.375rem;
    }

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

    .search-bar {
        max-width: none;
    }

    .filter-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .table-header {
        flex-direction: column;
        align-items: stretch;
    }

    .table-footer {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }

    .modal {
        max-width: none;
        margin: 1rem;
    }

    .breadcrumb {
        font-size: 0.75rem;
    }

    .tabs {
        overflow-x: auto;
    }

    .tab {
        padding: 0.625rem 1rem;
        font-size: 0.8125rem;
    }

    .dl-horizontal {
        grid-template-columns: 1fr;
        gap: 0.25rem 0;
    }

    .dl-horizontal dt {
        margin-top: 0.5rem;
    }

    .dl-horizontal dt:first-child {
        margin-top: 0;
    }

    .dispatch-board {
        flex-direction: column;
    }

    .dispatch-column {
        min-width: 0;
        max-width: none;
    }
}

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

    .page-header-actions,
    .page-header-right {
        flex-direction: column;
    }

    .page-header-actions .btn,
    .page-header-right .btn {
        width: 100%;
    }

    .card-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.625rem;
    }

    .card-body {
        padding: 1rem;
    }

    .card-footer {
        padding: 0.875rem 1rem;
        flex-direction: column;
    }

    .modal-header {
        padding: 1rem 1.25rem;
    }

    .modal-body {
        padding: 1.25rem;
    }

    .modal-footer {
        padding: 0.875rem 1.25rem;
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }
}
@media print {
    .sidebar,
    .sidebar-toggle,
    .sidebar-backdrop {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }

    .btn,
    .search-bar,
    .filter-bar {
        display: none;
    }

    body {
        background: #ffffff;
        color: #000000;
    }

    .card {
        box-shadow: none;
        border: 1px solid #cccccc;
    }
}

/* ------------------------------------------------------------------ */
/*  Tab Navigation                                                    */
/* ------------------------------------------------------------------ */

.tab-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 1.5rem;
}

.tab-link {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition:
        color var(--transition-fast),
        border-color var(--transition-fast);
    cursor: pointer;
}

.tab-link:hover {
    color: var(--color-text);
    border-bottom-color: var(--color-border);
}

.tab-link.active {
    color: var(--color-action);
    border-bottom-color: var(--color-action);
    font-weight: 600;
}

/* ------------------------------------------------------------------ */
/*  Status Badge Additions                                            */
/* ------------------------------------------------------------------ */

.badge-suspended {
    background: var(--color-error-bg);
    color: var(--color-error);
    border: 1px solid var(--color-error-border);
}

.badge-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border: 1px solid var(--color-warning-border);
}

.badge-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* ------------------------------------------------------------------ */
/*  Detail Page Utilities                                             */
/* ------------------------------------------------------------------ */

.detail-group {
    margin-bottom: 1rem;
}

.action-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.btn-warning {
    background: var(--color-warning);
    color: #ffffff;
    border-color: var(--color-warning);
}

.btn-warning:hover {
    background: #b45309;
    border-color: #b45309;
    color: #ffffff;
}

/* ------------------------------------------------------------------ */
/*  Image Preview                                                     */
/* ------------------------------------------------------------------ */

.card-image-preview {
    width: 160px;
    height: 160px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
}

.card-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Technician profile ───────────────────────────────────────────────── */

.tech-color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.5rem;
    vertical-align: middle;
    flex-shrink: 0;
}

.tech-color-dot-empty {
    background: var(--color-border);
    opacity: 0.4;
}

.tech-name-cell {
    display: inline-flex;
    align-items: center;
}

.section-heading {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-heading);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.detail-field-full {
    grid-column: 1 / -1;
}

.tech-notes {
    white-space: pre-wrap;
    color: var(--color-text);
    line-height: 1.6;
}

/* Form sections */
.form-section {
    border: none;
    padding: 0;
    margin: 0 0 2rem 0;
}

.form-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-heading);
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.form-row {
    display: flex;
    gap: 1rem;
}

@media (max-width: 640px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

.flex-1 {
    flex: 1;
}

.form-textarea {
    resize: vertical;
    min-height: 4rem;
    font-family: inherit;
}

/* Color picker */
.color-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.color-text-input {
    flex: 1;
}

.color-picker-input {
    width: 42px;
    height: 42px;
    padding: 2px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    background: none;
}

/* Certification form */
.cert-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.cert-form-grid .form-group {
    margin-bottom: 0;
}

/* Clickable table rows */
.clickable-row:hover {
    background: var(--color-border-light);
}

/* Dispatch tech color stripe */
.dispatch-column-color-stripe {
    height: 3px;
    border-radius: 2px;
    margin-bottom: 0.5rem;
}

/* ------------------------------------------------------------------ */
/*  Audit Detail Formatting                                           */
/* ------------------------------------------------------------------ */

.audit-expand {
    cursor: pointer;
    font-size: 0.8125rem;
    line-height: 1.5;
}

.audit-expand summary {
    color: var(--color-action);
    font-weight: 500;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.audit-expand summary::before {
    content: "▸";
    display: inline-block;
    transition: transform 0.15s ease;
    font-size: 0.6875rem;
}

.audit-expand[open] summary::before {
    transform: rotate(90deg);
}

.audit-expand summary::-webkit-details-marker {
    display: none;
}

.audit-detail-body {
    margin-top: 0.375rem;
    padding-left: 0.75rem;
    border-left: 2px solid var(--color-border);
    font-size: 0.75rem;
    color: var(--color-text);
}

.audit-section {
    margin-bottom: 0.375rem;
}

.audit-section:last-child {
    margin-bottom: 0;
}

.audit-section-title {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.125rem;
}

.audit-kv {
    line-height: 1.5;
}

.audit-text {
    font-size: 0.8125rem;
    line-height: 1.5;
}

.audit-change-arrow {
    color: var(--color-text-muted);
    margin: 0 0.125rem;
}

/* ── Progress Bar ───────────────────────────────────────────────────── */

.progress-track {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary, var(--color-border-light));
    border-radius: var(--radius-md);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-md);
    transition: width 0.3s ease;
    max-width: 100%;
    background: var(--color-success);
}

.progress-fill.progress-warning {
    background: var(--color-warning);
}

.progress-fill.progress-danger {
    background: var(--color-error);
}

/* ── Stat Link (clickable stat-card values) ─────────────────────────── */

.stat-link {
    color: inherit;
    text-decoration: none;
}

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

.stat-link.text-danger {
    color: var(--color-error);
}

/* ── Job Photos ──────────────────────────────────────────────── */

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}

.photo-grid-item {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    text-decoration: none;
    color: var(--color-text);
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}

.photo-grid-item:hover {
    border-color: var(--color-action);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.photo-grid-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    background: var(--color-bg);
}

.photo-caption {
    padding: 0.375rem 0.5rem 0;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.photo-date {
    padding: 0.25rem 0.5rem 0.375rem;
    font-size: 0.6875rem;
    color: var(--color-text-muted);
}

/* ── Calendar ────────────────────────────────────────────────── */

/* Month grid */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}
.cal-header > div {
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-weight: 650;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--color-border);
}
.cal-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.625rem 0.75rem;
    min-height: 90px;
    border-bottom: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    text-decoration: none;
    color: var(--color-text);
    transition: background 0.15s;
    position: relative;
}
.cal-cell:nth-child(7n) {
    border-right: none;
}
.cal-cell:nth-last-child(-n + 7) {
    border-bottom: none;
}
.cal-cell:hover {
    background: var(--color-border-light);
}
.cal-cell-muted {
    color: var(--color-silver-light);
    background: var(--color-bg);
}
.cal-cell-muted:hover {
    background: var(--color-border-light);
}
.cal-cell-today {
    background: var(--color-info-bg);
    border-color: var(--color-info-border);
}
.cal-day-number {
    font-weight: 700;
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
}
.cal-cell-today .cal-day-number {
    color: var(--color-action);
}
.cal-job-count {
    font-size: 0.75rem;
    font-weight: 550;
    color: var(--color-text-muted);
}
.cal-done-indicator {
    font-size: 0.6875rem;
    color: var(--color-success);
    font-weight: 600;
}
.cal-progress {
    font-size: 0.6875rem;
    color: var(--color-warning);
    font-weight: 600;
}
.cal-unassigned {
    font-size: 0.6875rem;
    color: var(--color-error);
    font-weight: 600;
}
.cal-time-off-dot {
    font-size: 0.5rem;
    color: var(--color-error);
    position: absolute;
    top: 0.5rem;
    right: 0.625rem;
}

/* Tech filter toolbar */
.cal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.cal-filter-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-right: 0.25rem;
}
.cal-filter-select {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    min-width: 180px;
}
.cal-filter-select:focus {
    outline: none;
    border-color: var(--color-action);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* Week grid */
.cal-week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.75rem;
}
.cal-week-col {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-height: 300px;
}
.cal-week-col-today {
    border-color: var(--color-action);
    box-shadow: 0 0 0 1px var(--color-action);
}
.cal-week-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}
.cal-week-day-link {
    font-weight: 650;
    font-size: 0.8125rem;
    color: var(--color-text-heading);
    text-decoration: none;
    flex: 1;
}
.cal-week-day-link:hover {
    color: var(--color-action);
}
.cal-week-count {
    background: var(--color-primary);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
}
.cal-week-unassigned-badge {
    background: var(--color-error);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
}
.cal-week-body {
    padding: 0.5rem;
}
.cal-week-empty {
    padding: 1rem 0.5rem;
    text-align: center;
    color: var(--color-silver-light);
    font-size: 0.8125rem;
}
.cal-job-card {
    display: block;
    padding: 0.5rem 0.625rem;
    margin-bottom: 0.375rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-text);
    transition:
        background 0.15s,
        border-color 0.15s;
    position: relative;
}
.cal-job-card:hover {
    background: var(--color-border-light);
    border-color: var(--color-silver-light);
}
.cal-job-card-unassigned {
    border-left: 3px solid var(--color-error);
}
.cal-job-tech-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}
.cal-job-time {
    font-size: 0.75rem;
    font-weight: 650;
    color: var(--color-text-heading);
    margin-bottom: 0.125rem;
}
.cal-job-client {
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cal-job-meta {
    margin-bottom: 0.25rem;
}
.cal-job-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.6875rem;
    color: var(--color-text-muted);
}
.cal-job-type {
    font-weight: 500;
}
.cal-job-tech {
    font-style: italic;
}

/* View toggle button group */
.cal-view-toggle {
    display: inline-flex;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.cal-view-toggle a {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--color-text-muted);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    transition:
        background 0.15s,
        color 0.15s;
}
.cal-view-toggle a:last-child {
    border-right: none;
}
.cal-view-toggle a:hover {
    background: var(--color-border-light);
    color: var(--color-text);
}
.cal-view-toggle a.active {
    background: var(--color-action);
    color: #fff;
}

/* ── Day view ────────────────────────────────────────────────── */

/* Outer wrapper: border + rounding */
.cal-day-wrapper {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-surface);
}

/* Sticky header row: 52px spacer + one cell per tech column */
.cal-day-header-row {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}
.cal-day-header-spacer {
    flex: 0 0 52px;
    border-right: 1px solid var(--color-border);
}
.cal-day-col-header {
    flex: 1;
    min-width: 220px;
    padding: 0.5rem 0.625rem;
    text-align: center;
    font-weight: 650;
    font-size: 0.8125rem;
    color: var(--color-text-heading);
    border-right: 1px solid var(--color-border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cal-day-col-header:last-child {
    border-right: none;
}
.cal-day-col-header .cal-day-col-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

/* Scrollable body row: hour labels + tech column bodies side by side */
.cal-day-container {
    display: flex;
    overflow-x: auto;
}
.cal-day-hours {
    flex: 0 0 52px;
    border-right: 1px solid var(--color-border);
    background: var(--color-bg);
    position: relative;
    height: 1440px;
}
.cal-day-hour-label {
    position: absolute;
    right: 8px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--color-text-muted);
    line-height: 1;
    transform: translateY(-50%);
    white-space: nowrap;
}
.cal-day-columns {
    flex: 1;
    display: flex;
    min-width: 0;
}
.cal-day-col {
    flex: 1;
    min-width: 220px;
    border-right: 1px solid var(--color-border);
    position: relative;
}
.cal-day-col:last-child {
    border-right: none;
}
.cal-day-col-body {
    position: relative;
    /* 24 hours × 60px per hour = 1440px */
    height: 1440px;
}
.cal-day-hour-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--color-border);
}
.cal-day-avail-window {
    position: absolute;
    left: 0;
    right: 0;
    background: rgba(34, 197, 94, 0.08);
    border-left: 3px solid rgba(34, 197, 94, 0.35);
    pointer-events: none;
    z-index: 0;
}
.cal-day-job-block {
    position: absolute;
    left: 4px;
    right: 4px;
    min-height: 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-border);
    background: var(--color-surface);
    padding: 0.25rem 0.4rem;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    color: var(--color-text);
    z-index: 1;
    transition:
        box-shadow 0.15s,
        border-color 0.15s;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 1px;
}
.cal-day-job-block:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border-color: var(--color-action);
    z-index: 2;
}
.cal-day-job-block-unassigned {
    border-left: 3px solid var(--color-error) !important;
}
.cal-day-job-block-completed {
    background: rgba(34, 197, 94, 0.06);
}
.cal-day-job-block-in-progress {
    background: rgba(245, 158, 11, 0.08);
}
.cal-day-job-block-en-route {
    background: rgba(59, 130, 246, 0.08);
}
.cal-day-job-block-cancelled {
    background: rgba(107, 114, 128, 0.06);
    opacity: 0.7;
}
/* First line: time + client name side by side */
.cal-day-job-line1 {
    display: flex;
    align-items: baseline;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
}
.cal-day-job-time {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--color-text-heading);
    line-height: 1.3;
    white-space: nowrap;
    flex: 0 0 auto;
}
.cal-day-job-client {
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
/* Second line: service type */
.cal-day-job-type {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cal-day-job-badge {
    margin-top: 1px;
}
.cal-day-job-badge .badge {
    font-size: 0.625rem;
    padding: 0.125rem 0.4rem;
}
.cal-day-now-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-error);
    z-index: 3;
    pointer-events: none;
}
.cal-day-now-line::before {
    content: "";
    position: absolute;
    left: -4px;
    top: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-error);
}
.cal-day-scroll-wrapper {
    max-height: 720px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}
.cal-day-unassigned-section {
    margin-top: 1rem;
}
.cal-day-unassigned-header {
    font-weight: 650;
    font-size: 0.875rem;
    color: var(--color-error);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}
.cal-day-unassigned-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
}
.cal-day-empty {
    text-align: center;
    color: var(--color-silver-light);
    font-size: 0.875rem;
    padding: 3rem 1rem;
}

/* Responsive: stack week columns on small screens */
@media (max-width: 1200px) {
    .cal-week-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
@media (max-width: 768px) {
    .cal-week-grid {
        grid-template-columns: 1fr;
    }
    .cal-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .cal-day-col {
        min-width: 120px;
    }
}
