/* ============================================================
   288 SERVICE DESK — GLASSMORPHISM DESIGN SYSTEM
   Premium, Modern, Custom UI
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
    color-scheme: light;

    /* Core Palette */
    --accent:       #4F46E5;
    --accent-hover: #4338CA;
    --accent-light: rgba(79, 70, 229, 0.1);
    
    --success:      #10B981;
    --warning:      #F59E0B;
    --danger:       #EF4444;
    --info:         #3B82F6;

    /* Shared surface aliases used by page-level views */
    --surface:      #FFFFFF;
    --surface-2:    #F8FAFC;
    --surface-3:    #F1F5F9;
    --border:       #E2E8F0;
    --line:         #E2E8F0;
    --blue:         #4F46E5;
    --blue-light:   #EEF2FF;
    --blue-dark:    #3730A3;
    --red:          #EF4444;
    --muted:        #64748B;
    --text:         var(--text-main);
    --text-2:       var(--text-muted);
    --text-3:       var(--text-light);
    --teal:         #0F766E;

    /* Old Color & Border Radius Aliases */
    --navy:         var(--accent);
    --green:        var(--success);
    --red:          var(--danger);
    --amber:        var(--warning);
    --r:            var(--radius-md);
    --r-full:       var(--radius-pill);

    /* Glass Surfaces */
    --glass-bg:     rgba(255, 255, 255, 0.65);
    --glass-bg-2:   rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.9);
    --glass-shadow: 0 12px 40px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.03);
    
    /* Text */
    --text-main:    #0F172A;
    --text-muted:   #64748B;
    --text-light:   #94A3B8;

    /* Geometry */
    --radius-sm:    8px;
    --radius-md:    16px;
    --radius-lg:    24px;
    --radius-xl:    32px;
    --radius-pill:  9999px;
    
    /* Animation */
    --transition:   0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100vh;
}

body {
    /* Dynamic Mesh Gradient Background */
    background-color: #f1f5f9;
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7deg,0.08) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30deg,0.08) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30deg,0.08) 0, transparent 50%), 
        radial-gradient(at 0% 100%, hsla(253,16%,7deg,0.08) 0, transparent 50%), 
        radial-gradient(at 50% 100%, hsla(225,39%,30deg,0.08) 0, transparent 50%), 
        radial-gradient(at 100% 100%, hsla(339,49%,30deg,0.08) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── App Shell (Layout) ──────────────────────────────────────── */
.app-shell {
    display: flex;
    min-height: 100vh;
    padding: 20px;
    gap: 20px;
    max-width: 1920px;
    margin: 0 auto;
}

/* ── Floating Glass Sidebar ───────────────────────────────────── */
.sidebar {
    width: 280px;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    position: sticky;
    top: 20px;
    height: calc(100vh - 40px);
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding: 0 8px;
}

.brand-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent), #8B5CF6);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.25);
}

.brand-text h1 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.brand-text span {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Nav */
.nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    overflow-y: auto;
}

.nav::-webkit-scrollbar { display: none; }

.nav a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.nav a::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent);
    opacity: 0;
    transition: var(--transition);
}

.nav-icon {
    width: 20px;
    height: 20px;
    position: relative;
    z-index: 1;
    opacity: 0.8;
}

.nav a span {
    position: relative;
    z-index: 1;
}

.nav a:hover {
    color: var(--text-main);
    transform: translateX(4px);
}

.nav a.active {
    color: var(--accent);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.nav a.active::before {
    opacity: 0.08;
}

.nav a.active .nav-icon {
    opacity: 1;
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding-top: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid rgba(255,255,255,0.4);
}

.sidebar-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #FF7E5F, #FEB47B);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 4px 10px rgba(255, 126, 95, 0.3);
}

.sidebar-user-info strong {
    display: block;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 700;
}
.sidebar-user-info small {
    color: var(--text-muted);
    font-size: 11px;
}

/* ── Workspace ────────────────────────────────────────────────── */
.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Glass Topbar */
.topbar {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 16px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    position: sticky;
    top: 20px;
    z-index: 30;
}

