/* ── CSS Variables (Theme) ─────────────────────────────── */
:root {
    --color-primary: #2d9fd6;
    --color-primary-dark: #2488b8;
    --color-primary-light: #4db8e8;
    --color-secondary: #6b7580;
    --color-success: #58c25a;
    --color-warning: #d97706;
    --color-danger: #dc2626;
    --color-info: #2d9fd6;

    --color-bg: #f3f4f6;
    --color-surface: #ffffff;
    --color-surface-hover: #f9fafb;
    --color-border: #e5e7eb;
    --color-border-dark: #d1d5db;
    --color-text: #111827;
    --color-text-secondary: #6b7280;
    --color-text-muted: #9ca3af;

    --sidebar-width: 240px;
    --header-height: 56px;
    --radius: 6px;
    --radius-lg: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
    --transition: 150ms ease;
}

/* ── Dark Mode ─────────────────────────────────────────── */
[data-theme="dark"] {
    --color-primary: #4db8e8;
    --color-primary-dark: #2d9fd6;
    --color-primary-light: #6dcaf0;
    --color-secondary: #9ca3af;
    --color-success: #6ad06c;
    --color-info: #4db8e8;

    --color-bg: #111827;
    --color-surface: #1f2937;
    --color-surface-hover: #283548;
    --color-border: #374151;
    --color-border-dark: #4b5563;
    --color-text: #f3f4f6;
    --color-text-secondary: #d1d5db;
    --color-text-muted: #9ca3af;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
    color-scheme: dark;
}

/* ── Feedback Widget Theme Integration ─────────────────── */
.fbw-overlay {
    --fbw-accent: var(--color-primary);
    --fbw-accent-hover: var(--color-primary-dark);
    --fbw-accent-subtle: rgba(45, 159, 214, 0.06);
    --fbw-accent-ring: rgba(45, 159, 214, 0.15);
    --fbw-bg: var(--color-surface);
    --fbw-bg-secondary: var(--color-surface-hover);
    --fbw-text: var(--color-text);
    --fbw-text-muted: var(--color-text-secondary);
    --fbw-text-faint: var(--color-text-muted);
    --fbw-border: var(--color-border);
    --fbw-radius: var(--radius-lg);
    --fbw-radius-sm: var(--radius);
    --fbw-shadow: var(--shadow-lg);
    --fbw-overlay-bg: rgba(0, 0, 0, 0.4);
    --fbw-success: var(--color-success);
    --fbw-error: var(--color-danger);
    --fbw-btn-secondary-bg: var(--color-surface-hover);
    --fbw-btn-secondary-hover: var(--color-border);
}

