/* ============================================
   KIOSK TECH SUPPORT PWA - STYLES
   Dark Futuristic Theme with Glassmorphism
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --bg-body: #0a0b10;
    --bg-surface: #13151b;
    --bg-card: #1a1d25;
    --bg-header: #16181f;
    --bg-input: #1a1c22;
    --text-primary: #e8e8e8;
    --text-secondary: #8a8f98;
    --text-muted: #5a5f68;
    --accent: #00d4ff;
    --accent-glow: rgba(0, 212, 255, 0.2);
    --accent-dim: rgba(0, 212, 255, 0.08);
    --accent-solid: #00b8db;
    --success: #00e676;
    --success-dim: rgba(0, 230, 118, 0.15);
    --warning: #ffb800;
    --warning-dim: rgba(255, 184, 0, 0.15);
    --danger: #ff5252;
    --danger-dim: rgba(255, 82, 82, 0.15);
    --border: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(22, 24, 30, 0.8);
    --glass-border: rgba(255, 255, 255, 0.08);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 50px;
    --spacing: 16px;
    --spacing-sm: 8px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Roboto Mono', 'Courier New', monospace;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --- App Container --- */
.app-container {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-surface);
    position: relative;
    overflow: hidden;
}

@media (min-width: 481px) {
    .app-container {
        height: 92vh;
        border-radius: var(--radius-lg);
        box-shadow: 0 0 60px rgba(0, 212, 255, 0.06), var(--shadow);
    }
}

/* --- Screen Container --- */
#screen-container {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

#screen-container::-webkit-scrollbar {
    width: 3px;
}

#screen-container::-webkit-scrollbar-track {
    background: transparent;
}

#screen-container::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

.screen {
    display: none;
    flex-direction: column;
    min-height: 100%;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* --- Glassmorphism --- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
}

/* --- Screen Header --- */
.screen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing);
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.screen-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.screen-header .subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* --- Typography --- */
h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.gradient-text {
    background: linear-gradient(135deg, #ffffff 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Buttons --- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-solid) 100%);
    color: #000;
    border: none;
    padding: 14px 24px;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    min-height: 48px;
    min-width: 44px;
    width: 100%;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.25);
    letter-spacing: 0.01em;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #7eefff 0%, var(--accent) 100%);
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.42);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 12px rgba(0, 212, 255, 0.2);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary:disabled:hover {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-solid) 100%);
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
    transition: var(--transition);
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.btn-secondary:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--accent-dim);
    color: var(--accent);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-icon:hover {
    background: var(--accent-glow);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

/* --- Form Inputs --- */
input, textarea {
    font-family: var(--font-body);
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted);
}

input:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

/* --- Bottom Navigation --- */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
    flex-shrink: 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px 12px;
    min-width: 56px;
    min-height: 48px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-family: var(--font-body);
    position: relative;
}

.nav-item span {
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.nav-item .nav-icon {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
}

.nav-item.active {
    color: var(--accent);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    background: var(--accent);
    border-radius: 0 0 2px 2px;
}

.nav-item:hover {
    color: var(--text-secondary);
}

/* ============================================
   LOGIN SCREEN
   ============================================ */
#login-screen {
    justify-content: center;
    align-items: center;
    padding: var(--spacing-lg);
    text-align: center;
    min-height: 100%;
    position: relative;
}

.login-card {
    width: 100%;
    padding: var(--spacing-xl) var(--spacing-lg);
}

.app-version {
    position: absolute;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0;
    white-space: nowrap;
}

.screen-version {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0;
}

.login-logo {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: var(--spacing-xl);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.login-step {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing);
    animation: fadeIn 0.3s ease;
}

.login-step.active {
    display: flex;
}

.login-step p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.phone-input-wrap {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 48px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
}

.phone-input-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.phone-country-code {
    width: 64px;
    flex: 0 0 64px;
    min-height: 48px;
    border: 0;
    border-right: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    color: var(--text-secondary);
    text-align: center;
    font-family: var(--font-mono);
    font-weight: 700;
    cursor: default;
    box-shadow: none;
}

.phone-country-code:focus {
    border-color: transparent;
    box-shadow: none;
}

.phone-local-input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 48px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0 14px;
    box-shadow: none;
}

