/* ============================================================
   main.css — SiteTracker design system (Light / In-Works Interiors)
   Brand: deep purple #7D3B9E -> magenta #EC0084 -> orange #EDA46D
   Fonts: Space Grotesk (display), Inter (body), JetBrains Mono (data)
   ============================================================ */

/* ── 1. Reset & base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* The HTML `hidden` attribute must always win over any component's display
   rule (e.g. .modal-overlay sets display:flex with no [hidden] guard).
   Without this, elements toggled via `el.hidden = true/false` in JS can get
   stuck visible because an author class rule of equal specificity overrides
   the browser's default [hidden]{display:none} UA rule. */
[hidden] { display: none !important; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg-base);
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 32px 32px;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    font-size: .95rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── 2. CSS Custom Properties ─────────────────────────────── */
:root {
    /* Fonts */
    --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    --font-body:    'Inter', system-ui, -apple-system, sans-serif;
    --font-mono:    'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;

    /* Surfaces — soft lavender-white, cards lift as true white */
    --bg-base:      #FBF8FC;
    --bg-surface:   #FFFFFF;
    --bg-elevated:  #F5EEF9;
    --bg-hover:     #EEE1F5;
    --border:       #E7DAEF;
    --border-light: #D6C0E2;
    --grid-line:    rgba(125,59,158,.035);

    /* Text — deep purple-black for warmth, not clinical grey */
    --text-primary:   #29162F;
    --text-secondary: #6E5D78;
    --text-muted:     #9C8CA8;

    /* Signature accent — brand purple */
    --accent:         #7D3B9E;
    --accent-hover:   #632F80;
    --accent-bright:  #9C5FC0;
    --accent-soft:    rgba(125,59,158,.10);
    --accent-ring:    rgba(125,59,158,.30);
    --primary:        #7D3B9E;
    --primary-hover:  #632F80;

    /* Secondary accent — brand magenta */
    --magenta:        #E01184;
    --magenta-bright:  #F0399E;
    --magenta-soft:    rgba(224,17,132,.10);

    /* Tertiary accent — brand orange */
    --orange:      #D98A3B;
    --orange-soft: rgba(217,138,59,.14);

    /* Status semantics */
    --blue:       #5D6FD1;
    --blue-soft:  rgba(93,111,209,.12);
    --green:      #2F9E64;
    --green-soft: rgba(47,158,100,.12);
    --red:        #DC5B54;
    --red-soft:   rgba(220,91,84,.12);
    --amber:      #D98A3B;
    --amber-soft: rgba(217,138,59,.14);
    --purple:     #9C5FC0;

    --radius-sm:  6px;
    --radius-md:  10px;
    --radius-lg:  14px;
    --radius-xl:  20px;

    --shadow-sm:  0 1px 2px rgba(41,22,47,.06), 0 1px 1px rgba(41,22,47,.03);
    --shadow-md:  0 10px 24px -8px rgba(41,22,47,.14), 0 2px 8px rgba(41,22,47,.05);
    --shadow-lg:  0 24px 56px -16px rgba(41,22,47,.20), 0 4px 14px rgba(41,22,47,.07);
    --shadow-glow: 0 0 0 1px var(--accent-ring), 0 10px 26px -6px rgba(125,59,158,.25);

    --nav-height: 60px;
    --transition: .18s cubic-bezier(.4,0,.2,1);
}

/* ── 3. Typography ────────────────────────────────────────── */
h1,h2,h3,h4 {
    font-family: var(--font-display);
    color: var(--text-primary); font-weight: 600; line-height: 1.2;
    letter-spacing: -.01em;
}
h1 { font-size: 1.7rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p  { color: var(--text-secondary); }
code {
    background: var(--bg-elevated); padding: 2px 6px; border-radius: var(--radius-sm);
    font-family: var(--font-mono); font-size: .82rem; color: var(--accent-hover);
    border: 1px solid var(--border);
}
small { font-size: .8rem; color: var(--text-muted); }

/* ── 4. Top Navigation ────────────────────────────────────── */
.topnav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--nav-height);
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(14px) saturate(1.2);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 1rem;
    padding: 0 1.5rem;
    box-shadow: var(--shadow-sm);
}

.topnav-brand {
    display: flex; align-items: center; gap: .6rem;
    text-decoration: none; flex-shrink: 0;
}
.brand-logo { height: 34px; width: auto; display: block; }
.brand-name {
    font-family: var(--font-display); font-weight: 600; font-size: 1.02rem;
    color: var(--text-primary); letter-spacing: -.01em; white-space: nowrap;
}
.brand-name em {
    font-style: normal; font-weight: 500; color: var(--text-muted);
    font-size: .85em; margin-left: .15em;
}

.nav-links {
    display: flex; list-style: none; gap: .2rem;
    flex: 1;
}
.nav-links a {
    display: block; padding: .4rem .85rem;
    color: var(--text-secondary); font-size: .875rem; font-weight: 500;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}
.nav-links a:hover { color: var(--text-primary); background: var(--bg-elevated); }
.nav-links a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* ── Nav Dropdown ── */
.nav-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}
.nav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .4rem .85rem;
    color: var(--text-secondary);
    font-size: .875rem;
    font-weight: 500;
    font-family: inherit;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color var(--transition), background var(--transition);
}
.nav-dropdown-toggle:hover,
.nav-dropdown:hover .nav-dropdown-toggle,
.nav-dropdown-toggle:focus {
    color: var(--text-primary);
    background: var(--bg-elevated);
}
.nav-dropdown-toggle.active {
    color: var(--accent);
    background: var(--accent-soft);
    font-weight: 600;
}
.dropdown-chevron {
    transition: transform 0.2s ease;
    opacity: 0.7;
    flex-shrink: 0;
}
.nav-dropdown:hover .dropdown-chevron,
.nav-dropdown.is-open .dropdown-chevron {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 170px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 8px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    padding: .4rem 0;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    z-index: 250;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu,
.nav-dropdown.is-open .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.nav-dropdown-menu li {
    margin: 0;
    padding: 0;
}
.nav-dropdown-menu a {
    display: flex !important;
    align-items: center;
    gap: .65rem;
    padding: .55rem 1rem !important;
    color: var(--text-primary) !important;
    font-size: .85rem !important;
    font-weight: 500 !important;
    text-decoration: none;
    border-radius: 0 !important;
    transition: background 0.15s ease, color 0.15s ease;
}
.nav-dropdown-menu a:hover {
    background: var(--bg-elevated) !important;
    color: var(--accent) !important;
}
.nav-dropdown-menu a.active {
    background: var(--accent-soft) !important;
    color: var(--accent) !important;
    font-weight: 600 !important;
}
.dropdown-icon {
    font-size: 1rem;
    line-height: 1;
}

.nav-user {
    display: flex; align-items: center; gap: .75rem; flex-shrink: 0;
}
.nav-user-info { text-align: right; }
.nav-user-name  { display: block; font-size: .875rem; font-weight: 600; color: var(--text-primary); }
.nav-user-role  { display: block; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-family: var(--font-mono); }
.badge-admin      { color: var(--accent); }
.badge-supervisor { color: var(--green); }
.badge-vendor      { color: var(--orange); }
.badge-role-vendor { background: var(--orange-soft); color: #A8631F; }

.btn-logout {
    background: transparent; border: 1px solid var(--border);
    color: var(--text-secondary); padding: .35rem .75rem;
    border-radius: var(--radius-sm); cursor: pointer; font-size: .82rem;
    font-family: var(--font-body);
    transition: all var(--transition);
}
.btn-logout:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }

/* Hamburger (mobile) */
.nav-toggle {
    display: none; flex-direction: column; gap: 5px;
    background: none; border: none; cursor: pointer; padding: .4rem; margin-left: auto;
}
.nav-toggle span {
    display: block; width: 22px; height: 2px;
    background: var(--text-secondary); border-radius: 2px; transition: all .2s;
}

@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    .nav-links {
        display: none; position: absolute; top: var(--nav-height); left: 0; right: 0;
        background: var(--bg-surface); border-bottom: 1px solid var(--border);
        flex-direction: column; padding: .5rem;
        box-shadow: var(--shadow-md);
    }
    .nav-links.open { display: flex; }
    .nav-dropdown {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    .nav-dropdown-toggle {
        width: 100%;
        justify-content: space-between;
        padding: .5rem .85rem;
    }
    .nav-dropdown-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        border: none;
        background: transparent;
        padding-left: .75rem;
        display: none;
        opacity: 1;
        visibility: visible;
        transform: none;
    }
    .nav-dropdown.is-open .nav-dropdown-menu,
    .nav-dropdown:hover .nav-dropdown-menu {
        display: block;
    }
    .nav-user { display: none; }
    .topnav { flex-wrap: wrap; height: auto; min-height: var(--nav-height); }
}

