/* === Reset & Base === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-primary: #1a3a6b;
    --color-primary-light: #2471a3;
    --color-gold: #FFD540;
    --color-accent: #27ae60;
    --color-danger: #c0392b;
    --color-warning: #f39c12;
    --color-muted: #5d7083;
    --color-bg: #f5f7fa;
    --color-surface: #ffffff;
    --color-text: #1a2d3d;
    --color-text-light: #5d7083;
    --color-border: #c8d8e8;
    --color-hover: rgba(26, 58, 107, 0.06);
    --color-bg-subtle: #eef3f8;
    --color-surface-alt: #f8f8f9;
    --radius: 4px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);

    /* Gradient KPI-card palette — shared by .oh-kpi-v1..v8 (light mode) */
    --gradient-kpi-1: radial-gradient(ellipse at 25% 20%, rgba(255,255,255,0.18) 0%, transparent 55%),
        linear-gradient(145deg, #70A4C4 0%, #2459A3 100%);
    --gradient-kpi-2: radial-gradient(ellipse at 25% 20%, rgba(255,255,255,0.16) 0%, transparent 55%),
        linear-gradient(145deg, #2459A3 0%, #1B3C59 100%);
    --gradient-kpi-3: radial-gradient(ellipse at 25% 20%, rgba(255,255,255,0.1) 0%, transparent 55%),
        linear-gradient(145deg, #1B3C59 0%, #141E28 100%);
    --gradient-kpi-4: radial-gradient(ellipse at 25% 20%, rgba(255,255,255,0.14) 0%, transparent 55%),
        linear-gradient(145deg, #2459A3 0%, #141E28 100%);
    --gradient-kpi-5: radial-gradient(ellipse at 25% 20%, rgba(255,255,255,0.16) 0%, transparent 55%),
        linear-gradient(145deg, #70A4C4 0%, #1B3C59 100%);
    --gradient-kpi-6: radial-gradient(ellipse at 25% 20%, rgba(255,255,255,0.12) 0%, transparent 55%),
        linear-gradient(145deg, #141E28 0%, #2459A3 100%);
    --gradient-kpi-7: radial-gradient(ellipse at 25% 20%, rgba(255,255,255,0.2) 0%, transparent 55%),
        linear-gradient(145deg, #1B3C59 0%, #70A4C4 100%);
    --gradient-kpi-8: radial-gradient(ellipse at 25% 20%, rgba(255,255,255,0.14) 0%, transparent 55%),
        linear-gradient(145deg, #70A4C4 0%, #141E28 100%);
    /* v10 — lighter, teal-dominant variant that never reaches navy/black, for
       dashboard sections that want more brightness than v1-v8 (which all end
       dark) without leaving the brand blue/teal family. */
    --gradient-kpi-10: radial-gradient(ellipse at 25% 20%, rgba(255,255,255,0.18) 0%, transparent 55%),
        linear-gradient(145deg, #5aa0c4 0%, #70A4C4 45%, #3d7ca8 100%);
    /* Gold/amber — the site's OTHER brand color (already used everywhere for
       active-state borders/highlights), used here as a full background so one
       section reads as genuinely different from its blue/teal neighbors, not
       just a lighter shade of the same hue. Dark enough throughout to keep
       white text legible without needing a text-color override. */
    --gradient-kpi-gold: radial-gradient(ellipse at 25% 20%, rgba(255,255,255,0.16) 0%, transparent 55%),
        linear-gradient(145deg, #d9a441 0%, #8a5d1f 55%, #4a3410 100%);
    /* Duration section — exact blue requested for that card. */
    --gradient-kpi-duration: radial-gradient(ellipse at 25% 20%, rgba(255,255,255,0.16) 0%, transparent 55%),
        linear-gradient(145deg, #3569AA 0%, #86B0CD 100%);
    --gradient-kpi-active: radial-gradient(ellipse at 25% 20%, rgba(255,255,255,0.22) 0%, transparent 55%),
        linear-gradient(145deg, #70A4C4 0%, #2459A3 60%, #1B3C59 100%);
}

[data-theme="dark"] {
    --color-primary: #2471a3;
    --color-primary-light: #4a90d9;
    --color-gold: #FFD540;
    --color-accent: #22c55e;
    --color-danger: #f87171;
    --color-warning: #fbbf24;
    --color-muted: #64748b;
    --color-bg: #182634;
    --color-surface: #1e3350;
    --color-text: #e8edf4;
    --color-text-light: #7a9bbf;
    --color-border: #3a5478;
    --color-hover: rgba(255, 255, 255, 0.05);
    --color-bg-subtle: #0f1e33;
    --color-surface-alt: #16283f;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);

    /* Gradient KPI-card palette — dark mode skips the near-black hue (would
       blend into the page background), reusing only the 3 brighter hues. */
    --gradient-kpi-1: radial-gradient(ellipse at 20% 30%, rgba(255,255,255,0.12) 0%, transparent 55%),
        linear-gradient(145deg, #70A4C4 0%, #2459A3 100%);
    --gradient-kpi-2: radial-gradient(ellipse at 20% 30%, rgba(255,255,255,0.12) 0%, transparent 55%),
        linear-gradient(145deg, #2459A3 0%, #1B3C59 100%);
    --gradient-kpi-3: radial-gradient(ellipse at 20% 30%, rgba(255,255,255,0.12) 0%, transparent 55%),
        linear-gradient(145deg, #1B3C59 0%, #2459A3 100%);
    --gradient-kpi-4: radial-gradient(ellipse at 20% 30%, rgba(255,255,255,0.12) 0%, transparent 55%),
        linear-gradient(145deg, #2459A3 0%, #70A4C4 100%);
    --gradient-kpi-5: radial-gradient(ellipse at 20% 30%, rgba(255,255,255,0.12) 0%, transparent 55%),
        linear-gradient(145deg, #70A4C4 0%, #1B3C59 100%);
    --gradient-kpi-6: radial-gradient(ellipse at 20% 30%, rgba(255,255,255,0.12) 0%, transparent 55%),
        linear-gradient(145deg, #1B3C59 0%, #70A4C4 100%);
    --gradient-kpi-7: radial-gradient(ellipse at 20% 30%, rgba(255,255,255,0.12) 0%, transparent 55%),
        linear-gradient(145deg, #70A4C4 0%, #2459A3 55%, #1B3C59 100%);
    --gradient-kpi-8: radial-gradient(ellipse at 20% 30%, rgba(255,255,255,0.12) 0%, transparent 55%),
        linear-gradient(145deg, #1B3C59 0%, #2459A3 55%, #70A4C4 100%);
    --gradient-kpi-10: radial-gradient(ellipse at 20% 30%, rgba(255,255,255,0.12) 0%, transparent 55%),
        linear-gradient(145deg, #5aa0c4 0%, #70A4C4 45%, #3d7ca8 100%);
    --gradient-kpi-gold: radial-gradient(ellipse at 20% 30%, rgba(255,255,255,0.14) 0%, transparent 55%),
        linear-gradient(145deg, #d9a441 0%, #8a5d1f 55%, #4a3410 100%);
    --gradient-kpi-duration: radial-gradient(ellipse at 20% 30%, rgba(255,255,255,0.12) 0%, transparent 55%),
        linear-gradient(145deg, #3569AA 0%, #86B0CD 100%);
    --gradient-kpi-active: radial-gradient(ellipse at 20% 30%, rgba(255,255,255,0.15) 0%, transparent 55%),
        linear-gradient(145deg, #70A4C4 0%, #2459A3 60%, #1B3C59 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
        Ubuntu, Cantarell, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text);
    background-color: #ffffff;
    min-height: 100vh;
}

[data-theme="dark"] body {
    background: linear-gradient(160deg, #13202f 0%, #182634 50%, #1a2c3e 100%);
}

a {
    color: var(--color-primary-light);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* === Navigation === */
.main-nav {
    background: linear-gradient(to right, #0d2040, #1a3a6b 30%, #2471a3 65%, #1a3a6b 85%, #0d2040);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    border-bottom: 3px solid var(--color-gold);
}

.nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.95rem 1.5rem;
    min-height: 4.5rem;
}

.nav-col {
    display: flex;
    align-items: center;
}

.nav-col-left {
    justify-content: flex-start;
}

.nav-col-center {
    justify-content: center;
}

.nav-col-right {
    justify-content: flex-end;
}

.nav-lws-logo {
    width: 200px;
    height: 40px;
    display: block;
    filter: invert(1);
    mix-blend-mode: screen;
    transition: opacity 0.15s;
}

.nav-logo-link:hover .nav-lws-logo {
    opacity: 0.85;
}

.nav-logo-link {
    text-decoration: none;
    display: block;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.nav-links a:hover {
    color: #fff;
    text-decoration: none;
}

.nav-links a.active {
    color: var(--color-gold);
    font-weight: 600;
    border-bottom: 2px solid var(--color-gold);
    padding-bottom: 2px;
}

.nav-user {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.85rem;
}

/* === Layout === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* === Messages === */
.messages {
    margin-bottom: 1rem;
}

.message {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.message-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* === Cards & Panels === */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-gold);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(26, 58, 107, 0.08);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

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

.card-header h2,
.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.1rem;
    border: 1px solid transparent;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover {
    text-decoration: none;
    opacity: 0.88;
}

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

.btn-primary:hover {
    background: var(--color-primary-light);
    color: #fff;
    opacity: 1;
}

.btn-gold {
    background: transparent;
    color: #b08000;
    border: 2px solid var(--color-gold);
}

.btn-gold:hover {
    background: rgba(240, 180, 41, 0.1);
    opacity: 1;
}

[data-theme="dark"] .btn-gold {
    color: var(--color-gold);
}

.btn-success {
    background: var(--color-accent);
    color: #fff;
}

.btn-success:hover {
    background: #219a52;
    opacity: 1;
}

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

.btn-danger:hover {
    background: #a93226;
    opacity: 1;
}

.btn-outline {
    background: transparent;
    color: var(--color-primary-light);
    border-color: var(--color-primary-light);
}

.btn-outline:hover {
    background: rgba(36, 113, 163, 0.08);
    opacity: 1;
}

[data-theme="dark"] .btn-outline {
    color: #4a90d9;
    border-color: #4a90d9;
}

[data-theme="dark"] .btn-outline:hover {
    background: rgba(74, 144, 217, 0.1);
}

.btn-sm {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
}

/* === Forms === */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--color-text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-gold);
    border-radius: 20px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary-light);
    border-left-color: var(--color-gold);
    box-shadow: 0 0 0 3px rgba(36, 113, 163, 0.15);
}

.form-group textarea {
    border-radius: 12px;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group .helptext {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--color-text-light);
}

/* Required field asterisk */
.required-asterisk {
    color: var(--color-danger);
    margin-left: 0.2rem;
    font-weight: 700;
}

/* Field subtitle — appears between the label and the input */
.form-group .field-subtitle {
    display: block;
    font-size: 0.78rem;
    color: var(--color-text-light);
    margin-bottom: 0.35rem;
    font-weight: 400;
}

.form-group .errorlist {
    list-style: none;
    margin-top: 0.25rem;
    padding: 0;
}

.form-group .errorlist li {
    color: var(--color-danger);
    font-size: 0.8rem;
}

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

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

@media (max-width: 600px) {
    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }
}

/* === Fieldsets === */
fieldset {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

fieldset:last-of-type {
    margin-bottom: 0;
}

legend {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-primary);
    padding: 0 0.5rem;
}

/* === Tables === */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    background: var(--color-bg);
    border-bottom: 2px solid var(--color-border);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-light);
    white-space: nowrap;
}

tbody td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

tbody tr:hover {
    background: var(--color-hover);
}

tr[data-href]:hover {
  background-color: var(--color-hover); /* Add a hover effect */
}

tbody tr[data-href] td {
    cursor: pointer;
}

.sort-link {
    color: var(--color-text-light);
    cursor: pointer;
    white-space: nowrap;
}

.sort-link:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.sort-link.sort-active {
    color: var(--color-primary);
}

/* === Status & Priority Badges === */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-purchased { background: #4a5568; color: #fff; }
.badge-received { background: #1a7a8a; color: #fff; }
.badge-in_review { background: #c07800; color: #fff; }
.badge-pending_approval { background: #6b3494; color: #fff; }
.badge-approved { background: #1a7a40; color: #fff; }
.badge-approved_conditionally { background: #1a7a40; color: #fff; }
.badge-rejected { background: #b03025; color: #fff; }
.badge-closed { background: #4a5568; color: #fff; }

.badge-low { background: #4a5568; color: #fff; }
.badge-medium { background: #c07800; color: #fff; }
.badge-high { background: #b05000; color: #fff; }
.badge-critical { background: #b03025; color: #fff; }

/* Step statuses */
.badge-pending { background: #4a5568; color: #fff; }
.badge-in_progress { background: #1a5fa8; color: #fff; }
.badge-completed { background: #14592d; color: #fff; }
.badge-skipped { background: #4a5568; color: #fff; }

/* === Chips (for selected users) === */
.chip-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-height: 2rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: 0.8rem;
}

.chip button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-muted);
    font-size: 1rem;
    line-height: 1;
    padding: 0;
}

.chip button:hover {
    color: var(--color-danger);
}

/* === Search Dropdown === */
.search-container {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
}

.search-results:empty {
    display: none;
}

.search-result-item {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    text-align: left;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--color-text);
    font-family: inherit;
}

.search-result-item:hover {
    background: var(--color-bg);
}

/* === My Work Tabs === */
.my-tabs-card {
    padding: 0;
    overflow: hidden;
}

.my-tabs-nav {
    display: flex;
    border-bottom: 2px solid var(--color-border);
    background: var(--color-bg);
}

.my-tab {
    padding: 0.65rem 1.25rem;
    border: none;
    background: none;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--color-text-light);
    cursor: pointer;
    position: relative;
    transition: color 0.15s;
}

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

.my-tab.active {
    color: var(--color-primary);
    font-weight: 600;
}

.my-tab.active::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-primary);
}

#my-tabs-content {
    padding: 0.75rem 1.25rem;
}

#my-tabs-content table {
    font-size: 0.85rem;
}

#my-tabs-content thead th {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
}

#my-tabs-content tbody td {
    padding: 0.4rem 0.75rem;
}

/* === Filter Card === */
.filter-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

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

.filter-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-primary);
}

.filter-card-actions {
    display: flex;
    gap: 0.5rem;
}

.filter-section {
    padding: 0.6rem 0;
}

.filter-section + .filter-section {
    border-top: 1px dashed var(--color-border);
}

.filter-section-label {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-light);
    margin-bottom: 0.45rem;
}

.filter-grid {
    display: grid;
    /* auto-fill + 1fr: packs items into equal-width tracks without letting
       a sparse row stretch each item across the full width. New filters
       slot into the next open cell — wraps to additional rows as needed. */
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem 1rem;
}

.filter-grid-dates {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text);
}

.filter-group select,
.filter-group input {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--color-surface);
    min-width: 0;
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.12);
}

/* Date range pair */
.filter-date-range {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.35rem;
}

.filter-date-sep {
    color: var(--color-muted);
    font-size: 0.8rem;
}

/* Collapsible Date-ranges panel */
details.filter-dates > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.1rem 0;
    margin-bottom: 0.25rem;
}

details.filter-dates > summary::-webkit-details-marker {
    display: none;
}

details.filter-dates > summary::before {
    content: "▸";
    font-size: 0.75rem;
    color: var(--color-muted);
    transition: transform 0.15s;
    display: inline-block;
}

details.filter-dates[open] > summary::before {
    transform: rotate(90deg);
}

details.filter-dates > summary > .filter-section-label {
    margin-bottom: 0;
}

.filter-badge {
    display: inline-block;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--color-primary);
    color: #fff;
}

/* === Page Header === */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    display: inline-block;
    border-bottom: 3px solid var(--color-gold);
    padding-bottom: 4px;
}

.page-header h2 {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--color-text-light);
}

/* === Detail Page Sections === */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

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

.detail-field {
    margin-bottom: 0.75rem;
}

.detail-field dt {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-light);
    margin-bottom: 0.15rem;
}

.detail-field dd {
    font-size: 0.95rem;
}

/* === Step Progress === */
.step-list {
    list-style: none;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.step-item:last-child {
    border-bottom: none;
}

.step-item.step-pending {
    opacity: 0.5;
}

.step-order {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--color-bg);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--color-text-light);
    flex-shrink: 0;
}

.step-info {
    flex: 1;
}

.step-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.step-desc {
    font-size: 0.8rem;
    color: var(--color-text-light);
}

/* === Pagination === */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1.25rem;
}

.pagination a,
.pagination span {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.85rem;
}

.pagination .current {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.pagination a:hover {
    background: var(--color-bg);
    text-decoration: none;
}

/* === Utility === */
.text-muted { color: var(--color-text-light); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-accent); }
.text-sm { font-size: 0.8rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* === Home Page === */
.home-header {
    margin-bottom: 1.5rem;
}

.home-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tile {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--color-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.tile:hover {
    text-decoration: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 2px 8px rgba(41, 128, 185, 0.15);
}

.tile-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--color-bg);
    border-radius: var(--radius);
    color: var(--color-primary);
}

.tile-body h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.tile-body p {
    font-size: 0.85rem;
    color: var(--color-text-light);
    line-height: 1.5;
}

.quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* === Process Steps Table === */
.steps-table {
    width: 100%;
    border-collapse: collapse;
}

.steps-table thead th {
    text-align: left;
    padding: 0.5rem 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-light);
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
}

.steps-table tbody td {
    padding: 0.35rem 0.4rem;
    vertical-align: top;
    border-bottom: 1px solid var(--color-border);
}

.steps-table input,
.steps-table select {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--color-surface);
}

.steps-table input:focus,
.steps-table select:focus {
    outline: none;
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 2px rgba(41, 128, 185, 0.15);
}

.steps-table .col-drag { width: 2rem; text-align: center; }
.steps-table .col-num { width: 2.5rem; text-align: center; }
.steps-table .col-time { width: 5.5rem; }
.steps-table .col-unit { width: 5.5rem; }
.steps-table .col-action { width: 2.5rem; text-align: center; }

.steps-table input[name$="-DELETE"] { display: none; }

.drag-handle {
    cursor: grab;
    color: var(--color-muted);
    font-size: 1.2rem;
    user-select: none;
    text-align: center;
}

.drag-handle:active {
    cursor: grabbing;
}

.step-number {
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-light);
    padding-top: 0.45rem;
}

.step-row-ghost {
    opacity: 0.4;
    background: var(--color-bg);
}

.field-error {
    color: var(--color-danger);
    font-size: 0.75rem;
    margin-top: 0.15rem;
}

/* === HTMX Loading Indicator === */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-block;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* === Step Types & Approval === */

.badge-approval {
    background: var(--color-warning);
    color: #fff;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius);
    vertical-align: middle;
}

.badge-test-type {
    background: var(--color-primary-light);
    color: #fff;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius);
    vertical-align: middle;
}

.badge-approved {
    background: var(--color-accent);
    color: #fff;
}

.badge-rejected {
    background: var(--color-danger);
    color: #fff;
}

.btn-approve {
    background: var(--color-accent);
    color: #fff;
    border: none;
    cursor: pointer;
}
.btn-approve:hover {
    opacity: 0.85;
}

.btn-reject {
    background: var(--color-danger);
    color: #fff;
    border: none;
    cursor: pointer;
}
.btn-reject:hover {
    opacity: 0.85;
}

.step-action-form {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.step-comment-input {
    width: 100%;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    resize: vertical;
    font-family: inherit;
}

.type-data-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-end;
}

.type-data-field label {
    display: block;
    font-size: 0.75rem;
    color: var(--color-muted);
    margin-bottom: 0.1rem;
}

.type-data-display {
    font-size: 0.85rem;
    color: var(--color-text);
}

/* === Step Comments === */

.step-comments {
    border-top: 1px solid var(--color-border);
    padding-top: 0.25rem;
}

.step-comment {
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--color-border);
}

.step-comment:last-child {
    border-bottom: none;
}

.step-comment-form {
    margin-top: 0.25rem;
}

/* === Step Assigned User Badges === */

.step-assigned-users {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.badge-user {
    background: #e8edf2;
    color: var(--color-primary);
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    white-space: nowrap;
}

/* === Detail Page Layout (main + sidebar) === */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1rem;
    align-items: start;
}

.detail-layout .detail-main {
    min-width: 0;
}

.detail-layout .detail-sidebar .card {
    position: sticky;
    top: 1rem;
}

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

/* === Attachments === */
.attachment-list {
    list-style: none;
    margin-bottom: 0.75rem;
}

.attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--color-border);
}

.attachment-item:last-child {
    border-bottom: none;
}

.attachment-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
    color: var(--color-text);
}

.attachment-link:hover {
    color: var(--color-primary-light);
    text-decoration: none;
}

.attachment-icon {
    flex-shrink: 0;
    font-size: 1.1rem;
}

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

.attachment-name {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-meta {
    font-size: 0.7rem;
    color: var(--color-text-light);
}

.attachment-upload-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius);
    color: var(--color-muted);
    flex-shrink: 0;
}

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

.btn-icon-danger:hover {
    color: var(--color-danger);
    background: #fdf0ef;
}

/* === Reference-app helpers === */
/* Minimal styles for the projects reference app and template skeleton. */

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: 1rem;
}
.data-table th,
.data-table td {
    padding: 0.65rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}
.data-table thead {
    background: var(--color-bg);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-light);
}
.data-table tbody tr[data-href] {
    cursor: pointer;
}
.data-table tbody tr[data-href]:hover {
    background: var(--color-bg);
}

.search-form {
    margin: 1rem 0;
}
.search-form input[type="search"] {
    width: 100%;
    max-width: 360px;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
}

.stacked-form p { margin-bottom: 0.9rem; }
.stacked-form label { display: block; font-weight: 500; margin-bottom: 0.25rem; }
.stacked-form input[type="text"],
.stacked-form input[type="search"],
.stacked-form input[type="date"],
.stacked-form input[type="number"],
.stacked-form select,
.stacked-form textarea {
    width: 100%;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
}

.form-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1rem;
}

