/* =========================================================
   VCUBE Support Desk - design system
   Light + dark themes via [data-bs-theme]
   ========================================================= */

:root {
  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-soft: #eef2ff;
  --accent: #06b6d4;
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e6e8ef;
  --text: #111827;
  --muted: #6b7280;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0284c7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18);
  --sb-w: 252px;
  --sb-w-collapsed: 72px;
  --topbar-h: 64px;
  --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-primary: #4f46e5;
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: #4f46e5;
  --bs-link-color-rgb: 79, 70, 229;
  --bs-link-hover-color: #4338ca;
  --bs-border-radius: 10px;
}

[data-bs-theme="dark"] {
  --brand: #818cf8;
  --brand-600: #a5b4fc;
  --brand-soft: rgba(129, 140, 248, .14);
  --bg: #0b0f1a;
  --surface: #121826;
  --surface-2: #182033;
  --border: #243049;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #38bdf8;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, .6);
  --bs-body-bg: #0b0f1a;
  --bs-body-color: #e5e7eb;
  --bs-border-color: #243049;
  --bs-tertiary-bg: #182033;
  --bs-link-color: #a5b4fc;
  --bs-link-color-rgb: 165, 180, 252;
  --bs-link-hover-color: #c7d2fe;
}

* { -webkit-font-smoothing: antialiased; }
html, body { background: var(--bg); color: var(--text); }
body { font-size: 14.5px; min-height: 100vh; }
a { text-decoration: none; }
h1, h2, h3, h4, h5, h6 { color: var(--text); font-weight: 700; letter-spacing: -.01em; }
kbd { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); border-bottom-width: 2px; font-size: 11px; padding: 1px 6px; border-radius: 6px; font-family: inherit; }
.text-muted { color: var(--muted) !important; }
:focus-visible { outline: 3px solid rgba(79, 70, 229, .45); outline-offset: 2px; border-radius: 6px; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 2000; background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 8px; }

