/**
 * Tint Atlanta CRM - Premium Shop Floor Theme
 * Dark/Light mode with distinctive typography
 */

/* ============================================
   FONTS
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=DM+Sans:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================
   CSS VARIABLES - THEME SYSTEM
   ============================================ */
:root {
    /* Brand */
    --accent: #f68e1e;
    --accent-dark: #e07d0d;
    --accent-light: rgba(246, 142, 30, 0.15);
    --accent-glow: 0 0 20px rgba(246, 142, 30, 0.3);

    /* Status Colors */
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);

    /* Layout */
    --sidebar-width: 220px;
    --sidebar-collapsed: 64px;
    --header-height: 56px;

    /* Typography */
    --font-display: 'Sora', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;

    /* Border Radius - Standardized (matches front-end) */
    --radius-sm: 8px;     /* Small badges, tags, pills */
    --radius-md: 12px;    /* Buttons, inputs, selects, calendar tiles, time slots */
    --radius-lg: 20px;    /* Cards, panels, containers */
    --radius-xl: 24px;    /* Modals, large sections */
}

/* Dark Theme (Default) */
[data-theme="dark"], :root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-card: #161616;
    --bg-elevated: #1c1c1c;
    --bg-hover: #222222;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --border-color: #2a2a2a;
    --border-light: #333333;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-elevated: #f1f3f4;
    --bg-hover: #e8eaed;
    --text-primary: #1a1a1a;
    --text-secondary: #5f6368;
    --text-muted: #9aa0a6;
    --border-color: #e0e0e0;
    --border-light: #eeeeee;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   LAYOUT STRUCTURE
   ============================================ */
html, body {
    /* clip (not hidden): contains horizontal overflow WITHOUT making html/body a
       scroll container, which on iOS Safari breaks vertical page scrolling. */
    overflow-x: clip;
    max-width: 100vw !important;
}

.crm-wrapper {
    display: flex;
    min-height: 100vh;
    overflow-x: clip;
    max-width: 100vw !important;
}

/* ============================================
   SIDEBAR - Collapsible
   ============================================ */
.crm-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width var(--transition-normal);
}

.sidebar-brand {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
}

.sidebar-brand a {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    max-width: 140px;
    height: auto;
    transition: var(--transition-normal);
}