.phone-local-input:focus {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

@media (max-width: 380px) {
    #login-screen {
        padding-inline: var(--spacing);
    }

    .login-card {
        padding-inline: var(--spacing);
    }

    .phone-country-code {
        width: 56px;
        flex-basis: 56px;
    }

    .phone-country-code,
    .phone-local-input {
        font-size: 0.9rem;
    }

    .phone-local-input {
        padding-inline: 12px;
    }
}

.otp-input-group {
    display: flex;
    gap: 8px;
    justify-content: center;
    width: 100%;
}

.otp-input-group input {
    width: 44px;
    height: 52px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 600;
    padding: 0;
    border-radius: var(--radius-sm);
    caret-color: var(--accent);
}

.otp-input-group input:focus {
    border-color: var(--accent);
    background: rgba(0, 212, 255, 0.05);
}

.otp-input-group input.filled {
    border-color: var(--accent);
    color: var(--accent);
}

.otp-timer {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.otp-timer strong {
    color: var(--accent);
    font-family: var(--font-mono);
}

.resend-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 8px;
    min-height: 44px;
    transition: var(--transition);
}

.resend-btn:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}

.auth-link-btn {
    border: none;
    background: transparent;
    color: var(--accent);
    font-family: var(--font-body);
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    min-height: 44px;
    padding: 8px 12px;
}

.auth-link-btn:hover {
    color: var(--text-primary);
}

.registration-grid {
    display: grid;
    gap: 10px;
    width: 100%;
}

.registration-grid input {
    min-height: 44px;
}

.registration-grid input[readonly] {
    background: rgba(0, 212, 255, 0.075);
    border-color: rgba(0, 212, 255, 0.32);
    color: var(--text-primary);
    cursor: not-allowed;
    opacity: 0.9;
    box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.1);
}

.registration-grid input[readonly]:focus {
    border-color: rgba(0, 212, 255, 0.32);
    box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.1);
}

/* ============================================
   SECURE ACCESS SCREEN
   ============================================ */
#secure-access-screen {
    padding: 0;
}

.credential-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-full);
    padding: 3px;
    margin: var(--spacing) var(--spacing) 0;
    border: 1px solid var(--border);
}

.toggle-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.toggle-btn.active {
    background: var(--accent);
    color: #000;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.toggle-btn svg {
    width: 16px;
    height: 16px;
}

.credential-body {
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
    flex: 1;
}

.credential-card {
    width: 100%;
    padding: var(--spacing-lg);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.technician-name-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 42%;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.technician-name-badge svg {
    flex: 0 0 auto;
}

.pin-display-container {
    position: relative;
    margin: var(--spacing) 0;
}

.pin-display {
    font-family: var(--font-mono);
    font-size: 3rem;
    font-weight: 600;
    letter-spacing: 12px;
    color: var(--accent);
    padding: var(--spacing-lg) var(--spacing);
    background: rgba(0, 0, 0, 0.4);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
    user-select: none;
}

.pin-blur-overlay {
    position: absolute;
    inset: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(10, 11, 16, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    z-index: 2;
    border-radius: var(--radius-md);
    transition: opacity 0.3s ease;
}

.pin-blur-overlay svg {
    width: 28px;
    height: 28px;
    color: var(--text-secondary);
}

.pin-blur-overlay span {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.pin-blur-overlay.revealed {
    opacity: 0;
    pointer-events: none;
}

/* QR Scanner */
.qr-scanner-area {
    width: 100%;
    aspect-ratio: 1;
    max-width: 280px;
    margin: var(--spacing) auto;
    background: #000;
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-scanner-area video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.qr-scanner-area.camera-active video {
    display: block;
}

.qr-scanner-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: none;
}

.qr-scanner-area.camera-active .qr-scanner-overlay {
    display: flex;
}

.qr-scanner-frame {
    width: 65%;
    aspect-ratio: 1;
    position: relative;
}

.scanner-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: var(--accent);
    border-style: solid;
    border-width: 0;
}

.scanner-corner.tl { top: 0; left: 0; border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 4px; }
.scanner-corner.tr { top: 0; right: 0; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 4px; }
.scanner-corner.bl { bottom: 0; left: 0; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 4px; }
.scanner-corner.br { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 4px; }

.scan-line {
    position: absolute;
    left: 17.5%;
    width: 65%;
    height: 2px;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    animation: scanMove 2s ease-in-out infinite;
}

@keyframes scanMove {
    0%, 100% { top: 20%; }
    50% { top: 75%; }
}

.qr-scanner-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 20px;
    text-align: center;
    position: absolute;
    inset: 0;
    z-index: 3;
}

.qr-scanner-area.camera-active .qr-scanner-placeholder {
    display: none;
}

.qr-scanner-placeholder span {
    font-size: 0.85rem;
    font-weight: 500;
}

.qr-scan-status {
    margin-top: var(--spacing);
    min-height: 24px;
}

.scan-detecting, .scan-detected, .scan-invalid {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    justify-content: center;
}

.scan-detecting {
    color: var(--text-secondary);
}

.scan-detected {
    color: var(--success);
    font-weight: 500;
}

.scan-invalid {
    color: var(--danger);
    font-weight: 500;
}

.scan-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.credential-timer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.timer-ring {
    width: 56px;
    height: 56px;
    position: relative;
}

.timer-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-ring .ring-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 3;
}