/* ---------- buttons + forms ---------- */
.btn { font-weight: 600; border-radius: 10px; padding: .5rem 1rem; }
.btn-sm { padding: .3rem .7rem; border-radius: 8px; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca; --bs-btn-active-bg: #3730a3; --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); color: #fff; }
[data-bs-theme="dark"] .btn-primary { --bs-btn-bg: #6366f1; --bs-btn-border-color: #6366f1; color: #fff; }
.btn-soft { background: var(--brand-soft); color: var(--brand); border: 0; }
.btn-soft:hover { background: var(--brand); color: #fff; }
.btn-light { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-light:hover { background: var(--border); color: var(--text); }
.form-control, .form-select { border-radius: 10px; border-color: var(--border); background-color: var(--surface); color: var(--text); padding: .55rem .8rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(79, 70, 229, .15); background-color: var(--surface); color: var(--text); }
.form-label { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.form-text { color: var(--muted); }

/* ---------- sidebar ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sb-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 1040; transition: width .2s ease, transform .25s ease; }
.sb-brand { height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--border); overflow: hidden; white-space: nowrap; }
.sb-brand .logo { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-size: 18px; background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.sb-brand strong { display: block; font-size: 14.5px; }
.sb-brand small { color: var(--muted); font-size: 12px; }
.sb-nav { flex: 1; padding: 14px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.sb-foot { padding: 12px; border-top: 1px solid var(--border); }
.sb-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; cursor: pointer; text-align: left; }
.sb-link i { font-size: 17px; width: 22px; text-align: center; flex: 0 0 22px; }
.sb-link:hover { background: var(--surface-2); color: var(--text); }
.sb-link.active { background: var(--brand-soft); color: var(--brand); }
.app { margin-left: var(--sb-w); min-height: 100vh; transition: margin-left .2s ease; display: flex; flex-direction: column; }
html.sb-collapsed .sidebar { width: var(--sb-w-collapsed); }
html.sb-collapsed .app { margin-left: var(--sb-w-collapsed); }
html.sb-collapsed .sb-text { display: none; }
html.sb-collapsed .sb-brand { padding: 0 17px; }
.sb-backdrop { display: none; }

/* ---------- topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 1030; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 24px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.search-trigger { flex: 1; max-width: 440px; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); padding: 8px 12px; border-radius: 10px; font-size: 13.5px; text-align: left; }
.search-trigger span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.search-trigger:hover { border-color: var(--brand); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); display: grid; place-items: center; font-size: 17px; }
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.notif-dot { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.user-btn { display: flex; align-items: center; gap: 10px; background: transparent; border: 0; color: var(--text); padding: 4px 6px; border-radius: 10px; }
.user-btn:hover { background: var(--surface); }
.user-btn small { font-size: 11.5px; }
.notif-menu { width: 360px; max-width: 92vw; border-radius: var(--radius); border-color: var(--border); box-shadow: var(--shadow-lg); overflow: hidden; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); }
.notif-item:hover { background: var(--surface-2); color: var(--text); }
.notif-item.unread { background: var(--brand-soft); }
.notif-item .ni-icon { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.notif-item strong { display: block; font-size: 13.5px; }
.notif-item p { margin: 0; font-size: 12.5px; color: var(--muted); }
.notif-item small { font-size: 11.5px; color: var(--muted); }

/* ---------- content ---------- */
.content { padding: 24px; flex: 1; width: 100%; max-width: 1480px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 24px; margin: 0; }
.page-sub { color: var(--muted); margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { font-size: 12.5px; margin-bottom: 4px; }
.breadcrumb-item a { color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 15.5px; margin: 0; }
.card-body { padding: 20px; }
.section-gap > * + * { margin-top: 20px; }

/* ---------- KPI cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { padding: 18px 20px; position: relative; overflow: hidden; display: block; color: var(--text); }
a.kpi:hover { border-color: var(--brand); color: var(--text); }
.kpi .kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi .kpi-label { color: var(--muted); font-weight: 600; font-size: 13px; }
.kpi .kpi-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 17px; }
.kpi .kpi-value { font-size: 28px; font-weight: 800; margin: 8px 0 2px; letter-spacing: -.02em; }
.kpi .kpi-trend { font-size: 12.5px; font-weight: 600; }
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }
.trend-flat { color: var(--muted); }
.kpi canvas.spark { position: absolute; right: 12px; bottom: 10px; width: 90px !important; height: 30px !important; opacity: .9; }
.tone-indigo { background: var(--brand-soft); color: var(--brand); }
.tone-amber { background: rgba(217, 119, 6, .12); color: var(--warning); }
.tone-green { background: rgba(5, 150, 105, .12); color: var(--success); }
.tone-red { background: rgba(220, 38, 38, .12); color: var(--danger); }
.tone-cyan { background: rgba(2, 132, 199, .12); color: var(--info); }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.chip-new { background: rgba(79, 70, 229, .12); color: var(--brand); }
.chip-progress { background: rgba(217, 119, 6, .13); color: var(--warning); }
.chip-waiting { background: rgba(124, 58, 237, .12); color: #7c3aed; }
.chip-review { background: rgba(2, 132, 199, .12); color: var(--info); }
.chip-resolved { background: rgba(5, 150, 105, .12); color: var(--success); }
.chip-closed { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
[data-bs-theme="dark"] .chip-waiting { color: #c4b5fd; }
.chip-p-urgent { color: var(--danger); background: rgba(220, 38, 38, .1); }
.chip-p-high { color: var(--warning); background: rgba(217, 119, 6, .1); }
.chip-p-medium { color: var(--info); background: rgba(2, 132, 199, .1); }
.chip-p-low { color: var(--success); background: rgba(5, 150, 105, .1); }
.chip i { font-size: 10px; }
.sla { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.sla-ok { color: var(--success); }
.sla-warn { color: var(--warning); }
.sla-breach { color: var(--danger); }
.sla-met { color: var(--success); }
.sla-late { color: var(--warning); }
.sla-closed { color: var(--muted); }

/* ---------- tables ---------- */
.table { --bs-table-bg: transparent; --bs-table-color: var(--text); color: var(--text); margin: 0; }
.table > :not(caption) > * > * { padding: 12px 16px; border-bottom-color: var(--border); vertical-align: middle; }
.table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; background: var(--surface-2); white-space: nowrap; }
.table thead th a { color: var(--muted); }
.table tbody tr { transition: background .1s; }
.table-hover tbody tr:hover > * { background: var(--surface-2); }
.table tr.row-link { cursor: pointer; }
.table tr.kb-selected > * { background: var(--brand-soft) !important; box-shadow: inset 3px 0 0 var(--brand); }
.t-subject { font-weight: 600; color: var(--text); display: block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-no { font-size: 12px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.filter-bar .form-control, .filter-bar .form-select { width: auto; min-width: 150px; padding: .4rem .7rem; font-size: 13.5px; }
.filter-bar .form-select { padding-right: 2.1rem; background-position: right .6rem center; }
.filter-bar .input-icon .form-control { padding-left: 36px; }
.filter-bar .grow { flex: 1; min-width: 200px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--muted); }
.pagination { margin: 0; --bs-pagination-color: var(--text); --bs-pagination-bg: var(--surface); --bs-pagination-border-color: var(--border); --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand); --bs-pagination-hover-bg: var(--surface-2); --bs-pagination-hover-color: var(--text); --bs-pagination-disabled-bg: var(--surface); }
.bulk-bar { display: none; align-items: center; gap: 10px; padding: 10px 16px; background: var(--brand-soft); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.bulk-bar.show { display: flex; }

/* ---------- empty + skeleton ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty i { font-size: 40px; display: block; margin-bottom: 8px; color: var(--brand); opacity: .6; }
.empty h3 { font-size: 16px; color: var(--text); }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: 6px; height: 12px; margin: 8px 0; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- avatars ---------- */
.avatar { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.avatar-client { background: linear-gradient(135deg, #0ea5e9, #06b6d4); }
.avatar-agent { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.avatar-admin { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.avatar-system { background: #64748b; }
.avatar-lg { width: 64px; height: 64px; flex-basis: 64px; font-size: 22px; }

/* ---------- ticket page ---------- */
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.ticket-side { position: sticky; top: calc(var(--topbar-h) + 16px); display: flex; flex-direction: column; gap: 16px; }
.meta-list { list-style: none; margin: 0; padding: 0; }
.meta-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.meta-list li:last-child { border-bottom: 0; }
.meta-list li > span:first-child { color: var(--muted); }
.thread-card { display: flex; flex-direction: column; overflow: hidden; }
.thread { padding: 20px; display: flex; flex-direction: column; gap: 16px; max-height: 62vh; min-height: 260px; overflow-y: auto; background: var(--surface-2); }
.msg { display: flex; gap: 10px; max-width: 82%; }
.msg-mine { align-self: flex-end; flex-direction: row-reverse; }
.bubble { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; border-top-left-radius: 4px; padding: 10px 14px; min-width: 140px; box-shadow: var(--shadow); }
.msg-mine .bubble { background: var(--brand); border-color: var(--brand); color: #fff; border-top-left-radius: 14px; border-top-right-radius: 4px; }
[data-bs-theme="dark"] .msg-mine .bubble { background: #4f46e5; border-color: #4f46e5; }
.bubble-head { font-size: 12.5px; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.role-tag { font-size: 10.5px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-weight: 600; }
.msg-mine .role-tag { background: rgba(255, 255, 255, .2); color: #fff; }
.bubble-text { line-height: 1.55; word-wrap: break-word; overflow-wrap: anywhere; }
.msg-mine .bubble-text a { color: #fff; text-decoration: underline; }
.bubble-meta { font-size: 11px; opacity: .7; margin-top: 6px; text-align: right; }
.bubble-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.att { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: 12.5px; border: 1px solid var(--border); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-mine .att { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .25); }
.att-img { padding: 0; overflow: hidden; }
.att-img img { width: 140px; height: 100px; object-fit: cover; display: block; }
.msg.new-msg { animation: pop .35s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.thread-status { display: flex; justify-content: space-between; padding: 6px 20px; min-height: 28px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); }
.seen { margin-left: auto; color: var(--info); }
.typing { display: inline-flex; align-items: center; gap: 3px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
.typing em { margin-left: 6px; font-style: normal; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.composer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.composer-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.composer-tools .form-select { width: auto; max-width: 260px; }
.composer-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.composer-actions .btn { margin-left: auto; }
.dropzone { border: 1.5px dashed var(--border); border-radius: 10px; padding: 10px 14px; font-size: 13px; color: var(--muted); transition: all .15s; }
.dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone label { cursor: pointer; margin: 0; }
.previews { display: flex; flex-wrap: wrap; gap: 8px; }
.previews:not(:empty) { margin-top: 10px; }
.preview { position: relative; display: flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px 4px 4px; font-size: 12px; color: var(--text); max-width: 220px; }
.preview img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; }
.preview .pi-file { width: 36px; height: 36px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); border-radius: 6px; }
.preview span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes-list .note { background: rgba(217, 119, 6, .08); border: 1px solid rgba(217, 119, 6, .2); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.notes-list .note + .note { margin-top: 8px; }
.note .mention { color: var(--brand); font-weight: 700; }
.history { list-style: none; padding: 0; margin: 0; position: relative; }
.history li { position: relative; padding: 0 0 14px 22px; font-size: 13px; }
.history li::before { content: ""; position: absolute; left: 5px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.history li::after { content: ""; position: absolute; left: 8.5px; top: 16px; bottom: 0; width: 1px; background: var(--border); }
.history li:last-child::after { display: none; }
.history small { color: var(--muted); display: block; }

/* progress tracker */
.tracker { display: flex; list-style: none; padding: 0; margin: 0; counter-reset: s; }
.tracker li { flex: 1; text-align: center; position: relative; font-size: 12px; color: var(--muted); font-weight: 600; }
.tracker li::before { content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 3px; background: var(--border); z-index: 0; }
.tracker li:first-child::before { display: none; }
.tracker li.done::before, .tracker li.current::before { background: var(--brand); }
.tracker .dot { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 6px; background: var(--surface); border: 3px solid var(--border); color: var(--muted); font-size: 12px; }
.tracker li.done .dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.tracker li.current .dot { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 5px var(--brand-soft); }
.tracker li.current { color: var(--text); }

/* rating */
.rating-faces { display: flex; gap: 8px; flex-wrap: wrap; }
.rating-faces input { position: absolute; opacity: 0; pointer-events: none; }
.rating-faces label { font-size: 30px; cursor: pointer; padding: 6px 10px; border-radius: 12px; border: 2px solid transparent; transition: transform .1s; filter: grayscale(.6); }
.rating-faces label:hover { transform: scale(1.12); filter: none; }
.rating-faces input:checked + label { border-color: var(--brand); background: var(--brand-soft); filter: none; }
.rating-faces input:focus-visible + label { outline: 3px solid rgba(79, 70, 229, .45); }
.stars { color: #f59e0b; letter-spacing: 2px; }

/* ---------- kanban ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; }
.board-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.board-col-head { padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.board-list { padding: 10px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 120px; flex: 1; }
.board-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: grab; box-shadow: var(--shadow); color: var(--text); display: block; }
.board-card:hover { border-color: var(--brand); color: var(--text); }
.board-card.sortable-ghost { opacity: .4; }
.board-card .bc-title { font-weight: 600; font-size: 13.5px; margin: 4px 0 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.board-card .bc-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- search modal ---------- */
.search-modal { border-radius: 16px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.search-input-wrap { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.search-input-wrap i { font-size: 18px; color: var(--muted); }
.search-input-wrap input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--text); }
.sr-group { padding: 8px 0; }
.sr-group h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 18px; margin: 0; }
.sr-item { display: flex; align-items: center; gap: 12px; padding: 10px 18px; color: var(--text); }
.sr-item:hover, .sr-item.active { background: var(--brand-soft); color: var(--text); }
.sr-item i { color: var(--brand); }
.sr-item small { color: var(--muted); display: block; font-size: 12px; }

/* ---------- KB ---------- */
.kb-hero { background: linear-gradient(135deg, #4f46e5, #7c3aed 60%, #06b6d4); color: #fff; border-radius: 16px; padding: 36px 28px; margin-bottom: 20px; }
.kb-hero h2 { color: #fff; font-size: 26px; }
.kb-hero p { opacity: .9; }
.kb-hero .form-control { border: 0; padding: .8rem 1rem; font-size: 15px; }
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.kb-card { padding: 18px; display: flex; flex-direction: column; gap: 8px; color: var(--text); height: 100%; }
.kb-card:hover { border-color: var(--brand); color: var(--text); transform: translateY(-2px); transition: all .15s; }
.kb-card h3 { font-size: 15px; margin: 0; }
.kb-card p { color: var(--muted); font-size: 13px; margin: 0; flex: 1; }
.article-body { font-size: 15.5px; line-height: 1.75; }
.article-body img { max-width: 100%; height: auto; border-radius: 10px; }
.suggest-box { border: 1px solid var(--border); border-radius: 12px; background: var(--brand-soft); padding: 14px 16px; }
.suggest-box a { display: block; padding: 6px 0; font-weight: 600; }

/* ---------- misc ---------- */
.confirm-icon { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 24px; background: rgba(220, 38, 38, .1); color: var(--danger); }
.toast { border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); background: var(--surface); color: var(--text); }
.toast .t-icon { font-size: 18px; }
.list-clean { list-style: none; padding: 0; margin: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); color: var(--text); }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { background: var(--surface-2); color: var(--text); }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.chart-box { position: relative; height: 280px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.ai-out { white-space: pre-wrap; background: var(--brand-soft); border-radius: 10px; padding: 12px 14px; font-size: 13.5px; }
.dropdown-menu { --bs-dropdown-bg: var(--surface); --bs-dropdown-border-color: var(--border); --bs-dropdown-link-color: var(--text); --bs-dropdown-link-hover-bg: var(--surface-2); --bs-dropdown-link-hover-color: var(--text); border-radius: 12px; box-shadow: var(--shadow-lg); }
.modal-content { background: var(--surface); color: var(--text); border-color: var(--border); border-radius: 16px; }
.nav-tabs { --bs-nav-tabs-border-color: var(--border); --bs-nav-tabs-link-active-bg: var(--surface); --bs-nav-tabs-link-active-border-color: var(--border) var(--border) var(--surface); --bs-nav-link-color: var(--muted); --bs-nav-link-hover-color: var(--text); }
.nav-tabs .nav-link.active { color: var(--brand); font-weight: 700; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 13px; }
.seg a.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }

/* ---------- auth pages ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { background: linear-gradient(140deg, #312e81, #4f46e5 45%, #7c3aed); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; right: -180px; bottom: -200px; background: radial-gradient(circle, rgba(6, 182, 212, .45), transparent 65%); }
.auth-art h2 { color: #fff; font-size: 34px; line-height: 1.2; max-width: 460px; }
.auth-art ul { list-style: none; padding: 0; margin: 28px 0 0; position: relative; z-index: 1; }
.auth-art li { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; opacity: .95; }
.auth-art li i { width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, .15); display: grid; place-items: center; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 20px; background: var(--surface); }
.auth-card { width: 100%; max-width: 410px; }
.auth-card h1 { font-size: 26px; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon .form-control { padding-left: 38px; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); padding: 4px 8px; }

/* ---------- bottom nav (client, mobile) ---------- */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; height: 64px; background: var(--surface); border-top: 1px solid var(--border); display: flex; justify-content: space-around; align-items: center; z-index: 1035; padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--muted); font-weight: 600; gap: 2px; min-width: 56px; }
.bottom-nav a i { font-size: 19px; }
.bottom-nav a.active { color: var(--brand); }
.bottom-nav .fab { width: 50px; height: 50px; border-radius: 50%; background: var(--brand); color: #fff; justify-content: center; margin-top: -26px; box-shadow: var(--shadow-lg); }
.bottom-nav .fab i { font-size: 22px; }

/* ---------- responsive ---------- */
@media (max-width: 1199px) {
  .ticket-layout { grid-template-columns: 1fr; }
  .ticket-side { position: static; }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); width: var(--sb-w) !important; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .sidebar.open .sb-text { display: inline !important; }
  .sb-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 1039; }
  .app, html.sb-collapsed .app { margin-left: 0; }
  #collapseSidebar { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  body.role-client .content { padding-bottom: 90px; }
}
@media (max-width: 575px) {
  .content { padding: 16px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .search-trigger kbd, .search-trigger span { display: none; }
  .search-trigger { flex: 0 0 auto; width: 40px; height: 40px; justify-content: center; padding: 0; }
  .page-head h1 { font-size: 20px; }
  .msg { max-width: 95%; }
  .thread { padding: 14px; max-height: 58vh; }
  .composer { padding: 12px; }
  .tracker .lbl { font-size: 10.5px; }
  .kpi .kpi-value { font-size: 24px; }
  .table > :not(caption) > * > * { padding: 10px 12px; }
  .hide-sm { display: none !important; }
  .filter-bar .form-select { flex: 1 1 40%; min-width: 0; }
  .filter-bar .grow { flex-basis: 100%; }
  .page-actions { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .sidebar, .topbar, .composer, .bottom-nav, .page-actions { display: none !important; }
  .app { margin: 0 !important; }
}