[data-theme="dark"] .fbw-overlay {
    --fbw-overlay-bg: rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .badge-active,
[data-theme="dark"] .badge-success { background: #1a3a1b; color: #6ad06c; }
[data-theme="dark"] .badge-inactive,
[data-theme="dark"] .badge-danger { background: #3b1111; color: #f87171; }
[data-theme="dark"] .badge-pending,
[data-theme="dark"] .badge-warning { background: #3b2e0a; color: #fbbf24; }
[data-theme="dark"] .badge-info { background: #0c2d3f; color: #4db8e8; }
[data-theme="dark"] .badge-secondary { background: #374151; color: #d1d5db; }
[data-theme="dark"] .hubspot-badge { background: #c4532c; color: #fff; }
[data-theme="dark"] .badge-stage { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
[data-theme="dark"] .badge-outline { color: var(--color-primary); border-color: var(--color-primary); }
[data-theme="dark"] .badge-outline:hover { background: rgba(45, 159, 214, 0.15); }

[data-theme="dark"] .nav-item.active { background: #172536; }
[data-theme="dark"] .upload-area:hover,
[data-theme="dark"] .upload-area.drag-over { background: #172536; }

[data-theme="dark"] .login-error { background: #3b1111; border-color: #5c1a1a; color: #f87171; }

[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-textarea:focus {
    box-shadow: 0 0 0 3px rgba(77,184,232,0.2);
}
[data-theme="dark"] .search-bar input:focus {
    box-shadow: 0 0 0 3px rgba(77,184,232,0.2);
}
[data-theme="dark"] .task-card.drag-over {
    box-shadow: 0 0 0 2px rgba(77,184,232,0.3);
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
    min-height: 100vh;
}
a { color: var(--color-primary); text-decoration: none; }
@media (hover: hover) {
    a:hover { text-decoration: underline; }
}
img { max-width: 100%; display: block; }

/* ── Layout ────────────────────────────────────────────── */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--header-height) auto 1fr;
    min-height: 100vh;
}
.app-header {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #58c25a 0%, #2d9fd6 100%);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    z-index: 100;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
}
.app-header h1 { font-size: 1.125rem; font-weight: 600; white-space: nowrap; }
.app-header .spacer { flex: 1; }

.header-actions { display: flex; align-items: center; gap: 12px; }
.header-user { font-size: 0.875rem; opacity: 0.9; color: inherit; text-decoration: none; display: inline-flex; align-items: center; }
.header-user:hover { opacity: 1; text-decoration: underline; }
.header-btn {
    background: rgba(255,255,255,0.22);
    border: none;
    color: #fff;
    padding: 8px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    transition: background var(--transition);
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.header-btn:hover { background: rgba(255,255,255,0.35); }
.header-icon { width: 22px; height: 22px; object-fit: contain; vertical-align: middle; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4)); }

.notification-bell { position: relative; font-size: 1.25rem; }
.notification-badge {
    position: absolute;
    top: -4px; right: -6px;
    background: var(--color-danger);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    min-width: 44px;
    min-height: 44px;
}
.header-logo-text { white-space: nowrap; }

/* ── Sidebar ───────────────────────────────────────────── */
.app-sidebar {
    grid-row: 2 / -1;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    padding: 12px 0;
}
.nav-section { padding: 8px 16px 4px; font-size: 0.675rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--color-text-secondary);
    font-size: 1rem;
    transition: all var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    min-height: 44px;
}
.nav-item:hover { background: var(--color-surface-hover); color: var(--color-text); text-decoration: none; }
.nav-item.active { color: var(--color-primary); background: #edf7fc; font-weight: 500; }
.nav-icon { width: 20px; text-align: center; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; }
.nav-icon-img { width: 20px; height: 20px; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3)); }
[data-theme="dark"] .nav-icon-img { filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5)); }
.sidebar-badge {
    background: var(--color-danger);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    margin-left: auto;
}

/* ── Action Bar ────────────────────────────────────────── */
.action-bar {
    grid-column: 2;
    position: sticky;
    top: var(--header-height);
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 24px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}
.action-bar:empty { display: none; }
.action-bar .btn { font-size: 0.8125rem; padding: 6px 14px; min-height: 34px; }
.action-bar-spacer { flex: 1; }

/* ── Main Content ──────────────────────────────────────── */
.app-main {
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
}

/* ── Page Header ───────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-title { font-size: 1.5rem; font-weight: 600; }
.page-subtitle { color: var(--color-text-secondary); font-size: 0.875rem; }

/* ── Item Hero Photo ──────────────────────────────────── */
.item-hero-photo {
    position: relative;
    margin-bottom: 16px;
    max-height: 200px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    overflow: hidden;
}
.item-hero-photo::before {
    content: '';
    position: absolute;
    inset: -20px;
    background: var(--hero-bg) center / cover no-repeat;
    filter: blur(20px) saturate(1.2);
}
.item-hero-photo img {
    position: relative;
    width: 100%;
    height: 100%;
    max-height: 200px;
    object-fit: contain;
}

/* ── Cards ─────────────────────────────────────────────── */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-title { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.card-body { padding: 20px; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    min-height: 44px;
    min-width: 44px;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border-dark); }
.btn-secondary:hover { background: var(--color-surface-hover); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-danger-icon {
    background: transparent; color: var(--color-danger); border-color: var(--color-danger);
    display: inline-flex; align-items: center; gap: 4px;
}
.btn-danger-icon:hover { background: var(--color-danger); color: #fff; }
.btn-danger-icon svg { vertical-align: middle; flex-shrink: 0; }
.btn-success { background: var(--color-success); color: #fff; }
.btn-success:hover { background: #46a948; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 0.8125rem; }
.btn-lg { min-height: 52px; padding: 12px 24px; font-size: 1rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Forms ─────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 4px; color: var(--color-text); }
.form-label .required { color: var(--color-danger); }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.875rem;
    border: 1px solid var(--color-border-dark);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
    min-height: 44px;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(45,159,214,0.15);
}
.form-textarea { min-height: 80px; resize: vertical; }
.form-error { font-size: 0.8125rem; color: var(--color-danger); margin-top: 4px; }
.form-help { font-size: 0.8125rem; color: var(--color-text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 16px; }

/* ── Tables ────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}
.data-table td {
    padding: 12px 16px;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--color-border);
}
.data-table tr:hover td { background: var(--color-surface-hover); }
.data-table tr.clickable-row { cursor: pointer; }
.data-table .actions { white-space: nowrap; text-align: right; }

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
    white-space: nowrap;
}
.data-table th.sortable:hover {
    color: var(--color-primary);
}
.data-table th.sorted {
    color: var(--color-primary);
}

/* ── Status Badges ─────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}
.badge-active, .badge-success { background: #d9f5da; color: #256b27; }
.badge-inactive, .badge-danger { background: #fee2e2; color: #991b1b; }
.badge-pending, .badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #ddf0fa; color: #1a6e94; }
.badge-secondary { background: #f3f4f6; color: #374151; }
.hubspot-badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: 4px;
    background: #ff7a59;
    color: #fff;
    vertical-align: middle;
    line-height: 1.4;
}
.badge-outline {
    background: transparent;
    color: var(--color-primary);
    border: 1px dashed var(--color-primary);
    cursor: pointer;
    font-weight: 500;
}
.badge-outline:hover {
    background: rgba(45, 159, 214, 0.08);
}
.badge-stage {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
    font-weight: 500;
}

/* ── Pagination ────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 0;
}
.pagination button {
    min-width: 36px;
    min-height: 36px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all var(--transition);
}
.pagination button:hover { background: var(--color-surface-hover); }
.pagination button.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Search Bar ────────────────────────────────────────── */
.search-bar {
    position: relative;
    max-width: 320px;
}
.search-bar input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--color-border-dark);
    border-radius: var(--radius);
    font-size: 0.875rem;
    min-height: 44px;
}
.search-bar input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(45,159,214,0.15); }
.search-bar .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); }

/* ── Toolbar ───────────────────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.toolbar .search-bar {
    width: 100%;
    max-width: 100%;
}
.toolbar .spacer { flex: 1; }

/* ── Empty State ───────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--color-text-secondary);
}
.empty-state p { margin-top: 8px; font-size: 0.875rem; }

/* ── Toast Notifications ───────────────────────────────── */
.toast-container {
    position: fixed;
    top: 112px;
    right: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 16px;
    border-radius: var(--radius);
    color: #fff;
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    animation: toast-in 200ms ease;
    max-width: 360px;
}
.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-danger); }
.toast-warning { background: var(--color-warning); }
.toast-info { background: var(--color-info); }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ── Modal ─────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 16px;
}
.modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}
.modal-title { font-size: 1.125rem; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--color-text-muted);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--color-border); display: flex; justify-content: flex-end; gap: 8px; }

/* ── Login ─────────────────────────────────────────────── */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    padding: 16px;
}
.login-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}
.login-banner { background: #1a1a2e; border-radius: 8px; padding: 12px 16px; }
[data-theme="dark"] .login-banner { background: transparent; padding: 0; }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h2 { font-size: 1.5rem; color: var(--color-primary); }
.login-logo p { color: var(--color-text-secondary); font-size: 0.875rem; margin-top: 4px; }
.login-error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 16px;
}

/* ── Loading ───────────────────────────────────────────── */
.loading { text-align: center; padding: 32px; color: var(--color-text-muted); }
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 600ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tabs ──────────────────────────────────────────────── */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 20px;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}
.tab {
    padding: 10px 20px;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
    min-height: 44px;
}
.tab:hover { color: var(--color-text); }
.tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* ── Detail Layout ─────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; }
.detail-field {}
.detail-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); font-weight: 600; }
.detail-value { font-size: 0.9375rem; margin-top: 2px; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
    .app-layout { grid-template-columns: 1fr; }
    .app-sidebar {
        position: fixed;
        top: var(--header-height);
        left: 0;
        bottom: 0;
        width: var(--sidebar-width);
        z-index: 90;
        transform: translateX(-100%);
        transition: transform 200ms ease;
    }
    .app-sidebar.open { transform: translateX(0); }
    .app-layout { grid-template-rows: auto auto 1fr; }
    .action-bar { grid-column: 1 / -1; flex-wrap: wrap; padding: 8px 16px; }
    .sidebar-toggle { display: flex; }
    .app-header { gap: 8px; padding: 0 8px; position: sticky; top: 0; height: var(--header-height); }
    .app-header h1 { display: none; }
    .header-user { display: none; }
    .header-actions { gap: 4px; }
    .header-btn { min-width: 40px; min-height: 40px; padding: 6px 8px; }
    .form-row { grid-template-columns: 1fr; }
    .page-header { align-items: flex-start; }
    .detail-grid { grid-template-columns: 1fr; }
    .app-main { padding: 16px; }
    .task-card { max-width: 100%; }
    .task-footer { flex-direction: column; gap: 8px; align-items: flex-start; }
    .task-actions { flex-wrap: wrap; }
    .task-time-toggle { grid-template-columns: 1fr auto; }
    .task-time-toggle-left { min-width: 0; }
    .task-time-empty { grid-template-columns: 1fr auto; }
    /* Prevent iOS auto-zoom on input focus */
    .form-input, .form-select, .form-textarea,
    .search-bar input, .task-status-select { font-size: 16px; }
}