.sidebar-brand small {
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.sidebar-nav .nav-section {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 16px 16px 8px;
    list-style: none;
    font-family: var(--font-display);
}

.sidebar-nav .nav-link {
    color: var(--text-secondary);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    font-size: 13px;
    font-weight: 500;
    margin: 2px 8px;
    border-radius: 0 6px 6px 0;
}

.sidebar-nav .nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.sidebar-nav .nav-link.active {
    color: var(--accent);
    background: var(--accent-light);
    border-left-color: var(--accent);
}

.sidebar-nav .nav-link i {
    font-size: 18px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.crm-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: clip;
    max-width: calc(100vw - var(--sidebar-width));
    transition: margin-left var(--transition-normal);
}

/* ============================================
   HEADER
   ============================================ */
.crm-header {
    height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 20px;
    padding-top: env(safe-area-inset-top, 0px);
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-toggle {
    display: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.header-search {
    flex: 1;
    max-width: 400px;
}

.header-search .input-group {
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.header-search .input-group:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.header-search .input-group-text {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 12px;
}

.header-search .form-control {
    background: transparent;
    border: none;
    padding: 8px 12px 8px 0;
    font-size: 13px;
    color: var(--text-primary);
}

.header-search .form-control::placeholder {
    color: var(--text-muted);
}

.header-search .form-control:focus {
    box-shadow: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* Theme Toggle */
.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.theme-toggle .bi-sun { display: none; }
.theme-toggle .bi-moon { display: block; }

[data-theme="light"] .theme-toggle .bi-sun { display: block; }
[data-theme="light"] .theme-toggle .bi-moon { display: none; }

/* User Dropdown */
.user-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.user-dropdown:hover {
    background: var(--bg-hover);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    font-family: var(--font-display);
}

.user-name {
    font-weight: 500;
    font-size: 13px;
}

/* ============================================
   CONTENT AREA
   ============================================ */
.crm-content {
    flex: 1;
    padding: 20px;
    overflow-x: clip;
    max-width: 100% !important;
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 2px;
}

/* ============================================
   DASHBOARD - HERO APPOINTMENTS
   ============================================ */
.hero-section {
    margin-bottom: 24px;
}

.hero-title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hero-title .count {
    background: var(--accent);
    color: #fff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.appointments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* Appointment Card - Premium (matches appointments page) */
.appointment-card {
    --card-accent: #ef4444;
    --card-glow: rgba(239, 68, 68, 0.2);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.appointment-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--card-accent);
}

.appointment-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, var(--card-glow) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.appointment-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

/* Ready (Red) - default */
.appointment-card.status-ready {
    --card-accent: #ef4444;
    --card-glow: rgba(239, 68, 68, 0.2);
}

/* In Progress (Blue) */
.appointment-card.status-in_progress {
    --card-accent: #3b82f6;
    --card-glow: rgba(59, 130, 246, 0.2);
}

/* Completed (Green) */
.appointment-card.status-completed {
    --card-accent: #22c55e;
    --card-glow: rgba(34, 197, 94, 0.25);
}

/* Paid (Gold) */
.appointment-card.status-paid {
    --card-accent: #f59e0b;
    --card-glow: rgba(245, 158, 11, 0.25);
}

/* Card body for content positioning */
.appointment-card-body {
    position: relative;
    z-index: 1;
    padding: 16px;
}

/* Gold Paid Badge */
.badge-paid {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.appointment-time {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 8px;
}

.appointment-customer {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.appointment-vehicle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

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

.appointment-price {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--success);
}

.appointment-code {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 4px 8px;
    border-radius: 4px;
}

/* ============================================
   STATS BAR
   ============================================ */
.stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    max-width: 100% !important;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: all var(--transition-fast);
    flex: 1 1 120px;
    min-width: 100px;
    max-width: 160px;
}

.stat-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card .stat-value.accent { color: var(--accent); }
.stat-card .stat-value.success { color: var(--success); }
.stat-card .stat-value.warning { color: var(--warning); }

.stat-card .stat-change {
    font-size: 11px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-card .stat-change.up { color: var(--success); }
.stat-card .stat-change.down { color: var(--danger); }

/* ============================================
   CARDS - Premium
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: none;
    transition: var(--transition-fast);
}

.card:hover {
    box-shadow: var(--shadow-sm);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 14px 16px;
    font-family: var(--font-display);
    font-weight: 600;
    border-top-left-radius: var(--radius-lg) !important;
    border-top-right-radius: var(--radius-lg) !important;
    font-size: 13px;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header .view-all {
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.card-header .view-all:hover {
    text-decoration: underline;
}

.card-body {
    padding: 16px;
}

/* ============================================
   TABLES - Clean
   ============================================ */
.table {
    margin: 0;
    color: var(--text-primary);
}

.table th {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    padding: 10px 12px;
    background: transparent;
}

.table td {
    padding: 12px;
    vertical-align: middle;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
}

.table tbody tr {
    transition: var(--transition-fast);
}

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

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

/* Table inside cards - rounded header corners */
.card .table thead tr:first-child th:first-child {
    border-top-left-radius: var(--radius-lg);
}
.card .table thead tr:first-child th:last-child {
    border-top-right-radius: var(--radius-lg);
}
.card .table-responsive .table thead tr:first-child th:first-child {
    border-top-left-radius: var(--radius-lg);
}
.card .table-responsive .table thead tr:first-child th:last-child {
    border-top-right-radius: var(--radius-lg);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    padding: 4px 10px;
    font-weight: 500;
    font-size: 11px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge.bg-success { background: var(--success-bg) !important; color: var(--success) !important; }
.badge.bg-warning { background: var(--warning-bg) !important; color: var(--warning) !important; }
.badge.bg-danger { background: var(--danger-bg) !important; color: var(--danger) !important; }
.badge.bg-info { background: var(--info-bg) !important; color: var(--info) !important; }
.badge.bg-primary { background: var(--accent-light) !important; color: var(--accent) !important; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    font-family: var(--font-body);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    box-shadow: var(--accent-glow);
}

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

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

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
}

/* ============================================
   FORMS
   ============================================ */
.form-control,
.form-select {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:focus,
.form-select:focus {
    background: var(--bg-elevated);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    color: var(--text-primary);
}

.form-label {
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-size: 13px;
}

/* ============================================
   ACTIVITY TIMELINE
   ============================================ */
.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

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

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.activity-icon.service { background: var(--success-bg); color: var(--success); }
.activity-icon.customer { background: var(--info-bg); color: var(--info); }
.activity-icon.lead { background: var(--warning-bg); color: var(--warning); }

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.activity-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.activity-value {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--success);
}

/* ============================================
   CUSTOMER AVATAR
   ============================================ */
.customer-avatar {
    width: 36px;
    height: 36px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    font-family: var(--font-display);
}

.customer-avatar.new {
    background: var(--accent-light);
    color: var(--accent);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-state-icon {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state-text {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 20px;
}

/* ============================================
   CHARTS
   ============================================ */
.chart-container {
    position: relative;
    height: 200px;
}

/* ============================================
   AI ASSISTANT WIDGET
   ============================================ */
.ai-widget {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.ai-widget-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.ai-widget-header i {
    color: var(--accent);
}

.ai-widget-header span {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 14px;
}

.ai-input-wrapper {
    display: flex;
    gap: 8px;
}

.ai-input-wrapper input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-primary);
}

.ai-input-wrapper input::placeholder {
    color: var(--text-muted);
}

.ai-input-wrapper button {
    background: var(--accent);
    border: none;
    border-radius: var(--radius-md);
    width: 40px;
    color: #fff;
    cursor: pointer;
    transition: var(--transition-fast);
}

.ai-input-wrapper button:hover {
    background: var(--accent-dark);
}

/* ============================================
   DROPDOWN MENUS
   ============================================ */
.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    font-size: 13px;
}

.dropdown-item {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-item i {
    width: 18px;
    margin-right: 8px;
    color: var(--text-muted);
}

.dropdown-divider {
    border-color: var(--border-color);
    margin: 6px 0;
}

/* ============================================
   MODALS
   ============================================ */
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
}

.modal-title {
    font-family: var(--font-display);
    font-weight: 600;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px 20px;
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-theme="light"] .btn-close {
    filter: none;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    border-radius: var(--radius-md);
    padding: 14px 16px;
    font-size: 13px;
    border: none;
}

.alert-success { background: var(--success-bg); color: var(--success); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-danger { background: var(--danger-bg); color: var(--danger); }
.alert-info { background: var(--info-bg); color: var(--info); }

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    gap: 4px;
}

.page-link {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 13px;
    transition: var(--transition-fast);
}

.page-link:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.page-item.active .page-link {
    background: var(--accent);
    border-color: var(--accent);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease;
}

.animate-fade-in-up {
    animation: fadeInUp 0.4s ease;
}

/* Staggered animations for cards */
.appointments-grid .appointment-card:nth-child(1) { animation-delay: 0.05s; }
.appointments-grid .appointment-card:nth-child(2) { animation-delay: 0.1s; }
.appointments-grid .appointment-card:nth-child(3) { animation-delay: 0.15s; }
.appointments-grid .appointment-card:nth-child(4) { animation-delay: 0.2s; }
.appointments-grid .appointment-card:nth-child(5) { animation-delay: 0.25s; }
.appointments-grid .appointment-card:nth-child(6) { animation-delay: 0.3s; }

.stats-bar .stat-card:nth-child(1) { animation-delay: 0.1s; }
.stats-bar .stat-card:nth-child(2) { animation-delay: 0.15s; }
.stats-bar .stat-card:nth-child(3) { animation-delay: 0.2s; }
.stats-bar .stat-card:nth-child(4) { animation-delay: 0.25s; }
.stats-bar .stat-card:nth-child(5) { animation-delay: 0.3s; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 991.98px) {
    .crm-sidebar {
        transform: translateX(-100%);
    }

    .crm-sidebar.show {
        transform: translateX(0);
    }

    .crm-main {
        margin-left: 0 !important;
        max-width: 100vw !important;
        width: 100% !important;
    }

    .sidebar-toggle {
        display: flex;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 999;
        display: none;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .header-search {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .crm-content {
        padding: 16px;
    }

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

    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .page-header > div:last-child {
        width: 100% !important;
        display: flex;
        gap: 8px;
    }

    .page-header > div:last-child .btn {
        flex: 1;
        justify-content: center;
    }

    .user-name {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .crm-content {
        padding: 12px;
    }

    .stats-bar {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-card .stat-value {
        font-size: 20px;
    }
}

/* ============================================
   PRINT
   ============================================ */
@media print {
    .crm-sidebar,
    .crm-header,
    .sidebar-overlay,
    .btn,
    .page-header > div:last-child {
        display: none !important;
    }

    .crm-main {
        margin-left: 0 !important;
    }

    .crm-content {
        padding: 0;
    }

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

    body {
        background: #fff;
        color: #000;
    }
}

/* ============================================
   UTILITIES
   ============================================ */
.text-primary { color: var(--accent) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-muted) !important; }

.bg-primary { background: var(--accent) !important; }

.cursor-pointer { cursor: pointer; }

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Lead Pipeline */
.pipeline-board {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 12px;
}

.pipeline-column {
    min-width: 280px;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: 12px;
}

.pipeline-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.pipeline-column-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 13px;
}

.pipeline-column-count {
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.lead-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lead-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.lead-card-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.lead-card-info {
    font-size: 12px;
    color: var(--text-muted);
}

.lead-card-value {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--success);
    font-size: 14px;
    margin-top: 8px;
}

/* Nav tabs */
.nav-tabs {
    border-bottom: 1px solid var(--border-color);
}

.nav-tabs .nav-link {
    border: none;
    color: var(--text-secondary);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: var(--transition-fast);
}

.nav-tabs .nav-link:hover {
    color: var(--text-primary);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    background: transparent;
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Mini stat cards for dashboard widgets */
.stat-card.mini {
    padding: 10px;
    text-align: center;
    cursor: pointer;
}

.stat-card.mini .stat-value {
    font-size: 18px;
}

.stat-card.mini .stat-label {
    font-size: 10px;
}

.stat-card.mini.active {
    border-color: var(--accent);
    background: var(--accent-light);
}

/* Widget drag handle */
.widget {
    margin-bottom: 16px;
}

.drag-handle {
    opacity: 0;
    cursor: grab;
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.widget:hover .drag-handle {
    opacity: 0.6;
}

.widget.sortable-ghost {
    opacity: 0.4;
}

.widget.sortable-chosen {
    box-shadow: var(--shadow-md);
}

/* ============================================================================
   BOOTSTRAP OVERRIDES - Force theme colors across all components
   ============================================================================ */

/* Body and base elements */
body {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

/* Cards */
.card {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.card-header {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.card-footer {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
    border-bottom-left-radius: var(--radius-lg) !important;
    border-bottom-right-radius: var(--radius-lg) !important;
}

.card-body {
    background-color: transparent !important;
}

/* Tables */
.table {
    --bs-table-bg: transparent !important;
    --bs-table-color: var(--text-primary) !important;
    color: var(--text-primary) !important;
}

.table > :not(caption) > * > * {
    background-color: transparent !important;
    border-bottom-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.table > thead {
    background-color: var(--bg-secondary) !important;
}

.table > thead > * > * {
    background-color: var(--bg-secondary) !important;
    color: var(--text-secondary) !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(255,255,255,0.02) !important;
}

.table-hover > tbody > tr:hover > * {
    background-color: rgba(255, 255, 255, 0.04) !important;
}

/* Fix table-warning hover to not clash */
.table-hover > tbody > tr.table-warning:hover > * {
    background-color: rgba(255, 193, 7, 0.15) !important;
}

/* Remove default Bootstrap table-warning background in dark mode */
[data-theme="dark"] .table-warning,
:root .table-warning {
    --bs-table-bg: rgba(255, 193, 7, 0.08);
    --bs-table-hover-bg: rgba(255, 193, 7, 0.12);
}

.table-bordered > :not(caption) > * > * {
    border-color: var(--border-color) !important;
}

/* Modals */
.modal-content {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.modal-header {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

.modal-footer {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

.modal-backdrop.show {
    opacity: 0.8;
}

/* Dropdowns */
.dropdown-menu {
    background-color: var(--bg-elevated) !important;
    border-color: var(--border-color) !important;
    box-shadow: var(--shadow-lg);
}

.dropdown-item {
    color: var(--text-primary) !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--accent-light) !important;
    color: var(--accent) !important;
}

.dropdown-divider {
    border-color: var(--border-color) !important;
}

.dropdown-header {
    color: var(--text-muted) !important;
}

/* Forms */
.form-control,
.form-select {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bg-secondary) !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-light) !important;
    color: var(--text-primary) !important;
}

.form-control::placeholder {
    color: var(--text-muted) !important;
}

.form-control:disabled,
.form-control[readonly] {
    background-color: var(--bg-primary) !important;
    opacity: 0.7;
}

.form-label {
    color: var(--text-secondary) !important;
    font-weight: 500;
}

.form-text {
    color: var(--text-muted) !important;
}

.form-check-input {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
}

.form-check-input:checked {
    background-color: var(--accent) !important;
    border-color: var(--accent) !important;
}

.input-group-text {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-muted) !important;
}

/* Header search - override generic !important form styles */
.header-search .form-control,
.header-search .form-control:focus {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}
.header-search .input-group-text {
    background-color: transparent !important;
    border: none !important;
}

/* Buttons - preserve primary/secondary but fix ghost styles */
.btn-light {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.btn-light:hover {
    background-color: var(--bg-elevated) !important;
}

.btn-outline-secondary {
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
}

.btn-outline-secondary:hover {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-light) !important;
    color: var(--text-primary) !important;
}

.btn-outline-light {
    border-color: var(--border-light) !important;
    color: var(--text-secondary) !important;
}

.btn-outline-light:hover {
    background-color: rgba(255,255,255,0.1) !important;
    color: var(--text-primary) !important;
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-theme="light"] .btn-close {
    filter: none;
}

/* List groups */
.list-group-item {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.list-group-item:hover {
    background-color: var(--bg-secondary) !important;
}

.list-group-item.active {
    background-color: var(--accent) !important;
    border-color: var(--accent) !important;
}

/* Nav tabs and pills */
.nav-tabs {
    border-color: var(--border-color) !important;
}

.nav-tabs .nav-link {
    color: var(--text-secondary) !important;
}

.nav-tabs .nav-link:hover {
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.nav-tabs .nav-link.active {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) var(--border-color) var(--bg-card) !important;
    color: var(--accent) !important;
}

.nav-pills .nav-link {
    color: var(--text-secondary) !important;
}

.nav-pills .nav-link.active {
    background-color: var(--accent) !important;
    color: white !important;
}

/* Pagination */
.page-link {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.page-link:hover {
    background-color: var(--bg-secondary) !important;
    color: var(--accent) !important;
}

.page-item.active .page-link {
    background-color: var(--accent) !important;
    border-color: var(--accent) !important;
}

.page-item.disabled .page-link {
    background-color: var(--bg-secondary) !important;
    color: var(--text-muted) !important;
}

/* Alerts - keep colors but adjust for dark theme */
.alert {
    border: none !important;
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.15) !important;
    color: #60a5fa !important;
}

.alert-success {
    background-color: rgba(34, 197, 94, 0.15) !important;
    color: #4ade80 !important;
}

.alert-warning {
    background-color: rgba(234, 179, 8, 0.15) !important;
    color: #fbbf24 !important;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.15) !important;
    color: #f87171 !important;
}

/* Breadcrumbs */
.breadcrumb {
    background-color: transparent !important;
}

.breadcrumb-item a {
    color: var(--text-secondary) !important;
}

.breadcrumb-item.active {
    color: var(--text-muted) !important;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: var(--text-muted) !important;
}

/* Accordion */
.accordion-item {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

.accordion-button {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

.accordion-button:not(.collapsed) {
    background-color: var(--bg-secondary) !important;
    color: var(--accent) !important;
}

.accordion-button::after {
    filter: invert(1);
}

[data-theme="light"] .accordion-button::after {
    filter: none;
}

.accordion-body {
    background-color: var(--bg-card) !important;
}

/* Tooltips */
.tooltip-inner {
    background-color: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
}

/* Popovers */
.popover {
    background-color: var(--bg-elevated) !important;
    border-color: var(--border-color) !important;
}

.popover-header {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.popover-body {
    color: var(--text-primary) !important;
}

/* Progress bars */
.progress {
    background-color: var(--bg-secondary) !important;
}

/* Offcanvas */
.offcanvas {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

.offcanvas-header {
    border-color: var(--border-color) !important;
}

/* Toast */
.toast {
    background-color: var(--bg-elevated) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.toast-header {
    background-color: var(--bg-secondary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Spinner */
.spinner-border,
.spinner-grow {
    color: var(--accent) !important;
}

/* Badge adjustments */
.badge.bg-light {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

/* Links */
a:not(.btn):not(.nav-link):not(.dropdown-item) {
    color: var(--accent);
}

a:not(.btn):not(.nav-link):not(.dropdown-item):hover {
    color: var(--accent-hover);
}

/* Text utilities override */
.text-dark {
    color: var(--text-primary) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

/* Background utilities override */
.bg-light {
    background-color: var(--bg-secondary) !important;
}

.bg-white {
    background-color: var(--bg-card) !important;
}

.bg-body {
    background-color: var(--bg-primary) !important;
}

/* Border utilities */
.border {
    border-color: var(--border-color) !important;
}

.border-bottom,
.border-top,
.border-start,
.border-end {
    border-color: var(--border-color) !important;
}

/* Selection styling */
::selection {
    background-color: var(--accent);
    color: white;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Light theme specific adjustments */
[data-theme="light"] .table > thead > * > * {
    background-color: var(--bg-secondary) !important;
    color: var(--text-secondary) !important;
}

[data-theme="light"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(0,0,0,0.02) !important;
}

[data-theme="light"] .alert-info {
    background-color: rgba(59, 130, 246, 0.1) !important;
    color: #2563eb !important;
}

[data-theme="light"] .alert-success {
    background-color: rgba(34, 197, 94, 0.1) !important;
    color: #16a34a !important;
}

[data-theme="light"] .alert-warning {
    background-color: rgba(234, 179, 8, 0.1) !important;
    color: #ca8a04 !important;
}

[data-theme="light"] .alert-danger {
    background-color: rgba(239, 68, 68, 0.1) !important;
    color: #dc2626 !important;
}

/* ============================================
   WARRANTY WORKSTATION
   ============================================ */

/* Clickable Stats */
.stats-bar .stat-card.clickable {
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 2px solid transparent;
}

.stats-bar .stat-card.clickable:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.stats-bar .stat-card.clickable.active {
    border-color: var(--accent);
    background: var(--accent-light);
}

/* Status Indicator Colors */
.stat-card .stat-value.status-new { color: var(--warning); }
.stat-card .stat-value.status-review { color: var(--info); }
.stat-card .stat-value.status-approved { color: var(--success); }
.stat-card .stat-value.status-denied { color: var(--danger); }
.stat-card .stat-value.status-scheduled { color: #a855f7; }
.stat-card .stat-value.status-completed { color: var(--text-muted); }

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius-md);
}

.view-toggle .btn {
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.view-toggle .btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.view-toggle .btn.active {
    background: var(--accent);
    color: #fff;
}

/* Claims Table */
.claims-table {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.claims-table .table {
    margin: 0;
}

.claims-table th {
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-display);
    white-space: nowrap;
}

.claims-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color var(--transition-fast);
}

.claims-table th.sortable:hover {
    color: var(--accent);
}

.claims-table th .sort-icon {
    opacity: 0.4;
    margin-left: 4px;
    font-size: 10px;
}

.claims-table th.sortable:hover .sort-icon,
.claims-table th.sort-asc .sort-icon,
.claims-table th.sort-desc .sort-icon {
    opacity: 1;
    color: var(--accent);
}

.claims-table td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.claims-table tbody tr {
    transition: background var(--transition-fast);
}

.claims-table tbody tr:hover {
    background: var(--bg-hover);
}

.claims-table tbody tr.selected {
    background: var(--accent-light);
}

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

.claim-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: 13px;
}

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

/* Days Badge */
.days-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.days-badge.overdue {
    background: var(--danger-bg);
    color: var(--danger);
}

.days-badge.warning {
    background: var(--warning-bg);
    color: var(--warning);
}

/* Customer Age Badge */
.customer-age {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.customer-age.new { background: var(--success-bg); color: var(--success); }
.customer-age.months { background: var(--info-bg); color: var(--info); }
.customer-age.years { background: rgba(168, 85, 247, 0.15); color: #a855f7; }

/* Claim Cards View */
.claims-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 16px;
}

.claim-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
    overflow: hidden;
    position: relative;
}

.claim-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--card-accent) 0%, var(--card-accent-end) 100%);
    opacity: 0.9;
}

.claim-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(180deg, var(--card-glow) 0%, transparent 100%);
    pointer-events: none;
    opacity: 0.5;
    transition: opacity var(--transition-fast);
}

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

.claim-card:hover::after {
    opacity: 0.8;
}

/* Status-based gradients */
.claim-card.status-submitted {
    --card-accent: #eab308;
    --card-accent-end: #facc15;
    --card-glow: rgba(234, 179, 8, 0.15);
}

.claim-card.status-under_review {
    --card-accent: #3b82f6;
    --card-accent-end: #60a5fa;
    --card-glow: rgba(59, 130, 246, 0.15);
}

.claim-card.status-approved {
    --card-accent: #22c55e;
    --card-accent-end: #4ade80;
    --card-glow: rgba(34, 197, 94, 0.15);
}

.claim-card.status-denied {
    --card-accent: #ef4444;
    --card-accent-end: #f87171;
    --card-glow: rgba(239, 68, 68, 0.15);
}

.claim-card.status-scheduled {
    --card-accent: #a855f7;
    --card-accent-end: #c084fc;
    --card-glow: rgba(168, 85, 247, 0.15);
}

.claim-card.status-completed {
    --card-accent: #6b7280;
    --card-accent-end: #9ca3af;
    --card-glow: rgba(107, 114, 128, 0.1);
}

/* ============================================
   STATUS COLOR SYSTEM
   Unified colors across all components
   ============================================ */

/* Status Color Variables */
:root {
    --status-submitted: #eab308;
    --status-submitted-bg: rgba(234, 179, 8, 0.15);
    --status-under-review: #3b82f6;
    --status-under-review-bg: rgba(59, 130, 246, 0.15);
    --status-approved: #22c55e;
    --status-approved-bg: rgba(34, 197, 94, 0.15);
    --status-denied: #ef4444;
    --status-denied-bg: rgba(239, 68, 68, 0.15);
    --status-scheduled: #a855f7;
    --status-scheduled-bg: rgba(168, 85, 247, 0.15);
    --status-completed: #6b7280;
    --status-completed-bg: rgba(107, 114, 128, 0.1);
}

/* --- Stats Bar Status Cards --- */
.stat-card.status-submitted {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.18) 0%, rgba(234, 179, 8, 0.05) 100%);
    border: 1px solid rgba(234, 179, 8, 0.4);
    border-left: 4px solid var(--status-submitted);
}
.stat-card.status-submitted .stat-label { color: var(--status-submitted); }
.stat-card.status-submitted .stat-value { color: var(--status-submitted); }
.stat-card.status-submitted:hover {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.28) 0%, rgba(234, 179, 8, 0.12) 100%);
    border-color: var(--status-submitted);
}
.stat-card.status-submitted.active {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.35) 0%, rgba(234, 179, 8, 0.18) 100%);
    border-color: var(--status-submitted);
    box-shadow: 0 0 20px rgba(234, 179, 8, 0.4);
}

.stat-card.status-under_review {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-left: 4px solid var(--status-under-review);
}
.stat-card.status-under_review .stat-label { color: var(--status-under-review); }
.stat-card.status-under_review .stat-value { color: var(--status-under-review); }
.stat-card.status-under_review:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25) 0%, rgba(59, 130, 246, 0.1) 100%);
    border-color: var(--status-under-review);
}
.stat-card.status-under_review.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(59, 130, 246, 0.15) 100%);
    border-color: var(--status-under-review);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.stat-card.status-approved {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.05) 100%);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-left: 4px solid var(--status-approved);
}
.stat-card.status-approved .stat-label { color: var(--status-approved); }
.stat-card.status-approved .stat-value { color: var(--status-approved); }
.stat-card.status-approved:hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.25) 0%, rgba(34, 197, 94, 0.1) 100%);
    border-color: var(--status-approved);
}
.stat-card.status-approved.active {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.3) 0%, rgba(34, 197, 94, 0.15) 100%);
    border-color: var(--status-approved);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
}

.stat-card.status-denied {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.05) 100%);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-left: 4px solid var(--status-denied);
}
.stat-card.status-denied .stat-label { color: var(--status-denied); }
.stat-card.status-denied .stat-value { color: var(--status-denied); }
.stat-card.status-denied:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.25) 0%, rgba(239, 68, 68, 0.1) 100%);
    border-color: var(--status-denied);
}
.stat-card.status-denied.active {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.3) 0%, rgba(239, 68, 68, 0.15) 100%);
    border-color: var(--status-denied);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.stat-card.status-scheduled {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15) 0%, rgba(168, 85, 247, 0.05) 100%);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-left: 4px solid var(--status-scheduled);
}
.stat-card.status-scheduled .stat-label { color: var(--status-scheduled); }
.stat-card.status-scheduled .stat-value { color: var(--status-scheduled); }
.stat-card.status-scheduled:hover {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.25) 0%, rgba(168, 85, 247, 0.1) 100%);
    border-color: var(--status-scheduled);
}
.stat-card.status-scheduled.active {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.3) 0%, rgba(168, 85, 247, 0.15) 100%);
    border-color: var(--status-scheduled);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.3);
}