/* ── 5. Main Content Area ─────────────────────────────────── */
.main-content {
    margin-top: var(--nav-height);
    padding: 2rem 1.5rem;
    max-width: 1400px;
    margin-left: auto; margin-right: auto;
    width: 100%;
    animation: fadeUpPage .35s ease both;
}
@keyframes fadeUpPage { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 768px) { .main-content { padding: 1rem; } }

/* ── 6. Page Header ───────────────────────────────────────── */
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; margin-bottom: 1.5rem;
    flex-wrap: wrap;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--border);
}
.page-title    { font-size: 1.5rem; font-weight: 600; color: var(--text-primary); }
.page-subtitle { color: var(--text-muted); font-size: .875rem; margin-top: .3rem; font-family: var(--font-mono); }
.header-actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }

/* ── 7. Buttons ───────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .55rem 1.1rem; border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: .875rem; font-weight: 600; cursor: pointer;
    border: 1px solid transparent; transition: all var(--transition); line-height: 1.4;
    text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(0) scale(.98); }

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--magenta));
    color: #FFFFFF; border-color: rgba(0,0,0,.04);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--accent-hover), var(--magenta-bright)); color: #FFFFFF; transform: translateY(-1px); box-shadow: var(--shadow-glow); }

/* Cancel / secondary actions — verified: kept high-contrast in light mode
   (this is the button family used by every "Cancel" control in the app) */
