/* ==========================================================================
   TRXLAB Support — dark theme
   Accent comes from --accent (palette picker); backgrounds from html[data-bg].
   ========================================================================== */

:root {
  --accent: #5ec4ff;
  --bg: #0a0c0f;
  --bg-2: #0d1014;
  --surface: #12151a;
  --surface-2: #181c22;
  --surface-3: #20252d;
  --border: #22272f;
  --border-strong: #2f3540;
  --text: #e8ebf1;
  --text-2: #b6bdc9;
  --muted: #7d8695;
  --accent-ink: #04121c;
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-softer: color-mix(in srgb, var(--accent) 7%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 45%, transparent);
  --accent-glow: color-mix(in srgb, var(--accent) 32%, transparent);
  --accent-hi: color-mix(in srgb, var(--accent) 75%, white);
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;
  --violet: #a78bfa;
  --orange: #fb923c;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .75);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --sidebar-w: 252px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  color-scheme: dark;
}
html[data-bg="abyss"]    { --bg:#000; --bg-2:#040405; --surface:#0b0c0e; --surface-2:#121316; --surface-3:#1a1c20; --border:#1d1f23; --border-strong:#2a2d33; }
html[data-bg="graphite"] { --bg:#141517; --bg-2:#17181b; --surface:#1c1e21; --surface-2:#232529; --surface-3:#2c2f34; --border:#2d3035; --border-strong:#3b3f46; }
html[data-bg="slate"]    { --bg:#0a0f16; --bg-2:#0d131b; --surface:#111923; --surface-2:#17212d; --surface-3:#1f2b39; --border:#1f2c3c; --border-strong:#2c3d52; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background-color .4s var(--ease);
}
a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-hi); }
h1, h2, h3 { margin: 0; letter-spacing: -.015em; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 6px; }
::selection { background: var(--accent-glow); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.block { display: block; }
.grow { flex: 1; min-width: 0; }
.accent-text { color: var(--accent); }
[hidden] { display: none !important; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid var(--bg); }

/* Icons */
.icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; }

/* Ambient glow ---------------------------------------------------------- */
.ambient { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.ambient span {
  position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 62%);
  opacity: .18; filter: blur(30px);
  animation: drift 26s ease-in-out infinite alternate;
}
.ambient span:first-child { top: -30vmax; right: -18vmax; }
.ambient span:last-child { bottom: -38vmax; left: -10vmax; opacity: .1; animation-duration: 34s; animation-direction: alternate-reverse; }
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-8vmax, 6vmax) scale(1.15); }
}