/* ── Task Cards (Job Detail) ──────────────────────────── */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}
.task-card {
    position: relative;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 12px;
    transition: border-color var(--transition), box-shadow var(--transition);
    min-width: 0;
    max-width: 100%;
    overflow: visible;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}
.task-card-actions {
    display: none;
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
    gap: 4px;
    z-index: 2;
}
.task-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #fff;
    border: 2px solid var(--color-surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: transform 0.15s ease;
}
.task-action-btn.edit-task-btn {
    background: var(--color-primary, #2d9fd6);
}
.task-action-btn.delete-task-btn {
    background: var(--color-danger, #ef4444);
}
.task-action-btn:hover {
    transform: scale(1.15);
}
.task-action-btn svg {
    width: 14px;
    height: 14px;
    pointer-events: none;
}
.task-card.selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(45, 159, 214, 0.2);
}
.task-card.selected .task-card-actions {
    display: flex;
}
@media (hover: hover) and (pointer: fine) {
    .task-card:hover {
        border-color: var(--color-primary-light);
        box-shadow: var(--shadow-sm);
    }
}
.task-card.dragging {
    opacity: 0.4;
    border-color: var(--color-primary);
}
.task-card.drag-over {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(45, 159, 214, 0.2);
}
@keyframes task-highlight-pulse {
    0%, 100% { box-shadow: 0 0 0 2px var(--color-primary); }
    50% { box-shadow: 0 0 0 2px transparent; }
}
.task-card.highlight-pulse {
    border-color: var(--color-primary);
    animation: task-highlight-pulse 1.5s ease-in-out 4;
}
.field-row.dragging {
    opacity: 0.5;
}
.field-row.drag-over {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}

/* Slider / Range input */
.form-range {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}
.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
}
.form-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: none;
}
.task-drag-handle {
    cursor: grab;
    color: var(--color-text-muted);
    font-size: 16px;
    user-select: none;
    flex-shrink: 0;
}
.task-drag-handle:active { cursor: grabbing; }
.task-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    min-width: 0;
    max-width: 100%;
}
.task-name-stack {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    line-height: 1.2;
}
.task-name-stack strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
}
.task-right-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: auto;
    flex-shrink: 0;
    line-height: 1.2;
}
.task-status-pill.task-status-select {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    border-radius: 9999px;
    margin-top: 2px;
    padding: 2px 18px 2px 6px;
    font-size: 0.675rem;
    font-weight: 600;
    min-height: 0;
    width: auto;
    cursor: pointer;
    align-self: flex-start;
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24'%3E%3Cpath fill='%23333' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 4px center / 10px;
}
.task-status-pill.task-status-select:focus {
    outline: none;
    box-shadow: none;
}
.task-status-pill option {
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.8125rem;
    padding: 4px 8px;
}
.task-status-pill.badge-secondary { background-color: #f3f4f6; color: #374151; }
.task-status-pill.badge-success { background-color: #d9f5da; color: #256b27; }
.task-status-pill.badge-warning { background-color: #fef3c7; color: #92400e; }
.task-status-pill.badge-danger { background-color: #fee2e2; color: #991b1b; }
[data-theme="dark"] .task-status-pill.task-status-select {
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24'%3E%3Cpath fill='%23ccc' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 4px center / 10px;
}
[data-theme="dark"] .task-status-pill.badge-secondary { background-color: #374151; color: #d1d5db; }
[data-theme="dark"] .task-status-pill.badge-success { background-color: #1a3a1b; color: #6ad06c; }
[data-theme="dark"] .task-status-pill.badge-warning { background-color: #3b2e0a; color: #fbbf24; }
[data-theme="dark"] .task-status-pill.badge-danger { background-color: #3b1010; color: #f87171; }
.stage-pill {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--color-primary);
    border-radius: 9999px;
    padding: 2px 18px 2px 6px;
    font-size: 0.675rem;
    font-weight: 600;
    min-height: 0;
    width: auto;
    cursor: pointer;
    background: rgba(45, 159, 214, 0.08);
    color: var(--color-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24'%3E%3Cpath fill='%232d9fd6' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
    background-size: 10px;
}
.stage-pill:focus { outline: none; box-shadow: none; }
.stage-pill option {
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.8125rem;
    padding: 4px 8px;
}
[data-theme="dark"] .stage-pill {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24'%3E%3Cpath fill='%234db8e8' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
}
.task-desc {
    color: var(--color-text-secondary);
    font-size: 13px;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.task-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
}
.task-assignees {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    min-width: 0;
    justify-content: center;
}
.assignee-pill {
    position: relative;
    transition: background 150ms, color 150ms;
}
.assignee-pill .assignee-remove {
    display: none;
    margin-left: 2px;
    padding: 2px 4px;
    font-weight: 700;
    font-size: 0.875rem;
    line-height: 1;
    cursor: pointer;
}
.assignee-pill:hover {
    background: var(--color-danger);
    color: #fff;
}
.assignee-pill:hover .assignee-remove {
    display: inline;
}
[data-theme="dark"] .assignee-pill:hover {
    background: var(--color-danger);
    color: #fff;
}
.task-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.task-status-select {
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    background: var(--color-surface);
    color: var(--color-text);
    min-height: 36px;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.task-status-select:hover {
    border-color: var(--color-primary-light);
}
.task-status-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(45, 159, 214, 0.2);
    outline: none;
}

/* ── Dashboard: My Tasks ──────────────────────────────── */
.my-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.my-task-filter {
    flex: 1;
    min-width: 0;
    min-height: 34px;
    font-size: 0.8125rem;
}

/* Sort pills */
.sort-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 12px;
}
.sort-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.sort-pill:hover {
    border-color: var(--color-primary-light);
    color: var(--color-text);
}
.sort-pill.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* Job groups */
.job-group {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
}
.job-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--color-bg);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
}
.job-group-header:hover {
    background: var(--color-border-light, var(--color-bg));
    filter: brightness(0.97);
}
.job-group-info {
    display: flex;
    align-items: center;
    gap: 8px;
}
.job-group-chevron {
    transition: transform 0.2s;
    flex-shrink: 0;
    color: var(--color-text-muted);
}
.job-group-chevron.expanded {
    transform: rotate(90deg);
}
.job-group-title {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.job-group-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.job-group-sub-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.job-name-stack {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.job-name-number {
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}
.job-name-title {
    font-size: 0.8125rem;
    overflow: hidden;
    text-overflow: ellipsis;
}
.job-group-number {
    font-weight: 700;
    font-size: 0.8125rem;
    color: var(--color-primary);
    white-space: nowrap;
}
.job-group-name {
    font-weight: 600;
    font-size: 0.875rem;
}
.job-group-task-count {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}
.job-group-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.job-group-item {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.job-group-tasks {
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: max-height 0.25s ease;
}
.job-group-tasks.collapsed {
    display: none;
}
.my-task-card {
    display: block;
    padding: 8px 14px;
    border-top: 1px solid var(--color-border);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}
.my-task-card:active {
    background: rgba(45, 159, 214, 0.06);
}
.my-task-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.my-task-title {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--color-primary);
    min-width: 0;
}
.my-task-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.my-task-est {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

@media (max-width: 768px) {
    .my-task-filter { flex: 1; }
    .job-group-header { flex-direction: column; align-items: flex-start; gap: 6px; }
    .job-group-meta { width: 100%; justify-content: space-between; }
    .my-task-row-top { flex-wrap: nowrap; }
    .sort-pills { gap: 4px; }
}

/* ── Time Clock Widget (Header) ──────────────────────── */
.time-clock-widget {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius);
    padding: 4px 12px;
    cursor: pointer;
    transition: background var(--transition);
    max-width: 320px;
    overflow: hidden;
}
.time-clock-widget:hover {
    background: rgba(255,255,255,0.25);
}
.time-clock-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}
.time-clock-task {
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.time-clock-job {
    color: rgba(255,255,255,0.7);
    font-size: 0.6875rem;
}
.time-clock-elapsed {
    color: #fff;
    font-size: 1.125rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.time-clock-stop {
    background: var(--color-danger);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: background var(--transition);
    flex-shrink: 0;
}
.time-clock-stop:hover {
    background: #b91c1c;
}

/* ── Task Time Entries (collapsible) ──────────────────── */
.task-time-section {
    margin-top: 8px;
    border-top: 1px solid var(--color-border);
    padding-top: 6px;
}
.task-time-toggle {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 0;
    width: 100%;
}
.task-time-toggle-left {
    display: flex;
    align-items: center;
    gap: 6px;
}
.task-time-toggle:hover {
    color: var(--color-text);
}
.task-time-chevron {
    transition: transform 0.2s;
    flex-shrink: 0;
}
.task-time-chevron.expanded {
    transform: rotate(90deg);
}
.task-time-entries {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}
.task-time-entries.expanded {
    max-height: 2000px;
}
.dt-compact { white-space: nowrap; }
.dt-date, .dt-time { white-space: nowrap; }
@media (max-width: 768px) {
    .dt-compact { display: inline-flex; flex-direction: column; }
}
.task-time-table {
    font-size: 12px;
    margin-top: 6px;
    width: 100%;
}
.task-time-table th,
.task-time-table td {
    padding: 4px 8px;
}
.task-time-table th {
    font-size: 11px;
}
.time-entry-group tr.has-notes > td {
    border-bottom: none;
}
.time-entry-group .time-notes-row td {
    padding-top: 0 !important;
    padding-bottom: 6px !important;
    border-bottom: 1px solid var(--color-border);
}
.time-entry-group {
    cursor: default;
}
.time-entry-group:hover tr td {
    background: var(--bg-secondary);
}
.time-notes-text {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
    font-size: 11px;
}
.task-time-empty {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 2px 0;
}

@media (max-width: 768px) {
    .time-clock-widget {
        max-width: 200px;
        padding: 4px 8px;
        gap: 6px;
    }
    .time-clock-info {
        display: none;
    }
    .time-clock-elapsed {
        font-size: 0.9375rem;
    }
}

/* ── Photo Gallery & Upload ──────────────────────────── */
.upload-area {
    border: 2px dashed var(--color-border-dark);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    margin-bottom: 20px;
    background: var(--color-surface);
}
.upload-area:hover, .upload-area.drag-over {
    border-color: var(--color-primary);
    background: #edf7fc;
}
.upload-area-icon {
    font-size: 2rem;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}
.upload-area-text {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}
.upload-area-text strong {
    color: var(--color-primary);
}
.upload-area input[type="file"] { display: none; }

.upload-progress {
    margin-bottom: 20px;
}
.upload-progress-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    font-size: 0.8125rem;
}
.upload-progress-item .filename {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.upload-progress-bar {
    width: 80px;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
}
.upload-progress-bar-fill {
    height: 100%;
    background: var(--color-primary);
    transition: width 0.3s;
}

/* Pending photo cards (new item upload) */
.pending-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 8px;
}
.pending-photo-card {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.8125rem;
}
.pending-photo-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: var(--color-bg);
}
.pending-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.pending-thumb-doc {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    font-size: 32px;
}
.remove-pending-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.remove-pending-btn:hover {
    background: rgba(0,0,0,0.8);
}
.pending-photo-info {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.pending-photo-info .filename {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}
.pending-caption-input {
    min-height: 32px !important;
    padding: 4px 8px !important;
    font-size: 0.8125rem !important;
}

.measurement-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.measurement-input-group .measurement-value {
    flex: 1;
}
.measurement-input-group .measurement-unit {
    width: auto;
    min-width: 70px;
}

.photo-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.photo-card {
    position: relative;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.photo-card:hover {
    border-color: var(--color-primary-light);
    box-shadow: var(--shadow);
}
.photo-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}
.photo-card-info {
    padding: 8px 10px;
}
.photo-card-caption {
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text);
}
.photo-card-meta {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    margin-top: 2px;
}
.photo-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    opacity: 0;
    transition: opacity var(--transition);
}
.photo-card:hover .photo-card-overlay {
    opacity: 1;
}
.photo-card-overlay .btn {
    min-height: 36px;
    min-width: 36px;
    padding: 6px 10px;
    font-size: 0.75rem;
}
.photo-card .badge {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 0.625rem;
    z-index: 1;
}
.photo-card-select {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: rgba(0,0,0,0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    transition: background var(--transition);
}
.photo-card-select.selected {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.photo-card-star {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    padding: 0;
    transition: background var(--transition), color var(--transition);
}
.photo-card-star:hover {
    background: rgba(0,0,0,0.6);
    color: #fbbf24;
}
.photo-card-star.active {
    background: rgba(251, 191, 36, 0.9);
    color: #fff;
}

/* ── Row Thumbnails (tables) ──────────────────────────── */
.data-table tr:has(.thumb-cell) td {
    padding-top: 0;
    padding-bottom: 0;
    vertical-align: middle;
}
.thumb-cell {
    padding: 0 !important;
}
.thumb-cell + td {
    padding-left: 8px !important;
}
.thumb-cell .row-thumb {
    display: block;
    width: 44px;
    min-width: 44px;
    height: 44px;
    object-fit: cover;
}
.thumb-cell .row-thumb-empty {
    width: 44px;
    min-width: 44px;
    height: 44px;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
}
.thumb-cell .row-thumb-empty img {
    width: 50%;
    height: 50%;
    object-fit: contain;
    opacity: 0.6;
}

/* ── Dashboard group thumbnails ──────────────────────── */
.dash-thumb {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: var(--radius);
    display: block;
    flex-shrink: 0;
}
.dash-thumb-empty {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dash-thumb-empty img {
    width: 50%;
    height: 50%;
    object-fit: contain;
    opacity: 0.6;
}

/* ── Inline mini thumbnails (e.g. item col in job list) ─ */
.inline-thumb {
    width: 24px;
    min-width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: var(--radius);
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}
.inline-thumb-empty {
    width: 24px;
    min-width: 24px;
    height: 24px;
    border-radius: var(--radius);
    background: #111;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    flex-shrink: 0;
}
.inline-thumb-empty img {
    width: 14px;
    height: 14px;
    object-fit: contain;
    opacity: 0.6;
}

.photo-doc-icon {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    font-size: 3rem;
    color: var(--color-text-muted);
}

/* ── Lightbox ────────────────────────────────────────── */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 600;
    display: flex;
    flex-direction: column;
}
.lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    color: #fff;
    flex-shrink: 0;
}
.lightbox-header .caption {
    font-size: 0.9375rem;
    flex: 1;
    text-align: center;
    padding: 0 16px;
}
.lightbox-header .meta {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
}
.lightbox-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
.lightbox-action-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
    text-decoration: none;
}
.lightbox-action-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}
.lightbox-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 0;
}
.lightbox-body img {
    max-width: 90%;
    max-height: 100%;
    object-fit: contain;
}
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    width: 48px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: background var(--transition);
}
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.lightbox-nav.prev { left: 12px; }
.lightbox-nav.next { right: 12px; }
.lightbox-footer {
    padding: 12px 16px;
    color: rgba(255,255,255,0.7);
    font-size: 0.8125rem;
    text-align: center;
    flex-shrink: 0;
}

/* ── Before/After Compare ────────────────────────────── */
.compare-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 16px;
}
.compare-panel {
    text-align: center;
}
.compare-panel img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: var(--radius);
    margin: 0 auto;
}
.compare-panel .label {
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.compare-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
    color: #fff;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .photo-gallery {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }
    .upload-area {
        padding: 20px 16px;
    }
    .lightbox-nav {
        width: 36px;
        height: 48px;
        font-size: 1.5rem;
    }
    .compare-view {
        grid-template-columns: 1fr;
    }
}