.title h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.title p {
    margin: 2px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-clock {
    font-family: 'Plus Jakarta Sans', monospace;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.5);
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    margin-right: 8px;
}

/* ── Content ─────────────────────────────────────────────────── */
.content {
    flex: 1;
}

/* ── Glass Panels (Cards) ────────────────────────────────────── */
.panel, .card {
    background: var(--glass-bg-2);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    margin-bottom: 24px;
    overflow: hidden;
    transition: var(--transition);
}

.panel:hover, .card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

.panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

.panel-body {
    padding: 24px;
}

/* ── Metrics (KPI Cards) ─────────────────────────────────────── */
.metric {
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.metric::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 150px; height: 150px;
    background: radial-gradient(circle, var(--accent-light) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(30%, -30%);
    z-index: -1;
}

.metric-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0;
    margin-bottom: 8px;
    padding-right: 50px;
    line-height: 1.3;
}

.metric-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
    line-height: 1.1;
    margin-bottom: 8px;
    padding-right: 40px;
    word-wrap: break-word;
}

.metric-sub {
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.4;
}

.metric-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* ── Premium Buttons ─────────────────────────────────────────── */
.button, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.button:hover, button:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
}

.button:active, button:active {
    transform: translateY(0);
}

.button.secondary, button.secondary {
    background: white;
    color: var(--text-main);
    box-shadow: 0 4px 14px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
}

.button.secondary:hover, button.secondary:hover {
    background: #f8fafc;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.button.ghost, button.ghost {
    background: transparent;
    color: var(--text-muted);
    box-shadow: none;
}

.button.ghost:hover, button.ghost:hover {
    background: rgba(0,0,0,0.05);
    color: var(--danger);
}

.button.danger, button.danger {
    background: var(--danger);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}
.button.danger:hover, button.danger:hover {
    background: #DC2626;
}

.button.success, button.success {
    background: var(--success);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.button.teal, button.teal {
    background: #0D9488;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.3);
}

.button.sm, button.sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 10px;
}

/* ── Inputs & Forms ──────────────────────────────────────────── */
input, select, textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 2px solid rgba(0, 0, 0, 0.08);
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-main);
    font-weight: 500;
    transition: var(--transition);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 4px var(--accent-light);
}

label {
    display: block;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
    font-size: 13px;
}