.btn-outline {
    background: var(--bg-surface); color: var(--text-secondary);
    border: 1px solid var(--border-light);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.btn-success {
    background: var(--green); color: #fff;
}
.btn-success:hover { background: #268554; color: #fff; transform: translateY(-1px); }

.btn-danger {
    background: var(--red-soft); color: #B23A34;
    border: 1px solid rgba(220,91,84,.35);
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-block { width: 100%; justify-content: center; }
.btn-lg    { padding: .75rem 1.5rem; font-size: 1rem; }
.btn-sm    { padding: .35rem .75rem; font-size: .8rem; }
.btn-xs    { padding: .25rem .55rem; font-size: .75rem; }

/* ── 8. Forms ─────────────────────────────────────────────── */
.form-card {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 2rem; margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    position: relative;
}
.form-card-compact { padding: 1.25rem 1.5rem; }
.form-card-title   {
    font-family: var(--font-display);
    font-size: 1rem; font-weight: 600; color: var(--text-primary); margin-bottom: 1.1rem;
    padding-bottom: .75rem; border-bottom: 1px solid var(--border);
    position: relative;
}
.form-card-title::after {
    content: ''; position: absolute; left: 0; bottom: -1px; width: 36px; height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--magenta));
}

.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group.has-error .form-input { border-color: var(--red); }

.form-grid { display: grid; gap: 1rem; margin-bottom: 1rem; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 600px) {
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

label {
    font-size: .78rem; font-weight: 600; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: .05em;
}
.required { color: var(--red); }

.form-input {
    background: var(--bg-elevated); border: 1px solid var(--border);
    color: var(--text-primary); border-radius: var(--radius-sm);
    padding: .65rem .9rem; font-size: .9rem; font-family: var(--font-body);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    width: 100%;
}
.form-input:focus {
    outline: none; border-color: var(--accent); background: var(--bg-surface);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input-sm { padding: .45rem .75rem; font-size: .85rem; }

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

.select-wrap { position: relative; }
.select-wrap select { appearance: none; padding-right: 2rem; cursor: pointer; }
.select-wrap::after {
    content: '▾'; position: absolute; right: .75rem; top: 50%;
    transform: translateY(-50%); pointer-events: none;
    color: var(--text-muted); font-size: .75rem;
}

.field-error { font-size: .78rem; color: #B23A34; font-weight: 500; }

.form-actions {
    display: flex; gap: .75rem; justify-content: flex-end;
    margin-top: 1.5rem; padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.checkbox-label {
    display: flex; align-items: center; gap: .5rem;
    font-size: .875rem; font-weight: 500; color: var(--text-secondary);
    cursor: pointer; text-transform: none; letter-spacing: 0;
}
.checkbox-label input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }

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

/* Input icon wrapper */
.input-wrap { position: relative; }
.input-wrap .form-input { padding-left: 2.5rem; }
.input-icon {
    position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: .95rem; pointer-events: none;
}
.toggle-password {
    position: absolute; right: .75rem; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; font-size: 1rem; padding: 0;
    opacity: .55;
}
.toggle-password:hover { opacity: 1; }

/* ── 9. Alerts & Flash Messages ───────────────────────────── */
.alert {
    padding: .85rem 1.1rem; border-radius: var(--radius-sm);
    margin-bottom: 1rem; font-size: .875rem; font-weight: 500;
    display: flex; align-items: flex-start; gap: .5rem;
    animation: slideIn .25s ease;
    border: 1px solid transparent;
}
@keyframes slideIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }

.alert-success { background: var(--green-soft); border-color: rgba(47,158,100,.3); color: #1E7A4C; }
.alert-error   { background: var(--red-soft);   border-color: rgba(220,91,84,.3);  color: #B23A34; }
.alert-info    { background: var(--blue-soft); border-color: rgba(93,111,209,.3); color: #4A57AD; }

/* ── 10. Tables ───────────────────────────────────────────── */
.table-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 1.5rem; box-shadow: var(--shadow-sm); }
.table-scroll { overflow-x: auto; }

.data-table {
    width: 100%; border-collapse: collapse; font-size: .85rem;
}
.data-table th {
    background: var(--bg-elevated); color: var(--text-muted);
    font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
    padding: .75rem 1rem; text-align: left; white-space: nowrap;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-mono);
}
.data-table td {
    padding: .75rem 1rem; color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); color: var(--text-primary); }
.data-table .col-work { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.data-table .col-material { max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.data-table .col-id { color: var(--text-muted); font-size: .78rem; font-family: var(--font-mono); }
.data-table .col-date { white-space: nowrap; font-family: var(--font-mono); font-size: .8rem; }
.data-table .col-actions { text-align: right; white-space: nowrap; }
.data-table .nowrap { white-space: nowrap; }

.row-inactive td { opacity: .5; }

/* ── 11. Status Badges ────────────────────────────────────── */
.status-badge {
    display: inline-flex; align-items: center;
    padding: .2rem .6rem; border-radius: 99px;
    font-family: var(--font-mono);
    font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
    white-space: nowrap;
}
.status-pending     { background: var(--amber-soft);  color: #A8631F; border: 1px solid rgba(217,138,59,.35); }
.status-inprogress  { background: var(--blue-soft);   color: #4A57AD; border: 1px solid rgba(93,111,209,.35); }
.status-complete    { background: var(--green-soft);  color: #1E7A4C; border: 1px solid rgba(47,158,100,.35); }
.status-blocked     { background: var(--red-soft);    color: #B23A34; border: 1px solid rgba(220,91,84,.35); }

/* ── 12. Site & other tags ────────────────────────────────── */
.site-badge, .site-tag {
    display: inline-block; background: var(--accent-soft);
    color: var(--accent-hover); border: 1px solid rgba(125,59,158,.28);
    padding: .2rem .6rem; border-radius: var(--radius-sm);
    font-size: .72rem; font-weight: 600; font-family: var(--font-mono);
    letter-spacing: .02em;
    white-space: nowrap;
}

/* ── 13. Generic badges ───────────────────────────────────── */
.badge {
    display: inline-block; padding: .2rem .55rem;
    border-radius: 99px; font-size: .72rem; font-weight: 700;
    background: var(--bg-elevated); color: var(--text-secondary);
    font-family: var(--font-mono);
}
.badge-active   { background: var(--green-soft);  color: #1E7A4C; }
.badge-inactive { background: var(--red-soft);    color: #B23A34;   }
.badge-alert    { background: var(--red-soft);    color: #B23A34;   }
.badge-role-admin      { background: var(--accent-soft); color: var(--accent-hover); }
.badge-role-supervisor { background: var(--green-soft);  color: #1E7A4C; }

/* ── 14. Filter Bar ───────────────────────────────────────── */
.filter-bar {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 1rem 1.25rem; margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}
.filter-form {}
.filter-row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.filter-group { display: flex; flex-direction: column; gap: .3rem; }
.filter-group label { font-size: .7rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.filter-group-search { flex: 1; min-width: 140px; }
.filter-actions { display: flex; gap: .5rem; align-items: flex-end; }

/* ── 15. Pagination ───────────────────────────────────────── */
.pagination {
    display: flex; align-items: center; gap: .4rem;
    justify-content: center; margin-top: 1.25rem; flex-wrap: wrap;
}
.page-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 .6rem;
    background: var(--bg-surface); border: 1px solid var(--border);
    color: var(--text-secondary); border-radius: var(--radius-sm);
    font-size: .82rem; font-weight: 500; font-family: var(--font-mono);
    transition: all var(--transition);
}
.page-btn:hover, .page-btn--active {
    background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700;
}
.page-info { font-size: .82rem; color: var(--text-muted); padding: 0 .5rem; font-family: var(--font-mono); }

/* ── 16. Empty state ──────────────────────────────────────── */
.empty-state {
    text-align: center; padding: 4rem 2rem;
    background: var(--bg-surface); border: 1px dashed var(--border-light);
    border-radius: var(--radius-lg); margin: 1rem 0;
}
.empty-icon { font-size: 2.75rem; margin-bottom: 1rem; opacity: .8; }
.empty-state h2 { margin-bottom: .5rem; color: var(--text-secondary); font-weight: 600; }
.empty-state p  { color: var(--text-muted); margin-bottom: 1.5rem; }

/* ── 17. Section helpers ──────────────────────────────────── */
.section-header { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.section-header h2 { font-size: 1.05rem; }
.section-footer { text-align: center; padding: 1rem 0; }
.link-subtle { color: var(--text-muted); font-size: .85rem; }
.link-subtle:hover { color: var(--accent); }
.link-more  { display: block; text-align: center; color: var(--text-muted); font-size: .85rem; margin-top: .75rem; }
.empty-text { color: var(--text-muted); font-size: .9rem; }
.success-text { color: var(--green); }

/* ── 18. Dashboard panels ─────────────────────────────────── */
.dashboard-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem;
}
@media (max-width: 900px) { .dashboard-grid { grid-template-columns: 1fr; } }

.dash-panel {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.panel-alert { border-color: rgba(220,91,84,.35); }
.panel-vendor { border-color: rgba(217,138,59,.35); }
.panel-header {
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
    position: relative;
}
.panel-header::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: linear-gradient(180deg, var(--accent), var(--magenta));
}
.panel-header h2 { font-family: var(--font-display); font-size: .92rem; font-weight: 600; }
.panel-body { padding: 1.25rem; }

/* KPI Cards */
.kpi-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px)  { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi-card {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 1.25rem 1rem;
    text-align: center; transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-light); }
.kpi-value { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; color: var(--text-primary); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.kpi-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-top: .35rem; }
.kpi-sub   { font-size: .7rem; color: var(--text-muted); margin-top: .2rem; font-family: var(--font-mono); }
.kpi-total    .kpi-value { color: var(--blue); }
.kpi-complete .kpi-value { color: var(--green); }
.kpi-pending  .kpi-value { color: var(--orange); }
.kpi-inprog   .kpi-value { color: var(--blue); }
.kpi-blocked  .kpi-value { color: var(--red); }
.kpi-stalled  .kpi-value { color: var(--red); }

/* ── 18. Leaderboard & Premium Timeframe Controls ─────────── */
.panel-header--flex {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 1rem;
}
.leaderboard-heading-block {
    display: flex; flex-direction: column; gap: .25rem;
}
.leaderboard-title-line {
    display: flex; align-items: center; gap: .65rem; flex-wrap: wrap;
}
.leaderboard-title {
    font-family: var(--font-display); font-size: 1rem; font-weight: 700;
    margin: 0; color: var(--text-primary);
}
.leaderboard-subtitle {
    color: var(--text-muted); font-size: .78rem;
}
.leaderboard-live-pill {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .2rem .6rem; border-radius: 99px;
    font-size: .7rem; font-weight: 700; font-family: var(--font-mono);
    background: rgba(16,185,129,.12); color: #065F46;
    border: 1px solid rgba(16,185,129,.3);
    letter-spacing: .02em;
}
.pulse-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #10B981; box-shadow: 0 0 8px #10B981;
    animation: pulseDot 2s infinite ease-in-out;
}
.leaderboard-live-pill--vendor {
    background: var(--orange-soft); color: #A8631F; border-color: rgba(217,138,59,.3);
}
.pulse-dot--vendor { background: var(--orange); box-shadow: 0 0 8px var(--orange); }
.vendor-avatar { background: linear-gradient(135deg, var(--orange), var(--magenta)); }
@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .35; transform: scale(.75); }
}

/* ── Timeframe & Leaderboard Controls Widget ── */
.timeframe-dropdown-wrap,
.leaderboard-controls-wrap {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    flex-wrap: wrap;
}
.leaderboard-controls-wrap .timeframe-select-box {
    padding: .1rem .35rem .1rem .6rem;
}
.leaderboard-controls-wrap .timeframe-select {
    min-width: auto;
    font-size: .8rem;
    padding: .35rem 1.3rem .35rem 0;
}
.timeframe-select-box {
    position: relative;
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, var(--bg-surface), var(--bg-elevated));
    border: 1px solid rgba(125,59,158,.25);
    border-radius: var(--radius-md);
    padding: .1rem .4rem .1rem .75rem;
    box-shadow: 0 2px 10px rgba(0,0,0,.04), 0 0 0 1px rgba(125,59,158,.08);
    transition: all var(--transition);
}
.timeframe-select-box:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(125,59,158,.15);
    transform: translateY(-1px);
}
.timeframe-select-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(125,59,158,.2);
}
.tf-select-icon {
    font-size: .88rem;
    pointer-events: none;
    user-select: none;
    margin-right: .45rem;
    opacity: .9;
}
.timeframe-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: .84rem;
    font-weight: 700;
    padding: .45rem 1.6rem .45rem 0;
    cursor: pointer;
    outline: none;
    min-width: 175px;
}
.timeframe-select optgroup {
    font-weight: 700;
    color: var(--accent);
    background: var(--bg-surface);
    font-size: .78rem;
}
.timeframe-select option {
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-surface);
    padding: .35rem;
    font-size: .84rem;
}
.tf-select-chevron {
    position: absolute;
    right: .65rem;
    font-size: .72rem;
    color: var(--text-muted);
    pointer-events: none;
    user-select: none;
    transition: transform var(--transition);
}
.timeframe-select-box:hover .tf-select-chevron {
    color: var(--accent);
}

/* Leaderboard Rows & Rankings */
.supervisor-completion-list { display: flex; flex-direction: column; gap: .45rem; }
.completion-row {
    display: flex; align-items: center; gap: .85rem;
    padding: .55rem .85rem; border-radius: var(--radius-md);
    background: var(--bg-surface); border: 1px solid var(--border);
    cursor: pointer; transition: all var(--transition);
}
.completion-row:hover {
    background: var(--bg-elevated);
    border-color: var(--accent);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

/* Rank Medals */
.leaderboard-rank { flex-shrink: 0; min-width: 48px; }
.rank-badge {
    display: inline-flex; align-items: center; justify-content: center;
    padding: .2rem .45rem; border-radius: 99px;
    font-size: .72rem; font-weight: 800; font-family: var(--font-mono);
    letter-spacing: .02em; white-space: nowrap;
}
.rank-1 {
    background: linear-gradient(135deg, #FEF08A, #F59E0B);
    color: #78350F; border: 1px solid #FCD34D;
    box-shadow: 0 2px 10px rgba(245,158,11,.28);
}
.completion-row.rank-1 {
    border-color: rgba(245,158,11,.35);
    background: linear-gradient(90deg, rgba(254,240,138,.08), var(--bg-surface));
}
.rank-2 {
    background: linear-gradient(135deg, #F1F5F9, #CBD5E1);
    color: #334155; border: 1px solid #94A3B8;
}
.rank-3 {
    background: linear-gradient(135deg, #FFEDD5, #FB923C);
    color: #7C2D12; border: 1px solid #FDBA74;
}
.rank-other {
    background: var(--bg-elevated);
    color: var(--text-muted); border: 1px solid var(--border);
}

.supervisor-mini-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--magenta));
    color: #ffffff; font-size: .75rem; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.completion-info {
    display: flex; align-items: center; gap: .6rem;
    min-width: 175px; flex-shrink: 0;
}
.completion-user-details {
    display: flex; flex-direction: column; line-height: 1.25;
}
.completion-name { font-size: .86rem; font-weight: 600; color: var(--text-primary); }
.completion-row:hover .completion-name { color: var(--accent); }
.completion-count { font-size: .72rem; color: var(--text-muted); font-family: var(--font-mono); }

.completion-bar-wrap {
    flex: 1; height: 8px; background: var(--bg-elevated); border-radius: 99px; overflow: hidden;
}
.completion-bar {
    height: 100%; border-radius: 99px;
    transition: width .6s cubic-bezier(.4,0,.2,1);
    min-width: 2px;
}
.completion-bar--top {
    background: linear-gradient(90deg, #10B981, #059669);
    box-shadow: 0 0 8px rgba(16,185,129,.4);
}
.completion-bar--regular {
    background: linear-gradient(90deg, var(--accent), var(--magenta));
}

.completion-pct {
    font-size: .82rem; font-weight: 700; color: #1E7A4C;
    min-width: 48px; text-align: right; font-family: var(--font-mono);
}
.pct-gold { color: #D97706; font-weight: 800; }

.empty-state-small {
    text-align: center; padding: 2rem 1rem; color: var(--text-muted);
    font-size: .88rem;
}
.empty-state-small span { font-size: 1.6rem; display: block; margin-bottom: .4rem; }
.empty-state-small p { margin-bottom: .6rem; }


/* Stalled list */
.stalled-list { display: flex; flex-direction: column; gap: .75rem; }
.stalled-item {
    background: var(--bg-elevated); border: 1px solid rgba(220,91,84,.25);
    border-radius: var(--radius-sm); padding: .75rem 1rem;
}
.stalled-header { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .35rem; }
.stalled-age    { font-size: .72rem; font-weight: 700; color: #B23A34; background: var(--red-soft); padding: 2px 7px; border-radius: 99px; font-family: var(--font-mono); }
.stalled-desc   { font-size: .85rem; color: var(--text-secondary); margin-bottom: .25rem; }
.stalled-sup    { color: var(--text-muted); display: block; margin-bottom: .5rem; }

/* ── 19. Modal ────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(41,22,47,.45); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-card {
    background: var(--bg-surface); border: 1px solid var(--border-light);
    border-radius: var(--radius-lg); padding: 2rem; width: 100%; max-width: 480px;
    box-shadow: var(--shadow-lg);
    animation: popIn .2s ease;
}
@keyframes popIn { from { opacity:0; transform: scale(.96) translateY(4px); } to { opacity:1; transform: scale(1) translateY(0); } }
.modal-card h3 { margin-bottom: 1.25rem; font-size: 1.1rem; }

/* ── 20. Audit Info ───────────────────────────────────────── */
.audit-info {
    padding: .75rem 1rem; background: var(--bg-elevated); border-radius: var(--radius-sm);
    border: 1px solid var(--border); margin-bottom: 1rem; color: var(--text-muted);
    font-family: var(--font-mono); font-size: .78rem;
}

/* ── 21. Login Page ───────────────────────────────────────── */
.login-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 1rem;
    background:
        radial-gradient(ellipse 900px 600px at 50% 0%, rgba(224,17,132,.07) 0%, transparent 60%),
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
        var(--bg-base);
    background-size: auto, 28px 28px, 28px 28px, auto;
}
.login-wrapper { width: 100%; max-width: 420px; }
.login-card {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-xl); padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    animation: fadeUp .45s cubic-bezier(.16,1,.3,1);
    position: relative;
}
/* Signature: drafting-sheet registration marks on the hero card */
.login-card::before, .login-card::after {
    content: ''; position: absolute; width: 18px; height: 18px;
    border-color: var(--accent-ring); opacity: .9;
}
.login-card::before { top: 14px; left: 14px; border-top: 2px solid; border-left: 2px solid; }
.login-card::after  { bottom: 14px; right: 14px; border-bottom: 2px solid; border-right: 2px solid; }
@keyframes fadeUp { from { opacity:0; transform:translateY(18px); } to { opacity:1; transform:translateY(0); } }
.login-brand { text-align: center; margin-bottom: 2rem; }
.login-logo { height: 96px; width: auto; margin: 0 auto 1rem; display: block; filter: drop-shadow(0 8px 20px rgba(125,59,158,.18)); }
.login-icon {
    width: 62px; height: 62px; margin: 0 auto 1rem;
    background: linear-gradient(150deg, var(--accent), var(--magenta) 65%, var(--orange));
    border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center;
    font-size: 1.9rem; box-shadow: 0 10px 28px rgba(125,59,158,.3);
}
.login-brand h1 { font-size: 1.7rem; margin-bottom: .3rem; }
.login-brand p  { color: var(--text-muted); font-size: .875rem; font-family: var(--font-mono); }
.login-form { display: flex; flex-direction: column; gap: 1.1rem; }
.login-hint { text-align: center; color: var(--text-muted); font-size: .8rem; margin-top: 1.25rem; }

/* ── 22. Import page ──────────────────────────────────────── */
.import-info {
    background: var(--bg-elevated); border-radius: var(--radius-sm); padding: 1rem 1.25rem;
    margin-bottom: 1.25rem; border-left: 3px solid var(--blue);
}
.import-info p { font-size: .85rem; margin-bottom: .4rem; color: var(--text-secondary); }
.import-info p:last-child { margin-bottom: 0; }
.import-info strong { color: var(--text-primary); }

.file-drop {
    position: relative; border: 2px dashed var(--border-light); border-radius: var(--radius-md);
    padding: 2.5rem; text-align: center; cursor: pointer; transition: all var(--transition);
}
.file-drop:hover, .file-drop.dragover {
    border-color: var(--accent); background: var(--accent-soft);
}
.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.file-drop-icon { font-size: 2.25rem; display: block; margin-bottom: .75rem; }
.file-drop-label { color: var(--text-secondary); font-size: .875rem; pointer-events: none; }

.import-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; }
.import-stat {
    background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 1rem; text-align: center;
}
.import-stat span { display: block; font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; color: var(--blue); }
.import-stat { font-size: .78rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.import-stat--success span { color: var(--green); }
.import-stat--warn    span { color: var(--orange); }

.error-list { padding: .75rem 1.25rem; list-style: disc; color: var(--text-secondary); font-size: .8rem; max-height: 200px; overflow-y: auto; }
.error-list li { margin-bottom: .25rem; }

/* ── 23. Error page ───────────────────────────────────────── */
.error-page {
    display: flex; align-items: center; justify-content: center; min-height: 100vh;
    background:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
        var(--bg-base);
    background-size: 28px 28px;
}
.error-card { text-align: center; padding: 3rem; }
.error-code { font-family: var(--font-display); font-size: 5.5rem; font-weight: 700; color: var(--red); opacity: .55; line-height: 1; }
.error-card h1 { margin: .5rem 0; }
.error-card p  { margin-bottom: 1.5rem; }

/* ── 24. Footer ───────────────────────────────────────────── */
.app-footer {
    text-align: center; padding: 1.5rem; color: var(--text-muted);
    font-size: .78rem; font-family: var(--font-mono); border-top: 1px solid var(--border); margin-top: 2rem;
}
.footer-sep { margin: 0 .5rem; }

/* ── 25. Stats Strip (Supervisor) ─────────────────────────── */
.stats-strip { display: flex; gap: .75rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.stat-card {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: .9rem 1.25rem;
    display: flex; flex-direction: column; align-items: center; gap: .2rem;
    min-width: 90px; flex: 1;
    transition: transform var(--transition), border-color var(--transition);
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--border-light); }
.stat-number { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; color: var(--text-primary); line-height: 1; }
.stat-label  { font-size: .7rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.stat-card--alert .stat-number { color: var(--red); }

/* ── 26. Entry Cards (Supervisor) ─────────────────────────── */
.entry-cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); margin-bottom: 1rem; }
@media (max-width: 400px) { .entry-cards { grid-template-columns: 1fr; } }

.entry-card {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    display: flex; flex-direction: column;
}
.entry-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-light); }

.entry-card-header {
    padding: .9rem 1.1rem; background: var(--bg-elevated);
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
.entry-card-body { padding: 1rem 1.1rem; flex: 1; }
.work-description { color: var(--text-primary); font-weight: 500; margin-bottom: .75rem; line-height: 1.5; }
.entry-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: .5rem; }
.entry-meta-item { display: flex; flex-direction: column; gap: .1rem; }
.meta-label { font-size: .68rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.meta-value { font-size: .85rem; color: var(--text-secondary); }
.entry-remarks { font-size: .8rem; color: var(--text-muted); font-style: italic; padding-top: .5rem; border-top: 1px solid var(--border); }
.entry-card-footer {
    padding: .75rem 1.1rem; border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: .75rem; justify-content: space-between;
    background: rgba(125,59,158,.02);
}
.status-form { display: flex; flex: 1; }
.status-select {
    background: var(--bg-elevated); border: 1px solid var(--border);
    color: var(--text-secondary); padding: .3rem .6rem;
    border-radius: var(--radius-sm); font-size: .8rem; cursor: pointer; flex: 1;
    appearance: none; font-family: var(--font-mono);
}
.status-select:focus { outline: none; border-color: var(--accent); }

/* ── 29. Combobox (live-search fields) ────────────────────── */
.combobox { position: relative; }

.combobox-menu {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50;
    background: var(--bg-surface); border: 1px solid var(--border-light);
    border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
    max-height: 260px; overflow-y: auto; padding: .35rem;
}

.combobox-option {
    padding: .55rem .75rem; border-radius: var(--radius-sm);
    font-size: .875rem; color: var(--text-primary); cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.combobox-option:hover, .combobox-option.is-active {
    background: var(--accent-soft); color: var(--accent-hover);
}

.combobox-option--create {
    color: var(--accent); font-weight: 600;
    border-top: 1px solid var(--border); margin-top: .3rem; padding-top: .6rem;
    white-space: normal;
}
.combobox-option--create:hover, .combobox-option--create.is-active {
    background: var(--accent-soft); color: var(--accent-hover);
}
.combobox-option--create.is-loading { color: var(--text-muted); font-weight: 500; cursor: wait; }

.combobox-option--hint {
    color: var(--text-muted); font-size: .8rem; font-style: italic;
    cursor: default; white-space: normal;
}
.combobox-option--hint:hover { background: transparent; }

/* ── 27. Misc utilities ───────────────────────────────────── */
.btn-loader { color: inherit; }
details summary { cursor: pointer; user-select: none; }

/* ── 28. Scrollbar polish ──────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 99px; border: 2px solid var(--bg-base); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── 30. Approval Workflow ─────────────────────────────────── */

/* Nav badge (live pending count in navbar) */
.nav-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.3em; height: 1.3em; padding: 0 .35em;
    background: #e53e3e; color: #fff;
    font-size: .65rem; font-weight: 700; line-height: 1;
    border-radius: 99px; vertical-align: middle;
    margin-left: .25rem; animation: pulse-badge 2s ease-in-out infinite;
}
@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: .7; }
}
.nav-link-approval { position: relative; }

/* Badge counts on buttons */
.badge-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.4em; height: 1.4em; padding: 0 .4em;
    background: rgba(255,255,255,.25); color: inherit;
    font-size: .7rem; font-weight: 700; border-radius: 99px;
    margin-left: .4rem; vertical-align: middle;
}
.badge-count--inline { background: rgba(0,0,0,.12); }
.badge-count--muted  { background: rgba(0,0,0,.08); opacity: .8; }

/* Warning button for approval queue */
.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff; border-color: transparent;
    box-shadow: 0 2px 8px rgba(245,158,11,.35);
}
.btn-warning:hover { background: linear-gradient(135deg, #d97706, #b45309); color: #fff; }

/* Danger button */
.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff; border-color: transparent;
    box-shadow: 0 2px 8px rgba(239,68,68,.3);
}
.btn-danger:hover { background: linear-gradient(135deg, #dc2626, #b91c1c); color: #fff; }

/* Approval KPI card */
.kpi-approval {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 2px solid #f59e0b;
    animation: glow-approval 2s ease-in-out infinite alternate;
}
.kpi-approval .kpi-value { color: #b45309; }
.kpi-approval .kpi-label { color: #92400e; }
.kpi-approval .kpi-sub   { color: #78350f; }
@keyframes glow-approval {
    from { box-shadow: 0 0 0 0 rgba(245,158,11,.2); }
    to   { box-shadow: 0 0 12px 4px rgba(245,158,11,.35); }
}

/* Global actions bar above all pending groups */
.approval-global-actions {
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.approval-global-label { flex: 1; font-size: .9rem; color: var(--text-secondary); }

/* Approval group card */
.approval-group {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1.75rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}
.approval-group:hover { box-shadow: var(--shadow-md); }

.approval-group-header {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
    gap: 1rem; padding: 1.1rem 1.4rem;
    background: linear-gradient(135deg, #fef9f0, #fdf3e3);
    border-bottom: 1px solid #f3d8a0;
}
.approval-group-info { display: flex; align-items: center; gap: .9rem; }
.approval-sup-avatar {
    width: 2.75rem; height: 2.75rem; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff; font-weight: 700; font-size: 1.1rem;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); flex-shrink: 0;
}
.approval-sup-name {
    font-size: 1.05rem; font-weight: 700; color: var(--text-primary);
    font-family: var(--font-display); margin: 0;
}
.approval-sup-count { font-size: .8rem; color: var(--text-muted); }
.approval-group-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Approval table */
.approval-table { font-size: .85rem; }

/* Row highlights */
tr.row-pending > td { background: rgba(245,158,11,.04); }
tr.row-rejected > td {
    background: rgba(239,68,68,.04);
    color: var(--text-muted);
    text-decoration-color: rgba(0,0,0,.2);
}
tr.row-rejected .site-tag { opacity: .6; }

/* Completed work rows on the vendor dashboard: sink visually so open work stands out */
tr.row-complete-dim > td {
    opacity: .5;
    filter: blur(.3px) saturate(.7);
    transition: opacity var(--transition), filter var(--transition);
}
tr.row-complete-dim:hover > td {
    opacity: .85;
    filter: none;
}
tr.row-complete-dim .status-badge { opacity: 1; filter: none; }

/* Per-row approve/reject buttons */
.approval-row-actions { display: flex; gap: .3rem; }

/* Approval badges (in supervisor entries list) */
.approval-badge {
    display: inline-flex; align-items: center; gap: .3em;
    padding: .25em .65em; border-radius: 99px;
    font-size: .75rem; font-weight: 600; line-height: 1.2;
    white-space: nowrap;
}
.approval-pending  { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.approval-approved { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.approval-rejected { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ── 31. Alert info variant ────────────────────────────────── */
.alert-info {
    background: #eff6ff; border-left: 4px solid #3b82f6;
    color: #1e40af; border-radius: var(--radius-md);
    padding: .85rem 1.1rem; margin-bottom: 1.25rem; font-size: .9rem;
}

/* ── 32. Supervisor status-only page ───────────────────────── */
.supervisor-readonly-notice {
    display: flex; align-items: flex-start; gap: 1rem;
    background: #fefce8; border: 1px solid #fde047;
    border-radius: var(--radius-md); padding: 1rem 1.25rem;
    margin-bottom: 1.5rem; font-size: .9rem;
}
.supervisor-readonly-notice .readonly-icon { font-size: 1.5rem; flex-shrink: 0; }
.supervisor-readonly-notice strong { display: block; color: #713f12; margin-bottom: .2rem; font-weight: 600; }
.supervisor-readonly-notice p { color: #854d0e; margin: 0; font-size: .85rem; }

.entry-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .85rem 1.5rem;
}
.entry-detail-item { display: flex; flex-direction: column; gap: .2rem; }
.entry-detail-item--full { grid-column: 1 / -1; }
.detail-label {
    font-size: .7rem; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .05em;
}
.detail-value { font-size: .9rem; color: var(--text-primary); line-height: 1.5; }

/* form-actions delete button pushed left */
.form-actions { flex-wrap: wrap; }

/* ── 33. Approval queue toolbar (search + global actions) ── */
.approval-toolbar {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: .85rem 1.2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.approval-search-wrap {
    position: relative; display: flex; align-items: center; flex: 1; min-width: 200px;
}
.approval-search-icon {
    position: absolute; left: .75rem; font-size: .95rem; pointer-events: none; user-select: none;
}
.approval-search-input {
    width: 100%; padding: .55rem .75rem .55rem 2.2rem;
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius-md); font-size: .9rem; color: var(--text-primary);
    font-family: var(--font-body); transition: border-color var(--transition), box-shadow var(--transition);
}
.approval-search-input:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(125,59,158,.15);
}
.approval-search-input::placeholder { color: var(--text-muted); }
.approval-search-clear {
    position: absolute; right: .65rem; cursor: pointer; color: var(--text-muted);
    font-size: .8rem; padding: .2rem .3rem; border-radius: 3px;
    transition: color var(--transition);
}
.approval-search-clear:hover { color: var(--text-primary); }

.approval-toolbar-actions {
    display: flex; align-items: center; gap: .75rem; flex-shrink: 0; flex-wrap: wrap;
}
.approval-global-label { font-size: .875rem; color: var(--text-secondary); white-space: nowrap; }

/* No search results message */
.approve-no-results {
    text-align: center; padding: 2.5rem 1rem;
    color: var(--text-muted); font-size: .95rem;
}
.approve-no-results span { font-size: 1.5rem; display: block; margin-bottom: .5rem; }

/* ── 34. AJAX toast notification ────────────────────────────── */
.approve-toast {
    position: fixed; bottom: 1.75rem; right: 1.75rem; z-index: 9999;
    min-width: 260px; max-width: 420px;
    padding: .85rem 1.25rem; border-radius: var(--radius-lg);
    font-size: .9rem; font-weight: 600; font-family: var(--font-body);
    box-shadow: 0 8px 30px rgba(0,0,0,.18);
    animation: slideInToast .25s cubic-bezier(.34,1.56,.64,1) forwards;
    pointer-events: none;
}
@keyframes slideInToast {
    from { opacity: 0; transform: translateY(20px) scale(.96); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}
.approve-toast--success { background: #065f46; color: #d1fae5; }
.approve-toast--error   { background: #991b1b; color: #fee2e2; }

/* ── 35. Inline Status Select in Tables ──────────────────────── */
.inline-status-wrap {
    display: inline-flex;
    align-items: center;
    position: relative;
}
.inline-status-select {
    padding: .35rem .75rem;
    border-radius: var(--radius-sm);
    font-size: .8rem;
    font-weight: 600;
    font-family: var(--font-mono);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
    outline: none;
}
.inline-status-select:hover {
    border-color: var(--accent);
    background: var(--bg-surface);
}
.inline-status-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(125,59,158,.18);
}
.inline-status-select[data-status="COMPLETE"] {
    background: var(--green-soft);
    color: #1E7A4C;
    border-color: rgba(47,158,100,.4);
}
.inline-status-select[data-status="IN_PROGRESS"] {
    background: var(--blue-soft);
    color: #4A57AD;
    border-color: rgba(93,111,209,.4);
}
.inline-status-select[data-status="PENDING"] {
    background: var(--amber-soft);
    color: #A8631F;
    border-color: rgba(217,138,59,.4);
}
.inline-status-select[data-status="BLOCKED"] {
    background: var(--red-soft);
    color: #B23A34;
    border-color: rgba(220,91,84,.4);
}

.status-locked-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .25rem .55rem;
    border-radius: var(--radius-sm);
    font-size: .75rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 1px dashed var(--border);
}

/* ── 36. Attendance System & Timesheet UI ─────────────────────── */
.att-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .75rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: .02em;
}
.att-full {
    background: rgba(16, 185, 129, .15);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, .35);
}
.att-half {
    background: rgba(245, 158, 11, .15);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, .35);
}
.att-week-off {
    background: rgba(139, 92, 246, .15);
    color: #7c3aed;
    border: 1px solid rgba(139, 92, 246, .35);
}
.att-absent {
    background: rgba(239, 68, 68, .12);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, .3);
}

/* Attendance Rules Banner */
.att-rules-banner {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: linear-gradient(135deg, rgba(125,59,158,.08), rgba(224,17,132,.04));
    border: 1px solid rgba(125,59,158,.2);
    border-radius: var(--radius-lg, 12px);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.rules-banner-icon {
    font-size: 2rem;
    flex-shrink: 0;
}
.rules-banner-content h4 {
    margin: 0 0 .4rem 0;
    font-size: .95rem;
    font-weight: 700;
    color: var(--text-primary);
}
.rules-banner-badges {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
}
.rule-badge-item {
    font-size: .8rem;
    padding: .25rem .65rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
}
.rule-badge-item.rule-full {
    background: rgba(16, 185, 129, .12);
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, .25);
}
.rule-badge-item.rule-half {
    background: rgba(245, 158, 11, .12);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, .25);
}
.rule-badge-item.rule-absent {
    background: rgba(239, 68, 68, .1);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, .2);
}

/* Supervisor Live Tracker Card */
.att-tracker-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition, .2s ease);
}
.att-theme-full_day {
    border-color: rgba(16, 185, 129, .4);
    background: linear-gradient(180deg, rgba(16, 185, 129, .04), var(--bg-surface));
}
.att-theme-half_day {
    border-color: rgba(245, 158, 11, .4);
    background: linear-gradient(180deg, rgba(245, 158, 11, .04), var(--bg-surface));
}
.att-theme-absent {
    border-color: rgba(239, 68, 68, .3);
}

.att-tracker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.15rem;
    padding-bottom: .85rem;
    border-bottom: 1px solid var(--border);
}
.att-status-indicator {
    display: flex;
    align-items: center;
    gap: .65rem;
}
.att-date-pill {
    font-size: .8rem;
    color: var(--text-muted);
    font-weight: 500;
}
.att-rules-tip {
    font-size: .82rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: .4rem;
}

.att-trackers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.att-metric-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 8px);
    padding: .9rem 1rem;
}
.att-metric-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .5rem;
}
.att-metric-title {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-primary);
}
.att-metric-score {
    font-size: .8rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}