/* ── Notification Dropdown ──────────────────────────────── */
.notification-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 360px;
    max-height: 480px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    overflow: hidden;
    margin-top: 8px;
}
.notification-dropdown.open { display: flex; flex-direction: column; }

.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
}
.notif-dropdown-title { font-weight: 600; color: var(--color-text); font-size: 0.9rem; }
.notif-mark-all-btn {
    background: none; border: none; color: var(--color-primary); cursor: pointer;
    font-size: 0.8rem; padding: 0;
}
.notif-mark-all-btn:hover { text-decoration: underline; }

.notif-dropdown-list {
    overflow-y: auto;
    max-height: 360px;
    flex: 1;
}

.notif-item {
    display: flex;
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--color-surface-hover); }
.notif-item.notif-unread { background: color-mix(in srgb, var(--color-primary) 5%, var(--color-surface)); }
.notif-item.notif-unread:hover { background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface)); }

.notif-item-content { display: flex; align-items: flex-start; gap: 8px; width: 100%; }
.notif-dot {
    width: 8px; height: 8px; min-width: 8px;
    background: var(--color-primary); border-radius: 50%;
    margin-top: 5px;
}
.notif-item-text { flex: 1; min-width: 0; }
.notif-item-title { font-size: 0.85rem; font-weight: 600; color: var(--color-text); line-height: 1.3; }
.notif-item-msg { font-size: 0.8rem; color: var(--color-text-secondary); line-height: 1.3; margin-top: 2px; }
.notif-item-time { font-size: 0.7rem; color: var(--color-text-muted); margin-top: 4px; }