/* Layout ---------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; position: relative; z-index: 1; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 18px; padding: 20px 14px;
  background: color-mix(in srgb, var(--bg-2) 86%, transparent);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--border);
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #000));
  color: var(--accent-ink); box-shadow: 0 6px 22px -6px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform .5s var(--spring);
}
.brand-mark .icon { width: 20px; height: 20px; fill: currentColor; }
.brand:hover .brand-mark { transform: rotate(-12deg) scale(1.06); }
.brand-mark.lg { width: 56px; height: 56px; border-radius: 16px; }
.brand-mark.lg .icon { width: 28px; height: 28px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 16px; letter-spacing: .06em; }
.brand-text small { color: var(--muted); font-size: 12px; }
.sidebar-cta { margin: 0 4px; }

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); padding: 14px 12px 6px; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 12px;
  border-radius: 10px; color: var(--text-2); font-weight: 500;
  transition: background .2s, color .2s, transform .2s var(--ease);
}
.nav-link:hover { background: var(--surface-2); color: var(--text); transform: translateX(2px); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-hi); }
.nav-link.active::before {
  content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--accent); box-shadow: 0 0 12px var(--accent);
  animation: grow-y .35s var(--spring);
}
@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.nav-sub { padding-left: 14px; font-size: 13px; }
.nav-badge {
  margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px;
  display: grid; place-items: center; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); animation: pop .5s var(--spring);
}
.nav-badge.soft { background: var(--accent-soft); color: var(--accent-hi); }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 10px; }
.sidebar-scrim { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 12px 28px; min-height: 64px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--border);
}
.search {
  flex: 1; max-width: 560px; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  height: 40px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); transition: border-color .2s, box-shadow .25s, background .2s;
}
.search:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-softer); background: var(--surface-2); }
.search input { flex: 1; background: none; border: 0; outline: 0; color: var(--text); font: inherit; height: 100%; padding: 0; box-shadow: none !important; }
.search kbd { font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border-strong); color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 30px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); cursor: pointer; font: inherit;
  transition: border-color .2s, background .2s;
}
.user-chip:hover { border-color: var(--border-strong); background: var(--surface-2); }
.user-chip-text { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-chip-text small { color: var(--muted); font-size: 11px; }

.page { padding: 28px; max-width: 1480px; width: 100%; margin: 0 auto; animation: page-in .45s var(--ease) both; }
.page.leaving { animation: page-out .16s ease-in both; }
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes page-out { to { opacity: 0; transform: translateY(-4px); } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.back-link:hover { color: var(--accent); }
.back-link .icon { width: 15px; height: 15px; transition: transform .2s; }
.back-link:hover .icon { transform: translateX(-3px); }

.row { display: flex; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.gap { gap: 10px; }
.center { justify-content: center; }
.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.sm { gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-2.tight { gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.span-2 { grid-column: span 2; }
.dash-grid { margin-top: 18px; }

/* Cards ----------------------------------------------------------------- */
.card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, white 4%), var(--surface));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); position: relative;
  transition: border-color .25s, transform .3s var(--ease), box-shadow .3s;
}
.card.glass { background: color-mix(in srgb, var(--surface) 78%, transparent); backdrop-filter: blur(20px); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head.sub { margin: 22px 0 10px; padding-top: 18px; border-top: 1px dashed var(--border); }
.card-head.pad { padding: 18px 20px 0; }
.card-head h2, .card-head h3, .card-title { display: flex; align-items: center; gap: 9px; }
.card-head .icon, .card-title .icon { color: var(--accent); }
.card-title { font-size: 14px; margin-bottom: 2px; }
.link-more { font-size: 13px; font-weight: 500; }

.reveal { animation: reveal .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }
@keyframes reveal { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.stat-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.stat { display: flex; flex-direction: column; gap: 6px; color: var(--text); overflow: hidden; }
a.stat:hover { color: var(--text); transform: translateY(-4px); border-color: var(--accent-line); box-shadow: 0 22px 40px -20px var(--accent-glow); }
.stat::after {
  content: ''; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, var(--tone, var(--accent)) 0%, transparent 70%); opacity: .12; transition: opacity .3s, transform .5s var(--ease);
}
a.stat:hover::after { opacity: .25; transform: scale(1.3); }
.stat-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--tone, var(--accent)) 14%, transparent); color: var(--tone, var(--accent)); margin-bottom: 6px; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 32px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tone-accent { --tone: var(--accent); }
.tone-warn { --tone: var(--warn); }
.tone-danger { --tone: var(--danger); }
.tone-ok { --tone: var(--ok); }
.tone-muted { --tone: var(--muted); }

