/* ==========================================================================
   Helpdesk design system
   Strict CSP (style-src 'self'): no inline styles anywhere. Dynamic widths use SVG
   attributes, <progress>/<meter>, or CSSOM updates from /js/app.js.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
    color-scheme: light;
    --font: "IBM Plex Sans KR", "Pretendard Variable", Pretendard, "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;

    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #eef2f7;
    --text: #172438;
    --muted: #5b6b80;
    --faint: #5f6e84;
    --line: #dce3ed;
    --line-strong: #c3cddb;
    --control-line: #7a899f; /* boundary of inputs, switches and other controls: 3:1 on every surface */
    --brand: #2455b7;
    --brand-hover: #1c4496;
    --brand-ink: #ffffff;
    --soft: #eaf0ff;
    --soft-line: #c9d8fb;
    --danger: #ad2835;
    --danger-soft: #fde8ea;
    --success: #1a6b4a;
    --success-soft: #e4f5ec;
    --warn: #8a5300;
    --warn-soft: #fff1d6;
    --warn-surface: #fffbf0;
    --warn-surface-strong: #fff3d6;
    --warn-ink: #ffffff;
    --info: #2455b7;
    --info-soft: #eaf0ff;
    --purple: #6535b8;
    --purple-soft: #f0e9fd;
    --orange: #a24300;
    --orange-soft: #ffe9d8;
    --neutral: #4a5a70;
    --neutral-soft: #eceff4;
    --page-head-h: 84px;

    --shadow-sm: 0 1px 2px #17243808;
    --shadow: 0 4px 20px #17345c0f;
    --shadow-lg: 0 18px 48px #10203a2e;
    --ring: 0 0 0 3px #2455b744;

    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --sidebar-w: 232px;
    --topbar-h: 60px;

    --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100; --c5: #e87ba4; --c6: #6250d6;
    --grid: #e6ebf2;
}

