/* =====================================================================
   IT Helpdesk – corporate design system
   One brand blue, neutral slate surfaces, navy sidebar.
   Colour is used only where it carries meaning (status, priority, SLA).
   Light + dark themes via data-bs-theme.
   ===================================================================== */

:root, [data-bs-theme=light] {
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --primary: #1f4fd8; --primary-rgb: 31,79,216;
  --primary-dark: #1a3fae;
  --grad: var(--primary);                       /* kept for compatibility: solid brand colour */
  --grad-soft: rgba(31,79,216,.08);
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef1f5;
  --border: #e3e7ee;
  --text: #111827;
  --muted: #64748b;
  --sidebar-bg: #ffffff;
  --sidebar-fg: #475569;
  --sidebar-strong: #0f172a;
  --sidebar-muted: #94a3b8;
  --sidebar-hover: #f1f5f9;
  --sidebar-active-bg: rgba(31,79,216,.08);
  --sidebar-active-fg: #1f4fd8;
  --sidebar-border: #e3e7ee;
  --glass: rgba(244,246,249,.85);
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow-md: 0 8px 24px -12px rgba(16,24,40,.18);
  --shadow-glow: 0 1px 2px rgba(16,24,40,.12);
  --radius: 12px; --radius-sm: 8px;
  --bs-body-bg: var(--surface);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-secondary-color: var(--muted);
  --bs-tertiary-bg: var(--surface-2);
  --bs-link-color: #1f4fd8; --bs-link-color-rgb: 31,79,216;
  --bs-link-hover-color: #1a3fae; --bs-link-hover-color-rgb: 26,63,174;
  --bs-font-sans-serif: var(--font);
  --bs-border-radius: 8px;
  color-scheme: light;
}
[data-bs-theme=dark] {
  --primary: #3b6ef0; --primary-rgb: 59,110,240;
  --grad-soft: rgba(59,110,240,.14);
  --bg: #0b1120;
  --surface: #111827;
  --surface-2: #162032;
  --surface-3: #1e293b;
  --border: #263247;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --sidebar-bg: #0a101e;
  --sidebar-fg: #94a3b8;
  --sidebar-strong: #ffffff;
  --sidebar-muted: #64748b;
  --sidebar-hover: rgba(255,255,255,.05);
  --sidebar-active-bg: rgba(255,255,255,.08);
  --sidebar-active-fg: #ffffff;
  --sidebar-border: rgba(255,255,255,.06);
  --glass: rgba(11,17,32,.85);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 10px 28px -12px rgba(0,0,0,.6);
  --bs-body-bg: var(--surface);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-secondary-color: var(--muted);
  --bs-tertiary-bg: var(--surface-2);
  --bs-link-color: #8fb0ff; --bs-link-color-rgb: 143,176,255;
  --bs-link-hover-color: #b3c9ff; --bs-link-hover-color-rgb: 179,201,255;
  --bs-secondary-bg: var(--surface-2);
  color-scheme: dark;
}

/* ---------- base */
body { font-family: var(--font); font-size: .875rem; color: var(--text); background: var(--bg); min-height: 100vh; }
a { text-decoration: none; }
::selection { background: rgba(var(--primary-rgb), .2); }
h1, h2, h3, h4, h5, h6 { letter-spacing: -.01em; }
.text-muted { color: var(--muted) !important; }
code { color: var(--text); background: var(--surface-3); padding: .1em .35em; border-radius: 4px; }
.app { display: flex; min-height: 100vh; }

