:root,
[data-theme="light"] {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --accent: #7c3aed;
    --accent-soft: #9333ea;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #6366f1;
    --bg: #f4f6fb;
    --card: #fff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --sidebar-bg: linear-gradient(180deg, #1e1b4b 0%, #312e81 55%, #4c1d95 100%);
    --sidebar-solid: #1e1b4b;
    --sidebar-hover: rgb(255 255 255 / 0.08);
    --sidebar-active: rgb(255 255 255 / 0.12);
    --surface-soft: #f8fafc;
    --table-head: #f8fafc;
    --table-hover: #f8fafc;
    --shadow: 0 1px 3px rgb(15 23 42 / 0.08);
    --shadow-lg: 0 10px 24px rgb(79 70 229 / 0.12);
    --radius: 12px;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --duration-fast: 0.18s;
    --duration-normal: 0.35s;
    --duration-slow: 0.55s;
    --chart-text: #64748b;
    --chart-grid: #e2e8f0;
}

[data-theme="dark"] {
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --accent: #a78bfa;
    --accent-soft: #c084fc;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #818cf8;
    --bg: #0b1020;
    --card: #151b32;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: #273149;
    --sidebar-bg: linear-gradient(180deg, #0f1428 0%, #1e1b4b 55%, #312e81 100%);
    --sidebar-solid: #0f1428;
    --sidebar-hover: rgb(255 255 255 / 0.06);
    --sidebar-active: rgb(255 255 255 / 0.1);
    --surface-soft: #1a2138;
    --table-head: #1a2138;
    --table-hover: #1c2440;
    --shadow: 0 1px 3px rgb(0 0 0 / 0.35);
    --shadow-lg: 0 12px 28px rgb(0 0 0 / 0.35);
    --chart-text: #94a3b8;
    --chart-grid: #334155;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: hidden; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
img, video, canvas, svg { max-width: 100%; height: auto; }
button, .btn, .nav-link, input, select, textarea { touch-action: manipulation; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; overflow-x: hidden; transition: background var(--duration-normal) var(--ease-out), color var(--duration-normal) var(--ease-out); }
a { color: var(--primary); text-decoration: none; }
.app-layout { display: flex; min-height: 100vh; width: 100%; max-width: 100%; overflow-x: hidden; }
.sidebar { width: 272px; flex-shrink: 0; align-self: flex-start; position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden; background: var(--sidebar-bg); color: #cbd5e1; padding: 1.5rem 1rem; display: flex; flex-direction: column; transition: width var(--duration-normal) var(--ease-out), padding var(--duration-normal) var(--ease-out); }
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 1.5rem; min-height: 52px; }
.sidebar-brand-main { display: flex; gap: 0.75rem; align-items: center; min-width: 0; flex: 1; }
.brand-text { overflow: hidden; white-space: nowrap; transition: opacity var(--duration-fast) var(--ease-out); min-width: 0; }
.brand-logo { width: 52px; height: 52px; object-fit: contain; flex-shrink: 0; border-radius: 50%; }
.brand-logo-lg { width: 128px; height: 128px; object-fit: contain; display: block; margin: 0 auto 1rem; }
.sidebar-brand strong { color: #fff; display: block; font-size: 0.95rem; letter-spacing: -0.01em; }
.sidebar-brand small { font-size: 0.7rem; opacity: 0.7; }
.sidebar-nav { flex: 1; }
.sidebar-nav .nav-link { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem; border-radius: 8px; color: #cbd5e1; margin-bottom: 0.25rem; transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out); }
.sidebar-nav .nav-link:hover, .sidebar-nav .nav-link.active { background: var(--sidebar-active); color: #fff; text-decoration: none; }
.sidebar-nav .nav-link:hover { transform: translateX(4px); }
.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex-shrink: 0; }
.nav-icon svg { width: 18px; height: 18px; display: block; }
.nav-text { white-space: nowrap; overflow: hidden; transition: opacity var(--duration-fast) var(--ease-out); }
.nav-section { display: block; margin: 1.25rem 0 0.5rem; padding: 0 0.75rem; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: rgb(255 255 255 / 0.45); white-space: nowrap; overflow: hidden; transition: opacity var(--duration-fast) var(--ease-out); }
.sidebar-footer { margin-top: auto; padding-top: 1rem; border-top: 1px solid #334155; }
.sidebar-user { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; font-size: 0.85rem; overflow: hidden; }
.sidebar-user-details { overflow: hidden; min-width: 0; transition: opacity var(--duration-fast) var(--ease-out); }
.sidebar-user-details small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-avatar { width: 32px; height: 32px; border-radius: 8px; background: rgb(255 255 255 / 0.15); font-size: 0.85rem; font-weight: 700; color: #fff; }
.sidebar-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; flex-shrink: 0; padding: 0;
    border: 1.5px solid rgb(167 139 250 / 0.45); border-radius: 8px;
    background: rgb(248 250 252 / 0.95); color: #1e1b4b;
    box-shadow: 0 0 0 1px rgb(124 58 237 / 0.15), inset 0 1px 0 rgb(255 255 255 / 0.8);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}
.sidebar-toggle:hover { background: #fff; border-color: rgb(196 181 253 / 0.8); transform: translateY(-1px); }
.sidebar-toggle-bars { display: flex; flex-direction: column; justify-content: center; gap: 3px; width: 13px; height: 11px; }
.sidebar-toggle-bars span { display: block; height: 1.5px; width: 100%; border-radius: 999px; background: currentColor; transition: transform var(--duration-fast) var(--ease-out), opacity var(--duration-fast) var(--ease-out); }
html.sidebar-collapsed .sidebar { width: 76px; padding: 1.25rem 0.65rem; }
html.sidebar-collapsed .brand-text,
html.sidebar-collapsed .nav-text,
html.sidebar-collapsed .sidebar-user-details { display: none; }
html.sidebar-collapsed .nav-section { display: none; }
html.sidebar-collapsed .sidebar-brand { flex-direction: column; align-items: center; gap: 0.75rem; }
html.sidebar-collapsed .sidebar-brand-main { justify-content: center; flex: none; }
html.sidebar-collapsed .sidebar-nav .nav-link { justify-content: center; padding: 0.65rem; }
html.sidebar-collapsed .sidebar-nav .nav-link:hover { transform: none; }
html.sidebar-collapsed .sidebar-user { justify-content: center; margin-bottom: 0; }
.role-badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600; margin-top: 0.25rem; }
.role-admin { background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; }
.role-agent { background: linear-gradient(135deg, #0891b2, #0d9488); color: #fff; }
.role-user { background: rgb(255 255 255 / 0.12); color: #cbd5e1; border: 1px solid rgb(255 255 255 / 0.15); }
.role-description { margin-top: 0.5rem; color: var(--muted); font-size: 0.875rem; }
.role-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }
.role-card { padding: 0.875rem 1rem; border-radius: 10px; border: 1px solid var(--border); background: var(--card); opacity: 0.65; transition: opacity var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
.role-card strong { display: block; margin-bottom: 0.35rem; font-size: 0.85rem; }
.role-card p { margin: 0; font-size: 0.78rem; color: var(--muted); line-height: 1.4; }
.role-card.active { opacity: 1; box-shadow: 0 0 0 2px var(--primary); border-color: var(--primary); }
.role-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-top: 1rem; }
.role-info-card { border-top: 3px solid var(--border); }
.role-info-user { border-top-color: #64748b; }
.role-info-agent { border-top-color: #0d9488; }
.role-info-admin { border-top-color: #7c3aed; }
.catalog-info { margin-bottom: 1rem; }
.field-hint-warn { color: var(--warning, #d97706); }
.main-content { flex: 1; min-width: 0; padding: 1.5rem 2rem; overflow-x: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.topbar-start { display: flex; align-items: center; gap: 0.75rem; min-width: 0; flex: 1; }
.topbar h1 { font-size: 1.5rem; margin-bottom: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-menu-toggle {
    display: none; align-items: center; justify-content: center;
    width: 42px; height: 42px; flex-shrink: 0; padding: 0;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--card); color: var(--text); cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}
.mobile-menu-toggle:hover { border-color: var(--primary); }
.sidebar-backdrop {
    display: none; position: fixed; inset: 0; z-index: 90;
    background: rgb(15 23 42 / 0.55); backdrop-filter: blur(2px);
}
html.sidebar-mobile-open .sidebar-backdrop { display: block; }
html.sidebar-mobile-open { overflow: hidden; }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; transition: background var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out); flex-shrink: 0; }
.theme-toggle:hover { border-color: var(--primary); transform: translateY(-1px); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }
.theme-toggle .theme-icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .theme-icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .theme-icon-moon { display: block; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; flex-wrap: wrap; gap: 0.75rem; }
.page-header-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.page-header p { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1rem; transition: box-shadow var(--duration-normal) var(--ease-out), transform var(--duration-normal) var(--ease-out), background var(--duration-normal) var(--ease-out), border-color var(--duration-normal) var(--ease-out); }
.card:hover { box-shadow: var(--shadow-lg); }
.chart-card { position: relative; overflow: hidden; }
.chart-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, #4f46e5, #7c3aed, #9333ea); }
.chart-wrap { position: relative; width: 100%; height: 240px; max-height: 240px; }
.chart-wrap canvas { display: block; width: 100% !important; height: 100% !important; max-height: 240px; }
.charts-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.dashboard-charts-top { display: grid; grid-template-columns: minmax(240px, 0.75fr) minmax(0, 1.25fr); gap: 1rem; margin-bottom: 1rem; }
.recent-tickets-card { position: relative; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.recent-tickets-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, #4f46e5, #7c3aed, #9333ea); }
.recent-tickets-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.recent-tickets-head h3 { margin-bottom: 0; font-size: 0.95rem; }
.recent-tickets-table-wrap { overflow: auto; flex: 1; }
.recent-tickets-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.recent-tickets-table th { text-align: left; padding: 0.5rem 0.65rem; color: var(--muted); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border); }
.recent-tickets-table td { padding: 0.65rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.recent-tickets-table tbody tr { cursor: pointer; transition: background var(--duration-fast) var(--ease-out); }
.recent-tickets-table tbody tr:hover { background: var(--table-hover); }
.recent-tickets-table td strong { display: block; font-size: 0.85rem; margin-bottom: 0.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.recent-tickets-table td small { color: var(--muted); font-size: 0.72rem; }
.recent-tickets-table .status { font-size: 0.72rem; white-space: nowrap; }
.stat-card { position: relative; overflow: hidden; background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--stat-accent, var(--primary)); border-radius: var(--radius); padding: 1rem 1rem 1rem 1.1rem; box-shadow: var(--shadow); transition: transform var(--duration-normal) var(--ease-out), box-shadow var(--duration-normal) var(--ease-out), background var(--duration-normal) var(--ease-out); }
.stat-card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, var(--stat-bg, rgb(79 70 229 / 0.08)) 0%, transparent 72%); pointer-events: none; }
.stat-card > * { position: relative; z-index: 1; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card span { display: block; font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-bottom: 0.35rem; }
.stat-card strong { display: block; font-size: 1.85rem; line-height: 1.1; color: var(--stat-accent, var(--primary)); }
.stat-card.stat-indigo { --stat-accent: #4f46e5; --stat-bg: rgb(79 70 229 / 0.14); }
.stat-card.stat-violet { --stat-accent: #7c3aed; --stat-bg: rgb(124 58 237 / 0.14); }
.stat-card.stat-purple { --stat-accent: #9333ea; --stat-bg: rgb(147 51 234 / 0.14); }
.stat-card.stat-cyan { --stat-accent: #0891b2; --stat-bg: rgb(8 145 178 / 0.14); }
.stat-card.stat-emerald { --stat-accent: #059669; --stat-bg: rgb(5 150 105 / 0.14); }
.stat-card.stat-amber { --stat-accent: #d97706; --stat-bg: rgb(217 119 6 / 0.14); }
.stat-card.stat-rose { --stat-accent: #e11d48; --stat-bg: rgb(225 29 72 / 0.14); }
.stat-card.primary { --stat-accent: #4f46e5; --stat-bg: rgb(79 70 229 / 0.14); }
.stat-card.info { --stat-accent: #7c3aed; --stat-bg: rgb(124 58 237 / 0.14); }
.stat-card.success { --stat-accent: #059669; --stat-bg: rgb(5 150 105 / 0.14); }
.stat-card.warning { --stat-accent: #d97706; --stat-bg: rgb(217 119 6 / 0.14); }
.stat-card.danger { --stat-accent: #dc2626; --stat-bg: rgb(220 38 38 / 0.14); }
[data-theme="dark"] .stat-card.stat-indigo { --stat-bg: rgb(129 140 248 / 0.16); }
[data-theme="dark"] .stat-card.stat-violet { --stat-bg: rgb(167 139 250 / 0.16); }
[data-theme="dark"] .stat-card.stat-purple { --stat-bg: rgb(192 132 252 / 0.16); }
[data-theme="dark"] .stat-card.stat-cyan { --stat-bg: rgb(34 211 238 / 0.12); }
[data-theme="dark"] .stat-card.stat-emerald { --stat-bg: rgb(52 211 153 / 0.14); }
[data-theme="dark"] .stat-card.stat-amber { --stat-bg: rgb(251 191 36 / 0.14); }
[data-theme="dark"] .stat-card.stat-rose { --stat-bg: rgb(251 113 133 / 0.14); }
[data-theme="dark"] .stat-card.primary { --stat-bg: rgb(129 140 248 / 0.16); }
[data-theme="dark"] .stat-card.info { --stat-bg: rgb(167 139 250 / 0.16); }
[data-theme="dark"] .stat-card.success { --stat-bg: rgb(52 211 153 / 0.14); }
[data-theme="dark"] .stat-card.warning { --stat-bg: rgb(251 191 36 / 0.14); }
[data-theme="dark"] .stat-card.danger { --stat-bg: rgb(248 113 113 / 0.14); }
.stat-card.danger strong, .stat-card.warning strong, .stat-card.success strong, .stat-card.primary strong { color: var(--stat-accent); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.charts-grid h3, .sector-card h3 { font-size: 0.95rem; margin-bottom: 1rem; }
.sector-bar { display: grid; grid-template-columns: 120px 1fr 36px; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; font-size: 0.85rem; }
.bar-track { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #4f46e5, #7c3aed); border-radius: 999px; transform-origin: left center; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; }
.form-control { width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: var(--card); color: var(--text); transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgb(79 70 229 / 0.15); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.55rem 1rem; border-radius: 8px; border: none; font: inherit; font-weight: 600; cursor: pointer; transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%); color: #fff; }
.btn-primary:hover { background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%); box-shadow: 0 6px 16px rgb(79 70 229 / 0.28); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; }
.btn-block { width: 100%; }
.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-success { background: rgb(5 150 105 / 0.12); color: #047857; border: 1px solid rgb(5 150 105 / 0.2); }
.alert-error { background: rgb(220 38 38 / 0.12); color: #991b1b; border: 1px solid rgb(220 38 38 / 0.2); }
.alert-warning { background: rgb(217 119 6 / 0.12); color: #92400e; border: 1px solid rgb(217 119 6 / 0.2); }
.alert-info { background: rgb(79 70 229 / 0.12); color: #4338ca; border: 1px solid rgb(79 70 229 / 0.2); }
[data-theme="dark"] .alert-success { color: #6ee7b7; }
[data-theme="dark"] .alert-error { color: #fca5a5; }
[data-theme="dark"] .alert-warning { color: #fcd34d; }
[data-theme="dark"] .alert-info { color: #c4b5fd; }
.sla-badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.sla-badge small { font-weight: 500; opacity: 0.85; }
.sla-ok { background: #dcfce7; color: #166534; }
.sla-warning { background: #fef3c7; color: #92400e; }
.sla-breached { background: #fee2e2; color: #991b1b; }
.sla-met { background: #dbeafe; color: #1e40af; }
.sla-paused { background: #e0f2fe; color: #075985; }
.sla-alert { font-weight: 600; }
.section-title { font-size: 1rem; margin: 1.5rem 0 0.5rem; }
.section-title:first-child { margin-top: 0; }
.section-desc, .field-hint { color: var(--muted); font-size: 0.85rem; margin-bottom: 1rem; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; font-weight: 600; }
.day-selector { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.day-chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.45rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 0.85rem; }
.day-chip:has(input:checked) { border-color: var(--primary); background: rgb(79 70 229 / 0.1); }
.sla-table-wrap { overflow-x: auto; margin-bottom: 1.5rem; }
.sla-table .form-control { max-width: 120px; }
.filters-card { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.filters-card .form-control { max-width: 160px; }
.table-card { padding: 0; overflow: hidden; }
.table-scroll-hint { display: none; padding: 0.5rem 1rem; font-size: 0.75rem; color: var(--muted); border-bottom: 1px solid var(--border); }
.tickets-grid-card .table-scroll-wrap {
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}
.tickets-grid-card .table-scroll-wrap:focus-visible { outline: 2px solid rgb(79 70 229 / 0.45); outline-offset: -2px; }
.table-card-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--table-head);
}
.table-card-meta { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.column-picker-wrap { position: relative; flex-shrink: 0; }
.column-picker-panel {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    z-index: 200;
    width: min(300px, calc(100vw - 2rem));
    max-height: min(360px, 70vh);
    overflow: auto;
    padding: 0.85rem;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgb(15 23 42 / 0.04);
    backdrop-filter: none;
}
[data-theme="dark"] .column-picker-panel {
    background: #151b32;
    border-color: #334155;
    box-shadow: 0 16px 40px rgb(0 0 0 / 0.55), 0 0 0 1px rgb(148 163 184 / 0.08);
}
.column-picker-title { margin: 0 0 0.35rem; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.column-picker-hint { margin: 0 0 0.75rem; font-size: 0.75rem; color: var(--muted); line-height: 1.4; }
.column-picker-list { display: flex; flex-direction: column; gap: 0.2rem; }
.column-picker-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    transition: border-color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}
.column-picker-row.is-dragging { opacity: 0.55; }
.column-picker-row.is-drop-target { border-color: rgb(79 70 229 / 0.35); background: rgb(79 70 229 / 0.06); }
.column-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: grab;
    flex-shrink: 0;
}
.column-drag-handle svg { width: 16px; height: 16px; display: block; }
.column-drag-handle:active { cursor: grabbing; }
.column-drag-handle:hover { background: var(--table-hover); color: var(--text); }
.column-picker-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex: 1;
    min-width: 0;
    padding: 0.35rem 0.25rem;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out);
}
.column-picker-row:hover .column-picker-item { background: var(--table-hover); }
.column-picker-item input { flex-shrink: 0; accent-color: var(--primary); }
.column-picker-item span { flex: 1; }
.column-picker-item small { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.column-picker-move { display: flex; flex-direction: column; gap: 0.15rem; flex-shrink: 0; }
.column-move-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1;
    cursor: pointer;
    transition: border-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out);
}
.column-move-btn:hover { border-color: var(--primary); color: var(--primary); background: rgb(79 70 229 / 0.06); }
.column-picker-actions { display: flex; justify-content: space-between; gap: 0.5rem; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.btn-icon { width: 14px; height: 14px; margin-right: 0.35rem; }
.tickets-grid { width: max-content; min-width: 100%; table-layout: auto; }
.tickets-grid th,
.tickets-grid td { white-space: nowrap; }
.tickets-grid .col-title { white-space: normal; min-width: 200px; max-width: 340px; }
.tickets-grid th[data-col],
.tickets-grid td[data-col] { transition: opacity var(--duration-fast) var(--ease-out); }
.tickets-grid .col-hidden { display: none; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--table-head); font-weight: 600; }
tbody tr { cursor: pointer; transition: background var(--duration-fast) var(--ease-out); }
tbody tr:hover { background: var(--table-hover); }
.badge { padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; }
.badge-incident { background: #fee2e2; color: #b91c1c; }
.badge-request { background: rgb(79 70 229 / 0.14); color: #4338ca; }
[data-theme="dark"] .badge-request { color: #c4b5fd; }
.badge-internal { background: #fef9c3; color: #a16207; font-size: 0.65rem; margin-left: 0.35rem; }
.status { padding: 0.15rem 0.45rem; border-radius: 6px; font-size: 0.75rem; font-weight: 600; }
.priority { font-weight: 700; font-size: 0.75rem; padding: 0.1rem 0.35rem; border-radius: 4px; color: #fff; }
.priority-P1 { background: #dc2626; } .priority-P2 { background: #ea580c; }
.priority-P3 { background: #ca8a04; } .priority-P4 { background: #64748b; }
.type-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.type-selector label input { position: absolute; opacity: 0; }
.type-card { border: 2px solid var(--border); border-radius: var(--radius); padding: 1.25rem; text-align: center; cursor: pointer; transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out); }
.type-card:hover { transform: translateY(-2px); }
.type-selector input:checked + .type-card { border-color: var(--primary); box-shadow: 0 0 0 3px rgb(79 70 229 / 0.15); transform: translateY(-2px); }
.type-card small { display: block; color: var(--muted); margin-top: 0.25rem; }
.priority-preview { background: var(--surface-soft); padding: 0.65rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
.ticket-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1rem; }
.chat-panel { padding: 0; display: flex; flex-direction: column; min-height: 480px; }
.chat-header { padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--border); font-weight: 600; display: flex; justify-content: space-between; }
.live { color: var(--success); font-size: 0.75rem; font-weight: 500; }
.live-dot { display: inline-block; animation: pulse-live 1.6s ease-in-out infinite; }
.chat-messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.85rem; max-height: 400px; }
.msg { display: flex; gap: 0.5rem; max-width: 82%; }
.msg-requester { align-self: flex-start; }
.msg-agent { align-self: flex-end; flex-direction: row-reverse; }
.msg-system { align-self: center; max-width: 100%; }
.msg-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; flex-shrink: 0; }
.msg-agent .msg-avatar { background: var(--success); }
.msg-bubble { background: var(--surface-soft); border-radius: 12px; padding: 0.6rem 0.85rem; font-size: 0.9rem; }
.msg-agent .msg-bubble { background: rgb(79 70 229 / 0.12); }
[data-theme="dark"] .msg-agent .msg-bubble { background: rgb(129 140 248 / 0.16); }
.msg-system .msg-bubble { background: transparent; color: var(--muted); font-size: 0.8rem; text-align: center; }
.msg-internal .msg-bubble { border-left: 3px solid #eab308; }
.msg-head { font-size: 0.72rem; font-weight: 600; margin-bottom: 0.2rem; display: flex; gap: 0.4rem; align-items: center; }
.msg-head time { color: var(--muted); font-weight: 400; margin-left: auto; }
.chat-input { border-top: 1px solid var(--border); padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.reply-visibility { display: flex; flex-direction: column; gap: 0.4rem; }
.reply-option { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.55rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 0.82rem; color: var(--muted); transition: border-color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out); }
.reply-option input { margin-top: 0.15rem; flex-shrink: 0; }
.reply-option strong { color: var(--text); }
.reply-option:has(input:checked) { border-color: var(--primary); background: rgb(79 70 229 / 0.06); }
.reply-internal:has(input:checked) { border-color: #eab308; background: rgb(234 179 8 / 0.08); }
.chat-closed { padding: 1rem; text-align: center; color: var(--muted); border-top: 1px solid var(--border); }
.info-card h4, .actions-card h4 { margin-bottom: 0.75rem; font-size: 0.9rem; }
.info-card dl { font-size: 0.85rem; }
.info-card dt { color: var(--muted); margin-top: 0.5rem; }
.info-card dd { font-weight: 600; }
.actions-card form { margin-bottom: 0.75rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.actions-card .form-control { margin-bottom: 0.4rem; }
.actions-form .form-field { margin-bottom: 0.75rem; }
.actions-form label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 0.2rem; }
.actions-form .field-current { margin: 0 0 0.35rem; font-size: 0.78rem; color: var(--muted); }
.actions-form .btn { width: 100%; }
.actions-card .close-form { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.attachments-card h4 { margin-bottom: 0.75rem; font-size: 0.9rem; }
.attachment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.attachment-link { display: block; padding: 0.55rem 0.65rem; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: inherit; transition: border-color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out); }
.attachment-link:hover { border-color: var(--primary); background: rgb(79 70 229 / 0.05); }
.attachment-name { display: block; font-size: 0.85rem; font-weight: 600; word-break: break-word; }
.attachment-meta { display: block; margin-top: 0.15rem; font-size: 0.75rem; color: var(--muted); }
.file-input { padding: 0.45rem; }
.status-table-card { padding: 0; overflow: hidden; }
.status-table-card .table-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); }
.status-table-card .table-page-size, .status-table-card .table-search { display: flex; align-items: center; gap: 0.45rem; font-size: 0.82rem; color: var(--muted); margin: 0; }
.status-table-card .form-control-sm { width: auto; min-width: 4.5rem; padding: 0.25rem 0.45rem; font-size: 0.82rem; }
.status-table-card .table-search .form-control-sm { min-width: 10rem; }
.status-table-card table { margin: 0; }
.status-table-card tbody tr { cursor: default; }
.status-table-card tbody tr:hover { background: var(--table-hover); }
.status-color-cell { display: inline-flex; align-items: center; gap: 0.55rem; }
.status-color-box { display: inline-block; width: 2rem; height: 1.35rem; border-radius: 6px; border: 1px solid rgb(15 23 42 / 0.12); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12); }
.status-color-code { font-size: 0.78rem; font-weight: 600; color: var(--muted); font-family: ui-monospace, monospace; }
.pill { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.pill-primary { background: rgb(79 70 229 / 0.14); color: #4338ca; }
.pill-success { background: #d1fae5; color: #047857; }
.pill-muted { background: var(--surface-soft); color: var(--muted); }
.pill-dark { background: #1e293b; color: #fff; }
[data-theme="dark"] .pill-dark { background: #334155; }
.actions-cell { display: flex; gap: 0.35rem; align-items: center; }
.inline-form { display: inline; margin: 0; }
.btn-icon { min-width: 2rem; padding: 0.25rem 0.45rem; line-height: 1.2; }
.table-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem; align-items: center; padding: 0.85rem 1rem; border-top: 1px solid var(--border); font-size: 0.82rem; color: var(--muted); }
.table-pagination { display: flex; gap: 0.35rem; align-items: center; }
.status-flag-grid { display: grid; gap: 0.35rem; margin: 0.75rem 0 1rem; }
.color-field { display: flex; align-items: center; gap: 0.5rem; }
.form-control-color { width: 2.75rem; height: 2.35rem; padding: 0.15rem; border: 1px solid var(--border); border-radius: 8px; background: var(--card); cursor: pointer; }
.color-hex { flex: 1; font-family: ui-monospace, monospace; font-size: 0.85rem; }
.ticket-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.ticket-sub { color: var(--muted); font-size: 0.9rem; margin-bottom: 1rem; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }
.modal-dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; max-width: 480px; width: calc(100% - 2rem); background: var(--card); color: var(--text); box-shadow: var(--shadow-lg); }
.modal-dialog::backdrop { background: rgb(15 23 42 / 0.45); }
.modal-dialog h3 { margin-bottom: 1rem; font-size: 1.1rem; }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }
.auth-body { min-height: 100vh; min-height: 100dvh; margin: 0; background: #f8fafc; overflow-x: hidden; overflow-y: auto; max-width: 100%; }
.auth-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; max-width: 100%; overflow-x: hidden; align-items: stretch; }
.auth-shell-single { grid-template-columns: 1fr; }
.auth-panel { min-height: 100vh; min-height: 100dvh; max-width: 100%; overflow-x: hidden; }
.auth-panel-form {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(1.75rem, 5vh, 3rem) 2.75rem 2.25rem;
    background: #fff;
    overflow-y: auto;
}
.auth-form-wrap { width: 100%; max-width: 480px; margin-top: clamp(0rem, 2vh, 1.5rem); }
.auth-brand-row { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 1.5rem; }
.brand-logo-auth { width: 64px; height: 64px; object-fit: contain; flex-shrink: 0; }
.auth-brand-text span { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.15rem; }
.auth-brand-text strong { font-size: 1.55rem; color: #312e81; line-height: 1.1; }
.auth-intro { margin-bottom: 1.25rem; }
.auth-intro h1 { font-size: 1.85rem; line-height: 1.2; margin-bottom: 0.5rem; color: #0f172a; }
.auth-intro p { color: var(--muted); font-size: 1rem; line-height: 1.6; }
.auth-password-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.35rem; }
.auth-password-row label { margin-bottom: 0; }
.auth-forgot-link { font-size: 0.82rem; font-weight: 600; color: var(--primary); white-space: nowrap; }
.auth-back-link { margin-top: 1.25rem; font-size: 0.88rem; text-align: center; }
.auth-back-link a { color: var(--muted); font-weight: 600; }
.auth-back-link a:hover { color: var(--primary); }

.pwa-install-hint {
  position: relative;
  margin: 0 0 1rem;
  padding: 0.9rem 2.4rem 0.9rem 0.9rem;
  background: rgb(79 70 229 / 0.08);
  border: 1px solid rgb(79 70 229 / 0.22);
  border-radius: var(--radius);
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text);
}

.pwa-install-hint__close {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 0.4rem;
  cursor: pointer;
  padding: 0;
}

.pwa-install-hint__close svg { width: 1rem; height: 1rem; }

.pwa-install-hint__close:hover {
  color: var(--text);
  background: rgb(0 0 0 / 0.05);
}

.pwa-install-hint__head {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.55rem;
}

.pwa-install-hint__icon {
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  color: var(--primary);
}

.pwa-install-hint__icon svg { width: 1.15rem; height: 1.15rem; }

.pwa-install-hint__title {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.pwa-install-hint__sub {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.pwa-install-hint__steps {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.pwa-install-hint__steps li { margin-bottom: 0.2rem; }
.pwa-install-hint__steps li:last-child { margin-bottom: 0; }
.pwa-install-hint__steps strong { color: var(--text); font-weight: 600; }

[data-theme="dark"] .pwa-install-hint {
  background: rgb(129 140 248 / 0.1);
  border-color: rgb(129 140 248 / 0.25);
}

[data-theme="dark"] .pwa-install-hint__close:hover {
  background: rgb(255 255 255 / 0.06);
}

.auth-form .form-group { margin-bottom: 1.15rem; }
.auth-logout-form { margin-top: 1rem; text-align: center; }
.auth-form label { font-size: 0.82rem; color: #334155; margin-bottom: 0.45rem; }
.input-icon-wrap { position: relative; }
.input-icon { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: #94a3b8; pointer-events: none; }
.input-icon svg { width: 18px; height: 18px; display: block; }
.auth-input { padding-left: 2.65rem; min-height: 52px; border-radius: 10px; border-color: #dbeafe; background: #f8fafc; font-size: 0.95rem; }
.auth-input:focus { background: #fff; border-color: #6366f1; box-shadow: 0 0 0 4px rgb(99 102 241 / 0.12); }
.input-icon-wrap .form-control.auth-input { padding-right: 2.75rem; }
.auth-code-input { padding-left: 1rem; text-align: center; letter-spacing: 0; font-weight: 700; }
.auth-honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.auth-security-check { padding: 0.85rem; border: 1px solid rgb(79 70 229 / 0.18); border-radius: 8px; background: rgb(79 70 229 / 0.06); }
.auth-captcha-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px; align-items: center; gap: 0.75rem; }
.auth-captcha-row span { font-weight: 700; color: var(--text); }
.mfa-secret-field { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; text-align: left; letter-spacing: 0; }
.mfa-uri-field { min-height: 86px; resize: vertical; font-size: 0.8rem; word-break: break-all; }
@media (max-width: 520px) {
    .auth-captcha-row { grid-template-columns: 1fr; }
}
.input-icon-wrap .input-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: #94a3b8;
  padding: 0;
  transition: color 0.15s, background 0.15s;
}
.input-icon-wrap .input-eye:hover { color: #475569; background: rgb(15 23 42 / 0.05); }
.input-icon-wrap .input-eye:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(99 102 241 / 0.12); }
.password-eye-icon { display: block; overflow: visible; }
.password-eye-pupil {
    transform-box: fill-box;
    transform-origin: center;
    transform: scale(0);
    opacity: 0;
    transition: transform 0.32s var(--ease-out), opacity 0.22s var(--ease-out);
}
.password-eye-slash {
    opacity: 1;
    stroke-dasharray: 22;
    stroke-dashoffset: 0;
    transition: opacity 0.2s ease, stroke-dashoffset 0.32s var(--ease-out);
}
.password-eye-lid {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    opacity: 1;
    transform-box: fill-box;
    transform-origin: 12px 12px;
    transform: translateY(1px);
    transition: transform 0.38s var(--ease-out), opacity 0.28s ease;
}
.input-eye[aria-pressed="true"] .password-eye-pupil {
    transform: scale(1);
    opacity: 1;
}
.input-eye[aria-pressed="true"] .password-eye-slash {
    opacity: 0;
    stroke-dashoffset: 22;
}
.input-eye[aria-pressed="true"] .password-eye-lid {
    transform: translateY(-6px) scaleY(0.2);
    opacity: 0;
}
.input-eye.is-animating[aria-pressed="true"] .password-eye-pupil {
    animation: password-eye-open 0.48s var(--ease-out);
}
.input-eye.is-animating[aria-pressed="true"] .password-eye-contour {
    animation: password-eye-blink 0.48s var(--ease-out);
}
@keyframes password-eye-open {
    0% { transform: scale(0) translateY(3px); opacity: 0; }
    55% { transform: scale(1.18) translateY(0); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes password-eye-blink {
    0%, 100% { transform: scaleY(1); }
    35% { transform: scaleY(0.72); }
    55% { transform: scaleY(1.06); }
}
.input-group { position: relative; display: flex; }
.input-group .form-control { padding-right: 2.75rem; }
.input-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: #94a3b8;
  padding: 0;
  transition: color 0.15s, background 0.15s;
}
.input-eye:hover { color: #475569; background: rgb(15 23 42 / 0.05); }
.input-eye:focus-visible { outline: none; box-shadow: 0 0 0 3px rgb(99 102 241 / 0.12); }
.btn-auth-submit { width: 100%; min-height: 52px; margin-top: 0.5rem; border: none; border-radius: 10px; color: #fff; font-weight: 700; font-size: 1rem; background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #9333ea 100%); box-shadow: 0 10px 24px rgb(79 70 229 / 0.28); gap: 0.55rem; }
.btn-auth-submit:hover { background: linear-gradient(135deg, #4338ca 0%, #6d28d9 55%, #7e22ce 100%); box-shadow: 0 14px 28px rgb(79 70 229 / 0.34); transform: translateY(-1px); }
.btn-auth-submit svg { width: 18px; height: 18px; }
.auth-active-session {
    margin-bottom: 1.25rem; padding: 0.9rem 1rem; border-radius: 10px;
    background: rgb(79 70 229 / 0.08); border: 1px solid rgb(79 70 229 / 0.22);
}
.auth-active-session p { margin: 0 0 0.65rem; font-size: 0.88rem; color: var(--text); }
.auth-active-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.auth-panel-showcase { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 3rem 4rem; color: #fff; background: linear-gradient(145deg, #1e1b4b 0%, #312e81 38%, #5b21b6 72%, #7c3aed 100%); }
.auth-showcase-glow { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.45; pointer-events: none; }
.auth-showcase-glow-a { width: 280px; height: 280px; top: -40px; right: -60px; background: #22d3ee; }
.auth-showcase-glow-b { width: 220px; height: 220px; bottom: 10%; left: -40px; background: #a855f7; }
.auth-showcase-content { position: relative; z-index: 1; width: 100%; max-width: 560px; }
.auth-showcase-tag { display: inline-block; padding: 0.25rem 0.65rem; border-radius: 999px; background: rgb(255 255 255 / 0.12); border: 1px solid rgb(255 255 255 / 0.18); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 1.25rem; }
.auth-showcase-content h2 { font-size: clamp(1.85rem, 2.8vw, 2.65rem); line-height: 1.15; margin-bottom: 1rem; }
.auth-showcase-lead { color: rgb(255 255 255 / 0.82); font-size: 1.05rem; line-height: 1.65; margin-bottom: 2rem; max-width: 42ch; }
.auth-feature-list { list-style: none; display: grid; gap: 1rem; }
.auth-feature-list li { display: flex; gap: 1rem; align-items: flex-start; padding: 1rem 0; border-top: 1px solid rgb(255 255 255 / 0.14); }
.auth-feature-list li:first-child { border-top: none; padding-top: 0; }
.auth-feature-icon { flex-shrink: 0; width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 800; background: rgb(255 255 255 / 0.12); border: 1px solid rgb(255 255 255 / 0.16); }
.auth-feature-list strong { display: block; font-size: 0.95rem; margin-bottom: 0.2rem; }
.auth-feature-list span { display: block; font-size: 0.86rem; line-height: 1.5; color: rgb(255 255 255 / 0.78); }
.brand-logo-lg { width: 128px; height: 128px; object-fit: contain; display: block; margin: 0 auto 1rem; }

[data-theme="dark"] .auth-panel-form { background: var(--card); }
[data-theme="dark"] .auth-intro h1,
[data-theme="dark"] .auth-brand-text strong { color: var(--text); }
[data-theme="dark"] .auth-input { background: var(--surface-soft); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .sla-met { background: rgb(79 70 229 / 0.18); color: #c4b5fd; }
[data-theme="dark"] .sla-ok { background: rgb(52 211 153 / 0.14); color: #6ee7b7; }
[data-theme="dark"] .sla-warning { background: rgb(251 191 36 / 0.14); color: #fcd34d; }
[data-theme="dark"] .sla-breached { background: rgb(248 113 113 / 0.14); color: #fca5a5; }
[data-theme="dark"] .sla-paused { background: rgb(129 140 248 / 0.14); color: #c4b5fd; }

@keyframes logo-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
@keyframes fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slide-down {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes bar-grow {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}
@keyframes pulse-live {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}
@keyframes msg-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.animate-ready .main-content { animation: fade-in var(--duration-normal) var(--ease-out) both; }
.animate-ready .page-header,
.animate-ready .topbar h1 { animation: fade-up var(--duration-slow) var(--ease-out) both; }
.animate-ready .stat-card { animation: fade-up var(--duration-slow) var(--ease-out) both; }
.animate-ready .stat-card:nth-child(1) { animation-delay: 0.04s; }
.animate-ready .stat-card:nth-child(2) { animation-delay: 0.08s; }
.animate-ready .stat-card:nth-child(3) { animation-delay: 0.12s; }
.animate-ready .stat-card:nth-child(4) { animation-delay: 0.16s; }
.animate-ready .stat-card:nth-child(5) { animation-delay: 0.2s; }
.animate-ready .stat-card:nth-child(6) { animation-delay: 0.24s; }
.animate-ready .stat-card:nth-child(7) { animation-delay: 0.28s; }
.animate-ready .stat-card:nth-child(8) { animation-delay: 0.32s; }
.animate-ready .stat-card:nth-child(9) { animation-delay: 0.36s; }
.animate-ready .charts-grid .card,
.animate-ready .dashboard-charts-top .card,
.animate-ready .sector-card,
.animate-ready .filters-card,
.animate-ready .table-card,
.animate-ready .ticket-layout > .card,
.animate-ready .ticket-sidebar .card { animation: fade-up var(--duration-slow) var(--ease-out) both; animation-delay: 0.18s; }
.animate-ready .alert { animation: slide-down var(--duration-normal) var(--ease-out) both; }
.animate-ready .auth-panel-form { animation: fade-in var(--duration-normal) var(--ease-out) both; }
.animate-ready .auth-panel-showcase { animation: fade-in 0.7s var(--ease-out) both; animation-delay: 0.08s; }
.animate-ready .brand-logo-auth { animation: logo-float 4s ease-in-out infinite; }
.animate-ready .auth-feature-list li { animation: fade-up 0.55s var(--ease-out) both; }
.animate-ready .auth-feature-list li:nth-child(1) { animation-delay: 0.15s; }
.animate-ready .auth-feature-list li:nth-child(2) { animation-delay: 0.25s; }
.animate-ready .auth-feature-list li:nth-child(3) { animation-delay: 0.35s; }
.animate-ready .auth-feature-list li:nth-child(4) { animation-delay: 0.45s; }
.animate-ready .bar-fill { animation: bar-grow 0.9s var(--ease-out) both; }
.animate-ready .msg { animation: msg-in 0.4s var(--ease-out) both; }
.animate-ready tbody tr { animation: fade-up 0.45s var(--ease-out) both; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .sidebar-nav .nav-link:hover,
    .stat-card:hover,
    .btn:hover,
    tbody tr:hover,
    .type-card:hover { transform: none; }
}

@media (max-width: 900px) {
    .mobile-menu-toggle { display: inline-flex; }
    .app-layout { flex-direction: row; }
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
        width: min(288px, 88vw); height: 100vh; height: 100dvh;
        padding-top: max(1.5rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
        padding-left: max(1rem, env(safe-area-inset-left));
        transform: translateX(-105%);
        transition: transform var(--duration-normal) var(--ease-out);
        box-shadow: 8px 0 32px rgb(0 0 0 / 0.25);
    }
    html.sidebar-mobile-open .sidebar { transform: translateX(0); }
    html.sidebar-collapsed .sidebar { width: min(288px, 88vw); padding: 1.5rem 1rem; transform: translateX(-105%); }
    html.sidebar-mobile-open.sidebar-collapsed .sidebar { transform: translateX(0); }
    html.sidebar-collapsed .brand-text,
    html.sidebar-collapsed .nav-text,
    html.sidebar-collapsed .sidebar-user-details,
    html.sidebar-collapsed .nav-section { display: block; }
    html.sidebar-collapsed .nav-text { display: inline; }
    html.sidebar-collapsed .sidebar-nav .nav-link { justify-content: flex-start; padding: 0.6rem 0.75rem; }
    html.sidebar-collapsed .sidebar-brand { flex-direction: row; align-items: center; }
    html.sidebar-collapsed .sidebar-brand-main { justify-content: flex-start; flex: 1; }
    html.sidebar-collapsed .sidebar-user { justify-content: flex-start; }
    .sidebar-nav .nav-link { min-height: 44px; }
    .sidebar-toggle { display: none; }
    .main-content {
        width: 100%;
        padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    }
    .topbar h1 { font-size: 1.15rem; }
    .page-header { flex-direction: column; align-items: stretch; }
    .page-header .btn, .page-header-actions { width: 100%; }
    .page-header .btn { justify-content: center; }
    .page-header-actions { display: flex; flex-wrap: wrap; }
    .page-header-actions .btn { flex: 1; min-width: 0; }
    .charts-grid, .dashboard-charts-top, .report-charts-grid, .ticket-layout, .form-row, .type-selector, .report-filters-row { grid-template-columns: 1fr; }
    .auth-shell { grid-template-columns: 1fr; min-height: 100dvh; }
    .auth-panel-form {
        order: 1;
        min-height: 100dvh;
        align-items: center;
        justify-content: center;
        padding: 2rem 1.25rem max(2.5rem, env(safe-area-inset-bottom));
        overflow-y: visible;
    }
    .auth-form-wrap { margin-top: 0; }
    .auth-panel-showcase { display: none; }
    .auth-showcase-content { max-width: none; }
    .auth-showcase-content h2 { font-size: 1.55rem; }
    .auth-feature-list { gap: 0.5rem; }
    .auth-brand-text strong { font-size: 1.35rem; word-break: break-word; }
    .auth-intro h1 { font-size: 1.45rem; }
    .auth-showcase-glow-a { width: 180px; right: -80px; }
    .auth-showcase-glow-b { width: 160px; left: -60px; }
    .form-control, .auth-input, select.form-control, textarea.form-control { font-size: 16px; }
    .filters-card { flex-direction: column; align-items: stretch; }
    .filters-card .form-control { max-width: none; width: 100%; }
    .filters-card .btn { width: 100%; }
    .report-filters-actions { flex-direction: column; }
    .report-filters-actions .btn { width: 100%; flex: none; min-width: 0; }
    .report-per-page-form { width: 100%; justify-content: space-between; }
    .report-per-page-form .form-control { flex: 1; max-width: none; }
    .report-table-card .table-scroll-hint { display: block; }
    .table-card-toolbar { flex-direction: column; align-items: stretch; gap: 0.65rem; }
    .table-scroll-hint { display: block; }
    .tickets-grid-card .table-scroll-wrap,
    .table-card .table-scroll-wrap,
    .report-table-card .table-scroll-wrap,
    .recent-tickets-table-wrap,
    .status-table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .status-table-card .table-toolbar,
    .status-table-card .table-footer { flex-direction: column; align-items: stretch; }
    .status-table-card .table-search .form-control-sm { width: 100%; min-width: 0; }
    .table-card-meta { font-size: 0.78rem; }
    .ticket-detail h2 { font-size: 1.2rem; line-height: 1.35; word-break: break-word; }
    .ticket-sidebar .card + .card { margin-top: 0.75rem; }
    .actions-form .btn { width: 100%; }
    .chat-panel { min-height: 360px; }
    .chat-messages { max-height: min(50vh, 420px); }
    .chat-input .btn { width: 100%; }
    .msg { max-width: 92%; }
    .msg-head { flex-wrap: wrap; }
    .msg-head time { margin-left: 0; width: 100%; }
    .sector-bar { grid-template-columns: 1fr; gap: 0.25rem; }
    .sector-bar .bar-track { order: 2; }
    .modal-dialog { width: calc(100vw - 1.5rem); max-width: none; max-height: calc(100dvh - 2rem); overflow-y: auto; margin: auto; }
    .stats-grid, .report-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-card strong { font-size: 1.45rem; }
    .btn, .theme-toggle, .mobile-menu-toggle { min-height: 44px; }
    .btn-sm { min-height: 38px; }
    th, td { padding: 0.65rem 0.75rem; font-size: 0.82rem; }
    .chart-wrap-tall { height: 240px; max-height: 240px; }
}

@media (max-width: 480px) {
    .main-content {
        padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
    }
    .topbar { margin-bottom: 0.85rem; gap: 0.5rem; }
    .topbar h1 { font-size: 1rem; }
    .card { padding: 1rem; border-radius: 10px; }
    .stats-grid, .report-summary-grid { grid-template-columns: 1fr; }
    .chart-wrap { height: 200px; max-height: 200px; }
    .chart-wrap-tall { height: 200px; max-height: 200px; }
    .type-selector { gap: 0.65rem; }
    .type-card { padding: 1rem; }
    .ticket-meta { flex-wrap: wrap; gap: 0.35rem; }
    .ticket-sub { font-size: 0.82rem; word-break: break-word; }
    .reply-option { font-size: 0.78rem; }
    .reply-visibility { flex-direction: column; }
    .actions-cell { flex-wrap: wrap; }
    .table-pagination { width: 100%; justify-content: center; flex-wrap: wrap; }
    .recent-tickets-table td strong { max-width: 140px; }
    .column-picker-panel {
        position: fixed; left: 0.75rem; right: 0.75rem; bottom: max(0.75rem, env(safe-area-inset-bottom)); top: auto;
        width: auto; max-height: min(70dvh, 480px);
    }
    .role-info-grid { grid-template-columns: 1fr; }
    .auth-panel-form { padding: 1.5rem 1rem max(2rem, env(safe-area-inset-bottom)); }
    .report-status-grid { flex-direction: column; align-items: flex-start; }
    .report-chip-list { flex-direction: column; align-items: flex-start; }
    .report-breakdown-card .report-chip { width: 100%; justify-content: space-between; }
}

.report-filters-card { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 1.5rem; }
.report-filters-section { padding-top: 0.25rem; }
.report-filters-section + .report-filters-section { border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 0.5rem; }
.report-filters-row { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.report-filters-row .form-control { max-width: none; }
.report-search-field { min-width: 200px; }
.report-status-grid { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-bottom: 0.5rem; }
.report-status-option { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; cursor: pointer; }
.report-filters-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.report-summary-grid { margin-top: 0.5rem; }
.report-breakdown-card { margin-bottom: 1.5rem; }
.report-breakdown-card h3 { margin: 0 0 0.75rem; font-size: 1rem; }
.report-chip-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.report-chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.65rem; border: 1px solid var(--border); border-radius: 999px; font-size: 0.85rem; background: var(--table-head); }
.report-table-card .table-scroll-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.report-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.report-table th, .report-table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.report-table .col-title { white-space: normal; min-width: 180px; max-width: 280px; }
.report-charts-grid { margin-bottom: 1.5rem; }
.report-chart-wide { grid-column: 1 / -1; }
.chart-wrap-tall { height: 280px; }
.report-per-page-form { display: flex; align-items: center; gap: 0.5rem; }
.report-per-page-form .form-control { max-width: 120px; }
.report-pagination-bar { justify-content: center; }
.report-page-indicator { font-size: 0.85rem; color: var(--muted); font-weight: 600; padding: 0 0.35rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.report-hint-card p { margin: 0; color: var(--muted); }