.stat-card.status-completed {
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.15) 0%, rgba(107, 114, 128, 0.05) 100%);
    border: 1px solid rgba(107, 114, 128, 0.3);
    border-left: 4px solid var(--status-completed);
}
.stat-card.status-completed .stat-label { color: var(--status-completed); }
.stat-card.status-completed .stat-value { color: var(--status-completed); }
.stat-card.status-completed:hover {
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.25) 0%, rgba(107, 114, 128, 0.1) 100%);
    border-color: var(--status-completed);
}
.stat-card.status-completed.active {
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.3) 0%, rgba(107, 114, 128, 0.15) 100%);
    border-color: var(--status-completed);
    box-shadow: 0 0 20px rgba(107, 114, 128, 0.3);
}

.stat-card.status-all {
    background: linear-gradient(135deg, rgba(246, 142, 30, 0.15) 0%, rgba(246, 142, 30, 0.05) 100%);
    border: 1px solid rgba(246, 142, 30, 0.3);
    border-left: 4px solid var(--accent);
}
.stat-card.status-all .stat-label { color: var(--accent); }
.stat-card.status-all .stat-value { color: var(--accent); }
.stat-card.status-all:hover {
    background: linear-gradient(135deg, rgba(246, 142, 30, 0.25) 0%, rgba(246, 142, 30, 0.1) 100%);
    border-color: var(--accent);
}
.stat-card.status-all.active {
    background: linear-gradient(135deg, rgba(246, 142, 30, 0.3) 0%, rgba(246, 142, 30, 0.15) 100%);
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(246, 142, 30, 0.3);
}