.att-metric-score.is-met {
    color: #10b981;
    font-weight: 700;
}
.att-metric-score.is-pending {
    color: #f59e0b;
}
.att-progress-bar-wrap {
    height: 9px;
    background: rgba(0,0,0,.08);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: .45rem;
}
.att-progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width .4s ease;
}
.fill-success { background: linear-gradient(90deg, #10b981, #059669); }
.fill-warning { background: linear-gradient(90deg, #f59e0b, #d97706); }
.att-metric-hint {
    font-size: .78rem;
    font-weight: 500;
}

.att-tracker-footer {
    padding-top: .75rem;
    border-top: 1px dashed var(--border);
    font-size: .82rem;
    color: var(--text-secondary);
}

/* Filter Toolbar */
.att-filter-bar {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 8px);
    padding: .75rem 1rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.att-filter-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}
.form-select-sm {
    padding: .35rem .75rem;
    font-size: .85rem;
}

/* KPI Card Enhancements */
.kpi-sub-unit {
    font-size: .9rem;
    font-weight: 500;
    color: var(--text-muted);
}
.kpi-attendance {
    border-left: 4px solid #10b981;
}

/* Task Count Pills & Badges */
.task-count-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .65rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
    font-family: var(--font-mono);
    white-space: nowrap;
}
.pill-att-full {
    background: rgba(16, 185, 129, .15);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, .4);
}
.pill-att-half {
    background: rgba(245, 158, 11, .15);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, .4);
}
.pill-att-absent {
    background: rgba(239, 68, 68, .12);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, .35);
}
.pill-done-badge {
    font-size: .75rem;
    font-weight: 600;
    opacity: .9;
}
.pill-success {
    background: rgba(16, 185, 129, .12);
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, .3);
}
.pill-warning {
    background: rgba(245, 158, 11, .12);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, .3);
}
.pill-muted {
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.eval-reason-text {
    font-size: .82rem;
    color: var(--text-secondary);
}

/* Timesheet Matrix Table */
.att-matrix-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
}
.att-matrix-table-wrap {
    max-width: 100%;
    overflow-x: auto;
}
.att-matrix-table {
    border-collapse: collapse;
    width: 100%;
    font-size: .8rem;
}
.att-matrix-table th,
.att-matrix-table td {
    padding: .45rem .3rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}