.notif-dropdown-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--color-border);
    text-align: center;
}
.notif-view-all {
    color: var(--color-primary); font-size: 0.85rem; text-decoration: none;
}
.notif-view-all:hover { text-decoration: underline; }

.notif-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* ── Notification Full List ─────────────────────────────── */
.notif-filters { display: flex; gap: 8px; margin-bottom: 16px; }

.notif-full-list { }
.notif-list-item {
    display: flex;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition);
}
.notif-list-item:last-child { border-bottom: none; }
.notif-list-item:hover { background: var(--color-surface-hover); }
.notif-list-item.notif-list-unread { background: color-mix(in srgb, var(--color-primary) 5%, var(--color-surface)); }

.notif-list-item-main { display: flex; align-items: flex-start; gap: 10px; width: 100%; }
.notif-dot-placeholder { width: 8px; min-width: 8px; }
.notif-list-item-body { flex: 1; min-width: 0; }
.notif-list-item-title { font-weight: 600; font-size: 0.9rem; color: var(--color-text); }
.notif-list-item-msg { font-size: 0.85rem; color: var(--color-text-secondary); margin-top: 4px; line-height: 1.4; }
.notif-list-item-meta {
    display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
    white-space: nowrap; min-width: fit-content;
}
.notif-list-time { font-size: 0.75rem; color: var(--color-text-muted); }

/* ── Notification Preferences ───────────────────────────── */
.notif-pref-intro { color: var(--color-text-secondary); margin-bottom: 16px; }