/* --- Table Row Status Borders --- */
.claims-table tbody tr.status-submitted {
    border-left: 4px solid var(--status-submitted);
}
.claims-table tbody tr.status-under_review {
    border-left: 4px solid var(--status-under-review);
}
.claims-table tbody tr.status-approved {
    border-left: 4px solid var(--status-approved);
}
.claims-table tbody tr.status-denied {
    border-left: 4px solid var(--status-denied);
}
.claims-table tbody tr.status-scheduled {
    border-left: 4px solid var(--status-scheduled);
}
.claims-table tbody tr.status-completed {
    border-left: 4px solid var(--status-completed);
}

/* --- Status Badges --- */
.badge-status {
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-status.status-submitted {
    background: var(--status-submitted-bg);
    color: var(--status-submitted);
    border: 1px solid var(--status-submitted);
}
.badge-status.status-under_review {
    background: var(--status-under-review-bg);
    color: var(--status-under-review);
    border: 1px solid var(--status-under-review);
}
.badge-status.status-approved {
    background: var(--status-approved-bg);
    color: var(--status-approved);
    border: 1px solid var(--status-approved);
}
.badge-status.status-denied {
    background: var(--status-denied-bg);
    color: var(--status-denied);
    border: 1px solid var(--status-denied);
}
.badge-status.status-scheduled {
    background: var(--status-scheduled-bg);
    color: var(--status-scheduled);
    border: 1px solid var(--status-scheduled);
}
.badge-status.status-completed {
    background: var(--status-completed-bg);
    color: var(--status-completed);
    border: 1px solid var(--status-completed);
}

/* --- Kanban Column Headers --- */
.kanban-column.status-submitted .kanban-header {
    border-bottom: 2px solid var(--status-submitted);
}
.kanban-column.status-submitted .kanban-title {
    color: var(--status-submitted);
}
.kanban-column.status-submitted .kanban-count {
    background: var(--status-submitted-bg);
    color: var(--status-submitted);
}

.kanban-column.status-under_review .kanban-header {
    border-bottom: 2px solid var(--status-under-review);
}
.kanban-column.status-under_review .kanban-title {
    color: var(--status-under-review);
}
.kanban-column.status-under_review .kanban-count {
    background: var(--status-under-review-bg);
    color: var(--status-under-review);
}

.kanban-column.status-approved .kanban-header {
    border-bottom: 2px solid var(--status-approved);
}
.kanban-column.status-approved .kanban-title {
    color: var(--status-approved);
}
.kanban-column.status-approved .kanban-count {
    background: var(--status-approved-bg);
    color: var(--status-approved);
}

.kanban-column.status-denied .kanban-header {
    border-bottom: 2px solid var(--status-denied);
}
.kanban-column.status-denied .kanban-title {
    color: var(--status-denied);
}
.kanban-column.status-denied .kanban-count {
    background: var(--status-denied-bg);
    color: var(--status-denied);
}

.kanban-column.status-scheduled .kanban-header {
    border-bottom: 2px solid var(--status-scheduled);
}
.kanban-column.status-scheduled .kanban-title {
    color: var(--status-scheduled);
}
.kanban-column.status-scheduled .kanban-count {
    background: var(--status-scheduled-bg);
    color: var(--status-scheduled);
}

.kanban-column.status-completed .kanban-header {
    border-bottom: 2px solid var(--status-completed);
}
.kanban-column.status-completed .kanban-title {
    color: var(--status-completed);
}
.kanban-column.status-completed .kanban-count {
    background: var(--status-completed-bg);
    color: var(--status-completed);
}

.kanban-count {
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    font-family: var(--font-mono);
}

.claim-card-header {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-light);
}

