/* ========================================
   TLCNA Tech Support PWA — Dark Theme
   Mobile-first, Emerald Green accent
   ======================================== */

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-card-hover: #263244;
    --bg-input: #0f172a;
    --bg-modal: #1e293b;
    --border: #334155;
    --border-light: #475569;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent: #10B981;
    --accent-hover: #059669;
    --accent-glow: rgba(16, 185, 129, 0.15);
    --accent-glow-strong: rgba(16, 185, 129, 0.3);

    --emergency: #ef4444;
    --emergency-bg: rgba(239, 68, 68, 0.12);
    --priority: #f59e0b;
    --priority-bg: rgba(245, 158, 11, 0.12);
    --normal: #3b82f6;
    --normal-bg: rgba(59, 130, 246, 0.12);

    --status-open: #3b82f6;
    --status-progress: #f59e0b;
    --status-complete: #10B981;
    --status-archived: #64748b;

    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);

    --topbar-height: 56px;
    --sidebar-width: 280px;

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ==========================================
   LOGIN
   ========================================== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-primary);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 40px 32px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    text-align: center;
}

.login-logo {
    margin-bottom: 16px;
}

.login-card h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 28px;
}

.form-group {
    text-align: left;
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-full { width: 100%; }

.login-error {
    color: var(--emergency);
    font-size: 13px;
    margin-top: 16px;
}

/* ==========================================
   APP SHELL
   ========================================== */
.app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: var(--safe-top);
}

/* ---- TOPBAR ---- */
.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 8px;
    flex-shrink: 0;
}

.topbar-menu-btn, .topbar-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
    position: relative;
}

.topbar-menu-btn:hover, .topbar-btn:hover {
    color: var(--text-primary);
    background: var(--accent-glow);
}

.topbar-title {
    flex: 1;
    font-size: 18px;
    font-weight: 700;
    margin-left: 4px;
}

.topbar-unsnooze-all {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--accent);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-weight: 600;
    margin-right: 8px;
    transition: background 0.15s, transform 0.1s;
}

.topbar-unsnooze-all:hover {
    background: var(--accent-hover);
}

.topbar-unsnooze-all:active {
    transform: scale(0.97);
}

.topbar-unsnooze-all svg {
    flex-shrink: 0;
}

.topbar-actions {
    display: flex;
    gap: 4px;
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--emergency);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ---- SEARCH BAR ---- */
.search-bar {
    background: var(--bg-secondary);
    padding: 0 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.search-input-wrap {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    gap: 8px;
    transition: border-color 0.2s;
}

.search-input-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-input-wrap svg { color: var(--text-muted); flex-shrink: 0; }

.search-input-wrap input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 10px 0;
    font-size: 14px;
    outline: none;
}

.search-input-wrap input::placeholder { color: var(--text-muted); }

.search-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    padding: 4px;
    line-height: 1;
}

.search-filters {
    display: flex;
    gap: 8px;
}

.search-filters select {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    padding: 8px 10px;
    font-size: 13px;
    outline: none;
    appearance: auto;
}

.search-filters select:focus {
    border-color: var(--accent);
}

/* ---- SIDEBAR ---- */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar.open { transform: translateX(0); }

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 16px;
}

.sidebar-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    padding: 4px 8px;
}

.sidebar-nav {
    padding: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    text-align: left;
}

.nav-item:hover { background: var(--accent-glow); color: var(--text-primary); }
.nav-item.active { background: var(--accent-glow-strong); color: var(--accent); }

.nav-badge {
    margin-left: auto;
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 16px;
}

.sidebar-section {
    padding: 12px 16px;
}

