/* ==========================================================================
   HelpDesk – design tokens
   ========================================================================== */
:root {
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --primary: #1f6dff;
    --primary-hover: #3a80ff;
    --green: #22c55e;
    --red: #ef4444;
    --amber: #f5a524;
    --purple: #8b5cf6;
    --radius: 14px;
    --sidebar-w: 236px;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #040a18;
    --bg-glow: radial-gradient(1200px 600px at 70% -10%, #0e2150 0%, transparent 60%), radial-gradient(900px 500px at 0% 100%, #0a1a3d 0%, transparent 60%);
    --sidebar: #050d20;
    --surface: #0a152e;
    --surface-grad: linear-gradient(160deg, #0d1b3b 0%, #09132b 100%);
    --surface-2: #0e1d3f;
    --input: #0b1731;
    --border: #1a2d57;
    --border-soft: #14244a;
    --text: #f2f6ff;
    --text-2: #c3cfe8;
    --muted: #8da0c6;
    --primary-soft: rgba(31, 109, 255, .18);
    --row-hover: rgba(255, 255, 255, .03);
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
    --bubble: #0c1a38;
    --tag-bg: #1347c7;
    --tag-fg: #eaf1ff;
    --pill-high: #e5484d;     --pill-high-fg: #fff;
    --pill-medium: #f59e0b;   --pill-medium-fg: #fff;
    --pill-low: #19b86a;      --pill-low-fg: #fff;
    --pill-open: #e5484d;     --pill-open-fg: #fff;
    --pill-inprogress: #1f6dff; --pill-inprogress-fg: #fff;
    --pill-waiting: #f59e0b;  --pill-waiting-fg: #fff;
    --pill-resolved: #19b86a; --pill-resolved-fg: #fff;
    --tone-red: #ff4d5e;   --tone-red-bg: rgba(255, 77, 94, .16);
    --tone-blue: #2f7bff;  --tone-blue-bg: rgba(47, 123, 255, .18);
    --tone-amber: #fbb024; --tone-amber-bg: rgba(251, 176, 36, .16);
    --tone-green: #22c55e; --tone-green-bg: rgba(34, 197, 94, .16);
    --tone-orange: #fbb024; --tone-orange-bg: rgba(251, 176, 36, .16);
    --tone-purple: #9b72ff; --tone-purple-bg: rgba(155, 114, 255, .18);
    --tone-pink: #ff5fae;   --tone-pink-bg: rgba(255, 95, 174, .16);
    --tone-yellow: #facc15; --tone-yellow-bg: rgba(250, 204, 21, .16);
    --tone-cyan: #22d3ee;   --tone-cyan-bg: rgba(34, 211, 238, .16);
    --chart-grid: rgba(255, 255, 255, .06);
    --trend-created: #2f7bff;
    --trend-inprogress: #c2457a;
    --trend-closed: #16a34a;
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f3f6fb;
    --bg-glow: none;
    --sidebar: #ffffff;
    --surface: #ffffff;
    --surface-grad: #ffffff;
    --surface-2: #f6f8fc;
    --input: #ffffff;
    --border: #e3e9f3;
    --border-soft: #edf1f8;
    --text: #0e1a3a;
    --text-2: #34415f;
    --muted: #6b7a99;
    --primary-soft: rgba(31, 109, 255, .1);
    --row-hover: rgba(15, 30, 80, .03);
    --shadow: 0 6px 22px rgba(20, 40, 100, .08);
    --bubble: #ffffff;
    --tag-bg: #e6efff;
    --tag-fg: #1f5fe0;
    --pill-high: #fde7ea;     --pill-high-fg: #e03a4a;
    --pill-medium: #feeed3;   --pill-medium-fg: #e08a00;
    --pill-low: #dcf5e7;      --pill-low-fg: #16a35a;
    --pill-open: #fde7ea;     --pill-open-fg: #e03a4a;
    --pill-inprogress: #e1ecff; --pill-inprogress-fg: #1f5fe0;
    --pill-waiting: #feeed3;  --pill-waiting-fg: #e08a00;
    --pill-resolved: #dcf5e7; --pill-resolved-fg: #16a35a;
    --tone-red: #ef4455;   --tone-red-bg: #fde7ea;
    --tone-blue: #1f6dff;  --tone-blue-bg: #e1ecff;
    --tone-amber: #f59e0b; --tone-amber-bg: #feeed3;
    --tone-green: #19b86a; --tone-green-bg: #dcf5e7;
    --tone-orange: #f59e0b; --tone-orange-bg: #feeed3;
    --tone-purple: #8b5cf6; --tone-purple-bg: #efe8ff;
    --tone-pink: #ec4899;   --tone-pink-bg: #fde6f2;
    --tone-yellow: #eab308; --tone-yellow-bg: #fef7d6;
    --tone-cyan: #06b6d4;   --tone-cyan-bg: #d9f6fb;
    --chart-grid: rgba(15, 30, 80, .08);
    --trend-created: #1f6dff;
    --trend-inprogress: #c2457a;
    --trend-closed: #16a34a;
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.45;
    color: var(--text);
    background-color: var(--bg);
    background-image: var(--bg-glow);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}
h1, h2, p, ul, dl, dd { margin: 0; padding: 0; }
ul { list-style: none; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 14px; font-weight: 600; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
small { font-size: 12px; }
.muted { color: var(--muted); }
.grow { flex: 1; }
.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.logo-mark { width: 30px; height: 30px; flex: none; }
:root[data-theme="dark"] .if-light, :root[data-theme="light"] .if-dark { display: none; }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-lg { font-size: 26px; }
.brand-lg .logo-mark { width: 44px; height: 44px; }

/* Avatars (initials stand in for photos) */
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex: none; font-size: 12px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #f0a67a, #c4673a); box-shadow: 0 0 0 2px var(--surface); }
.avatar.sk { background: linear-gradient(135deg, #f6b48a, #d77a4a); }
.avatar.jd { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.avatar.jd-sk { background: linear-gradient(135deg, #2f7bff, #1f56d8); }
.avatar.lg { width: 44px; height: 44px; font-size: 14px; background: linear-gradient(135deg, #6a7cf5, #4b4fd8); }
.avatar.xs { width: 18px; height: 18px; font-size: 8px; box-shadow: none; }

/* Buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: 14px; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(31, 109, 255, .35); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: var(--input); border-color: var(--border); color: var(--text); font-weight: 500; }
.btn-outline:hover { border-color: var(--primary); }
.btn-block { width: 100%; height: 44px; }
.btn-soft { background: var(--primary-soft); color: var(--primary); padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 600; }
:root[data-theme="dark"] .btn-soft { color: #6aa0ff; }
.btn-soft:hover { text-decoration: none; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-size: 18px; }
.icon-btn:hover { background: var(--row-hover); text-decoration: none; }
.search { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--input); color: var(--muted); flex: 1; min-width: 0; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.search input::placeholder, textarea::placeholder, .field input::placeholder { color: var(--muted); }
.search:focus-within, .field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* Pills */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.pri-high { background: var(--pill-high); color: var(--pill-high-fg); }
.pri-medium { background: var(--pill-medium); color: var(--pill-medium-fg); }
.pri-low { background: var(--pill-low); color: var(--pill-low-fg); }
.st-open { background: var(--pill-open); color: var(--pill-open-fg); }
.st-inprogress { background: var(--pill-inprogress); color: var(--pill-inprogress-fg); }
.st-waiting { background: var(--pill-waiting); color: var(--pill-waiting-fg); }
.st-resolved { background: var(--pill-resolved); color: var(--pill-resolved-fg); }
.st-open-green { background: #19b86a; color: #fff; padding: 3px 12px; }
:root[data-theme="light"] .st-open-green { background: #d9f6e6; color: #14a05a; }

/* Cards */
.card { background: var(--surface-grad); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; }

/* ==========================================================================
   App shell
   ========================================================================== */
.app { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; width: var(--sidebar-w); flex: none; display: flex; flex-direction: column; padding: 22px 12px 18px; background: var(--sidebar); border-right: 1px solid var(--border-soft); }
.sidebar .brand { padding: 0 6px 22px; }
.side-nav { display: flex; flex-direction: column; gap: 6px; }
.side-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; }
.side-link .icon { font-size: 17px; }
.side-link:hover { background: var(--row-hover); text-decoration: none; }
.side-link.active { background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(31, 109, 255, .35); }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-top: 1px solid var(--border-soft); padding-top: 16px; }
.side-user .who { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.side-user .who strong { font-size: 13px; }
.side-user .who small { color: var(--muted); }
.main { flex: 1; min-width: 0; padding: 0 20px 28px; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 16px 0 6px; }
.topbar .search { max-width: 560px; flex: 0 1 560px; }
.content { max-width: 1180px; width: 100%; min-width: 0; padding-top: 14px; }
.page-head { margin-bottom: 18px; }
.page-head p { margin-top: 4px; font-size: 13px; }
.greeting { font-size: 24px; }
.wave { display: inline-block; }

/* Mobile top bar + bottom nav */
.mobile-bar { align-items: center; gap: 6px; padding: 12px 0 4px; }

/* ==========================================================================
   Dashboard
   ========================================================================== */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.stat { position: relative; padding: 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-grad); box-shadow: var(--shadow); overflow: hidden; }
.stat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 80px; background: linear-gradient(180deg, var(--tone-bg), transparent); opacity: .7; pointer-events: none; }
.stat > * { position: relative; }
.stat-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--tone); color: #fff; margin-bottom: 14px; font-size: 17px; box-shadow: 0 6px 16px color-mix(in srgb, var(--tone) 45%, transparent); }
.stat-label { color: var(--text-2); font-size: 13px; font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.2; margin: 2px 0 4px; }
.stat-delta { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; }
.stat-delta.good { color: var(--green); }
.stat-delta.bad { color: var(--red); }
.tone-red { --tone: var(--tone-red); --tone-bg: var(--tone-red-bg); }
.tone-blue { --tone: var(--tone-blue); --tone-bg: var(--tone-blue-bg); }
.tone-amber { --tone: var(--tone-amber); --tone-bg: var(--tone-amber-bg); }
.tone-green { --tone: var(--tone-green); --tone-bg: var(--tone-green-bg); }
.tone-orange { --tone: var(--tone-orange); --tone-bg: var(--tone-orange-bg); }
.tone-purple { --tone: var(--tone-purple); --tone-bg: var(--tone-purple-bg); }
.tone-pink { --tone: var(--tone-pink); --tone-bg: var(--tone-pink-bg); }
.tone-yellow { --tone: var(--tone-yellow); --tone-bg: var(--tone-yellow-bg); }
.tone-cyan { --tone: var(--tone-cyan); --tone-bg: var(--tone-cyan-bg); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.trends, .category, .recent { padding: 16px; }
.trends { position: relative; }
.legend { display: flex; gap: 16px; font-size: 11px; color: var(--text-2); }
.legend i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.legend-top { justify-content: flex-end; margin-top: -18px; }
.chart { width: 100%; max-height: 270px; overflow: visible; margin-top: 6px; display: block; }
.grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.axis { fill: var(--muted); font-size: 7px; font-family: var(--font); }
.donut-wrap { display: flex; align-items: center; gap: 22px; margin-top: 12px; }
.donut { width: 128px; flex: none; }
.donut-num { fill: var(--text); font-size: 17px; font-weight: 700; font-family: var(--font); }
.donut-sub { fill: var(--muted); font-size: 6.5px; font-family: var(--font); }
.legend-list { flex-direction: column; gap: 9px; flex: 1; font-size: 12px; }
.legend-list li { display: flex; align-items: center; }
.legend-list span { flex: 1; }
.legend-list b { font-weight: 600; color: var(--text); }

.recent .card-head { margin-bottom: 8px; }
.recent-list li a { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-top: 1px solid var(--border-soft); color: var(--text); font-size: 13px; }
.recent-list li a:hover { background: var(--row-hover); text-decoration: none; }
.t-ico { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--tone); color: #fff; font-size: 12px; }
.t-id { color: var(--primary); font-weight: 600; font-size: 12px; }
:root[data-theme="dark"] .t-id { color: #4d8dff; }
.recent-list .t-id { width: 66px; }
.recent-list .t-subject { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-list .pill { min-width: 62px; text-align: center; margin-right: 40px; }
.t-time { color: var(--text-2); font-size: 12px; white-space: nowrap; min-width: 70px; text-align: right; }

/* ==========================================================================
   Ticket list
   ========================================================================== */
.tickets-head { display: flex; align-items: flex-start; gap: 12px; }
.toolbar { display: flex; gap: 12px; margin-bottom: 14px; }
.toolbar .btn { height: 40px; padding: 0 16px; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.chip b { font-weight: 500; opacity: .85; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(31, 109, 255, .35); }
.chip.active b { font-weight: 700; }

.table-wrap { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-grad); overflow-x: auto; box-shadow: var(--shadow); }
.tickets-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tickets-table th { text-align: left; padding: 14px 14px 12px; font-weight: 500; color: var(--text-2); font-size: 11px; }
.tickets-table td { padding: 0 14px; height: 40px; border-top: 1px solid var(--border-soft); white-space: nowrap; }
.tickets-table tbody tr:hover { background: var(--row-hover); }
.tickets-table .c-check { width: 38px; padding-right: 0; }
.tickets-table .c-subject a { color: var(--text); }
.tickets-table .c-subject { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.muted-cell { color: var(--text-2); }
.cbox { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--muted); vertical-align: middle; }
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; font-size: 12px; }
.pages { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.pages button { min-width: 28px; height: 28px; padding: 0 6px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); display: inline-grid; place-items: center; }
.pages button:hover { background: var(--row-hover); }
.pages button.active { background: var(--primary); color: #fff; font-weight: 600; }

/* ==========================================================================
   Ticket detail
   ========================================================================== */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 290px; grid-template-areas: "head head" "title prio" "thread side" "composer composer"; column-gap: 16px; align-items: start; }
.detail-head { grid-area: head; display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.detail-head .icon-btn { margin-left: -8px; }
.detail-head .icon-btn:last-child { margin-left: 0; }
.ticket-no { font-size: 18px; font-weight: 700; }
.detail-title { grid-area: title; margin-bottom: 14px; }
.detail-title h1 { font-size: 22px; }
.detail-title p { margin-top: 4px; font-size: 12px; }
.detail-priority { grid-area: prio; display: flex; flex-direction: column; gap: 6px; font-size: 12px; margin-bottom: 14px; }
.select { position: relative; display: block; }
.select select { appearance: none; width: 100%; height: 38px; padding: 0 36px 0 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--input); font-weight: 600; font-size: 13px; outline: 0; }
.select .icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; font-size: 16px; }
.pri-high-select select, .pri-high-select .icon { color: #ff6b78; }
.pri-high-select select { background: rgba(229, 72, 77, .16); border-color: rgba(229, 72, 77, .45); }
:root[data-theme="light"] .pri-high-select select { background: #fdeaed; border-color: #f9c9d0; color: #e03a4a; }

.thread { grid-area: thread; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 12px; align-items: flex-start; }
.msg .avatar { width: 32px; height: 32px; font-size: 11px; }
.bubble { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px; background: var(--bubble); border: 1px solid var(--border); font-size: 12.5px; color: var(--text); }
.bubble header { margin-bottom: 6px; }
.bubble header b { font-size: 12px; }
.bubble header small { color: var(--primary); margin-left: 4px; font-size: 11px; }
.bubble p + p { margin-top: 8px; }
.attachment { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.attachment .thumb { display: grid; place-items: center; width: 52px; height: 36px; border-radius: 6px; background: linear-gradient(135deg, #123a78, #0a1f4a); color: #6aa0ff; border: 1px solid var(--border); }
.attachment b { display: block; font-size: 12px; font-weight: 500; }
.attachment small { color: var(--muted); }

.side-panels { grid-area: side; display: flex; flex-direction: column; gap: 12px; }
.panel { padding: 14px 16px; }
.panel h2 { margin-bottom: 12px; }
.requester { display: flex; align-items: center; gap: 12px; }
.requester b { display: block; font-size: 13px; }
.requester small { color: var(--muted); }
.details > div { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; font-size: 12px; }
.details dt { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.details dt .icon { width: 14px; height: 14px; }
.details dd { display: flex; align-items: center; gap: 6px; width: 54%; color: var(--text); }
.k-red .icon { color: var(--red); } .k-amber .icon { color: var(--amber); } .k-green .icon { color: var(--green); } .k-blue .icon { color: var(--primary); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.red { background: var(--red); } .dot.blue { background: var(--primary); } .dot.sq { border-radius: 2px; }
.muted-ico { color: var(--muted); display: inline-flex; }
.muted-ico .icon { width: 12px; height: 12px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px; border-radius: 999px; background: var(--tag-bg); color: var(--tag-fg); font-size: 11px; font-weight: 500; border: 0; }
.tag-add { background: transparent; border: 1px dashed var(--border); color: var(--primary); padding: 5px 14px; }
.tag-add .icon { width: 11px; height: 11px; }

.composer { grid-area: composer; margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-grad); overflow: hidden; }
.composer-tabs { display: flex; align-items: center; gap: 4px; padding: 6px 8px 0; border-bottom: 1px solid var(--border-soft); }
.composer-tabs > button { padding: 8px 14px; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.composer-tabs > button.active { color: var(--primary); border-bottom-color: var(--primary); }
.tools { display: flex; gap: 14px; padding-right: 8px; color: var(--muted); font-size: 14px; }
.composer-body { display: flex; align-items: flex-end; gap: 10px; padding: 10px 12px 12px; }
.composer-body textarea { flex: 1; min-height: 44px; resize: vertical; border: 0; outline: 0; background: transparent; font-size: 13px; padding-top: 4px; }
.composer .send { height: 34px; padding: 0 20px; font-size: 13px; }

/* ==========================================================================
   Auth
   ========================================================================== */
.auth-body { display: grid; place-items: center; padding: 24px 16px; }
.auth-toggle { position: fixed; top: 14px; right: 14px; }
.auth-card { width: 100%; max-width: 440px; padding: 40px 36px 30px; border-radius: 18px; border: 1px solid var(--border); background: var(--surface-grad); box-shadow: var(--shadow); }
.auth-hero { display: none; }
.auth-card h1 { margin-top: 28px; font-size: 24px; }
.auth-card > .muted { margin: 4px 0 20px; font-size: 13px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--input); color: var(--muted); font-size: 18px; }
.field-body { display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: 14px; line-height: 1.25; }
.field-body small { color: var(--text-2); font-size: 11px; }
.field input { border: 0; outline: 0; background: transparent; padding: 0; color: var(--text); font-size: 13px; width: 100%; }
.eye { border: 0; background: transparent; color: var(--muted); font-size: 18px; display: grid; place-items: center; padding: 4px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; margin: 2px 0 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--primary); font-weight: 500; cursor: pointer; }
:root[data-theme="light"] .check { color: var(--text-2); }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--muted); display: grid; place-items: center; color: transparent; font-size: 11px; }
.check input:checked + .box { background: var(--primary); border-color: var(--primary); color: #fff; }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 16px; color: var(--muted); font-size: 11px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-card .btn-outline { margin-bottom: 12px; }
.brand-ico { width: 20px; height: 20px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 12px; }
.auth-foot a { font-weight: 600; }

/* ==========================================================================
   Desktop-only helpers & mobile layout
   ========================================================================== */
@media (min-width: 900px) {
    .m-only { display: none !important; }
    .mobile-bar { display: none; }
    .bottom-nav { display: none; }
}

@media (max-width: 899.98px) {
    .d-only { display: none !important; }
    .mobile-bar { display: flex; }
    .sidebar { display: none; }
    .main { padding: 0 16px 24px; }
    .has-bottom-nav .main { padding-bottom: 96px; }
    .content { padding-top: 6px; }
    h1 { font-size: 20px; }
    .greeting { font-size: 19px; margin-top: 10px; }
    .page-head { margin-bottom: 14px; }
    .brand { font-size: 15px; }
    .logo-mark { width: 24px; height: 24px; }

    .stats { gap: 8px; }
    .stat { padding: 10px 8px; border-radius: 12px; box-shadow: none; }
    .stat-icon { width: 26px; height: 26px; margin-bottom: 8px; font-size: 13px; border-radius: 7px; }
    .stat-label { font-size: 10.5px; }
    .stat-value { font-size: 20px; }
    .stat-delta { font-size: 10px; }
    .dash-grid { grid-template-columns: minmax(0, 1fr); }
    .category { display: none; }
    .card { box-shadow: none; }
    .trends, .recent { padding: 12px; }
    .recent-list li a { flex-wrap: wrap; row-gap: 2px; }
    .recent-list .t-ico { display: none; }
    .recent-list .t-id { width: auto; }
    .recent-list .t-subject { order: 3; flex-basis: 100%; }
    .recent-list .pill { margin: 0 0 0 auto; min-width: 0; }
    .recent-list .t-time { min-width: 0; }

    .tickets-head { margin-bottom: 10px; }
    .toolbar .btn { width: 40px; padding: 0; }
    .ticket-cards { background: var(--surface-grad); border: 1px solid var(--border); border-radius: var(--radius); }
    .ticket-cards li + li { border-top: 1px solid var(--border-soft); }
    .ticket-cards a { display: grid; grid-template-columns: 1fr auto; row-gap: 6px; padding: 12px 14px; color: var(--text); font-size: 12px; }
    .ticket-cards a:hover { text-decoration: none; background: var(--row-hover); }
    .ticket-cards .t-id { grid-column: 1; font-size: 11px; }
    .ticket-cards .pill { grid-column: 2; grid-row: 1; justify-self: end; }
    .ticket-cards .t-subject { grid-column: 1; grid-row: 2; font-weight: 500; }
    .ticket-cards .t-time { grid-column: 2; grid-row: 2; justify-self: end; color: var(--muted); min-width: 0; }

    .bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: space-around; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
    .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 52px; color: var(--muted); font-size: 10px; font-weight: 500; }
    .bottom-nav a:hover { text-decoration: none; }
    .bottom-nav a .icon { font-size: 20px; }
    .bottom-nav a.active { color: var(--primary); }
    .bottom-nav .fab { width: 46px; height: 46px; margin-top: -22px; border-radius: 50%; justify-content: center; background: var(--primary); color: #fff; box-shadow: 0 8px 20px rgba(31, 109, 255, .45); border: 4px solid var(--surface); }
    .bottom-nav .fab .icon { font-size: 22px; }

    .detail { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "title" "prio" "thread" "side" "composer"; }
    .detail-priority { flex-direction: row; align-items: center; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--border-soft); }
    .detail-priority .select { width: 100px; }
    .detail-priority .select select { height: 30px; font-size: 12px; }
    .thread { margin-bottom: 14px; }
    .msg > .avatar { width: 28px; height: 28px; }
    .detail .card { box-shadow: none; }
    .composer { position: sticky; bottom: 12px; box-shadow: var(--shadow); margin-top: 14px; }
    .composer-body { align-items: center; }
    .composer .send { width: 38px; padding: 0; font-size: 16px; }
    .composer-tabs { display: flex; }

    /* Auth: full-bleed light screen with illustration */
    .auth-body { display: block; padding: 0; }
    .auth-card { max-width: 480px; margin: 0 auto; min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; padding: 24px 24px 28px; background: var(--bg); }
    .auth-hero { display: block; width: 270px; margin: 0 auto 4px; }
    .brand.brand-lg { font-size: 24px; }
    .brand-lg .logo-mark { width: 40px; height: 40px; }
    .auth-card h1 { margin-top: 18px; }
    .auth-toggle { top: 10px; right: 10px; }
}

@media (min-width: 900px) and (max-width: 1100px) {
    .stats { gap: 10px; }
    .detail { grid-template-columns: minmax(0, 1fr) 260px; }
}

/* ==========================================================================
   Main palette: blue, red, orange, green, purple, pink, yellow, cyan.
   Each color is a pair of tokens per theme (--tone-<color> and --tone-<color>-bg),
   used through the .tone-<color> classes, which set --tone and --tone-bg.
   ==========================================================================
   App shell additions (Web): admin navigation, mobile drawer, page header
   ========================================================================== */
.content { max-width: 1440px; }
/* Only the menu scrolls: the title stays at the top, and the signed in user (with Log out) stays at the bottom */
.sidebar { overflow: hidden; height: 100dvh; }
.sidebar-top, .side-user { flex: none; }
.side-nav > * { flex-shrink: 0; }
.side-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -6px; padding: 0 6px 8px; scrollbar-width: thin; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; }
.side-section { margin: 18px 12px 4px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.side-user .who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user form { display: contents; }
.avatar { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.page-head-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 10px; }
.tenant-selector { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.tenant-selector .select { min-width: 160px; }
.app-footer { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--border-soft); font-size: 11px; }
.nav-backdrop { display: none; }

/* Plain content card, e.g. Tenant Settings */
.card-body { padding: 18px 20px; }
.card-body + .card-body { border-top: 1px solid var(--border-soft); }
.card-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.card-text { color: var(--text-2); font-size: 13px; margin: 0 0 14px; }
.card + .card { margin-top: 14px; }
.text-danger { color: var(--red); }

@media (max-width: 899.98px) {
    .sidebar { display: flex; position: fixed; left: 0; top: 0; bottom: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
    .app.nav-open .sidebar { transform: none; }
    .app.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(2, 6, 20, .55); }
    .page-head-bar { padding-top: 4px; }
    .tenant-selector { width: 100%; }
    .tenant-selector .select { flex: 1; }
}
.card-actions { margin-top: 16px; }
.auth-error { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; padding: 10px 12px; border-radius: 10px; background: var(--tone-red-bg); color: var(--tone-red); font-size: 12.5px; }
.auth-error .icon { margin-top: 1px; }
.side-user { gap: 8px; padding-left: 4px; padding-right: 0; }
.side-user .icon-btn { width: 32px; height: 32px; }

/* Colored menu icons: a tinted tile in the sidebar, a solid tile in the page header */
.nav-ico { display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 8px; background: var(--tone-bg); color: var(--tone); }
.side-link .nav-ico .icon { font-size: 15px; }
.side-link.active .nav-ico { background: rgba(255, 255, 255, .22); color: #fff; }
.side-link { padding: 7px 10px; }
.page-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--tone); color: #fff; font-size: 21px; box-shadow: 0 8px 20px color-mix(in srgb, var(--tone) 40%, transparent); }
.page-title { min-width: 0; flex: 1 1 320px; }
.page-head-bar .grow { display: none; }
.logo-mark { object-fit: contain; }
.sidebar-top .brand { min-width: 0; }
.sidebar-top .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-toggle { flex: none; }

/* Collapsed sidebar (desktop): an icon rail, labels are shown as tooltips */
@media (min-width: 900px) {
    .sidebar { transition: width .2s ease; }
    .app.sidebar-collapsed .sidebar { width: 76px; padding-left: 10px; padding-right: 10px; }
    .app.sidebar-collapsed .sidebar-top { flex-direction: column; gap: 10px; }
    .app.sidebar-collapsed .sidebar .brand { padding: 0 0 4px; }
    .app.sidebar-collapsed .brand span,
    .app.sidebar-collapsed .side-label,
    .app.sidebar-collapsed .side-user .who { display: none; }
    .app.sidebar-collapsed .side-section { margin: 14px 0 4px; height: 1px; background: var(--border-soft); }
    .app.sidebar-collapsed .side-section span { display: none; }
    .app.sidebar-collapsed .side-link { justify-content: center; padding: 8px 0; }
    .app.sidebar-collapsed .side-user { flex-direction: column; padding-left: 0; }
}
.logo-mark { width: 36px; height: 36px; }
.brand-lg .logo-mark { width: 56px; height: 56px; }
@media (max-width: 899.98px) {
    .logo-mark { width: 30px; height: 30px; }
    .brand-lg .logo-mark { width: 48px; height: 48px; }
}

/* Signed in user at the bottom of the sidebar, opens the Profile */
.side-profile { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 4px; margin: -4px; border-radius: 10px; color: var(--text); }
.side-profile:hover { background: var(--row-hover); text-decoration: none; }
.side-profile .who { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.side-profile .who strong, .side-profile .who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-profile .who small { color: var(--muted); }
a.avatar:hover { text-decoration: none; }
@media (min-width: 900px) {
    .app.sidebar-collapsed .side-profile { flex: none; }
}

/* Plain forms (non DevExtreme pages, e.g. Profile) */
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.input { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--input); color: var(--text); font-size: 13px; outline: 0; }
.input:hover:not(:disabled) { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.input.input-validation-error { border-color: var(--red); }
.input-with-button { position: relative; display: block; }
.input-with-button .input { padding-right: 44px; }
.input-with-button .eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.form-field .help { color: var(--muted); font-size: 12px; }
.field-error { color: var(--red); font-size: 12px; }
.field-error:empty { display: none; }
.btn:disabled, .eye:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.profile-grid .card + .card { margin-top: 0; }
@media (max-width: 1100px) { .profile-grid { grid-template-columns: minmax(0, 1fr); } }

/* Page notices */
.notice { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.notice .icon { margin-top: 1px; }
.notice-success { background: var(--tone-green-bg); color: var(--tone-green); }
.notice-info { background: var(--tone-blue-bg); color: var(--text); }
.notice-info .icon { color: var(--tone-blue); }
.notice-error { background: var(--tone-red-bg); color: var(--tone-red); }
.input[readonly] { background: var(--surface-2); color: var(--muted); }
.settings-rows { display: flex; flex-direction: column; gap: 12px; max-width: 640px; }
.settings-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: 12px; }
.settings-row label { font-size: 13px; font-weight: 500; color: var(--text-2); }
@media (max-width: 899.98px) { .settings-row { grid-template-columns: minmax(0, 1fr); gap: 6px; } }

/* Ticket forms */
.form-columns { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.form-columns .card + .card { margin-top: 0; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.textarea { height: auto; min-height: 120px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.req { color: var(--red); }
.form-field .select select:disabled { color: var(--muted); background: var(--surface-2); cursor: not-allowed; }
.form-field .select select { font-weight: 500; }
.file-drop { position: relative; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 14px; border: 1px dashed var(--border); border-radius: 10px; color: var(--text-2); font-size: 13px; cursor: pointer; }
.file-drop:hover { border-color: var(--primary); color: var(--primary); }
.file-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-list { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.file-list:empty { display: none; }
.file-list small { color: var(--muted); margin-left: 6px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 20px; text-align: center; }
.ticket-cards .t-meta { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.chip:hover { text-decoration: none; border-color: var(--primary); }
.pages a { min-width: 28px; height: 28px; padding: 0 6px; border-radius: 7px; color: var(--text-2); display: inline-grid; place-items: center; }
.pages a:hover { background: var(--row-hover); text-decoration: none; }
.pages a.active { background: var(--primary); color: #fff; font-weight: 600; }
.st-closed { background: var(--pill-resolved); color: var(--pill-resolved-fg); }
@media (max-width: 899.98px) {
    .form-columns, .form-row { grid-template-columns: minmax(0, 1fr); }
    .pager { justify-content: center; flex-wrap: wrap; gap: 8px; }
}

/* Ticket detail */
.detail .notice { margin-bottom: 0; }
.pill-lg { padding: 3px 12px; font-size: 12px; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-note .bubble { background: var(--tone-orange-bg); border-color: color-mix(in srgb, var(--tone-orange) 40%, transparent); }
.note-tag { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--tone-orange-bg); color: var(--tone-orange); font-size: 10.5px; font-weight: 600; }
.note-tag .icon { width: 11px; height: 11px; }
a.attachment { color: var(--text); }
a.attachment:hover { border-color: var(--primary); text-decoration: none; }
.thread-empty { padding: 12px 0; }
.panel-form { gap: 12px; }
.panel-form .details { margin-top: 2px; }
.panel-help { color: var(--muted); font-size: 12px; margin: -6px 0 12px; }
.panel-field { margin-top: 14px; }
.sev-select select { font-weight: 600; }
.sev-high select, .sev-high .icon { color: var(--pill-high-fg); }
.sev-medium select, .sev-medium .icon { color: var(--pill-medium-fg); }
.sev-low select, .sev-low .icon { color: var(--pill-low-fg); }
:root[data-theme="dark"] .sev-high select, :root[data-theme="dark"] .sev-high .icon { color: #ff6b78; }
:root[data-theme="dark"] .sev-medium select, :root[data-theme="dark"] .sev-medium .icon { color: var(--tone-orange); }
:root[data-theme="dark"] .sev-low select, :root[data-theme="dark"] .sev-low .icon { color: var(--tone-green); }
.sev-high select { background: var(--tone-red-bg); border-color: color-mix(in srgb, var(--tone-red) 45%, transparent); }
.sev-medium select { background: var(--tone-orange-bg); border-color: color-mix(in srgb, var(--tone-orange) 45%, transparent); }
.sev-low select { background: var(--tone-green-bg); border-color: color-mix(in srgb, var(--tone-green) 45%, transparent); }
/* Ticket Status dropdown: the colors of the status pills, as the Severity dropdown (Open red, In Progress blue, Closed green) */
.status-select select { font-weight: 600; }
.status-open select, .status-open .icon { color: var(--pill-open-fg); }
.status-inprogress select, .status-inprogress .icon { color: var(--pill-inprogress-fg); }
.status-closed select, .status-closed .icon { color: var(--pill-resolved-fg); }
:root[data-theme="dark"] .status-open select, :root[data-theme="dark"] .status-open .icon { color: #ff6b78; }
:root[data-theme="dark"] .status-inprogress select, :root[data-theme="dark"] .status-inprogress .icon { color: #6ea2ff; }
:root[data-theme="dark"] .status-closed select, :root[data-theme="dark"] .status-closed .icon { color: var(--tone-green); }
.status-open select { background: var(--tone-red-bg); border-color: color-mix(in srgb, var(--tone-red) 45%, transparent); }
.status-inprogress select { background: var(--tone-blue-bg); border-color: color-mix(in srgb, var(--tone-blue) 45%, transparent); }
.status-closed select { background: var(--tone-green-bg); border-color: color-mix(in srgb, var(--tone-green) 45%, transparent); }
.composer-hint { font-size: 11px; padding-right: 8px; }
.composer-error { display: block; padding: 8px 14px 0; }
.composer-files { padding: 0 14px 10px; }
.composer.composer-note { border-color: color-mix(in srgb, var(--tone-orange) 50%, var(--border)); }
.composer.composer-note .composer-tabs > button.active { color: var(--tone-orange); border-bottom-color: var(--tone-orange); }
.composer .attach { cursor: pointer; }
.bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 52px; border: 0; background: transparent; color: var(--muted); font-size: 10px; font-weight: 500; }
.bottom-nav button .icon { font-size: 20px; }
@media (min-width: 900px) {
    .composer .attach { display: inline-grid; }
}
@media (max-width: 899.98px) {
    .page-title { flex: 1 1 0; }
    .page-icon { width: 38px; height: 38px; font-size: 18px; border-radius: 10px; }
}

/* Knowledge Base */
.kb-draft { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.kb-pending { background: var(--tone-orange-bg); color: var(--tone-orange); }
.kb-approved { background: var(--tone-green-bg); color: var(--tone-green); }
.kb-inactive { background: var(--tone-red-bg); color: var(--tone-red); margin-left: 4px; }
.kb-name { font-weight: 600; }
.kb-detail .detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.kb-detail .detail-head .icon-btn { margin-left: -8px; }
.kb-detail .detail-title { margin-bottom: 14px; }
.kb-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.kb-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.kb-main { display: flex; flex-direction: column; gap: 14px; }
.kb-main .card + .card { margin-top: 0; }
.kb-main .card-title { display: flex; align-items: center; gap: 8px; }
.kb-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.6; color: var(--text); }
.dot.green { background: var(--green); }
.approvals { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.approvals li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border-soft); }
.approvals li:first-child { border-top: 0; }
.approval-ico { display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 8px; background: var(--tone-orange-bg); color: var(--tone-orange); }
.approvals li.approved .approval-ico { background: var(--tone-green-bg); color: var(--tone-green); }
.approval-body { display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: 12.5px; }
.approval-body small { color: var(--muted); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.btn-danger-text { color: var(--red); }
.btn-danger-text:hover:not(:disabled) { border-color: var(--red); }
.notice-warning { background: var(--tone-orange-bg); color: var(--text); }
.notice-warning .icon { color: var(--tone-orange); }
@media (max-width: 899.98px) { .kb-grid { grid-template-columns: minmax(0, 1fr); } }
.label-with-link { display: flex; justify-content: space-between; align-items: baseline; }
.label-with-link a { font-size: 12px; font-weight: 600; }
.btn-link-subtle { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--primary); padding: 4px 0; }
.kb-grid .side-panels { grid-area: auto; }
.panel-field .help { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.file-list li { display: flex; align-items: center; gap: 8px; padding: 6px 4px 6px 10px; border: 1px solid var(--border-soft); border-radius: 8px; background: var(--surface-2); }
.file-list .file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list small { margin-left: 0; }
.file-remove { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; }
.file-remove:hover { background: var(--tone-red-bg); color: var(--tone-red); }
.remove-check { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; font-size: 12px; color: var(--text-2); cursor: pointer; }
.remove-check:has(input:checked) { color: var(--red); }
.existing-files li:has(input:checked) .file-name { text-decoration: line-through; color: var(--muted); }
.kb-attachments { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.kb-attachments .attachment { margin-top: 0; }

/* ==========================================================================
   Dashboard charts (colors validated with the dataviz palette validator, see DashboardHelper)
   ========================================================================== */
.period-filter { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 12px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }
.segmented a { padding: 6px 12px; border-radius: 8px; color: var(--text-2); font-weight: 500; }
.segmented a:hover { text-decoration: none; color: var(--text); }
.segmented a.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(31, 109, 255, .3); }
.stat-caption { color: var(--muted); font-size: 11.5px; font-weight: 500; }
.stat-delta .stat-caption { margin-left: 6px; }
.chart-sub { font-size: 12px; margin-top: 2px; }
.chart-wrap { position: relative; }
.trend-chart { max-height: none; margin-top: 8px; }
.trend-chart .axis { font-size: 11px; font-variant-numeric: tabular-nums; }
.trend-chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend-chart .area { stroke: none; opacity: .1; }
.line-created, .dot-created { stroke: var(--trend-created); }
.line-closed, .dot-closed { stroke: var(--trend-closed); }
.area-created, .dot-created { fill: var(--trend-created); }
.area-closed, .dot-closed { fill: var(--trend-closed); }
.trend-chart .dot { stroke: var(--surface); stroke-width: 2; paint-order: stroke; }
.trend-chart .dot-created { fill: var(--trend-created); }
.trend-chart .dot-closed { fill: var(--trend-closed); }
.trend-chart .crosshair { stroke: var(--muted); stroke-width: 1; opacity: .6; }
.trend-chart .hit { fill: transparent; cursor: crosshair; outline: 0; }
.legend .key, .chart-tip .key { display: inline-block; width: 12px; height: 2px; border-radius: 1px; margin-right: 6px; vertical-align: middle; }
.key-created { background: var(--trend-created); }
.key-closed { background: var(--trend-closed); }
.card-head .legend { margin: 0; }
.chart-tip { position: absolute; top: 8px; z-index: 5; min-width: 140px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); font-size: 12px; pointer-events: none; }
.chart-tip.floating { position: absolute; top: 0; left: 0; min-width: 0; }
.chart-tip .tip-title { color: var(--muted); margin-bottom: 4px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 6px; }
.chart-tip .tip-row b { font-weight: 700; color: var(--text); min-width: 18px; }
.chart-tip .tip-row span { color: var(--text-2); }
.chart-table { margin-top: 8px; font-size: 12px; }
.chart-table summary { cursor: pointer; color: var(--primary); font-weight: 500; }
.chart-table table { width: 100%; margin-top: 8px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.chart-table th, .chart-table td { text-align: left; padding: 6px 8px; border-top: 1px solid var(--border-soft); }
.chart-table th { color: var(--text-2); font-weight: 500; }
.chart-empty { padding: 28px 0; text-align: center; font-size: 13px; }
.donut-seg { fill: none; stroke-width: 12; stroke: var(--cl); cursor: pointer; outline: 0; transition: stroke-width .15s; }
.donut-seg.active, .donut-seg:focus { stroke-width: 15; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; background: var(--cl); }
:root[data-theme="dark"] .donut-seg { stroke: var(--cd); }
:root[data-theme="dark"] .swatch { background: var(--cd); }
.category .donut-wrap { margin-top: 18px; }
.recent-list .pill { min-width: 76px; text-align: center; }
.dash-grid > .card { margin-top: 0; }
.recent-list .t-id { width: auto; min-width: 96px; white-space: nowrap; }
@media (max-width: 899.98px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-caption { font-size: 10.5px; }
    .trend-chart .axis { font-size: 20px; }
    .period-filter .segmented { flex: 1; }
    .period-filter .segmented a { flex: 1; text-align: center; padding: 6px 4px; }
}

.line-inprogress, .dot-inprogress { stroke: var(--trend-inprogress); }
.trend-chart .dot-inprogress { fill: var(--trend-inprogress); }
.key-inprogress { background: var(--trend-inprogress); }
/* Created vs Closed takes a full row, the three donut cards share the row below it */
.dash-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-grid .trends { grid-column: 1 / -1; }
.dash-grid .category .donut-wrap { gap: 18px; }
.dash-grid .legend-list li { min-width: 0; }
.dash-grid .legend-list span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 8px; }
@media (max-width: 1279.98px) {
    .dash-grid .category .donut-wrap { flex-direction: column; align-items: stretch; }
    .dash-grid .category .donut { width: 136px; align-self: center; }
}
/* The chart keeps its proportions; when it is wide it is capped in height (and centered) so its text stays small */
.trend-chart { width: 100%; max-height: 300px; }
.trends .card-head { flex-wrap: wrap; gap: 6px 16px; }
.trends .card-head .legend span { white-space: nowrap; }

/* Profile: notification choices */
.notifications-card { margin-top: 14px; }
.choice-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 24px; }
.check.choice { align-items: flex-start; gap: 12px; padding: 10px 4px; color: var(--text); font-weight: 400; cursor: pointer; }
.check.choice .box { flex: none; margin-top: 2px; }
.choice-text { display: flex; flex-direction: column; gap: 2px; }
.choice-text b { font-size: 13px; font-weight: 600; }
.choice-text small { color: var(--muted); font-size: 12px; line-height: 1.45; }
@media (max-width: 899.98px) { .choice-list { grid-template-columns: minmax(0, 1fr); } }

/* Tickets/Created: the thank you page of an employee's new ticket */
.ticket-created { max-width: 640px; margin: 24px auto 0; }
.ticket-created h2 { font-size: 20px; }
.ticket-created .muted { max-width: 460px; line-height: 1.55; }
.ticket-created .created-ticket { font-weight: 600; overflow-wrap: anywhere; }
.ticket-created .created-ticket .t-id { color: var(--primary); margin-right: 4px; }
.created-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; }

/* User Guide: USERGUIDE.md rendered as a document, with a sticky list of its sections on wide screens */
.guide-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.guide-layout > .card { margin-top: 0; }
.guide-toc { display: none; }
@media (min-width: 1200px) {
    .guide-layout { grid-template-columns: 250px minmax(0, 1fr); }
    .guide-toc { display: block; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 14px 10px; }
}
.guide-toc-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 8px 8px; }
.guide-toc ul { list-style: none; margin: 0; padding: 0; }
.guide-toc a { display: block; padding: 4px 8px; border-radius: 7px; color: var(--text-2); font-size: 12.5px; line-height: 1.35; }
.guide-toc a:hover { background: var(--row-hover); text-decoration: none; }
.guide-toc .toc-h2 { margin-top: 6px; }
.guide-toc .toc-h2 a { font-weight: 600; color: var(--text); }
.guide-toc .toc-h3 a { padding-left: 18px; }
.guide { padding: 24px 28px 32px; font-size: 14px; line-height: 1.65; color: var(--text-2); max-width: 980px; }
.guide-audience { margin-bottom: 20px; }
.guide h1, .guide h2, .guide h3, .guide h4 { color: var(--text); line-height: 1.3; scroll-margin-top: 16px; }
.guide h1 { font-size: 26px; margin: 0 0 12px; }
.guide h2 { font-size: 21px; margin: 32px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.guide h3 { font-size: 16.5px; margin: 24px 0 8px; }
.guide h4 { font-size: 14.5px; margin: 18px 0 6px; }
.guide p { margin: 0 0 12px; }
.guide ul, .guide ol { margin: 0 0 12px; padding-left: 22px; }
.guide li { margin: 3px 0; }
.guide li > ul, .guide li > ol { margin: 4px 0; }
.guide strong { color: var(--text); font-weight: 600; }
.guide code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; padding: 1px 5px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); }
.guide hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }
.guide blockquote { margin: 0 0 12px; padding: 10px 14px; border-left: 3px solid var(--primary); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.guide blockquote p { margin: 0; }
.guide table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 0 0 14px; font-size: 13px; line-height: 1.5; }
.guide th, .guide td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; }
.guide th { background: var(--surface-2); color: var(--text); font-weight: 600; }
.guide-top { position: fixed; right: 20px; bottom: 20px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.guide-top:hover { text-decoration: none; }
.has-bottom-nav .guide-top { bottom: 84px; }
@media (max-width: 899.98px) {
    .guide { padding: 16px; font-size: 13.5px; }
}

/* The bell (Pages/Shared/_Bell): a badge on the button, and a panel next to the sidebar (on a phone: below the top bar) */
.bell-btn { position: relative; }
.bell-count { position: absolute; top: -3px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--tone-red); color: #fff; font-size: 10px; font-weight: 700; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--sidebar); }
.bell-panel { position: fixed; z-index: 60; left: calc(var(--sidebar-w) + 8px); bottom: 16px; width: 380px; max-height: min(560px, calc(100dvh - 32px)); display: flex; flex-direction: column; padding: 0; margin: 0; box-shadow: var(--shadow); }
.sidebar-collapsed .bell-panel { left: 84px; }
.bell-panel[hidden] { display: none; }
.bell-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--border-soft); }
.bell-head h2 { margin: 0; font-size: 15px; }
.bell-list { overflow-y: auto; min-height: 0; padding: 6px; }
.bell-empty { padding: 18px 10px; margin: 0; text-align: center; }
.bell-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--text-2); }
.bell-item:hover { background: var(--row-hover); text-decoration: none; }
.bell-item .nav-ico { flex: none; }
.bell-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.bell-title { font-size: 12.5px; line-height: 1.4; overflow-wrap: anywhere; }
.bell-item.unread .bell-title { color: var(--text); font-weight: 600; }
.bell-text small { color: var(--muted); font-size: 11px; }
.bell-dot { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--primary); }
.bell-all { display: block; padding: 11px 16px; border-top: 1px solid var(--border-soft); text-align: center; font-size: 12.5px; font-weight: 600; }
.inbox-list { padding: 6px; }
.inbox-list .bell-title { font-size: 13.5px; }
@media (max-width: 899.98px) {
    .bell-panel, .bell-panel.from-top { left: 8px; right: 8px; top: 60px; bottom: auto; width: auto; max-height: calc(100dvh - 150px); }
}

/* Create Demo Tenant dialog (Administration > Tenants) */
.demo-dialog { display: flex; flex-direction: column; gap: 6px; max-width: 420px; }
.demo-dialog p { margin: 0 0 6px; }
.demo-dialog label { font-weight: 600; margin-top: 4px; }
