/* 团队管理工作台 · 统一样式表
   Replaces style.css + experience.css + workspace-ui.css (kept on disk only for rollback).
   One ground, one ink, one accent; colour sits on data (attendance, leave kinds, status), not on chrome.
   Token names --bg/--surface/--text/--muted/--accent/--line/--tint are kept because app.js
   maps Telegram Mini App theme colours onto them. */

:root {
  --bg: #f5f6f7;
  --surface: #ffffff;
  --raised: #f9fafa;
  --active: #eceef0;
  --line: #e4e6e9;
  --rule: #eff0f2;
  --control: #cfd3d8;
  --text: #15181b;
  --muted: #5b626a;
  --faint: #6b7178;
  --primary: #17191c;
  --on-primary: #ffffff;
  --accent: #1d6b57;
  --tint: #e8f2ee;
  --positive: #1f7a4d;
  --positive-bg: #ddf4e6;
  --positive-ink: #0f3d24;
  --negative: #b42318;
  --negative-bg: #fdeceb;
  --negative-ink: #7a1b14;
  --warn-bg: #fff7e6;
  --warn-line: #f3d79b;
  --warn-ink: #8a4a0b;
  --success: var(--positive);
  --warning: var(--warn-ink);

  /* Leave kinds: neutral for routine rest, one hue per exception. */
  --k-rest-bg: #e7e9ec;   --k-rest-ink: #363c43;
  --k-personal-bg: #fdecc8; --k-personal-ink: #7c4108;
  --k-sick-bg: #fbdcd9;   --k-sick-ink: #8f1d16;
  --k-paid-bg: #d5f0df;   --k-paid-ink: #14532d;
  --k-other-bg: #dde7f3;  --k-other-ink: #1f3c62;

  --radius: 8px;
  --radius-control: 6px;
  --radius-chip: 4px;
  --control-h: 34px;
  --shadow-float: 0 12px 32px rgb(15 20 25 / 16%), 0 2px 6px rgb(15 20 25 / 8%);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
  font-family: var(--font);
  font-size: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1011;
    --surface: #17191b;
    --raised: #1d1f22;
    --active: #26292c;
    --line: #2a2d31;
    --rule: #222528;
    --control: #43474d;
    --text: #f2f3f4;
    --muted: #b1b6bc;
    --faint: #9aa0a6;
    --primary: #f2f3f4;
    --on-primary: #111214;
    --accent: #5cc4a3;
    --tint: #16302a;
    --positive: #57c48c;
    --positive-bg: #15301f;
    --positive-ink: #8fe0b3;
    --negative: #f0766b;
    --negative-bg: #3a1a18;
    --negative-ink: #f7aaa2;
    --warn-bg: #33270f;
    --warn-line: #6b5121;
    --warn-ink: #f2c879;
    --k-rest-bg: #2b2e32;   --k-rest-ink: #d6dade;
    --k-personal-bg: #3e2c10; --k-personal-ink: #f5c77a;
    --k-sick-bg: #44201d;   --k-sick-ink: #f6aaa2;
    --k-paid-bg: #173823;   --k-paid-ink: #9be2b8;
    --k-other-bg: #1d2c40;  --k-other-ink: #a9c6ea;
    --shadow-float: 0 16px 40px rgb(0 0 0 / 55%);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.55; }