.timer-ring .ring-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}

.timer-ring .timer-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
}

.timer-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.credential-view {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.credential-view.active {
    display: flex;
}

/* ============================================
   DASHBOARD SCREEN
   ============================================ */
#dashboard-screen {
    padding: 0;
}

.dashboard-body {
    padding: var(--spacing);
    display: flex;
    flex-direction: column;
    gap: var(--spacing);
}

.status-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.status-tabs::-webkit-scrollbar {
    display: none;
}

.status-tab {
    padding: 8px 18px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
    min-height: 36px;
}

.status-tab.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 600;
}

.status-tab:hover:not(.active) {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.log-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.log-card {
    padding: var(--spacing);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent);
    transition: var(--transition);
    animation: slideUp 0.3s ease;
}

.log-card.status-completed {
    border-left-color: var(--success);
}

.log-card.status-active {
    border-left-color: var(--accent);
}

.log-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.log-card-id {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.active {
    background: var(--accent-dim);
    color: var(--accent);
}

.status-badge.completed {
    background: var(--success-dim);
    color: var(--success);
}

.log-card-body {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.log-card-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    gap: var(--spacing);
    text-align: center;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    opacity: 0.5;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, rgba(255,255,255,0.04) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton-card {
    height: 80px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
}

/* ============================================
   CHAT SCREEN
   ============================================ */
#chat-screen {
    position: relative;
    padding: 0;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--spacing);
    display: flex;
    flex-direction: column;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
}

.chat-messages::-webkit-scrollbar {
    width: 2px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 2px;
}

.chat-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.history-btn,
.history-close-btn {
    width: 40px;
    height: 40px;
}

.chat-history-panel {
    position: absolute;
    inset: 73px 0 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
}

.chat-history-panel[hidden] {
    display: none;
}

.chat-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px var(--spacing);
    border-bottom: 1px solid var(--border);
}

.chat-history-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px var(--spacing) var(--spacing);
}

.chat-history-state {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 32px 16px;
    color: var(--text-secondary);
    text-align: center;
}

.chat-history-state strong {
    color: var(--text-primary);
}

.chat-history-item {
    width: 100%;
    display: grid;
    gap: 4px;
    padding: 12px 0;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
}

.chat-history-item:hover,
.chat-history-item:focus-visible {
    color: var(--accent);
}

.chat-history-item-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.chat-history-item-top strong {
    font-size: 0.92rem;
}

.chat-history-item-top time,
.chat-history-location {
    color: var(--text-muted);
    font-size: 0.74rem;
}

.chat-history-issue {
    color: var(--text-secondary);
    font-size: 0.84rem;
    overflow-wrap: anywhere;
}

.chat-history-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

