:root {
  color-scheme: light;
  --page: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e1e4ea;
  --border-strong: #c9ced8;
  --text: #14181f;
  --text-2: #4b5260;
  --muted: #7b8291;
  --brand: #1f4e79;
  --brand-ink: #ffffff;
  --brand-soft: #e7eef6;
  --accent: #2a78d6;
  --side: #163a5c;
  --side-text: #c9d6e4;
  --side-active: #ffffff;
  --side-hover: rgba(255, 255, 255, .08);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: #e1e0d9;
  --track: #eef0f3;
  --good: #0ca30c; --good-ink: #006300; --good-bg: #e6f5e6;
  --warn: #fab219; --warn-ink: #7a5200; --warn-bg: #fff4dc;
  --serious: #ec835a; --serious-ink: #8a3a12; --serious-bg: #fdeee6;
  --crit: #d03b3b; --crit-ink: #a12424; --crit-bg: #fbe9e9;
  --info-bg: #e7f0fb; --info-ink: #1c5cab;
  --neutral-bg: #eef0f3; --neutral-ink: #4b5260;
  --repeat: #a84c00; --repeat-bg: #fbeee2;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0f1115; --surface: #181b21; --surface-2: #1e2229; --border: #2a2f38; --border-strong: #3a404b;
    --text: #eef0f3; --text-2: #c3c8d1; --muted: #8b919c; --brand: #4a8fd4; --brand-ink: #0b1420; --brand-soft: #1b2a3b; --accent: #3987e5;
    --side: #11161d; --side-text: #aab4c2; --side-hover: rgba(255,255,255,.06);
    --series-1: #3987e5; --series-2: #d95926; --grid: #2c2c2a; --track: #252a32;
    --good-ink: #4cc94c; --good-bg: #13301a; --warn-ink: #f5c35a; --warn-bg: #33280e; --serious-ink: #f2a07e; --serious-bg: #3a2216;
    --crit-ink: #f08080; --crit-bg: #3a1a1a; --info-bg: #182c45; --info-ink: #86b6ef; --neutral-bg: #252a32; --neutral-ink: #c3c8d1;
    --repeat: #f0a35e; --repeat-bg: #3a2614;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f1115; --surface: #181b21; --surface-2: #1e2229; --border: #2a2f38; --border-strong: #3a404b;
  --text: #eef0f3; --text-2: #c3c8d1; --muted: #8b919c; --brand: #4a8fd4; --brand-ink: #0b1420; --brand-soft: #1b2a3b; --accent: #3987e5;
  --side: #11161d; --side-text: #aab4c2; --side-hover: rgba(255,255,255,.06);
  --series-1: #3987e5; --series-2: #d95926; --grid: #2c2c2a; --track: #252a32;
  --good-ink: #4cc94c; --good-bg: #13301a; --warn-ink: #f5c35a; --warn-bg: #33280e; --serious-ink: #f2a07e; --serious-bg: #3a2216;
  --crit-ink: #f08080; --crit-bg: #3a1a1a; --info-bg: #182c45; --info-ink: #86b6ef; --neutral-bg: #252a32; --neutral-ink: #c3c8d1;
  --repeat: #f0a35e; --repeat-bg: #3a2614;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--text); font: 14px/1.45 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- login ---------- */
.login-wrap {
  position: relative; overflow: hidden; min-height: 100vh; padding: 24px 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(120% 90% at 50% 0%, #2a5f96 0%, #163a5c 55%, #0d243b 100%);
}
/* faint orbit rings behind the card */
.login-wrap .orbit { position: absolute; left: 50%; top: 50%; border-radius: 50%; border: 1px solid rgba(255,255,255,.08); transform: translate(-50%, -50%); pointer-events: none; }
.login-wrap .orbit-1 { width: 520px; height: 520px; }
.login-wrap .orbit-2 { width: 820px; height: 820px; border-color: rgba(255,255,255,.06); }
.login-wrap .orbit-3 { width: 1150px; height: 1150px; border-color: rgba(255,255,255,.04); }
.login-wrap .orbit-1::after { /* a small "planet" on the inner ring */
  content: ''; position: absolute; top: 50%; right: -5px; width: 10px; height: 10px; border-radius: 50%;
  background: #7fb6ff; box-shadow: 0 0 12px 3px rgba(127,182,255,.6);
}
.login-card {
  position: relative; width: 100%; max-width: 380px; background: var(--surface); color: var(--text);
  border-radius: 18px; padding: 32px 28px 26px; box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.login-card .logo { text-align: center; margin-bottom: 18px; }
.login-card .logo-mark {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 18px; letter-spacing: .5px; color: #fff;
  background: linear-gradient(135deg, #3d8bff, #1f4e79); box-shadow: 0 0 0 6px rgba(61,139,255,.15);
}
.login-card h1 { margin: 0; font-size: 22px; letter-spacing: .2px; }
.login-card p.sub { color: var(--muted); margin: 4px 0 0; font-size: 12.5px; font-style: italic; }
.login-card .welcome { text-align: center; color: var(--text-2); font-size: 13px; margin: 0 0 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.login-card .form-grid { gap: 14px; }
.login-card label.field input { padding: 10px 12px; font-size: 14px; border-radius: 9px; }
.login-card .form-actions { margin-top: 18px; }
.login-card .form-actions .btn.primary { width: 100%; justify-content: center; padding: 11px; font-size: 14px; border-radius: 10px; }
.login-foot { position: relative; margin: 0; color: rgba(255,255,255,.55); font-size: 12px; }
.demo-users { margin-top: 18px; font-size: 12px; color: var(--text-2); border-top: 1px solid var(--border); padding-top: 14px; }
.demo-users button { border: 1px solid var(--border); background: var(--surface-2); border-radius: 6px; padding: 3px 8px; margin: 3px 4px 0 0; cursor: pointer; font-size: 12px; }
.demo-users button:hover { border-color: var(--accent); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--side) 240px, transparent 240px); }
.sidebar { background: var(--side); color: var(--side-text); padding: 16px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; color: #fff; }
.brand .logo-mark { width: 34px; height: 34px; border-radius: 8px; background: #2a78d6; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; flex: none; }
.brand b { display: block; font-size: 14px; }
.brand small { display: block; color: var(--side-text); font-size: 11px; line-height: 1.35; margin-top: 2px; } /* tagline may wrap to 2 lines */
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #7f93aa; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--side-text); padding: 8px 10px; border-radius: 7px; font-size: 13.5px; }
.nav a:hover { background: var(--side-hover); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(255,255,255,.13); color: var(--side-active); font-weight: 600; }
.nav a .count { margin-left: auto; background: rgba(255,255,255,.14); color: #fff; font-size: 11px; padding: 0 7px; border-radius: 10px; }
.nav svg { width: 17px; height: 17px; flex: none; opacity: .9; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.topbar .menu-btn { display: none; }
.topbar .spacer { flex: 1; }
.userchip { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.userchip small { display: block; color: var(--muted); font-size: 11.5px; }
.content { padding: 20px 24px 40px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head p { margin: 4px 0 0; color: var(--text-2); font-size: 13px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--surface); padding: 7px 13px; border-radius: 7px; cursor: pointer; font-weight: 500; font-size: 13px; white-space: nowrap; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--crit-ink); border-color: var(--crit); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 7px; width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 17px; height: 17px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); font-weight: 500; min-width: 0; }
label.field .req { color: var(--crit); }
label.field[hidden] { display: none; }
input[type=text], input[type=password], input[type=date], input[type=datetime-local], input[type=number], input[type=search], input[type=email], select, textarea {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 7px; padding: 7px 9px; font-size: 13.5px; width: 100%; min-width: 0;
}
textarea { min-height: 74px; resize: vertical; }

/* searchable dropdowns (the real <select> is hidden; .ss-btn looks like it) */
select.ss-native { display: none; }
.ss { position: relative; width: 100%; min-width: 0; }
.ss-btn {
  display: block; width: 100%; min-width: 0; text-align: left; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 7px;
  padding: 7px 28px 7px 9px; font-size: 13.5px; line-height: 1.35; min-height: 34px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
.ss-btn:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
.ss-btn:disabled { opacity: .6; cursor: not-allowed; }
.ss-btn.ss-placeholder { color: var(--muted); }
.ss-panel {
  position: fixed; z-index: 80; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 9px; box-shadow: 0 12px 32px rgba(0,0,0,.2); padding: 6px; display: flex; flex-direction: column; gap: 6px;
}
.ss-panel .ss-search { width: 100%; }
.ss-list { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow: auto; }
.ss-list li { padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.ss-list li.act { background: var(--brand-soft); }
.ss-list li.sel { font-weight: 600; color: var(--brand); }
.ss-list li.ph { color: var(--muted); }
.ss-list li.dis { opacity: .5; cursor: not-allowed; }
.ss-list li.none { color: var(--muted); cursor: default; }
.imp-tbl .ss-btn { min-width: 120px; font-size: 13px; padding-top: 5px; padding-bottom: 5px; min-height: 30px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 0; border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 14px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
.form-hint { font-size: 12px; color: var(--muted); }
.form-error { background: var(--crit-bg); color: var(--crit-ink); border-radius: 7px; padding: 8px 11px; font-size: 13px; margin-top: 10px; }
.form-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* ---------- filter bar ---------- */
.filters { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 16px; }
.filters .row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; align-items: end; }
.filters label.field { font-size: 11px; }
.filters select, .filters input { padding: 5px 7px; font-size: 12.5px; }
.filters .toggle { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.filters .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.fchip { background: var(--brand-soft); color: var(--brand); border-radius: 14px; padding: 2px 6px 2px 10px; font-size: 12px; display: inline-flex; gap: 4px; align-items: center; }
.fchip button { border: 0; background: transparent; cursor: pointer; color: inherit; padding: 0 2px; font-size: 14px; line-height: 1; }
.presets { display: flex; gap: 4px; flex-wrap: wrap; }
.presets button { border: 1px solid var(--border); background: var(--surface-2); padding: 3px 9px; font-size: 12px; border-radius: 14px; cursor: pointer; }
.presets button.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* ---------- cards / panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px 0; flex-wrap: wrap; }
.panel-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.panel-body { padding: 12px 16px 16px; overflow-x: auto; } /* wide tables scroll inside their panel on phones */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.section-title { margin: 22px 0 10px; display: flex; align-items: baseline; gap: 10px; }
.section-title span { color: var(--muted); font-size: 12px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 14px; cursor: pointer; text-align: left; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--k, var(--brand)); }
.stat:hover { border-color: var(--accent); }
.stat .lbl { font-size: 12px; color: var(--text-2); font-weight: 500; }
.stat .val { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.stat .sub { font-size: 11.5px; color: var(--muted); }

/* ---------- charts ---------- */
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.bars { display: flex; flex-direction: column; gap: 2px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr 44px; align-items: center; gap: 10px; padding: 4px 6px; margin: 0 -6px; border-radius: 6px; cursor: pointer; }
.bar-row:hover { background: var(--surface-2); }
.bar-row .lbl { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .num { font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.bar-track { height: 14px; display: flex; gap: 2px; }
.bar-seg { height: 100%; min-width: 0; }
.bar-seg:first-child { border-radius: 0; }
.bar-seg:last-child { border-radius: 0 4px 4px 0; }
.s1 { background: var(--series-1); }
.s2 { background: var(--series-2); }
.empty { color: var(--muted); font-size: 13px; padding: 14px 0; text-align: center; }

.heat td.cell { text-align: center; font-variant-numeric: tabular-nums; cursor: pointer; border-radius: 4px; }
.heat td.cell:hover { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--text); }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .tno { font-weight: 600; white-space: nowrap; }
.tbl .title { min-width: 220px; }
.tbl .nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 12px; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral-ink); }
.chip.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-NEW { background: var(--info-bg); color: var(--info-ink); }
.st-ASSIGNED { background: var(--info-bg); color: var(--info-ink); }
.st-IN_PROGRESS { background: var(--warn-bg); color: var(--warn-ink); }
.st-RETURNED { background: var(--crit-bg); color: var(--crit-ink); }
.st-QUERY_AM, .st-QUERY_HEAD { background: var(--warn-bg); color: var(--warn-ink); }
.st-TEST_PUBLISH { background: var(--info-bg); color: var(--info-ink); }
.st-SITE_VALIDATION { background: var(--warn-bg); color: var(--warn-ink); }
.st-TESTING { background: var(--serious-bg); color: var(--serious-ink); }
.st-READY_TO_PUBLISH { background: var(--good-bg); color: var(--good-ink); }
.st-PUBLISHED { background: var(--good-bg); color: var(--good-ink); }
.st-CLOSED { background: var(--neutral-bg); color: var(--neutral-ink); }
.pr-Critical { background: var(--crit-bg); color: var(--crit-ink); }
.pr-High { background: var(--serious-bg); color: var(--serious-ink); }
.pr-Medium { background: var(--warn-bg); color: var(--warn-ink); }
.pr-Low { background: var(--neutral-bg); color: var(--neutral-ink); }
.chip.overdue { background: var(--crit-bg); color: var(--crit-ink); }
.chip.repeat { background: var(--repeat-bg); color: var(--repeat); }
.chip.good { background: var(--good-bg); color: var(--good-ink); }

/* ---------- action queue ---------- */
.queue { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.queue .q { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 0; }
.queue .q-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.queue .q-head b { font-size: 13px; }
.queue .q-head a { font-size: 12px; }
.queue .q-count { font-size: 12px; font-weight: 700; background: var(--brand-soft); color: var(--brand); padding: 1px 8px; border-radius: 10px; }
.queue ul { list-style: none; margin: 0; padding: 0; }
.queue li { padding: 6px 0; border-top: 1px solid var(--border); font-size: 12.5px; display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.queue .q-menu { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue li:first-child { border-top: 0; }
.queue li a { font-weight: 600; flex: none; }
.queue li span.t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }

/* ---------- ticket detail ---------- */
.ticket-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.ticket-head .tno { color: var(--muted); font-weight: 600; font-size: 13px; }
.ticket-head h1 { margin: 2px 0 8px; }
.ticket-head .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.stepper { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; /* one column per step, however many */ margin-bottom: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.step { text-align: center; font-size: 11.5px; color: var(--muted); position: relative; }
.step .dot { width: 26px; height: 26px; border-radius: 50%; margin: 0 auto 5px; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: var(--track); color: var(--muted); border: 2px solid var(--track); }
.step.done .dot { background: var(--good); border-color: var(--good); color: #fff; }
.step.done { color: var(--text-2); }
.step.current .dot { background: var(--surface); border-color: var(--accent); color: var(--accent); }
.step.current { color: var(--text); font-weight: 600; }
.step.returned .dot { border-color: var(--crit); color: var(--crit); }
.step:not(:last-child)::after { content: ""; position: absolute; top: 13px; left: calc(50% + 17px); right: calc(-50% + 17px); height: 2px; background: var(--track); }
.step.done:not(:last-child)::after { background: var(--good); }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 16px; }
.kv div small { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 1px; }
.kv div span { font-size: 13.5px; word-break: break-word; }
.kv .wide { grid-column: 1 / -1; }
.desc { white-space: pre-wrap; margin: 0; }
.progress { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; margin-top: 5px; max-width: 220px; }
.progress i { display: block; height: 100%; background: var(--series-1); border-radius: 4px; }
details.action { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; background: var(--surface); }
details.action[open] { border-color: var(--accent); }
details.action summary { padding: 9px 12px; cursor: pointer; font-weight: 600; font-size: 13px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.action summary::-webkit-details-marker { display: none; }
details.action summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 16px; }
details.action[open] summary::after { content: "–"; }
details.action summary .next { font-size: 10.5px; background: var(--brand); color: var(--brand-ink); padding: 1px 7px; border-radius: 10px; margin-left: 8px; font-weight: 600; }
details.action form { padding: 0 12px 12px; }
details.action .form-grid { grid-template-columns: 1fr 1fr; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 14px 20px; font-size: 12.5px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.timeline li::after { content: ""; position: absolute; left: 7.5px; top: 16px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline .when { color: var(--muted); font-size: 11.5px; }
.timeline .what { font-weight: 600; }
.timeline .chg { color: var(--text-2); margin: 2px 0 0; padding: 0; list-style: none; }
.timeline .chg li { padding: 0; font-size: 12px; }
.timeline .chg li::before, .timeline .chg li::after { display: none; }
.timeline .note { background: var(--surface-2); border-radius: 6px; padding: 5px 8px; margin-top: 3px; color: var(--text-2); }
.notice { border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; display: flex; gap: 8px; align-items: flex-start; }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice.crit { background: var(--crit-bg); color: var(--crit-ink); }
.notice.info { background: var(--info-bg); color: var(--info-ink); }
.notice.repeat { background: var(--repeat-bg); color: var(--repeat); }

/* ---------- gantt ---------- */
.gantt { font-size: 12px; min-width: 760px; }
.gantt .g-row { display: grid; grid-template-columns: 260px 1fr; align-items: center; border-bottom: 1px solid var(--border); min-height: 34px; }
.gantt .g-row:hover { background: var(--surface-2); }
.gantt .g-label { padding: 4px 10px 4px 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.gantt .g-label a { font-weight: 600; margin-right: 6px; }
.gantt .g-lane { position: relative; height: 34px; }
.gantt .g-bar { position: absolute; height: 7px; border-radius: 0 4px 4px 0; cursor: pointer; }
.gantt .g-bar.plan { top: 9px; background: var(--series-1); }
.gantt .g-bar.act { top: 19px; background: var(--series-2); }
.gantt .g-bar.act.open { background: repeating-linear-gradient(45deg, var(--series-2) 0 4px, color-mix(in srgb, var(--series-2) 45%, transparent) 4px 8px); }
.gantt .g-today { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--crit); }
.gantt .g-axis { position: relative; height: 22px; border-bottom: 1px solid var(--border-strong); }
.gantt .g-tick { position: absolute; top: 3px; font-size: 11px; color: var(--muted); transform: translateX(-50%); white-space: nowrap; }
.gantt .g-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--grid); }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 9px 13px; cursor: pointer; font-weight: 500; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tabs .tab-count { display: inline-block; min-width: 20px; margin-left: 4px; padding: 0 6px; border-radius: 10px; font-size: 11px; font-weight: 700; background: var(--track); color: var(--text-2); }
.tabs button.on .tab-count { background: var(--brand-soft); color: var(--brand); }
.inline-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; align-items: end; margin-bottom: 14px; }

/* ---------- floating ---------- */
#tooltip { position: fixed; z-index: 100; background: #14181f; color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 6px; pointer-events: none; max-width: 300px; box-shadow: 0 4px 14px rgba(0,0,0,.25); white-space: pre-line; }
:root[data-theme="dark"] #tooltip { background: #eef0f3; color: #14181f; }
#toast { position: fixed; bottom: 20px; right: 20px; z-index: 100; background: #14181f; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.3); }
#toast.err { background: var(--crit); }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 1200px) { .detail { grid-template-columns: 1fr; } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .sidebar { position: fixed; z-index: 20; left: 0; top: 0; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .topbar .menu-btn { display: grid; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .stepper { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); row-gap: 14px; }
  .step:nth-child(3n)::after { display: none; } /* no connector line from the last step of each row */
  .userchip .who { display: none; }
  details.action .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: 1 / -1; }
}
@media print { .sidebar, .topbar, .filters, .page-head .actions { display: none !important; } .shell { display: block; } }

/* replacement picker dialog (Master Data delete) */
.pick-dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 20px; width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow); }
.pick-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.pick-dialog h2 { margin: 0 0 8px; font-size: 16px; }
.pick-dialog p { margin: 0 0 12px; color: var(--text-2); }
.pick-dialog select { width: 100%; padding: 8px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface-2); color: var(--text); font: inherit; }
.pick-dialog .pick-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Excel import preview */
.imp-tbl td { vertical-align: top; }
.imp-tbl input, .imp-tbl select, .imp-tbl textarea { width: 100%; min-width: 120px; padding: 5px 7px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
.imp-tbl tr.imp-bad td { background: var(--crit-bg); }
.imp-tbl tr.imp-bad td:first-child { box-shadow: inset 3px 0 0 var(--crit); }

/* menu type chips (Master Data → Menus / Reports) */
.chip.kind-master { background: var(--info-bg); color: var(--info-ink); }
.chip.kind-transaction { background: var(--warn-bg); color: var(--warn-ink); }
.chip.kind-report { background: var(--good-bg); color: var(--good-ink); }

/* notifications bell */
.notif { position: relative; }
.notif .icon-btn { position: relative; }
.notif-badge { position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--crit); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; }
.notif-panel { position: absolute; right: 0; top: calc(100% + 8px); width: min(380px, calc(100vw - 32px)); max-height: 70vh; overflow: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.18); z-index: 60; }
/* phones: the bell isn't at the screen edge, so anchor the panel to the screen instead of the bell */
@media (max-width: 600px) { .notif-panel { position: fixed; left: 16px; right: 16px; top: 64px; width: auto; } }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.notif-panel ul { list-style: none; margin: 0; padding: 0; }
.notif-panel li { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13px; }
.notif-panel li:hover { background: var(--surface-2); }
.notif-panel li.unread { background: var(--info-bg); }
.notif-panel li.unread .msg { font-weight: 600; }
.notif-panel .when { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

/* checklist field (e.g. an Account Manager's customers) */
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; max-height: 220px; overflow: auto; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 7px; background: var(--surface); }
.checks .check { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 400; color: var(--text); cursor: pointer; }
.checks .check input { width: auto; }

/* bulk actions bar (e.g. publish several tickets for testing) */
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; margin-bottom: 12px; border: 1px dashed var(--border-strong); border-radius: 9px; background: var(--surface-2); }
.bulk-bar input { width: auto; }
.tbl input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }

/* bulk publish pop-up */
.bulk-dialog { width: min(520px, calc(100vw - 32px)); }
.bulk-dialog .bulk-list { max-height: 160px; overflow: auto; margin: 0 0 14px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); font-size: 13px; display: grid; gap: 4px; }
.bulk-dialog textarea, .bulk-dialog input { width: 100%; }

