/* Giao diện "Nhận cuốc Web" – kế thừa chuẩn 100% ngôn ngữ thiết kế của extension (panel.css),
   bổ sung màn hình đăng nhập/xác thực sắc nét và bố cục 2 cột không cần khung chat Zalo. */
:root {
  --blue: #0068ff; --blue-600: #0055d4; --blue-ink: #0068ff; --blue-50: #e9f2ff; --blue-100: #cde0ff;
  --ink: #081c36; --ink-2: #3a4a61; --muted: #6c7a90; --line: #dfe5ec; --line-2: #eef1f5; --bg: #f3f5f8; --card: #fff;
  --ok: #0c9a52; --ok-50: #e6f6ed; --ok-100: #b9e5cb; --warn: #e07800; --warn-50: #fff4e2; --bad: #d63636; --bad-50: #fdeded; --bad-100: #f5c3c3;
  --gold: #f2a100; --gold-50: #fff6dc; --gold-ink: #9a5d00;
  --shadow: 0 1px 2px rgb(8 28 54 / .06);
  --shadow-md: 0 6px 20px rgb(8 28 54 / .08), 0 1px 3px rgb(8 28 54 / .05);
  --shadow-lg: 0 14px 36px rgb(8 28 54 / .16), 0 2px 6px rgb(8 28 54 / .08);
}

body.dark {
  --blue-ink: #58a6ff;
  --ink: #e7ecf3; --ink-2: #c4cdd9; --muted: #8e9aac; --line: #333c48; --line-2: #2a313b; --bg: #161b22; --card: #212832;
  --blue-50: #142a4d; --blue-100: #1f4277; --ok-50: #11301f; --ok-100: #1d5537; --warn-50: #3a2a10; --bad-50: #3b1c1c; --bad-100: #6b2b2b;
  --gold-50: #3a2f10; --gold-ink: #f2c45a;
  --shadow: 0 1px 2px rgb(0 0 0 / .24);
  --shadow-md: 0 6px 20px rgb(0 0 0 / .34), 0 1px 3px rgb(0 0 0 / .22);
  --shadow-lg: 0 14px 36px rgb(0 0 0 / .48), 0 2px 6px rgb(0 0 0 / .3);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body {
  font: 14px/1.45 "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ================= Màn hình Đăng nhập / Thiết lập tài khoản ================= */
.auth-screen {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(640px 360px at 50% -6%, rgb(0 104 255 / .11), transparent 70%),
    var(--bg);
}
body.dark .auth-screen {
  background:
    radial-gradient(640px 360px at 50% -6%, rgb(0 104 255 / .22), transparent 70%),
    var(--bg);
}
.auth-theme-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  background: var(--card) !important;
  border: 1px solid var(--line) !important;
  box-shadow: var(--shadow);
}
.auth-card {
  width: 100%;
  max-width: 404px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px 24px 22px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: pop .18s ease-out;
}
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}
.auth-brand .logo {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  box-shadow: 0 6px 18px rgb(0 104 255 / .32);
}
.auth-brand .logo svg { width: 25px; height: 25px; }
.auth-brand h1 { margin: 2px 0 0; font-size: 20px; font-weight: 800; letter-spacing: -.015em; color: var(--ink); }
.auth-brand p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.auth-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--blue-50);
  color: var(--blue-ink);
  border: 1px solid var(--blue-100);
  font-size: 11.5px;
  font-weight: 700;
}
.auth-pill svg { width: 12px; height: 12px; }
.auth-form { display: flex; flex-direction: column; gap: 11px; }
.auth-form .fld { margin-top: 0; }
.fld-inline { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.auth-form input:not([type=checkbox]) { height: 40px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap input { padding-right: 40px !important; }
.pw-eye {
  position: absolute;
  right: 5px;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.pw-eye:hover { background: var(--bg); color: var(--ink); }
.auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
  margin-top: 2px;
}
.auth-remember input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
  cursor: pointer;
  margin: 0;
}
.auth-submit {
  width: 100%;
  height: 44px !important;
  font-size: 15px !important;
  border-radius: 11px !important;
  margin-top: 4px;
}
.auth-foot {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding-top: 10px;
  border-top: 1px solid var(--line-2);
}

/* ================= Giao diện ứng dụng chính ================= */
.ui { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 58px;
  padding: 0 18px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgb(8 28 54 / .04);
  z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 6px; flex: none; }
.top-sep { width: 1px; height: 22px; background: var(--line); margin: 0 2px; }

.logo {
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center; color: #fff; flex: none; background: var(--blue);
  box-shadow: 0 2px 8px rgb(0 104 255 / .28);
}
.logo svg { width: 19px; height: 19px; }
.ttl { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ttl b { font-size: 15.5px; line-height: 1.2; }
.st { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pill-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; max-width: 240px; padding: 0 12px 0 10px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--bg);
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  cursor: pointer; transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.pill-btn:hover { border-color: var(--blue-100); background: var(--blue-50); color: var(--blue); }
.pill-btn.need-login { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 2px 8px rgb(0 104 255 / .26); }
.pill-btn.need-login:hover { background: var(--blue-600); color: #fff; }
.pill-btn.need-login .dot { background: #fff; box-shadow: none; animation: none; }
.pill-btn .acc-avt { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex: none; }
.pill-btn .acc-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ================= Bố cục 2 cột (Spotlight Cuốc + Panel cấu hình) ================= */
.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(360px, 480px) minmax(420px, 1fr);
  gap: 0;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}
.workspace.wide-editor {
  grid-template-columns: minmax(320px, 410px) minmax(540px, 1fr);
}

.stage-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px 20px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
}
.stage-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.stage-title b {
  min-width: 20px;
  height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  display: inline-grid;
  place-items: center;
}
.stage-auto-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--gold-50);
  color: var(--gold-ink);
  border: 1px solid #f7d983;
}
.stage-auto-pill svg { width: 12px; height: 12px; }
.stage-auto-pill.off {
  background: var(--card);
  color: var(--muted);
  border-color: var(--line);
}