/* Chart */
.chart svg { width: 100%; height: 200px; display: block; overflow: visible; }
.gridline { stroke: var(--border); stroke-dasharray: 3 5; }
.bar { transform-box: fill-box; transform-origin: bottom; animation: bar-up .8s var(--spring) both; animation-delay: calc(var(--i) * 40ms + 200ms); transition: opacity .2s; }
.bar-created { fill: var(--accent); }
.bar-closed { fill: color-mix(in srgb, var(--ok) 70%, transparent); }
.bar-group:hover .bar { opacity: .75; }
@keyframes bar-up { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.chart-x { display: grid; grid-template-columns: repeat(14, 1fr); margin-top: 8px; font-size: 11px; color: var(--muted); }
.chart-x span { white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lg-created::before { background: var(--accent); }
.lg-closed::before { background: var(--ok); }

.status-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.status-bars a { display: grid; grid-template-columns: 150px 1fr 34px; align-items: center; gap: 12px; color: var(--text); padding: 4px 6px; border-radius: 8px; transition: background .2s; }
.status-bars a:hover { background: var(--surface-2); }
.sb-track { height: 8px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.sb-fill { display: block; height: 100%; width: var(--w); border-radius: 6px; background: var(--c, var(--accent)); animation: fill-x 1s var(--ease) both; animation-delay: calc(var(--i) * 60ms + 250ms); transform-origin: left; }
@keyframes fill-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.sb-num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }

.workload { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.workload a { display: grid; grid-template-columns: 28px 1fr 70px 24px; align-items: center; gap: 10px; color: var(--text); padding: 6px; border-radius: 8px; transition: background .2s; }
.workload a:hover { background: var(--surface-2); }
.wl-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-bar { height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.wl-bar span { display: block; height: 100%; width: var(--w); background: var(--accent); border-radius: 4px; animation: fill-x .9s var(--ease) both; animation-delay: calc(var(--i) * 70ms + 300ms); transform-origin: left; }
.wl-num { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }
.you { font-style: normal; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; margin-left: 4px; vertical-align: 1px; }

/* Ticket mini-list (dashboard) */
.ticket-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ticket-list li { position: relative; display: flex; align-items: center; gap: 8px; border-radius: 12px; border: 1px solid transparent; transition: background .2s, border-color .2s, transform .25s var(--ease); }
.ticket-list li > a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 12px; color: var(--text); }
.ticket-list li:hover { background: var(--surface-2); border-color: var(--border); transform: translateX(3px); }
.ticket-list .ref { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.tl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tl-main strong { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-main small { color: var(--muted); font-size: 12px; }
.tl-action { padding-right: 10px; }
.ticket-list li.mine { background: var(--accent-softer); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
.ticket-list li.mine::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; position: relative; }
.feed li { display: flex; gap: 12px; padding: 8px 0; position: relative; }
.feed li:not(:last-child)::after { content: ''; position: absolute; left: 4px; top: 24px; bottom: -8px; width: 1px; background: var(--border); }
.feed p { color: var(--text-2); font-size: 13px; }
.feed a { color: var(--text); font-weight: 500; font-size: 13px; }
.feed a:hover { color: var(--accent); }
.feed small { font-size: 11.5px; }
.feed.compact li { padding: 6px 0; }
.feed-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin-top: 6px; flex-shrink: 0; box-shadow: 0 0 0 3px var(--surface); z-index: 1; }
.act-created { background: var(--accent); }
.act-status { background: var(--violet); }
.act-assigned_to { background: var(--warn); }
.act-priority { background: var(--orange); }
.act-comment { background: var(--ok); }

.empty-mini { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 16px; border: 1px dashed var(--border-strong); border-radius: 12px; }
.empty-mini .icon { color: var(--accent); }
.empty-state { text-align: center; padding: 56px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-state h2 { font-size: 18px; }
.empty-state .btn { margin-top: 10px; }
.empty-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; animation: float 4s ease-in-out infinite; }
.empty-icon .icon { width: 30px; height: 30px; }
@keyframes float { 50% { transform: translateY(-6px); } }
.error-state { min-height: 60vh; justify-content: center; }
.error-code { font-size: 96px; font-weight: 800; letter-spacing: -.05em; line-height: 1; background: linear-gradient(120deg, var(--accent), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Buttons --------------------------------------------------------------- */
.btn {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 11px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; user-select: none;
  transition: transform .18s var(--ease), box-shadow .25s, background .2s, border-color .2s, color .2s, filter .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 22px -10px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.3); }
.btn-primary:hover { color: var(--accent-ink); filter: brightness(1.08); box-shadow: 0 10px 30px -8px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.3); transform: translateY(-1px); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--accent-line); background: var(--surface-3); }
.btn-success { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.btn-success:hover { color: #052e14; background: var(--ok); }
.btn-danger { background: var(--danger); color: #2b0606; }
.btn-danger:hover { color: #2b0606; filter: brightness(1.1); }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn-danger-ghost:hover { color: #2b0606; background: var(--danger); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn-lg { height: 46px; font-size: 15px; border-radius: 13px; }
.btn-block { width: 100%; }
.btn.icon-only { width: 38px; padding: 0; }
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: currentColor; opacity: .25; pointer-events: none; animation: ripple .6s ease-out; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
.btn.saved { animation: saved .6s var(--spring); }
@keyframes saved { 40% { transform: scale(1.05); } }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2); cursor: pointer;
  transition: color .2s, border-color .2s, background .2s, transform .25s var(--spring);
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent-line); transform: rotate(-8deg); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }
.icon-btn.sm .icon { width: 16px; height: 16px; }
.icon-btn.danger:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.only-mobile { display: none; }

/* Forms ----------------------------------------------------------------- */
input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel], input[type=date], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--border-strong); border-radius: 10px; padding: 9px 12px; outline: none;
  transition: border-color .2s, box-shadow .25s, background .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-softer); background: var(--surface); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
textarea { resize: vertical; min-height: 80px; line-height: 1.55; }
select {
  appearance: none; cursor: pointer; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237d8695' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
select.sm { height: 34px; padding-top: 0; padding-bottom: 0; font-size: 13px; width: auto; }
input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.7); cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.req { color: var(--accent); font-style: normal; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text-2); }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > .icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; transition: color .2s; }
.input-icon input { padding-left: 40px; }
.input-icon:focus-within > .icon { color: var(--accent); }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px; margin-bottom: 16px; }
.filters select { width: auto; min-width: 140px; }
.filters .grow { min-width: 220px; }