.chat-history-banner div {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.chat-history-banner strong,
.chat-history-banner span {
    overflow-wrap: anywhere;
}

.chat-history-banner span {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.return-live-btn {
    width: auto;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.chat-bubble {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.45;
    animation: popIn 0.2s ease;
    position: relative;
}

.assignment-card {
    align-self: stretch;
    padding: 18px 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    display: grid;
    justify-items: center;
    gap: 8px;
    text-align: center;
    animation: slideUp 0.25s ease;
}

.assignment-card strong {
    font-size: 0.96rem;
}

.assignment-card span {
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.4;
}

.assignment-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes popIn {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.chat-bubble.incoming {
    background: var(--accent);
    color: #000;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.typing-indicator {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 82%;
    padding: 9px 12px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid rgba(0, 212, 255, 0.18);
    font-size: 0.82rem;
    font-weight: 700;
}

.typing-dots {
    display: inline-flex;
    gap: 3px;
}

.typing-dots i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    animation: typingDot 1s ease-in-out infinite;
}

.typing-dots i:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-dots i:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typingDot {
    0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

.chat-bubble.outgoing {
    background: var(--bg-card);
    color: var(--text-primary);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    border: 1px solid var(--border);
}

.chat-bubble .bubble-time {
    font-size: 0.65rem;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    width: 100%;
}

.delivery-ticks {
    display: inline-flex;
    align-items: center;
    gap: 0;
    color: var(--text-muted);
    font-weight: 800;
    letter-spacing: -3px;
    line-height: 1;
}

.delivery-ticks.read {
    color: var(--accent);
}

.chat-bubble .bubble-file {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.chat-bubble .bubble-file svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.chat-bubble .bubble-image {
    width: 100%;
    max-width: 220px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    display: block;
}

.chat-bubble .bubble-video {
    background: #000;
}

.upload-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 4px 8px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
}

.upload-status.pending {
    background: var(--warning-dim);
    color: var(--warning);
}

.upload-status.sent {
    background: var(--success-dim);
    color: var(--success);
}

.upload-status.failed {
    background: var(--danger-dim);
    color: var(--danger);
}

.upload-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.retry-upload-btn {
    border: none;
    border-radius: var(--radius-full);
    background: var(--danger);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    min-height: 28px;
    padding: 4px 10px;
}

.retry-upload-btn:hover {
    filter: brightness(1.08);
}

.file-preview-thumb {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.chat-input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: var(--spacing-sm) var(--spacing);
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
}

.attach-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--accent-dim);
    color: var(--accent);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    position: relative;
}

.attach-btn:hover {
    background: var(--accent-glow);
}

.attach-btn svg {
    width: 20px;
    height: 20px;
}

.camera-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--accent-dim);
    color: var(--accent);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.camera-btn:hover {
    background: var(--accent-glow);
}

.attach-btn:disabled,
.camera-btn:disabled,
.send-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    box-shadow: none;
}

.camera-btn svg {
    width: 20px;
    height: 20px;
}

.chat-text-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 0.9rem;
    min-height: 44px;
    outline: none;
    transition: var(--transition);
}

.chat-text-input::placeholder {
    color: var(--text-muted);
}

.chat-text-input:focus {
    border-color: var(--accent);
}

.send-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #000;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.send-btn:hover {
    box-shadow: 0 0 16px rgba(0, 212, 255, 0.3);
}

.send-btn svg {
    width: 18px;
    height: 18px;
}

.file-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px var(--spacing);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-secondary);
    animation: slideUp 0.2s ease;
}

.file-preview .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-preview .remove-file {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 4px;
    font-size: 1.1rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-status .live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

.chat-status.assigning .live-dot {
    background: var(--warning);
}

.chat-status.assigning span {
    color: var(--warning);
}

.chat-status.history .live-dot {
    background: var(--text-muted);
    animation: none;
}

.chat-status.history span {
    color: var(--text-muted);
}

.chat-status span {
    font-size: 0.8rem;
    color: var(--success);
    font-weight: 500;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 440px;
    width: calc(100% - 32px);
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    pointer-events: auto;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    box-shadow: var(--shadow);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-10px); }
}

.toast.success {
    background: var(--success);
    color: #000;
}

.toast.error {
    background: var(--danger);
    color: #fff;
}

.toast.info {
    background: var(--accent);
    color: #000;
}

/* ============================================
   OFFLINE BANNER
   ============================================ */
.offline-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px;
    background: var(--warning-dim);
    color: var(--warning);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   REQUIRED PWA UPDATE
   ============================================ */
.pwa-update-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    background: rgba(10, 11, 16, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.pwa-update-dialog {
    width: min(100%, 360px);
    display: grid;
    gap: var(--spacing);
    padding: var(--spacing-lg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    box-shadow: var(--shadow);
    text-align: center;
}

.pwa-update-dialog h2 {
    font-size: 1.2rem;
}

.pwa-update-dialog p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ============================================
   CONFIRMATION DIALOG
   ============================================ */
.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(10, 11, 16, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.confirm-dialog {
    width: min(100%, 360px);
    padding: 22px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    box-shadow: var(--shadow);
}

.confirm-dialog h2 {
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.confirm-dialog p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.45;
    margin-bottom: 18px;
}

.confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.confirm-actions .btn-primary,
.confirm-actions .btn-secondary {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
}

/* ============================================
   UTILITIES
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