.claim-card-body {
    padding: 16px;
}

.claim-card-footer {
    padding: 12px 16px;
    background: var(--bg-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Kanban View */
.kanban-container {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overflow-y: visible;
    padding: 8px 0 20px 0;
    width: 100% !important;
    -webkit-overflow-scrolling: touch;
}

.kanban-column {
    flex: 1 1 200px;
    min-width: 180px;
    max-width: 240px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 12px;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

.kanban-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 1;
}

.kanban-header-title {
    font-weight: 600;
    font-family: var(--font-display);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.kanban-count {
    background: var(--bg-elevated);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.kanban-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid var(--border-light);
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

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

/* Bulk Toolbar */
.bulk-toolbar {
    background: var(--accent);
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    display: none;
    align-items: center;
    gap: 16px;
    animation: slideDown 0.2s ease;
}

.bulk-toolbar.show {
    display: flex;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.bulk-toolbar .form-select {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    min-width: 160px;
}

.bulk-toolbar .form-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.bulk-toolbar .btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
}

.bulk-toolbar .btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Search Filter Card */
.filter-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.filter-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

/* Form container for workstations */
#bulkForm {
    max-width: 100% !important;
    overflow-x: hidden;
}

.filter-row .form-control,
.filter-row .form-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
}

.filter-row .form-control:focus,
.filter-row .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* Filter row child elements */
.filter-search {
    flex: 1 1 280px;
    min-width: 200px;
}

.filter-select {
    flex: 0 0 auto;
    min-width: 160px;
}

.filter-date {
    flex: 0 0 auto;
    width: 140px;
}

.filter-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
}

.filter-row .input-group {
    flex-wrap: nowrap;
}

.filter-row .input-group-text {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-right: none;
    color: var(--text-muted);
}

.filter-row .input-group .form-control {
    border-left: none;
}

.filter-row .input-group .form-control:focus {
    border-left: none;
}

.filter-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.filter-info {
    color: var(--text-muted);
    font-size: 13px;
}

/* Keyboard Shortcuts */
.kbd {
    display: inline-block;
    padding: 3px 8px;
    font-size: 12px;
    font-family: var(--font-mono);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-muted);
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

/* Empty State for Workstation */
.workstation-empty {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
}

.workstation-empty i {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.workstation-empty h3 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

.workstation-empty p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Pull to refresh */
.pull-to-refresh {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-100%);
    transition: transform 0.2s;
    z-index: 9999;
    background: var(--bg-secondary);
}
.pull-to-refresh.visible {
    transform: translateY(env(safe-area-inset-top, 47px));
}
.pull-to-refresh i {
    font-size: 24px;
    color: var(--primary);
}

/* ============================================
   TINT LAW WAIVER MODAL
   (from includes/waiver-modal.php)
   ============================================ */
.waiver-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.waiver-modal-content {
    background: #1a1a2e;
    border-radius: 15px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.1);
}
.waiver-modal-header {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.waiver-modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: #ef476f;
}
.waiver-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.7;
}
.waiver-close-btn:hover { opacity: 1; }
.waiver-modal-body {
    padding: 15px;
}
.waiver-vehicle-info {
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 12px;
    text-align: center;
}
.waiver-vehicle-info .vehicle-name {
    font-size: 1rem;
    font-weight: 600;
}
.waiver-vehicle-info .shade-info {
    color: #ef476f;
    font-weight: 600;
    font-size: 0.9rem;
}
.waiver-legal-text {
    background: rgba(239, 71, 111, 0.1);
    border-left: 3px solid #ef476f;
    padding: 10px;
    margin-bottom: 12px;
    border-radius: 0 8px 8px 0;
    font-size: 0.85rem;
    line-height: 1.4;
}
.waiver-acknowledgments {
    margin-bottom: 12px;
}
.waiver-acknowledgments label {
    display: block;
    padding: 10px 12px 10px 40px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1.4;
    position: relative;
}
.waiver-acknowledgments input[type="checkbox"] {
    position: absolute;
    left: 10px;
    top: 10px;
    width: 22px;
    height: 22px;
    accent-color: #06d6a0;
}
.waiver-signature-section {
    margin-bottom: 10px;
}
.waiver-signature-section label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
}
#waiver-signature-canvas {
    width: 100%;
    height: 80px;
    background: #fff;
    border-radius: 8px;
    cursor: crosshair;
    touch-action: none;
}
.btn-clear-sig {
    margin-top: 5px;
    padding: 5px 12px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    font-size: 0.8rem;
}
.btn-clear-sig:hover { background: rgba(255,255,255,0.2); }
.waiver-name-section {
    margin-bottom: 10px;
}
.waiver-name-section label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
}
.waiver-name-section input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 0.95rem;
}
.waiver-name-section input:focus {
    outline: none;
    border-color: #4361ee;
}
.waiver-error {
    background: rgba(239, 71, 111, 0.2);
    border: 1px solid #ef476f;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    color: #ef476f;
    font-size: 0.85rem;
}
.waiver-modal-footer {
    padding: 12px 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    gap: 10px;
}
.waiver-modal-footer .btn-cancel {
    flex: 1;
    padding: 12px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
}
.waiver-modal-footer .btn-cancel:hover {
    background: rgba(255,255,255,0.2);
}
.waiver-modal-footer .btn-submit {
    flex: 2;
    padding: 12px;
    background: #06d6a0;
    border: none;
    border-radius: 8px;
    color: #000;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}
.waiver-modal-footer .btn-submit:disabled {
    background: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.5);
    cursor: not-allowed;
}
.waiver-modal-footer .btn-submit:not(:disabled):hover {
    background: #05c492;
}