:root[data-theme=dark] {
    color-scheme: dark;
    --bg: #0f1724;
    --surface: #1b283b;
    --surface-2: #17223a;
    --surface-3: #22314a;
    --text: #edf2fa;
    --muted: #acbad0;
    --faint: #93a3bb;
    --line: #35445c;
    --line-strong: #4a5c78;
    --control-line: #6f819c;
    --brand: #9bbcff;
    --brand-hover: #b9d0ff;
    --brand-ink: #0b1f44;
    --soft: #273c61;
    --soft-line: #3a5588;
    --danger: #ff9ea8;
    --danger-soft: #4a1f26;
    --success: #7fd9ad;
    --success-soft: #173a2c;
    --warn: #f3c46e;
    --warn-soft: #3d2f12;
    --warn-surface: #201a0e;
    --warn-surface-strong: #2c2212;
    --warn-ink: #1a1200;
    --info: #9bbcff;
    --info-soft: #273c61;
    --purple: #c6aaff;
    --purple-soft: #33244f;
    --orange: #ffb98a;
    --orange-soft: #442a17;
    --neutral: #b4c0d4;
    --neutral-soft: #2a3850;
    --shadow-sm: none;
    --shadow: none;
    --shadow-lg: 0 18px 48px #00000080;
    --ring: 0 0 0 3px #9bbcff55;
    --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #9085e9;
    --grid: #2b3a52;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font: 15px/1.6 var(--font); font-feature-settings: "tnum" 1;
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
/* Korean breaks a line between words, not inside one; a string that is longer than its box still wraps */
body { word-break: keep-all; overflow-wrap: break-word; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 700; letter-spacing: -.01em; text-wrap: balance; }
.sub, .lead, .hint { text-wrap: pretty; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-hover); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }
small, .muted { color: var(--muted); }
small { font-size: .8125rem; }
code, kbd, .mono { font-family: var(--mono); font-size: .875em; }
::selection { background: var(--soft-line); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
ul.plain, ol.plain { list-style: none; margin: 0; padding: 0; }
.sr-only, .skip-link { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sr-only { width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important; margin: -1px !important; }
.skip-link:focus { width: auto; height: auto; clip-path: none; padding: 10px 14px; background: var(--surface); z-index: 200; left: 8px; top: 8px; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1.125em; height: 1.125em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.icon.lg { width: 1.5em; height: 1.5em; }
.icon.fill { fill: currentColor; }
.nowrap { white-space: nowrap; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.right { text-align: right; }
.link-sm { font-size: .85rem; font-weight: 600; color: var(--brand); }
.link-sm:hover { text-decoration: underline; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }
.tabular { font-variant-numeric: tabular-nums; }
.grow { flex: 1 1 auto; min-width: 0; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; }

/* ---------- Buttons ---------- */
.btn, button.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    min-height: 40px; padding: .45rem .95rem; border-radius: var(--radius);
    border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
    font-weight: 600; font-size: .9375rem; line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: background-color .12s, border-color .12s, box-shadow .12s, transform .05s;
}
.btn:hover { background: var(--surface-3); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--brand-ink); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: var(--surface); }
.btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: var(--surface); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { min-height: 32px; padding: .2rem .65rem; font-size: .8125rem; border-radius: var(--radius-sm); }
.btn.lg { min-height: 48px; padding: .65rem 1.4rem; font-size: 1rem; }
.btn.icon { padding: 0; width: 40px; }
.btn.icon.sm { width: 32px; }
.btn.block { display: flex; width: 100%; }
.btn:disabled, .btn[aria-disabled=true] { opacity: .5; cursor: not-allowed; pointer-events: none; }
form[aria-busy=true] [data-submit-busy] { opacity: .65; cursor: wait; }
.htmx-request.btn, .htmx-request .btn { opacity: .75; }

/* ---------- Form controls ---------- */
label, .label { font-weight: 600; font-size: .875rem; color: var(--text); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field .hint, .hint { font-size: .8125rem; color: var(--muted); font-weight: 400; }
.field .req { color: var(--danger); margin-left: 2px; }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), select, textarea {
    width: 100%; min-height: 40px; padding: .5rem .75rem;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--control-line); border-radius: var(--radius);
    transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
select { appearance: none; padding-right: 2.2rem; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
select[multiple] { background-image: none; padding-right: .75rem; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; flex: none; }
input[type=file] { width: 100%; font-size: .875rem; color: var(--muted); }
input[type=file]::file-selector-button { margin-right: 10px; padding: 7px 12px; border: 1px solid var(--control-line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--surface-3); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-3); color: var(--muted); cursor: not-allowed; }
[aria-invalid=true], .field-error-input { border-color: var(--danger) !important; }
.field-error, .error-text { color: var(--danger); font-size: .8125rem; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; cursor: pointer; }
.check input { margin-top: 3px; }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon > input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]) { padding-left: 2.3rem; }
.form-grid { display: grid; gap: 18px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-section { display: grid; gap: 16px; padding: 22px 0; border-top: 1px solid var(--line); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section > h3 { font-size: .95rem; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding-top: 6px; }
.segmented { display: inline-flex; background: var(--surface-3); border-radius: var(--radius); padding: 3px; gap: 2px; }
.segmented label, .segmented a { padding: 6px 12px; border-radius: 6px; font-weight: 600; font-size: .8125rem; color: var(--muted); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented input:checked + span, .segmented a[aria-current], .segmented label.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented label > span { padding: 6px 12px; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px; margin: -6px -12px; }
.segmented a[aria-current] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + span { outline: 2px solid var(--brand); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 40px; height: 24px; border-radius: 99px; background: var(--control-line); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked ~ .track { background: var(--brand); }
.switch input:checked ~ .track::after { transform: translateX(16px); background: var(--brand-ink); }
.switch input:focus-visible ~ .track { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch input:disabled ~ .track { opacity: .45; cursor: not-allowed; }
.switch input:disabled ~ span:not(.track) { color: var(--muted); cursor: not-allowed; }
.stars { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.stars input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars label { cursor: pointer; color: var(--control-line); font-size: 1.8rem; line-height: 1; padding: 2px 4px; transition: transform .12s ease, color .12s ease; }
.stars label:hover { transform: scale(1.2); }
.stars label .icon { width: 1em; height: 1em; fill: currentColor; stroke: none; }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: #e0a100; }
.stars input:focus-visible + label { outline: 2px solid var(--brand); border-radius: 4px; }
.rating-static { color: #e0a100; display: inline-flex; gap: 1px; }
.rating-static .off { color: var(--line-strong); }
.rating-static .icon { fill: currentColor; stroke: none; width: 1em; height: 1em; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.app.public { display: block; }
.sidebar {
    position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
    background: var(--surface); border-right: 1px solid var(--line); padding: 14px 12px 12px; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; text-decoration: none; color: var(--text); font-weight: 800; font-size: 1.1rem; letter-spacing: -.02em; }
.brand:hover { color: var(--text); }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; flex: none; }
.brand .logo .icon { width: 18px; height: 18px; }
.brand small { display: block; font-weight: 500; font-size: .6875rem; letter-spacing: .02em; line-height: 1.1; }
.nav-section { font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 16px 10px 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
    display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius);
    color: var(--muted); font-weight: 600; font-size: .9rem; text-decoration: none; min-height: 40px;
}
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { background: var(--soft); color: var(--brand); }
.nav a .count { margin: 0 0 0 auto !important; border: none !important; outline: none; box-sizing: border-box; font-size: .6875rem; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; display: inline-flex; align-items: center; justify-content: center; align-self: center; line-height: 1; flex-shrink: 0; background: var(--surface-3); color: var(--muted); transition: background .12s, color .12s; }
.nav a .count.alert, .nav a .count.count-alert { margin: 0 0 0 auto !important; border: none !important; background: var(--danger); color: var(--surface); }
.nav a.active .count { background: var(--surface); color: var(--brand); }
.nav-sub { font-size: .75rem; font-weight: 600; color: var(--muted); margin: 10px 12px 4px; }
.sidebar-foot { margin-top: auto; padding: 14px 8px 4px; font-size: .75rem; color: var(--muted); }
.sidebar-foot .org { display: flex; gap: 8px; align-items: center; font-weight: 600; color: var(--text); }
.scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
    position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
    padding: 0 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line);
}
.topbar .menu-btn { display: none; }
.search-trigger {
    display: flex; align-items: center; gap: 10px; flex: 1 1 360px; max-width: 460px; min-height: 38px; padding: 0 12px;
    border: 1px solid var(--control-line); border-radius: var(--radius); background: var(--surface); color: var(--faint); cursor: pointer; text-align: left;
}
.search-trigger:hover { border-color: var(--faint); }
.search-trigger span.label { flex: 1; font-weight: 500; font-size: .875rem; }
.topbar .spacer { flex: 1; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.kbd { display: inline-block; min-width: 20px; padding: 0 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); color: var(--muted); font: 600 .6875rem/18px var(--mono); text-align: center; }
/* The frame of every page: the line above the title, the title, the one-line description, the control buttons and the
   body sit at the same place on every screen. Nothing in the head changes its height, and the scrollbar never takes width. */
html { scrollbar-gutter: stable; overflow-y: scroll; }
.page { padding: 28px; width: 100%; max-width: 1440px; margin: 0 auto; flex: 1; }
.page-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; column-gap: 16px; min-height: var(--page-head-h); margin-bottom: 20px; }
.page-title { min-width: 0; }
.page-crumb { display: flex; align-items: center; gap: 8px; height: 22px; margin: 0; font-size: .75rem; font-weight: 600; letter-spacing: .02em; color: var(--faint); white-space: nowrap; overflow: hidden; }
.page-head h1 { margin: 2px 0 0; height: 34px; line-height: 34px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-head .sub { margin: 2px 0 0; height: 24px; line-height: 24px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; padding-top: 24px; }
.page-actions > .cluster { display: contents; }
.page-body { min-width: 0; display: flow-root; }
.page-body > :first-child { margin-top: 0; }
.page-body.reading > * { max-width: 880px; }
.cols-2.equal { align-items: stretch; }
.person-pop { position: fixed; z-index: 90; width: 320px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); display: flex; flex-direction: column; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.person-pop .pop-body { overflow-y: auto; overscroll-behavior: contain; max-height: inherit; min-height: 0; }
.person-pop .pop-close { position: absolute; top: 8px; right: 8px; z-index: 1; }
.person-card .person-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.person-card .who { display: grid; gap: 3px; justify-items: start; min-width: 0; }
.person-card .name { font-size: 1.0625rem; line-height: 1.3; overflow-wrap: anywhere; }
@media (max-width: 720px) { .person-pop { left: 8px !important; right: 8px; top: auto !important; bottom: 8px; width: auto; max-width: none; } }
.suggest-wrap { position: relative; }
.suggest-pop { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40; margin: 0; padding: 4px; list-style: none; max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.suggest-pop[hidden] { display: none; }
.suggest-pop [role=option] { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.suggest-pop [role=option]:hover, .suggest-pop [role=option][aria-selected=true] { background: var(--surface-3); }
.suggest-pop [role=option] small { color: var(--muted); white-space: nowrap; }
.suggest-foot { margin-top: 4px; padding: 8px 10px 6px; border-top: 1px solid var(--line); font-size: .8125rem; color: var(--muted); }
.mode-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 99px; font-size: .6875rem; font-weight: 700; letter-spacing: 0; }
.mode-badge.manage { background: var(--soft); color: var(--brand); }
.mode-badge.view { background: var(--neutral-soft); color: var(--neutral); box-shadow: inset 0 0 0 1px var(--line-strong); }
.breadcrumb { display: flex; gap: 6px; align-items: center; font-size: .8125rem; color: var(--muted); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand); text-decoration: underline; }
.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 0; }
.footer { padding: 18px 28px 28px; color: var(--faint); font-size: .75rem; text-align: center; }
.user-menu-btn { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 3px; border-radius: 99px; border: 1px solid transparent; background: transparent; cursor: pointer; }
.user-menu-btn:hover { background: var(--surface-3); }
.user-menu-btn .who { text-align: left; line-height: 1.2; }
.user-menu-btn .who strong { display: block; font-size: .8125rem; }
.user-menu-btn .who small { font-size: .6875rem; }

/* ---------- Menus / popovers ---------- */
.menu-wrap { position: relative; }
.popover {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; z-index: 60; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 6px;
}
.popover.left { right: auto; left: 0; }
.popover.wide { width: 380px; max-width: calc(100vw - 24px); padding: 0; }
.popover .item, .menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
    background: transparent; color: var(--text); text-align: left; text-decoration: none; font-weight: 500; font-size: .875rem; cursor: pointer; min-height: 38px;
}
.popover .item:hover, .menu-item:hover { background: var(--surface-3); color: var(--text); }
.popover .item.danger { color: var(--danger); }
.popover .sep { height: 1px; background: var(--line); margin: 6px 0; }
.popover .sep:first-child, .popover .sep:last-child, .popover .sep + .sep { display: none; }
.popover .menu-form { margin: 0; }
.action-menu { min-width: 250px; }
.popover.compact { width: 280px; padding: 14px; }
.popover.compact .pop-title { margin: 0 0 10px; font-weight: 700; font-size: .875rem; }
.props dd.with-edit { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.props dd .grow-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.inline-edit { flex: none; }
.inline-edit > summary { margin: -4px 0; }
.popover .head { padding: 10px 12px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.bell { position: relative; }
.bell .dot {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 99px;
    background: var(--danger);
    color: var(--surface);
    font-size: .625rem;
    font-weight: 800;
    display: grid;
    place-items: center;
    border: 2px solid var(--bg);
    line-height: 1;
    animation: bellPulse 2.5s infinite;
}
@keyframes bellPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.18); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 40%, transparent); }
}
.notif-list { max-height: 420px; overflow-y: auto; }
.notif { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); transition: background .12s ease; }
.notif:last-child { border-bottom: 0; }
.notif:hover { background: var(--surface-2); color: var(--text); }
.notif.unread {
    background: color-mix(in srgb, var(--brand) 8%, var(--surface));
    border-left: 3px solid var(--brand);
    font-weight: 500;
}
.notif .ico { width: 32px; height: 32px; border-radius: 50%; background: var(--soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.notif .body { min-width: 0; font-size: .875rem; }
.notif .body small { display: block; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
/* two cards one below the other get a gap; in a grid or a stack the gap of the grid does that (a margin as well would push the second card of a row down and double the space between stacked ones) */
:not(.cols-2, .cols-3, .cols-4, .cols-main, .cols-2-1, .widgets, .stack, .kpis, .form-grid, aside) > .card + .card { margin-top: 18px; }
.card-body { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2 { font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.card-foot { padding: 12px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card.flat { box-shadow: none; }
.panel { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stack { display: grid; gap: 18px; }
.stack.sm { gap: 10px; }
.cluster { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cluster.tight { gap: 6px; }
.cluster.between { justify-content: space-between; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.cols-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.cols-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.cols-main > aside { display: grid; gap: 18px; }

/* ---------- Alerts / banners / toasts ---------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius); background: var(--surface); margin-bottom: 18px; }
.alert .icon { margin-top: 3px; }
.alert p { margin: 0; }
.alert .grow > :last-child { margin-bottom: 0; }
.alert.info { border-left-color: var(--info); background: var(--info-soft); }
.alert.success { border-left-color: var(--success); background: var(--success-soft); }
.alert.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.alert.error { border-left-color: var(--danger); background: var(--danger-soft); }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: grid; gap: 10px; max-width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--info); border-radius: var(--radius); box-shadow: var(--shadow-lg); animation: toast-in .2s ease-out; pointer-events: auto; }
.toast.toast-out { animation: toast-out .25s ease-in forwards; pointer-events: none; }
.toast.success { border-left-color: var(--success); } .toast.error { border-left-color: var(--danger); } .toast.warn { border-left-color: var(--warn); }
.toast .body { flex: 1; font-size: .875rem; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { from { transform: translateY(0); opacity: 1; } to { transform: translateY(8px); opacity: 0; } }

/* ---------- Badges / status / priority / avatars ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; min-height: 22px; border-radius: 99px; font-size: .75rem; font-weight: 600; white-space: nowrap; background: var(--neutral-soft); color: var(--neutral); }
.badge.brand, .badge.info { background: var(--info-soft); color: var(--info); }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.purple { background: var(--purple-soft); color: var(--purple); }
.badge.orange { background: var(--orange-soft); color: var(--orange); }
.badge.outline { background: transparent; border: 1px solid var(--line-strong); color: var(--muted); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.st-REQUESTED { background: var(--warn-soft); color: var(--warn); }
.st-PROCESSING { background: var(--info-soft); color: var(--info); }
.st-WAITING { background: var(--purple-soft); color: var(--purple); }
.st-IN_REVIEW { background: var(--info-soft); color: var(--info); box-shadow: inset 0 0 0 1px var(--soft-line); }
.st-COMPLETED { background: var(--success-soft); color: var(--success); }
.st-REJECTED { background: var(--danger-soft); color: var(--danger); }
.st-RECEIVED { background: var(--orange-soft); color: var(--orange); }
.st-ASSIGNED { background: var(--info-soft); color: var(--info); box-shadow: inset 0 0 0 1px var(--soft-line); }
.st-ON_HOLD { background: var(--neutral-soft); color: var(--neutral); box-shadow: inset 0 0 0 1px var(--soft-line); }
.st-CANCELED { background: var(--neutral-soft); color: var(--neutral); }
.st-DUPLICATE { background: var(--neutral-soft); color: var(--neutral); box-shadow: inset 0 0 0 1px var(--line-strong); }
.tags { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.badge.tag { font-weight: 600; }
.tag-editor { display: grid; gap: 6px; }
.prio { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.prio .bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.prio .bars i { width: 3px; border-radius: 1px; background: var(--line-strong); display: block; }
.prio .bars i:nth-child(1) { height: 5px; } .prio .bars i:nth-child(2) { height: 8px; } .prio .bars i:nth-child(3) { height: 11px; } .prio .bars i:nth-child(4) { height: 14px; }
.prio.p-LOW .bars i:nth-child(-n+1) { background: var(--faint); }
.prio.p-MEDIUM .bars i:nth-child(-n+2) { background: var(--info); }
.prio.p-HIGH { color: var(--orange); } .prio.p-HIGH .bars i:nth-child(-n+3) { background: var(--orange); }
.prio.p-URGENT { color: var(--danger); } .prio.p-URGENT .bars i { background: var(--danger); }
.avatar { --a: 210; width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-weight: 700; font-size: .8125rem; color: #fff; background: hsl(var(--a) 48% 42%); letter-spacing: 0; text-transform: uppercase; user-select: none; }
.avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; display: block; }
.avatar.sm { width: 24px; height: 24px; font-size: .6875rem; }
.avatar.lg { width: 44px; height: 44px; font-size: 1rem; }
.avatar.xl { width: 72px; height: 72px; font-size: 1.6rem; }
.avatar.unassigned { background: transparent; border: 1.5px dashed var(--line-strong); color: var(--faint); }
.person { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: inherit; text-decoration: none; }
.person .name { font-weight: 600; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person small { display: block; line-height: 1.2; }
a.person:hover .name { color: var(--brand); text-decoration: underline; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; min-height: 28px; border: 1px solid var(--soft-line); border-radius: 99px; background: var(--soft); color: var(--brand); font-size: .8125rem; font-weight: 600; text-decoration: none; }
.chip.plain { padding-right: 10px; }
.chip a.x, .chip button.x { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: inherit; background: transparent; border: 0; cursor: pointer; padding: 0; }
.chip a.x:hover, .chip button.x:hover { background: var(--surface); }
.sla { display: inline-flex; align-items: center; gap: 5px; font-size: .75rem; font-weight: 700; padding: 1px 8px; min-height: 22px; border-radius: 99px; white-space: nowrap; }
.sla.ok { background: var(--success-soft); color: var(--success); }
.sla.soon { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn); font-weight: 800; animation: sla-pulse 2s infinite ease-in-out; }
@keyframes sla-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--warn) 40%, transparent); } 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 20%, transparent); } }
@media (prefers-reduced-motion: reduce) { .sla.soon { animation: none; } }
.sla.over { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); font-weight: 800; box-shadow: 0 0 0 1px color-mix(in srgb, var(--danger) 30%, transparent); }
.sla.paused { background: var(--purple-soft); color: var(--purple); }
.sla.done { background: var(--neutral-soft); color: var(--neutral); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th { text-align: left; font-size: .75rem; font-weight: 700; letter-spacing: .02em; color: var(--muted); background: var(--surface-2); white-space: nowrap; padding: 10px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; }
.table th a { color: inherit; text-decoration: none; display: inline-flex; gap: 4px; align-items: center; }
.table th a:hover { color: var(--brand); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .08s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.is-selected { background: var(--soft) !important; }
.table.compact td { padding: 7px 12px; }
.table .title { font-weight: 600; color: var(--text); text-decoration: none; display: block; }
.table .title:hover { color: var(--brand); }
.table .key { font-family: var(--mono); font-size: .75rem; color: var(--faint); }
.table td.num, .table th.num { text-align: right; }
.table .col-check { width: 40px; }
.row-link { cursor: pointer; }
.table-empty { padding: 56px 16px; text-align: center; color: var(--muted); }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.toolbar .search { flex: 1 1 260px; max-width: 420px; }
.toolbar select { width: auto; min-width: 130px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { display: inline-flex; align-items: center; gap: 7px; padding: 11px 14px; font-weight: 600; font-size: .875rem; color: var(--muted); text-decoration: none; border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs a[aria-current], .tabs button[aria-selected=true] { color: var(--brand); border-bottom-color: var(--brand); }
.tabs .n { font-size: .6875rem; background: var(--surface-3); padding: 0 7px; border-radius: 99px; min-height: 18px; line-height: 18px; color: var(--muted); }
.tabs [aria-current] .n, .tabs [aria-selected=true] .n { background: var(--soft); color: var(--brand); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); align-items: center; }
.filter-drawer { padding: 16px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.filter-drawer .form-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.bulkbar { display: flex; gap: 10px; align-items: center; padding: 10px 18px; background: var(--soft); border-bottom: 1px solid var(--soft-line); flex-wrap: wrap; }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; font-size: .875rem; color: var(--muted); }
.pagination .pages { display: flex; gap: 4px; }
.pagination .pages a, .pagination .pages span { min-width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: var(--radius-sm); text-decoration: none; font-weight: 600; color: var(--text); border: 1px solid transparent; padding: 0 6px; }
.pagination .pages a:hover { background: var(--surface-3); }
.pagination .pages [aria-current] { background: var(--brand); color: var(--brand-ink); }
.pagination .pages .gap { color: var(--faint); }

/* ---------- KPI / charts ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); min-width: 0; }
a.kpi:hover { border-color: var(--brand); color: var(--text); box-shadow: var(--shadow); }
.kpi .k-label { font-size: .8125rem; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.kpi .k-value { font-size: 1.85rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi .k-value small { font-size: .9rem; font-weight: 600; color: var(--muted); margin-left: 3px; }
.kpi .k-foot { font-size: .75rem; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kpi.alert-kpi .k-value { color: var(--danger); }
.kpi.good .k-value { color: var(--success); }
.delta { font-weight: 700; display: inline-flex; align-items: center; gap: 2px; }
.delta.up { color: var(--success); } .delta.down { color: var(--danger); } .delta.flat { color: var(--muted); }
.delta.inverse.up { color: var(--danger); } .delta.inverse.down { color: var(--success); }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--line-strong); }
.chart .s1 { stroke: var(--c1); fill: var(--c1); } .chart .s2 { stroke: var(--c2); fill: var(--c2); } .chart .s3 { stroke: var(--c3); fill: var(--c3); }
.chart .s4 { stroke: var(--c4); fill: var(--c4); } .chart .s5 { stroke: var(--c5); fill: var(--c5); } .chart .s6 { stroke: var(--c6); fill: var(--c6); }
.chart path.line, .chart polyline.line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart path.area { stroke: none; opacity: .14; }
.chart rect.bar { stroke: none; }
.chart .hit { fill: transparent; stroke: none; }
.chart .hit:hover + .hv, .chart g.pt:hover .hv { opacity: 1; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .hv { opacity: 0; transition: opacity .1s; }
.chart-wrap { position: relative; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8125rem; color: var(--muted); margin-top: 10px; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.sw.s1 { background: var(--c1); } .sw.s2 { background: var(--c2); } .sw.s3 { background: var(--c3); } .sw.s4 { background: var(--c4); } .sw.s5 { background: var(--c5); } .sw.s6 { background: var(--c6); }
.sw.sd { background: var(--danger); } .sw.ss { background: var(--success); } .sw.sw2 { background: var(--warn); }
.chart-tip { position: absolute; pointer-events: none; z-index: 5; background: var(--text); color: var(--surface); padding: 5px 9px; border-radius: 6px; font-size: .75rem; font-weight: 600; white-space: nowrap; transform: translate(-50%, -120%); box-shadow: var(--shadow-lg); }
.bar-row { display: grid; grid-template-columns: minmax(70px, 160px) 1fr auto; gap: 12px; align-items: center; padding: 5px 0; font-size: .875rem; }
.bar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .val { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 2.5ch; text-align: right; }
.meter { width: 100%; height: 8px; border: 0; border-radius: 99px; overflow: hidden; background: var(--surface-3); appearance: none; display: block; }
.meter::-webkit-progress-bar { background: var(--surface-3); }
.meter::-webkit-progress-value { background: var(--c1); border-radius: 99px; }
.meter::-moz-progress-bar { background: var(--c1); border-radius: 99px; }
.meter.good::-webkit-progress-value { background: var(--success); } .meter.good::-moz-progress-bar { background: var(--success); }
.meter.warn::-webkit-progress-value { background: var(--c3); } .meter.warn::-moz-progress-bar { background: var(--c3); }
.meter.bad::-webkit-progress-value { background: var(--danger); } .meter.bad::-moz-progress-bar { background: var(--danger); }
.donut-wrap { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.donut-wrap svg { width: 150px; height: 150px; flex: none; }
.heat { display: grid; grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 3px; font-size: .6875rem; color: var(--muted); align-items: center; }
.heat .c { aspect-ratio: 1; border-radius: 3px; background: var(--surface-3); }
.heat .c.l1 { background: color-mix(in srgb, var(--c1) 25%, var(--surface-3)); } .heat .c.l2 { background: color-mix(in srgb, var(--c1) 50%, var(--surface-3)); }
.heat .c.l3 { background: color-mix(in srgb, var(--c1) 75%, var(--surface-3)); } .heat .c.l4 { background: var(--c1); }

/* ---------- Ticket detail / conversation ---------- */
.ticket-head { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 18px; margin-bottom: 16px; }
.ticket-line { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.ticket-meta.who { font-size: .8125rem; }
.ticket-head > .cluster { margin-top: 12px; }
.ticket-meta { display: flex; gap: 8px 16px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: .875rem; }
/* Customer Action Banner for WAITING state */
.customer-action-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    margin-bottom: 16px;
    background: color-mix(in srgb, var(--warn-surface) 85%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--line));
    border-left: 5px solid var(--warn);
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--warn) 15%, transparent);
}
.customer-action-banner .action-banner-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--warn);
    color: var(--warn-ink);
    display: grid;
    place-items: center;
}
.customer-action-banner .action-banner-content {
    flex: 1;
    min-width: 0;
}
.customer-action-banner .action-banner-title {
    display: block;
    font-size: .9375rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}
.customer-action-banner .action-banner-desc {
    margin: 0;
    font-size: .8125rem;
    color: var(--muted);
    line-height: 1.4;
}
.customer-action-banner .action-banner-btn {
    flex-shrink: 0;
}
.customer-action-banner .action-banner-btn .btn {
    white-space: nowrap;
    padding: 8px 16px;
    font-size: .875rem;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* The progress of a request: five equal columns, the dots on one line, the line to a step coloured when the step is reached */
.progress-track {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin: 16px 0 2px;
    padding: 14px 10px;
    list-style: none;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}
.track-step { position: relative; display: grid; justify-items: center; align-content: start; gap: 8px; text-align: center; color: var(--faint); font-size: .75rem; font-weight: 600; line-height: 1.3; }
.track-step::before { content: ""; position: absolute; top: 12px; right: 50%; width: 100%; height: 2px; background: var(--line-strong); }
.track-step:first-child::before { display: none; }
.track-step .dot { position: relative; z-index: 1; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-strong); background: var(--surface); font-size: .72rem; font-weight: 700; transition: all .15s ease; }
.track-step .dot .icon { width: 14px; height: 14px; }
.track-step .step-label { padding: 0 4px; text-wrap: balance; transition: color .15s ease; }
.track-step.done, .track-step.now { color: var(--text); }
.track-step.done::before, .track-step.now::before { background: var(--success); }
.track-step.done .dot { background: var(--success); border-color: var(--success); color: var(--surface); }
.track-step.now { color: var(--brand); font-weight: 700; }
.track-step.now .dot { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); border-color: var(--brand); border-width: 2.5px; color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); transform: scale(1.08); }
.track-step.stop .dot { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.track-step.stop::before { background: var(--danger); }
.track-step.stop.canceled .dot { background: var(--muted); border-color: var(--muted); color: var(--surface); }
.track-step.stop.canceled::before { background: var(--muted); }
.track-step.stop.canceled { color: var(--muted); }

@media (max-width: 640px) {
    .customer-action-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 12px 14px;
    }
    .customer-action-banner .action-banner-btn {
        width: 100%;
    }
    .customer-action-banner .action-banner-btn .btn {
        width: 100%;
        justify-content: center;
    }
    .progress-track {
        padding: 10px 4px;
        margin: 12px 0 2px;
    }
    .track-step {
        font-size: .6875rem;
        gap: 6px;
    }
    .track-step .dot {
        width: 22px;
        height: 22px;
        font-size: .65rem;
    }
    .track-step::before {
        top: 10px;
    }
    .track-step .step-label {
        padding: 0 2px;
        line-height: 1.2;
    }
}

/* Customer Quick Presets Filter Chips */
.customer-quick-presets {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.quick-preset-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: .8125rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--control-line);
    text-decoration: none;
    white-space: nowrap;
    transition: all .15s ease;
}
.quick-preset-chip:hover {
    color: var(--text);
    border-color: var(--line-strong);
}
.quick-preset-chip.active {
    background: var(--brand);
    color: var(--brand-ink);
    border-color: var(--brand);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.quick-preset-chip.warn {
    color: var(--warn);
}
.quick-preset-chip.warn:hover {
    border-color: var(--warn);
}
.quick-preset-chip.warn.active {
    background: var(--warn);
    color: var(--warn-ink);
    border-color: var(--warn);
}

/* Rating Feedback Loop */
.rating-feedback-box {
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}
.rating-thanks-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .875rem;
    font-weight: 600;
    color: var(--success);
}

.prose { font-size: 1rem; line-height: 1.75; overflow-wrap: anywhere; }
.prose p { margin: 0 0 .85em; } .prose p:last-child { margin-bottom: 0; }
.prose code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.prose pre { background: var(--surface-3); padding: 12px 14px; border-radius: var(--radius); overflow-x: auto; }
.prose blockquote { margin: 0 0 .85em; padding: 2px 14px; border-left: 3px solid var(--line-strong); color: var(--muted); }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 .85em; }
.timeline { position: relative; display: grid; gap: 0; }
.tl-item { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding-bottom: 18px; position: relative; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 17px; top: 38px; bottom: 0; width: 2px; background: var(--line); }
.tl-item .tl-ico { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-3); color: var(--muted); display: grid; place-items: center; z-index: 1; }
.tl-item.event .tl-ico { width: 24px; height: 24px; margin: 6px 6px; background: var(--surface); border: 2px solid var(--line-strong); }
.tl-item.event .tl-ico .icon { width: 12px; height: 12px; }
.tl-item.event:not(:last-child)::before { left: 17px; top: 30px; }
.tl-item.event .tl-body { padding-top: 7px; font-size: .875rem; color: var(--muted); }
.tl-item.event .tl-body strong { color: var(--text); }
.bubble { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.bubble.internal { background: var(--warn-surface); border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--line)); border-left: 4px solid var(--warn); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04); }
.bubble.staff-reply {
    border-left: 4px solid var(--brand);
    box-shadow: 0 1px 4px color-mix(in srgb, var(--brand) 10%, transparent);
}
.bubble.staff-reply .bubble-head {
    background: color-mix(in srgb, var(--brand) 6%, var(--surface-2));
}
.bubble.mine {
    border-color: color-mix(in srgb, var(--brand) 30%, var(--line));
}
.bubble-head { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: .8125rem; color: var(--muted); flex-wrap: wrap; background: var(--surface-2); }
.bubble.internal .bubble-head { background: var(--warn-surface-strong); border-color: color-mix(in srgb, var(--warn) 25%, var(--line)); }
.bubble.internal .internal-badge { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.bubble.internal .internal-badge .internal-hint { opacity: 0.85; font-size: .6875rem; font-weight: 500; margin-left: 2px; }
.bubble-head strong { color: var(--text); font-size: .875rem; }
.bubble-body { padding: 14px 16px; }
.bubble-tools { margin-left: auto; display: flex; gap: 2px; }
.composer { background: var(--surface); border: 1px solid var(--control-line); border-radius: var(--radius-lg); overflow: hidden; }
.composer:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.composer.internal { background: var(--warn-surface); border: 2px dashed var(--warn); border-left: 6px solid var(--warn); box-shadow: 0 2px 8px color-mix(in srgb, var(--warn) 18%, transparent); }
.composer.internal:focus-within { border-color: var(--warn); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 25%, transparent); }
.composer textarea { border: 0; border-radius: 0; box-shadow: none !important; background: transparent; min-height: 110px; padding: 14px 16px; }
.composer-bar { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-top: 1px solid var(--line); flex-wrap: wrap; background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.composer.internal .composer-bar { background: var(--warn-surface-strong); border-top-color: color-mix(in srgb, var(--warn) 25%, var(--line)); }
.composer.internal button[data-submit-label] { background: var(--warn); border-color: var(--warn); color: var(--warn-ink); font-weight: 700; box-shadow: 0 2px 6px color-mix(in srgb, var(--warn) 35%, transparent); }
.composer.internal button[data-submit-label]:hover { filter: brightness(1.1); }
.composer-tabs { display: flex; gap: 2px; padding: 6px 8px 0; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.composer-tabs button { border: 0; background: transparent; padding: 8px 14px; font-weight: 600; font-size: .8125rem; color: var(--muted); border-radius: 8px 8px 0 0; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.composer-tabs button[aria-selected=true] { background: var(--surface); color: var(--text); box-shadow: 0 1px 0 var(--surface); }
.composer-tabs button.internal[aria-selected=true] { background: var(--warn-surface); color: var(--warn); border-top: 2px solid var(--warn); padding-top: 6px; box-shadow: 0 1px 0 var(--warn-surface); }
.composer-internal-banner { display: none; align-items: center; gap: 8px; padding: 10px 14px; font-size: .8125rem; font-weight: 700; background: var(--warn-surface-strong); color: var(--warn); border-bottom: 1px solid color-mix(in srgb, var(--warn) 35%, var(--line)); }
.composer.internal .composer-internal-banner { display: flex; }
.composer-waiting-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: .8125rem;
    font-weight: 600;
    background: color-mix(in srgb, var(--warn-surface) 80%, var(--surface));
    border-bottom: 1px solid color-mix(in srgb, var(--warn) 30%, var(--line));
    color: var(--warn);
}

/* Customer Dashboard KPI Grid */
.customer-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.customer-kpi-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text);
    transition: all .15s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.customer-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: var(--line-strong);
}
.customer-kpi-card .kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    background: var(--surface-2);
    color: var(--muted);
    flex-shrink: 0;
}
.customer-kpi-card.warn .kpi-icon {
    background: color-mix(in srgb, var(--warn) 15%, var(--surface));
    color: var(--warn);
}
.customer-kpi-card.warn.has-items {
    border-color: color-mix(in srgb, var(--warn) 40%, var(--line));
    border-left: 4px solid var(--warn);
}
.customer-kpi-card.brand .kpi-icon {
    background: color-mix(in srgb, var(--brand) 15%, var(--surface));
    color: var(--brand);
}
.customer-kpi-card.star .kpi-icon {
    background: color-mix(in srgb, #f59e0b 15%, var(--surface));
    color: #f59e0b;
}
.customer-kpi-card.success .kpi-icon {
    background: color-mix(in srgb, var(--success) 15%, var(--surface));
    color: var(--success);
}
.customer-kpi-card .kpi-data {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.customer-kpi-card .kpi-label {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.customer-kpi-card .kpi-num {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
}
.customer-kpi-card.warn.has-items .kpi-num {
    color: var(--warn);
}
.props { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 11px 10px; font-size: .875rem; align-items: center; margin: 0; }
.props dt { color: var(--muted); font-weight: 500; }
.props dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.card-foot.files { display: grid; gap: 10px; }
.file-list { display: grid; gap: 8px; }
.bubble-files { display: grid; gap: 8px; padding: 0 16px 14px; }
.attach-btn:focus-within { box-shadow: var(--ring); }
.composer .file-list { padding: 10px 12px; border-top: 1px dashed var(--line); background: var(--surface); }
.composer .file-list:empty { display: none; }
.composer.over { border-color: var(--brand); box-shadow: var(--ring); }
.file-list .attach .thumb { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex: none; }
.bubble-files .attach .thumb { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; flex: none; }
.attach-view { display: inline-flex; flex: none; border-radius: 8px; }
.attach-view.thumb-btn { border: 0; padding: 0; background: transparent; cursor: pointer; }
.grow > .attach-view { display: block; }
.info-part { padding-top: 14px; border-top: 1px solid var(--line); }
.info-title { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: .8125rem; font-weight: 700; color: var(--muted); }
details.manage > summary { list-style: none; cursor: pointer; display: inline-flex; }
details.manage > summary::-webkit-details-marker { display: none; }
.attach { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.attach .fi { width: 36px; height: 36px; border-radius: 8px; background: var(--soft); color: var(--brand); display: grid; place-items: center; flex: none; font-size: .625rem; font-weight: 800; text-transform: uppercase; }
.dropzone { position: relative; border: 2px dashed var(--line-strong); border-radius: var(--radius-lg); padding: 22px; text-align: center; color: var(--muted); background: var(--surface-2); transition: border-color .12s, background .12s; cursor: pointer; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--soft); color: var(--brand); }
.file-list { display: grid; gap: 8px; margin-top: 10px; }
.sla-box { padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); display: grid; gap: 8px; }
.sla-box .row { display: flex; justify-content: space-between; align-items: center; font-size: .8125rem; gap: 8px; }

/* ---------- Board (kanban) ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.lane { background: var(--surface-3); border-radius: var(--radius-lg); padding: 10px; min-height: 180px; max-height: calc(100vh - 220px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; position: relative; transition: min-width .2s ease, width .2s ease, max-width .2s ease, padding .2s ease; }
.lane.is-collapsed { min-width: 48px; width: 48px; max-width: 48px; padding: 10px 4px; cursor: pointer; }
.lane.is-collapsed .tcard, .lane.is-collapsed .empty { display: none; }
.lane.is-collapsed .lane-head { writing-mode: vertical-rl; transform: rotate(180deg); padding: 14px 8px; cursor: pointer; gap: 8px; justify-content: flex-end; }
.lane.is-collapsed .lane-head .lane-toggle svg { transform: rotate(180deg); }
.lane.drop { outline: 2px dashed var(--brand); background: var(--soft); }
.lane-head { position: sticky; top: -10px; margin: -10px -10px 0 -10px; padding: 10px 14px; background: var(--surface-3); border-bottom: 1px solid var(--line); border-radius: var(--radius-lg) var(--radius-lg) 0 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: .875rem; cursor: pointer; user-select: none; }
.lane-head .lane-toggle { opacity: 0.6; transition: opacity .15s, transform .2s ease; }
.lane-head:hover .lane-toggle { opacity: 1; }
.tcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 8px; text-decoration: none; color: var(--text); cursor: grab; box-shadow: var(--shadow-sm); }
.tcard:hover { border-color: var(--brand); color: var(--text); }
.tcard.dragging { opacity: .45; }
.tcard .t { font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.tcard .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .75rem; color: var(--muted); }

/* ---------- Empty / skeleton / progress ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.empty .art { width: 64px; height: 64px; border-radius: 50%; background: var(--soft); color: var(--brand); display: grid; place-items: center; margin-bottom: 4px; }
.empty .art .icon { width: 28px; height: 28px; }
.empty h3 { color: var(--text); }
.empty p { max-width: 42ch; margin: 0; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; height: 14px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.htmx-indicator { opacity: 0; transition: opacity .15s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
#ticket-results.htmx-request, [data-live].htmx-request { opacity: .6; transition: opacity .15s; }
.top-progress { position: fixed; left: 0; top: 0; height: 3px; width: 0; background: var(--brand); z-index: 400; transition: width .3s ease; }
.network-pill { position: fixed; top: 0; left: 0; right: 0; z-index: 500; padding: 6px 16px; text-align: center; font-size: .8125rem; font-weight: 600; transition: transform .2s ease; }
.network-pill.offline { background: var(--warn); color: var(--warn-ink); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.network-pill.online { background: var(--success, #16a34a); color: #fff; }

/* ---------- Dialogs / command palette ---------- */
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 0; max-width: min(560px, 94vw); max-height: min(88vh, 88dvh); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
dialog:not([open]) { display: none; }
dialog form { display: flex; flex-direction: column; max-height: inherit; min-height: 0; flex: 1 1 auto; }
dialog::backdrop { background: #0b1626a6; backdrop-filter: blur(2px); }
dialog[open] { animation: dlg-fade-in 0.15s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes dlg-fade-in { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { dialog[open] { animation: none; } }
@media (max-width: 640px) { dialog:not(.cmdk) { position: fixed; bottom: 0; top: auto; left: 0; right: 0; margin: 0; width: 100%; max-width: 100vw; max-height: 85vh; max-height: 85dvh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-bottom: 0; border-left: 0; border-right: 0; } dialog:not(.cmdk)[open] { animation: sheet-slide-up 0.22s cubic-bezier(0.16, 1, 0.3, 1); } .dlg-head::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: -6px auto 10px; } }
@keyframes sheet-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.dlg-head { padding: 18px 22px 14px; flex: 0 0 auto; } .dlg-body { padding: 10px 22px 18px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; flex: 1 1 auto; } .dlg-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2); flex: 0 0 auto; }
.input-code-match { border-color: var(--success, #16a34a) !important; background-color: var(--soft) !important; }
.merge-match-feedback { display: inline-flex; align-items: center; gap: 4px; font-size: .8125rem; font-weight: 600; color: var(--success, #16a34a); margin-top: 4px; }
dialog.cmdk { width: min(640px, 94vw); max-width: none; margin-top: 12vh; overflow: hidden; }
.cmdk-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.cmdk-input input { border: 0 !important; box-shadow: none !important; min-height: 54px !important; font-size: 1.05rem; background: transparent !important; }
.cmdk-list { max-height: 52vh; overflow-y: auto; padding: 8px; }
.cmdk-group { padding: 8px 10px 4px; font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius); text-decoration: none; color: var(--text); cursor: pointer; }
.cmdk-item[aria-selected=true], .cmdk-item:hover { background: var(--soft); color: var(--brand); }
.cmdk-item .sub { margin-left: auto; font-size: .75rem; color: var(--muted); }
.cmdk-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: .75rem; color: var(--muted); background: var(--surface-2); }
.shortcuts { display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.auth-hero { position: relative; overflow: hidden; background: linear-gradient(155deg, #17356f 0%, #2455b7 55%, #3b78e0 100%); color: #fff; padding: 56px 56px 40px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.auth-hero::after { content: ""; position: absolute; width: 520px; height: 520px; right: -180px; bottom: -200px; border-radius: 50%; background: radial-gradient(circle, #ffffff26, transparent 65%); }
.auth-hero .brand { color: #fff; padding: 0; font-size: 1.25rem; } .auth-hero .brand .logo { background: #ffffff26; color: #fff; }
.auth-hero h2 { font-size: 2rem; line-height: 1.25; letter-spacing: -.02em; max-width: 18ch; }
.auth-hero ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; position: relative; z-index: 1; }
.auth-hero li { display: flex; gap: 12px; align-items: flex-start; color: #e4ecff; }
.auth-hero li .icon { margin-top: 3px; color: #fff; }
.auth-hero .foot { font-size: .8125rem; color: #bcd0f7; position: relative; z-index: 1; }
.auth-form-side { display: grid; align-content: center; justify-items: center; padding: 40px 28px; position: relative; }
.auth-form-side .auth-tools { position: absolute; top: 16px; right: 16px; display: flex; gap: 6px; }
.auth-card { width: min(440px, 100%); }
.auth-card.wide { width: min(560px, 100%); }
.auth-card h1 { font-size: 1.65rem; margin: 6px 0 6px; }
.auth-card .lead { color: var(--muted); margin-bottom: 24px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: .8125rem; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.steps-list { display: grid; gap: 0; }
.steps-list .s { display: grid; grid-template-columns: 34px 1fr; gap: 14px; padding-bottom: 20px; position: relative; }
.steps-list .s:not(:last-child)::before { content: ""; position: absolute; left: 16px; top: 34px; bottom: 2px; width: 2px; background: var(--line); }
.steps-list .s .n { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-strong); font-weight: 700; background: var(--surface); }
.steps-list .s.done .n { background: var(--success); border-color: var(--success); color: var(--surface); }
.steps-list .s.now .n { border-color: var(--brand); color: var(--brand); box-shadow: var(--ring); }
.steps-list .s h3 { font-size: .95rem; margin-top: 6px; } .steps-list .s p { margin: 2px 0 0; color: var(--muted); font-size: .875rem; }

/* ---------- Misc ---------- */
.tree ul { list-style: none; margin: 0; padding-left: 22px; border-left: 1px dashed var(--line-strong); }
.tree > ul { padding-left: 0; border-left: 0; }
.tree li { padding: 3px 0; }
.tree .node { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--radius); }
.tree .node:hover { background: var(--surface-2); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: .9rem; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.pill-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.tooltip-host { position: relative; }
.leaderboard .row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.leaderboard .row:last-child { border-bottom: 0; }
.leaderboard .rank { font-weight: 800; color: var(--faint); text-align: center; }
.leaderboard .row:nth-child(-n+3) .rank { color: #e0a100; }
.cmd-hint { font-size: .75rem; color: var(--faint); }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-main { grid-template-columns: minmax(0, 1fr) 310px; } }
@media (max-width: 1050px) {
    .app { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: fixed; inset: 0 auto 0 0; width: min(290px, 86vw); transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .scrim { display: block; position: fixed; inset: 0; background: #0b162680; z-index: 35; }
    .topbar { padding: 0 16px; }
    .topbar .menu-btn { display: inline-flex; }
    .page { padding: 20px 16px; }
    .cols-main { grid-template-columns: minmax(0, 1fr); }
    .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .auth { grid-template-columns: minmax(0, 1fr); } .auth-hero { display: none; }
}
@media (max-width: 720px) {
    h1 { font-size: 1.35rem; }
    .search-trigger { flex: 0 0 38px; min-width: 38px; padding: 0; justify-content: center; } .search-trigger .label, .search-trigger .kbd { display: none; }
    .user-menu-btn .who { display: none; }
    .cols-2, .cols-3, .cols-4, .form-grid.two, .form-grid.three { grid-template-columns: minmax(0, 1fr); }
    .card-body { padding: 16px; } .card-head { padding: 12px 16px; }
    .toolbar { padding: 12px; } .toolbar .search { max-width: none; flex-basis: 100%; }
    .props { grid-template-columns: 92px minmax(0, 1fr); }
    .tl-item { grid-template-columns: 30px minmax(0, 1fr); gap: 10px; } .tl-item .tl-ico { width: 30px; height: 30px; } .tl-item:not(:last-child)::before { left: 14px; top: 32px; }
    .bar-row { grid-template-columns: minmax(60px, 110px) 1fr auto; gap: 8px; }
    .table.stack-sm { display: block; border: none; background: transparent; }
    .table.stack-sm thead { display: none; }
    .table.stack-sm tbody { display: flex; flex-direction: column; gap: 10px; }
    .table.stack-sm tr { display: grid; gap: 6px 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); grid-template-columns: 1fr auto; align-items: center; transition: border-color var(--transition), box-shadow var(--transition); }
    .table.stack-sm tr.row-link { cursor: pointer; }
    .table.stack-sm tr.row-link:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
    .table.stack-sm td { padding: 0; border: 0; }
    .table.stack-sm td.c-title { grid-column: 1 / -1; }
    .table.stack-sm td.c-title a.title { font-weight: 700; font-size: .9375rem; line-height: 1.35; color: var(--text); }
    .table.stack-sm td.c-title .cell-meta { margin-top: 5px; gap: 6px 10px; }
    .table.stack-sm td.hide-sm { display: none; }
    .table.stack-sm td.right { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center; border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 4px; }
    .table.stack-sm td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .8125rem; }
    .page-head { grid-template-columns: minmax(0, 1fr); min-height: 0; }
    .page-actions { justify-content: flex-start; padding-top: 10px; margin-bottom: 4px; }
    .toasts { left: 16px; right: 16px; bottom: 12px; }
    .kv { grid-template-columns: 1fr; gap: 0 0; } .kv dd { margin-bottom: 8px; }
}
.print-only { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } }
@media print {
    .print-only { display: block !important; }
    .sidebar, .topbar, .toasts, .no-print, .footer, .pagination, .toolbar, .btn,
    [data-composer], .customer-action-banner, #ticket-draft-banner, .edit-box,
    .composer-tabs, .action-menu, .tabs, .bubble.internal, .bubble-tools,
    nav.breadcrumb, .menu-wrap, .progress-track, .customer-kpi-grid, .customer-quick-presets {
        display: none !important;
    }

    /* Official Resolution Report Header */
    .print-report-header {
        margin-bottom: 20px;
        padding-bottom: 14px;
        border-bottom: 2px solid #000;
    }
    .print-title-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 14px;
    }
    .print-title-row h1 {
        font-size: 18pt;
        font-weight: 800;
        margin: 0;
        letter-spacing: -0.5px;
        color: #000;
    }
    .print-stamp {
        width: 58px;
        height: 58px;
        border: 2px solid #b91c1c;
        color: #b91c1c;
        border-radius: 50%;
        display: grid;
        place-items: center;
        font-weight: 800;
        font-size: 10pt;
        transform: rotate(-10deg);
    }
    .print-meta-table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 8px;
    }
    .print-meta-table th, .print-meta-table td {
        border: 1px solid #ccc;
        padding: 6px 10px;
        font-size: 9.5pt;
        text-align: left;
    }
    .print-meta-table th {
        background: #f0f0f0;
        width: 18%;
        font-weight: 700;
        color: #333;
    }
    .print-meta-table td {
        width: 32%;
    }
    .app { display: block; } .page { padding: 0; max-width: none; }
    body { background: #fff; color: #000; }
    .card, .kpi, .panel { box-shadow: none; break-inside: avoid; }
    a { color: inherit; text-decoration: none; }
    :root { --bg: #fff; --surface: #fff; }
}

/* ---------- Additions: avatar hues, flash wrap ---------- */
.avatar.h0 { --a: 8; } .avatar.h1 { --a: 32; } .avatar.h2 { --a: 52; } .avatar.h3 { --a: 96; }
.avatar.h4 { --a: 142; } .avatar.h5 { --a: 172; } .avatar.h6 { --a: 196; } .avatar.h7 { --a: 214; }
.avatar.h8 { --a: 244; } .avatar.h9 { --a: 270; } .avatar.h10 { --a: 300; } .avatar.h11 { --a: 336; }
.flash-wrap { width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 28px; }
.flash-wrap .alert { margin: 20px 0 0; }
.flash-wrap + .page { padding-top: 16px; }
@media (max-width: 1050px) { .flash-wrap { padding: 0 16px; } }

/* ---------- Dropdown filters, choice cards, dialogs, misc ---------- */
.dd { position: relative; }
.dd > summary { list-style: none; cursor: pointer; user-select: none; }
.dd > summary::-webkit-details-marker { display: none; }
.dd > .popover { max-height: 340px; overflow: auto; min-width: 220px; }
.dd[open] > summary { background: var(--surface-3); }
.dd .menu-item { cursor: pointer; font-weight: 500; }
.dd .menu-item input { flex: none; }
.dd .count-badge { background: var(--brand); color: var(--brand-ink); border-radius: 99px; min-width: 18px; height: 18px; padding: 0 5px; font-size: .6875rem; display: inline-grid; place-items: center; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.choice { position: relative; display: block; cursor: pointer; font-weight: 400; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice-body { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border: 1px solid var(--control-line); border-radius: var(--radius); background: var(--surface); transition: border-color .12s, background .12s, box-shadow .12s; height: 100%; }
.choice:hover .choice-body { border-color: var(--faint); }
.choice input:checked + .choice-body { border-color: var(--brand); background: var(--soft); box-shadow: var(--ring); }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--brand); outline-offset: 2px; }
.choice-body b { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.choice-body small { color: var(--muted); line-height: 1.35; }
.choice.p-URGENT input:checked + .choice-body { border-color: var(--danger); background: var(--danger-soft); box-shadow: none; }
.choice.p-HIGH input:checked + .choice-body { border-color: var(--orange); background: var(--orange-soft); box-shadow: none; }
.suggest-item { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); background: var(--surface); transition: border-color .15s, box-shadow .15s, transform .15s; }
.suggest-item:hover { border-color: var(--brand); color: var(--text); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.suggest-item .t { font-weight: 600; font-size: .875rem; display: block; }
.suggest-group { display: grid; gap: 8px; }
.suggest-group h3 { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.sla-table { width: 100%; font-size: .8125rem; border-collapse: collapse; }
.sla-table td, .sla-table th { padding: 6px 4px; text-align: left; border-bottom: 1px solid var(--line); }
.sla-table th { color: var(--muted); font-weight: 600; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form select { width: auto; flex: 1 1 140px; min-width: 120px; }
.inline-form input[type=number] { width: 84px; flex: 0 0 auto; }
.inline-form > span { color: var(--muted); font-size: .9rem; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.sticky-aside { position: sticky; top: calc(var(--topbar-h) + 16px); align-self: start; }
.chat-log { max-height: 320px; overflow-y: auto; display: grid; gap: 10px; padding: 14px 16px; background: var(--surface-2); }
.chat-msg { display: grid; gap: 2px; max-width: 92%; }
.chat-msg .meta { font-size: .6875rem; color: var(--muted); }
.chat-msg .body { background: var(--surface); border: 1px solid var(--line); border-radius: 12px 12px 12px 3px; padding: 7px 11px; font-size: .875rem; overflow-wrap: anywhere; }
.chat-msg.mine { justify-self: end; } .chat-msg.mine .body { background: var(--soft); border-color: var(--soft-line); border-radius: 12px 12px 3px 12px; }
.card-head.comm-head { display: flex; justify-content: space-between; align-items: center; padding: 0 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); min-height: 44px; }
.comm-head .tabs { display: flex; gap: 4px; border-bottom: 0; }
.comm-head .tabs button { border: 0; background: transparent; padding: 11px 16px; font-weight: 600; font-size: .875rem; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; transition: color .12s, border-color .12s, background .12s; }
.comm-head .tabs button:hover { color: var(--text); }
.comm-head .tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); font-weight: 700; }
.dot-badge { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); display: inline-block; vertical-align: middle; }
.text-danger { color: var(--danger); } .text-success { color: var(--success); } .text-warn { color: var(--warn); }
.badge-count { font-variant-numeric: tabular-nums; }
.hint-box { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--soft); color: var(--text); font-size: .875rem; }
.hint-box .icon { color: var(--brand); margin-top: 3px; }
.kbd-list { display: grid; gap: 4px; }
.thumb { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex: none; border: 1px solid var(--line); }
.filter-search { flex: 1 1 280px; max-width: 420px; }
.toolbar .btn.sm { min-height: 36px; }
.summary-line { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: .8125rem; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.table td .person { max-width: 190px; }
.table .cell-meta { display: flex; gap: 8px; align-items: center; margin-top: 3px; color: var(--faint); font-size: .75rem; flex-wrap: wrap; }
.table .cell-meta .icon { width: 13px; height: 13px; }
.lane .empty { padding: 20px 8px; font-size: .8125rem; }
@media (max-width: 520px) {
    .topbar { gap: 6px; padding: 0 10px; }
    .top-actions { gap: 2px; }
    .top-actions > [data-new-ticket] { padding: 0; width: 38px; min-width: 38px; justify-content: center; }
    .top-actions > [data-new-ticket] span { display: none; }
    .user-menu-btn { padding: 2px; gap: 0; } .user-menu-btn > svg { display: none; }
}
@media (max-width: 720px) { .dd > .popover { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; max-height: 60vh; } }
.avatar.md { width: 36px; height: 36px; font-size: .875rem; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; }
.edit-box > summary { list-style: none; cursor: pointer; }
.edit-box > summary::-webkit-details-marker { display: none; }
.note-quote { margin: 6px 0 0; padding: 8px 12px; border-left: 3px solid var(--line-strong); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text); font-size: .875rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.role-chip { font-size: .6875rem; font-weight: 700; padding: 0 7px; border-radius: 99px; background: var(--info-soft); color: var(--info); }
.role-chip.customer { background: var(--neutral-soft); color: var(--neutral); }
.tl-item .tl-avatar { display: block; }
.stars-wrap { display: flex; flex-direction: column; gap: 8px; }
.print-only { display: none; }
@media print { .print-only { display: block; } }
.popover.form-pop { width: 440px; max-width: calc(100vw - 24px); padding: 16px; max-height: none; overflow: visible; }
.popover.form-pop .form-grid { gap: 12px; }
.menu-list { max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 10px; background: var(--surface-2); }
.chart line.hv { stroke: var(--line-strong); stroke-dasharray: 3 3; stroke-width: 1; }
.chart.donut { width: 160px; height: 160px; }
.chart.donut circle.track { fill: none; stroke: var(--surface-3); stroke-width: 14; }
.chart.donut circle.slice { fill: none; stroke-width: 14; }
.chart.donut circle.slice:hover { stroke-width: 16; }
.chart.donut text.donut-total { font-size: 18px; font-weight: 800; fill: var(--text); }
.chart.donut text.donut-sub { font-size: 5.5px; fill: var(--muted); }
.legend.stacked { flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: .875rem; }
.legend .sw { border-radius: 3px; }
.sw.s1 { background: var(--c1); } .sw.s2 { background: var(--c2); } .sw.s3 { background: var(--c3); } .sw.s4 { background: var(--c4); } .sw.s5 { background: var(--c5); } .sw.s6 { background: var(--c6); }
.chart-table > summary { cursor: pointer; font-size: .8125rem; color: var(--muted); padding: 6px 0; }
.chart-table table { margin-top: 6px; }
.meter.s2::-webkit-progress-value { background: var(--c2); } .meter.s2::-moz-progress-bar { background: var(--c2); }
.meter.s3::-webkit-progress-value { background: var(--c3); } .meter.s3::-moz-progress-bar { background: var(--c3); }
.heat-hours { color: var(--faint); }
.range-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filter-inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-inline select, .filter-inline input { width: auto; min-width: 140px; }
.rank-badge { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .6875rem; font-weight: 800; background: var(--surface-3); color: var(--muted); }
.rank-1 { background: #f6d77a; color: #5a4300; } .rank-2 { background: #dfe3ea; color: #3a4350; } .rank-3 { background: #efc7a2; color: #5c3410; }
.stat-line { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .875rem; }
.stat-line:last-child { border-bottom: 0; }
.cols-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 1050px) { .cols-2-1 { grid-template-columns: minmax(0, 1fr); } }
@media print { .range-bar, .filter-inline { display: none !important; } .cols-2, .cols-2-1, .cols-3 { grid-template-columns: 1fr 1fr; } }
.block { display: block; }
.filter-inline input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=hidden]), .filter-inline select, .toolbar select { width: auto; min-width: 140px; }
.filter-inline input[type=date] { min-width: 150px; }
.narrow-field { max-width: 260px; }
.meter.warn::-webkit-progress-value { background: var(--c4); } .meter.warn::-moz-progress-bar { background: var(--c4); }
.kb-hero { background: linear-gradient(135deg, var(--soft), var(--surface)); }
.kb-hero .kb-hero-title { font-size: 1.9rem; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; margin: 0 0 4px; }
.kb-hero .input-icon input { min-height: 52px; font-size: 1.05rem; max-width: 640px; }
.kb-card { display: grid; gap: 8px; align-content: start; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); text-decoration: none; color: var(--text); transition: border-color .12s, box-shadow .12s, transform .12s; }
.kb-card:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-1px); color: var(--text); }
.kb-card .t { font-size: 1.02rem; line-height: 1.4; }
.kb-card .excerpt { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }

/* ---------- Organization tree ---------- */
.block-gap { margin-bottom: 16px; }
.org-layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.org-tree-card { position: sticky; top: calc(var(--topbar-h) + 12px); max-height: calc(100vh - var(--topbar-h) - 24px); display: flex; flex-direction: column; }
.org-tree-card .tree-body { overflow: auto; padding: 8px; }
.org-tree, .org-tree ul { list-style: none; margin: 0; padding: 0; }
.org-tree ul { margin-left: 14px; padding-left: 8px; border-left: 1px solid var(--line); }
.org-tree details > summary { list-style: none; display: flex; align-items: center; cursor: pointer; border-radius: var(--radius); }
.org-tree details > summary::-webkit-details-marker { display: none; }
.org-tree details > summary::before { content: ""; flex: none; width: 18px; height: 18px; margin-right: 2px; background: currentColor; color: var(--faint); transition: transform .12s;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E") center / 16px no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E") center / 16px no-repeat; }
.org-tree details[open] > summary::before { transform: rotate(90deg); }
.org-tree li > .org-row { margin-left: 20px; }
.org-tree details > summary > .org-row { margin-left: 0; flex: 1; min-width: 0; }
.org-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius); color: var(--text); text-decoration: none; min-height: 40px; }
.org-row:hover { background: var(--surface-3); }
.org-row.current { background: var(--soft); box-shadow: inset 0 0 0 1px var(--soft-line); }
.org-row .kind { color: var(--brand); flex: none; }
.org-row .kind.internal { color: var(--success); }
.org-name { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.org-name strong { font-size: .875rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-name strong.hit { background: var(--warn-soft); border-radius: 3px; }
.org-lead, .org-count { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); flex: none; }
.org-lead { max-width: 110px; } .org-lead small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-head { align-items: flex-start; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: .8125rem; color: var(--muted); }
.crumbs a { color: var(--muted); } .crumbs a:hover { color: var(--brand); }
.crumbs [aria-current] { color: var(--text); font-weight: 600; }
.chip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip.lead { display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 8px; border: 1px solid var(--soft-line); background: var(--soft); border-radius: 99px; }
.chip.lead form { display: inline-flex; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-3); color: var(--danger); }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.plain-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-body { max-height: 360px; overflow: auto; }
.pt-0 { padding-top: 0; }
@media (max-width: 1050px) {
    .org-layout { grid-template-columns: minmax(0, 1fr); }
    .org-tree-card { position: static; max-height: none; }
}

.role-chip.lead { background: var(--soft); color: var(--brand); border-color: var(--soft-line); }
.muted-row { opacity: .6; }

.request-list { list-style: none; margin: 0; padding: 0; display: grid; }
.request-item { display: grid; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.request-item:last-child { border-bottom: 0; }
.request-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.request-actions { display: grid; gap: 8px; }
.request-actions .inline-form input { flex: 1 1 180px; min-width: 120px; }

/* ---- Statistics by organization, person and period (phase 9) ---- */
.org-depth { display: inline-block; }
.org-depth.d1 { padding-left: 16px; } .org-depth.d2 { padding-left: 32px; } .org-depth.d3 { padding-left: 48px; }
.org-depth.d4 { padding-left: 64px; } .org-depth.d5 { padding-left: 80px; }
.check.sm { font-size: .8125rem; align-items: center; color: var(--muted); }
.check.sm input { margin-top: 0; }
.perspective { margin: 0 0 14px; }
a.kpi .k-value, a.kpi .k-label { text-decoration: none; }
.bar-row a.lbl, .bar-row a.val { color: inherit; text-decoration: none; }
.bar-row a.lbl:hover, .bar-row a.val:hover { color: var(--brand); text-decoration: underline; }
td.num > a { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--faint); }
td.num > a:hover { color: var(--brand); border-bottom-color: var(--brand); }
.leaderboard .row a.truncate { color: inherit; text-decoration: none; }
.leaderboard .row a.truncate:hover { color: var(--brand); text-decoration: underline; }
.defs { margin: 0 0 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0 16px; }
.defs summary { cursor: pointer; padding: 11px 0; font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none; }
.defs summary::-webkit-details-marker { display: none; }
.defs[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.def-list { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 6px 18px; margin: 0 0 14px; }
.def-list dt { font-weight: 600; }
.def-list dd { margin: 0; color: var(--muted); }
@media (max-width: 640px) { .def-list { grid-template-columns: 1fr; gap: 0; } .def-list dd { margin-bottom: 8px; } }
@media print { .defs { display: none; } }

/* ---- Dashboards by role (phase 10) ---- */
.widgets { align-items: stretch; }
.widgets > .widget { height: 100%; }
.widgets > .wide { grid-column: 1 / -1; }
.widget .card-head h2 .badge { margin-left: 6px; }
.empty.compact { padding: 22px 16px; }
.empty.compact .art { width: 44px; height: 44px; }
.empty.compact .art .icon { width: 22px; height: 22px; }
.card-note { margin: -4px 18px 10px; font-size: .8125rem; }
.stat { display: inline-flex; align-items: baseline; gap: 6px; }
.stat strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.skeleton.block { height: 16px; margin: 10px 0; }
.skeleton.short { width: 60%; }
.kpis.compact { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 0; }
.fieldset-plain { border: 0; margin: 0; padding: 0; min-width: 0; }

/* ---- Inline image lightbox ---- */
body.lb-open { overflow: hidden; }
dialog.lightbox { width: auto; max-width: 96vw; max-height: 96vh; max-height: 96dvh; background: transparent; border: 0; box-shadow: none; color: #fff; overscroll-behavior: contain; padding: 0; }
dialog.lightbox::backdrop { background: #000000e6; backdrop-filter: blur(2px); }
.lb-frame { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px; }
.lb-stage { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; }
.lb-stage img { max-width: min(100%, 96vw); max-height: 80vh; max-height: 80dvh; object-fit: contain; border-radius: var(--radius); background: #111; }
.lb-err { padding: 24px 32px; background: #1a1a1ae6; border: 1px solid #ffffff4d; border-radius: var(--radius); color: #fff; text-align: center; }
.lb-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; width: 100%; background: #000000cc; padding: 8px 14px; border-radius: var(--radius); }
.lb-caption { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: .875rem; color: #fff; min-width: 0; }
.lb-caption small, .lb-caption .lb-pos { color: #e2e8f0; font-size: .8125rem; }
.lb-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
dialog.lightbox .lb-btn { min-width: 44px; min-height: 44px; padding: 0 12px; border-radius: var(--radius); background: #ffffff1f; color: #fff; border: 1px solid #ffffff66; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; cursor: pointer; font-size: .8125rem; font-weight: 600; }
dialog.lightbox .lb-btn:hover { background: #ffffff33; color: #fff; }
dialog.lightbox .lb-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; box-shadow: none; }
dialog.lightbox .lb-btn[hidden] { display: none; }

/* ---- Organization tree picker ---- */
.org-picker { position: relative; }
.org-picker select.sr-only-select { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; opacity: 0; pointer-events: none; }
.org-picker-btn { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; font-size: .875rem; text-align: left; display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; }
.org-picker-btn:hover:not(:disabled) { border-color: var(--brand); }
.org-picker-btn:focus-visible { border-color: var(--brand); box-shadow: var(--ring); outline: none; }
.org-picker-btn:disabled { opacity: .6; cursor: not-allowed; background: var(--surface-2); }
dialog.org-picker-dialog { width: min(520px, 94vw); max-width: 94vw; max-height: 85vh; max-height: 85dvh; display: flex; flex-direction: column; overflow: hidden; }
dialog.org-picker-dialog:not([open]) { display: none; }
.org-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.org-picker-head h2 { margin: 0; font-size: 1rem; }
.org-picker-search { padding: 10px 18px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; background: var(--surface-2); }
.org-picker-tree { overflow-y: auto; overscroll-behavior: contain; padding: 8px 10px; max-height: 56vh; max-height: 56dvh; display: grid; gap: 2px; }
.org-picker-item { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 10px; border-radius: var(--radius); cursor: pointer; color: var(--text); }
.org-picker-item[hidden] { display: none; }
.org-picker-item:hover:not([aria-disabled="true"]) { background: var(--soft); }
.org-picker-item[aria-selected="true"] { background: var(--soft); color: var(--brand); font-weight: 600; }
.org-picker-item[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.org-picker-item:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.org-twisty, .org-twisty-spacer { width: 28px; height: 28px; min-height: 28px; flex: none; display: inline-grid; place-items: center; }
.org-picker-item[aria-expanded="false"] .org-twisty svg { transform: rotate(-90deg); }
.org-picker-main { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.org-picker-name { white-space: normal; overflow-wrap: anywhere; }
.inline-form .org-picker { flex: 1 1 200px; min-width: 180px; }
.inline-form .org-picker-btn { min-height: 38px; }
select.input-locked, input.input-locked { background-color: var(--surface-2); cursor: not-allowed; color: var(--muted); }
.search-match { background: var(--warn-soft); color: var(--text); padding: 0 2px; border-radius: 2px; font-weight: 600; }
.org-picker-empty { padding: 32px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.org-picker-empty .icon { width: 32px; height: 32px; opacity: .6; }




/* ---- Ticket Detail UX Simplification (Phase 3) ---- */
.resolution-highlight-card {
    border-left: 4px solid var(--brand) !important;
    background: var(--surface) !important;
    box-shadow: var(--shadow-sm);
}
.resolution-highlight-card .card-head {
    background: var(--soft);
    border-bottom: 1px solid var(--line);
    padding: 10px 16px;
}
.resolution-highlight-card .card-head h2 {
    font-size: 0.95rem;
    color: var(--brand);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Sidebar Accordion Sections */
details.props-accordion {
    border-top: 1px solid var(--line);
    padding: 0;
    margin-top: 6px;
}
details.props-accordion summary.props-accordion-head {
    padding: 8px 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    border-radius: var(--radius);
    transition: background 0.15s ease, color 0.15s ease;
}
details.props-accordion summary.props-accordion-head::-webkit-details-marker {
    display: none;
}
details.props-accordion summary.props-accordion-head:hover {
    background: var(--surface-2);
    color: var(--text);
}
details.props-accordion summary.props-accordion-head .accordion-title {
    display: flex;
    align-items: center;
    gap: 6px;
}
details.props-accordion summary.props-accordion-head .accordion-arrow {
    transition: transform 0.2s ease;
    width: 14px;
    height: 14px;
    opacity: 0.7;
}
details.props-accordion[open] summary.props-accordion-head .accordion-arrow {
    transform: rotate(90deg);
}
details.props-accordion .props-accordion-body {
    padding: 4px 0 8px;
}

/* Timeline Activity Filter Toggle */
.tl-filter-group {
    display: inline-flex;
    background: var(--surface-2);
    border-radius: var(--radius);
    padding: 2px;
    gap: 2px;
    margin-left: auto;
}
.tl-filter-btn {
    border: none;
    background: transparent;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted);
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s ease, color 0.15s ease;
}
.tl-filter-btn:hover {
    color: var(--text);
}
.tl-filter-btn.active {
    background: var(--surface);
    color: var(--brand);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* When comments-only filter is active */
[data-tl-filter="comments"] .tl-item.event {
    display: none !important;
}
.tl-empty-filter {
    display: none;
    padding: 24px;
    text-align: center;
    color: var(--muted);
    font-size: 0.875rem;
}
[data-tl-filter="comments"]:not(:has(.tl-item:not(.event))) .tl-empty-filter {
    display: block !important;
}