.segmented { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border); gap: 4px; }
.segmented label { flex: 1; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: 13px; transition: all .25s var(--ease); }
.segmented input:checked + span { background: var(--surface-3); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }

.prio-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.prio-opt { cursor: pointer; }
.prio-opt input { position: absolute; opacity: 0; }
.prio-opt span { display: block; text-align: center; padding: 8px 4px; border-radius: 9px; border: 1px solid var(--border-strong); font-size: 12.5px; font-weight: 600; color: var(--muted); transition: all .2s var(--ease); }
.prio-opt input:checked + span { color: var(--pc); border-color: var(--pc); background: color-mix(in srgb, var(--pc) 13%, transparent); transform: translateY(-1px); }
.prio-opt.prio-low { --pc: var(--muted); }
.prio-opt.prio-normal { --pc: var(--info); }
.prio-opt.prio-high { --pc: var(--orange); }
.prio-opt.prio-urgent { --pc: var(--danger); }

.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; cursor: pointer;
  padding: 26px; border-radius: 14px; border: 1.5px dashed var(--border-strong); background: var(--bg-2);
  transition: border-color .2s, background .2s, transform .2s var(--ease);
}
.dropzone > .icon { width: 26px; height: 26px; color: var(--accent); transition: transform .3s var(--spring); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-softer); }
.dropzone.over { transform: scale(1.01); }
.dropzone.over > .icon, .dropzone:hover > .icon { transform: translateY(-4px); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-files { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.dz-files li { font-size: 12px; padding: 3px 10px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-hi); animation: pop .35s var(--spring); }

/* Badges ---------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-2); border: 1px solid transparent; }
.badge .icon { width: 13px; height: 13px; }
.badge.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--sc); box-shadow: 0 0 8px var(--sc); }
.badge.status { color: var(--sc); background: color-mix(in srgb, var(--sc) 11%, transparent); border-color: color-mix(in srgb, var(--sc) 22%, transparent); }
.status-new { --sc: var(--accent); }
.status-new i { animation: pulse 1.8s ease-in-out infinite; }
.status-open { --sc: var(--info); }
.status-in_progress { --sc: var(--violet); }
.status-waiting { --sc: var(--warn); }
.status-on_hold { --sc: #94a3b8; }
.status-resolved { --sc: var(--ok); }
.status-closed { --sc: #6b7280; }
.status-fill-new { --c: var(--accent); } .status-fill-open { --c: var(--info); } .status-fill-in_progress { --c: var(--violet); }
.status-fill-waiting { --c: var(--warn); } .status-fill-on_hold { --c: #94a3b8; } .status-fill-resolved { --c: var(--ok); } .status-fill-closed { --c: #6b7280; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }
.prio { background: transparent; border-color: var(--border-strong); }
.prio::before { content: ''; width: 6px; height: 6px; border-radius: 2px; background: var(--pc); transform: rotate(45deg); }
.prio-low { --pc: var(--muted); color: var(--muted); }
.prio-normal { --pc: var(--info); }
.prio-high { --pc: var(--orange); color: var(--orange); border-color: color-mix(in srgb, var(--orange) 35%, transparent); }
.prio-urgent { --pc: var(--danger); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.prio-urgent::before { animation: pulse 1.2s ease-in-out infinite; }
.mine-badge { background: var(--accent-soft); color: var(--accent-hi); border-color: var(--accent-line); }
.internal-badge { background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--warn); }
.client-badge { background: color-mix(in srgb, var(--violet) 12%, transparent); color: var(--violet); }
.reply-badge { background: var(--accent-soft); color: var(--accent-hi); }
.role-admin { background: color-mix(in srgb, var(--violet) 14%, transparent); color: var(--violet); }
.role-agent { background: var(--accent-soft); color: var(--accent-hi); }
.muted-badge { background: var(--surface-3); color: var(--muted); }
.chip { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); transition: all .2s; }
.chip.sm { font-size: 11px; padding: 1px 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chips .chip { padding: 6px 14px; font-size: 13px; }
.chips .chip:hover { border-color: var(--accent-line); color: var(--text); }
.chips .chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.pill { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 7px; border-radius: 11px; font-weight: 700; font-size: 12px; }
.pill.accent { background: var(--accent-soft); color: var(--accent-hi); }

/* Avatars */
.avatar {
  --h: 200; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  font-size: 12.5px; font-weight: 700; color: hsl(var(--h) 85% 82%);
  background: linear-gradient(140deg, hsl(var(--h) 55% 32%), hsl(calc(var(--h) + 40) 50% 22%));
  box-shadow: inset 0 0 0 1px hsl(var(--h) 60% 50% / .35);
}
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.lg { width: 52px; height: 52px; font-size: 17px; }

/* Tabs ------------------------------------------------------------------ */
.tabs { position: relative; display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px 12px; color: var(--muted); font-weight: 600; transition: color .2s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab .count { font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 10px; background: var(--surface-3); color: var(--text-2); transition: all .25s; }
.tab.active .count { background: var(--accent); color: var(--accent-ink); }
.tab-indicator { position: absolute; bottom: -1px; height: 2px; left: 0; width: 0; background: var(--accent); border-radius: 2px; box-shadow: 0 0 12px var(--accent); transition: left .35s var(--ease), width .35s var(--ease); }

/* Tables ---------------------------------------------------------------- */
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2) 60%, transparent); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { animation: row-in .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 25ms); transition: background .18s; }
@keyframes row-in { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.row-link { cursor: pointer; }
.row-link:hover { background: var(--surface-2); }
.table .subject { color: var(--text); font-weight: 600; }
.row-link:hover .subject { color: var(--accent-hi); }
.table .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 4px; color: var(--muted); font-size: 12px; }
.table .meta span { display: inline-flex; align-items: center; gap: 4px; }
.table .meta .icon { width: 13px; height: 13px; }
.col-check { width: 42px; padding-right: 0 !important; }
.col-actions { text-align: right; width: 60px; }
.col-subject { min-width: 280px; }
.assignee { display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; }
.you-label { color: var(--accent); }
.overdue { color: var(--danger); font-weight: 600; }