[hidden] { display: none !important; }
main { min-height: 100dvh; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 22px; line-height: 1.3; font-weight: 650; letter-spacing: -.01em; margin-bottom: 4px; }
h2 { font-size: 16px; line-height: 1.4; font-weight: 600; margin-bottom: 0; }
h3 { font-size: 14px; font-weight: 600; margin: 20px 0 8px; }
p { margin-bottom: 10px; }
a { color: var(--accent); }
mark { background: #fde68a; color: inherit; border-radius: 2px; padding: 0 1px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--raised); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
small.muted, label small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.good-text { color: var(--positive); font-weight: 600; }
.warning-text { color: var(--warn-ink); font-weight: 600; }
.num, .numeric-cell, td.numeric-cell, th.numeric-cell { font-variant-numeric: tabular-nums; }
.eyebrow { font-size: 12px; color: var(--muted); margin: 0 0 2px; }

/* ---------- Controls ---------- */
button, input, select, textarea { font: inherit; color: inherit; }
button {
  min-height: var(--control-h);
  padding: 6px 12px;
  border: 1px solid var(--control);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  line-height: 1.3;
  white-space: nowrap;
  transition: background-color .12s, border-color .12s, color .12s, transform .06s;
}
button:hover:not(:disabled) { background: var(--raised); border-color: #b8bdc4; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
button[aria-busy=true] { cursor: wait; }
.primary, button.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
.primary:hover:not(:disabled), button.primary:hover:not(:disabled) { background: #33373c; border-color: #33373c; }
@media (prefers-color-scheme: dark) { .primary:hover:not(:disabled), button.primary:hover:not(:disabled) { background: #d4d7da; border-color: #d4d7da; } }
button.ux-danger, .danger-button { background: var(--negative); border-color: var(--negative); color: #fff; font-weight: 600; }
.wide { width: 100%; }
.icon-button, .dialog-title > button { min-width: var(--control-h); padding: 0 8px; font-size: 18px; line-height: 1; border-color: transparent; background: transparent; color: var(--muted); }
.text-button { border: 0; background: none; color: var(--accent); padding: 0; min-height: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

label { display: block; font-weight: 500; font-size: 13px; color: var(--text); margin: 12px 0; }
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  min-height: var(--control-h);
  padding: 6px 10px;
  border: 1px solid var(--control);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
}
textarea { resize: vertical; line-height: 1.5; }
input[type=checkbox], input[type=radio] { display: inline-block; width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; accent-color: var(--primary); vertical-align: middle; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: #b8bdc4; }
input[readonly], dialog [readonly] { background: var(--raised); color: var(--muted); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 16px 0; min-width: 0; }
legend { font-weight: 600; padding: 0 6px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.switch-row label { margin: 0; }
.switch-row input { width: 36px; height: 20px; flex: 0 0 auto; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.two-col > * { min-width: 0; }
.secondary-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }

/* ---------- Notices ---------- */
.notice { background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 14px; color: var(--text); }
.error { color: var(--negative); font-weight: 500; margin: 8px 0; }
.error:empty { display: none; }
#view-error { background: var(--negative-bg); color: var(--negative-ink); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 16px; }
.empty { color: var(--muted); text-align: center; padding: 28px 12px; margin: 0; }
details > summary { cursor: pointer; font-weight: 600; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "›"; display: inline-block; width: 14px; color: var(--muted); transition: transform .12s; }
details[open] > summary::before { transform: rotate(90deg); }
details { margin: 12px 0; }
.help-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 16px; }
.help-box summary { color: var(--muted); font-weight: 500; }
.help-box[open] summary { color: var(--text); margin-bottom: 6px; }
.help-box p { margin: 8px 0 0; line-height: 1.7; }
.summary-line { padding: 10px 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.summary-line:empty { display: none; }

#toast { position: fixed; z-index: 1000; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: min(560px, calc(100vw - 32px)); padding: 10px 16px; border-radius: var(--radius); background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-float); font-weight: 500; }

/* ---------- Badges / pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; min-height: 20px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--active); color: var(--text); white-space: nowrap; }
.badge.good { background: var(--positive-bg); color: var(--positive-ink); }
.badge.warning { background: var(--warn-bg); color: var(--warn-ink); }
.badge.neutral { background: var(--active); color: var(--muted); }
.badge.danger { background: var(--negative-bg); color: var(--negative-ink); }

/* ---------- Login gate ---------- */
.gate { max-width: 400px; margin: 0 auto; padding: 14vh 24px 40px; }
.gate h1 { font-size: 22px; margin: 18px 0 6px; }
.brand-icon, .brand-mark { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: var(--primary); color: var(--on-primary); flex: 0 0 auto; }
.brand-icon svg, .brand-mark svg { width: 20px; height: 20px; }
#gate-message { color: var(--muted); }
#login-form { margin-top: 20px; }
#login-form .primary { width: 100%; margin-top: 8px; min-height: 40px; }
#retry-session { margin-top: 12px; }
#gate-help { margin-top: 24px; font-size: 13px; }

/* ---------- Shell ---------- */
#workspace { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100dvh; }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 100; padding: 8px 14px; background: var(--surface); border: 2px solid var(--accent); border-radius: 6px; color: var(--text); }
.skip-link:focus { top: 12px; }

.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 6px; padding: 16px 12px; background: var(--bg); border-right: 1px solid var(--line); overflow-y: auto; }
.workspace-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.workspace-brand strong { font-size: 14px; line-height: 1.3; }
.workspace-brand small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; }
.brand-mark svg { width: 17px; height: 17px; }
#navigation-toggle { display: none; }
#main-nav { display: flex; flex-direction: column; gap: 1px; }
.nav-group { font-size: 12px; color: var(--muted); padding: 16px 10px 6px; }
.nav-group:first-child { padding-top: 4px; }
#main-nav button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 34px; padding: 6px 10px;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--muted); font-weight: 500; text-align: left;
}
#main-nav button:hover:not(:disabled) { background: var(--active); color: var(--text); }
#main-nav button[aria-current=page] { background: var(--active); color: var(--text); font-weight: 600; }
#main-nav .nav-count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--negative); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.nav-icon { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-bottom { margin-top: auto; padding: 14px 10px 4px; font-size: 12px; color: var(--muted); line-height: 1.6; border-top: 1px solid var(--line); }
.sidebar-bottom span { display: block; }
.sidebar-bottom button { margin-top: 10px; width: 100%; }

.work-content { min-width: 0; padding: 0 32px 64px; }
.workspace-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.workspace-header > div:first-child { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.workspace-header > div:first-child .muted { font-size: 13px; }
.workspace-header strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.header-actions label { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--muted); font-weight: 400; }
.header-actions select { margin: 0; width: auto; min-width: 150px; }

.page-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 24px 0 6px; }
.page-title h1 { margin: 0; }
.page-title h1:focus { outline: none; }
.page-title p { margin: 4px 0 0; color: var(--muted); }
.connection { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; padding: 0 0 18px; font-size: 12px; color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--positive); display: inline-block; margin-right: -8px; }
.dot.offline { background: #c08a2b; }
#last-updated { margin-left: auto; }

.view { display: block; }
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 0 0 14px; }
.toolbar label { margin: 0; min-width: 160px; }
.toolbar label input, .toolbar label select { min-width: 0; }
.toolbar > button { flex: 0 0 auto; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 16px; min-width: 0; }
.panel.table-scroll { padding: 0; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.people-panel .panel-heading .toolbar { margin: 0; }
.compact-search { margin: 0; min-width: 240px; }
.home-filters { margin-bottom: 12px; }
.home-filters label:nth-child(2) { flex: 1 1 260px; }

/* KPI strip: one card split by dividers, type not tiles */
.stats-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 16px; overflow: hidden; }
.stats-strip > div { padding: 14px 18px; border-left: 1px solid var(--line); display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 2px; min-width: 0; }
.stats-strip > div:first-child { border-left: 0; }
.stats-strip span { font-size: 12px; color: var(--muted); }
.stats-strip strong { font-size: 24px; line-height: 1.2; font-weight: 600; font-variant-numeric: tabular-nums; }
.stats-strip .stat-accent strong { color: var(--accent); }

/* Work queue */
.queue-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto auto; gap: 8px; margin: 0 0 16px; }
.queue-card { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0 12px; text-align: left; padding: 10px 14px; min-height: 56px; white-space: normal; background: var(--surface); border-color: var(--line); }
.queue-card strong { grid-row: span 2; font-size: 22px; font-weight: 600; min-width: 22px; font-variant-numeric: tabular-nums; color: var(--muted); }
.queue-card span { font-weight: 600; }
.queue-card small { color: var(--muted); font-size: 12px; }
.queue-card.needs-action { background: var(--warn-bg); border-color: var(--warn-line); }
.queue-card.needs-action strong { color: var(--warn-ink); }
.queue-strip > button:not(.queue-card) { align-self: stretch; }

.setup-checklist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 16px; }
.checklist-line { display: grid; grid-template-columns: 84px 150px 1fr; gap: 12px; padding: 8px 0; border-top: 1px solid var(--rule); font-size: 13px; }
.checklist-line:first-of-type { margin-top: 8px; }

/* Off-today strip on the overview */
.off-today { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 16px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.off-today > strong { font-size: 13px; margin-right: 4px; }
.off-today .muted { font-size: 13px; }
.off-today button { margin-left: auto; }
.setup-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin: 0 0 16px; background: var(--tint); border-radius: var(--radius); }
.setup-banner p { margin: 0; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; min-width: 0; -webkit-overflow-scrolling: touch; }
.table-scroll:focus-visible { outline-offset: -2px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead, th { background: transparent; }
th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--raised); }
th.numeric-cell, td.numeric-cell { text-align: right; }
.table-actions { white-space: nowrap; }
.table-actions button { min-height: 28px; padding: 3px 8px; margin: 2px 4px 2px 0; font-size: 13px; border-color: transparent; background: transparent; color: var(--accent); }
.table-actions button:hover:not(:disabled) { background: var(--tint); border-color: transparent; }
.employee-identity { display: grid; gap: 1px; min-width: 150px; }
.employee-identity strong { font-weight: 600; }
.cell-secondary, .employee-contact { font-size: 12px; color: var(--muted); }
#home-employees td:nth-child(8) { min-width: 150px; max-width: 260px; white-space: normal; }
#home-employees .table-actions, #home-employees th:last-child { position: sticky; right: 0; background: var(--surface); box-shadow: -1px 0 0 var(--line); }
#home-employees tbody tr:hover .table-actions { background: var(--raised); }
#home-admins { max-height: 280px; }
#home-admins th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
#home-penalties td:nth-child(2) { max-width: 640px; white-space: normal; }
#home-attendance td:last-child { white-space: normal; min-width: 180px; }

.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 10px 0; font-size: 13px; color: var(--muted); }
.pagination:empty { display: none; }
.pagination span { margin-right: auto; }