.field { margin-bottom: 20px; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    background: rgba(255,255,255,0.5);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    text-align: left;
    padding: 16px 20px;
    font-size: 12px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

td {
    padding: 16px 20px;
    font-size: 14px;
    color: var(--text-main);
    font-weight: 500;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

tr:hover td {
    background: rgba(255,255,255,0.8);
}

tr:last-child td {
    border-bottom: none;
}

/* ── Badges & Tags ───────────────────────────────────────────── */
.badge, .tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-new { background: #EEF2FF; color: #4F46E5; }
.badge-in_progress { background: #FEF3C7; color: #D97706; }
.badge-resolved { background: #D1FAE5; color: #059669; }
.badge-closed { background: #F1F5F9; color: #475569; }
.badge-cancelled { background: #FEE2E2; color: #DC2626; }
.badge-waiting { background: #FFEDD5; color: #EA580C; }
.badge-urgent { background: #FEE2E2; color: #B91C1C; }
.badge-high { background: #FFEDD5; color: #C2410C; }

/* ── Grids ───────────────────────────────────────────────────── */
.grid { display: grid; gap: 24px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-2 { display: grid; gap: 20px; grid-template-columns: 1fr 1fr; }
.field.full { grid-column: 1 / -1; }

/* ── Flash Messages ──────────────────────────────────────────── */
.flash {
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    border-left: 4px solid var(--success);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    color: var(--text-main);
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    margin-bottom: 24px;
    animation: slideInDown 0.4s ease;
}

.flash.danger {
    border-left-color: var(--danger);
}

.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    opacity: 0.8;
}

@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Mobile Overlays ─────────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.2);
    backdrop-filter: blur(4px);
    z-index: 40;
}
.sidebar-toggle { display: none; }

@media (max-width: 1024px) {
    .app-shell { flex-direction: column; padding: 10px; }
    .sidebar { 
        position: fixed; left: -300px; top: 10px; bottom: 10px; z-index: 50; 
        transition: left 0.3s;
    }
    .sidebar.show { left: 10px; }
    .sidebar-overlay.show { display: block; }
    .sidebar-toggle { display: flex; }
    .cols-4, .cols-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .cols-4, .cols-3, .cols-2, .form-grid-2 { grid-template-columns: 1fr; }
    .topbar-actions .button span { display: none; }
}

/* Scrollbar customization */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* ── Alert Banners ───────────────────────────────────────────── */
.alert-banner {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.1));
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-left: 4px solid var(--danger);
    color: var(--danger);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    backdrop-filter: blur(10px);
}

/* ── Bar Charts ──────────────────────────────────────────────── */
.bar-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 8px;
}
.bar-row {
    display: flex;
    align-items: center;
    gap: 16px;
}
.bar-row strong {
    flex-shrink: 0;
    width: 120px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bar-track {
    flex: 1;
    background: rgba(0, 0, 0, 0.05);
    height: 10px;
    border-radius: var(--radius-pill);
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #8B5CF6);
    border-radius: var(--radius-pill);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.bar-row span {
    flex-shrink: 0;
    width: 30px;
    font-size: 14px;
    font-weight: 800;
    color: var(--text-main);
    text-align: right;
}

/* Global confirmation dialog */
body.dialog-open { overflow: hidden; }
.app-confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}
.app-confirm-overlay.show { display: flex; }
.app-confirm-dialog {
    width: min(100%, 470px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.92);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}
.app-confirm-main {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 22px 54px 18px 22px;
}
.app-confirm-icon {
    display: flex;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #fff7ed;
    color: #c2410c;
}
.app-confirm-dialog[data-tone="danger"] .app-confirm-icon { background: #fef2f2; color: #dc2626; }
.app-confirm-copy h2 { margin: 0 0 6px; color: var(--text-main); font-size: 17px; letter-spacing: 0; }
.app-confirm-copy p { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.55; }
.app-confirm-meta {
    margin-top: 12px;
    padding: 9px 11px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 700;
}
.app-confirm-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    box-shadow: none;
}
.app-confirm-close:hover { background: #f1f5f9; color: var(--text-main); box-shadow: none; transform: none; }
.app-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}
.app-confirm-dialog[data-tone="danger"] #app-confirm-accept { background: var(--danger); box-shadow: 0 4px 14px rgba(239, 68, 68, 0.24); }
.app-confirm-dialog[data-tone="danger"] #app-confirm-accept:hover { background: #dc2626; }
@media (max-width: 520px) {
    .app-confirm-main { padding: 20px 48px 16px 18px; }
    .app-confirm-actions { padding: 14px 18px; }
    .app-confirm-actions .button { flex: 1; padding-left: 12px; padding-right: 12px; }
}

/* Password visibility control */
.password-input-wrap {
    position: relative;
    width: 100%;
}
.password-input-wrap > input {
    padding-right: 52px;
}
button.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    z-index: 2;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    box-shadow: none;
    transform: translateY(-50%);
}
button.password-toggle:hover {
    background: #f1f5f9;
    color: var(--accent);
    box-shadow: none;
    transform: translateY(-50%);
}
button.password-toggle:active {
    transform: translateY(-50%);
}
button.password-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* Shared application modals */
body.modal-open { overflow: hidden; }
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2500;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}
.modal-overlay.active { display: flex; }
.modal-content {
    width: min(100%, 600px);
    max-height: min(90vh, 820px);
    overflow-y: auto;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.92);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.modal-header h3 { margin: 0; font-size: 18px; color: var(--text-main); }
button.modal-close {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    box-shadow: none;
    font-size: 20px;
}
button.modal-close:hover {
    background: var(--surface-3);
    color: var(--text-main);
    box-shadow: none;
    transform: none;
}

.sidebar-close {
    display: none;
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 8px;
    background: var(--surface-3);
    color: var(--text-main);
    box-shadow: none;
}
.sidebar-close:hover { background: #e2e8f0; box-shadow: none; transform: none; }

@media (max-width: 1024px) {
    .sidebar { width: min(280px, calc(100vw - 20px)); }
    .sidebar-close { display: inline-flex; }
    .topbar-clock { display: none; }
}

@media (max-width: 768px) {
    .app-shell { gap: 12px; padding: 8px; }
    .topbar {
        top: 8px;
        gap: 8px;
        min-height: 64px;
        margin-bottom: 16px;
        padding: 10px 12px;
        border-radius: 12px;
    }
    .topbar > div:first-child { min-width: 0; gap: 8px !important; }
    .title { min-width: 0; }
    .title h1 { overflow: hidden; font-size: 17px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
    .title p { overflow: hidden; max-width: 260px; font-size: 11px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
    .topbar-actions { flex: 0 0 auto; gap: 4px; }
    .topbar-actions .button,
    .topbar-actions button {
        width: 38px;
        min-width: 38px;
        height: 38px;
        padding: 0;
        border-radius: 8px;
    }
    .topbar-actions .button span { display: none !important; }
    .content { min-width: 0; }
    .panel-header { padding: 16px; }
    .panel-body { padding: 16px; }
    .dropdown-menu { right: -48px !important; width: min(300px, calc(100vw - 24px)) !important; }
}

@media (max-width: 520px) {
    .title p { display: none; }
    .modal-overlay { align-items: flex-end; padding: 8px; }
    .modal-content { max-height: calc(100vh - 16px); padding: 18px; }
    .modal-header { margin-bottom: 16px; }
}
/* Call center improvements: filters, read tracking, references and map */
.filter-band { background: var(--surface-2); border-bottom: 1px solid var(--line); }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; align-items: end; width: 100%; }
.filter-grid-wide { grid-template-columns: repeat(5, minmax(145px, 1fr)); }
.compact-filter-grid { grid-template-columns: minmax(0, 1fr) minmax(180px, 220px) auto; }
.compact-filter-grid .filter-search { grid-column: auto; }
.compact-filter-grid .filter-actions { flex-wrap: nowrap; white-space: nowrap; }
.filter-grid .field { min-width: 0; margin: 0; }
.filter-search { grid-column: span 2; }
.filter-actions { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.filter-actions .button, .filter-actions button { min-height: 42px; justify-content: center; }
.table-panel-body { padding: 0; }
.table-panel-body .app-pagination { padding: 14px 18px; }
.ticket-summary-cell { min-width: 220px; max-width: 310px; }
.ticket-link { color: #3730a3; text-decoration: none; }
.ticket-link:hover { text-decoration: underline; }
.ticket-row-success td { background: #f0fdf4; }
.ticket-row-attention td { background: #fef2f2; }
.badge-routed, .badge-assigned { background: #e0e7ff; color: #4338ca; }
.badge-pending_approval, .badge-returned { background: #fee2e2; color: #b91c1c; }
.badge-closed { background: #d1fae5; color: #047857; }
.badge-low, .badge-normal { background: #e0f2fe; color: #0369a1; }
.badge-channel { margin-top: 4px; background: #f1f5f9; color: #475569; }
.read-state { display: flex; justify-content: space-between; gap: 10px; min-width: 190px; padding: 3px 0; font-size: 11px; }
.read-state span { color: var(--text-muted); }
.read-ok { color: #047857 !important; }
.read-pending { color: #b91c1c !important; }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.row-actions form { margin: 0; }

.tickets-table {
  min-width: 1320px;
}

.tickets-table th:nth-child(5) {
  width: 128px;
}

.tickets-table th:last-child {
  width: 142px;
}

.ticket-status-cell {
  min-width: 128px;
}

.ticket-status-block {
  display: grid;
  justify-items: start;
  gap: 7px;
}

.ticket-status-pill {
  width: max-content;
  max-width: 100%;
  margin: 0;
  padding: 5px 8px;
  border-radius: 6px;
  line-height: 1.2;
}

.ticket-priority-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.ticket-priority-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: currentColor;
}

.ticket-priority-low { color: #64748b; }
.ticket-priority-normal { color: #0284c7; }
.ticket-priority-high { color: #ea580c; }
.ticket-priority-urgent { color: #dc2626; }

.ticket-actions-cell {
  min-width: 142px;
}

.ticket-row-actions,
.ticket-row-actions form {
  display: flex;
  align-items: center;
}

.ticket-row-actions {
  flex-wrap: nowrap;
  gap: 6px;
}

.ticket-row-actions form {
  margin: 0;
}

.ticket-action-button {
  display: inline-flex;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #fff;
  color: #334155;
  box-shadow: none;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.ticket-action-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  pointer-events: none;
}

.ticket-action-button:hover,
.ticket-action-button:focus-visible {
  transform: none;
  outline: none;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .09);
}

.ticket-action-view:hover,
.ticket-action-view:focus-visible {
  border-color: #94a3b8;
  background: #f8fafc;
  color: #0f172a;
}

.ticket-action-edit {
  border-color: #c7d2fe;
  background: #eef2ff;
  color: #4f46e5;
}

.ticket-action-edit:hover,
.ticket-action-edit:focus-visible {
  border-color: #818cf8;
  background: #e0e7ff;
  color: #3730a3;
}

.ticket-action-delete {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #e11d48;
}

.ticket-action-delete:hover,
.ticket-action-delete:focus-visible {
  border-color: #fb7185;
  background: #ffe4e6;
  color: #be123c;
}
.app-pagination { display:flex; align-items:center; justify-content:space-between; gap:14px; }
.page-list { display:flex; align-items:center; gap:4px; }
.page-control, .page-number { display:inline-flex; width:36px; height:36px; align-items:center; justify-content:center; border:1px solid var(--line); border-radius:6px; background:#fff; color:var(--text-main); text-decoration:none; font-size:12px; font-weight:800; }
.page-control svg { width:16px; height:16px; }
.page-control:hover, .page-number:hover { border-color:var(--accent); color:var(--accent); }
.page-number.active { border-color:var(--accent); background:var(--accent); color:#fff; }
.page-control.disabled { opacity:.42; cursor:default; }
.page-ellipsis { display:inline-flex; width:20px; justify-content:center; color:var(--text-muted); font-weight:800; }
.page-summary { color:var(--text-muted); font-size:12px; font-weight:700; }
.modal-overlay.show { display: flex; }
.modal-card { width: min(100%, 620px); max-height: 90vh; overflow-y: auto; padding: 22px; border-radius: 8px; background: #fff; box-shadow: 0 24px 70px rgba(15,23,42,.28); }
.compact-modal { width: min(100%, 520px); }
.modal-header h2 { margin: 0; font-size: 18px; }
.form-stack { display: grid; gap: 14px; }
.form-stack .field { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; }
.detail-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.detail-section { margin-bottom: 16px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px 24px; }
.detail-grid > div { min-width: 0; }
.detail-grid span, .read-overview-item > span { display: block; margin-bottom: 5px; color: var(--text-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.detail-grid strong { display: block; overflow-wrap: anywhere; }
.detail-grid p { margin: 0; line-height: 1.55; }
.detail-wide { grid-column: 1 / -1; }
.read-overview { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.read-overview-item { padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.read-overview-item strong, .read-overview-item small { display: block; margin-top: 5px; }
.bordered-top { border-top: 1px solid var(--line); }
.metrics-row { margin-bottom: 16px; }
.technical-filter-panel { margin-bottom: 16px; }
.technical-list { display: grid; gap: 12px; }
.work-item { display: grid; grid-template-columns: minmax(0,1fr) 290px; gap: 20px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 8px 26px rgba(15,23,42,.06); }
.work-item-urgent { border-left: 4px solid #dc2626; }
.work-item-overdue { background: #fff7ed; }
.work-item-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.work-item h3 { margin: 12px 0 6px; font-size: 16px; }
.work-item p { margin: 0 0 12px; color: var(--text-muted); line-height: 1.55; }
.work-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 14px; color: var(--text-muted); font-size: 12px; }
.work-action-form { display: grid; gap: 10px; padding-left: 18px; border-left: 1px solid var(--line); }
.work-action-form .field { margin: 0; }
.resolved-fields { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.resolved-fields[hidden] { display: none; }
.reference-create-panel { margin-bottom: 16px; }
.reference-create-panel details { padding: 18px 22px; }
.reference-create-panel summary { cursor: pointer; color: var(--text-main); font-weight: 800; }
.reference-form { margin-top: 18px; }
.phone-link { color: #2563eb; font-weight: 800; text-decoration: none; }
.phone-link:hover { text-decoration: underline; }
.map-shell { display: grid; grid-template-columns: 350px minmax(0,1fr); min-height: 620px; height: calc(100vh - 158px); overflow: hidden; }
.map-shell:hover { transform: none; }
.map-controls { display: flex; min-width: 0; flex-direction: column; gap: 16px; padding: 20px; border-right: 1px solid var(--line); background: #fff; overflow-y: auto; }
.map-controls h2 { margin: 0; font-size: 17px; }
.map-controls-intro { margin: 4px 0 0; color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.map-coordinate-field { margin: 0; }
.map-diagnostic { display: flex; min-height: 190px; flex-direction: column; align-items: center; justify-content: center; gap: 9px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); text-align: center; }
.map-diagnostic.available { border-color: #86efac; background: #f0fdf4; }
.map-diagnostic.unavailable { border-color: #fecaca; background: #fef2f2; }
.map-diagnostic-icon { display: flex; width: 42px; height: 42px; align-items: center; justify-content: center; border-radius: 50%; background: #e2e8f0; font-size: 22px; }
.map-diagnostic h3, .map-diagnostic p { margin: 0; }
.map-diagnostic h3 { font-size: 15px; }
.map-diagnostic p { color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.map-diagnostic-details { display: none; width: 100%; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); text-align: left; font-size: 11px; }
.map-diagnostic-details > div { display: flex; justify-content: space-between; gap: 12px; }
.map-diagnostic-details strong { max-width: 60%; text-align: right; }
.map-ticket-button { width: 100%; }
.map-stage { position: relative; min-width: 0; background: #dbe4ea; }
#service-map { width: 100%; height: 100%; min-height: 440px; }
.map-load-error { position: absolute; inset: 20px; z-index: 500; display: none; align-items: center; justify-content: center; padding: 20px; border: 1px solid #fecaca; border-radius: 8px; background: rgba(254,242,242,.96); color: #991b1b; text-align: center; font-weight: 700; }
.ready-address-marker { display: flex; width: 28px; height: 28px; align-items: center; justify-content: center; border: 2px solid #fff; border-radius: 50%; background: #047857; color: #fff; box-shadow: 0 4px 12px rgba(4,120,87,.3); font-size: 13px; font-weight: 900; }
@media (max-width: 1100px) { .filter-grid-wide { grid-template-columns: repeat(3,minmax(150px,1fr)); } .work-item { grid-template-columns: 1fr; } .work-action-form { padding: 16px 0 0; border-left: 0; border-top: 1px solid var(--line); grid-template-columns: repeat(3,minmax(0,1fr)); } .resolved-fields, .work-action-form button { grid-column: 1 / -1; } }
@media (max-width: 900px) { .map-shell { grid-template-columns: 1fr; height: auto; min-height: 0; } .map-controls { border-right: 0; border-bottom: 1px solid var(--line); } #service-map { height: 500px; } .detail-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 720px) { .filter-grid, .filter-grid-wide, .compact-filter-grid, .reference-form { grid-template-columns: 1fr; } .filter-search { grid-column: auto; } .filter-actions { width: 100%; } .filter-actions > * { flex: 1; } .detail-grid, .read-overview { grid-template-columns: 1fr; } .work-action-form { grid-template-columns: 1fr; } .resolved-fields, .work-action-form button { grid-column: auto; } .app-pagination { justify-content: space-between; } .map-controls { padding: 16px; } #service-map { height: 420px; min-height: 420px; } }
.ticket-latest-note {
  display: grid;
  gap: 2px;
  margin-top: 8px;
  padding: 7px 9px;
  border-left: 3px solid var(--blue, #4f46e5);
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  line-height: 1.45;
}

.ticket-latest-note strong,
.ticket-latest-note span {
  overflow-wrap: anywhere;
}

.ticket-latest-note small {
  color: #64748b;
}

.history-change-list {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.history-change {
  display: grid;
  gap: 2px;
}

.history-change strong {
  color: #334155;
  font-size: 11px;
}

.history-change span {
  color: #64748b;
  font-size: 12px;
  overflow-wrap: anywhere;
}

/* Shared accent notes keep their visual line separate from the content. */
.accent-note {
  position: relative;
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 8px;
  padding: 2px 0 2px 16px;
}

.accent-note::before {
  content: '';
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: 3px;
  border-radius: 2px;
  background: var(--accent-line, var(--teal));
}

.accent-note > * {
  min-width: 0;
}

.website-api-grid {
  gap: 28px;
}

.api-endpoint-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 11px;
  font-weight: 800;
}

.api-info-title {
  color: var(--navy);
  font-size: 13px;
  line-height: 1.35;
}

.api-info-code {
  display: block;
  width: 100%;
  padding: 6px 9px;
  overflow-wrap: anywhere;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  background: #f8fafc;
  color: #334155;
  font-size: 11.5px;
  line-height: 1.35;
}

.api-info-copy {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.api-info-summary {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.55;
}

@media (max-width: 720px) {
  .website-api-grid {
    gap: 18px;
  }
}

.nav-group { border-radius:var(--radius-md); }
.nav-group summary { display:flex; align-items:center; gap:14px; padding:12px 16px; border-radius:var(--radius-md); color:var(--text-muted); font-size:14px; font-weight:600; cursor:pointer; list-style:none; }
.nav-group summary::-webkit-details-marker { display:none; }
.nav-group-summary.active { color:var(--accent); background:rgba(79,70,229,.08); }
.nav-group-chevron { width:16px; height:16px; margin-left:auto; transition:transform .18s ease; }
.nav-group[open] .nav-group-chevron { transform:rotate(180deg); }
.nav-submenu { display:grid; gap:2px; margin:3px 0 6px 35px; padding-left:12px; border-left:1px solid var(--line); }
.nav .nav-submenu a { min-height:32px; padding:7px 10px; border-radius:5px; font-size:12px; }
.nav .nav-submenu a:hover { transform:none; }
.department-responsibility-list { display:grid; }
.department-responsibility-row { display:grid; grid-template-columns:minmax(180px,.7fr) minmax(0,1.8fr); gap:20px; align-items:start; padding:20px; border-top:1px solid var(--line); }
.department-responsibility-meta { display:grid; gap:5px; }
.department-responsibility-meta strong { color:var(--text-main); font-size:15px; }
.department-responsibility-meta span, .department-responsibility-meta small { color:var(--text-muted); font-size:12px; }
.department-responsibility-fields { display:grid; grid-template-columns:minmax(220px,1fr) minmax(200px,.8fr) auto; gap:12px; align-items:end; }
.department-responsibility-fields .field { margin:0; }
.department-responsibility-fields select[multiple] { min-height:130px; }
@media (max-width:900px) { .department-responsibility-row, .department-responsibility-fields { grid-template-columns:1fr; } }
@media (max-width:560px) { .app-pagination { align-items:flex-start; flex-direction:column; } .page-list { max-width:100%; overflow-x:auto; padding-bottom:2px; } }