/* "Assigned to me" highlight */
.table tr.mine td { background: var(--accent-softer); }
.table tr.mine td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.table tr.mine:hover td { background: var(--accent-soft); }
.mine-legend { color: var(--accent-hi); background: var(--accent-soft); padding: 1px 8px; border-radius: 6px; border-left: 3px solid var(--accent); }
.prio-row-urgent .col-subject .subject::after { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); margin-left: 8px; vertical-align: 2px; box-shadow: 0 0 8px var(--danger); animation: pulse 1.2s infinite; }

.bulk-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 0 16px; max-height: 0; overflow: hidden; opacity: 0;
  background: var(--accent-softer); border-bottom: 1px solid transparent; transition: max-height .35s var(--ease), opacity .25s, padding .35s var(--ease), border-color .3s;
}
.bulk-bar.show { max-height: 140px; opacity: 1; padding: 10px 16px; border-color: var(--accent-line); }
.bulk-group { display: flex; gap: 6px; }
.bulk-group select { height: 32px; padding-top: 0; padding-bottom: 0; font-size: 12.5px; width: auto; }

.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 18px; }

/* Ticket view ----------------------------------------------------------- */
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.ticket-side { position: sticky; top: 84px; }
.ticket-title { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.ticket-title h1 { font-size: 24px; }
.ref-lg { font-size: 14px; color: var(--accent); background: var(--accent-soft); padding: 3px 10px; border-radius: 8px; }
.meta-row { margin-top: 10px; }
.meta-row .muted { display: inline-flex; align-items: center; gap: 6px; }
.meta-row .muted .icon { width: 14px; height: 14px; }
.ticket-head.is-mine .ref-lg { box-shadow: 0 0 0 1px var(--accent-line), 0 0 22px -4px var(--accent-glow); }

.timeline { display: flex; flex-direction: column; gap: 14px; position: relative; }
.timeline:not(:empty)::before { content: ''; position: absolute; left: 37px; top: -14px; bottom: -14px; width: 2px; background: linear-gradient(var(--border), var(--border-strong), var(--border)); z-index: 0; }
.message { padding: 18px 20px; z-index: 1; }
.msg-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.msg-head > div { display: flex; flex-direction: column; line-height: 1.3; }
.msg-head small { font-size: 12px; }
.msg-tags { margin-left: auto; }
.msg-body { color: var(--text-2); line-height: 1.65; word-wrap: break-word; overflow-wrap: anywhere; }
.message.original { border-color: var(--accent-line); background: linear-gradient(180deg, var(--accent-softer), var(--surface) 60%); }
.message.internal { border-color: color-mix(in srgb, var(--warn) 30%, transparent); background: linear-gradient(180deg, color-mix(in srgb, var(--warn) 6%, var(--surface)), var(--surface)); }
.message.from-client { border-left: 3px solid var(--violet); }
.message:target { animation: target-flash 1.6s var(--ease); }
@keyframes target-flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent), 0 0 40px -6px var(--accent-glow); } }