.matrix-sticky-col {
    position: sticky;
    left: 0;
    background: var(--bg-surface);
    z-index: 2;
    text-align: left !important;
    min-width: 140px;
    box-shadow: 2px 0 5px rgba(0,0,0,.04);
}
.matrix-sticky-right {
    position: sticky;
    right: 0;
    background: var(--bg-surface);
    z-index: 2;
    box-shadow: -2px 0 5px rgba(0,0,0,.04);
}
.user-cell-compact {
    display: flex;
    align-items: center;
    gap: .4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.supervisor-mini-avatar-sm {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--magenta));
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.user-name-text {
    font-weight: 600;
    color: var(--text-primary);
}
.col-day {
    min-width: 28px;
    max-width: 34px;
    padding: .35rem .15rem !important;
}
.col-sunday,
.col-friday {
    background: rgba(139, 92, 246, .04);
}
.col-friday .matrix-day-name {
    color: #8b5cf6;
    font-weight: 700;
}
.matrix-day-num {
    font-weight: 700;
    font-size: .78rem;
}
.matrix-day-name {
    font-size: .65rem;
    color: var(--text-muted);
}
.matrix-cell-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: .72rem;
    font-weight: 700;
    font-family: var(--font-mono);
    text-decoration: none;
    transition: transform .15s ease;
}
.matrix-cell-pill:hover {
    transform: scale(1.15);
}
.cell-full {
    background: #10b981;
    color: #ffffff;
}
.cell-half {
    background: #f59e0b;
    color: #ffffff;
}
.cell-weekoff {
    background: #8b5cf6;
    color: #ffffff;
}
.cell-absent {
    background: rgba(239, 68, 68, .18);
    color: #dc2626;
}
.pill-att-weekoff {
    background: rgba(139, 92, 246, .12);
    color: #6d28d9;
    border-color: rgba(139, 92, 246, .35);
}
.cell-future {
    color: var(--text-muted);
    font-weight: 400;
}
.matrix-legend {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: .8rem;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: .35rem;
    color: var(--text-secondary);
}
.text-primary-unit {
    color: var(--accent);
    font-size: .92rem;
}
.text-weekend {
    color: #ef4444;
    font-weight: 600;
}