.notif-pref-table {
    width: 100%;
    border-collapse: collapse;
}
.notif-pref-table th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid var(--color-border);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}
.notif-pref-table th:not(:first-child) { text-align: center; width: 80px; }
.notif-pref-table td {
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.notif-pref-toggle { text-align: center !important; }
.notif-pref-type strong { display: block; font-size: 0.9rem; color: var(--color-text); }
.notif-pref-desc { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 2px; }

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--color-border-dark);
    border-radius: 22px;
    transition: background var(--transition);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px; width: 16px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--transition);
}
.toggle-switch input:checked + .toggle-slider { background: var(--color-primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Toast Notification ─────────────────────────────────── */
.toast-notification {
    position: fixed;
    bottom: 24px; right: 24px;
    padding: 12px 20px;
    border-radius: var(--radius);
    color: #fff;
    font-size: 0.9rem;
    z-index: 9999;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: var(--shadow-lg);
}
.toast-notification.toast-visible { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-danger); }

/* ── Notification Responsive ────────────────────────────── */
@media (max-width: 480px) {
    .notification-dropdown { width: calc(100vw - 32px); right: -60px; }
    .notif-list-item-meta { flex-direction: column-reverse; }
}

/* ── Shop Dashboard (TV Kiosk) ─────────────────────────── */
/* Shop dashboard theme variables — dark by default */
.shop-dashboard {
    --sd-bg: #0f1419;
    --sd-bg-raised: #161b22;
    --sd-border: #30363d;
    --sd-text: #e8eaed;
    --sd-text-secondary: #8b949e;
    --sd-text-muted: #636c76;
    --sd-text-faint: #484f58;
    --sd-accent: #58c25a;
    --sd-accent-bg: rgba(88, 194, 90, 0.08);
    --sd-accent-hover: rgba(88, 194, 90, 0.06);
    --sd-orange: #f0883e;
    --sd-row-border: #21262d;
    --sd-thumb-bg: #21262d;

    position: fixed;
    inset: 0;
    background: var(--sd-bg);
    color: var(--sd-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: grid;
    grid-template-rows: 48px 1fr auto;
    overflow: hidden;
}
/* Light mode overrides */
.shop-dashboard.light {
    --sd-bg: #ffffff;
    --sd-bg-raised: #f0f3f6;
    --sd-border: #d0d7de;
    --sd-text: #1f2328;
    --sd-text-secondary: #636c76;
    --sd-text-muted: #8b949e;
    --sd-text-faint: #afb8c1;
    --sd-accent: #1a7f37;
    --sd-accent-bg: rgba(26, 127, 55, 0.08);
    --sd-accent-hover: rgba(26, 127, 55, 0.05);
    --sd-orange: #cf6517;
    --sd-row-border: #d8dee4;
    --sd-thumb-bg: #e6eaef;
}

.shop-dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: var(--sd-bg-raised);
    border-bottom: 1px solid var(--sd-border);
    font-size: 0.875rem;
}
.shop-dash-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    font-weight: 700;
    font-size: 1rem;
    color: var(--sd-accent);
}
.shop-dash-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--sd-text-secondary);
}
.shop-dash-clock {
    font-variant-numeric: tabular-nums;
    font-size: 1rem;
    color: var(--sd-text);
}
.shop-dash-connection {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
}
.shop-dash-connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #58c25a;
}
.shop-dash-connection-dot.disconnected { background: #f85149; }
.shop-dash-connection-dot.reconnecting { background: #d29922; }

.shop-dash-body {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: 1fr auto minmax(0, auto);
    gap: 1px;
    background: var(--sd-border);
    overflow: hidden;
}

.shop-dash-panel {
    background: var(--sd-bg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.shop-dash-panel-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sd-text-secondary);
    margin-bottom: 12px;
    flex-shrink: 0;
}
.shop-dash-panel-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
.shop-dash-panel-scroll::-webkit-scrollbar { width: 4px; }
.shop-dash-panel-scroll::-webkit-scrollbar-track { background: transparent; }
.shop-dash-panel-scroll::-webkit-scrollbar-thumb { background: var(--sd-border); border-radius: 2px; }

/* Left column wrapper: crew + orphan work orders — sizes to content */
.shop-dash-left-col {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--sd-bg);
    min-width: 200px;
    max-width: 380px;
}
.shop-dash-left-col > .shop-dash-crew {
    flex: 1;
    min-height: 0;
}
.shop-dash-left-col > .shop-dash-orphan-wo {
    flex: 0 0 auto;
    max-height: 45%;
    border-top: 1px solid var(--sd-border);
}
/* Ready to start spans right column, row 1 */
.shop-dash-available { grid-column: 2; grid-row: 1; }
/* High priority spans full width, row 2 — single horizontal row of cards */
.shop-dash-priority { grid-column: 1 / -1; grid-row: 2; }
/* Blocked tasks spans full width, row 3 — capped so it doesn't steal space */
.shop-dash-blocked { grid-column: 1 / -1; grid-row: 3; }

/* Technician rows in crew panel */
.shop-dash-tech-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
    transition: background 0.15s;
}
.shop-dash-tech-row.working { background: var(--sd-accent-bg); }
.shop-dash-tech-row.idle { opacity: 0.6; }
.shop-dash-tech-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.shop-dash-tech-dot.working { background: var(--sd-accent); }
.shop-dash-tech-dot.idle { background: var(--sd-text-faint); }
.shop-dash-tech-info { flex: 1; min-width: 0; }
.shop-dash-tech-name {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
}
.shop-dash-tech-task {
    font-size: 0.8125rem;
    color: var(--sd-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.shop-dash-tech-timer {
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--sd-accent);
    flex-shrink: 0;
}
.shop-dash-tech-idle-label {
    font-size: 0.875rem;
    color: var(--sd-text-faint);
    flex-shrink: 0;
}

/* Orphan work orders (no jobs) — prominent warning cards */
.shop-dash-orphan-wo-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #d29922 !important;
}
.shop-dash-orphan-wo-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d29922;
    animation: orphan-wo-pulse 2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes orphan-wo-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(210, 153, 34, 0.6); }
    50% { opacity: 0.6; box-shadow: 0 0 0 6px rgba(210, 153, 34, 0); }
}
.shop-dash-orphan-wo-count {
    background: #d29922;
    color: var(--sd-bg);
    font-size: 0.625rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}
