/* =============================================
   TimeClock — Site Styles
   Brand: Crows Nest Software
   Colors: CNS Blue #1F95BD · CNS Red #DC4537
   Fonts: Syne (headings) + DM Sans (body)
============================================= */

:root {
    /* Backgrounds — dark blue-grey tinted */
    --bg:  #0b0f12;
    --bg2: #121a1f;
    --bg3: #192028;
    --bg4: #1f2a33;
    --border: #243340;
    --border-light: #2e4050;

    /* Text */
    --text: #f0ede8;
    --text-muted: #7a8f9a;
    --text-dim: #3a5060;

    /* Brand accent — CNS Blue */
    --accent: #1F95BD;
    --accent-light: #4ab0d0;
    --accent-dim: rgba(31, 149, 189, 0.14);

    /* CNS Red — used for clock-in button, highlights */
    --cns-red: #DC4537;
    --cns-red-dim: rgba(220, 69, 55, 0.14);

    /* Status colors */
    --green: #3db87a;
    --green-dim: rgba(61, 184, 122, 0.13);
    --amber: #f5a623;
    --amber-dim: rgba(245, 166, 35, 0.15);
    --red: #DC4537;
    --red-dim: rgba(220, 69, 55, 0.14);
    --blue: #1F95BD;

    /* Header background — dark navy-blue */
    --navy: #0d1c26;
    --navy-light: #142533;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.5);
    --shadow-lg: 0 8px 48px rgba(0,0,0,0.7);
}

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

html { font-size: 16px; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* ---- HEADER ---- */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 64px;
    background: var(--navy);
    border-bottom: 2px solid var(--accent);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.site-logo-img {
    height: 52px;
    width: auto;
}

.site-logo-sub {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    border-left: 1px solid rgba(255,255,255,0.2);
    padding-left: 0.75rem;
    margin-top: 2px;
}

.site-time {
    font-family: 'Syne', sans-serif;
    font-weight: 500;
    font-size: 0.95rem;
    color: rgba(255,255,255,0.6);
    letter-spacing: 0.05em;
}

/* ---- HOME PAGE ---- */
.page-home {
    max-width: 1280px;
    margin: 0 auto;
    padding: 3rem 2rem 4rem;
}

.page-hero {
    margin-bottom: 3rem;
}

.hero-title {
    font-family: 'Syne', sans-serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.04em;
    color: var(--text);
}

.hero-sub {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* ---- EMPLOYEE GRID ---- */
.employee-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
}

.employee-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.75rem 1rem 1.5rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.employee-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

.employee-card.status-in::before { background: var(--green); }
.employee-card.status-break::before { background: var(--amber); }
.employee-card.status-out::before { background: var(--border); }

.employee-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.card-photo-wrap {
    position: relative;
    margin-bottom: 1rem;
}

.card-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg3);
    border: 2px solid var(--border);
}

.status-dot {
    position: absolute;
    bottom: 4px; right: 4px;
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 2px solid var(--bg2);
}

.status-in .status-dot { background: var(--green); }
.status-break .status-dot { background: var(--amber); }
.status-out .status-dot { background: var(--text-dim); }

.card-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    width: 100%;
    text-align: center;
}

.card-name {
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

.card-dept {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.card-status-badge {
    margin-top: 0.5rem;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.status-in .card-status-badge { background: var(--green-dim); color: var(--green); }
.status-break .card-status-badge { background: var(--amber-dim); color: var(--amber); }
.status-out .card-status-badge { background: var(--bg3); color: var(--text-muted); }


/* ---- STATUS PAGE ---- */
.page-status {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
}

.back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.15s;
}
.back-link:hover { color: var(--accent); }

.status-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

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

/* Employee Panel */
.employee-panel {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.emp-photo-wrap {
    position: relative;
    margin-bottom: 1.25rem;
}

.emp-photo-wrap::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 3px solid transparent;
}

.emp-photo-wrap.status-in::after { border-color: var(--green); }
.emp-photo-wrap.status-break::after { border-color: var(--amber); }

.emp-photo {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg3);
    display: block;
}

.emp-name {
    font-family: 'Syne', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.emp-dept {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.2rem;
}

.status-badge-large {
    margin: 1rem 0;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge-large.status-in { background: var(--green-dim); color: var(--green); }
.status-badge-large.status-break { background: var(--amber-dim); color: var(--amber); }
.status-badge-large.status-out { background: var(--bg3); color: var(--text-muted); }

.time-stats {
    width: 100%;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.stat-block {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.stat-block.wide { text-align: left; }

.stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.stat-value {
    font-family: 'Syne', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
}
.stat-value.text-sm { font-size: 0.85rem; font-weight: 500; }
.task-detail-link { color: var(--accent); text-decoration: underline; }
.task-detail-link:hover { opacity: 0.8; }

/* Action Panel */
.action-panel {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}

.action-section { display: none; }
.action-section.active { display: block; }
.action-section.hidden { display: none; }

.action-heading {
    font-family: 'Syne', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 0.3rem;
}

.action-sub {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Form Fields */
.form-field {
    margin-bottom: 1.25rem;
}

.field-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.optional {
    text-transform: none;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--text-dim);
}

/* Searchable Select */
.searchable-select {
    position: relative;
}

/* Display trigger — the always-visible button showing selection or placeholder */
.select-display {
    display: flex;
    align-items: center;
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s;
    user-select: none;
    gap: 0.4rem;
}
.select-display:hover:not(.disabled *) { border-color: var(--accent-light); }
.searchable-select.disabled .select-display { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.searchable-select.select-locked .select-display { cursor: default; border-color: var(--accent-light); }

.select-display-text {
    flex: 1;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.select-display-text.has-value { color: var(--text); }

.select-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0 0.1rem;
    line-height: 1;
    flex-shrink: 0;
}
.select-clear:hover { color: var(--red); }
.select-clear.hidden { display: none; }

.select-arrow {
    color: var(--text-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* Dropdown panel */
.select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--bg3);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    z-index: 50;
    box-shadow: var(--shadow-lg);
}
.select-dropdown.hidden { display: none; }

/* Search input inside the dropdown */
.select-search-inner {
    width: 100%;
    background: var(--bg4);
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    padding: 0.5rem 0.9rem;
    outline: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.select-search-inner:focus { border-bottom-color: var(--accent); }

/* Scrollable list */
.select-list {
    max-height: 200px;
    overflow-y: auto;
}

.select-display.field-required { border-color: var(--accent-light); }

.dropdown-item {
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.1s;
    border-bottom: 1px solid var(--border);
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--bg4); color: var(--accent); }
.dropdown-item.no-results { color: var(--text-muted); cursor: default; }

.field-textarea {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    padding: 0.65rem 0.9rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    line-height: 1.5;
}
.field-textarea:focus { border-color: var(--accent); }
.field-textarea::placeholder { color: var(--text-dim); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
}

.btn:active { transform: scale(0.97); }
.btn:hover { opacity: 0.9; box-shadow: 0 4px 16px rgba(0,0,0,0.3); }

.btn-icon { font-size: 0.8em; }

.btn-clockin { background: var(--cns-red); color: white; width: 100%; justify-content: center; margin-top: 0.5rem; font-size: 1rem; padding: 0.9rem; }
.btn-clockout { background: var(--red); color: white; }
.btn-break { background: var(--bg4); color: var(--text); border: 1px solid var(--border-light); }
.btn-endbreak { background: var(--green); color: var(--navy); }

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 2rem;
}

/* Elapsed Display */
.elapsed-display {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    text-align: center;
    margin-top: 1rem;
}

.elapsed-display.break-mode {
    border-color: var(--amber);
    background: var(--amber-dim);
}

.elapsed-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.elapsed-time {
    font-family: 'Syne', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.break-mode .elapsed-time { color: var(--amber); }

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg3);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.5rem;
    font-family: 'Syne', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 999;
    box-shadow: var(--shadow-lg);
    transition: opacity 0.3s ease;
}
.toast.hidden { opacity: 0; pointer-events: none; }
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error   { border-color: var(--red);   color: var(--red);   }
.toast.warning { border-color: var(--amber);  color: var(--amber);  }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- Initials Avatars (when no photo) ---- */
.card-photo-initials,
.emp-photo-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg4);
    color: var(--text-muted);
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    letter-spacing: -0.03em;
    border: 1px solid var(--border);
    user-select: none;
}
.card-photo-initials { font-size: 1.3rem; }
.emp-photo-initials  { font-size: 2rem; }

/* Paid break variant — slightly different shade to distinguish */
.btn-break-paid {
    background: var(--bg4);
    border-color: var(--accent);
    color: var(--accent);
}

/* ---- Utility ---- */
.hidden { display: none !important; }

/* ---- Employee Search ---- */
.search-wrap {
    position: relative;
    margin-bottom: 2rem;
    max-width: 420px;
}

.employee-search {
    width: 100%;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    padding: 0.8rem 2.8rem 0.8rem 2.75rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.employee-search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.employee-search::placeholder { color: var(--text-dim); }

.search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: var(--text-muted);
    pointer-events: none;
    line-height: 1;
}

.search-clear {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.2rem 0.35rem;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
}

.search-clear:hover {
    background: var(--bg4);
    color: var(--text);
}

/* ---- No Results ---- */
.no-results {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 1rem;
    padding: 2rem;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

/* ---- GPS Activity Overlay ---- */
.gps-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gps-overlay.hidden { display: none; }

.gps-overlay-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: var(--bg2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 2.5rem 3rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.gps-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: gps-spin 0.9s linear infinite;
}

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

.gps-overlay-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
}

.gps-overlay-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ---- Break Violation Modal ---- */
.violation-modal {
    max-width: 420px;
    width: 90%;
    align-items: stretch;
    text-align: left;
}

.violation-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--red);
    margin-bottom: 0.25rem;
}