/* ---------- Rules ---------- */
.search { position: relative; display: block; margin: 0 0 12px; }
.search span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { margin: 0; padding-left: 34px; min-height: 38px; }
.filter-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.segmented { display: inline-flex; padding: 2px; background: var(--active); border-radius: 8px; gap: 2px; }
.segmented button { border: 0; background: transparent; min-height: 30px; color: var(--muted); }
.segmented button[aria-pressed=true] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / 8%); }
.categories { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.categories button { min-height: 30px; border-radius: 999px; padding: 4px 12px; border-color: var(--line); color: var(--muted); }
.categories button[aria-pressed=true] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.rules-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.rule-card { display: flex; flex-direction: column; gap: 8px; text-align: left; white-space: normal; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: 118px; }
.rule-card:hover:not(:disabled) { border-color: #b8bdc4; background: var(--surface); }
.rule-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.rule-title { font-weight: 600; font-size: 15px; }
.rule-status { font-size: 12px; color: var(--positive); white-space: nowrap; }
.rule-status.off { color: var(--faint); }
.rule-meta { color: var(--muted); font-size: 13px; }
.rule-bottom { display: flex; justify-content: space-between; align-items: baseline; margin-top: auto; color: var(--muted); font-size: 12px; }
.rule-score { font-size: 20px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.rule-score small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.rules-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.rule-sentence { background: var(--tint); border-radius: var(--radius); padding: 10px 14px; margin: 4px 0 12px; line-height: 1.7; }
.rule-sentence strong { font-variant-numeric: tabular-nums; }

/* ---------- Dialogs ---------- */
dialog { width: min(600px, calc(100vw - 24px)); max-width: calc(100vw - 24px); max-height: min(90dvh, 920px); padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-float); overflow: auto; }
dialog::backdrop { background: rgb(15 18 22 / 45%); }
dialog > form, dialog:not([data-ux-prepared]) { padding: 0; }
.dialog-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dialog-title h2 { font-size: 17px; margin: 0; }
.dialog-title h2:focus { outline: none; }
.dialog-title .eyebrow { margin: 0; }
dialog:not([data-ux-prepared]) > :not(.dialog-title):not(form) { margin-left: 20px; margin-right: 20px; }
dialog:not([data-ux-prepared]) > form > :not(.dialog-title) { margin-left: 20px; margin-right: 20px; }
body.ux-modal-open { overflow: hidden; }
dialog[data-ux-prepared] { overflow: hidden; }
dialog[data-ux-prepared][open], dialog[data-ux-prepared] > form { display: flex; flex-direction: column; min-height: 0; }
dialog[data-ux-prepared] > form { max-height: inherit; margin: 0; }
dialog[data-ux-prepared] .dialog-title { flex: 0 0 auto; }
.ux-dialog-body { padding: 16px 20px 20px; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.ux-dialog-body > :first-child { margin-top: 0; }
.ux-form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface); flex: 0 0 auto; }
.ux-form-actions > button { min-width: 88px; margin: 0; }
.ux-form-actions .error { flex-basis: 100%; margin: 0; }
.ux-saving { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 13px; }
dialog [role="alert"]:not(:empty) { padding: 8px 12px; border-radius: 6px; background: var(--negative-bg); color: var(--negative-ink); }
dialog.ux-confirm { width: min(460px, calc(100vw - 32px)); padding: 22px; overflow: auto; }
.ux-confirm h2 { font-size: 17px; margin: 0 0 10px; }
.ux-confirm > p { white-space: pre-wrap; line-height: 1.7; margin-bottom: 18px; color: var(--muted); }
.ux-confirm .ux-form-actions { padding: 14px 0 0; }
dialog.attendance-wide { width: min(1320px, 96vw); }
dialog.attendance-config { width: min(760px, 94vw); }
#guided-dialog { width: min(880px, calc(100vw - 24px)); }
#guided-dialog.ux-compact { width: min(560px, calc(100vw - 24px)); }
#guided-body { display: grid; gap: 14px; }
#guided-body form { display: grid; gap: 10px; }
#guided-body form label { margin-top: 0; }
#guided-body input[type=checkbox] { width: 18px; height: 18px; margin-left: 10px; }
#guided-body form .ux-form-actions { position: sticky; bottom: -20px; margin: 16px 0 0; padding: 12px 0; z-index: 2; }
.guided-section { border-top: 1px solid var(--line); padding-top: 12px; }
.guided-section h3 { margin: 0 0 8px; }
.guided-section p { overflow-wrap: anywhere; white-space: pre-wrap; }
.guided-section > button { margin: 6px 8px 0 0; }

dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 16px 0; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.history-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); font-size: 13px; }