.back-link {
    font-size: 0.85rem;
    color: var(--color-text-light);
    text-decoration: none;
}
.back-link:hover { color: var(--color-primary); }

.btn-link {
    background: none;
    border: none;
    color: var(--color-primary);
    text-decoration: underline;
    cursor: pointer;
    padding: 0.5rem 0.9rem;
    font-family: inherit;
    font-size: 0.95rem;
}

.task-form { margin-top: 1.5rem; max-width: 500px; }

/* === Dark mode overrides for hardcoded colors === */

[data-theme="dark"] .message-success {
    background: #14532d;
    color: #86efac;
    border-color: #166534;
}
[data-theme="dark"] .message-error {
    background: #450a0a;
    color: #fca5a5;
    border-color: #7f1d1d;
}
[data-theme="dark"] .message-warning {
    background: #451a03;
    color: #fcd34d;
    border-color: #78350f;
}
[data-theme="dark"] .message-info {
    background: #0c4a6e;
    color: #7dd3fc;
    border-color: #075985;
}

[data-theme="dark"] .badge-user {
    background: #1e3a5f;
    color: var(--color-primary-light);
}

[data-theme="dark"] .btn-icon-danger:hover {
    color: var(--color-danger);
    background: rgba(248, 113, 113, 0.12);
}

[data-theme="dark"] .oh-theme-toggle {
    color: rgba(255, 255, 255, 0.85);
}

/* Catch-all: every input/select/textarea inherits theme colors in dark mode */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    color: var(--color-text);
    /* background-color, not the background shorthand — the shorthand resets
       background-repeat/position/size to their defaults, which tiles any
       custom chevron background-image (e.g. .oh-filter-select) across the
       whole box instead of leaving it as a single small arrow. */
    background-color: var(--color-surface);
    border-color: var(--color-border);
    color-scheme: dark;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--color-text-light);
}

/* Theme toggle button in nav */
.oh-theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.75);
    font-size: 1.1rem;
    padding: 0.2rem 0.35rem;
    border-radius: var(--radius);
    line-height: 1;
    transition: color 0.15s;
}
.oh-theme-toggle:hover {
    color: #fff;
}