.violation-message {
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

.violation-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.violation-option-btn {
    width: 100%;
    padding: 0.65rem 1rem;
    background: var(--bg3);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.violation-option-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ---- Required field label indicator ---- */
.field-label .required-marker {
    color: var(--red);
    font-weight: 700;
    margin-left: 0.2rem;
}

.select-display.field-required {
    border-color: var(--accent-light);
}

/* ---- Fast Action Buttons on Employee Cards ---- */
.card-fast-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.6rem;
    width: 100%;
    justify-content: center;
}

.fast-btn {
    font-family: 'Syne', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.15s;
    white-space: nowrap;
}

.fast-btn:active { transform: scale(0.95); }
.fast-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.fast-btn-in {
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid var(--green);
}

.fast-btn-in:hover:not(:disabled) {
    background: var(--green);
    color: white;
}

.fast-btn-out {
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid var(--red);
}

.fast-btn-out:hover:not(:disabled) {
    background: var(--red);
    color: white;
}

.fast-btn-endbreak {
    background: var(--amber-dim);
    color: var(--amber);
    border: 1px solid var(--amber);
}

.fast-btn-endbreak:hover:not(:disabled) {
    background: var(--amber);
    color: white;
}

/* ---- Brand accent overrides ---- */
.hero-title {
    background: linear-gradient(135deg, var(--text) 60%, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* CNS Blue top stripe on status-in cards */
.employee-card.status-in::before { background: var(--accent); }

/* Status badge blue for clocked-in */
.status-in .card-status-badge { background: var(--accent-dim); color: var(--accent); }
.status-in .status-dot { background: var(--accent); }
.emp-photo-wrap.status-in::after { border-color: var(--accent); }
.status-badge-large.status-in { background: var(--accent-dim); color: var(--accent); }

/* ---- Header right group ---- */
.header-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.header-settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    transition: color 0.2s;
    padding: 0.25rem;
    border-radius: 6px;
}

.header-settings-btn:hover {
    color: var(--accent);
}

/* ---- Filter indicator on home page ---- */
.filter-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.6rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
}

.filter-indicator-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.78rem;
}

.filter-indicator-link:hover { text-decoration: underline; }

/* ---- Settings Page ---- */
.page-settings {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 2rem 6rem; /* extra bottom padding so content clears fixed footer */
}

.settings-back { margin-bottom: 1.5rem; }

.settings-layout {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.settings-header {}

.settings-title {
    font-family: 'Syne', sans-serif;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text);
}