.stage-card { display: flex; flex-direction: column; gap: 12px; }

.recent-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 2px 2px;
}
.recent-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 9px;
  background: var(--bg);
  border: 1px solid var(--line-2);
}
.recent-item .rm { flex: 1; min-width: 0; }

.panel-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.panel-nav {
  flex: none;
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.panel-nav button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 8px; border: 0; border-radius: 10px; background: transparent;
  font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
  transition: background .12s, color .12s;
}
.panel-nav button:hover { background: var(--bg); color: var(--ink); }
.panel-nav button.on { background: var(--blue-50); color: var(--blue-ink); }
.panel-nav button b { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 11px; display: inline-grid; place-items: center; }
.panel-nav .kn { font-style: normal; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--blue-100); color: var(--blue-ink); font-size: 11px; display: inline-grid; place-items: center; }

.body { flex: 1; overflow: auto; padding: 12px 14px 20px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* ---------- Nút & phím (y hệt panel.css) ---------- */
kbd { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; background: var(--card); font: 600 11px "Segoe UI", system-ui, sans-serif; color: var(--ink-2); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s, opacity .2s, transform .06s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, .ib:focus-visible, .pill-btn:focus-visible, .panel-nav button:focus-visible, .link:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.btn.big { height: 46px; font-size: 16px; border-radius: 12px; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.sm svg { width: 14px; height: 14px; }
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 3px 10px rgb(0 104 255 / .3); }
.btn.primary:hover { background: var(--blue-600); }
.btn.primary kbd { background: rgb(255 255 255 / .18); border-color: rgb(255 255 255 / .4); color: #fff; }
.btn.primary.locked { opacity: .5; pointer-events: none; }
.btn.quiet { background: var(--card); border-color: var(--line); color: var(--ink-2); padding: 0 16px; }
.btn.quiet:hover { background: var(--bad-50); border-color: var(--bad-100); color: var(--bad); }
.btn.outline { background: var(--card); border-color: var(--blue-100); color: var(--blue-ink); }
.btn.outline:hover { background: var(--blue-50); }
.btn.danger-outline { background: var(--card); border-color: var(--bad-100); color: var(--bad); }
.btn.danger-outline:hover { background: var(--bad-50); }
.btn.plain { background: transparent; color: var(--muted); padding: 0 8px; }
.btn.plain:hover { color: var(--bad); background: var(--bad-50); }

.ib { width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; flex: none; transition: background .12s, color .12s; }
.ib:hover { background: var(--bg); color: var(--ink); }
.ib.sm { width: 26px; height: 26px; border-radius: 7px; }
.ib.sm svg { width: 15px; height: 15px; }
.ib:disabled { opacity: .35; cursor: default; background: transparent; }
.ib.off { color: var(--bad); }
.ib.danger { background: var(--bad-50); color: var(--bad); }

.link { border: 0; background: none; padding: 0; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--blue-ink); cursor: pointer; }
.link:hover { text-decoration: underline; }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--warn); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgb(12 154 82 / .16); animation: breathe 2.4s ease-in-out infinite; }
.dot.bad { background: var(--bad); }
@keyframes breathe { 50% { box-shadow: 0 0 0 5px rgb(12 154 82 / .05); } }
.spin { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid var(--blue-100); border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= Thẻ cuốc nổi bật ================= */
.card { position: relative; background: var(--card); border: 2px solid var(--blue); border-radius: 16px; padding: 14px 16px 16px; box-shadow: var(--shadow-lg); }
.card.hot { border-color: var(--gold); box-shadow: 0 0 0 4px rgb(242 161 0 / .22), var(--shadow-lg); }
.card.in { animation: pop .14s ease-out; }
@keyframes pop { from { transform: translateY(10px) scale(.985); opacity: 0; } }

.top { display: flex; align-items: center; gap: 4px; margin: -2px -4px 6px 0; }
.cap { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.cap b { color: var(--ink-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cap span { flex: none; }
.ago { font-style: normal; }
.nav { display: flex; align-items: center; gap: 1px; flex: none; font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav .newer { color: var(--blue); background: var(--blue-50); animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(-2px); } }

.head { display: flex; align-items: flex-start; gap: 12px; }
.route { flex: 1; min-width: 0; font-size: 18px; font-weight: 700; line-height: 1.35; color: var(--ink); white-space: pre-line; word-break: break-word; letter-spacing: -.01em;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.price { flex: none; font-size: 25px; font-weight: 800; color: var(--warn); line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 7px; font-size: 12.5px; font-weight: 600;
  background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip svg { width: 13px; height: 13px; }
.chip.hot { background: var(--gold); color: #fff; border-color: var(--gold); }
.chip.hot svg { fill: currentColor; stroke: none; }
.chip.from { background: var(--ok-50); color: var(--ok); border-color: var(--ok-100); }
.chip.to { background: var(--blue-50); color: var(--blue-ink); border-color: var(--blue-100); }
.chip.to svg { transform: rotate(45deg); }
.chip.now { background: var(--bad-50); color: var(--bad); border-color: var(--bad-100); }
.chip.price { background: var(--warn-50); color: var(--warn); border-color: #ffd59a; }
.chip.route { order: -1; flex: 1 1 100%; height: auto; min-height: 24px; padding: 3px 8px; white-space: normal; font-weight: 600; }
.chip.also { background: transparent; border-style: dashed; color: var(--muted); }
.chip.tpl { background: var(--gold-50); color: var(--gold-ink); border-color: #ffdf8a; }
.chip.key { background: var(--blue-50); color: var(--blue-ink); border-color: var(--blue-100); }
.chip.key.auto { background: var(--gold); color: #fff; border-color: var(--gold); }
.chip.key.auto svg { fill: currentColor; stroke: none; }

.bar { height: 4px; margin: 12px 0 14px; border-radius: 2px; background: var(--line-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 2px; background: var(--blue); transition: width 1s linear, background .4s; }
.bar.mid i { background: var(--warn); }
.bar.low i { background: var(--muted); }
.acts { display: flex; gap: 8px; }
.acts .btn.primary { flex: 1; }

.note { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 12px; padding: 9px 11px; border-radius: 10px; font-size: 13px; line-height: 1.45; }
.note svg { margin-top: 1px; width: 15px; height: 15px; }
.note.bad { background: var(--bad-50); color: var(--bad); }
.note.warn { background: var(--warn-50); color: var(--warn); margin: 10px 0 0; font-weight: 600; }
.note.ok { background: var(--ok-50); color: var(--ok); }

.card.s-failed { border-color: var(--bad); }
.card.s-preparing { border-color: var(--blue); }
.prog { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 9px 10px 9px 12px; border-radius: 11px; background: var(--blue-50); color: var(--blue); font-weight: 600; font-size: 14px; }
.prog span { flex: 1; }

.fi { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--ok-50); color: var(--ok); font-style: normal; }
.fi svg { width: 19px; height: 19px; stroke-width: 2.6; }
.ft { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ft b { font-size: 15px; color: var(--ink); }
.ft span { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card.flash { display: flex; align-items: center; gap: 10px; padding: 14px 16px; }
.card.flash.ok { border-color: var(--ok); }
.card.flash.mute { border-color: var(--line); }
.card.flash.mute .fi { background: var(--bg); color: var(--muted); }
.card.flash .ft b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.flash .ft b em { font-style: normal; color: var(--blue); }
.card.flash.ok .ft b em { color: var(--ok); }

/* ================= Thẻ chờ & Thẻ đăng nhập QR trên sân khấu ================= */
.idle-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 18px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.idle-head { display: flex; align-items: center; gap: 12px; }
.idle-icon {
  width: 44px; height: 44px; border-radius: 13px; flex: none;
  display: grid; place-items: center;
  background: var(--blue-50); color: var(--blue);
}
.idle-icon.ok { background: var(--ok-50); color: var(--ok); }
.idle-icon.warn { background: var(--warn-50); color: var(--warn); }
.idle-icon svg { width: 22px; height: 22px; }
.idle-head h3 { margin: 0; font-size: 15.5px; color: var(--ink); }
.idle-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }

.idle-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.idle-stat {
  padding: 10px 12px; border-radius: 11px; background: var(--bg); border: 1px solid var(--line-2);
  display: flex; flex-direction: column; gap: 2px;
}
.idle-stat span { font-size: 11.5px; color: var(--muted); }
.idle-stat b { font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; }
.idle-stat b.gold { color: var(--gold-ink); }
.idle-stat b.ok { color: var(--ok); }

.idle-keys {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding-top: 10px; border-top: 1px solid var(--line-2);
  font-size: 12.5px; color: var(--muted);
}
.idle-keys span { display: inline-flex; align-items: center; gap: 5px; }
.idle-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.qr-box {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 18px 16px; border-radius: 14px; background: var(--bg); border: 1px dashed var(--blue-100);
  text-align: center;
}
.qr-img-wrap {
  width: 212px; height: 212px; padding: 10px; border-radius: 14px;
  background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow);
  display: grid; place-items: center;
}
.qr-img-wrap img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 6px; }
.qr-scanned { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.qr-scanned img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 3px solid var(--ok); }
.qr-caption { font-size: 13px; color: var(--ink-2); }
.qr-caption small { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }

.banner {
  padding: 10px 12px; border-radius: 12px; background: var(--warn-50); border: 1px solid #ffd59a;
  font-size: 13px; color: var(--ink-2); display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.banner.bad { background: var(--bad-50); border-color: var(--bad-100); color: var(--bad); }

/* ================= Toast ================= */
.toast { position: fixed; z-index: 9999; top: 14px; left: 50%; transform: translate(-50%, -8px);
  max-width: min(460px, calc(100vw - 32px)); padding: 8px 16px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: #142238; color: #fff; box-shadow: var(--shadow-lg); pointer-events: none; opacity: 0; visibility: hidden;
  transition: opacity .18s, transform .18s, visibility 0s linear .18s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: opacity .18s, transform .18s; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.warn { background: var(--warn); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }

/* ================= Lịch sử cuốc ================= */
.sum { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.sum div { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; }
.sum div + div { border-left: 1px solid var(--line-2); }
.sum b { font-size: 18px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.sum b.ok { color: var(--ok); }
.sum span { font-size: 11.5px; color: var(--muted); }

.sec { display: flex; align-items: center; justify-content: space-between; padding: 14px 2px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.sec b { min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); display: inline-grid; place-items: center; font-size: 11px; color: var(--ink-2); }
.sec.click { cursor: pointer; user-select: none; }
.sec.click:hover span { color: var(--ink); }

.rows { display: flex; flex-direction: column; gap: 6px; }
.rw { display: flex; align-items: center; gap: 8px; padding: 9px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; transition: border-color .12s, background .12s; }
.rw.clickable:hover { border-color: var(--blue-100); background: var(--blue-50); }
.rw.hot { border-color: #ffd36b; }
.rw.s-pending, .rw.s-failed { border-left: 3px solid var(--blue); }
.rw.s-preparing, .rw.s-sent { border-left: 3px solid var(--ok); }
.rw.s-sent.clickable:hover { border-color: var(--ok-100); background: var(--ok-50); }
.rm { flex: 1; min-width: 0; }
.rw .rm[data-act] { cursor: pointer; }
.rr { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.rr span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr b { flex: none; color: var(--warn); font-variant-numeric: tabular-nums; }
.rw:not(.s-pending):not(.s-failed):not(.s-preparing):not(.s-sent) .rr { color: var(--ink-2); font-weight: 500; }
.rw:not(.s-pending):not(.s-failed):not(.s-preparing):not(.s-sent) .rr b { color: var(--muted); }
.rc { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc b { color: var(--ink-2); font-weight: 600; }
.rt { font-size: 12.5px; color: var(--ink-2); white-space: pre-line; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rw-acts { display: flex; align-items: center; gap: 5px; flex: none; }

.badge { flex: none; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge.info { background: var(--blue-50); color: var(--blue-ink); }
.badge.ok { background: var(--ok-50); color: var(--ok); }
.badge.bad { background: var(--bad-50); color: var(--bad); }
.badge.mute { background: var(--bg); color: var(--muted); }

.empty { padding: 18px 12px; text-align: center; font-size: 13px; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: 12px; }
.empty b { color: var(--ink-2); }
.whybox { margin-bottom: 8px; padding: 8px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.whyt { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.why { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; font-size: 12.5px; color: var(--ink-2); border-top: 1px dashed var(--line); }
.why b { font-variant-numeric: tabular-nums; }

/* ================= Biểu mẫu, Bộ lọc, Key, Cài đặt (y hệt panel.css) ================= */
.form { display: flex; flex-direction: column; gap: 10px; }
.box { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.box.tester { border-color: var(--blue-100); }
h4 { margin: 0 0 8px; font-size: 13.5px; display: flex; align-items: center; gap: 6px; color: var(--ink); }
h4 small { margin-left: auto; font-weight: 500; color: var(--muted); font-size: 11.5px; }
h4 svg { width: 14px; height: 14px; color: var(--blue); }
.hint { margin: -2px 0 8px; font-size: 12px; color: var(--muted); }

textarea, input:not([type=checkbox]) {
  width: 100%; font: 13px/1.5 "Segoe UI", system-ui, sans-serif; color: var(--ink); padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--card); outline: none; resize: vertical;
  transition: border-color .12s, box-shadow .12s;
}
textarea:focus, input:not([type=checkbox]):focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgb(0 104 255 / .14); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }

.frow { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 8px; padding: 8px 0; }
.frow + .frow { border-top: 1px solid var(--line-2); }
.frow.wide { grid-template-columns: auto 1fr; }
.fl { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }

.tgs { display: flex; flex-wrap: wrap; gap: 6px; }
.tg { position: relative; cursor: pointer; }
.tg input { position: absolute; top: 0; left: 0; width: 0; height: 0; margin: 0; opacity: 0; pointer-events: none; }
.tg > span { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px 0 7px; border-radius: 15px; border: 1px solid var(--line); background: var(--card);
  font-size: 12.5px; font-weight: 600; color: var(--muted); transition: background .12s, border-color .12s, color .12s; user-select: none; }
.tg > span::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line); box-sizing: border-box; display: grid; place-items: center;
  font-size: 10px; font-weight: 900; line-height: 1; flex: none; }
.tg:hover > span { border-color: var(--blue-100); }
.tg input:checked + span { background: var(--blue-50); border-color: var(--blue); color: var(--blue-ink); }
.tg input:checked + span::before { content: "✓"; border: 0; background: var(--blue); color: #fff; }
.tg input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.tg.block > span { width: 100%; height: auto; min-height: 30px; padding: 4px 10px 4px 7px; border-radius: 9px; }
.tg.block > .gline { display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; }
.tg.block .gname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.tg .ldot { width: 7px; height: 7px; }

.suffix { display: flex; max-width: 170px; }
.suffix.wide { max-width: none; }
.suffix input { border-radius: 9px 0 0 9px; }
.suffix em { display: grid; place-items: center; padding: 0 10px; font-style: normal; font-size: 12px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-left: 0; border-radius: 0 9px 9px 0; white-space: nowrap; }

.fld { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-top: 8px; }
.fld small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.fld .cnt, .cnt { font-weight: 500; color: var(--muted); font-size: 11.5px; }
.fld:has(> .cnt) { position: relative; }
.fld > .cnt { position: absolute; right: 2px; top: 0; }

.sw { position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; cursor: pointer; font-size: 13.5px; color: var(--ink); }
.sw + .sw { border-top: 1px solid var(--line-2); }
.sw input { position: absolute; top: 0; left: 0; width: 0; height: 0; margin: 0; opacity: 0; pointer-events: none; }
.sw > i { position: relative; flex: none; width: 34px; height: 20px; margin-top: 1px; border-radius: 10px; background: #c9d1dc; transition: background .15s; }
.sw > i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .2); transition: transform .15s; }
.sw input:checked + i { background: var(--blue); }
.sw input:checked + i::after { transform: translateX(14px); }
.sw input:focus-visible + i { outline: 2px solid var(--blue); outline-offset: 2px; }
.sw > span { display: flex; flex-direction: column; min-width: 0; }
.sw small { font-size: 11.5px; color: var(--muted); }

details.adv summary { list-style: none; cursor: pointer; }
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary h4 { margin: 0; }
details.adv summary h4::before { content: "▸"; color: var(--muted); font-size: 11px; margin-right: 2px; transition: transform .15s; }
details.adv[open] summary h4::before { transform: rotate(90deg); }
details.adv[open] summary { margin-bottom: 6px; }
details.sub-adv { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); }
details.sub-adv summary { list-style: none; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
details.sub-adv summary::-webkit-details-marker { display: none; }
details.sub-adv summary::before { content: "▸"; color: var(--muted); font-size: 11px; transition: transform .15s; }
details.sub-adv[open] summary::before { transform: rotate(90deg); }
details.sub-adv[open] summary { margin-bottom: 8px; color: var(--blue); }

.groups { position: relative; display: flex; flex-direction: column; max-height: 260px; overflow: auto; margin-top: 6px; }
.groups .sw > .gline { display: flex; flex-direction: row; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.groups .sw .gname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; display: block; }
.lchips { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 6px; }
.lchip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: background .12s, border-color .12s, color .12s; white-space: nowrap; max-width: 100%; }
.lchip:hover { border-color: var(--blue-100); background: var(--blue-50); }
.lchip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.lchip.on em { color: rgb(255 255 255 / .85); }
.lchip em { font-style: normal; font-size: 11px; font-weight: 500; color: var(--muted); }
.ldot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--blue); }
.lchip.on .ldot { box-shadow: 0 0 0 1.5px rgb(255 255 255 / .75); }
.ltags { display: inline-flex; align-items: center; gap: 3px; flex: none; margin-left: auto; }
.ltag { display: inline-flex; align-items: center; gap: 3px; height: 18px; padding: 0 6px; border-radius: 999px; font-size: 10.5px; font-weight: 600;
  background: var(--bg); border: 1px solid var(--line); color: var(--muted); max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ltag .ldot { width: 6px; height: 6px; }
.gtools { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.gtools .gsep { color: var(--line); }
.gtools .gact-right { margin-left: auto; }
.klsec { margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.klsec .klhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.klsec .tgs { gap: 5px; }
.klsec .tg > span { height: 27px; font-size: 12px; }
#g_search, #k_gsearch { margin-top: 6px; }

.warnline { margin-top: 8px; font-size: 12px; padding: 7px 9px; border-radius: 8px; background: var(--warn-50); color: var(--ink-2); }
code { padding: 0 4px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); font: 11.5px ui-monospace, Consolas, monospace; color: var(--ink-2); }
.testres { margin-top: 8px; padding: 9px 10px; border-radius: 9px; font-size: 13px; border: 1px solid transparent; color: var(--ink-2); }
.testres.ok { background: var(--ok-50); border-color: var(--ok-100); }
.testres.bad { background: var(--bad-50); border-color: var(--bad-100); }
.testres .ok { color: var(--ok); }
.testres .bad { color: var(--bad); }
.saved { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 4px 0 8px; }
.saved svg { width: 13px; height: 13px; color: var(--ok); }

/* Phím tắt */
.keyset { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.kchip { display: inline-flex; align-items: center; height: 28px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 8px; background: var(--card); overflow: hidden; }
.kchip .kbtn { min-width: 0; height: 100%; padding: 0 8px; border: 0; border-radius: 0; background: transparent; font-size: 12.5px; }
.kchip .kdel { display: inline-grid; place-items: center; width: 22px; height: 100%; border: 0; border-left: 1px solid var(--line-2); background: transparent; color: var(--muted); font: 700 13px/1 system-ui, sans-serif; cursor: pointer; }
.kchip .kdel:hover { background: var(--bad-50); color: var(--bad); }
.kbtn { min-width: 72px; height: 28px; padding: 0 10px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 8px; background: var(--card);
  font: inherit; font-size: 12.5px; font-weight: 700; color: var(--ink); cursor: pointer; }
.kbtn.empty { font-weight: 500; color: var(--muted); }
.kbtn.add { min-width: 28px; padding: 0 8px; border-style: dashed; border-bottom-width: 1px; color: var(--blue); border-color: var(--blue-100); background: var(--blue-50); font-weight: 700; }
.kbtn.add:hover { background: var(--blue-100); }
.kbtn.rec { border-color: var(--blue); color: var(--blue); background: var(--blue-50); animation: pop .3s ease-out; }

/* KEY */
.khead { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); }
.klist { display: flex; flex-direction: column; gap: 8px; }
.kcard { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); transition: border-color .12s; }
.kcard:hover { border-color: var(--blue-100); }
.kcard.off { opacity: .55; }
.kcard .sw.mini { padding: 0; }
.kmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 0; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.kname { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kname b { font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kbadge { flex: none; display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 7px; border-radius: 10px; font-style: normal; font-size: 11px; font-weight: 700; }
.kbadge svg { width: 12px; height: 12px; }
.kbadge.auto { background: var(--gold-50); color: var(--gold-ink); }
.kbadge.ask { background: var(--blue-50); color: var(--blue-ink); }
.kroute { font-size: 12.5px; font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcond { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kops { display: flex; gap: 2px; flex: none; }
.kempty { padding: 22px 18px; text-align: center; background: var(--card); border: 1px dashed var(--blue-100); border-radius: 14px; }
.kempty .kei { width: 44px; height: 44px; margin: 0 auto 8px; border-radius: 14px; display: grid; place-items: center; background: var(--blue-50); color: var(--blue); }
.kempty .kei svg { width: 22px; height: 22px; }
.kempty b { font-size: 15px; color: var(--ink); }
.kempty p { margin: 6px 0 14px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.kbtns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

.seg { display: flex; padding: 3px; gap: 3px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; transition: background .12s, color .12s; }
.seg button svg { width: 14px; height: 14px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--card); color: var(--blue-ink); box-shadow: 0 1px 3px rgb(8 28 54 / .12); }
.seg[data-seg="action"] button.on:first-child { color: var(--gold-ink); }
.segnote { display: block; margin-top: 4px; font-weight: 400; font-size: 12px; color: var(--muted); }

.kbar { display: flex; align-items: center; gap: 10px; }
.kbar b { margin-left: auto; font-size: 14px; color: var(--ink); }
.link.back { display: inline-flex; align-items: center; gap: 2px; }
.link.back svg { width: 15px; height: 15px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.setgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
select { width: 100%; height: 34px; font: 13px "Segoe UI", system-ui, sans-serif; color: var(--ink); padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); outline: none; }
select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgb(0 104 255 / .14); }
.tester select { margin-top: 6px; }
details.more { margin-top: 4px; }
details.more summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--blue); padding: 4px 0; }
.vars { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.var { height: 24px; padding: 0 8px; border-radius: 7px; border: 1px dashed var(--blue-100); background: var(--blue-50); color: var(--blue); font: 600 11.5px ui-monospace, Consolas, monospace; cursor: pointer; }
.var:hover { border-style: solid; }
.kprev { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.kprev:empty { display: none; }
.kprev q, .kwill q { quotes: "“" "”"; font-weight: 700; color: var(--ink); }
.kgroups { margin-top: 4px; }
.kgroups .groups { max-height: 190px; gap: 4px; }
.kread { margin-top: 6px; font-size: 12px; color: var(--muted); }
.kread b { color: var(--ink-2); }
.kwill { margin-top: 6px; font-size: 12.5px; }
.cks { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.ck { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 8px; }
.ck.ok { background: var(--ok-50); color: var(--ok); }
.ck.bad { background: var(--bad-50); color: var(--bad); }
.ck.mute { background: var(--bg); color: var(--muted); }
.kresl { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.kres { display: flex; gap: 8px; font-size: 12px; padding: 5px 8px; border-radius: 8px; background: var(--bg); }
.kres b { flex: none; }
.kres.ok b { color: var(--ok); }
.kres.bad b { color: var(--muted); }
.kres span { color: var(--muted); min-width: 0; }
.kfoot { position: sticky; bottom: -20px; z-index: 2; display: flex; align-items: center; gap: 8px; margin: 4px -14px -20px; padding: 10px 14px 14px; background: var(--bg); border-top: 1px solid var(--line); }
.kfoot > span { flex: 1; }
.kerr { font-size: 12px; font-weight: 600; color: var(--bad); }

/* Thẻ tài khoản Zalo & Web trong Cài đặt */
.acc-card {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 11px; background: var(--bg); border: 1px solid var(--line-2); margin-bottom: 10px;
}
.acc-card img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex: none; background: var(--blue-50); }
.acc-card .acc-ph { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-50); color: var(--blue); font-weight: 700; flex: none; font-size: 15px; }
.acc-card .acc-info { flex: 1; min-width: 0; }
.acc-card .acc-info b { display: block; font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-card .acc-info span { display: block; font-size: 12px; color: var(--muted); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.user-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.user-row {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border-radius: 9px; background: var(--bg); border: 1px solid var(--line-2);
}
.user-row .u-info { flex: 1; min-width: 0; }
.user-row .u-info b { display: block; font-size: 13px; color: var(--ink); }
.user-row .u-info span { font-size: 11.5px; color: var(--muted); }

/* Thống kê đường truyền siêu tốc */
.perf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.perf-cell { padding: 8px 10px; border-radius: 9px; background: var(--bg); border: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 2px; }
.perf-cell span { font-size: 11px; color: var(--muted); }
.perf-cell b { font-size: 13.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
.perf-cell b.ok { color: var(--ok); }
.perf-cell b.warn { color: var(--warn); }
.perf-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.perf-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 8px; border-radius: 8px; background: var(--bg); font-size: 12px; font-variant-numeric: tabular-nums; }
.perf-row span { color: var(--muted); }
.perf-row b { color: var(--ink-2); }

/* ================= Modal ================= */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 9000;
  background: rgb(8 28 54 / .5); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 16px;
}
.modal {
  width: 100%; max-width: 440px; max-height: 92vh; overflow: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 16px 18px 18px;
  display: flex; flex-direction: column; gap: 12px;
  animation: pop .15s ease-out;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.modal-head b { font-size: 15.5px; color: var(--ink); }

/* ================= Responsive ================= */
@media (max-width: 920px) {
  .ui { height: auto; min-height: 100vh; overflow: visible; }
  .workspace, .workspace.wide-editor {
    grid-template-columns: 1fr;
    max-width: 680px;
  }
  .stage-col { padding: 12px 12px 8px; overflow: visible; }
  .panel-col { border-left: 0; border-right: 0; border-top: 1px solid var(--line); }
  .panel-nav { position: sticky; top: 0; z-index: 15; }
  .body { overflow: visible; }
  .kfoot { position: sticky; bottom: 0; margin: 4px -14px 0; }
}
@media (max-width: 600px) {
  .topbar { padding: 0 12px; }
  .grid2, .setgrid, .idle-stats { grid-template-columns: 1fr; }
  .pill-btn .acc-label { max-width: 92px; }
}