/* ============================================
   FILM REMOVAL WAIVER MODAL
   (from includes/film-removal-waiver-modal.php)
   ============================================ */
.service-waiver-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.service-waiver-modal-content {
    background: #1a1a2e;
    border-radius: 15px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.1);
}
.service-waiver-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: #1a1a2e;
    z-index: 10;
}
.service-waiver-modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #f68e1e;
}
.service-waiver-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.7;
}
.service-waiver-close-btn:hover { opacity: 1; }
.service-waiver-modal-body {
    padding: 20px;
}
.service-waiver-section {
    margin-bottom: 20px;
}
.service-waiver-section h3 {
    color: #f68e1e;
    font-size: 1rem;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(246, 142, 30, 0.3);
    padding-bottom: 5px;
}
.service-waiver-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.service-waiver-info-item {
    background: rgba(255,255,255,0.05);
    padding: 8px 12px;
    border-radius: 6px;
}
.service-waiver-info-item label {
    display: block;
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 2px;
}
.service-waiver-info-item span {
    font-size: 0.95rem;
    color: #fff;
}
.service-waiver-legal-text {
    background: rgba(246, 142, 30, 0.1);
    border-left: 3px solid #f68e1e;
    padding: 12px 15px;
    margin-bottom: 15px;
    border-radius: 0 8px 8px 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #ccc;
}
.service-waiver-acknowledgments {
    margin-bottom: 15px;
}
.service-waiver-acknowledgments label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 15px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}
.service-waiver-acknowledgments label:hover {
    background: rgba(255,255,255,0.08);
}
.service-waiver-acknowledgments input[type="checkbox"] {
    width: 22px;
    height: 22px;
    min-width: 22px;
    accent-color: #06d6a0;
    margin-top: 2px;
}
.service-waiver-acknowledgments .ack-text {
    flex: 1;
}
.service-waiver-acknowledgments .ack-text strong {
    color: #f68e1e;
}
.service-waiver-signature-section {
    margin-bottom: 15px;
}
.service-waiver-signature-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.95rem;
}
#service-waiver-signature-canvas {
    width: 100%;
    height: 100px;
    background: #fff;
    border-radius: 8px;
    cursor: crosshair;
    touch-action: none;
}
.btn-clear-service-sig {
    margin-top: 8px;
    padding: 6px 15px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    font-size: 0.85rem;
}
.btn-clear-service-sig:hover { background: rgba(255,255,255,0.2); }
.service-waiver-name-section {
    margin-bottom: 15px;
}
.service-waiver-name-section label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.95rem;
}
.service-waiver-name-section input {
    width: 100%;
    padding: 12px 15px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
}
.service-waiver-name-section input:focus {
    outline: none;
    border-color: #f68e1e;
}
.service-waiver-error {
    background: rgba(239, 71, 111, 0.2);
    border: 1px solid #ef476f;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    color: #ef476f;
    font-size: 0.9rem;
}
.service-waiver-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    gap: 12px;
    position: sticky;
    bottom: 0;
    background: #1a1a2e;
}
.service-waiver-modal-footer .btn-cancel {
    flex: 1;
    padding: 14px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}