/* ── 37. Premium Attendance Rules Popup Modal ─────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1rem;
    overflow-y: auto;
    animation: fadeInModal .2s cubic-bezier(.16, 1, .3, 1) forwards;
}
@keyframes fadeInModal {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-rules-dialog {
    background: var(--bg-surface);
    border: 1px solid rgba(125,59,158,.25);
    border-radius: var(--radius-lg, 18px);
    box-shadow: 0 25px 70px -10px rgba(0,0,0,.45), 0 0 0 1px rgba(125,59,158,.15);
    width: 100%;
    max-width: 720px;
    max-height: calc(100vh - 2.5rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: auto;
    animation: slideUpModalPrem .25s cubic-bezier(.16, 1, .3, 1) forwards;
}
@keyframes slideUpModalPrem {
    from { opacity: 0; transform: scale(.96) translateY(16px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.rules-modal-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(125,59,158,.1), rgba(224,17,132,.04), var(--bg-surface));
}
.rules-modal-icon-badge {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(125,59,158,.2), rgba(224,17,132,.15));
    border: 1px solid rgba(125,59,158,.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(125,59,158,.15);
}
.modal-title {
    margin: 0;
    font-size: 1.18rem;
    font-weight: 800;
    letter-spacing: -.01em;
    color: var(--text-primary);
}
.modal-subtitle {
    margin: .15rem 0 0 0;
    font-size: .82rem;
    color: var(--text-secondary);
}
.modal-close-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    font-size: 1rem;
    color: var(--text-muted);
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s ease;
    flex-shrink: 0;
}
.modal-close-btn:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #ffffff;
    transform: rotate(90deg) scale(1.05);
}

.rules-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(125,59,158,.3) transparent;
}
.rules-modal-body::-webkit-scrollbar {
    width: 6px;
}
.rules-modal-body::-webkit-scrollbar-thumb {
    background: rgba(125,59,158,.3);
    border-radius: 999px;
}

/* 3-Pill Quick Summary Grid */
.rules-quick-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .75rem;
}
@media (max-width: 600px) {
    .rules-quick-grid { grid-template-columns: 1fr; }
}
.quick-pill-card {
    border-radius: var(--radius-md, 12px);
    border: 1px solid var(--border);
    padding: .75rem .9rem;
    background: var(--bg-elevated);
    display: flex;
    flex-direction: column;
    gap: .35rem;
    transition: transform .15s ease;
}
.quick-pill-card:hover {
    transform: translateY(-2px);
}
.quick-full { border-top: 3px solid #10b981; }
.quick-half { border-top: 3px solid #f59e0b; }
.quick-absent { border-top: 3px solid #ef4444; }

.quick-pill-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.quick-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.dot-full { background: #10b981; box-shadow: 0 0 6px rgba(16,185,129,.6); }
.dot-half { background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,.6); }
.dot-absent { background: #ef4444; }

.quick-pill-title {
    font-size: .85rem;
    color: var(--text-primary);
}
.quick-pill-credit {
    font-size: .75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    padding: .15rem .45rem;
    border-radius: 999px;
}
.quick-full .quick-pill-credit { background: rgba(16,185,129,.15); color: #059669; }
.quick-half .quick-pill-credit { background: rgba(245,158,11,.15); color: #d97706; }
.quick-absent .quick-pill-credit { background: rgba(239,68,68,.15); color: #dc2626; }
.quick-pill-req {
    font-size: .76rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Premium Rule Cards */
.prem-rule-card {
    border-radius: var(--radius-md, 14px);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,.03);
    transition: all .2s ease;
}
.prem-rule-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.06);
}
.prem-rule-full {
    border-left: 5px solid #10b981;
}
.prem-rule-half {
    border-left: 5px solid #f59e0b;
}
.prem-rule-absent {
    border-left: 5px solid #94a3b8;
}

.prem-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .85rem 1.15rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: .5rem;
}
.prem-tier-title {
    display: flex;
    align-items: center;
    gap: .65rem;
}
.prem-tier-icon {
    font-size: 1.1rem;
}
.prem-tier-title h4 {
    margin: 0;
    font-size: .95rem;
    font-weight: 700;
    color: var(--text-primary);
}
.prem-tier-credit {
    font-size: .76rem;
    color: var(--text-muted);
    font-weight: 500;
}

.prem-status-chip {
    font-size: .74rem;
    font-weight: 700;
    padding: .25rem .65rem;
    border-radius: 999px;
    letter-spacing: .02em;
}
.chip-success {
    background: rgba(16,185,129,.14);
    color: #059669;
    border: 1px solid rgba(16,185,129,.3);
}
.chip-warning {
    background: rgba(245,158,11,.14);
    color: #b45309;
    border: 1px solid rgba(245,158,11,.3);
}
.chip-danger {
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.prem-card-body {
    padding: 1rem 1.15rem;
}
.prem-rule-intro {
    font-size: .84rem;
    color: var(--text-primary);
    margin: 0 0 .85rem 0;
    line-height: 1.45;
}

/* Criteria Grid for Full Day */
.prem-criteria-grid {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .85rem;
}
@media (max-width: 540px) {
    .prem-criteria-grid { flex-direction: column; align-items: stretch; }
    .prem-criterion-divider { display: none; }
}
.prem-criterion-box {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid rgba(16,185,129,.25);
    border-radius: var(--radius-sm, 8px);
    padding: .75rem .9rem;
    display: flex;
    align-items: center;
    gap: .75rem;
}
.crit-icon-tag {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #10b981;
    color: #ffffff;
    font-size: .8rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.crit-content {
    display: flex;
    flex-direction: column;
}
.crit-label {
    font-size: .72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: .04em;
}
.crit-value {
    font-size: .95rem;
    color: #065f46;
    font-weight: 800;
    font-family: var(--font-mono);
}
.crit-hint {
    font-size: .72rem;
    color: var(--text-secondary);
}
.prem-criterion-divider {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-muted);
}

/* Criteria Stacked for Half Day */
.prem-criteria-grid-stacked {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-bottom: .85rem;
}
.prem-criterion-row {
    background: var(--bg-surface);
    border: 1px solid rgba(245,158,11,.25);
    border-radius: var(--radius-sm, 8px);
    padding: .6rem .85rem;
    display: flex;
    align-items: center;
    gap: .75rem;
}
.crit-trigger-pill {
    font-size: .72rem;
    font-weight: 700;
    padding: .2rem .5rem;
    border-radius: 4px;
    white-space: nowrap;
}
.pill-warn {
    background: rgba(245,158,11,.15);
    color: #b45309;
    border: 1px solid rgba(245,158,11,.3);
}
.crit-row-text {
    font-size: .82rem;
    color: var(--text-primary);
}

/* Example Box */
.prem-example-box {
    background: var(--bg-surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm, 8px);
    padding: .75rem .95rem;
    font-size: .8rem;
    color: var(--text-secondary);
    line-height: 1.45;
}
.example-tag {
    font-size: .7rem;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: .04em;
    margin-bottom: .3rem;
}
.box-success .example-tag { color: #059669; }
.box-warning .example-tag { color: #d97706; }
.example-list {
    margin: 0;
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

/* Punch Callout */
.prem-punch-callout {
    background: linear-gradient(135deg, rgba(125,59,158,.08), rgba(59,130,246,.06));
    border: 1px solid rgba(125,59,158,.25);
    border-radius: var(--radius-md, 12px);
    padding: .85rem 1.15rem;
    display: flex;
    align-items: center;
    gap: .85rem;
}
.punch-callout-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}
.punch-callout-text {
    font-size: .82rem;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Modal Footer */
.rules-modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 1.1rem 1.75rem;
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
}
.btn-modal-done {
    padding: .75rem 1.6rem;
    font-size: .92rem;
    font-weight: 700;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(125,59,158,.25);
    transition: all .2s ease;
}
.btn-modal-done:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(125,59,158,.35);
}


/* ── 38. Employee Punch In / Punch Out Widget ─────────────────── */
.punch-widget {
    background: linear-gradient(135deg, var(--bg-surface), var(--bg-elevated));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 14px);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 18px rgba(0,0,0,.04), 0 0 0 1px rgba(125,59,158,.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.25rem;
    transition: all var(--transition, .2s ease);
}
.punch-widget:hover {
    border-color: rgba(125,59,158,.25);
    box-shadow: 0 6px 24px rgba(125,59,158,.08);
}

.punch-widget-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.punch-clock-block {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 10px);
    padding: .65rem 1.15rem;
    text-align: center;
    box-shadow: inset 0 1px 3px rgba(0,0,0,.02);
}
.punch-live-clock {
    font-size: 1.35rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent);
    letter-spacing: .02em;
    line-height: 1.2;
}
.punch-live-date {
    font-size: .75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: .15rem;
}

.punch-info-block {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}
.punch-status-tag {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .88rem;
    font-weight: 700;
    width: fit-content;
}
.tag-not-punched {
    color: var(--text-secondary);
}
.tag-active {
    color: #10b981;
}
.tag-completed {
    color: #3b82f6;
}
.punch-status-desc {
    margin: 0;
    font-size: .83rem;
    color: var(--text-secondary);
}

.punch-pulse-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: punchPulse 1.8s infinite;
}
@keyframes punchPulse {
    0%   { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70%  { transform: scale(1);    box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.punch-widget-right {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.btn-punch-in {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    border: none;
    padding: .85rem 1.6rem;
    border-radius: 999px;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    box-shadow: 0 4px 15px rgba(16, 185, 129, .35);
    transition: all .2s cubic-bezier(.16, 1, .3, 1);
}
.btn-punch-in:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, .45);
    color: #ffffff;
}

.btn-punch-out {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    border: none;
    padding: .85rem 1.6rem;
    border-radius: 999px;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    box-shadow: 0 4px 15px rgba(245, 158, 11, .35);
    transition: all .2s cubic-bezier(.16, 1, .3, 1);
}
.btn-punch-out:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, .45);
    color: #ffffff;
}

.btn-punch-done {
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: .75rem 1.4rem;
    border-radius: 999px;
    font-size: .88rem;
    font-weight: 600;
    cursor: default;
}

/* Punch Badges in Tables */
.punch-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .6rem;
    border-radius: var(--radius-sm, 6px);
    font-size: .78rem;
    font-family: var(--font-mono);
    font-weight: 600;
    white-space: nowrap;
}
.punch-pill-active {
    background: rgba(16, 185, 129, .12);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, .35);
}
.punch-live-text {
    font-weight: 700;
    font-size: .74rem;
}
.punch-pill-completed {
    background: rgba(59, 130, 246, .1);
    color: #1d4ed8;
    border: 1px solid rgba(59, 130, 246, .3);
}
.punch-hours-text {
    font-weight: 700;
    color: #2563eb;
}
.punch-pill-none {
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* ==========================================================================
   Dedicated Rules & Policy Page Styles
   ========================================================================== */
.rules-hero-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.75rem 2rem;
    background: linear-gradient(135deg, rgba(125, 59, 158, 0.08) 0%, rgba(224, 17, 132, 0.04) 100%), var(--bg-surface);
    border: 1px solid rgba(125, 59, 158, 0.2);
    border-radius: var(--radius-lg, 12px);
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.04);
}
.rules-hero-icon-wrap {
    font-size: 2.75rem;
    width: 68px;
    height: 68px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(125, 59, 158, 0.1);
    border: 1px solid rgba(125, 59, 158, 0.25);
    flex-shrink: 0;
}
.rules-hero-content h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
    letter-spacing: -0.01em;
}
.rules-hero-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