/* ---------- sidebar */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 248px; z-index: 1040;
  background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border);
  color: var(--sidebar-fg); display: flex; flex-direction: column; overflow: hidden;
  transition: width .2s ease, transform .2s ease;
}
.brand { display: flex; align-items: center; gap: .7rem; height: 64px; padding: 0 1.1rem; color: var(--sidebar-strong); white-space: nowrap; border-bottom: 1px solid var(--sidebar-border); }
.brand-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--primary); display: grid; place-items: center; font-size: 1.1rem; color: #fff; flex-shrink: 0; }
.brand-text { font-weight: 700; font-size: .98rem; line-height: 1.15; overflow: hidden; }
.brand-text small { display: block; font-weight: 400; font-size: .7rem; color: var(--sidebar-fg); margin-top: 2px; }
.sidebar nav { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--sidebar-border) transparent; }
.nav-list { list-style: none; padding: .5rem .65rem 1.5rem; margin: 0; }
.nav-section { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sidebar-muted); padding: 1rem .75rem .35rem; font-weight: 600; white-space: nowrap; }
.nav-list .nav-link {
  position: relative; display: flex; align-items: center; gap: .75rem; padding: .55rem .75rem; color: var(--sidebar-fg);
  border-radius: 6px; margin-bottom: 2px; font-size: .855rem; font-weight: 500; white-space: nowrap; transition: background .15s, color .15s;
}
.nav-list .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-list .nav-link:hover { background: var(--sidebar-hover); color: var(--sidebar-strong); }
.nav-list .nav-link.active { color: var(--sidebar-active-fg); background: var(--sidebar-active-bg); font-weight: 600; }
.nav-list .nav-link .badge { background: #dc2626; color: #fff; font-size: .66rem; padding: .25em .5em; }
.sidebar-collapsed .nav-list .nav-link .badge { position: absolute; top: 4px; right: 10px; }
.nav-list .nav-link.active::before { content: ""; position: absolute; left: -.65rem; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
[data-bs-theme=dark] .nav-list .nav-link .badge { background: #dc2626; color: #fff; font-size: .66rem; padding: .25em .5em; }
.sidebar-collapsed .nav-list .nav-link .badge { position: absolute; top: 4px; right: 10px; }
.nav-list .nav-link.active::before { background: #60a5fa; }
.sidebar-foot { padding: .75rem; border-top: 1px solid var(--sidebar-border); }
.sidebar-foot .help-card { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: 6px; color: var(--sidebar-fg); font-size: .78rem; white-space: nowrap; background: var(--sidebar-hover); }
.sidebar-foot .help-card i { font-size: 1.1rem; color: var(--primary); }
.sidebar-foot .help-card:hover { color: var(--sidebar-strong); }
.sidebar-backdrop { display: none; }

@media (min-width: 992px) {
  .sidebar-collapsed .sidebar { width: 72px; }
  .sidebar-collapsed .brand { justify-content: center; padding: 0; }
  .sidebar-collapsed .brand-text, .sidebar-collapsed .nav-link span, .sidebar-collapsed .help-card span { display: none; }
  .sidebar-collapsed .nav-section { font-size: 0; padding: .5rem 0; }
  .sidebar-collapsed .nav-section::after { content: ""; display: block; height: 1px; margin: 0 .8rem; background: var(--sidebar-border); }
  .sidebar-collapsed .nav-list .nav-link, .sidebar-collapsed .help-card { justify-content: center; padding-left: 0; padding-right: 0; }
  .sidebar-collapsed .main { margin-left: 72px; }
}

/* ---------- main + top bar */
.main { flex: 1; margin-left: 248px; display: flex; flex-direction: column; min-width: 0; transition: margin-left .2s ease; }
.topbar {
  height: 64px; display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem; position: sticky; top: 0; z-index: 1030;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-search { position: relative; align-items: center; width: 380px; max-width: 42vw; }
.topbar-search > i { position: absolute; left: 12px; color: var(--muted); }
.topbar-search input { padding: .5rem 2.6rem .5rem 2.2rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
.topbar-search kbd { position: absolute; right: 9px; font-family: var(--font); font-size: .68rem; padding: .1rem .4rem; border-radius: 4px; background: var(--surface); color: var(--muted); border: 1px solid var(--border); box-shadow: none; }
.btn-icon { width: 36px; height: 36px; border-radius: 8px; display: inline-grid; place-items: center; font-size: 1.1rem; color: var(--muted); border: 1px solid transparent; background: transparent; transition: background .15s, color .15s; }
.btn-icon:hover { color: var(--text); background: var(--surface-3); }
.btn-icon:focus-visible { outline: 2px solid rgba(var(--primary-rgb), .5); }
.notif-dot { position: absolute; top: 1px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; font-size: .6rem; line-height: 17px; border-radius: 9px; background: #dc2626; color: #fff; font-weight: 600; box-shadow: 0 0 0 2px var(--surface); }
.theme-toggle .bi-sun { display: none; }
[data-bs-theme=dark] .theme-toggle .bi-sun { display: inline; }
[data-bs-theme=dark] .theme-toggle .bi-moon-stars { display: none; }
.notif-menu { width: 360px; max-width: 92vw; border-radius: 10px; overflow: hidden; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: flex; gap: .7rem; padding: .7rem 1rem; border-bottom: 1px solid var(--border); color: inherit; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: rgba(var(--primary-rgb), .06); }
.notif-item .ni-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; background: var(--grad-soft); color: var(--primary); }
.user-btn { border: 0; background: transparent; padding: .25rem .5rem .25rem .25rem; border-radius: 8px; color: var(--text); }
.user-btn:hover { background: var(--surface-3); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #334155; color: #fff; display: inline-grid; place-items: center; font-size: .72rem; font-weight: 600; flex-shrink: 0; }
.avatar.sm { width: 26px; height: 26px; font-size: .62rem; }
.dropdown-menu { border: 1px solid var(--border); border-radius: 10px; padding: .35rem; box-shadow: var(--shadow-md); background: var(--surface); }
.dropdown-item { border-radius: 6px; padding: .45rem .7rem; font-size: .85rem; }
.content { padding: 1.5rem; flex: 1; }
.app-footer { padding: 1rem 1.5rem; font-size: .75rem; color: var(--muted); border-top: 1px solid var(--border); }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; }
.page-title { font-size: 1.4rem; font-weight: 700; margin: 0; }
.page-subtitle { color: var(--muted); margin: .25rem 0 0; font-size: .85rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- buttons */
.btn { border-radius: 8px; font-weight: 500; }
.btn-sm { border-radius: 6px; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-dark); --bs-btn-hover-border-color: var(--primary-dark); --bs-btn-active-bg: var(--primary-dark); --bs-btn-active-border-color: var(--primary-dark); --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary); }
.btn-outline-primary { --bs-btn-color: var(--primary); --bs-btn-border-color: rgba(var(--primary-rgb), .5); --bs-btn-hover-bg: var(--primary); --bs-btn-hover-border-color: var(--primary); --bs-btn-active-bg: var(--primary); }
.btn-outline-secondary { --bs-btn-color: var(--text); --bs-btn-border-color: var(--border); --bs-btn-hover-bg: var(--surface-3); --bs-btn-hover-color: var(--text); --bs-btn-hover-border-color: var(--border); --bs-btn-active-bg: var(--surface-3); --bs-btn-active-color: var(--text); background: var(--surface); }
.btn-link { font-weight: 500; }

/* ---------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header {
  background: transparent; border-bottom: 1px solid var(--border); padding: .85rem 1.1rem; font-weight: 600; font-size: .9rem;
  border-radius: var(--radius) var(--radius) 0 0 !important; display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
.card-header .bi { color: var(--muted); }
.card-footer { background: transparent; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius) !important; }
.list-group { --bs-list-group-bg: transparent; --bs-list-group-border-color: var(--border); --bs-list-group-action-hover-bg: var(--surface-2); --bs-list-group-active-bg: rgba(var(--primary-rgb), .08); --bs-list-group-active-color: var(--primary); --bs-list-group-active-border-color: var(--border); }
.list-group-item.active { font-weight: 600; box-shadow: inset 3px 0 0 var(--primary); }

/* stat cards – restrained palette: brand blue for volume, semantic colours for outcomes */
.stat-card { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; height: 100%; color: inherit; transition: border-color .15s, box-shadow .15s; }
a.stat-card:hover { border-color: rgba(var(--primary-rgb), .35); box-shadow: var(--shadow-md); }
.stat-icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; font-size: 1.15rem; flex-shrink: 0; background: rgba(var(--c), .1); color: rgb(var(--c)); }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; font-feature-settings: "tnum"; }
.stat-label { color: var(--muted); font-size: .76rem; margin-top: 2px; }
.si-blue, .si-indigo, .si-cyan { --c: 31,79,216; }
.si-slate, .si-purple { --c: 71,85,105; }
.si-amber, .si-orange { --c: 180,110,10; }
.si-green { --c: 21,128,61; }
.si-red { --c: 200,30,30; }
[data-bs-theme=dark] .si-blue, [data-bs-theme=dark] .si-indigo, [data-bs-theme=dark] .si-cyan { --c: 120,160,255; }
[data-bs-theme=dark] .si-slate, [data-bs-theme=dark] .si-purple { --c: 160,174,200; }
[data-bs-theme=dark] .si-amber, [data-bs-theme=dark] .si-orange { --c: 234,179,60; }
[data-bs-theme=dark] .si-green { --c: 74,200,120; }
[data-bs-theme=dark] .si-red { --c: 248,113,113; }
.chart-box { position: relative; height: 260px; }

/* banners */
.hero-card, .kb-hero { color: var(--text); border: 1px solid rgba(var(--primary-rgb), .15); border-radius: var(--radius); background: #eef3ff; }
[data-bs-theme=dark] .hero-card, [data-bs-theme=dark] .kb-hero { background: rgba(var(--primary-rgb), .1); border-color: rgba(var(--primary-rgb), .25); }
.hero-card .opacity-75, .kb-hero .opacity-75 { opacity: 1 !important; color: var(--muted); }
.kb-hero { padding: 1.75rem 1.5rem; }
.kb-hero .form-control { border: 1px solid var(--border); padding: .75rem 1rem .75rem 2.6rem; font-size: .95rem; border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.kb-search-wrap { position: relative; max-width: 640px; }
.kb-search-wrap > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #64748b; z-index: 2; }
.success-mark { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: rgba(21,128,61,.12); color: #15803d; font-size: 2.2rem; }
.ticket-number-box { display: inline-block; padding: .9rem 1.75rem; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.ticket-number-box .num { font-size: 1.7rem; font-weight: 700; color: var(--primary); }

/* ---------- badges (one colour var, works in both themes) */
.badge-status, .badge-priority, .sla-pill {
  display: inline-flex; align-items: center; gap: .35em; font-weight: 600; font-size: .7rem; padding: .32em .6em; border-radius: 6px; white-space: nowrap;
  background: rgba(var(--c), .1); color: rgb(var(--c));
}
.badge-status .bi { font-size: .7rem; }
.badge-priority .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.bs-primary { --c: 31,79,216; } .bs-indigo { --c: 67,56,202; } .bs-warning { --c: 161,98,7; } .bs-orange { --c: 194,65,12; }
.bs-success { --c: 21,128,61; } .bs-dark { --c: 71,85,105; } .bs-danger { --c: 200,30,30; } .bs-secondary { --c: 71,85,105; }
.bp-danger { --c: 200,30,30; } .bp-warning { --c: 194,65,12; } .bp-info { --c: 3,105,161; } .bp-secondary { --c: 71,85,105; }
.sla-on_track, .sla-met { --c: 21,128,61; } .sla-at_risk { --c: 161,98,7; } .sla-overdue, .sla-breached { --c: 200,30,30; }
[data-bs-theme=dark] .bs-dark, [data-bs-theme=dark] .bs-secondary, [data-bs-theme=dark] .bp-secondary { --c: 160,174,200; }
[data-bs-theme=dark] .bs-warning, [data-bs-theme=dark] .sla-at_risk { --c: 234,179,60; }
[data-bs-theme=dark] .bs-orange, [data-bs-theme=dark] .bp-warning { --c: 251,146,60; }
[data-bs-theme=dark] .bs-danger, [data-bs-theme=dark] .bp-danger, [data-bs-theme=dark] .sla-overdue, [data-bs-theme=dark] .sla-breached { --c: 248,113,113; }
[data-bs-theme=dark] .bs-success, [data-bs-theme=dark] .sla-on_track, [data-bs-theme=dark] .sla-met { --c: 74,200,120; }
[data-bs-theme=dark] .bs-primary, [data-bs-theme=dark] .bs-indigo { --c: 130,165,255; }
[data-bs-theme=dark] .bp-info { --c: 96,180,240; }
.badge { font-weight: 600; }
.text-indigo { color: #4338ca !important; } .text-orange { color: #c2410c !important; }
.escalated-flag { color: #c81e1e; font-size: .8rem; }
.cat-chip { display: inline-flex; align-items: center; gap: .35rem; background: var(--surface-3); color: var(--text); border-radius: 6px; padding: .2rem .55rem; font-size: .72rem; font-weight: 600; }

/* ---------- tables */
.table { margin-bottom: 0; --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-hover-bg: var(--surface-2); --bs-table-hover-color: var(--text); --bs-table-border-color: var(--border); }
.table > thead th { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; padding: .7rem .8rem; }
.table > tbody td { padding: .7rem .8rem; vertical-align: middle; }
.table > tbody tr:last-child td { border-bottom: 0; }
.card > .table-responsive:first-child thead th:first-child { border-top-left-radius: var(--radius); }
.card > .table-responsive:first-child thead th:last-child { border-top-right-radius: var(--radius); }
.ticket-no { font-weight: 600; color: var(--primary); white-space: nowrap; font-feature-settings: "tnum"; }
[data-bs-theme=dark] .ticket-no { color: #8fb0ff; }
.filter-bar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem; margin-bottom: 1rem; }
.filter-bar .form-select, .filter-bar .form-control { font-size: .84rem; }
.quick-tabs { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.quick-tabs a { padding: .55rem 0; color: var(--muted); font-size: .84rem; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.quick-tabs a:hover { color: var(--text); }
.quick-tabs a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.quick-tabs a .count { background: var(--surface-3); color: var(--muted); border-radius: 10px; padding: 0 .45rem; margin-left: .35rem; font-size: .7rem; font-weight: 600; }
.quick-tabs a.active .count { background: rgba(var(--primary-rgb), .1); color: var(--primary); }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.4rem; opacity: .45; }
.pagination { --bs-pagination-bg: var(--surface); --bs-pagination-border-color: var(--border); --bs-pagination-color: var(--text); --bs-pagination-hover-bg: var(--surface-2); --bs-pagination-active-bg: var(--primary); --bs-pagination-active-border-color: var(--primary); --bs-pagination-disabled-bg: var(--surface); }
.progress { background: var(--surface-3); }

/* ---------- forms */
.form-label { font-weight: 500; font-size: .8rem; color: var(--text); }
.form-control, .form-select { border-color: var(--border); border-radius: 8px; background-color: var(--surface); color: var(--text); }
.form-control-sm, .form-select-sm { border-radius: 6px; }
.form-control:focus, .form-select:focus { border-color: rgba(var(--primary-rgb), .6); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .12); background-color: var(--surface); color: var(--text); }
.form-control[readonly], .form-control.bg-light { background-color: var(--surface-2) !important; }
.input-group-text { background: var(--surface-2); border-color: var(--border); color: var(--muted); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .12); }
.btn-check:checked + .btn-outline-primary, .btn-check:checked + .btn-outline-secondary { background: var(--primary); border-color: var(--primary); color: #fff; }
.req::after { content: " *"; color: #c81e1e; }
.priority-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.priority-picker input { display: none; }
.priority-picker label { border: 1px solid var(--border); border-radius: 8px; padding: .65rem .4rem; text-align: center; cursor: pointer; font-weight: 600; font-size: .85rem; background: var(--surface); transition: border-color .15s, background .15s; }
.priority-picker label:hover { border-color: rgba(var(--primary-rgb), .4); }
.priority-picker label small { display: block; font-weight: 400; font-size: .7rem; color: var(--muted); margin-top: 1px; }
.priority-picker .p-danger { --c: 200,30,30; } .priority-picker .p-warning { --c: 194,65,12; } .priority-picker .p-info { --c: 3,105,161; } .priority-picker .p-secondary { --c: 71,85,105; }
.priority-picker input:checked + label { border-color: rgb(var(--c)); background: rgba(var(--c), .07); color: rgb(var(--c)); box-shadow: inset 0 0 0 1px rgb(var(--c)); }
.dropzone { border: 1px dashed #c3cad6; border-radius: 8px; padding: 1.1rem; text-align: center; color: var(--muted); cursor: pointer; background: var(--surface-2); transition: border-color .15s, background .15s; }
[data-bs-theme=dark] .dropzone { border-color: var(--border); }
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: rgba(var(--primary-rgb), .04); }
.file-chip { display: inline-flex; align-items: center; gap: .4rem; background: var(--surface-3); border-radius: 6px; padding: .25rem .55rem; font-size: .76rem; margin: .2rem; }

/* ---------- ticket detail */
.detail-list { margin: 0; }
.detail-list dt { font-size: .7rem; text-transform: uppercase; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.detail-list dd { margin-bottom: .85rem; }
.ticket-desc { line-height: 1.65; }
.timeline { position: relative; padding-left: 2.4rem; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 4px; bottom: 4px; width: 1px; background: var(--border); }
.tl-item { position: relative; margin-bottom: 1.1rem; }
.tl-icon { position: absolute; left: -2.4rem; top: 0; width: 31px; height: 31px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; background: var(--surface); color: rgb(var(--c)); border: 1px solid var(--border); }
.tl-event { font-size: .84rem; color: var(--muted); padding-top: .35rem; }
.tl-event strong { color: var(--text); font-weight: 600; }
.tl-time { font-size: .72rem; color: var(--muted); }
.tl-note { font-size: .8rem; background: var(--surface-2); border-left: 2px solid var(--border); padding: .35rem .65rem; margin-top: .3rem; border-radius: 0 6px 6px 0; color: var(--text); }
.comment-card { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.comment-card.staff { border-left: 3px solid var(--primary); }
.comment-card.internal { background: rgba(202,138,4,.06); border-color: rgba(202,138,4,.3); border-left: 3px solid #ca8a04; }
.comment-head { display: flex; align-items: center; gap: .5rem; padding: .55rem .85rem; border-bottom: 1px solid var(--border); font-size: .82rem; }
.comment-body { padding: .7rem .85rem; line-height: 1.6; }
.attach-link { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--border); border-radius: 6px; padding: .35rem .6rem; font-size: .79rem; margin: .2rem .3rem .2rem 0; background: var(--surface); color: var(--text); }
.attach-link:hover { border-color: rgba(var(--primary-rgb), .5); color: var(--primary); }
.sla-progress { height: 6px; }
.reply-tabs { border-bottom: 0; }
.reply-tabs .nav-link { font-size: .84rem; font-weight: 500; color: var(--muted); border: 0; border-bottom: 2px solid transparent; background: transparent !important; }
.reply-tabs .nav-link.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.kb-card { display: block; color: inherit; height: 100%; transition: border-color .15s, box-shadow .15s; }
.kb-card:hover { border-color: rgba(var(--primary-rgb), .4); box-shadow: var(--shadow-md); }
.kb-content { line-height: 1.7; }
.kb-content ol, .kb-content ul { padding-left: 1.3rem; }
.kb-content li { margin-bottom: .3rem; }

/* ---------- modals, alerts, misc */
.modal-content { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: 0 24px 48px -16px rgba(0,0,0,.35); }
.modal-header, .modal-footer { border-color: var(--border); }
.alert { border-radius: 8px; }
.toast { border-radius: 8px; }
.nav-tabs { --bs-nav-tabs-border-color: var(--border); }
.bg-white { background-color: var(--surface) !important; }
.bg-light { background-color: var(--surface-2) !important; }
.text-bg-light { background-color: var(--surface-3) !important; color: var(--text) !important; }
.table-light { --bs-table-bg: var(--surface-2); --bs-table-color: var(--text); --bs-table-border-color: var(--border); }
.border { border-color: var(--border) !important; }

/* ---------- login: the page is a support ticket, the sign-in panel is its stub */
.login-body {
  background-color: #f4f7fd;
  background-image:
    linear-gradient(rgba(31,79,216,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31,79,216,.05) 1px, transparent 1px);
  background-size: 32px 32px;
}
[data-bs-theme=dark] .login-body { background-color: var(--bg); background-image: linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px); }
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.login-ticket {
  --notch: 16px;
  position: relative; display: grid; grid-template-columns: 1.15fr .85fr; width: 100%; max-width: 1120px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: 0 30px 60px -30px rgba(15,35,95,.35), 0 2px 6px rgba(15,35,95,.05);
}
.lt-info { padding: 2.5rem 2.75rem 2rem; background: #eef3ff; border-radius: 20px 0 0 20px; display: flex; flex-direction: column; }
[data-bs-theme=dark] .lt-info { background: var(--surface-2); }
.lt-title { font-size: clamp(1.7rem, 2.6vw, 2.25rem); font-weight: 700; line-height: 1.18; margin: 1.75rem 0 .6rem; letter-spacing: -.02em; }
.lt-title span { color: var(--primary); }
.login-photo { margin: 1rem auto .75rem; width: 100%; max-width: 500px; text-align: right; }
.login-photo img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; object-position: center 55%; mix-blend-mode: multiply; } /* white background takes the panel colour */
.login-photo figcaption { font-size: .62rem; color: var(--muted); opacity: .8; margin-top: .15rem; }
[data-bs-theme=dark] .login-photo img { mix-blend-mode: normal; background: #fff; border-radius: 14px; }
.lt-steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); padding: 0; margin: auto 0 0; position: relative; }
.lt-steps::before { content: ""; position: absolute; top: 14px; left: 12.5%; right: 12.5%; height: 2px; background: repeating-linear-gradient(90deg, rgba(var(--primary-rgb), .35) 0 6px, transparent 6px 11px); }
.lt-steps li { position: relative; display: flex; flex-direction: column; align-items: center; gap: .4rem; font-size: .76rem; font-weight: 600; color: var(--muted); }
.lt-steps li span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid rgba(var(--primary-rgb), .35); color: var(--primary); font-size: .78rem; font-weight: 700; }
.lt-steps li:last-child span { background: var(--primary); border-color: var(--primary); color: #fff; }

/* the stub: dashed tear line with punched notches */
.lt-stub { position: relative; display: flex; flex-direction: column; border-left: 2px dashed #cdd8f2; }
[data-bs-theme=dark] .lt-stub { border-left-color: var(--border); }
.lt-stub::before, .lt-stub::after { content: ""; position: absolute; left: calc(var(--notch) * -1 - 1px); width: calc(var(--notch) * 2); height: calc(var(--notch) * 2); border-radius: 50%; background: #f4f7fd; border: 1px solid var(--border); }
.lt-stub::before { top: calc(var(--notch) * -1 - 1px); clip-path: inset(50% 0 0 0); }
.lt-stub::after { bottom: calc(var(--notch) * -1 - 1px); clip-path: inset(0 0 50% 0); }
[data-bs-theme=dark] .lt-stub::before, [data-bs-theme=dark] .lt-stub::after { background: var(--bg); }
.lt-stub-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; padding: 1.4rem 2.25rem 0; }
.lt-code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .72rem; letter-spacing: .12em; color: var(--muted); }
.desk-status { white-space: nowrap; display: inline-flex; align-items: center; gap: .45rem; font-size: .76rem; font-weight: 600; padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); }
.desk-status small { font-weight: 400; color: var(--muted); }
.desk-status i { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.desk-status.is-open { color: #15803d; border-color: rgba(21,128,61,.25); background: rgba(21,128,61,.06); }
.desk-status.is-open i { background: #16a34a; box-shadow: 0 0 0 0 rgba(22,163,74,.5); animation: deskPulse 2s infinite; }
.desk-status.is-closed { color: var(--muted); }
@keyframes deskPulse { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.45); } 70% { box-shadow: 0 0 0 7px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
.lt-stub-body { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 1.5rem 2.25rem; }
.lt-stub-body h2 { font-size: 1.6rem; letter-spacing: -.02em; }
.lt-stub-body .form-control { padding: .65rem .85rem; }
.lt-stub-body .form-control::placeholder { color: #a7b1c2; }
.lt-stub-foot { display: flex; gap: .6rem; align-items: center; margin: 0 2.25rem; padding: 1rem 0 1.4rem; border-top: 1px solid var(--border); font-size: .78rem; color: var(--muted); }
.lt-stub-foot i { color: var(--primary); font-size: 1rem; }
.login-copy { margin: 1.25rem 0 0; font-size: .75rem; color: var(--muted); }
/* login: fit exactly to the window – no page scroll on desktop/laptop screens */
.login-wrap { height: 100vh; height: 100dvh; min-height: 540px; padding: clamp(.75rem, 3vh, 2rem) 1.25rem; }
.login-ticket { height: 100%; max-height: 780px; }
.lt-info { min-height: 0; padding: clamp(1.25rem, 4vh, 2.5rem) clamp(1.5rem, 3vw, 2.75rem) clamp(1rem, 3vh, 2rem); }
.lt-title { margin: clamp(.75rem, 3vh, 1.75rem) 0 .5rem; font-size: clamp(1.5rem, min(2.6vw, 4.2vh), 2.25rem); }
.login-photo { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: clamp(.25rem, 1.5vh, 1rem) auto; max-width: none; }
.login-photo img { width: auto; height: 100%; max-width: min(100%, 520px); min-height: 0; flex: 1 1 auto; }
.login-photo figcaption { align-self: flex-end; flex: none; }
.lt-steps { flex: none; margin-top: 0; }
.lt-stub-body { min-height: 0; padding-top: clamp(.75rem, 3vh, 1.5rem); padding-bottom: clamp(.75rem, 3vh, 1.5rem); }
.login-copy { margin-top: clamp(.4rem, 1.5vh, 1.25rem); flex: none; }
@media (max-height: 700px) and (min-width: 992px) {
  .lt-info > p { display: none; }
  .lt-stub-body h2 { font-size: 1.35rem; }
  .lt-stub-body p.mb-4 { margin-bottom: 1rem !important; }
  .lt-stub-body .mb-3, .lt-stub-body .mb-4 { margin-bottom: .75rem !important; }
}
/* sign-up: same ticket language, single card; page may scroll on short screens */
.signup-wrap { height: auto; min-height: 100vh; min-height: 100dvh; }
.signup-card { width: 100%; max-width: 760px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 30px 60px -30px rgba(15,35,95,.35), 0 2px 6px rgba(15,35,95,.05); }
.signup-card .lt-stub-head { padding-bottom: 1.1rem; border-bottom: 2px dashed #cdd8f2; }
[data-bs-theme=dark] .signup-card .lt-stub-head { border-bottom-color: var(--border); }
.signup-body { padding: 1.75rem 2.25rem .5rem; }
.signup-card .lt-stub-foot { margin-top: 1.25rem; }
.lt-signup { text-align: center; font-size: .85rem; color: var(--muted); margin-top: 1rem; }
/* sign-up: compact spacing on shorter screens so the whole card fits the window */
@media (max-height: 860px) and (min-width: 576px) {
  .signup-wrap { padding-top: .75rem; padding-bottom: .75rem; }
  .signup-card .lt-stub-head { padding: .85rem 2rem .75rem; }
  .signup-body { padding: 1rem 2rem .25rem; }
  .signup-body h1 { font-size: 1.4rem; }
  .signup-body > p.mb-4 { margin-bottom: .85rem !important; font-size: .84rem; }
  .signup-body .row.g-3 { --bs-gutter-y: .6rem; }
  .signup-body .form-label { margin-bottom: .2rem; }
  .signup-body .form-control, .signup-body .form-select { padding-top: .42rem; padding-bottom: .42rem; }
  .signup-body .pw-hint { display: none; }
  .signup-body .btn.mt-4 { margin-top: 1rem !important; }
  .signup-card .lt-stub-foot { margin-top: .6rem; padding: .65rem 0 .8rem; }
  .signup-wrap .login-copy { margin-top: .4rem; }
}
@media (max-height: 680px) and (min-width: 576px) {
  .signup-card .brand-icon { width: 30px; height: 30px; font-size: .95rem; }
  .signup-body h1 { font-size: 1.25rem; margin-bottom: .1rem !important; }
  .signup-body .row.g-3 { --bs-gutter-y: .45rem; }
  .signup-body .form-control, .signup-body .form-select { padding-top: .32rem; padding-bottom: .32rem; font-size: .85rem; }
  .signup-wrap .login-copy { display: none; }
}
@media (max-width: 575.98px) {
  .signup-wrap { padding: .6rem .6rem .4rem; justify-content: flex-start; }
  .signup-card { border-radius: 16px; }
  .signup-card .lt-stub-head { padding: .75rem 1rem .65rem; flex-wrap: nowrap; }
  .signup-card .lt-code { display: none; }
  .signup-card .brand-icon { width: 30px; height: 30px; font-size: .95rem; }
  .signup-body { padding: .85rem 1rem .1rem; }
  .signup-body h1 { font-size: 1.25rem; margin-bottom: .15rem !important; }
  .signup-body > p.mb-4 { font-size: .8rem; margin-bottom: .7rem !important; }
  .signup-body .row.g-3 { --bs-gutter-x: .6rem; --bs-gutter-y: .5rem; }
  .signup-body .form-label { margin-bottom: .15rem; font-size: .76rem; }
  .signup-body .form-control, .signup-body .form-select { padding: .4rem .6rem; font-size: .88rem; }
  .signup-body .pw-hint { display: none; }
  .signup-body .form-check-label { font-size: .74rem !important; }
  .signup-body .btn.mt-4 { margin-top: .8rem !important; }
  .signup-card .lt-stub-foot { margin: .6rem 1rem 0; padding: .6rem 0 .75rem; font-size: .76rem; }
  .signup-wrap .login-copy { margin-top: .35rem; font-size: .7rem; }
}
/* ---------- motion (transform only – content is never hidden) */
@keyframes fadeUp { from { transform: translateY(6px); } to { transform: none; } }
.content > * { animation: fadeUp .3s ease both; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- responsive */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 1035; }
  .main { margin-left: 0; }
  .content { padding: 1rem; }
  .topbar { padding: 0 1rem; }
  .app-footer { padding: 1rem; }
  .login-ticket { grid-template-columns: 1fr; max-width: 460px; height: auto; }
  .login-wrap { height: auto; min-height: 100vh; min-height: 100dvh; }
  .lt-info { display: none; }
  .lt-stub { border-left: 0; }
  .lt-stub::before, .lt-stub::after { display: none; }
  .lt-stub-head, .lt-stub-body { padding-left: 1.5rem; padding-right: 1.5rem; }
  .lt-stub-foot { margin: 0 1.5rem; }
}
@media (max-width: 575.98px) {
  .desk-status small { display: none; }
  .priority-picker { grid-template-columns: repeat(2, 1fr); }
  .page-title { font-size: 1.2rem; }
  .stat-value { font-size: 1.25rem; }
  .stat-card { padding: .85rem; gap: .7rem; }
  .stat-icon { width: 36px; height: 36px; font-size: 1rem; }
}
@media print {
  .sidebar, .topbar, .app-footer, .page-actions, .no-print { display: none !important; }
  .main { margin: 0 !important; }
  body { background: #fff; }
}