.sidebar-section h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.stat-card {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.stat-val {
    display: block;
    font-size: 22px;
    font-weight: 700;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-emergency { background: var(--emergency-bg); }
.stat-emergency .stat-val { color: var(--emergency); }
.stat-open { background: var(--normal-bg); }
.stat-open .stat-val { color: var(--status-open); }
.stat-progress { background: var(--priority-bg); }
.stat-progress .stat-val { color: var(--status-progress); }
.stat-complete { background: var(--accent-glow); }
.stat-complete .stat-val { color: var(--accent); }

.stat-card {
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s;
}

.stat-card:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.stat-card:active {
    transform: scale(0.97);
}

.stat-card.stat-active {
    outline: 2px solid currentColor;
    outline-offset: -2px;
    border-radius: var(--radius-sm);
}

/* Push toggle */
.push-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input { display: none; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}

.sidebar-user { color: var(--text-secondary); }

.sidebar-logout {
    color: var(--emergency);
    font-weight: 500;
    font-size: 13px;
}

/* ==========================================
   MAIN CONTENT
   ========================================== */
.main-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(20px + var(--safe-bottom));
}

/* ---- TICKET LIST ---- */
.ticket-list {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 14px;
    gap: 16px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- TICKET CARD ---- */
.ticket-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    position: relative;
    overflow: hidden;
}

.ticket-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.ticket-card:active { transform: scale(0.99); }

.ticket-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.ticket-card.urgency-Emergency::before { background: var(--emergency); }
.ticket-card.urgency-Priority::before { background: var(--priority); }
.ticket-card.urgency-Normal::before { background: var(--normal); }

.ticket-card.status-Complete { opacity: 0.7; }

.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    gap: 8px;
}

.card-id {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
}

.card-badges {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 4px;
}

.badge-status {
    color: #fff;
}

.badge-status-Open { background: var(--status-open); }
.badge-status-In-Progress { background: var(--status-progress); }
.badge-status-Complete { background: var(--status-complete); }

.badge-urgency {
    border: 1px solid;
}

.badge-urgency-Emergency { color: var(--emergency); border-color: var(--emergency); background: var(--emergency-bg); }
.badge-urgency-Priority { color: var(--priority); border-color: var(--priority); background: var(--priority-bg); }
.badge-urgency-Normal { color: var(--normal); border-color: var(--normal); background: var(--normal-bg); }

.badge-assigned {
    background: linear-gradient(135deg, #8B5CF6, #6D28D9);
    color: #fff;
    border: 1px solid rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.35);
    font-weight: 600;
}

.card-desc {
    font-size: 14px;
    line-height: 1.45;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.card-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-meta-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.card-email-link {
    color: var(--accent);
    cursor: pointer;
    transition: color 0.15s;
}

.card-email-link:hover { color: var(--accent-hover); text-decoration: underline; }

.card-note-count {
    margin-left: auto;
    color: var(--text-muted);
}

/* ---- Desktop snooze button on card ---- */
.snooze-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, border-color 0.15s, background 0.15s;
    padding: 0;
}

.ticket-card:hover .snooze-btn { opacity: 1; }
.snooze-btn:hover {
    color: var(--priority);
    border-color: var(--priority);
    background: var(--priority-bg);
}

/* Snooze time badge */
.badge-snooze {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    color: var(--priority);
    border: 1px solid var(--priority);
    background: var(--priority-bg);
}

.badge-snooze svg {
    width: 12px;
    height: 12px;
}

/* Unsnooze button */
.unsnooze-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--priority-bg);
    border: 1px solid var(--priority);
    color: var(--priority);
    padding: 5px 12px;
    border-radius: var(--radius-xs);
    font-size: 11px;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
}

.unsnooze-btn:hover {
    background: var(--priority);
    color: #fff;
}

/* ---- Swipe container (mobile) ---- */
.swipe-container {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
}

.swipe-actions {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    pointer-events: none;
}

.swipe-action-left,
.swipe-action-right {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0;
    transition: opacity 0.15s;
}

.swipe-action-left {
    right: 0;
    background: var(--priority);
    color: #fff;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.swipe-action-right {
    left: 0;
    background: var(--status-archived);
    color: #fff;
    border-radius: var(--radius) 0 0 var(--radius);
}

.swipe-action-left svg,
.swipe-action-right svg {
    width: 24px;
    height: 24px;
}

.swipe-action-left.visible,
.swipe-action-right.visible {
    opacity: 1;
}

/* Snoozed view: left swipe = unsnooze (green) */
.swipe-container[data-view="snoozed"] .swipe-action-left {
    background: var(--accent);
}

/* On mobile, the card itself is the swipe surface */
.swipe-container .ticket-card {
    position: relative;
    z-index: 2;
    will-change: transform;
    transition: none;
}