.rules-section {
    margin-bottom: 2.5rem;
}
.rules-section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.section-number-pill {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #7D3B9E;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(125, 59, 158, 0.35);
    flex-shrink: 0;
}
.rules-section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.rules-section-sub {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 0.15rem 0 0 0;
}

/* Tier Cards Grid */
.rules-tier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
}
.tier-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg, 12px);
    border: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.tier-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.08);
}
.tier-card.tier-full {
    border-color: rgba(16, 185, 129, 0.4);
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.03) 0%, var(--bg-surface) 30%);
}
.tier-card.tier-half {
    border-color: rgba(245, 158, 11, 0.4);
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.03) 0%, var(--bg-surface) 30%);
}
.tier-card.tier-weekoff {
    border-color: rgba(139, 92, 246, 0.4);
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.03) 0%, var(--bg-surface) 30%);
}
.tier-card.tier-absent {
    border-color: rgba(239, 68, 68, 0.3);
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.02) 0%, var(--bg-surface) 30%);
}

.tier-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}
.tier-badge-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.tier-badge-title h4 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}
.tier-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}
.dot-full    { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.6); }
.dot-half    { background: #f59e0b; box-shadow: 0 0 8px rgba(245, 158, 11, 0.6); }
.dot-weekoff { background: #8b5cf6; box-shadow: 0 0 8px rgba(139, 92, 246, 0.6); }
.dot-absent  { background: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.4); }

.tier-credit-pill {
    font-size: 0.8rem;
    font-weight: 700;
    font-family: var(--font-mono);
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    white-space: nowrap;
}
.pill-full {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.4);
}
.pill-half {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.4);
}
.pill-weekoff {
    background: rgba(139, 92, 246, 0.15);
    color: #6d28d9;
    border: 1px solid rgba(139, 92, 246, 0.4);
}
.pill-absent {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.tier-body {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    flex: 1;
}
.tier-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin: 0;
}
.tier-criteria-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.tier-criterion {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--text-primary);
}
.crit-check {
    color: #10b981;
    font-weight: 800;
    font-size: 1rem;
    flex-shrink: 0;
}
.crit-warn {
    font-size: 0.95rem;
    flex-shrink: 0;
}
.crit-none {
    font-size: 0.85rem;
    opacity: 0.6;
    flex-shrink: 0;
}