.service-waiver-modal-footer .btn-cancel:hover {
    background: rgba(255,255,255,0.2);
}
.service-waiver-modal-footer .btn-submit {
    flex: 2;
    padding: 14px;
    background: #06d6a0;
    border: none;
    border-radius: 8px;
    color: #000;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}
.service-waiver-modal-footer .btn-submit:disabled {
    background: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.5);
    cursor: not-allowed;
}
.service-waiver-modal-footer .btn-submit:not(:disabled):hover {
    background: #05c492;
}
.service-waiver-preexisting {
    margin-top: 10px;
}
.service-waiver-preexisting textarea {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 60px;
}
.service-waiver-preexisting textarea:focus {
    outline: none;
    border-color: #f68e1e;
}

/* ============================================
   SMS NOTIFICATION SYSTEM
   ============================================ */

/* Bell badge */
.sms-badge {
    position: absolute;
    top: 2px; right: 2px;
    background: var(--danger, #ef4444);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    padding: 0 4px;
}

/* Messages Drawer (slides in from right) */
.sms-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 10049;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.sms-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}
.sms-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 440px;
    max-width: 100vw;
    background: var(--bg-card, #161616);
    border-left: 1px solid var(--border-color, #2a2a2a);
    box-shadow: -8px 0 32px rgba(0,0,0,0.5);
    z-index: 10050;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.sms-panel:not(.d-none) {
    transform: translateX(0);
}
.sms-panel-header {
    padding: 14px 18px;
    /* viewport-fit=cover lets the panel sit under the iOS status bar / Dynamic
       Island; inset the top so the close (X) + actions clear the iPhone UI. */
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
    border-bottom: 1px solid var(--border-color, #2a2a2a);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    font-weight: 600;
    flex-shrink: 0;
}
.sms-panel-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}
.sms-panel-actions .btn-link {
    padding: 4px 8px;
    color: var(--text-muted, #888);
    font-size: 1rem;
    line-height: 1;
}
.sms-panel-actions .btn-link:hover {
    color: var(--text-primary, #e0e0e0);
}
.sms-search {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color, #2a2a2a);
    flex-shrink: 0;
}
.sms-search .form-control {
    background: var(--bg-primary, #0a0a0a);
    border-color: var(--border-color, #2a2a2a);
    color: var(--text-primary, #e0e0e0);
    font-size: 0.85rem;
}
.sms-tabs {
    display: flex;
    gap: 2px;
    padding: 0 14px 8px;
    border-bottom: 1px solid var(--border-color, #2a2a2a);
    flex-shrink: 0;
}
.sms-tab {
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: var(--text-muted, #888);
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
}
.sms-tab:hover {
    color: var(--text-primary, #e0e0e0);
    background: var(--bg-hover, #222);
}
.sms-tab.active {
    color: var(--accent, #f68e1e);
    background: rgba(246, 142, 30, 0.1);
    font-weight: 600;
}

/* Conversation list */
.sms-conv-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
.sms-conv-item.has-unread {
    background: rgba(246, 142, 30, 0.04);
}
.sms-conv-item.has-unread .sms-conv-header strong {
    color: var(--accent, #f68e1e);
}
.sms-conv-direction-icon {
    font-size: 0.7rem;
    color: var(--text-muted, #666);
    margin-right: 4px;
}
.sms-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted, #666);
}
.sms-conv-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #2a2a2a);
    cursor: pointer;
    position: relative;
    transition: background var(--transition-fast, 0.15s);
}
.sms-conv-item:hover {
    background: var(--bg-hover, #222);
}
.sms-conv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.sms-conv-time {
    font-size: 0.7rem;
    color: var(--text-muted, #666);
}
.sms-conv-preview {
    font-size: 0.8rem;
    color: var(--text-secondary, #a0a0a0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sms-conv-badge {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 0.65rem;
}

/* Thread view — fills the drawer when a conversation is open */
.sms-thread {
    flex: 1;
    flex-direction: column;
    min-height: 0;
}
.sms-thread-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #2a2a2a);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.sms-thread-load-older {
    padding: 8px;
    text-align: center;
    border-bottom: 1px solid var(--border-color, #2a2a2a);
    flex-shrink: 0;
}
.sms-thread-load-older .btn-link {
    color: var(--text-muted, #888);
    font-size: 0.75rem;
}
.sms-thread-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}
.sms-thread-input {
    padding: 10px 12px;
    border-top: 1px solid var(--border-color, #2a2a2a);
    background: var(--bg-elevated, #1c1c1c);
    flex-shrink: 0;
}
.sms-thread-input .form-control {
    background: var(--bg-primary, #0a0a0a);
    border-color: var(--border-color, #2a2a2a);
    color: var(--text-primary, #e0e0e0);
}

/* Chat bubbles */
.sms-bubble {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.4;
}
.sms-bubble-in {
    align-self: flex-start;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-bottom-left-radius: 4px;
}
.sms-bubble-out {
    align-self: flex-end;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-bottom-right-radius: 4px;
}
.sms-bubble-time {
    font-size: 0.65rem;
    color: var(--text-muted, #666);
    margin-top: 4px;
}
.sms-bubble-out .sms-bubble-time { text-align: right; }

/* Toast notifications */
.sms-toast-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 10060;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.sms-toast {
    pointer-events: auto;
    width: 320px;
    background: var(--bg-elevated, #1c1c1c);
    border: 1px solid var(--info, #3b82f6);
    border-radius: var(--radius-md, 12px);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
    cursor: pointer;
    transition: opacity 0.3s, transform 0.3s;
    animation: smsToastIn 0.3s ease;
}
.sms-toast-header {
    padding: 10px 14px 4px;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--info, #3b82f6);
}
.sms-toast-body {
    padding: 4px 14px 10px;
    font-size: 0.8rem;
    color: var(--text-secondary, #a0a0a0);
}
@keyframes smsToastIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 768px) {
    .sms-panel { width: 100vw; }
    .sms-toast-container { right: 10px; }
    .sms-toast { width: calc(100vw - 20px); }
}

/* ============================================
   MOBILE REMEDIATION  (2026-06-24)
   Phones ≤575.98px. The app sets overflow-x:hidden + max-width:100vw on
   html/body/.crm-wrapper/.crm-main, so ANYTHING wider than the viewport is
   clipped with no horizontal scroll — off-screen controls become unreachable.
   These rules stop rows / grids / modals / menus from overflowing in the
   first place, and restore comfortable tap targets.
   ============================================ */
@media (max-width: 575.98px) {
    /* Reusable: turn a horizontal action-button row into a full-width column.
       Apply `.mobile-stack` to any button row that overflows on a phone. */
    .mobile-stack { flex-direction: column !important; align-items: stretch !important; }
    .mobile-stack > .btn,
    .mobile-stack > button,
    .mobile-stack > a { width: 100% !important; }

    /* Bootstrap modals: never wider than the viewport, so the dialog AND its
       close button always stay on-screen. Body scrolls if content is tall. */
    .modal-dialog { max-width: calc(100vw - 16px) !important; margin: 8px auto !important; }
    .modal-body { max-height: calc(100vh - 160px); overflow-y: auto; }

    /* Dropdown menus: clamp to the viewport so they never open off the edge. */
    .dropdown-menu { max-width: calc(100vw - 16px); }
    .dropdown-menu-end { right: 0 !important; }

    /* Comfortable tap targets for small buttons (WCAG ~40px min). */
    .btn-sm { min-height: 40px; }

    /* Bootstrap close button: larger hit area + visible on the dark theme. */
    .btn-close { padding: 0.6rem; background-size: 0.85rem; }
}