/* Payroll / attendance details */
.column-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.column-row input { margin: 0; }
#pay-fields input[type=checkbox] { margin-right: 8px; }
#pay-fields label { margin: 10px 0; }
.tier-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; margin: 12px 0; }
.tier-range { grid-column: 1 / -1; margin: 0; color: var(--muted); }
.policy-preview { margin: 16px 0; padding: 14px 16px; background: var(--raised); border-radius: var(--radius); }
.policy-preview h3 { margin-top: 0; }
.shift-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
#assign-users { max-height: 40vh; overflow: auto; margin: 14px 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 12px; }
#assign-users label { display: flex; align-items: center; gap: 10px; padding: 9px 0; margin: 0; border-bottom: 1px solid var(--rule); font-weight: 400; }
#assign-users label:last-child { border-bottom: 0; }
#assign-users input { width: auto; margin: 0; }
#attendance-detail { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
#attendance-days details { min-width: 180px; white-space: normal; }
#export-status a { display: inline-block; margin-left: 10px; }
.profile-facts { background: var(--raised); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 4px; }
.profile-facts strong { font-size: 18px; }
.calculation-box { padding: 14px 16px; background: var(--tint); border-radius: var(--radius); }
.calculation-box strong { font-size: 22px; color: var(--accent); font-variant-numeric: tabular-nums; }
.pay-item { display: flex; gap: 14px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--rule); padding: 9px 0; }
.pay-item span { overflow-wrap: anywhere; }
.pay-stages { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 0; list-style: none; font-weight: 600; }
.flex-pay-section { min-width: 0; margin: 14px 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.flex-pay-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.flex-pay-section label { min-width: 0; }
.flex-pay-section button { margin: 8px 0; }

/* ---------- Bot visual editor (Telegram canvas) ---------- */
.visual-toolbar, .visual-crumbs { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.visual-toolbar label { min-width: 220px; margin: 0; }
.visual-grid { display: grid; grid-template-columns: minmax(300px, 520px) minmax(280px, 1fr); gap: 20px; align-items: start; }
.telegram-preview { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #dfe9e4; color: #1f2d36; }
.telegram-header { padding: 14px 18px; background: #3f6475; color: #fff; font-weight: 600; }
.telegram-conversation { padding: 18px; min-height: 420px; }
.telegram-message { display: block; width: 100%; border: 0; border-radius: 12px 12px 12px 3px; background: #fff; color: #1f2d36; text-align: left; white-space: pre-wrap; line-height: 1.65; padding: 14px 16px; }
.telegram-row { display: flex; gap: 5px; margin-top: 5px; }
.telegram-button { flex: 1; min-width: 0; border: 0; background: #4f7480; color: #fff; white-space: normal; overflow-wrap: anywhere; padding: 10px 8px; border-radius: 6px; cursor: grab; }
.telegram-button:hover:not(:disabled) { background: #3f616b; border: 0; }
.telegram-button.is-hidden { opacity: .45; text-decoration: line-through; }
.telegram-drop { font-size: 11px; height: 16px; color: #45636a; text-align: center; border: 1px dashed transparent; }
.telegram-drop:hover { border-color: #3f6475; }
.telegram-caption { font-size: 12px; color: #4b666b; line-height: 1.6; }
.telegram-media { display: block; width: 100%; max-height: 300px; object-fit: contain; margin-bottom: 10px; border-radius: 10px; }
.visual-inspector { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.visual-inspector label { margin: 14px 0; }
.visual-inspector button { margin: 4px; }
.visual-inspector textarea { min-height: 110px; }

/* ---------- Quick start ---------- */
.start-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.start-progress { display: flex; align-items: center; gap: 14px; margin: 0 0 16px; }
.start-progress .bar { flex: 1; height: 6px; background: var(--active); border-radius: 999px; overflow: hidden; }
.start-progress .bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .3s; }
.start-progress strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.start-steps { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.start-step { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 4px 14px; align-items: start; padding: 16px 18px; border-top: 1px solid var(--rule); }
.start-step:first-child { border-top: 0; }
.start-step .mark { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--control); display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 1px; font-variant-numeric: tabular-nums; }
.start-step.done .mark { background: var(--positive); border-color: var(--positive); color: #fff; }
.start-step h3 { margin: 0; font-size: 15px; }
.start-step.done h3 { color: var(--muted); }
.start-step p { margin: 4px 0 0; color: var(--muted); line-height: 1.65; }
.start-step .where { font-size: 12px; color: var(--faint); margin-top: 6px; }
.start-step .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.start-aside { display: grid; gap: 16px; }
.start-aside .panel { margin: 0; }
.start-aside h2 { margin-bottom: 8px; }
.start-aside ol, .start-aside ul { margin: 0; padding-left: 18px; line-height: 1.8; }
.glossary dt { color: var(--text); font-weight: 600; }
.glossary dd { color: var(--muted); margin-bottom: 4px; }
.glossary { grid-template-columns: 1fr; gap: 2px; margin: 0; }

/* ---------- Leave calendar ---------- */
.leave-top { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; margin-bottom: 16px; }
.leave-top .panel { margin: 0; }
.leave-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); align-items: center; }
.leave-legend span { display: inline-flex; align-items: center; gap: 6px; }
.leave-legend i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.k-rest { background: var(--k-rest-bg); color: var(--k-rest-ink); }
.k-personal { background: var(--k-personal-bg); color: var(--k-personal-ink); }
.k-sick { background: var(--k-sick-bg); color: var(--k-sick-ink); }
.k-paid { background: var(--k-paid-bg); color: var(--k-paid-ink); }
.k-other { background: var(--k-other-bg); color: var(--k-other-ink); }
.leave-grid-wrap { overflow: auto; max-height: 70vh; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.leave-grid { border-collapse: separate; border-spacing: 0; font-size: 12px; width: max-content; min-width: 100%; }
.leave-grid th, .leave-grid td { padding: 0; border-bottom: 1px solid var(--rule); border-right: 1px solid var(--rule); white-space: nowrap; text-align: center; }
.leave-grid thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); height: 44px; min-width: 34px; font-weight: 500; line-height: 1.2; color: var(--muted); }
.leave-grid thead th b { display: block; font-size: 13px; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.leave-grid thead th.weekend b, .leave-grid thead th.weekend { color: var(--negative); }
.leave-grid thead th.today { box-shadow: inset 0 -2px 0 var(--accent); }
.leave-grid thead th.today b { color: var(--accent); }
.leave-grid .person { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; padding: 6px 12px; min-width: 150px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.leave-grid thead .person { z-index: 3; }
.leave-grid .person strong { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.leave-grid .person small { color: var(--muted); }
.leave-grid .total { position: sticky; right: 0; background: var(--surface); padding: 0 10px; min-width: 56px; font-variant-numeric: tabular-nums; font-weight: 600; box-shadow: -1px 0 0 var(--line); }
.leave-grid thead .total { z-index: 3; }
.leave-grid td.cell { width: 34px; height: 36px; }
.leave-grid td.cell button { width: 100%; height: 36px; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; font-size: 11px; font-weight: 600; color: var(--muted); }
.leave-grid td.cell button:hover:not(:disabled) { background: var(--active); }
.leave-grid td.cell.weekend { background: var(--raised); }
.leave-grid td.cell.today { background: var(--tint); }
.leave-grid td.cell button.has { border-radius: 4px; margin: 3px 2px; width: calc(100% - 4px); height: 30px; }
.leave-grid td.cell button.half { box-shadow: inset 0 -3px 0 var(--surface); opacity: .8; }
.leave-grid td.cell button.k-rest { background: var(--k-rest-bg); color: var(--k-rest-ink); }
.leave-grid td.cell button.k-personal { background: var(--k-personal-bg); color: var(--k-personal-ink); }
.leave-grid td.cell button.k-sick { background: var(--k-sick-bg); color: var(--k-sick-ink); }
.leave-grid td.cell button.k-paid { background: var(--k-paid-bg); color: var(--k-paid-ink); }
.leave-grid td.cell button.k-other { background: var(--k-other-bg); color: var(--k-other-ink); }
.leave-grid td.cell button.selected { outline: 2px solid var(--primary); outline-offset: -2px; }
.leave-grid tbody tr:hover td { background: inherit; }
.leave-grid tbody tr:hover .person { background: var(--raised); }
.leave-form label { margin: 10px 0; }
.leave-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.weekday-pick { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.weekday-pick label, .kind-pick label { margin: 0; display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; font-weight: 400; cursor: pointer; font-size: 13px; }
.weekday-pick label:has(input:checked), .kind-pick label:has(input:checked) { border-color: var(--primary); background: var(--active); font-weight: 600; }
.kind-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.kind-pick i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.people-pick { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-control); padding: 4px 10px; margin-top: 6px; }
.people-pick label { display: flex; align-items: center; gap: 8px; margin: 0; padding: 6px 0; border-bottom: 1px solid var(--rule); font-weight: 400; }
.people-pick label:last-child { border-bottom: 0; }
.people-pick .pick-all { font-weight: 600; }
.leave-actions { display: flex; gap: 8px; margin-top: 14px; }
.leave-actions .primary { flex: 1; }
.leave-list { display: grid; gap: 0; }
.leave-list .item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--rule); font-size: 13px; }
.leave-list .item:last-child { border-bottom: 0; }
.leave-list .chip { padding: 1px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.leave-howto { margin: 0; padding-left: 18px; line-height: 1.8; color: var(--muted); }
.leave-howto b { color: var(--text); }
.contact-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.contact-list a { text-decoration: none; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--text); }
.contact-list a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Promotion page aliases ---------- */
.promotion-scope { border-left: 0 !important; border-radius: var(--radius); }
.placement-tag { border-radius: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .leave-top, .start-layout { grid-template-columns: 1fr; }
  .queue-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .queue-strip > button:not(.queue-card) { grid-column: span 1; }
}
@media (max-width: 1100px) {
  #workspace { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--line); background: var(--bg); }
  .workspace-brand { padding: 0; flex: 1; }
  #navigation-toggle { display: inline-flex; }
  #main-nav { display: none; flex-basis: 100%; padding: 6px 0 4px; }
  .navigation-open #main-nav { display: flex; }
  .sidebar-bottom { display: none; }
  .navigation-open .sidebar-bottom { display: block; flex-basis: 100%; }
  .work-content { padding: 0 16px 48px; }
}
@media (max-width: 720px) {
  .workspace-header { flex-wrap: wrap; }
  .header-actions { width: 100%; justify-content: flex-start; }
  .header-actions label { flex: 1; }
  .header-actions select { min-width: 0; flex: 1; }
  .page-title { padding-top: 16px; align-items: flex-start; }
  .stats-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-strip > div { border-left: 0; border-top: 1px solid var(--line); flex-direction: row-reverse; justify-content: space-between; align-items: center; padding: 10px 14px; }
  .stats-strip > div:nth-child(-n+2) { border-top: 0; }
  .stats-strip > div:nth-child(2n) { border-left: 1px solid var(--line); }
  .stats-strip strong { font-size: 20px; }
  .queue-strip { grid-template-columns: 1fr; }
  .checklist-line { grid-template-columns: 80px 1fr; }
  .checklist-line > span:last-child { grid-column: 2; }
  .two-col, .shift-grid, .flex-pay-grid, .leave-form .row { grid-template-columns: 1fr; }
  .toolbar label { flex: 1 1 100%; }
  .toolbar > button { flex: 1 1 auto; }
  .compact-search { min-width: 0; width: 100%; }
  .visual-grid { grid-template-columns: 1fr; }
  .start-step { grid-template-columns: 28px minmax(0, 1fr); }
  .start-step .actions { grid-column: 2; justify-content: flex-start; margin-top: 8px; }
  button { min-height: 40px; }
  .table-actions button, .leave-grid td.cell button, .segmented button, .categories button { min-height: 32px; }
  dialog[data-ux-prepared] { width: calc(100vw - 16px); max-height: 94dvh; }
  .ux-dialog-body { padding: 14px 16px; }
  .ux-form-actions { padding: 10px 16px; }
  .ux-form-actions > button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.leave-grid td, .leave-grid th { vertical-align: middle; }
@media (max-width: 1100px) { #navigation-toggle { order: 2; } }
input[role=switch] { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--control); position: relative; cursor: pointer; transition: background-color .15s; flex: 0 0 auto; }
input[role=switch]::before { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgb(0 0 0 / 20%); }
input[role=switch]:checked { background: var(--positive); }
input[role=switch]:checked::before { transform: translateX(16px); }
input[role=switch]:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Group receipt visual editor ---------- */
.group-grid { grid-template-columns: minmax(340px, 560px) minmax(300px, 1fr); }
.group-chat { display: flex; flex-direction: column; max-height: 82vh; }
.group-chat .telegram-conversation { flex: 1; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.tg-divider { align-self: center; margin: 14px 0 4px; padding: 2px 12px; border-radius: 999px; background: rgb(0 0 0 / 22%); color: #fff; font-size: 12px; font-weight: 600; }
.tg-user { align-self: flex-end; max-width: 70%; background: #e1fec6; color: #1f2d36; border-radius: 12px 12px 3px 12px; padding: 6px 12px; display: grid; }
.tg-user small { color: #3a8a3a; font-weight: 600; font-size: 12px; }
.tg-system { align-self: center; font-size: 12px; color: #fff; background: rgb(0 0 0 / 16%); border-radius: 999px; padding: 2px 10px; }
.tg-bot { display: grid; gap: 4px; max-width: 92%; }
.tg-bot .telegram-message { cursor: pointer; }
.tg-tag { font-size: 11px; color: #3f6475; font-weight: 600; }
.telegram-message.selected, .tg-popup.selected, .telegram-button.selected, .group-key.selected { outline: 3px solid #f2a93b; outline-offset: 1px; }
.telegram-message strong { font-weight: 700; }
.telegram-message code { background: #eef2f4; border: 0; color: #a3263f; font-size: 12.5px; }
.telegram-message blockquote { margin: 4px 0; padding-left: 8px; border-left: 3px solid #4f7480; }
.tg-link { color: #2a7ab0; }
.tg-emoji { display: inline-block; padding: 0 2px; border-radius: 4px; box-shadow: inset 0 0 0 1.5px #f2a93b; line-height: 1.2; }
.tg-popup { align-self: center; display: grid; gap: 2px; max-width: 80%; text-align: center; white-space: normal; background: #fff; color: #1f2d36; border: 1px dashed #8aa4ad; border-radius: 10px; padding: 8px 14px; }
.tg-popup small { color: #6a7f86; font-size: 11px; }
.telegram-row .telegram-button { cursor: pointer; }
.group-keyboard { background: #eef2f4; padding: 8px 10px 10px; display: grid; gap: 5px; border-top: 1px solid #c9d6db; }
.group-keyboard .telegram-caption { color: #4b666b; }
.group-key { flex: 1; min-width: 0; background: #fff; color: #1f2d36; border: 0; border-radius: 6px; box-shadow: 0 1px 0 #b9c7cc; padding: 9px 6px; white-space: normal; }
.group-key:hover:not(:disabled) { background: #f7fafb; }
.group-copy { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 0 0 12px; }
.group-copy-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.group-copy textarea { font-size: 13px; margin-top: 6px; }
.group-copy-tools { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.field-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; }
.field-chip { min-height: 24px; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--tint); border-color: transparent; color: var(--accent); }
.emoji-palette { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.emoji-chip { display: inline-flex; gap: 6px; align-items: center; min-height: 30px; padding: 3px 10px; border-radius: 999px; font-size: 12px; }
.group-library { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 12px; }
.library-list { display: grid; gap: 6px; margin: 8px 0; }
.library-row, .library-add { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto auto; gap: 6px; align-items: center; }
.library-add { grid-template-columns: 52px minmax(0, 1fr) minmax(0, 1fr) auto; margin: 10px 0; }
.library-row input, .library-add input { margin: 0; }
.library-row input.fallback, .library-add input.fallback { text-align: center; }
.library-row code { font-size: 11.5px; }
@media (max-width: 900px) { .group-grid { grid-template-columns: 1fr; } .group-chat { max-height: none; } }
.emoji-picker { margin: 4px 0 12px; } .emoji-picker .emoji-palette { margin: 4px 0 0; }

.group-v8-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 0; font-size: 12.5px; }
.group-v8-hint button { min-height: 28px; padding: 2px 10px; }

.contact-suggest { margin: 0 0 12px; }
.contact-suggest p { margin: 0 0 6px; font-size: 12.5px; }
.contact-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.contact-chips button { min-height: 30px; padding: 3px 10px; font-size: 13px; }
.contact-chips button.active { border-color: var(--accent, #1f6f5c); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #1f6f5c) 25%, transparent); }

/* Group bottom keyboard preview on the rules page: mirrors Telegram's reply keyboard. */
.keyboard-panel { margin-top: 22px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.keyboard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.keyboard-head h2 { margin: 0 0 4px; font-size: 16px; }
.keyboard-head p { margin: 0; max-width: 62ch; font-size: 13px; line-height: 1.6; }
.keyboard-head > span { white-space: nowrap; font-size: 13px; }
.keyboard-frame { max-width: 560px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--raised); }
.keyboard-input { padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.keyboard-input span { display: block; padding: 8px 12px; border-radius: 18px; background: var(--raised); color: var(--faint); font-size: 14px; }
.keyboard-keys { display: grid; gap: 6px; padding: 8px; }
.keyboard-row { display: flex; gap: 6px; }
.keyboard-key { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 46px; padding: 6px 8px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 0 var(--control); color: var(--text); font-size: 15px; font-weight: 500; text-align: center; overflow-wrap: anywhere; }
.keyboard-key small { font-size: 11px; font-weight: 400; color: var(--muted); }
.keyboard-icon { font-size: 11px; color: var(--accent); margin-bottom: -2px; }
@media (max-width: 600px) { .keyboard-head { flex-direction: column; gap: 6px; } .keyboard-key { font-size: 14px; min-height: 42px; } }

/* ---------- Telegram-style copy & emoji editor (tg-emoji.js, bsCopy) ---------- */
/* Telegram's own colours: the Web app's light theme, and the desktop "Night" theme for dark mode. */
.tgx {
  --tg-bg: #8fb48c; --tg-bg-1: #dbddbb; --tg-bg-2: #6ba587; --tg-bg-3: #d5d88d; --tg-bg-4: #88b884;
  --tg-surface: #ffffff; --tg-bubble: #ffffff; --tg-text: #000000; --tg-muted: #707579; --tg-accent: #3390ec;
  --tg-line: #dadce0; --tg-hover: #f4f4f5; --tg-chip: #e8f1fc;
  --tg-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", "Apple Color Emoji", sans-serif;
  display: grid; grid-template-columns: minmax(340px, 520px) minmax(260px, 1fr); gap: 20px; align-items: start;
}
@media (prefers-color-scheme: dark) {
  .tgx {
    --tg-bg: #0e1621; --tg-bg-1: #10202f; --tg-bg-2: #0e1621; --tg-bg-3: #142636; --tg-bg-4: #0b131c;
    --tg-surface: #17212b; --tg-bubble: #182533; --tg-text: #f5f5f5; --tg-muted: #708499; --tg-accent: #5eb5f7;
    --tg-line: #101921; --tg-hover: #202b36; --tg-chip: #1f3347;
  }
}
.tgx-chat { position: relative; display: flex; flex-direction: column; height: min(640px, calc(100vh - 160px)); min-height: 520px;
  border-radius: 12px; overflow: hidden; border: 1px solid var(--line); font-family: var(--tg-font); color: var(--tg-text);
  background: radial-gradient(circle at 15% 20%, var(--tg-bg-1), transparent 55%), radial-gradient(circle at 85% 30%, var(--tg-bg-3), transparent 50%),
    radial-gradient(circle at 30% 85%, var(--tg-bg-4), transparent 55%), radial-gradient(circle at 80% 90%, var(--tg-bg-2), transparent 60%), var(--tg-bg); }
.tgx-head { display: flex; align-items: center; gap: 12px; padding: 8px 16px; min-height: 56px; background: var(--tg-surface); border-bottom: 1px solid var(--tg-line); }
.tgx-head div { display: grid; line-height: 1.25; }
.tgx-head strong { font-size: 16px; font-weight: 600; }
.tgx-head small { font-size: 14px; color: var(--tg-muted); }
.tgx-avatar { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; font-weight: 600; font-size: 17px;
  background: linear-gradient(#72d5fd, #2a9ef1); }
.tgx-scroll { flex: 1; overflow-y: auto; padding: 16px 12px 12px; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; }
.tgx-date { align-self: center; padding: 2px 10px; border-radius: 12px; background: rgba(0,0,0,.22); color: #fff; font-size: 13px; font-weight: 500; }
.tgx-msg { display: flex; }
.tgx-bubble { position: relative; max-width: min(440px, 88%); padding: 6px 9px 7px 11px; border-radius: 15px 15px 15px 6px; background: var(--tg-bubble);
  box-shadow: 0 1px 2px rgba(16,35,47,.15); font-size: 16px; line-height: 1.3125; white-space: pre-wrap; overflow-wrap: anywhere; }
.tgx-bubble a, .tgx-bubble .tg-link { color: var(--tg-accent); }
.tgx-bubble code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9em; color: var(--tg-accent); }
.tgx-bubble blockquote { margin: 2px 0; padding: 2px 8px; border-left: 3px solid var(--tg-accent); border-radius: 4px; background: var(--tg-chip); }
.tgx-time { float: right; margin: 8px 0 -4px 10px; font-size: 12px; color: var(--tg-muted); line-height: 1; }
.tgx-empty { color: var(--tg-muted); font-style: italic; }
.tgx-editbar { display: flex; align-items: center; gap: 12px; padding: 6px 8px 6px 16px; background: var(--tg-surface); border-top: 1px solid var(--tg-line); }
.tgx-editbar > svg { flex: none; width: 22px; height: 22px; fill: var(--tg-accent); }
.tgx-editbar div { flex: 1; min-width: 0; display: grid; padding-left: 10px; border-left: 2px solid var(--tg-accent); line-height: 1.3; }
.tgx-editbar strong { color: var(--tg-accent); font-size: 14px; font-weight: 600; }
.tgx-editbar span { font-size: 14px; color: var(--tg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tgx-composer { display: flex; align-items: flex-end; gap: 4px; padding: 6px 8px 8px; background: var(--tg-surface); }
.tgx-input { flex: 1; min-width: 0; min-height: 22px; max-height: 180px; overflow-y: auto; padding: 11px 4px; outline: 0; color: var(--tg-text);
  font: 16px/1.375 var(--tg-font); white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; }
.tgx-input:empty::before { content: attr(data-placeholder); color: var(--tg-muted); }
.tgx-atom { display: inline-block; vertical-align: -0.25em; user-select: all; }
.tgx-atom .tge { vertical-align: 0; }
.tgx-composer:focus-within { box-shadow: inset 0 2px 0 var(--tg-accent); }
.tgx-icon, .tgx-send { flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.tgx-icon svg { width: 24px; height: 24px; fill: var(--tg-muted); }
.tgx-icon:hover { background: var(--tg-hover); }
.tgx-icon[aria-expanded="true"] svg { fill: var(--tg-accent); }
.tgx-send { background: var(--tg-accent); }
.tgx-send svg { width: 24px; height: 24px; fill: #fff; }
.tgx-chat button:focus-visible { outline: 2px solid var(--tg-accent); outline-offset: 2px; }
.tgx-panel { position: absolute; left: 8px; z-index: 3; width: min(380px, calc(100% - 16px)); border-radius: 12px; overflow: hidden;
  background: var(--tg-surface); box-shadow: 0 4px 20px rgba(0,0,0,.22); }

.tgx-side { min-width: 0; }
.tgx-side h3 { margin: 0 0 8px; font-size: 15px; }
.tgx-list { display: grid; max-height: 360px; overflow-y: auto; margin: 10px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.tgx-row { display: grid; gap: 2px; padding: 9px 12px; text-align: left; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; background: transparent; color: var(--text); white-space: normal; }
.tgx-row:hover { background: var(--raised); }
.tgx-row[aria-selected="true"] { background: var(--tint); box-shadow: inset 3px 0 0 var(--accent); }
.tgx-row-top { display: flex; align-items: center; gap: 8px; }
.tgx-row-top strong { font-size: 14px; font-weight: 600; }
.tgx-row-text { font-size: 13px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tgx-tag { font-size: 12px; padding: 0 6px; border-radius: 9px; background: var(--tint); color: var(--accent); }
.tgx-draft { background: var(--warn-bg); color: var(--warn-ink); }
.tgx-origin pre { white-space: pre-wrap; font-size: 13px; background: var(--raised); padding: 10px; border-radius: var(--radius); }
.tgx-tools { margin: 8px 0; }
@media (max-width: 900px) { .tgx { grid-template-columns: 1fr; } .tgx-chat { height: 600px; } }

/* Custom emoji: inline in text it is 1.25em like Telegram; in the panel a 32px cell. */
.tge { display: inline-block; width: 1.25em; height: 1.25em; line-height: 1.25em; text-align: center; vertical-align: -0.25em; overflow: hidden; }
.tge.is-ready { font-size: inherit; }
.tge svg, .tge img, .tge video { display: block; width: 100%; height: 100%; object-fit: contain; }
.tge.is-missing { opacity: .7; }
.telegram-button .tge, .group-key .tge { vertical-align: -0.2em; }

.tge-panel { display: flex; flex-direction: column; height: 320px; font-family: var(--tg-font, inherit); color: var(--tg-text, var(--text)); background: var(--tg-surface, var(--surface)); }
.visual-inspector .tge-panel, .emoji-picker .tge-panel, .group-copy .tge-panel { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 8px 0; }
.tge-search { box-sizing: border-box; width: calc(100% - 16px); margin: 8px; padding: 7px 12px; border-radius: 18px; border: 1px solid transparent; background: var(--tg-hover, var(--raised)); color: inherit; font: 15px var(--tg-font, inherit); }
.tge-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 8px; overscroll-behavior: contain; }
.tge-section h4 { position: sticky; top: 0; margin: 0; padding: 8px 4px 4px; font-size: 14px; font-weight: 500; color: var(--tg-muted, var(--muted)); background: var(--tg-surface, var(--surface)); z-index: 1; }
.tge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 2px; }
.tge-cell { display: grid; place-items: center; height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; font-size: 26px; cursor: pointer; }
.tge-cell .tge { width: 32px; height: 32px; line-height: 32px; font-size: 26px; vertical-align: 0; }
.tge-cell:hover, .tge-cell:focus-visible { background: var(--tg-hover, var(--raised)); }
.tge-cell:focus-visible, .tge-tab:focus-visible { outline: 2px solid var(--tg-accent, var(--accent)); outline-offset: -2px; }
.tge-tabs { display: flex; gap: 2px; overflow-x: auto; padding: 4px 8px; border-top: 1px solid var(--tg-line, var(--line)); }
.tge-tab { flex: none; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 10px; background: transparent; font-size: 20px; cursor: pointer; }
.tge-tab .tge { width: 26px; height: 26px; line-height: 26px; vertical-align: 0; }
.tge-tab:hover { background: var(--tg-hover, var(--raised)); }
.tge-add { color: var(--tg-accent, var(--accent)); font-size: 24px; font-weight: 300; }
.tge-empty { padding: 24px 12px; text-align: center; color: var(--tg-muted, var(--muted)); line-height: 1.6; }
.tge-import { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 0 8px 8px; }
.tge-import input { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--tg-line, var(--line)); background: transparent; color: inherit; font: 14px var(--tg-font, inherit); }
.tge-import button { border-radius: 8px; background: var(--tg-accent, var(--accent)); color: #fff; border: 0; padding: 0 14px; }
.tge-import p { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--tg-muted, var(--muted)); line-height: 1.5; }
.tge-status:empty { display: none; }
@media (prefers-reduced-motion: reduce) { .tgx * { scroll-behavior: auto !important; } }

/* ---------- 机器人设置 (v2.13) ----------
   One identity header, tabs in four groups, a sticky publish bar on the visual editors and narrow
   form cards on the list tabs. Uses only the workbench tokens, so light, dark and Telegram themes follow. */
.bs-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.bs-avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); font-size: 18px; font-weight: 650; }
.bs-who { min-width: 0; }
.bs-name { font-size: 17px; line-height: 1.3; margin: 0; overflow-wrap: anywhere; }
.bs-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.bs-handle { font-variant-numeric: tabular-nums; }
.bs-state, .bs-draft { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; line-height: 1.4; padding: 2px 9px 2px 8px; border-radius: 999px; white-space: nowrap; }
.bs-state::before, .bs-draft::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.bs-state.is-own, .bs-draft.is-clean { background: var(--positive-bg); color: var(--positive-ink); }
.bs-state.is-shared, .bs-draft.is-dirty { background: var(--warn-bg); color: var(--warn-ink); }
.bs-about { position: relative; align-self: start; }
.bs-about > summary { list-style: none; cursor: pointer; font-size: 13px; color: var(--muted); padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-control); white-space: nowrap; }
.bs-about > summary::-webkit-details-marker { display: none; }
.bs-about > summary::before { content: "i"; display: inline-grid; place-items: center; width: 15px; height: 15px; margin-right: 6px; border: 1.5px solid currentColor; border-radius: 50%; font: 600 10px/1 Georgia, serif; vertical-align: -2px; }
.bs-about[open] > summary { color: var(--text); background: var(--raised); }
.bs-about > ul { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: min(420px, 80vw); margin: 0; padding: 14px 16px 14px 30px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-float); font-size: 13px; line-height: 1.65; color: var(--text); }
.bs-about li + li { margin-top: 6px; }

.bs-tabs { display: flex; gap: 4px 22px; margin: 14px 0 0; padding: 0 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.bs-tabs::-webkit-scrollbar { display: none; }
.bs-tab-group { display: flex; align-items: flex-end; gap: 2px; flex: none; }
.bs-tab-group + .bs-tab-group { padding-left: 22px; border-left: 1px solid var(--rule); }
.bs-tab-label { align-self: center; font-size: 11.5px; color: var(--faint); margin-right: 8px; }
.bs-tabs .bs-tab { height: auto; min-height: 44px; padding: 10px 10px 11px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); font-weight: 500; white-space: nowrap; margin-bottom: -1px; }
.bs-tabs .bs-tab:hover:not(:disabled) { background: none; color: var(--text); border-color: transparent; border-bottom-color: var(--control); }
.bs-tabs .bs-tab[aria-selected=true] { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }
.bs-tabs .bs-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.bs-view #bot-settings-error:empty { display: none; }
.bs-view #bot-settings-error { margin: 12px 0 0; }
.bs-body { padding-top: 18px; }

.bs-actionbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; padding: 12px 14px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--radius); }
.bs-actionbar label { min-width: 240px; margin: 0; font-size: 12.5px; color: var(--muted); }
.bs-actionbar label select { margin-top: 4px; color: var(--text); }
.bs-actionbar .bs-draft { margin-left: auto; align-self: center; }
.bs-actionbar > button { min-height: 36px; }
.bs-body .visual-crumbs { margin: -4px 0 12px; font-size: 13px; }
.bs-body .telegram-preview { border-radius: 14px; }
.bs-body .visual-inspector { border-radius: var(--radius); }
.bs-body .visual-inspector > h3:first-child { margin-top: 0; }

/* List tabs: one readable column of cards rather than full-width rows of inputs. */
.bs-body[data-tab=buttons], .bs-body[data-tab=custom], .bs-body[data-tab=media], .bs-body[data-tab=demo], .bs-body[data-tab=security] { max-width: 820px; }
.bs-body > .guided-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 20px; margin: 0 0 14px; }
.bs-body > .guided-section > h3 { font-size: 15px; margin: 0 0 6px; }
.bs-body > .guided-section > p.muted { font-size: 13px; line-height: 1.65; margin-bottom: 14px; max-width: 68ch; }
.bs-body > .guided-section label { margin: 0 0 14px; }
.bs-body > .guided-section > button { margin: 4px 8px 0 0; }
.bs-body > .guided-section > button:first-of-type { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
.bs-body .guided-section .guided-section { border-top: 1px solid var(--rule); padding: 12px 0 4px; margin-top: 12px; }
.bs-body .guided-section .guided-section > h3 { margin: 0 0 2px; font-size: 14px; }
.bs-body .guided-section .guided-section > button { margin: 6px 8px 0 0; }

@media (max-width: 720px) {
  .bs-head { grid-template-columns: auto 1fr; padding: 14px; }
  .bs-about { grid-column: 1 / -1; }
  .bs-about > ul { position: static; width: auto; margin-top: 8px; box-shadow: none; }
  .bs-tabs { gap: 4px 14px; }
  .bs-tab-group + .bs-tab-group { padding-left: 14px; }
  .bs-actionbar { position: static; }
  .bs-actionbar label { min-width: 0; width: 100%; }
  .bs-actionbar .bs-draft { margin-left: 0; }
  .bs-body > .guided-section { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { .bs-actionbar { backdrop-filter: none; } }

/* ---------- 系统更新 (v2.13) ---------- */
.su-view { max-width: 860px; }
.su-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 14px; }
.su-card h2 { font-size: 15px; margin: 0; }
.su-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.su-head { display: grid; grid-template-columns: minmax(140px, auto) 1fr; gap: 24px; align-items: center; }
.su-label { font-size: 12.5px; color: var(--muted); margin: 0; }
.su-version { font-size: 26px; font-weight: 650; letter-spacing: -.01em; margin: 0; font-variant-numeric: tabular-nums; }
.su-mode p { margin: 6px 0 0; font-size: 13px; line-height: 1.6; }
.su-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 2px 9px 2px 8px; border-radius: 999px; white-space: nowrap; }
.su-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.su-badge.is-ok { background: var(--positive-bg); color: var(--positive-ink); }
.su-badge.is-warn { background: var(--warn-bg); color: var(--warn-ink); }
.su-badge.is-bad { background: var(--negative-bg); color: var(--negative-ink); }
.su-badge.is-idle { background: var(--active); color: var(--muted); }
.su-badge.is-busy { background: var(--tint); color: var(--accent); }
.su-badge.is-busy::before { animation: su-pulse 1.2s ease-in-out infinite; }
@keyframes su-pulse { 50% { opacity: .25; } }
.su-fresh { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-color: var(--positive); }
.su-fresh p { margin: 0; }
.su-upload > p.muted { font-size: 13px; line-height: 1.65; margin: 6px 0 14px; }
.su-drop { position: relative; display: grid; place-items: center; gap: 4px; min-height: 132px; padding: 20px; border: 1.5px dashed var(--control); border-radius: var(--radius); background: var(--raised); text-align: center; cursor: pointer; margin: 0; }
.su-drop:hover, .su-drop.is-over, .su-drop:focus-within { border-color: var(--text); background: var(--surface); }
.su-drop[aria-busy=true] { opacity: .6; cursor: progress; }
.su-file { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.su-drop-title { font-weight: 600; font-size: 14px; }
.su-drop-sub { font-size: 12.5px; color: var(--muted); }
.su-versions { display: flex; align-items: baseline; gap: 10px; font-size: 20px; font-variant-numeric: tabular-nums; margin: 4px 0 12px; }
.su-versions span:first-child { color: var(--muted); }
.su-arrow { color: var(--faint); }
.su-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.su-stats div { border: 1px solid var(--rule); border-radius: var(--radius-control); padding: 10px 12px; }
.su-stats dt { font-size: 12.5px; color: var(--muted); }
.su-stats dd { margin: 2px 0 0; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.su-files { margin: 0 0 10px; }
.su-files > summary { cursor: pointer; font-size: 13px; color: var(--muted); padding: 4px 0; }
.su-files ul { list-style: none; margin: 6px 0 0; padding: 0; max-height: 260px; overflow: auto; border: 1px solid var(--rule); border-radius: var(--radius-control); }
.su-files li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 12.5px; border-top: 1px solid var(--rule); }
.su-files li:first-child { border-top: 0; }
.su-tag { font-size: 11.5px; padding: 0 6px; border-radius: var(--radius-chip); flex: none; }
.su-tag.is-new { background: var(--positive-bg); color: var(--positive-ink); }
.su-tag.is-mod { background: var(--k-other-bg); color: var(--k-other-ink); }
.su-confirm { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--rule); }
.su-confirm label { flex: 1 1 240px; margin: 0; }
.su-actions { display: flex; gap: 8px; }
.su-actions button, .su-confirm > button { min-height: 36px; }
.su-steps { list-style: none; margin: 8px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--rule); }
.su-steps li { position: relative; display: grid; grid-template-columns: 9.5em 1fr; gap: 10px; padding: 5px 0; font-size: 13px; line-height: 1.55; }
.su-steps li::before { content: ""; position: absolute; left: -19px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--control); }
.su-steps li:last-child::before { background: var(--text); }
.su-steps time { color: var(--muted); font-variant-numeric: tabular-nums; }
.su-history h2 { margin-bottom: 8px; }
.su-item { border-top: 1px solid var(--rule); }
.su-item > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; padding: 10px 0; cursor: pointer; font-size: 13px; }
.su-item > summary .su-badge { margin-left: auto; }
.su-when { font-variant-numeric: tabular-nums; color: var(--muted); }
.su-ver { font-weight: 600; font-variant-numeric: tabular-nums; }
.su-item > .su-steps { margin-bottom: 12px; }
.su-rollback { margin-bottom: 14px; }
@media (max-width: 720px) {
  .su-head { grid-template-columns: 1fr; gap: 10px; }
  .su-steps li { grid-template-columns: 1fr; gap: 0; }
  .su-fresh { flex-direction: column; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) { .su-badge.is-busy::before { animation: none; } }

/* v2.14 · a former employee still listed in the months they worked */
.tag-departed { justify-self: start; padding: 1px 7px; border-radius: 999px; font-size: 12px; line-height: 18px;
  background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line); }

/* Pay standards: one line per rule in force */
.standard-line { display: grid; grid-template-columns: minmax(96px, auto) 1fr auto; align-items: center; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.standard-line span { color: var(--muted); font-variant-numeric: tabular-nums; }
.standard-line button { min-height: 36px; }
#standards-current h3 { font-size: 15px; margin: 12px 0 4px; }
@media (max-width: 640px) { .standard-line { grid-template-columns: 1fr auto; } .standard-line span { grid-column: 1 / -1; grid-row: 2; } }