.shop-dash-orphan-wo-card {
    padding: 10px 12px;
    margin-bottom: 6px;
    border: 1px solid rgba(210, 153, 34, 0.4);
    border-left: 3px solid #d29922;
    border-radius: 8px;
    background: rgba(210, 153, 34, 0.08);
}
.shop-dash-orphan-wo-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}
.shop-dash-orphan-wo-number {
    font-weight: 700;
    color: var(--sd-orange);
    font-size: 0.875rem;
}
.shop-dash-orphan-wo-age {
    font-size: 0.6875rem;
    color: #d29922;
    font-weight: 600;
    white-space: nowrap;
}
.shop-dash-orphan-wo-customer {
    color: var(--sd-text);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.shop-dash-orphan-wo-desc {
    color: var(--sd-text-secondary);
    font-size: 0.75rem;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.shop-dash-orphan-wo-action {
    margin-top: 6px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #d29922;
}

/* High priority job cards */
/* Horizontal scrolling container for priority cards */
.shop-dash-priority-scroll {
    flex: 1;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 0;
    padding-bottom: 4px;
}
.shop-dash-priority-scroll::-webkit-scrollbar { height: 4px; }
.shop-dash-priority-scroll::-webkit-scrollbar-track { background: transparent; }
.shop-dash-priority-scroll::-webkit-scrollbar-thumb { background: var(--sd-border); border-radius: 2px; }

.shop-dash-job-card {
    flex: 0 0 240px;
    padding: 12px 14px;
    border: 1px solid var(--sd-border);
    border-radius: 8px;
    background: var(--sd-bg-raised);
}
.shop-dash-job-card.p1 { border-left: 3px solid #f85149; }
.shop-dash-job-card.p2 { border-left: 3px solid #d29922; }
.shop-dash-job-number {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--sd-orange);
}
.shop-dash-job-title {
    font-size: 0.9375rem;
    font-weight: 500;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.shop-dash-job-meta {
    font-size: 0.75rem;
    color: var(--sd-text-secondary);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Available task rows — 2-row grid so job numbers align across rows */
/*   Row 1: [Start] [Thumb] [Task — Item]        [Job number]         */
/*   Row 2:                 [Assignees  ]         [Job title ]         */
.shop-dash-task-row {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 12px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--sd-row-border);
    cursor: pointer;
    transition: background 0.15s;
    align-items: baseline;
}
.shop-dash-task-row:hover { background: var(--sd-accent-hover); }
.shop-dash-task-row:last-child { border-bottom: none; }
.shop-dash-task-row.priority-high { background: rgba(210, 153, 34, 0.12); border-left: 3px solid #d29922; }
.shop-dash-task-row.priority-high:hover { background: rgba(210, 153, 34, 0.2); }
.shop-dash-task-row.priority-critical { background: rgba(248, 81, 73, 0.12); border-left: 3px solid #f85149; }
.shop-dash-task-row.priority-critical:hover { background: rgba(248, 81, 73, 0.2); }
.shop-dash-start-btn {
    grid-column: 1;
    grid-row: 1 / -1;
    align-self: center;
    background: #238636;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    min-height: 32px;
    transition: background 0.15s;
}
.shop-dash-start-btn:hover { background: #2ea043; }
.shop-dash-task-thumb {
    grid-column: 2;
    grid-row: 1 / -1;
    align-self: center;
}
.shop-dash-task-title {
    grid-column: 3;
    grid-row: 1;
    font-size: 0.9375rem;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.shop-dash-task-job {
    grid-column: 4;
    grid-row: 1;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--sd-orange);
    white-space: nowrap;
    text-align: right;
}
.shop-dash-task-assignee {
    grid-column: 3;
    grid-row: 2;
    font-size: 0.75rem;
    color: var(--sd-text-muted);
    white-space: nowrap;
    line-height: 1.1;
}
.shop-dash-task-assignee:empty { display: none; }
.shop-dash-task-job-title {
    grid-column: 4;
    grid-row: 2;
    font-size: 0.75rem;
    color: var(--sd-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
    text-align: right;
}

/* Blocked task rows */
/* Horizontal scrolling container for blocked cards */
.shop-dash-blocked-scroll {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 0;
    padding-bottom: 4px;
}
.shop-dash-blocked-scroll::-webkit-scrollbar { height: 4px; }
.shop-dash-blocked-scroll::-webkit-scrollbar-track { background: transparent; }
.shop-dash-blocked-scroll::-webkit-scrollbar-thumb { background: var(--sd-border); border-radius: 2px; }

.shop-dash-blocked-card {
    flex: 0 0 auto;
    min-width: 180px;
    max-width: 280px;
    padding: 12px 14px;
    border: 1px solid var(--sd-border);
    border-radius: 8px;
    background: var(--sd-bg-raised);
    border-left: 3px solid #d29922;
}
.shop-dash-blocked-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.shop-dash-blocked-job {
    font-weight: 700;
    font-size: 0.8125rem;
    color: var(--sd-orange);
}
.shop-dash-blocked-title {
    font-size: 0.875rem;
    color: var(--sd-text-secondary);
}
.shop-dash-blocked-status {
    font-size: 0.6875rem;
    padding: 2px 8px;
    border-radius: 9999px;
    font-weight: 500;
    flex-shrink: 0;
    white-space: nowrap;
}
.shop-dash-blocked-task-item {
    font-size: 0.8rem;
    color: var(--sd-text-secondary);
    margin-top: 3px;
}
.shop-dash-blocked-status.waiting_parts { background: #3b2e0a; color: #fbbf24; }
.shop-dash-blocked-status.waiting_customer { background: #1c2d4a; color: #79c0ff; }
.shop-dash-blocked-status.waiting_internal { background: #2d1a3e; color: #d2a8ff; }
.shop-dashboard.light .shop-dash-blocked-status.waiting_parts { background: #fef3c7; color: #92400e; }
.shop-dashboard.light .shop-dash-blocked-status.waiting_customer { background: #dbeafe; color: #1e40af; }
.shop-dashboard.light .shop-dash-blocked-status.waiting_internal { background: #ede9fe; color: #6d28d9; }

/* Stats bar */
.shop-dash-stats {
    grid-column: 1 / -1;
    background: var(--sd-bg-raised);
    border-top: 1px solid var(--sd-border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 10px 20px;
    font-size: 0.875rem;
}
.shop-dash-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--sd-text-secondary);
}
.shop-dash-stat-value {
    font-weight: 700;
    font-size: 1rem;
    color: var(--sd-text);
    font-variant-numeric: tabular-nums;
}

/* Theme toggle */
.shop-dash-theme-btn {
    background: none;
    border: 1px solid var(--sd-border);
    color: var(--sd-text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
}
.shop-dash-theme-btn:hover {
    background: var(--sd-accent-hover);
    color: var(--sd-text);
}

/* ── PIN Pad Overlay ───────────────────────────────────── */
.pin-pad-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.pin-pad {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 16px;
    padding: 32px;
    width: 380px;
    text-align: center;
}
.pin-pad-context {
    font-size: 0.875rem;
    color: #8b949e;
    margin-bottom: 8px;
}
.pin-pad-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #e8eaed;
    margin-bottom: 24px;
}
.pin-pad-error {
    color: #f85149;
    font-size: 0.875rem;
    margin-bottom: 12px;
    min-height: 1.25em;
}
.pin-dots {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}
.pin-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #30363d;
    transition: background 0.15s, border-color 0.15s;
}
.pin-dot.filled {
    background: #58c25a;
    border-color: #58c25a;
}
.pin-pad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-width: 280px;
    margin: 0 auto;
}
.pin-pad-digit {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid #30363d;
    background: #0f1419;
    color: #e8eaed;
    font-size: 1.75rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.pin-pad-digit:hover { background: #1c2128; border-color: #484f58; }
.pin-pad-digit:active { background: #238636; border-color: #238636; }
.pin-pad-digit.clear-btn {
    font-size: 0.875rem;
    color: #8b949e;
}
.pin-pad-cancel {
    margin-top: 20px;
    background: none;
    border: none;
    color: #8b949e;
    font-size: 0.9375rem;
    cursor: pointer;
    padding: 8px 16px;
}
.pin-pad-cancel:hover { color: #e8eaed; }

/* PIN pad shake animation */
@keyframes pin-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}
.pin-pad.shake .pin-dots { animation: pin-shake 0.4s ease; }

/* PIN confirm screen */
.pin-confirm {
    text-align: center;
    padding: 20px 0;
}
.pin-confirm-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #e8eaed;
    margin-bottom: 8px;
}
.pin-confirm-action {
    font-size: 1rem;
    color: #8b949e;
    margin-bottom: 24px;
}
.pin-confirm-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.pin-confirm-btn {
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    min-height: 48px;
    transition: background 0.15s;
}
.pin-confirm-btn.confirm { background: #238636; color: #fff; }
.pin-confirm-btn.confirm:hover { background: #2ea043; }
.pin-confirm-btn.cancel { background: #21262d; color: #8b949e; }
.pin-confirm-btn.cancel:hover { background: #30363d; }

/* Clock-out notes */
.pin-notes-textarea {
    width: 100%;
    min-height: 80px;
    background: #0f1419;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #e8eaed;
    padding: 10px;
    font-size: 0.9375rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 16px;
}
.pin-notes-textarea:focus {
    outline: none;
    border-color: #58c25a;
}

/* Kiosk setup screen */
.kiosk-setup {
    position: fixed;
    inset: 0;
    background: #0f1419;
    display: flex;
    align-items: center;
    justify-content: center;
}
.kiosk-setup-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
}
.kiosk-setup-title {
    text-align: center;
    color: #58c25a;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.kiosk-setup-subtitle {
    text-align: center;
    color: #8b949e;
    font-size: 0.875rem;
    margin-bottom: 24px;
}
.kiosk-setup .form-input {
    background: #0f1419;
    border-color: #30363d;
    color: #e8eaed;
}
.kiosk-setup .form-input:focus {
    border-color: #58c25a;
    box-shadow: 0 0 0 3px rgba(88, 194, 90, 0.15);
}
.kiosk-setup .form-label { color: #8b949e; }
.kiosk-setup .btn-primary {
    background: #238636;
    width: 100%;
}
.kiosk-setup .btn-primary:hover { background: #2ea043; }
.kiosk-setup-error {
    background: #3b1111;
    border: 1px solid #5c1a1a;
    color: #f85149;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-bottom: 16px;
}

/* Active timer clickable in crew panel */
.shop-dash-tech-row.working { cursor: pointer; }
.shop-dash-tech-row.working:hover { background: rgba(88, 194, 90, 0.14); }

/* ── Task Detail Modal ────────────────────────────────── */
.task-detail-modal {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}
.task-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px 12px;
    border-bottom: 1px solid #30363d;
}
.task-detail-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #e8eaed;
}
.task-detail-subtitle {
    font-size: 0.8125rem;
    color: #8b949e;
    margin-top: 4px;
}
.task-detail-close {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.task-detail-close:hover { color: #e8eaed; }
.task-detail-body {
    padding: 16px 24px 24px;
}
.task-detail-info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.task-detail-status-pill {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 9999px;
}
.task-detail-status-pill.pending { background: #3b2e0a; color: #fbbf24; }
.task-detail-status-pill.in-progress { background: #0c2d3f; color: #4db8e8; }
.task-detail-status-pill.complete { background: #1a3a1b; color: #6ad06c; }
.task-detail-status-pill.on-hold { background: #2d1a3e; color: #d2a8ff; }
.task-detail-hours {
    font-size: 0.875rem;
    color: #8b949e;
}
.task-detail-desc {
    font-size: 0.875rem;
    color: #b1bac4;
    margin-bottom: 16px;
    line-height: 1.5;
    white-space: pre-wrap;
}
.task-detail-section {
    margin-bottom: 16px;
}
.task-detail-section-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8b949e;
    margin-bottom: 8px;
}
.task-detail-assignees {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.task-detail-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    background: #21262d;
    color: #e8eaed;
}
.task-detail-badge.manual {
    background: #3b2e0a;
    color: #fbbf24;
    font-size: 0.625rem;
    padding: 1px 6px;
    margin-left: 4px;
}
.task-detail-action-btn {
    background: none;
    border: 1px dashed #30363d;
    border-radius: 9999px;
    color: #58c25a;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 3px 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.task-detail-action-btn:hover {
    background: rgba(88, 194, 90, 0.1);
    border-color: #58c25a;
}
.task-detail-action-btn.danger {
    color: #f85149;
    border-color: #30363d;
}
.task-detail-action-btn.danger:hover {
    background: rgba(248, 81, 73, 0.1);
    border-color: #f85149;
}
.task-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}
.task-detail-table th {
    text-align: left;
    padding: 6px 8px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8b949e;
    border-bottom: 1px solid #30363d;
}
.task-detail-table td {
    padding: 8px 8px;
    border-bottom: 1px solid #21262d;
    color: #b1bac4;
}
.task-detail-table tr:last-child td { border-bottom: none; }
.task-detail-assign-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #21262d;
    font-size: 0.875rem;
    color: #e8eaed;
}
.task-detail-assign-row:last-child { border-bottom: none; }
.task-detail-form-group {
    margin-bottom: 12px;
}
.task-detail-form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #8b949e;
    margin-bottom: 4px;
}
.task-detail-input {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.875rem;
    background: #0f1419;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #e8eaed;
    font-family: inherit;
}
.task-detail-input:focus {
    outline: none;
    border-color: #58c25a;
}
textarea.task-detail-input {
    resize: vertical;
    min-height: 60px;
}
.task-detail-form-error {
    color: #f85149;
    font-size: 0.8125rem;
    margin-bottom: 8px;
    min-height: 0;
}
.task-detail-flash-error {
    background: #3b1111;
    border-bottom: 1px solid #5c1a1a;
    color: #f85149;
    padding: 10px 24px;
    font-size: 0.875rem;
    display: none;
}

/* Shop Dashboard Sign Out Button */
.shop-dash-signout {
    background: transparent;
    border: 1px solid var(--sd-border);
    color: var(--sd-text-secondary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 8px;
    line-height: 1;
}
.shop-dash-signout:hover {
    color: var(--sd-text);
    border-color: var(--sd-text-secondary);
}

/* Login Page Dashboard Button */
.login-dashboard-link {
    text-align: center;
    margin-top: 12px;
}
.login-dashboard-btn {
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
}
.login-dashboard-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.login-dashboard-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Dashboard sticky nav bar */
.dash-nav-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.dash-nav-card {
    text-decoration: none !important;
    color: inherit;
    overflow: hidden;
}

/* Draft restore banner */
.draft-restore-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin-bottom: 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--color-text);
}
.draft-restore-banner span { flex: 1; }

/* Customer search select (searchable dropdown) */
.customer-search-select {
    position: relative;
}
.customer-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.customer-search-input-wrap .form-input {
    flex: 1;
    padding-right: 32px;
}
.customer-search-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.customer-search-clear:hover {
    color: var(--color-danger);
}
.customer-search-results {
    position: absolute;
    z-index: 100;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    margin-top: 2px;
}
.customer-search-group-label {
    padding: 6px 12px 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
}
.customer-search-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
}
.customer-search-item:hover {
    background: var(--color-surface-hover);
}
.customer-search-item.customer-search-loading,
.customer-search-item.customer-search-empty {
    color: var(--color-text-muted);
    cursor: default;
    font-style: italic;
}
.customer-search-item-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.customer-search-item-sub {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 1px;
}
.customer-search-company {
    color: var(--color-text-muted);
    font-size: 0.8125rem;
}

/* HubSpot badges */
.customer-result-badge {
    display: inline-block;
    padding: 1px 6px;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #ff7a59;
    color: #fff;
    border-radius: 3px;
    vertical-align: middle;
    margin-left: 4px;
}
.hubspot-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #ff7a59;
    color: #fff;
    border-radius: 4px;
    vertical-align: middle;
}

/* ── Tab Bar ──────────────────────────────────────────── */
.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
}
.tab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color var(--transition), border-color var(--transition);
}
.tab-btn:hover {
    color: var(--color-text);
}
.tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* ── Work Order Card List (mobile) ───────────────────── */
.wo-card-list { display: none; }

.wo-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 12px 14px;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.wo-card:hover {
    border-color: var(--color-primary-light);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.wo-card + .wo-card { margin-top: 8px; }

.wo-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.wo-card-number {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}
.wo-card-title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 6px;
    line-height: 1.3;
}
.wo-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

@media (max-width: 768px) {
    .wo-table-wrap { display: none; }
    .wo-card-list { display: block; }
}