.tier-example {
    margin-top: auto;
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius-sm, 6px);
    font-size: 0.82rem;
    line-height: 1.45;
}
.box-success {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #065f46;
}
.box-warning {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: #92400e;
}
.box-purple {
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.25);
    color: #5b21b6;
}
.box-danger {
    background: rgba(239, 68, 68, 0.07);
    border: 1px solid rgba(239, 68, 68, 0.22);
    color: #991b1b;
}

/* Policy Card & Grid */
.rules-policy-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    padding: 1.75rem;
}
.policy-points-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}
.policy-point-box {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.policy-point-icon {
    font-size: 1.6rem;
    line-height: 1;
    flex-shrink: 0;
    padding: 0.5rem;
    border-radius: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}
.policy-point-box h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.35rem 0;
}
.policy-point-box p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.policy-lead {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}
.cutoff-rules-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.cutoff-rule-item {
    display: flex;
    align-items: center;
    gap: 1.15rem;
    padding: 0.85rem 1.15rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 8px);
    font-size: 0.92rem;
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.cutoff-badge {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.35rem 0.8rem;
    border-radius: var(--radius-sm, 6px);
    background: #7D3B9E;
    color: #ffffff !important;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(125, 59, 158, 0.3);
    letter-spacing: 0.02em;
}

@media (max-width: 768px) {
    .rules-hero-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .cutoff-rule-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}