.files { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.file { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--bg-2); color: var(--text); font-size: 13px; max-width: 280px; transition: border-color .2s, transform .2s var(--ease); }
.file:hover { border-color: var(--accent); color: var(--text); transform: translateY(-2px); }
.file span { display: flex; flex-direction: column; min-width: 0; }
.file span, .file small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file small { color: var(--muted); font-size: 11px; }
.file.is-img img { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; }

.composer { padding: 0; overflow: hidden; }
.composer-tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.composer-tabs button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px; background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; position: relative; transition: color .2s, background .2s; }
.composer-tabs button::after { content: ''; position: absolute; left: 20%; right: 20%; bottom: 0; height: 2px; border-radius: 2px; background: var(--tc, var(--accent)); transform: scaleX(0); transition: transform .3s var(--ease); }
.composer-tabs button.active { color: var(--text); background: var(--surface); }
.composer-tabs button.active::after { transform: scaleX(1); }
.composer-tabs button[data-type=internal] { --tc: var(--warn); }
.composer-hint { padding: 12px 20px 0; }
.composer textarea { border: 0; background: transparent; border-radius: 0; padding: 12px 20px; min-height: 120px; box-shadow: none !important; }
.composer.is-internal { border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.composer.is-internal textarea { background: color-mix(in srgb, var(--warn) 4%, transparent); }
.composer-foot { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.file-btn { position: relative; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn.has-files { border-color: var(--accent); color: var(--accent); }

.props select, .props input { padding-top: 8px; padding-bottom: 8px; }
.props.dirty [data-save-btn] { animation: nudge 1.6s var(--ease) infinite; }
@keyframes nudge { 0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); } 50% { box-shadow: 0 0 0 6px transparent; } }
.client-mini { display: flex; align-items: center; gap: 12px; color: var(--text); padding: 8px; margin: -8px; border-radius: 12px; transition: background .2s; }
.client-mini:hover { background: var(--surface-2); color: var(--text); }
.client-mini span { display: flex; flex-direction: column; }
.client-mini small { color: var(--muted); }
.kv { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }
.kv .icon { width: 15px; height: 15px; color: var(--muted); }
a.kv:hover { color: var(--accent); }
.mini-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.mini-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.mini-list a { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-list a:hover { color: var(--accent); }
.mini-list .badge { font-size: 10.5px; padding: 1px 7px; }
.dates { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; }
.dates dt { color: var(--muted); }
.dates dd { margin: 0; color: var(--text-2); }
.kv-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 13px; }
.kv-list dt { color: var(--muted); }
.kv-list dd { margin: 0; overflow-wrap: anywhere; }

/* Users ----------------------------------------------------------------- */
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.user-card { display: flex; flex-direction: column; gap: 16px; }
.user-card:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.user-card.inactive { opacity: .55; }
.user-card-top { display: flex; align-items: center; gap: 14px; }
.user-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.user-stats div { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; }
.user-stats strong { font-size: 17px; }
.user-stats strong.small { font-size: 13px; line-height: 25px; }
.user-stats small { color: var(--muted); font-size: 11px; }
.user-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }

/* FAQs ------------------------------------------------------------------ */
.faq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.faq-card { display: flex; flex-direction: column; gap: 14px; }
.faq-card:hover { transform: translateY(-4px); border-color: var(--accent-line); box-shadow: 0 24px 44px -22px var(--accent-glow); }
.faq-icon { position: relative; width: 48px; height: 56px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(160deg, color-mix(in srgb, var(--danger) 25%, var(--surface-3)), var(--surface-3)); color: #fecaca; transition: transform .4s var(--spring); }
.faq-icon .icon { width: 24px; height: 24px; }
.faq-icon span { position: absolute; bottom: -6px; right: -8px; font-size: 9.5px; font-weight: 800; letter-spacing: .05em; background: var(--danger); color: #2b0606; padding: 1px 6px; border-radius: 5px; }
.faq-card:hover .faq-icon { transform: rotate(-6deg) translateY(-2px); }
.faq-body { flex: 1; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.faq-body h3 { font-size: 16px; }
.faq-body p { font-size: 13px; }
.faq-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.faq-actions form { margin-left: auto; }
.faq-actions .icon-btn:first-of-type { margin-left: auto; }
.help-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 36px; }
.help-hero h1 { font-size: 34px; }

/* Checks (settings) */
.checks { list-style: none; padding: 0; margin: 10px 0 14px; display: flex; flex-direction: column; gap: 8px; }
.checks li { display: flex; align-items: center; gap: 10px; }
.checks li .icon { width: 20px; height: 20px; padding: 3px; border-radius: 50%; }
.checks li.ok .icon { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.checks li.bad .icon { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }

/* Menu ------------------------------------------------------------------ */
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; padding: 6px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-6px) scale(.97); transform-origin: top right; pointer-events: none;
  transition: opacity .18s, transform .25s var(--ease); z-index: 60;
}
.menu.open .menu-pop { opacity: 1; transform: none; pointer-events: auto; }
.menu-pop a, .menu-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 9px; color: var(--text-2); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-3); color: var(--text); }

