@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500&display=swap');
@import url('https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@3.17.0/dist/tabler-icons.min.css');

/* =====================================================
   Tumbo Support — design system v3
   Matches: Logoipsum ticket view + Helpdesk dashboard
   ===================================================== */

:root {
    --tumbo-blue:       #2B2D8E;
    --tumbo-blue-dark:  #1F2071;
    --tumbo-blue-light: #4548B0;
    --tumbo-blue-50:    #EEF0FF;
    --tumbo-blue-100:   #D9DCFB;
    --tumbo-gradient:   linear-gradient(135deg, #FF6B35 0%, #E91E63 25%, #9C27B0 50%, #2196F3 75%, #4CAF50 100%);

    --status-new:          #6366F1;
    --status-acknowledged: #3B82F6;
    --status-inprogress:   #F59E0B;
    --status-delayed:      #EF4444;
    --status-onhold:       #6B7280;
    --status-resolved:     #10B981;
    --status-closed:       #4B5563;

    --ink-900: #0F172A;
    --ink-700: #1F2937;
    --ink-600: #475569;
    --ink-500: #64748B;
    --ink-400: #94A3B8;
    --ink-300: #CBD5E1;
    --ink-200: #E2E8F0;
    --ink-100: #F1F5F9;
    --ink-50:  #F8FAFC;
    --line:    #E5E7EB;
    --bg:      #F8FAFC;
    --surface: #FFFFFF;

    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --shadow-sm: 0 1px 2px rgba(15,23,42,.04);
    --shadow:    0 1px 3px rgba(15,23,42,.04), 0 1px 2px rgba(15,23,42,.06);
    --shadow-lg: 0 10px 30px rgba(15,23,42,.08), 0 4px 10px rgba(15,23,42,.06);
    --t:         .15s cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    background: var(--bg); color: var(--ink-900);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-size: 14px; line-height: 1.5;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}

a { color: var(--tumbo-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 4px; color: var(--ink-900); }
.page-sub { color: var(--ink-500); font-size: 13px; margin: 0 0 24px; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }

.ti { font-family: 'tabler-icons'; font-style: normal; line-height: 1; }
.muted { color: var(--ink-500); }

/* ---------- Boot splash ---------- */
.boot-splash {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100vh; background: var(--tumbo-blue); position: relative; overflow: hidden;
}
.boot-splash::before {
    content: ''; position: absolute; width: 700px; height: 700px;
    background: var(--tumbo-gradient); border-radius: 50%; filter: blur(140px); opacity: .35;
}
.boot-splash img { position: relative; z-index: 1; }
.boot-brand {
    font-weight: 700; font-size: 28px; letter-spacing: -.02em;
    background: var(--tumbo-gradient); -webkit-background-clip: text;
    background-clip: text; color: transparent; position: relative; z-index: 1;
}
.boot-sub { color: rgba(255,255,255,.65); font-size: 11px; letter-spacing: 2px; position: relative; z-index: 1; margin-top: 14px; }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.app-topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 16px;
    background: rgba(255,255,255,.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--line);
    padding: 0 20px; min-height: 60px;
}
.hamburger {
    background: transparent; border: 0; width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; border-radius: var(--radius); color: var(--ink-700);
    font-size: 20px;
}
.hamburger:hover { background: var(--ink-100); }
.hamburger i { font-family: 'tabler-icons'; font-style: normal; }

.brand {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none; font-weight: 600; font-size: 15px;
    letter-spacing: -.01em;
}
.brand img { height: 30px; width: auto; display: block; }
.brand-mark { color: var(--ink-900); }

.topbar-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.iconbtn {
    background: transparent; border: 0; color: var(--ink-600);
    width: 38px; height: 38px; border-radius: var(--radius); cursor: pointer;
    font-size: 18px; transition: var(--t);
    display: inline-flex; align-items: center; justify-content: center; position: relative;
}
.iconbtn:hover { background: var(--ink-100); color: var(--ink-900); }
.iconbtn i { font-family: 'tabler-icons'; font-style: normal; }

.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    color: white; font-weight: 600; font-size: 12px; cursor: pointer;
    letter-spacing: -.02em; flex-shrink: 0;
}
.avatar-lg { width: 36px; height: 36px; font-size: 13px; }
.avatar-xl { width: 44px; height: 44px; font-size: 15px; }
.avatar-brand { background: var(--tumbo-gradient); }
.avatar-c0 { background: #C9A227; } /* mustard */
.avatar-c1 { background: #B23A48; } /* burgundy */
.avatar-c2 { background: #5B9BD5; } /* slate blue */
.avatar-c3 { background: #3D5A80; } /* deep blue */
.avatar-c4 { background: #6A8E7F; } /* sage */
.avatar-c5 { background: #3F4756; } /* charcoal */
.avatar-c6 { background: #8A8B43; } /* olive */
.avatar-c7 { background: #C97B5C; } /* terracotta */
.avatar-c8 { background: #4F7D6B; } /* forest */
.avatar-c9 { background: #2D2D2D; } /* near-black */

/* ---------- Drawer (sidebar) ---------- */
.app-drawer {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
    width: 240px; max-width: 86vw; background: var(--surface);
    border-right: 1px solid var(--line);
    transform: translateX(-105%); transition: transform .3s cubic-bezier(.4,0,.2,1);
    overflow-y: auto; display: flex; flex-direction: column;
}
.app-drawer.open { transform: translateX(0); }
.drawer-scrim {
    position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 35;
    opacity: 0; pointer-events: none; transition: opacity .3s; backdrop-filter: blur(4px);
}
.drawer-scrim.show { opacity: 1; pointer-events: auto; }

.drawer-header { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer-header img { height: 32px; width: auto; display: block; margin-bottom: 8px; }
.drawer-brand { font-weight: 700; font-size: 14px; letter-spacing: -.01em; color: var(--ink-900); }
.drawer-subtitle { color: var(--ink-500); font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; margin-top: 2px; font-weight: 600; }

.drawer-section-label {
    padding: 14px 18px 6px;
    font-size: 10px; font-weight: 600; letter-spacing: 1.2px;
    text-transform: uppercase; color: var(--ink-400);
}

.drawer-nav ul { list-style: none; padding: 8px 10px; margin: 0; }
.drawer-nav li.divider { height: 1px; background: var(--line); margin: 10px 4px; }
.drawer-nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 8px 12px; color: var(--ink-700); font-weight: 500; font-size: 13px;
    text-decoration: none; border-radius: var(--radius-sm);
    margin-bottom: 1px; transition: var(--t); position: relative;
}
.drawer-nav a i {
    font-family: 'tabler-icons'; font-style: normal; font-size: 18px;
    color: var(--ink-500); width: 20px; text-align: center;
}
.drawer-nav a:hover { background: var(--ink-100); color: var(--ink-900); text-decoration: none; }
.drawer-nav a:hover i { color: var(--ink-700); }
.drawer-nav a.active {
    background: var(--tumbo-blue-50); color: var(--tumbo-blue); font-weight: 600;
}
.drawer-nav a.active i { color: var(--tumbo-blue); }
.drawer-nav a .count {
    margin-left: auto; font-size: 11px; font-weight: 600;
    background: var(--ink-100); color: var(--ink-600);
    padding: 1px 7px; border-radius: 999px;
}
.drawer-nav a.active .count { background: var(--tumbo-blue); color: white; }

.drawer-footer { margin-top: auto; padding: 12px 14px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.drawer-footer .user-info { flex: 1; min-width: 0; }
.drawer-footer .user-name { font-size: 13px; font-weight: 600; color: var(--ink-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-footer .user-email { font-size: 11px; color: var(--ink-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (min-width: 1024px) {
    .hamburger { display: none; }
    .app-drawer { position: static; transform: translateX(0); width: 240px; box-shadow: none; }
    .drawer-scrim { display: none; }
    .app-shell { display: grid; grid-template-columns: 240px 1fr; grid-template-rows: 60px 1fr; }
    .app-topbar { grid-column: 1 / span 2; }
    .app-drawer { grid-column: 1; grid-row: 2; top: 60px; }
    .app-main { grid-column: 2; }
}

/* ---------- Main ---------- */
.app-main { padding: 28px 32px; width: 100%; max-width: 1400px; margin: 0 auto; }
@media (max-width: 720px) { .app-main { padding: 20px; } }

.error { color: #B91C1C; background: #FEF2F2; padding: 12px 14px; border-radius: var(--radius); font-size: 13px; margin: 12px 0; border: 1px solid #FECACA; }
.success { color: #047857; background: #ECFDF5; padding: 12px 14px; border-radius: var(--radius); font-size: 13px; margin: 12px 0; border: 1px solid #A7F3D0; }

/* ---------- Auth ---------- */
.auth-shell {
    min-height: 100vh; padding: 24px; position: relative;
    background: linear-gradient(135deg, #1A1B5C 0%, var(--tumbo-blue) 100%);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.auth-shell::before { content: ''; position: absolute; top: -250px; right: -250px; width: 700px; height: 700px; background: var(--tumbo-gradient); border-radius: 50%; filter: blur(140px); opacity: .35; }
.auth-shell::after { content: ''; position: absolute; bottom: -200px; left: -200px; width: 500px; height: 500px; background: var(--tumbo-gradient); border-radius: 50%; filter: blur(120px); opacity: .2; }
.auth-card { background: var(--surface); border-radius: var(--radius-xl); padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); position: relative; z-index: 1; }
.auth-brand { text-align: center; margin-bottom: 28px; }
.auth-brand img { height: 48px; margin-bottom: 14px; }
.auth-brand-sub { background: var(--tumbo-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: 4px; font-weight: 800; font-size: 12px; }
.auth-card h1 { text-align: center; font-size: 20px; margin-bottom: 8px; }
.auth-card .page-sub { text-align: center; }
.auth-links { text-align: center; margin-top: 16px; font-size: 13px; }

/* ---------- Inputs ---------- */
.input {
    display: block; width: 100%; min-height: 40px; padding: 9px 12px;
    border: 1px solid var(--ink-200); border-radius: var(--radius);
    background: var(--surface); color: var(--ink-900);
    font-size: 13px; font-family: inherit; transition: var(--t);
}
.input:hover { border-color: var(--ink-300); }
.input:focus { outline: none; border-color: var(--tumbo-blue); box-shadow: 0 0 0 3px rgba(43,45,142,.1); }
textarea.input { min-height: 100px; resize: vertical; line-height: 1.5; }
select.input { cursor: pointer; }

label { display: block; font-size: 11px; letter-spacing: .3px; text-transform: uppercase; font-weight: 600; color: var(--ink-500); margin: 14px 0 6px; }
.field { margin-bottom: 4px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin-right: 12px; color: var(--ink-700); cursor: pointer; }

/* ---------- Attachment pickers (mobile-friendly trio) ---------- */
.attach-buttons {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px;
}
.attach-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 14px; border-radius: var(--radius);
    background: var(--surface); color: var(--ink-700);
    border: 1px solid var(--ink-200); font-size: 13px; font-weight: 500;
    cursor: pointer; user-select: none; transition: var(--t);
    text-transform: none; letter-spacing: 0;
    margin: 0;
}
.attach-btn:hover { background: var(--ink-50); border-color: var(--tumbo-blue); color: var(--tumbo-blue); }
.attach-btn input[type=file], .hidden-input { display: none; }
@media (max-width: 640px) {
    .attach-btn { flex: 1 1 100%; justify-content: center; min-height: 44px; }
}

/* ---------- Buttons ---------- */
.btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 38px; padding: 9px 18px; border-radius: var(--radius);
    border: 0; background: var(--tumbo-blue); color: white;
    font-weight: 600; font-size: 13px; font-family: inherit; cursor: pointer;
    transition: var(--t);
    box-shadow: 0 1px 2px rgba(43,45,142,.2);
}
.btn-primary i { font-family: 'tabler-icons'; font-style: normal; font-size: 16px; }
.btn-primary:hover { background: var(--tumbo-blue-dark); box-shadow: 0 4px 12px rgba(43,45,142,.25); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 34px; padding: 7px 14px; border-radius: var(--radius);
    background: var(--surface); color: var(--ink-700);
    border: 1px solid var(--ink-200); font-weight: 500; font-size: 13px;
    cursor: pointer; transition: var(--t); font-family: inherit;
}
.btn-secondary i { font-family: 'tabler-icons'; font-style: normal; font-size: 14px; color: var(--ink-500); }
.btn-secondary:hover { background: var(--ink-50); border-color: var(--ink-300); }

/* ---------- Page header ---------- */
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-header .page-title h1 { margin-bottom: 2px; }

/* ============================================================
   DASHBOARD — matches pic 2 (Helpdesk Ticket Management)
   ============================================================ */
.kpi-row {
    display: grid; gap: 14px;
    grid-template-columns: repeat(6, 1fr);
    margin-bottom: 18px;
}
@media (max-width: 1100px) { .kpi-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px)  { .kpi-row { grid-template-columns: repeat(2, 1fr); } }

.kpi-card {
    background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line);
    overflow: hidden; transition: var(--t);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-head {
    background: var(--tumbo-blue); color: white;
    padding: 8px 14px; font-size: 12px; font-weight: 600; letter-spacing: .2px;
    text-align: center;
}
.kpi-card.kpi-accent .kpi-head { background: var(--tumbo-blue-light); }
.kpi-card.kpi-warn   .kpi-head { background: #F59E0B; }
.kpi-card.kpi-danger .kpi-head { background: #EF4444; }
.kpi-card.kpi-success .kpi-head { background: #10B981; }
.kpi-body {
    padding: 22px 14px; text-align: center;
}
.kpi-value { font-size: 36px; font-weight: 700; color: var(--ink-900); letter-spacing: -.02em; line-height: 1; }
.kpi-trend { margin-top: 6px; font-size: 11px; color: var(--ink-500); }

/* Dashboard chart panels - 3 in a row */
.chart-row {
    display: grid; gap: 14px;
    grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 980px) { .chart-row { grid-template-columns: 1fr; } }

.chart-panel {
    background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line);
    overflow: hidden;
}
.chart-panel-head {
    background: var(--tumbo-blue); color: white;
    padding: 10px 16px; font-size: 13px; font-weight: 600;
    text-align: center;
}
.chart-panel-body { padding: 20px; min-height: 260px; }

.bar-list { display: flex; flex-direction: column; gap: 18px; }
.bar-item .bar-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--ink-700); }
.bar-item .bar-value { font-weight: 700; color: var(--ink-900); }
.bar-item .bar-track { height: 10px; background: var(--ink-100); border-radius: 999px; overflow: hidden; }
.bar-item .bar-fill { height: 100%; background: var(--tumbo-blue); border-radius: 999px; transition: width .6s ease; }
.bar-item .bar-fill.c-1 { background: var(--tumbo-blue); }
.bar-item .bar-fill.c-2 { background: #6366F1; }
.bar-item .bar-fill.c-3 { background: #06B6D4; }
.bar-item .bar-fill.c-4 { background: #8B5CF6; }
.bar-item .bar-fill.c-5 { background: #14B8A6; }

.donut-wrap { position: relative; height: 220px; display: flex; align-items: center; justify-content: center; }
.donut-wrap canvas { max-height: 220px; max-width: 220px; }
.donut-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.donut-center .num { font-size: 28px; font-weight: 700; color: var(--ink-900); letter-spacing: -.02em; }
.donut-center .lbl { font-size: 11px; color: var(--ink-500); text-transform: uppercase; letter-spacing: .8px; }

.legend { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-700); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* ============================================================
   TICKETS LIST — matches pic 1 & pic 3
   ============================================================ */
.tickets-shell {
    display: grid; gap: 16px;
    grid-template-columns: 220px 1fr;
}
@media (max-width: 900px) { .tickets-shell { grid-template-columns: 1fr; } }

.tickets-sidebar {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius-lg); padding: 8px; height: fit-content;
}
.tickets-sidebar .search { padding: 4px; margin-bottom: 4px; }
.tickets-sidebar .search input { font-size: 13px; min-height: 36px; padding-left: 36px; background: var(--ink-50); border-color: transparent; }
.tickets-sidebar .search { position: relative; }
.tickets-sidebar .search::before { content: '\eb6b'; font-family: 'tabler-icons'; position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-400); pointer-events: none; }

.tickets-sidebar .group-label {
    padding: 12px 12px 4px; font-size: 10px; font-weight: 600;
    letter-spacing: 1.2px; text-transform: uppercase; color: var(--ink-400);
}
.filter-list { list-style: none; padding: 0; margin: 0 0 8px; }
.filter-list li button {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 12px; background: transparent; border: 0; border-radius: var(--radius-sm);
    font-family: inherit; font-size: 13px; color: var(--ink-700); font-weight: 500;
    cursor: pointer; text-align: left; transition: var(--t);
}
.filter-list li button:hover { background: var(--ink-100); color: var(--ink-900); }
.filter-list li button.active { background: var(--tumbo-blue-50); color: var(--tumbo-blue); font-weight: 600; }
.filter-list li button .ti { font-family: 'tabler-icons'; font-style: normal; font-size: 16px; width: 18px; text-align: center; color: var(--ink-500); }
.filter-list li button.active .ti { color: var(--tumbo-blue); }
.filter-list li button .count {
    margin-left: auto; font-size: 11px; font-weight: 600;
    color: var(--ink-500); background: transparent; padding: 0;
}
.filter-list li button.active .count { color: var(--tumbo-blue); }

/* Right pane = tickets table card */
.tickets-pane {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius-lg); overflow: hidden;
}
.tickets-toolbar {
    padding: 14px 18px; display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.tickets-toolbar .title { font-weight: 600; font-size: 14px; color: var(--ink-900); }
.tickets-toolbar .count-pill {
    background: var(--ink-100); color: var(--ink-600);
    padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
}
.tickets-toolbar .spacer { flex: 1; }

.table {
    width: 100%; border-collapse: collapse; font-size: 13px;
}
.table thead th {
    background: var(--ink-50); color: var(--ink-500);
    font-size: 10px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase;
    text-align: left; padding: 10px 16px;
    border-bottom: 1px solid var(--line);
}
.table tbody tr { border-bottom: 1px solid var(--line); transition: var(--t); }
.table tbody tr:hover { background: var(--ink-50); }
.table tbody tr:last-child { border-bottom: 0; }
.table tbody td { padding: 14px 18px; vertical-align: middle; color: var(--ink-700); }
.table .row-link { color: var(--ink-900); font-weight: 500; text-decoration: none; display: block; }
.table .row-link:hover { color: var(--tumbo-blue); text-decoration: none; }
.table .ref { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--ink-500); margin-top: 2px; display: block; }
.table .reqcell { display: flex; align-items: center; gap: 10px; }
.table .reqcell .who { min-width: 0; }
.table .reqcell .who-name { font-weight: 500; font-size: 13px; color: var(--ink-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table .reqcell .who-email { font-size: 11px; color: var(--ink-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Pills (status & severity) */
.pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 999px;
    font-size: 11px; font-weight: 600; letter-spacing: .1px;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill-new          { background: #EEF2FF; color: #4338CA; }
.pill-acknowledged { background: #DBEAFE; color: #1D4ED8; }
.pill-inprogress   { background: transparent; color: #92400E; border: 1px solid #FCD34D; }
.pill-delayed      { background: #FEE2E2; color: #B91C1C; }
.pill-onhold       { background: transparent; color: #475569; border: 1px solid #CBD5E1; }
.pill-resolved     { background: #D1FAE5; color: #047857; }
.pill-closed       { background: #E5E7EB; color: #374151; }

.sev {
    display: inline-flex; padding: 2px 8px; border-radius: 6px;
    font-size: 10px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase;
}
.sev-low      { background: var(--ink-100); color: var(--ink-700); }
.sev-medium   { background: #FEF3C7; color: #92400E; }
.sev-high     { background: #FED7AA; color: #9A3412; }
.sev-critical { background: #FEE2E2; color: #991B1B; }

/* ---------- Empty ---------- */
.empty {
    background: var(--surface); border: 1px dashed var(--ink-200); border-radius: var(--radius-lg);
    padding: 50px 24px; text-align: center; color: var(--ink-500);
}
.empty .empty-icon { font-family: 'tabler-icons'; font-style: normal; font-size: 44px; color: var(--ink-300); margin-bottom: 14px; display: block; }
.empty h3 { font-size: 15px; color: var(--ink-900); margin: 0 0 4px; font-weight: 600; }
.empty p { margin: 0 0 18px; font-size: 13px; }

/* Empty inside table */
.table-empty { padding: 60px 24px; text-align: center; color: var(--ink-500); }
.table-empty i { font-family: 'tabler-icons'; font-style: normal; font-size: 36px; color: var(--ink-300); display: block; margin-bottom: 10px; }

/* ---------- Ticket detail ---------- */
.detail-grid {
    display: grid; gap: 16px;
    grid-template-columns: 1fr 320px;
}
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.panel {
    background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--line);
    padding: 18px 20px; margin-bottom: 14px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-title { font-size: 11px; font-weight: 600; color: var(--ink-500); margin: 0; letter-spacing: 1px; text-transform: uppercase; }

.ref-big { font-family: 'JetBrains Mono', monospace; color: var(--ink-500); font-size: 12px; letter-spacing: .5px; margin-bottom: 4px; }
.kv { display: grid; grid-template-columns: 140px 1fr; row-gap: 10px; margin: 0; }
.kv dt { color: var(--ink-500); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.kv dd { margin: 0; font-size: 13px; color: var(--ink-900); }
.description { white-space: pre-wrap; word-wrap: break-word; line-height: 1.65; color: var(--ink-700); }

.attachment-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .attachment-grid { grid-template-columns: repeat(4, 1fr); } }
.attachment { background: var(--ink-50); border-radius: var(--radius); padding: 8px; text-align: center; color: var(--ink-700); text-decoration: none; border: 1px solid var(--line); transition: var(--t); }
.attachment:hover { border-color: var(--ink-300); }
.attachment img { width: 100%; height: 110px; object-fit: cover; border-radius: 8px; }
.attachment .file-icon { font-size: 32px; padding: 16px 0; color: var(--ink-400); }
.attachment .filename { font-size: 11px; margin-top: 4px; word-break: break-all; color: var(--ink-700); }

.status-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.note { padding: 14px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; }
.note:last-of-type { border-bottom: 0; }
.note-body-wrap { flex: 1; min-width: 0; }
.note-head { display: flex; gap: 8px; align-items: baseline; font-size: 12px; margin-bottom: 4px; }
.note-head strong { color: var(--ink-900); font-weight: 600; font-size: 13px; }
.note-body { white-space: pre-wrap; color: var(--ink-700); font-size: 13px; }
.note-internal { background: #FEF9C3; border-left: 3px solid #F59E0B; padding: 10px 12px; border-radius: 8px; }
.badge { background: var(--tumbo-blue); color: white; padding: 2px 8px; font-size: 9px; border-radius: 4px; font-weight: 700; letter-spacing: .5px; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 10px 0 10px 22px; border-bottom: 1px solid var(--line); font-size: 13px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: 4px; top: 16px; width: 7px; height: 7px; background: var(--tumbo-blue); border-radius: 50%; box-shadow: 0 0 0 3px white, 0 0 0 4px var(--ink-200); }
.timeline li:last-child { border-bottom: 0; }
.timeline .reason { color: var(--ink-500); font-size: 12px; margin-top: 4px; }

/* ---------- Admin ---------- */
.invite-form .input { margin-bottom: 10px; }
.role-grid { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; }

/* ---------- Validation ---------- */
.validation-message { color: #DC2626; font-size: 12px; margin-top: 4px; }

/* ---------- File list ---------- */
.file-list { list-style: none; padding: 0; margin: 10px 0; font-size: 13px; }
.file-list li { padding: 6px 0; color: var(--ink-700); display: flex; align-items: center; gap: 8px; }
.file-list li::before { content: '\eaff'; font-family: 'tabler-icons'; color: var(--ink-400); }

/* ---------- Blazor error UI ---------- */
#blazor-error-ui { background: #DC2626; color: white; padding: 14px 20px; position: fixed; bottom: 0; left: 0; right: 0; display: none; z-index: 100; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }

/* ---------- iOS safe area ---------- */
@supports (padding: max(0px)) {
    .app-topbar { padding-top: max(0px, env(safe-area-inset-top)); }
    .app-main { padding-bottom: max(28px, env(safe-area-inset-bottom)); }
}


/* ---------- Tickets toolbar polish ---------- */
.tickets-toolbar .title.accent {
    font-size: 16px; font-weight: 700; color: var(--tumbo-blue); letter-spacing: -.01em;
}
.tickets-toolbar .count-pill.brand {
    background: var(--tumbo-blue-50); color: var(--tumbo-blue);
}
.tickets-sidebar .group-label {
    color: var(--tumbo-blue); font-weight: 700;
}
.tickets-sidebar .group-label::before {
    content: ''; display: inline-block; width: 3px; height: 12px;
    background: var(--tumbo-gradient); margin-right: 8px; vertical-align: -2px; border-radius: 2px;
}

/* Topbar logo a touch bigger so it reads */
.app-topbar .brand img { height: 32px; }

/* Drawer section label with rainbow accent for the first section only */
.drawer-section-label.brand-section {
    color: var(--tumbo-blue); font-weight: 700;
}
.drawer-section-label.brand-section::before {
    content: ''; display: inline-block; width: 3px; height: 11px;
    background: var(--tumbo-gradient); margin-right: 8px; vertical-align: -1px; border-radius: 2px;
}


/* ============================================================
   Logo + tagline (topbar) - bigger logo + "Tumbo Helpdesk Platform"
   ============================================================ */
.app-topbar .brand {
    gap: 12px;
}
.app-topbar .brand img {
    height: 38px;
    width: auto;
    display: block;
}
.app-topbar .brand-tagline {
    color: var(--tumbo-blue);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -.01em;
    border-left: 1px solid var(--ink-200);
    padding-left: 12px;
    white-space: nowrap;
}
@media (max-width: 640px) {
    .app-topbar .brand-tagline { display: none; }
}

/* ============================================================
   Users management page
   ============================================================ */
.users-toolbar {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 14px 18px; margin-bottom: 14px;
    display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.users-toolbar .input { max-width: 260px; }
.users-toolbar .filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.users-toolbar .pill-btn {
    background: var(--surface); border: 1px solid var(--ink-200);
    border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 500;
    color: var(--ink-700); cursor: pointer; font-family: inherit;
}
.users-toolbar .pill-btn:hover { border-color: var(--ink-300); }
.users-toolbar .pill-btn.active {
    background: var(--tumbo-blue); color: white; border-color: var(--tumbo-blue);
}

.user-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 10px;
    display: grid; grid-template-columns: auto 1fr auto auto; gap: 16px; align-items: center;
    transition: var(--t);
}
.user-card:hover { box-shadow: var(--shadow); }
.user-card .role-chip {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    background: var(--tumbo-blue-50); color: var(--tumbo-blue);
    font-size: 11px; font-weight: 600; margin-right: 4px;
}
.user-card .area-chip {
    display: inline-block; padding: 2px 8px; border-radius: 6px;
    background: var(--ink-100); color: var(--ink-700);
    font-size: 11px; font-weight: 500; margin-right: 4px;
}
.user-card.inactive { opacity: .55; }
.user-card .status-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--status-resolved); display: inline-block;
}
.user-card.inactive .status-dot { background: var(--ink-300); }

/* ============================================================
   Report builder
   ============================================================ */
.report-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius-lg); padding: 22px; margin-bottom: 16px;
}
.report-grid {
    display: grid; gap: 14px;
    grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 900px) { .report-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .report-grid { grid-template-columns: 1fr; } }

.report-actions {
    margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.report-actions .export-group {
    margin-left: auto; display: flex; gap: 6px;
}

/* ============================================================
   Modal
   ============================================================ */
.modal-scrim {
    position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 60;
    display: flex; align-items: center; justify-content: center; padding: 20px;
    backdrop-filter: blur(4px);
}
.modal-card {
    background: var(--surface); border-radius: var(--radius-lg);
    width: 100%; max-width: 480px; box-shadow: var(--shadow-lg);
    max-height: 90vh; overflow-y: auto;
}
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line);
              display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-body { padding: 18px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line);
              display: flex; gap: 8px; justify-content: flex-end; }