/* publish-to-client pop-up: wider, with the upload page inside */
.bulk-dialog.publish-dialog { width: min(900px, calc(100vw - 32px)); }
.upload-frame { width: 100%; height: 360px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; margin-top: 4px; }
.publish-dialog .upload-frame { height: min(520px, 60vh); }

/* publish-to-client pop-up: nearly full screen so the upload page has its normal room */
.bulk-dialog.publish-dialog { width: calc(100vw - 48px); max-width: 1400px; height: calc(100vh - 48px); max-height: none; padding: 16px 18px; }
.publish-dialog form { display: flex; flex-direction: column; height: 100%; }
.publish-dialog .bulk-list { flex: none; max-height: 90px; margin-bottom: 10px; }
.publish-dialog .field:has(.upload-frame) { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.publish-dialog .upload-frame { flex: 1; height: auto; min-height: 300px; border-radius: 8px; }
.publish-dialog .pick-actions { flex: none; margin-top: 12px; }

/* our copy of the upload page's form, inside the publish pop-up */
.publish-dialog .asup { flex: 1; display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--border); border-radius: 9px; padding: 12px; background: var(--surface-2); overflow: auto; }
.asup-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.asup-head a { margin-left: auto; }
.asup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.asup-grid textarea, .asup-grid input[type=text] { width: 100%; }
.asup-result { width: 100%; height: 90px; border: 1px dashed var(--border-strong); border-radius: 7px; background: #fff; margin-top: 10px; flex: none; }
@media (max-width: 700px) { .asup-grid { grid-template-columns: 1fr; } }

/* upload form: same single-column layout as the original asupold.php page, no empty space */
.bulk-dialog.publish-dialog { width: min(640px, calc(100vw - 32px)); height: auto; max-height: calc(100vh - 32px); }
.publish-dialog form { height: auto; }
.publish-dialog .asup { flex: none; overflow: visible; }
.asup-grid { grid-template-columns: 1fr; gap: 10px; }
.asup-grid .field { grid-column: 1 / -1; }
.asup-grid .asup-btn { justify-content: flex-start; }
.asup-result { height: 60px; }

/* publish pop-up showing the real upload page */
.bulk-dialog.publish-dialog { width: min(780px, calc(100vw - 32px)); }
.publish-dialog .upload-frame { flex: none; height: min(720px, calc(100vh - 230px)); min-height: 360px; }

/* the hidden attribute must win over .btn's display */
.btn[hidden] { display: none !important; }

/* loading overlay inside a pop-up */
.busy-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); border-radius: inherit; z-index: 5; font-weight: 600; color: var(--text); }
.busy-overlay[hidden] { display: none; }
.spinner { width: 42px; height: 42px; border: 4px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.publish-dialog { position: relative; }

/* "worked before on this menu" box in Review & assign */
.past-devs { margin-bottom: 12px; padding: 9px 11px; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 7px; background: var(--info-bg); }
.past-dev { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; margin-top: 4px; font-size: 13px; }

/* role switcher (members with more than one role) */
.role-switch { margin-left: 8px; max-width: 190px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border, #d0d7e2); background: var(--panel, #fff); color: inherit; font-size: 13px; }

/* publish list grouped by company */
.co-group { margin: 14px 0 18px; }
.co-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 4px; border-bottom: 2px solid var(--border, #d0d7e2); font-size: 15px; }
.co-head .btn { margin-left: auto; }

/* Master Data: search above lists, edit form in a pop-up */
.admin-search { width: 100%; max-width: 360px; margin: 14px 0 8px; }
tr[hidden] { display: none; }
.admin-modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 80; display: grid; place-items: center; padding: 16px; }
.admin-modal-box { position: relative; background: var(--surface); color: var(--text); border-radius: var(--radius); box-shadow: 0 20px 50px rgba(0,0,0,.3);
  width: min(900px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 20px 22px; }
.admin-modal-box h2 { margin: 0 34px 12px 0; }
.admin-modal-x { position: absolute; top: 12px; right: 12px; }

/* test findings grid */
.find-tbl td { vertical-align: top; }
.find-tbl textarea { width: 100%; min-width: 180px; min-height: 0; padding: 5px 7px; font-size: 13px; }
.find-tbl select { min-width: 110px; font-size: 13px; }
.find-tbl tr.find-new td { background: var(--info-bg); }

/* push-notification bar inside the bell panel */
.push-bar { padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); line-height: 1.6; }
.push-bar .btn { margin-left: 4px; }