.swipe-container .ticket-card.snapping {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hide the hover snooze button on touch devices, use swipe instead */
@media (hover: none), (pointer: coarse) {
    .snooze-btn { display: none; }
}

/* On desktop, hide swipe actions */
@media (hover: hover) and (pointer: fine) {
    .swipe-actions { display: none; }
}

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 16px;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 13px;
}

/* ==========================================
   MODAL (Bottom Sheet on mobile)
   ========================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 300;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-sheet {
    width: 100%;
    max-height: 92vh;
    background: var(--bg-modal);
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.modal-handle {
    width: 36px;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    margin: 10px auto 0;
    flex-shrink: 0;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 12px;
    flex-shrink: 0;
}

.modal-nav-btn {
    background: var(--primary, #10B981);
    border: none;
    border-radius: 8px;
    color: #fff;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
}

.modal-nav-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.modal-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.modal-header h2 {
    font-size: 17px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    padding: 4px 8px;
    line-height: 1;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
    transition: opacity 0.15s ease;
}

.modal-body.loading {
    opacity: 0.4;
    pointer-events: none;
}

/* Sticky note input footer */
.modal-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    padding: 12px 16px;
    padding-bottom: calc(12px + var(--safe-bottom));
}

.modal-footer .add-note-form {
    margin-top: 0;
}

/* Modal ticket details */
.detail-section {
    margin-bottom: 20px;
}

.detail-section h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.detail-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.detail-meta-item {
    padding: 10px 12px;
    background: var(--bg-input);
    border-radius: var(--radius-xs);
}

.detail-meta-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.detail-meta-val {
    font-size: 14px;
    font-weight: 500;
}

.detail-description {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--bg-input);
    padding: 12px;
    border-radius: var(--radius-sm);
}

/* Status stepper */
.status-stepper {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}

.step-btn {
    flex: 1;
    padding: 10px 8px;
    border: 2px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
    text-align: center;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    margin-right: 4px;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}

.step-btn.active .step-num {
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
}

.step-btn:hover { border-color: var(--border-light); background: var(--bg-card-hover); }

.step-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.step-btn.step-open.active { border-color: var(--status-open); color: var(--status-open); background: var(--normal-bg); }
.step-btn.step-progress.active { border-color: var(--status-progress); color: var(--status-progress); background: var(--priority-bg); }
.step-btn.step-complete.active { border-color: var(--status-complete); color: var(--status-complete); background: var(--accent-glow); }
.step-btn.step-archive.active { border-color: var(--status-archived); color: var(--status-archived); background: rgba(100, 116, 139, 0.12); }

/* Ticket viewer presence indicator (in modal header) */
.ticket-viewers {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-secondary);
    margin-left: auto;
    margin-right: 4px;
    white-space: nowrap;
    overflow: hidden;
}

.ticket-viewers:empty {
    display: none;
}

.viewer-label {
    color: var(--text-muted);
    font-weight: 500;
    margin-right: 2px;
}

.viewer-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--bg-modal);
}

.viewer-dot + .viewer-dot {
    margin-left: -6px;
}

.viewer-names {
    color: var(--text-secondary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Action buttons */
.detail-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    flex: 1;
    justify-content: center;
    min-width: 120px;
}

.action-btn:hover { border-color: var(--accent); background: var(--accent-glow); }

.action-btn-email { color: var(--accent); border-color: var(--accent); }
.action-btn-email:hover { background: var(--accent-glow-strong); }

.action-btn-archive { color: var(--status-archived); border-color: var(--status-archived); }
.action-btn-archive:hover { background: rgba(100,116,139,0.15); }

.action-btn-unarchive { color: var(--status-open); border-color: var(--status-open); }
.action-btn-unarchive:hover { background: var(--normal-bg); }

/* Notes section — Timeline conversation */
.note-timeline {
    position: relative;
    padding-left: 24px;
}

/* Vertical line */
.note-timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border);
    border-radius: 1px;
}

.note-tl-item {
    display: flex;
    gap: 14px;
    padding: 10px 0;
    position: relative;
}

.note-tl-item + .note-tl-item {
    border-top: 1px solid rgba(51, 65, 85, 0.3);
}