.settings-sub {
    margin-top: 0.3rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.settings-saved-banner {
    background: var(--green-dim);
    border: 1px solid var(--green);
    color: var(--green);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.settings-section {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem 2rem;
}

.settings-section-title {
    font-family: 'Syne', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.4rem;
}

.settings-section-desc {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.dept-filter-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.link-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.link-btn:hover { color: var(--accent-light); }

.separator {
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* Department checkbox grid */
.dept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.6rem;
}

.dept-checkbox {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.9rem;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}

.dept-checkbox:hover {
    border-color: var(--border-light);
    background: var(--bg4);
}

.dept-checkbox.checked {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.dept-checkbox input[type=checkbox] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.dept-checkbox-mark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-light);
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, background 0.15s;
}

.dept-checkbox.checked .dept-checkbox-mark {
    background: var(--accent);
    border-color: var(--accent);
}

.dept-checkbox.checked .dept-checkbox-mark::after {
    content: '';
    width: 5px;
    height: 9px;
    border: 2px solid var(--bg);
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translate(-1px, -1px);
    display: block;
}

.dept-checkbox-label {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.3;
}

.dept-checkbox.checked .dept-checkbox-label {
    color: var(--accent);
    font-weight: 500;
}

/* Settings footer */
.settings-footer-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: var(--navy);
    border-top: 2px solid var(--accent);
    z-index: 100;
    padding: 0 2rem;
}

.settings-footer-fixed .btn-clockin,
.settings-footer-fixed .btn-break {
    width: auto;
    padding: 0.65rem 2rem;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ---- Labor History Panel ---- */
.page-history {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
}

.history-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.history-title {
    font-family: 'Syne', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.history-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.date-range-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.date-range-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.date-nav {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.date-nav-btn {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    width: 28px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}

.date-nav-btn:hover {
    background: var(--bg4);
    color: var(--accent);
    border-color: var(--accent);
}

.date-input {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    padding: 0.35rem 0.6rem;
    outline: none;
    height: 32px;
    transition: border-color 0.2s;
    color-scheme: dark;
}

.date-input:focus { border-color: var(--accent); }

.date-range-sep {
    color: var(--text-dim);
    padding-top: 1.25rem;
}

.history-loading,
.history-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

/* History table */
.history-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    white-space: nowrap;
}

.history-table thead tr {
    background: var(--bg3);
    border-bottom: 1px solid var(--border-light);
}

.history-table th {
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    padding: 0.6rem 0.75rem;
    text-align: left;
    white-space: nowrap;
}

.history-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

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

.history-table tbody tr:hover { background: var(--bg3); }

.history-table .date-cell {
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--accent);
    white-space: nowrap;
}

.history-table .time-cell {
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    white-space: nowrap;
}

.history-table .num-cell {
    font-variant-numeric: tabular-nums;
    text-align: right;
    font-family: 'Syne', sans-serif;
    font-size: 0.82rem;
}

.history-table .num-cell.ot {
    color: var(--amber);
}

.history-table .desc-cell {
    color: var(--text-muted);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-table .type-cell {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    white-space: nowrap;
    padding: 0.55rem 0.75rem;
}

.history-table .type-regular {
    color: var(--accent);
}

.history-table .type-break {
    color: var(--amber);
}

/* History totals row */
.history-table .totals-row {
    background: var(--bg3);
    border-top: 2px solid var(--border-light);
}

.history-table .totals-row td {
    border-bottom: none;
}

.history-table .totals-label {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    padding: 0.6rem 0.75rem;
}

.history-table .totals-num {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    color: var(--text);
}

.history-table .totals-num.ot {
    color: var(--amber);
}

/* ---- Clock-in actions row ---- */
.clockin-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.5rem;
}

.clockin-actions .btn-clockin {
    flex: 1;
    margin-top: 0;
}

.btn-lastjob {
    background: var(--bg4);
    color: var(--accent);
    border: 1px solid var(--accent);
    font-size: 0.85rem;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.btn-lastjob:hover {
    background: var(--accent-dim);
}

/* ---- PIN Modal ---- */
.pin-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(6px);
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pin-modal.hidden { display: none; }

.pin-modal-inner {
    background: var(--bg2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 2rem;
    width: min(340px, 90vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow-lg);
}

.pin-modal-title {
    font-family: 'Syne', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.pin-modal-name {
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: 500;
    margin-top: -0.75rem;
}

.pin-display {
    font-family: 'Syne', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.5em;
    color: var(--text);
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1.5rem;
    width: 100%;
    text-align: center;
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    width: 100%;
}

.pin-key {
    font-family: 'Syne', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 0.85rem;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
    text-align: center;
}

.pin-key:active { transform: scale(0.94); }
.pin-key:hover  { background: var(--bg4); border-color: var(--accent); }

.pin-key-clear  { color: var(--amber); }
.pin-key-cancel { color: var(--red); }

.pin-error {
    font-size: 0.85rem;
    color: var(--red);
    text-align: center;
    background: var(--red-dim);
    border: 1px solid var(--red);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    width: 100%;
}

/* ---- Change Job / Clock In Again button ---- */
.btn-clockinagain {
    background: var(--bg4);
    color: var(--accent);
    border: 1px solid var(--accent);
}
.btn-clockinagain:hover { background: var(--accent-dim); }

.clockinagain-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}
.clockinagain-header .action-heading { margin: 0; }

/* ---- Device Access Status Screen ---- */
.device-access-screen-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 64px);
    padding: 2rem;
}

.device-access-inner {
    max-width: 480px;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.device-access-icon {
    font-size: 3.5rem;
    line-height: 1;
}

.device-access-title {
    font-family: 'Syne', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text);
}

.device-access-msg {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 380px;
}

.device-access-detail {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    width: 100%;
    justify-content: space-between;
}

.device-access-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.device-access-value {
    font-family: 'Syne', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.device-access-hint {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 0.5rem;
}

/* ---- Device pending page — email button & feedback ---- */
.device-email-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.btn-send-email {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.8rem 1.75rem;
    cursor: pointer;
    transition: background 0.15s;
    width: 100%;
    max-width: 320px;
}

.btn-send-email:hover:not(:disabled) { background: var(--accent-light); }
.btn-send-email:disabled { opacity: 0.6; cursor: default; }

.email-feedback {
    font-size: 0.88rem;
    border-radius: var(--radius-sm);
    padding: 0.6rem 1rem;
    width: 100%;
    max-width: 320px;
    text-align: center;
}

.email-feedback.hidden  { display: none; }
.email-feedback.success { background: var(--green-dim); color: var(--green); border: 1px solid var(--green); }
.email-feedback.error   { background: var(--red-dim);   color: var(--red);   border: 1px solid var(--red); }

/* ---- Device pending page — resend email button ---- */
.btn-resend-email {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 0.5rem;
}
.btn-resend-email:hover:not(:disabled) { background: var(--accent-light); }
.btn-resend-email:disabled { opacity: 0.6; cursor: default; }

.email-feedback {
    font-size: 0.88rem;
    border-radius: var(--radius-sm);
    padding: 0.6rem 1rem;
    width: 100%;
    text-align: center;
    line-height: 1.5;
}
.email-feedback.hidden { display: none; }
.email-feedback.feedback-success {
    background: var(--green-dim);
    border: 1px solid var(--green);
    color: var(--green);
}
.email-feedback.feedback-error {
    background: var(--red-dim);
    border: 1px solid var(--red);
    color: var(--red);
}

/* ---- Settings — Device Name ---- */
.device-name-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.device-name-input {
    flex: 1;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    padding: 0.65rem 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    min-width: 0;
}

.device-name-input:focus { border-color: var(--accent); }
.device-name-input::placeholder { color: var(--text-dim); }

.btn-rename {
    background: var(--bg4);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.65rem 1.25rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.btn-rename:hover:not(:disabled) { background: var(--accent-dim); }
.btn-rename:disabled { opacity: 0.6; cursor: default; }

.rename-feedback {
    margin-top: 0.6rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.9rem;
}

.rename-feedback.hidden  { display: none; }
.rename-feedback.success { background: var(--green-dim); color: var(--green); border: 1px solid var(--green); }
.rename-feedback.error   { background: var(--red-dim);   color: var(--red);   border: 1px solid var(--red); }

/* ---- Device pending page — name editor ---- */
.pending-name-section {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: 100%;
}

.pending-name-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    text-align: left;
}

.pending-name-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
}

.pending-name-row .device-name-input {
    flex: 1;
    min-width: 0;
}

.pending-name-row .btn-rename {
    flex-shrink: 0;
    padding: 0.65rem 1.1rem;
}

/* ---- Time Off Page ---- */
.page-timeoff {
    max-width: 860px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
}

.timeoff-back { margin-bottom: 1.25rem; }

.timeoff-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.timeoff-title {
    font-family: 'Syne', sans-serif;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text);
    margin: 0;
}

.timeoff-sub {
    color: var(--accent);
    font-size: 0.95rem;
    margin: 0.2rem 0 0;
}

.timeoff-new-btn {
    width: auto;
    padding: 0.7rem 1.5rem;
    margin-top: 0;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.timeoff-form-section { margin-bottom: 1.5rem; }
.timeoff-form-section.hidden { display: none; }

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

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

.timeoff-date {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    height: auto;
}

.timeoff-select {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    padding: 0.6rem 0.75rem;
    outline: none;
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a8f9a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
    cursor: pointer;
}

.timeoff-select:focus { border-color: var(--accent); }

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

.timeoff-form-actions .btn-clockin {
    width: auto;
    padding: 0.75rem 2rem;
    margin-top: 0;
}

.to-feedback {
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.9rem;
    font-size: 0.88rem;
    margin-top: 0.5rem;
}
.to-feedback.hidden { display: none; }
.to-feedback.error  { background: var(--red-dim); color: var(--red); border: 1px solid var(--red); }

.timeoff-history { margin-top: 1.5rem; }

.timeoff-empty {
    text-align: center;
    padding: 2.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.timeoff-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* Status badges */
.to-status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.to-pending  { background: var(--amber-dim);   color: var(--amber);  border: 1px solid var(--amber); }
.to-approved { background: var(--green-dim);   color: var(--green);  border: 1px solid var(--green); }
.to-rejected { background: var(--red-dim);     color: var(--red);    border: 1px solid var(--red); }

/* Time Off button on status page */
.status-back {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.btn-timeoff-link {
    font-size: 0.85rem;
    padding: 0.4rem 0.9rem;
    background: var(--bg3);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.btn-timeoff-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ---- Time Off table — Note/Response wrap naturally, no tooltip ---- */
.timeoff-table .desc-cell {
    white-space: normal;
    word-break: break-word;
    min-width: 120px;
    max-width: 220px;
}

.timeoff-table-wrap,
.timeoff-table,
.timeoff-table tbody,
.timeoff-table tr,
.timeoff-table td {
    overflow: visible;
}

/* ---- Status page back bar with multiple buttons ---- */
.status-back-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ---- Standalone History Page ---- */
.page-history-standalone {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
}

.history-page-back { margin-bottom: 1.25rem; }

.history-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* ---- History — weekly subtotal row ---- */
.history-table .week-subtotal-row {
    background: var(--bg2);
    border-top: 1px solid var(--border-light);
    border-bottom: 2px solid var(--border-light);
}

.history-table .week-subtotal-row td { border-bottom: none; }

.history-table .subtotal-label {
    font-family: 'Syne', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    padding: 0.5rem 0.75rem;
}

.history-table .subtotal-num {
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.history-table .subtotal-num.ot { color: var(--amber); }

/* ---- History subtotal toggles ---- */
.history-subtotal-toggles {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.subtotal-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.subtotal-toggle input[type=checkbox] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.subtotal-toggle-mark {
    width: 34px;
    height: 18px;
    background: var(--bg4);
    border: 1px solid var(--border-light);
    border-radius: 9px;
    position: relative;
    transition: background 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.subtotal-toggle-mark::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--text-muted);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s, background 0.2s;
}

.subtotal-toggle input:checked + .subtotal-toggle-mark {
    background: var(--accent-dim);
    border-color: var(--accent);
}

.subtotal-toggle input:checked + .subtotal-toggle-mark::after {
    transform: translateX(16px);
    background: var(--accent);
}

.subtotal-toggle-label {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.subtotal-toggle input:checked ~ .subtotal-toggle-label {
    color: var(--text);
}

/* ---- History — daily subtotal row ---- */
.history-table .day-subtotal-row {
    background: var(--bg2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.history-table .day-subtotal-row td { border-bottom: none; }

.history-table .day-subtotal-row .subtotal-label {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.4rem 0.75rem;
}

.history-table .day-subtotal-row .subtotal-num {
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    color: var(--text-dim);
    font-size: 0.8rem;
}

.history-table .day-subtotal-row .subtotal-num.ot { color: var(--amber); opacity: 0.7; }

/* ---- Locked select (dept/op pre-filled by task definition) ---- */
.searchable-select.select-locked .select-display {
    opacity: 0.75;
    cursor: not-allowed;
    background: var(--bg2);
}

/* ---- Customer logo (right side of header) ---- */
.customer-logo-img {
    height: 36px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
    border-left: 1px solid rgba(255,255,255,0.15);
    padding-left: 0.75rem;
    margin-left: 0.25rem;
    display: block;
}

/* ============================================================
   Forms Feature
   ============================================================ */

/* ---- Layout ---- */
.page-forms { min-height: 100vh; background: var(--bg2); }
.forms-back  { padding: 1rem 1.5rem 0; }

.triggered-banner {
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--accent-light);
    display: flex;
    align-items: center;
    gap: 8px;
}
.triggered-banner.required {
    background: rgba(220,69,55,0.12);
    border-color: rgba(220,69,55,0.35);
    color: #f08070;
}
.forms-layout { max-width: 760px; margin: 0 auto; padding: 1rem 1.5rem 3rem; }

.forms-panel { display: none; }
.forms-panel.active { display: block; }

.forms-heading { font-family: 'Syne', sans-serif; font-size: 2rem; font-weight: 800;
    color: var(--text); margin: 0 0 0.25rem; }
.forms-sub { color: var(--accent); font-size: 1rem; margin: 0 0 1.5rem; }
.forms-empty { color: var(--text-muted); padding: 2rem 0; text-align: center; }

/* ---- Form card list ---- */
.form-category { margin-bottom: 1.5rem; }
.form-category-title {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; color: var(--text-muted); margin-bottom: 0.5rem;
}
.form-card {
    display: flex; align-items: center; gap: 1rem;
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem 1.25rem;
    cursor: pointer; transition: border-color 0.2s, background 0.2s;
    margin-bottom: 0.5rem;
}
.form-card:hover { border-color: var(--accent); background: var(--bg4); }
.form-card.form-card-done { opacity: 0.6; }
.form-card-icon  { font-size: 1.75rem; flex-shrink: 0; }
.form-card-body  { flex: 1; min-width: 0; }
.form-card-title { font-weight: 600; color: var(--text); font-size: 1rem; }
.form-card-desc  { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.2rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.form-card-arrow { color: var(--text-muted); font-size: 1.5rem; flex-shrink: 0; }

.form-badge { display: inline-block; font-size: 0.65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px; padding: 2px 6px;
    border-radius: 4px; margin-left: 8px; vertical-align: middle; }
.form-badge.draft { background: rgba(255,180,0,.15); color: #c89000; border: 1px solid rgba(255,180,0,.3); }
.form-badge.done  { background: rgba(31,149,189,.15); color: var(--accent); border: 1px solid rgba(31,149,189,.3); }

.form-card-skeleton {
    height: 68px; background: var(--bg3); border-radius: var(--radius);
    margin-bottom: 0.5rem; animation: skeleton-pulse 1.4s ease-in-out infinite;
}
@keyframes skeleton-pulse {
    0%, 100% { opacity: 1; } 50% { opacity: 0.5; }
}

/* ---- Form Renderer ---- */
.form-renderer-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1rem;
}
.form-save-status { font-size: 0.8rem; }
.form-save-status.unsaved { color: var(--text-muted); }
.form-save-status.saved   { color: var(--accent); }

.form-header {
    display: flex; gap: 1rem; align-items: flex-start;
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.5rem;
}
.form-header-icon { font-size: 2rem; flex-shrink: 0; line-height: 1; }
.form-title   { font-family: 'Syne', sans-serif; font-size: 1.4rem;
    font-weight: 800; color: var(--text); margin: 0 0 0.25rem; }
.form-description { font-size: 0.9rem; color: var(--text-muted); margin: 0; }

.form-fields { display: flex; flex-direction: column; gap: 1rem; }

.form-field-wrap { transition: opacity 0.2s; }
.form-field-wrap.hidden { display: none; }
.form-field-wrap.field-error .form-input,
.form-field-wrap.field-error .sig-canvas,
.form-field-wrap.field-error .bool-toggle-group,
.form-field-wrap.field-error .choice-group {
    border-color: var(--red) !important;
    box-shadow: 0 0 0 2px rgba(220,69,55,.15);
}

.form-section { margin-top: 0.5rem; }
.form-section-title {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; color: var(--accent); margin-bottom: 0.75rem;
    padding-bottom: 0.5rem; border-bottom: 1px solid var(--border);
}

.form-footer-actions { margin-top: 2rem; }

.form-input {
    width: 100%; background: var(--bg3); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    font-family: 'DM Sans', sans-serif; font-size: 0.95rem;
    padding: 0.65rem 0.9rem; outline: none;
    transition: border-color 0.2s; box-sizing: border-box;
}
.form-input:focus { border-color: var(--accent); }

/* ---- Boolean toggle ---- */
.bool-toggle-group { display: flex; gap: 0.5rem; }
.bool-btn {
    flex: 1; padding: 0.65rem; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--bg3);
    color: var(--text-muted); font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem; cursor: pointer; transition: all 0.15s;
}
.bool-btn:hover           { border-color: var(--accent-light); }
.bool-btn.active.yes      { background: rgba(46,160,67,.15); border-color: #2ea043; color: #2ea043; font-weight: 600; }
.bool-btn.active.no       { background: rgba(220,69,55,.15); border-color: var(--red); color: var(--red); font-weight: 600; }

/* ---- Choice buttons ---- */
.choice-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.choice-btn {
    padding: 0.5rem 1rem; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--bg3);
    color: var(--text-muted); font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem; cursor: pointer; transition: all 0.15s;
}
.choice-btn:hover  { border-color: var(--accent-light); color: var(--text); }
.choice-btn.active { background: rgba(31,149,189,.15); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ---- Signature canvas ---- */
.signature-wrap { }
.sig-caption { font-size: 0.8rem; color: var(--text-muted); margin: 0 0 0.5rem; font-style: italic; }
.sig-canvas {
    width: 100%; height: 150px; border: 1px dashed var(--border);
    border-radius: var(--radius-sm); background: var(--bg4);
    cursor: crosshair; touch-action: none; display: block;
}
.sig-canvas.has-sig { border-style: solid; border-color: var(--accent-light); }
.sig-actions { display: flex; justify-content: flex-end; margin-top: 0.4rem; }
.btn-sig-clear {
    background: none; border: none; color: var(--text-muted);
    font-size: 0.8rem; cursor: pointer; padding: 2px 6px;
}
.btn-sig-clear:hover { color: var(--red); }

/* ---- Photo field ---- */
.photo-field-wrap { }
.photo-preview { max-width: 200px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); display: block; margin-bottom: 0.5rem; }
.photo-actions { display: flex; gap: 0.5rem; align-items: center; }

/* ---- Repeating groups ---- */
.repeating-group { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 0.5rem; }
.repeating-item {
    background: var(--bg4); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 0.75rem 1rem;
}
.rg-item-header { display: flex; justify-content: space-between;
    align-items: center; margin-bottom: 0.75rem; }
.rg-item-num { font-size: 0.75rem; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .5px; }
.btn-rg-remove { background: none; border: none; color: var(--text-muted);
    font-size: 0.8rem; cursor: pointer; }
.btn-rg-remove:hover { color: var(--red); }
.btn-add-item {
    width: 100%; padding: 0.6rem; border: 1px dashed var(--border);
    border-radius: var(--radius-sm); background: transparent;
    color: var(--accent); font-family: 'DM Sans', sans-serif; font-size: 0.9rem;
    cursor: pointer; transition: all 0.15s;
}
.btn-add-item:hover { border-color: var(--accent); background: rgba(31,149,189,.05); }

/* ---- Review panel ---- */
.review-fields { display: flex; flex-direction: column; gap: 0; margin-bottom: 1.5rem; }
.review-section-title {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; color: var(--accent); padding: 1rem 0 0.5rem;
    border-bottom: 1px solid var(--border); margin-bottom: 0.5rem;
}
.review-field {
    display: flex; gap: 1rem; padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
}
.review-field-sub { padding-left: 0.5rem; }
.review-label { flex: 0 0 40%; font-size: 0.8rem; color: var(--text-muted);
    font-weight: 600; text-transform: uppercase; letter-spacing: .3px;
    padding-top: 2px; }
.review-value { flex: 1; color: var(--text); font-size: 0.95rem; word-break: break-word; }
.review-sig   { max-width: 200px; border: 1px solid var(--border); border-radius: 4px; display: block; }
.review-photo { max-width: 160px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); display: block; }
.review-group-item {
    background: var(--bg4); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 0.75rem 1rem; margin-bottom: 0.5rem;
}
.review-group-num { font-size: 0.75rem; font-weight: 700; color: var(--text-muted);
    margin-bottom: 0.5rem; text-transform: uppercase; }
.review-actions { margin-top: 1.5rem; }

/* ---- Success panel ---- */
.form-success {
    text-align: center; padding: 3rem 1rem;
    display: flex; flex-direction: column; align-items: center; gap: 1rem;
}
.success-icon {
    width: 64px; height: 64px; border-radius: 50%;
    background: rgba(46,160,67,.15); border: 2px solid #2ea043;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.75rem; color: #2ea043;
}
.success-title { font-family: 'Syne', sans-serif; font-size: 1.75rem;
    font-weight: 800; color: var(--text); margin: 0; }
.success-msg   { color: var(--text-muted); font-size: 1rem; margin: 0; }
.success-queued { color: #c89000; font-size: 0.85rem; margin: 0;
    background: rgba(255,180,0,.1); border: 1px solid rgba(255,180,0,.3);
    border-radius: var(--radius-sm); padding: 0.5rem 1rem; }

/* ---- Selfie modal ---- */
.selfie-preview-wrap {
    width: 100%; max-width: 320px; margin: 0 auto 1rem;
    border-radius: var(--radius-sm); overflow: hidden;
    background: var(--bg4); border: 1px solid var(--border);
}
#selfie-video { width: 100%; display: block; }
#selfie-preview { width: 100%; display: block; }

/* ============================================================
   Mobile Responsive — max-width: 600px
   Covers phones in portrait and small tablets
   ============================================================ */
@media (max-width: 600px) {

    /* ---- Global spacing ---- */
    .page-home    { padding: 1.25rem 1rem 3rem; }
    .page-status  { padding: 1.25rem 1rem 3rem; }
    .page-history-standalone { padding: 1rem 1rem 3rem; }
    .page-forms   { min-height: 100vh; }
    .forms-layout { padding: 1rem 1rem 3rem; }

    /* ---- Site header ---- */
    .site-header  { padding: 0 1rem; }
    .site-logo-text { font-size: 0.95rem; }
    .site-time    { display: none; } /* too cramped on phone */

    /* ---- Home page ---- */
    .page-hero    { margin-bottom: 1.5rem; }
    .hero-title   { font-size: 1.6rem; }
    .hero-sub     { font-size: 0.9rem; }

    .home-search-bar { flex-direction: column; gap: 0.5rem; }
    .search-input    { width: 100%; }

    /* Cards: 2-column grid on phone — still browsable, not a single wide column */
    .employee-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    .employee-card {
        padding: 1.25rem 0.5rem 1rem;
    }
    .emp-avatar   { width: 52px; height: 52px; }
    .emp-card-name { font-size: 0.85rem; }
    .card-dept    { font-size: 0.72rem; }
    .card-status-badge { font-size: 0.65rem; padding: 0.2rem 0.5rem; }

    /* Fast action buttons on cards */
    .card-fast-actions { gap: 0.25rem; flex-wrap: wrap; justify-content: center; }
    .fast-btn { font-size: 0.72rem; padding: 0.3rem 0.5rem; }

    /* ---- Status page back bar ---- */
    .status-back {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
    .status-back-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.4rem;
    }
    .btn-timeoff-link {
        text-align: center;
        font-size: 0.78rem;
        padding: 0.45rem 0.4rem;
        white-space: normal;
        line-height: 1.3;
    }

    /* Status layout already goes 1-column at 680px — just tighten gap */
    .status-layout { gap: 1rem; margin-top: 1rem; }

    /* Employee panel — tighten on phone */
    .employee-panel { padding: 1.25rem 1rem; }
    .emp-photo { width: 80px; height: 80px; }
    .emp-name  { font-size: 1.15rem; }
    .time-stats { gap: 0.5rem; }

    /* Action panel */
    .action-panel { }
    .action-heading { font-size: 1.1rem; }
    .btn { font-size: 0.9rem; padding: 0.75rem 1rem; }

    /* Clock-in form — full width fields */
    .clockin-actions { flex-direction: column; gap: 0.5rem; }
    .clockin-actions .btn-clockin,
    .clockin-actions .btn-lastjob { width: 100%; }

    /* Change job form header */
    .clockinagain-header { flex-wrap: wrap; gap: 0.5rem; }

    /* ---- History page ---- */
    .history-page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .history-controls {
        width: 100%;
        flex-direction: column;
        gap: 0.75rem;
    }
    .date-nav-group { width: 100%; }
    .date-nav { width: 100%; }
    .date-nav input[type=date] { flex: 1; min-width: 0; }

    /* Toggle row — stack on phone */
    .history-subtotal-toggles {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    /* History table — horizontal scroll rather than overflow hidden */
    .history-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .history-table { min-width: 480px; }
    .history-table td, .history-table th { font-size: 0.78rem; padding: 0.4rem 0.5rem; }

    /* ---- PIN modal ---- */
    .pin-modal-inner {
        padding: 1.5rem 1rem;
        width: calc(100vw - 2rem);
        max-width: 340px;
    }
    .pin-display { font-size: 1.6rem; letter-spacing: 0.4rem; }
    .pin-key     { height: 52px; font-size: 1.2rem; }

    /* ---- Violation / early clock-in modal ---- */
    .violation-modal { padding: 1.25rem 1rem; width: calc(100vw - 2rem); }
    .violation-option-btn { font-size: 0.9rem; padding: 0.65rem; }

    /* GPS overlay inner */
    .gps-overlay-inner { padding: 1.25rem 1rem; width: calc(100vw - 2rem); }

    /* ---- Settings page ---- */
    .settings-form { padding: 1.25rem 1rem 5rem; }
    .settings-section { padding: 1rem; }

    /* ---- Forms page ---- */
    .forms-heading { font-size: 1.5rem; }
    .form-header   { flex-direction: column; gap: 0.75rem; }
    .form-header-icon { font-size: 1.5rem; }
    .form-title    { font-size: 1.2rem; }
    .review-field  { flex-direction: column; gap: 0.25rem; }
    .review-label  { flex: none; }
    .bool-toggle-group { flex-direction: row; } /* keep side-by-side */
    .choice-group  { gap: 0.4rem; }
    .choice-btn    { font-size: 0.85rem; padding: 0.45rem 0.75rem; }

    /* Signature canvas — full width on phone, shorter height */
    .sig-canvas    { height: 120px; }

    /* Selfie modal */
    .selfie-preview-wrap { max-width: 100%; }

    /* ---- Time Off page ---- */
    .timeoff-page-header  { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .timeoff-form-actions { flex-direction: column; }
    .timeoff-form-actions .btn-clockin { width: 100%; }

    /* ---- Device pages ---- */
    .device-page { padding: 1.25rem 1rem; }
}

/* Slightly wider phones / small tablets — relax card grid */
@media (min-width: 601px) and (max-width: 900px) {
    .page-home    { padding: 2rem 1.25rem 4rem; }
    .page-status  { padding: 1.5rem 1.25rem 4rem; }
    .employee-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
    .history-controls { flex-wrap: wrap; }
    .status-back-actions { gap: 0.4rem; }
    .btn-timeoff-link { font-size: 0.8rem; padding: 0.4rem 0.65rem; }
}

/* ============================================================
   Task Calendar page
   ============================================================ */

.page-task-calendar {
    padding: 1.5rem 2rem 4rem;
    max-width: 1100px;
    margin: 0 auto;
}

.tc-back {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.tc-employee-name {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ---- Toolbar ---- */
.tc-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tc-nav {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tc-nav-btn {
    padding: 0.3rem 0.7rem;
    font-size: 1.1rem;
    line-height: 1;
    min-width: 36px;
}

.tc-today {
    font-size: 0.8rem;
    padding: 0.3rem 0.65rem;
}

.tc-period-label {
    font-weight: 700;
    font-size: 1rem;
    min-width: 180px;
    text-align: center;
    color: var(--text);
}

/* ---- Calendar collapsible container ---- */
.tc-calendar-section {
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.tc-calendar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 10px 14px;
    background: var(--bg2);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    user-select: none;
}

.tc-calendar-header:hover { background: var(--bg3); }

.tc-calendar-chevron {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---- Loading / error ---- */
.tc-loading, .tc-error {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.tc-error { color: var(--red, #dc4537); }

/* ---- Month view ---- */
.tc-month-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}

.tc-dow {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    padding: 0.4rem 0;
}

/* Month cells container — stack weeks vertically */
.tc-month-cells {
    display: flex;
    flex-direction: column;
}

/* Each week row */
.tc-week {
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

/* Day number row inside each week */
.tc-week-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.tc-day-num {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 3px 6px 2px;
    text-align: left;
    min-height: 22px;
}

.tc-day-num.tc-today-num {
    color: var(--accent);
}

.tc-day-adjacent {
    opacity: 0.3;
}

/* Events layer — positioned relative, height driven by JS */
.tc-week-events {
    position: relative;
    width: 100%;
    margin-bottom: 4px;
    overflow: hidden;
}

/* Individual spanning event block */
.tc-event {
    position: absolute;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    padding: 0 6px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    border-radius: 3px;
    background: var(--accent-dim);
    color: var(--accent-light);
    transition: opacity .15s;
    box-sizing: border-box;
}

.tc-event:hover { opacity: .8; }

/* Left cap — event starts this week */
.tc-event.tc-event-start {
    border-radius: 3px 0 0 3px;
}

/* Right cap — event ends this week */
.tc-event.tc-event-end {
    border-radius: 0 3px 3px 0;
    margin-right: 2px;
}

/* Both caps */
.tc-event.tc-event-start.tc-event-end {
    border-radius: 3px;
    margin-left: 2px;
    margin-right: 2px;
}

/* Continuation — no cap on this side */
.tc-event.tc-event-cont { border-radius: 0; }

/* Priority event colours */
.tc-event.tc-priority-1 { background: rgba(220,69,55,.25); color: #f08070; }
.tc-event.tc-priority-2 { background: rgba(232,164,74,.25); color: #e8a44a; }
.tc-event.tc-priority-3 { background: rgba(80,200,120,.25); color: #50c878; }

/* Priority colours */
.tc-priority-1 .tc-chip, .tc-chip.tc-priority-1 { background: rgba(220,69,55,.18); color: #f08070; }
.tc-priority-2 .tc-chip, .tc-chip.tc-priority-2 { background: rgba(232,164,74,.18); color: #e8a44a; }
.tc-priority-3 .tc-chip, .tc-chip.tc-priority-3 { background: rgba(80,200,120,.18); color: #50c878; }

/* ---- Agenda view ---- */
.tc-agenda-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tc-agenda-empty {
    color: var(--text-muted);
    padding: 2rem;
    text-align: center;
    font-size: 0.9rem;
}

.tc-agenda-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: var(--bg2);
    border-radius: var(--radius);
    padding: 10px 14px;
    cursor: pointer;
    border-left: 3px solid var(--accent-dim);
    transition: background .15s;
}

.tc-agenda-row:hover { background: var(--bg3); }

.tc-agenda-row.tc-priority-1 { border-left-color: #f08070; }
.tc-agenda-row.tc-priority-2 { border-left-color: #e8a44a; }
.tc-agenda-row.tc-priority-3 { border-left-color: #50c878; }

.tc-agenda-dates {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 100px;
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.tc-agenda-arrow { font-size: 0.65rem; color: var(--text-faint); }

.tc-agenda-info { flex: 1; }

.tc-agenda-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text);
    margin-bottom: 2px;
}

.tc-agenda-parent {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.tc-agenda-note {
    font-size: 0.75rem;
    color: var(--text-faint);
    margin-top: 3px;
    font-style: italic;
}

/* ---- Priority badge ---- */
.tc-priority-badge {
    font-size: 0.68rem;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 700;
    flex-shrink: 0;
    align-self: center;
}

.tc-priority-badge.tc-priority-1 { background: rgba(220,69,55,.18); color: #f08070; }
.tc-priority-badge.tc-priority-2 { background: rgba(232,164,74,.18); color: #e8a44a; }
.tc-priority-badge.tc-priority-3 { background: rgba(80,200,120,.18); color: #50c878; }

/* ---- Undated section ---- */
.tc-undated-section {
    margin-top: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.tc-undated-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 10px 14px;
    background: var(--bg2);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    user-select: none;
}

.tc-undated-header:hover { background: var(--bg3); }

.tc-undated-count {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.82rem;
}

.tc-undated-chevron {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tc-undated-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
}

.tc-undated-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 8px 6px;
}

.tc-undated-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: var(--bg1);
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    border-left: 3px solid var(--accent-dim);
    transition: background .15s;
}

.tc-undated-row:hover { background: var(--bg2); }
.tc-undated-row.tc-priority-1 { border-left-color: #f08070; }
.tc-undated-row.tc-priority-2 { border-left-color: #e8a44a; }
.tc-undated-row.tc-priority-3 { border-left-color: #50c878; }

.tc-undated-info { flex: 1; }

.tc-undated-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
}

.tc-undated-parent {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.tc-undated-note {
    font-size: 0.73rem;
    color: var(--text-faint);
    font-style: italic;
    margin-top: 2px;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .page-task-calendar { padding: 1rem 0.75rem 4rem; }
    .tc-period-label { min-width: 130px; font-size: 0.88rem; }
    .tc-agenda-dates { min-width: 75px; font-size: 0.72rem; }
    .tc-dow { font-size: 0.62rem; }
}

/* ============================================================
   Task Detail page
   ============================================================ */

.page-task-detail {
    padding: 1.5rem 2rem 4rem;
    max-width: 700px;
    margin: 0 auto;
}

.td-back {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.td-employee-name {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.td-loading, .td-error {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.td-error { color: var(--red, #dc4537); }

/* ---- Card ---- */
.td-card {
    background: var(--bg2);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

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

.td-task-name {
    font-family: 'Syne', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.td-parent-name {
    font-size: 0.85rem;
    color: var(--accent-light);
    margin-top: 0.25rem;
}

.td-priority-badge {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 10px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 3px;
}

.td-priority-1 { background: rgba(220,69,55,.18);  color: #f08070; }
.td-priority-2 { background: rgba(232,164,74,.18); color: #e8a44a; }
.td-priority-3 { background: rgba(80,200,120,.18); color: #50c878; }

.td-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.td-meta-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.td-meta-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-faint);
    font-weight: 700;
}

.td-meta-value {
    font-size: 0.88rem;
    color: var(--text);
    font-weight: 500;
}

/* ---- Actions ---- */
.td-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.td-action-btn {
    width: 100%;
    padding: 0.9rem 1.25rem;
    font-size: 1rem;
    font-weight: 700;
    justify-content: center;
}

.td-complete-btn {
    background: var(--bg3);
    color: var(--text);
    border: 1px solid var(--border);
}

.td-complete-btn:hover {
    background: rgba(80,200,120,.15);
    border-color: #50c878;
    color: #50c878;
}

.td-completed-notice {
    background: rgba(80,200,120,.12);
    border: 1px solid rgba(80,200,120,.3);
    color: #50c878;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    font-weight: 600;
    text-align: center;
}

/* ---- Checklist ---- */
.td-checklist-section {
    margin-top: 1.5rem;
}

.td-section-title {
    font-family: 'Syne', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-faint);
    margin: 0 0 0.6rem;
}

.td-cl-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg2);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.88rem;
}

.td-cl-table thead tr {
    background: var(--bg3);
}

.td-cl-th-check,
.td-cl-th-desc,
.td-cl-th-note,
.td-cl-th-compby {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-faint);
}

.td-cl-th-check  { width: 52px; text-align: center; }
.td-cl-th-note   { width: 22%; }
.td-cl-th-compby { width: 18%; }

.td-cl-table tbody tr {
    border-top: 1px solid var(--border);
}

.td-cl-table tbody tr:first-child {
    border-top: none;
}

.td-cl-td-check {
    width: 52px;
    text-align: center;
    padding: 0.55rem 0.5rem;
    vertical-align: middle;
}

.td-cl-td-desc {
    padding: 0.55rem 0.75rem;
    color: var(--text);
    vertical-align: middle;
    white-space: normal;
    word-break: break-word;
}

.td-cl-td-note {
    padding: 0.25rem 0.5rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    vertical-align: middle;
}

.td-cl-note-input {
    display: block;
    width: 100%;
    min-height: 1.8em;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-family: inherit;
    line-height: 1.4;
    padding: 0.3rem 0.4rem;
    box-sizing: border-box;
    resize: none;
    overflow: hidden;
    transition: border-color 0.15s, background 0.15s;
}
.td-cl-note-input::placeholder { opacity: 0.45; }
.td-cl-note-input:hover  { border-color: var(--border); }
.td-cl-note-input:focus  {
    outline: none;
    border-color: var(--accent);
    background: var(--bg2);
    color: var(--text, #fff);
}

.td-cl-td-compby {
    padding: 0.55rem 0.75rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    vertical-align: middle;
    white-space: nowrap;
}

.td-cl-cb {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
    accent-color: var(--accent, #5b9cf6);
}

/* ---- Links section ---- */
.td-links-section {
    margin-top: 1.75rem;
}

.td-links-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.td-add-photo-btn {
    font-size: 0.8rem;
    padding: 0.35rem 0.85rem;
    font-weight: 700;
}

.td-link-unavailable {
    color: var(--text-faint);
    font-size: 0.85rem;
    font-style: italic;
    cursor: default;
}

/* Photo upload modal */
.td-photo-pick-area {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.td-photo-file-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.td-photo-pick-label {
    display: inline-block;
    cursor: pointer;
    padding: 0.6rem 1.25rem;
    border: 2px dashed var(--accent);
    border-radius: var(--radius);
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s;
}

.td-photo-pick-label:hover,
.td-photo-pick-btn:hover {
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.td-photo-pick-btn {
    background: none;
    cursor: pointer;
}

.td-webcam-video {
    display: block;
    width: 100%;
    max-height: 260px;
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    object-fit: cover;
    background: #000;
}

.td-webcam-btns {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.td-photo-preview {
    display: block;
    max-width: 100%;
    max-height: 260px;
    border-radius: var(--radius);
    margin: 0 auto 0.75rem;
    object-fit: contain;
}

.td-link-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--bg2);
    border-radius: var(--radius);
    padding: 0.6rem 0.9rem;
    margin-bottom: 0.4rem;
}

.td-link-anchor {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--accent-light, #5b9cf6);
    text-decoration: none;
    font-size: 0.88rem;
    word-break: break-all;
}

.td-link-anchor::before {
    content: '↗';
    font-size: 0.8rem;
    flex-shrink: 0;
    opacity: 0.7;
}

/* File-type icon tints via data-ext attribute */
.td-link-anchor[data-ext="pdf"]::before  { content: '📄'; }
.td-link-anchor[data-ext="jpg"]::before,
.td-link-anchor[data-ext="jpeg"]::before,
.td-link-anchor[data-ext="png"]::before,
.td-link-anchor[data-ext="gif"]::before,
.td-link-anchor[data-ext="webp"]::before,
.td-link-anchor[data-ext="svg"]::before  { content: '🖼'; }

.td-link-anchor:hover { text-decoration: underline; }

.td-link-thumb {
    max-width: 100%;
    max-height: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid var(--border);
    align-self: flex-start;
    cursor: pointer;
}

/* ---- Notes section ---- */
.td-notes-section {
    margin-top: 1.75rem;
}

.td-notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.td-add-note-btn {
    font-size: 0.8rem;
    padding: 0.35rem 0.85rem;
    font-weight: 700;
}

.td-notes-empty {
    color: var(--text-faint);
    font-size: 0.85rem;
    text-align: center;
    padding: 1.25rem 0;
}

/* ---- Note cards ---- */
.td-note-card {
    background: var(--bg2);
    border-radius: var(--radius);
    border-left: 4px solid var(--border);
    padding: 0.75rem 1rem;
    margin-bottom: 0.6rem;
}

.td-note-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
}

.td-note-author {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
}

.td-note-time {
    font-size: 0.75rem;
    color: var(--text-faint);
}

/* .td-note-importance removed — importance is communicated by card border colour only */

.td-note-body {
    font-size: 0.88rem;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

.td-note-actions {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.td-note-btn-edit,
.td-note-btn-delete {
    background: none;
    border: none;
    border-radius: 4px;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

.td-note-btn-edit  { color: var(--accent-light, #5b9cf6); }
.td-note-btn-edit:hover  { background: rgba(91,156,246,.14); }
.td-note-btn-delete { color: var(--red, #dc4537); }
.td-note-btn-delete:hover { background: rgba(220,69,55,.14); }

/* ---- Note modal overlay ---- */
.td-note-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.td-note-overlay.hidden { display: none; }

.td-note-modal {
    background: var(--bg2);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
}

.td-note-modal-title {
    font-family: 'Syne', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 1.1rem;
    color: var(--text);
}

.td-note-modal-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.85rem;
}

.td-note-imp-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

.td-note-imp-swatch {
    width: 28px;
    height: 28px;
    border-radius: 5px;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    outline: none;
    transition: transform .12s, box-shadow .12s;
}

.td-note-imp-swatch:hover {
    transform: scale(1.15);
}

.td-note-imp-swatch.selected {
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(255,255,255,.55);
    transform: scale(1.1);
}

.td-note-textarea {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}

.td-note-textarea:focus {
    outline: none;
    border-color: var(--accent-light, #5b9cf6);
}

.td-note-textarea {
    resize: vertical;
    min-height: 110px;
}

.td-note-modal-btns {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.td-note-modal-btns .btn {
    flex: 1;
    justify-content: center;
}

@media (max-width: 600px) {
    .page-task-detail { padding: 1rem 0.75rem 4rem; }
    .td-meta-grid { grid-template-columns: repeat(2, 1fr); }
    .td-cl-table { font-size: 0.8rem; }
    .td-cl-th-note, .td-cl-td-note,
    .td-cl-th-compby, .td-cl-td-compby { display: none; }
}

/* ---- Task Calendar search ---- */
.tc-search-wrap {
    position: relative;
    flex: 1;
    min-width: 160px;
    max-width: 280px;
}

.tc-search {
    width: 100%;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.35rem 2rem 0.35rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text);
    outline: none;
    box-sizing: border-box;
}

.tc-search:focus {
    border-color: var(--accent);
}

.tc-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 4px;
    line-height: 1;
}

.tc-search-clear:hover { color: var(--text); }

@media (max-width: 600px) {
    .tc-search-wrap { max-width: 100%; order: 3; flex-basis: 100%; }
    .tc-toolbar { flex-wrap: wrap; }
}

.tc-undated-date {
    font-size: 0.73rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---- Camera barcode scanner ---- */

.cam-scan-btn {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 14px rgba(0,0,0,0.45);
    z-index: 900;
    transition: background 0.15s, transform 0.1s;
}
.cam-scan-btn:hover  { background: #1680a8; }
.cam-scan-btn:active { transform: scale(0.94); }

.cam-scan-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cam-scan-overlay.hidden { display: none; }

.cam-scan-modal {
    position: relative;
    width: min(480px, 96vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.cam-scan-video {
    width: 100%;
    border-radius: var(--radius);
    background: #000;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
}

/* Targeting reticle drawn over the video */
.cam-scan-reticle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -58%);
    width: 62%;
    height: 28%;
    border: 2px solid var(--accent);
    border-radius: 6px;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.35);
    pointer-events: none;
}
/* Corner accents */
.cam-scan-reticle::before,
.cam-scan-reticle::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-color: #fff;
    border-style: solid;
}
.cam-scan-reticle::before {
    top: -2px; left: -2px;
    border-width: 3px 0 0 3px;
    border-radius: 4px 0 0 0;
}
.cam-scan-reticle::after {
    bottom: -2px; right: -2px;
    border-width: 0 3px 3px 0;
    border-radius: 0 0 4px 0;
}

.cam-scan-status {
    color: rgba(255,255,255,0.85);
    font-size: 0.88rem;
    text-align: center;
    margin: 0;
}

.cam-scan-close {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-color: rgba(255,255,255,0.25);
    min-width: 120px;
}
.cam-scan-close:hover { background: rgba(255,255,255,0.22); }

/* ---- End camera scanner ---- */

.tc-no-date {
    color: var(--text-faint);
    font-style: italic;
}