/* Palette --------------------------------------------------------------- */
.palette {
  position: fixed; top: 72px; right: 24px; width: 300px; z-index: 80; padding: 16px; border-radius: 18px;
  background: color-mix(in srgb, var(--surface-2) 92%, transparent); backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong); box-shadow: 0 30px 60px -20px rgba(0,0,0,.8), 0 0 0 1px rgba(255,255,255,.02);
  display: flex; flex-direction: column; gap: 12px;
  animation: palette-in .35s var(--spring);
}
@keyframes palette-in { from { opacity: 0; transform: translateY(-10px) scale(.95); } }
.palette.closing { animation: palette-out .18s ease-in forwards; }
@keyframes palette-out { to { opacity: 0; transform: translateY(-6px) scale(.97); } }
.palette-head { display: flex; align-items: center; justify-content: space-between; }
.palette-label { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 600; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.swatch { aspect-ratio: 1; border-radius: 50%; border: 2px solid transparent; background: var(--c); cursor: pointer; position: relative; transition: transform .25s var(--spring), box-shadow .25s; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.swatch:hover { transform: scale(1.15); }
.swatch.active { box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 4px var(--c), 0 0 18px var(--c); }
.custom-color { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border); cursor: pointer; }
.custom-color input { width: 30px; height: 30px; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 8px; }
.custom-color input::-webkit-color-swatch-wrapper { padding: 0; }
.custom-color input::-webkit-color-swatch { border: 0; border-radius: 8px; }
.custom-color span { flex: 1; font-weight: 500; }
.custom-color code { font-size: 12px; }
.bg-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.bg-option { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; transition: border-color .2s, color .2s; }
.bg-option i { width: 18px; height: 18px; border-radius: 6px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.bg-option:hover { color: var(--text); }
.bg-option.active { border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 3px var(--accent-softer); }
.palette-fab { position: fixed; right: 20px; bottom: 20px; z-index: 70; }
body.bare .palette { top: auto; bottom: 72px; right: 20px; }

/* Toasts ---------------------------------------------------------------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2) 94%, transparent); backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow); --tc: var(--accent);
  border-left: 3px solid var(--tc); animation: toast-in .5s var(--spring) both; position: relative; overflow: hidden;
}
.toast::after { content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--tc); transform-origin: left; animation: toast-timer 5s linear forwards; opacity: .6; }
.toast:hover::after { animation-play-state: paused; }
.toast > .icon { color: var(--tc); margin-top: 1px; }
.toast span { flex: 1; }
.toast-success { --tc: var(--ok); }
.toast-error { --tc: var(--danger); }
.toast-x { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; }
.toast-x .icon { width: 15px; height: 15px; }
.toast.out { animation: toast-out .3s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px) scale(.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px); } }
@keyframes toast-timer { to { transform: scaleX(0); } }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; animation: shake .45s var(--ease); }
.alert-error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: #fecaca; border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.alert .icon { color: var(--danger); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* Modals ---------------------------------------------------------------- */
.modal {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border-radius: 20px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  box-shadow: 0 40px 80px -24px rgba(0,0,0,.85);
}
.modal-sm { width: min(420px, calc(100vw - 32px)); }
.modal[open] { animation: modal-in .4s var(--spring); }
.modal.closing { animation: modal-out .2s ease-in forwards; }
.modal::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(6px); animation: fade-in .3s ease; }
.modal.closing::backdrop { animation: fade-out .2s ease forwards; }
@keyframes modal-in { from { opacity: 0; transform: translateY(20px) scale(.95); } }
@keyframes modal-out { to { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.modal-head h3 .icon { color: var(--accent); }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
.confirm-body { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 28px; }
.confirm-icon { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); margin-bottom: 4px; animation: pop .5s var(--spring); }
.confirm-icon .icon { width: 26px; height: 26px; }

/* Auth page ------------------------------------------------------------- */
.bare-page { min-height: 100vh; display: flex; flex-direction: column; position: relative; z-index: 1; }
.auth { flex: 1; display: grid; place-items: center; padding: 24px 0; }
.auth-card { width: min(420px, 100%); padding: 34px; display: flex; flex-direction: column; gap: 22px; }
.auth-brand { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.auth-brand .brand-mark { animation: float 5s ease-in-out infinite; }
.auth-brand h1 { font-size: 26px; }
.auth-foot { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; text-align: center; padding-top: 16px; border-top: 1px solid var(--border); }
.auth-foot a { display: inline-flex; align-items: center; gap: 6px; }
.auth input { height: 44px; }

/* Responsive ------------------------------------------------------------ */
@media (max-width: 1280px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .ticket-layout { grid-template-columns: 1fr; }
  .ticket-side { position: static; }
  .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-105%); transition: transform .35s var(--ease); box-shadow: 30px 0 60px rgba(0,0,0,.6); background: var(--bg-2); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.55); backdrop-filter: blur(3px); animation: fade-in .25s; }
  .only-mobile { display: inline-grid; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .user-chip-text, .search kbd { display: none; }
  .user-chip { padding: 3px; }
  .page { padding: 20px 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .stat-grid, .stat-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .palette { right: 16px; left: 16px; width: auto; top: 66px; }
  h1 { font-size: 22px; }
}
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .stat-value { font-size: 26px; }
  .status-bars a { grid-template-columns: 120px 1fr 28px; }
  .filters select { flex: 1; min-width: 120px; }
  .filters .grow { min-width: 100%; }
  .col-subject { min-width: 200px; }
  .table td, .table th { padding: 11px 12px; }
  .ticket-list .badge.status { display: none; }
  .composer-foot > .row { flex-wrap: wrap; }
  .page-head { align-items: flex-start; }
  .search { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .ambient { display: none; }
}