/* Dot / avatar circle */
.note-tl-dot {
    position: absolute;
    left: -24px;
    top: 12px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--dot-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 1;
    box-shadow: 0 0 0 3px var(--bg-modal);
}

.note-tl-initials {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.02em;
    line-height: 1;
}

/* Content area */
.note-tl-content {
    flex: 1;
    min-width: 0;
    padding-left: 20px;
}

.note-tl-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.note-tl-author {
    font-size: 13px;
    font-weight: 700;
}

.note-tl-time {
    font-size: 11px;
    color: var(--text-muted);
}

.note-tl-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Actions — inline in header, shown on hover */
.note-actions {
    display: flex;
    gap: 2px;
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.15s;
}

.note-tl-item:hover .note-actions { opacity: 1; }

/* Always show on touch devices */
@media (hover: none) {
    .note-actions { opacity: 1; }
}

.note-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
}

.note-action-btn:hover { color: var(--accent); background: var(--accent-glow); }
.note-action-btn.note-action-delete:hover { color: var(--emergency); background: var(--emergency-bg); }

/* Inline edit form */
.note-edit-form {
    margin-top: 6px;
}

.note-edit-textarea {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 8px 10px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    min-height: 60px;
    outline: none;
}

.note-edit-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.note-edit-save, .note-edit-cancel {
    padding: 4px 12px;
    border: none;
    border-radius: var(--radius-xs);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.note-edit-save {
    background: var(--accent);
    color: white;
}
.note-edit-save:hover { background: var(--accent-hover); }

.note-edit-cancel {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.note-edit-cancel:hover { background: var(--bg-card-hover); }

/* Delete confirm button (red) */
.confirm-danger {
    background: var(--emergency) !important;
    color: white !important;
}
.confirm-danger:hover { background: #dc2626 !important; }

.note-highlight {
    animation: noteGlow 3.5s ease;
    border-radius: var(--radius-sm);
}

@keyframes noteGlow {
    0%   { background: transparent; box-shadow: none; }
    8%   { background: rgba(16, 185, 129, 0.18); box-shadow: inset 3px 0 0 var(--accent), 0 0 12px rgba(16, 185, 129, 0.2); }
    25%  { background: rgba(16, 185, 129, 0.12); box-shadow: inset 3px 0 0 var(--accent), 0 0 8px rgba(16, 185, 129, 0.15); }
    50%  { background: rgba(16, 185, 129, 0.08); box-shadow: inset 3px 0 0 rgba(16, 185, 129, 0.5), 0 0 4px rgba(16, 185, 129, 0.1); }
    100% { background: transparent; box-shadow: none; }
}

/* Add note form */
.add-note-form {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.add-note-form textarea {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 13px;
    resize: vertical;
    min-height: 60px;
    outline: none;
}

.add-note-form textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.add-note-form button {
    align-self: flex-end;
    padding: 10px 16px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.add-note-form button:hover { background: var(--accent-hover); }

/* Attachments */
.attachment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}

.attachment-thumb {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: border-color 0.15s;
}

.attachment-thumb:hover { border-color: var(--accent); }

.attachment-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---- TOAST ---- */
.toast-container {
    position: fixed;
    bottom: calc(20px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}

.toast {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    box-shadow: var(--shadow);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    pointer-events: auto;
    max-width: 90vw;
    text-align: center;
}

.toast-success { background: var(--accent); }
.toast-error { background: var(--emergency); }
.toast-info { background: var(--status-open); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(20px); }
}

/* ==========================================
   DESKTOP (768px+)
   ========================================== */
@media (min-width: 768px) {
    .sidebar {
        transform: translateX(0);
        position: fixed;
        z-index: 50;
    }

    .sidebar-overlay { display: none !important; }
    .sidebar-close { display: none; }
    .topbar-menu-btn { display: none; }

    .topbar {
        margin-left: var(--sidebar-width);
        padding: 0 24px;
    }

    .search-bar {
        margin-left: var(--sidebar-width);
        padding: 0 24px 12px;
    }

    .main-content {
        margin-left: var(--sidebar-width);
    }

    .ticket-list {
        padding: 20px 24px;
        max-width: 900px;
    }

    .ticket-card {
        padding: 16px 20px;
    }

    .ticket-card:hover {
        border-color: var(--accent);
        box-shadow: 0 0 0 1px var(--accent-glow);
    }

    /* Modal as centered dialog on desktop */
    .modal-overlay {
        align-items: center;
    }

    .modal-sheet {
        max-width: 640px;
        max-height: 85vh;
        border-radius: var(--radius);
        margin: 0 24px;
        box-shadow: var(--shadow);
    }

    .modal-handle { display: none; }
}

/* ==========================================
   LARGE DESKTOP (1200px+)
   ========================================== */
@media (min-width: 1200px) {
    .ticket-list {
        max-width: 1000px;
        padding: 24px 32px;
        gap: 10px;
    }

    .modal-sheet {
        max-width: 720px;
    }
}

/* ==========================================
   Roles, Assignment & User Management
   ========================================== */
.role-badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 8px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    vertical-align: middle;
}
.role-admin { background: #3B82F6; color: #fff; }
.role-tech  { background: #F59E0B; color: #fff; }

/* Assigned user on ticket cards */
.card-assigned { color: #3B82F6; }
.card-unassigned { color: #9CA3AF; font-style: italic; }

/* Quick-assign dropdown on ticket cards */
.card-assign-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    font-size: 11px;
    padding: 2px 6px;
    outline: none;
    cursor: pointer;
    max-width: 140px;
    appearance: auto;
    margin-left: auto;
}

.card-assign-select:focus {
    border-color: var(--accent);
    color: var(--text-primary);
}

/* Assignment dropdown in ticket detail */
.detail-assignment select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    background: #fff;
    color: #1e293b;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* User Management */
.user-management {
    padding: 0 4px;
}

.user-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

.user-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: 8px;
    flex-wrap: wrap;
}

.user-card-header strong {
    font-size: 15px;
    color: #1e293b;
}

.user-card-detail {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 2px;
}

.user-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.action-btn-sm {
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
.action-btn-sm:hover { background: #e2e8f0; }
.action-btn-sm.action-btn-danger { color: #dc2626; border-color: #fecaca; }
.action-btn-sm.action-btn-danger:hover { background: #fee2e2; }

.user-form {
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
}

.user-form h4 {
    margin: 0 0 12px;
    font-size: 15px;
    color: #1e293b;
}

.user-form input,
.user-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 8px;
    box-sizing: border-box;
    background: #fff;
}

.user-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.text-muted { color: #9CA3AF; }

/* ==========================================
   Invite Section
   ========================================== */
.invite-section {
    margin-bottom: 20px;
}

.invite-section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.invite-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 8px;
}

.invite-card.invite-expired {
    opacity: 0.5;
}

.invite-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.invite-info strong {
    font-size: 14px;
    color: var(--text-primary);
}

.invite-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.invite-actions {
    display: flex;
    gap: 8px;
}

/* ==========================================
   Push Status Badges
   ========================================== */
.push-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 8px;
    font-weight: 600;
    letter-spacing: 0.3px;
    vertical-align: middle;
    margin-left: 4px;
}

.push-badge svg {
    width: 12px;
    height: 12px;
}

.push-on {
    background: rgba(16, 185, 129, 0.15);
    color: #10B981;
}

.push-off {
    background: rgba(100, 116, 139, 0.15);
    color: #64748b;
}

/* ==========================================
   Impersonation
   ========================================== */
.impersonation-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    flex-shrink: 0;
}

.impersonation-banner strong {
    font-weight: 700;
}

.impersonation-banner button {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 4px 14px;
    border-radius: var(--radius-xs);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.impersonation-banner button:hover {
    background: rgba(255,255,255,0.35);
}

.action-btn-sm.action-btn-impersonate {
    color: #7c3aed;
    border-color: #c4b5fd;
}

.action-btn-sm.action-btn-impersonate:hover {
    background: #ede9fe;
}

@media (min-width: 768px) {
    .impersonation-banner {
        margin-left: var(--sidebar-width);
    }
}

/* ==========================================
   Confirm Modal
   ========================================== */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.confirm-overlay.visible {
    opacity: 1;
}

.confirm-sheet {
    width: 100%;
    max-width: 380px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px 24px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    transform: scale(0.95) translateY(8px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.confirm-overlay.visible .confirm-sheet {
    transform: scale(1) translateY(0);
}

.confirm-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: rgba(124, 58, 237, 0.12);
    border-radius: 50%;
    color: #a78bfa;
}

.confirm-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.confirm-message {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.confirm-actions {
    display: flex;
    gap: 10px;
}

.confirm-btn {
    flex: 1;
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    font-family: inherit;
}

.confirm-btn:active {
    transform: scale(0.97);
}

.confirm-cancel {
    background: var(--bg-input);
    color: var(--text-primary);
}

.confirm-cancel:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.confirm-proceed {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.confirm-proceed:hover {
    background: var(--accent-hover);
}

.confirm-impersonate {
    background: #7c3aed;
    color: #fff;
    border-color: #7c3aed;
}

.confirm-impersonate:hover {
    background: #6d28d9;
    border-color: #6d28d9;
}

/* ==========================================
   Push Notification Prompt Banner
   ========================================== */
.push-prompt-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(5, 150, 105, 0.08));
    border-bottom: 1px solid rgba(16, 185, 129, 0.25);
    flex-shrink: 0;
    animation: fadeIn 0.3s ease;
}

.push-prompt-banner svg {
    color: var(--accent);
    flex-shrink: 0;
}

.push-prompt-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.push-prompt-enable {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 6px 16px;
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, transform 0.1s;
}

.push-prompt-enable:hover {
    background: var(--accent-hover);
}

.push-prompt-enable:active {
    transform: scale(0.97);
}

.push-prompt-dismiss {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    padding: 2px 6px;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}

.push-prompt-dismiss:hover {
    color: var(--text-secondary);
}

@media (min-width: 768px) {
    .push-prompt-banner {
        margin-left: var(--sidebar-width);
    }
}

/* ==========================================
   Completion Confirmation Modal
   ========================================== */
.completion-sheet {
    width: 100%;
    max-width: 400px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px 24px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    transform: scale(0.95) translateY(8px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.confirm-overlay.visible .completion-sheet {
    transform: scale(1) translateY(0);
}

.completion-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #10B981, #059669);
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.completion-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.completion-btn-notify {
    width: 100%;
    padding: 13px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    background: linear-gradient(135deg, #10B981, #059669);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.completion-btn-notify:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.completion-btn-notify:active {
    transform: scale(0.97);
}

.completion-btn-quiet {
    width: 100%;
    padding: 11px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    background: var(--bg-input);
    color: var(--text-secondary);
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.completion-btn-quiet:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.completion-btn-quiet:active {
    transform: scale(0.97);
}

.completion-cancel {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    padding: 8px 16px;
    transition: color 0.15s;
}

.completion-cancel:hover {
    color: var(--text-secondary);
}

/* ==========================================
   Notification Panel
   ========================================== */
.notif-panel {
    position: fixed;
    top: var(--topbar-height);
    right: 0;
    width: 340px;
    max-height: 70vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
    z-index: 150;
    display: flex;
    flex-direction: column;
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.notif-panel.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.notif-panel-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.notif-mark-all {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    transition: background 0.15s;
}

.notif-mark-all:hover {
    background: var(--accent-glow);
}

.notif-panel-body {
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.notif-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: var(--bg-card-hover);
}

.notif-unread {
    background: var(--accent-glow);
    border-left: 3px solid var(--accent);
}

.notif-unread:hover {
    background: var(--accent-glow-strong);
}

.notif-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.notif-item-message {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-item-time {
    font-size: 11px;
    color: var(--text-muted);
}

@media (max-width: 400px) {
    .notif-panel {
        width: 100%;
        border-radius: 0;
    }
}

@media (min-width: 768px) {
    .notif-panel {
        right: 24px;
        border-radius: 0 0 var(--radius) var(--radius);
    }
}

/* ==========================================
   Email Compose Form
   ========================================== */
.email-compose {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 16px;
    animation: fadeIn 0.2s ease;
}

.email-compose-subject {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
}

.email-compose-textarea {
    width: 100%;
    min-height: 120px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
}

.email-compose-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.email-compose-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.email-compose-send {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.email-compose-send:hover { background: var(--accent-hover); }
.email-compose-send:active { transform: scale(0.98); }
.email-compose-send:disabled { opacity: 0.6; cursor: default; }

.email-compose-send svg {
    width: 14px;
    height: 14px;
}

.email-compose-cancel {
    padding: 10px 14px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.email-compose-cancel:hover { background: var(--bg-card-hover); }

/* ==========================================
   Email Note Types in Timeline
   ========================================== */
.note-type-email-out {
    background: rgba(59, 130, 246, 0.06);
    border-radius: var(--radius-sm);
    padding-left: 10px !important;
    padding-right: 10px !important;
    margin-left: -10px;
    margin-right: -10px;
}

.note-type-email-in {
    background: rgba(245, 158, 11, 0.06);
    border-radius: var(--radius-sm);
    padding-left: 10px !important;
    padding-right: 10px !important;
    margin-left: -10px;
    margin-right: -10px;
}

.note-type-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1.2;
}

.note-type-badge-out {
    background: rgba(59, 130, 246, 0.15);
    color: #3B82F6;
}

.note-type-badge-in {
    background: rgba(245, 158, 11, 0.15);
    color: #F59E0B;
}

.note-opened {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: #10B981;
    font-weight: 500;
}

.note-opened svg {
    flex-shrink: 0;
}

.note-not-opened {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.note-not-opened svg {
    flex-shrink: 0;
}

.note-track-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 2px;
}

/* Email type dots show SVG icons instead of initials */
.note-type-email-out .note-tl-dot svg,
.note-type-email-in .note-tl-dot svg {
    width: 14px;
    height: 14px;
    color: #fff;
}

/* ==========================================
   Offline Banner
   ========================================== */
.offline-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.10));
    border-bottom: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--emergency);
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
    animation: fadeIn 0.3s ease;
}

@media (min-width: 768px) {
    .offline-banner {
        margin-left: var(--sidebar-width);
    }
}

/* ==========================================
   Snooze Duration Picker
   ========================================== */
.snooze-picker-sheet {
    max-width: 340px;
}

.snooze-picker-sheet .confirm-icon {
    color: var(--priority);
}

.snooze-picker-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.snooze-picker-btn {
    width: 100%;
    padding: 12px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.snooze-picker-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.snooze-picker-btn:active {
    transform: scale(0.97);
}

.snooze-picker-btn.snooze-picker-default {
    background: var(--priority-bg);
    border-color: var(--priority);
    color: var(--priority);
    font-weight: 600;
}

.snooze-picker-btn.snooze-picker-default:hover {
    background: var(--priority);
    color: #fff;
}

/* ==========================================
   Load More Spinner (Infinite Scroll)
   ========================================== */
.load-more-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.load-more-spinner .spinner {
    width: 24px;
    height: 24px;
}

/* ==========================================
   Create Ticket FAB
   ========================================== */
.fab-create-ticket {
    position: fixed;
    bottom: calc(24px + var(--safe-bottom));
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 90;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.fab-create-ticket:hover {
    background: var(--accent-hover);
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.5);
    transform: scale(1.05);
}

.fab-create-ticket:active {
    transform: scale(0.95);
}

@media (min-width: 768px) {
    .fab-create-ticket {
        right: calc(24px);
        bottom: 32px;
    }
}

/* ==========================================
   Create Ticket Modal
   ========================================== */
.create-ticket-sheet {
    max-width: 520px;
}

.ct-form-group {
    margin-bottom: 14px;
}

.ct-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.ct-form-group input,
.ct-form-group select,
.ct-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.ct-form-group input:focus,
.ct-form-group select:focus,
.ct-form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.ct-form-group textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.ct-form-group select {
    appearance: auto;
}

.ct-file-input {
    font-size: 13px;
}

.ct-file-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.ct-file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.ct-file-preview:empty {
    display: none;
}

.ct-file-thumb {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-xs);
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
}

.ct-file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ct-file-thumb .ct-file-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.ct-submit-btn {
    margin-top: 8px;
}

.ct-submit-btn:disabled {
    opacity: 0.6;
    cursor: default;
}
