/* NxtVision Desk — no external fonts or libraries, works offline / on intranet */
:root {
  --brand: #2457D6;
  --brand-ink: #fff;
  --brand-soft: color-mix(in srgb, var(--brand) 11%, var(--surface));
  --brand-text: color-mix(in srgb, var(--brand) 85%, #000);

  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --surface-2: #F8F9FB;
  --line: #E3E6EB;
  --line-strong: #CDD2DA;
  --ink: #16181D;
  --ink-2: #3B414C;
  --muted: #5B6270;

  --red: #B91C1C;    --red-soft: #FDECEC;
  --amber: #92400E;  --amber-soft: #FEF3E2;
  --green: #15803D;  --green-soft: #E8F5EC;
  --blue: #1A43A8;   --blue-soft: #EAF0FD;
  --gray-soft: #EEF1F5;

  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-pop: 0 10px 30px rgba(16, 24, 40, .14);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

/* Dark theme: chosen in the account menu (Light / Dark / Auto = follow device) */
:root[data-theme="dark"] {
    --bg: #0F1115;
    --surface: #171A20;
    --surface-2: #1D2128;
    --line: #2A2F38;
    --line-strong: #3A404B;
    --ink: #ECEEF2;
    --ink-2: #C9CDD5;
    --muted: #9AA1AD;
    --brand-text: color-mix(in srgb, var(--brand) 55%, #fff);
    --red: #F2A1A1;   --red-soft: #3A1D1F;
    --amber: #F3C27A; --amber-soft: #36291A;
    --green: #8BD3A4; --green-soft: #17301F;
    --blue: #A9BEF5;  --blue-soft: #1B2540;
    --gray-soft: #232831;
    --shadow: none;
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #0F1115;
    --surface: #171A20;
    --surface-2: #1D2128;
    --line: #2A2F38;
    --line-strong: #3A404B;
    --ink: #ECEEF2;
    --ink-2: #C9CDD5;
    --muted: #9AA1AD;
    --brand-text: color-mix(in srgb, var(--brand) 55%, #fff);
    --red: #F2A1A1;   --red-soft: #3A1D1F;
    --amber: #F3C27A; --amber-soft: #36291A;
    --green: #8BD3A4; --green-soft: #17301F;
    --blue: #A9BEF5;  --blue-soft: #1B2540;
    --gray-soft: #232831;
    --shadow: none;
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0; }
.icon { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ---------- top bar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1440px; margin: 0 auto; padding: 0 20px; min-height: 60px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; font-size: 16px; text-decoration: none !important; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 13px; letter-spacing: .02em; }
.mainnav { display: flex; gap: 2px; }
.mainnav a { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 8px; color: var(--ink-2); font-weight: 550; text-decoration: none; }
.mainnav a:hover { background: var(--surface-2); }
.mainnav a.is-active { background: var(--brand-soft); color: var(--brand-text); }
.topsearch { margin-left: auto; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--muted); width: 280px; }
.topsearch input { border: 0; outline: 0; background: transparent; font: inherit; color: var(--ink); width: 100%; min-width: 0; padding: 0; }
.iconbtn { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; color: var(--ink-2); }
.iconbtn:hover, .iconbtn.is-active { background: var(--surface-2); text-decoration: none; }
.iconbtn .dot { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
:root[data-theme="dark"] .iconbtn .dot { background: #DC2626; }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] .iconbtn .dot { background: #DC2626; } }
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; border-radius: 50%; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu .menu { position: absolute; right: 0; top: 46px; width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; }
.menu-head { padding: 10px 10px 8px; display: flex; flex-direction: column; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-head span { color: var(--muted); font-size: 12.5px; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; text-decoration: none; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }
.menu form { margin: 0; }

@media (max-width: 900px) {
  .topbar-inner { flex-wrap: wrap; gap: 8px 12px; padding: 8px 16px; }
  .brand-name { display: none; }
  .topsearch { order: 3; width: 100%; margin-left: 0; }
  .mainnav { order: 4; width: 100%; overflow-x: auto; }
  .mainnav a span { white-space: nowrap; }
  .iconbtn { margin-left: auto; }
}

/* ---------- layout ---------- */
.container { max-width: 1440px; margin: 0 auto; padding: 22px 20px 48px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.page-head .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.cols { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.col-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.col-side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } .container { padding: 16px 12px 40px; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head .actions { margin-left: auto; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; text-decoration: none !important; color: var(--ink); }
.stat:hover { border-color: var(--line-strong); }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 2px; letter-spacing: -0.02em; }
.stat.is-alert .v { color: var(--red); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 9px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); }
.btn-success { background: #15803D; color: #fff; }
.btn-success:hover { background: #126B33; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: var(--surface); color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--surface)); }
.btn-danger:hover { background: var(--red-soft); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-red { background: var(--red-soft); color: var(--red); }
.b-amber { background: var(--amber-soft); color: var(--amber); }
.b-green { background: var(--green-soft); color: var(--green); }
.b-blue { background: var(--blue-soft); color: var(--blue); }
.b-gray { background: var(--gray-soft); color: var(--ink-2); }
.b-quiet { font-weight: 500; }
.tag { display: inline-flex; align-items: center; gap: 2px; height: 26px; padding: 0 4px 0 10px; border-radius: 13px; background: var(--gray-soft); color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.tag form { display: inline; margin: 0; }
.tag button { width: 22px; height: 22px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; padding: 0; }
.tag button:hover { background: var(--line); color: var(--ink); }
.tag-only { padding-right: 10px; }
.mention { color: var(--brand-text); font-weight: 600; }
.tag-inline { color: var(--ink-2); font-weight: 600; }

.sla-ok { color: var(--muted); }
.sla-warn { color: var(--amber); font-weight: 600; }
.sla-breach { color: var(--red); font-weight: 650; }
.sla-paused { color: var(--amber); }
.sla-done { color: var(--green); }

/* ---------- avatar ---------- */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; font-weight: 700; flex: none;
  background: hsl(var(--h) 55% 92%); color: hsl(var(--h) 55% 28%); }
:root[data-theme="dark"] .avatar { background: hsl(var(--h) 30% 24%); color: hsl(var(--h) 60% 82%); }
@media (prefers-color-scheme: dark) { :root[data-theme="system"] .avatar { background: hsl(var(--h) 30% 24%); color: hsl(var(--h) 60% 82%); } }
.avatar-sm { width: 34px; height: 34px; font-size: 12px; }
.avatar-md { width: 36px; height: 36px; font-size: 13px; }
.avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.person { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 13px; text-decoration: none; }
.tabs a:hover { border-color: var(--line-strong); }
.tabs a.is-active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.tabs .count { font-size: 12px; font-weight: 700; opacity: .75; }
.tabs a.is-alert:not(.is-active) .count { color: var(--red); opacity: 1; }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.filters select, .filters input[type=search] { height: 36px; width: auto; min-width: 140px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .t-title { font-weight: 600; color: var(--ink); }
.tbl .t-title:hover { color: var(--brand-text); }
.tbl .t-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tbl .num { font-variant-numeric: tabular-nums; color: var(--muted); }
.tbl th:first-child, .tbl td:first-child { border-top-left-radius: 0; }
.card > .table-wrap:first-child .tbl th:first-child { border-top-left-radius: var(--radius-lg); }
.card > .table-wrap:first-child .tbl th:last-child { border-top-right-radius: var(--radius-lg); }
.row-link { position: relative; }

@media (max-width: 760px) {
  .tbl.responsive thead { display: none; }
  .tbl.responsive tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .tbl.responsive td { display: flex; gap: 10px; padding: 3px 0; border: 0; }
  .tbl.responsive td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; min-width: 84px; padding-top: 1px; }
  .tbl.responsive td.cell-main { display: block; padding-bottom: 6px; }
}

/* ---------- forms ---------- */
label, .label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; font-weight: 400; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=search], input[type=number], input[type=time], input[type=color], input[type=url], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; }
input[type=color] { padding: 4px; width: 64px; }
textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.field { margin-bottom: 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; margin: 0 14px 8px 0; color: var(--ink); }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
fieldset { border: 0; padding: 0; margin: 0; }

/* ---------- alerts ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; border: 1px solid transparent; }
.alert-success { background: var(--green-soft); color: var(--green); border-color: color-mix(in srgb, var(--green) 25%, transparent); }
.alert-error { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.alert-info { background: var(--blue-soft); color: var(--blue); border-color: color-mix(in srgb, var(--blue) 25%, transparent); }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; background: var(--surface); padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); color: var(--ink); user-select: all; }

/* ---------- ticket detail ---------- */
.ticket-head .meta { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.ticket-head h1 { font-size: 22px; margin-top: 4px; }
.ticket-head .row { margin-top: 12px; }
.ticket-desc { margin-top: 16px; padding: 14px 16px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); white-space: pre-line; line-height: 1.6; }

.flow { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.flow li { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.flow li::before { content: ""; height: 6px; border-radius: 3px; background: var(--line); }
.flow li.done { color: var(--ink); }
.flow li.done::before { background: #15803D; }
.flow li.now { color: var(--ink); }
.flow li.now::before { background: var(--brand); }
@media (max-width: 560px) { .flow { grid-template-columns: repeat(5, minmax(0, 1fr)); } .flow li span { display: none; } .flow li.now span { display: inline; } }

.actionbar { margin-top: 18px; padding: 14px 16px; border-radius: 12px; background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.actionbar .what { flex: 1 1 260px; font-size: 13.5px; color: var(--ink-2); }
.actionbar .what strong { color: var(--ink); }
.actionbar.is-closed { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 25%, transparent); }
.actionbar.is-waiting { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 25%, transparent); }
.inline-form { display: none; width: 100%; margin-top: 4px; }
.inline-form.open { display: block; }
.inline-form textarea { min-height: 72px; background: var(--surface); }
.inline-form .row { margin-top: 8px; }

.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.tl-item:last-child { border-bottom: 0; }
.tl-item .who { font-size: 13.5px; line-height: 1.5; }
.tl-item .when { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tl-item .body { margin-top: 6px; font-size: 14px; line-height: 1.55; color: var(--ink); word-wrap: break-word; }
.tl-item.is-system { padding-top: 10px; padding-bottom: 10px; }
.tl-item.is-system .who { color: var(--ink-2); }
.tl-dot { width: 24px; display: grid; place-items: center; flex: none; color: var(--muted); }
.tl-item.ev-closed .tl-dot { color: var(--green); }
.tl-item.ev-reopen .tl-dot { color: var(--red); }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.file { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); max-width: 280px; }
.file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb { display: block; width: 120px; height: 90px; border-radius: 8px; border: 1px solid var(--line); object-fit: cover; background: var(--surface-2); }

.composer { padding: 16px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); position: relative; }
.composer textarea { background: var(--surface); }
.composer .bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.composer .bar .spacer { flex: 1; }
.filepick { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0 10px; height: 34px; border-radius: 8px; margin: 0; }
.filepick:hover { background: var(--surface); }
.filepick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.picked { font-size: 12.5px; color: var(--muted); }

/* @mention / autocomplete popup */
.suggest { position: absolute; z-index: 30; min-width: 240px; max-height: 260px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 4px; }
.suggest button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.suggest button.on, .suggest button:hover { background: var(--brand-soft); }
.suggest .s-sub { display: block; font-size: 12px; color: var(--muted); }
.ac-wrap { position: relative; }

/* side panel facts */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.facts .k { font-size: 12px; color: var(--muted); }
.facts .v { font-weight: 600; margin-top: 2px; word-wrap: break-word; }
.side-select select { height: 38px; }
.contact-list { display: flex; flex-direction: column; gap: 8px; }
.contact { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.contact .src { margin-left: auto; }

/* empty states */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h2 { color: var(--ink); margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }

/* pager */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px; color: var(--muted); font-size: 13px; }

/* ---------- login ---------- */
body.bare { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 60%), var(--bg); }
.bare-main { width: 100%; max-width: 400px; }
.auth-card { padding: 32px 28px; }
.auth-card .brand { margin-bottom: 22px; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); margin-bottom: 22px; }
.mobile-input { display: flex; align-items: stretch; }
.mobile-input .cc { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line-strong); border-right: 0; border-radius: 9px 0 0 9px; background: var(--surface-2); color: var(--ink-2); font-weight: 600; }
.mobile-input input { border-radius: 0 9px 9px 0; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 12.5px; color: var(--muted); }

/* settings */
.section-title { margin: 6px 0 12px; }
.cat-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) 120px minmax(0, 2fr) 80px 70px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cat-row:last-child { border-bottom: 0; }
.cat-row.head { font-size: 12px; font-weight: 600; color: var(--muted); }
@media (max-width: 900px) { .cat-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .cat-row.head { display: none; } }
.swatch-row { display: flex; align-items: center; gap: 10px; }

/* fixes */
.topsearch input[type=search] { border: 0; height: auto; padding: 0; box-shadow: none; background: transparent; border-radius: 0; }
.topsearch input[type=search]:focus { box-shadow: none; }
.topsearch:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
@media (max-width: 640px) { .kbd-hint { display: none; } }

/* theme switch in the account menu */
.theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.theme-switch .label { grid-column: 1 / -1; margin: 0 0 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.menu .theme-switch button { justify-content: center; padding: 8px 4px; font-size: 12.5px; border: 1px solid var(--line); gap: 4px; }
.menu .theme-switch button[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-text); font-weight: 600; }
.auth-theme { display: flex; justify-content: center; gap: 4px; margin-top: 10px; }
.auth-theme button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.auth-theme button[aria-pressed="true"] { color: var(--ink); font-weight: 600; background: var(--surface-2); }

/* quick ticket */
.quick { padding: 14px 16px; margin-bottom: 18px; }
.quick-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 10px; }
.quick-title .icon { color: var(--brand-text); }
.quick-row { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-row input[type=tel] { flex: 0 1 200px; }
.quick-row input[type=text] { flex: 1 1 260px; }
.quick-row select { flex: 0 1 230px; width: auto; }
@media (max-width: 640px) { .quick-row > * { flex: 1 1 100% !important; } }

/* WhatsApp settings */
.codebox { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line);
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--ink); white-space: pre-wrap; word-break: break-all; user-select: all; }
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.usermenu summary { position: relative; display: block; }
.away-dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 6px; background: #D97706; border: 2px solid var(--surface); }

/* ---------- leads ---------- */
.nav-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #DC2626; color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.stage { font-weight: 650; }
.st-new { --st: #2457D6; } .st-contacted { --st: #7C3AED; } .st-demo { --st: #B45309; } .st-nego { --st: #0E7490; } .st-won { --st: #15803D; } .st-lost { --st: #6B7280; }
.badge.stage { background: color-mix(in srgb, var(--st) 13%, var(--surface)); color: color-mix(in srgb, var(--st) 80%, var(--ink)); }
:root[data-theme="dark"] .badge.stage { color: color-mix(in srgb, var(--st) 45%, #fff); }
.fu-overdue { color: var(--red); font-weight: 650; }
.fu-today { color: var(--amber); font-weight: 600; }
.fu-later { color: var(--muted); }
.fu-none { color: var(--muted); font-style: italic; }

.board-wrap { overflow-x: auto; padding-bottom: 8px; margin: 0 -4px; }
.board { display: grid; grid-template-columns: repeat(6, minmax(236px, 1fr)); gap: 12px; min-width: 1450px; padding: 0 4px; align-items: start; }
.board-col { background: var(--gray-soft); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 240px; border: 2px solid transparent; transition: border-color .12s, background .12s; }
.board-col.is-over { border-color: var(--st); background: color-mix(in srgb, var(--st) 8%, var(--gray-soft)); }
.board-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.board-head .dot { width: 9px; height: 9px; border-radius: 5px; background: var(--st); flex: none; }
.board-head h2 { font-size: 13.5px; }
.board-head .count { font-size: 12px; font-weight: 700; color: var(--muted); }
.board-head .sum { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; }
.board-note { font-size: 11.5px; color: var(--muted); padding: 0 4px; }
.board-cards { display: flex; flex-direction: column; gap: 8px; }
.board-empty { font-size: 12.5px; color: var(--muted); text-align: center; padding: 18px 0; border: 1px dashed var(--line-strong); border-radius: 10px; }
.lead-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; color: var(--ink); text-decoration: none !important; box-shadow: var(--shadow); cursor: grab; border-left: 3px solid var(--st, var(--line)); }
.board-col .lead-card { --st: inherit; }
.lead-card:hover { border-color: var(--line-strong); border-left-color: var(--st); }
.lead-card.is-dragging { opacity: .45; }
.lc-title { font-weight: 650; font-size: 14px; line-height: 1.3; }
.lc-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.lc-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 8px; }
.lc-value { font-size: 12.5px; font-weight: 650; }
.lc-fu { display: flex; align-items: center; gap: 4px; font-size: 12px; margin-top: 6px; }

.stagebar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 18px; }
.stagebar form { margin: 0; }
.stagebar button { width: 100%; height: 38px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.stagebar button:hover:not([disabled]) { background: var(--surface-2); }
.stagebar button.done { background: var(--green-soft); border-color: transparent; color: var(--green); }
.stagebar button.now { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); cursor: default; opacity: 1; }
@media (max-width: 560px) { .stagebar { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { margin: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--ink-2); }
.seg input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.seg input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.quick-dates { display: flex; flex-wrap: wrap; gap: 2px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-weight: 600; box-shadow: var(--shadow-pop); z-index: 50; max-width: 90vw; }
.toast.is-error { background: #B91C1C; color: #fff; }

/* ---- ticket: call bar ---- */
.callbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0 4px; }
.btn-call { background: #16A34A; border-color: #16A34A; color: #fff; }
.btn-call:hover { background: #15803D; color: #fff; }
.btn-wa { background: transparent; border-color: var(--line, #D9DDE5); color: #128C7E; }
.callbar-more { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; }
.callbar-more a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
@media (max-width: 640px) {
  .callbar .btn-call { flex: 1 1 100%; height: 52px; font-size: 17px; justify-content: center; }
  .callbar .btn-wa { flex: 1 1 100%; justify-content: center; }
}
