/* ============================================================
   SK5 Workbench · Design System v2 (ui-ux-pro-max)
   功能 id/类名 100% 兼容 v1，app.js 无需改动
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Brand */
  --brand-50:  #eef4ff;
  --brand-100: #dbe7ff;
  --brand-200: #b8ceff;
  --brand-300: #8aaeff;
  --brand-400: #5d8df5;
  --brand-500: #3b6bf0;
  --brand-600: #2952db;
  --brand-700: #1f3eb3;
  --brand-800: #1a338a;
  --brand-900: #162a6e;

  /* Accent (violet) */
  --violet-50:  #f3efff;
  --violet-100: #e5dcff;
  --violet-200: #cab9ff;
  --violet-400: #9772ff;
  --violet-600: #7340f0;

  /* Neutrals (slate) */
  --slate-0:   #ffffff;
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-150: #e9eef5;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #0b1220;

  /* Semantic */
  --ok-bg:    #ecfdf5;
  --ok-bd:    #bbf7d0;
  --ok-fg:    #047857;
  --warn-bg:  #fff7ed;
  --warn-bd:  #fed7aa;
  --warn-fg:  #b45309;
  --bad-bg:   #fef2f2;
  --bad-bd:   #fecaca;
  --bad-fg:   #b91c1c;

  /* Backdrop surface */
  --bg:           #f6f8fc;
  --bg-grid:      radial-gradient(circle at 0 0, rgba(31,104,255,.05) 0, transparent 40%),
                  radial-gradient(circle at 100% 0, rgba(115,64,240,.04) 0, transparent 35%);
  --card:         #ffffff;
  --line:         #e6ebf3;
  --line-soft:    #eef2f7;
  --text:         #0f172a;
  --sub:          #475569;
  --muted:        #94a3b8;

  /* Shadows */
  --shadow-xs:    0 1px 2px rgba(15,23,42,.04);
  --shadow-sm:    0 2px 6px rgba(15,23,42,.06);
  --shadow-md:    0 8px 22px rgba(15,23,42,.06);
  --shadow-lg:    0 16px 38px rgba(15,23,42,.08);
  --shadow-brand: 0 8px 22px rgba(41,82,219,.18);

  /* Radius */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;

  /* Fonts */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;

  /* Motion */
  --ease: cubic-bezier(.2,.7,.2,1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  background-image: var(--bg-grid);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--brand-200); color: var(--slate-900); }
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }
hr { border: 0; border-top: 1px solid var(--line-soft); margin: var(--s-5) 0; }
code { font-family: var(--font-mono); font-size: .92em; }

/* ---------- Layout shell ---------- */
.wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: var(--s-6) var(--s-6) var(--s-10);
}
.sub-wrap { max-width: 1480px; }

/* ---------- App header (logo + nav) ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-6);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.app-brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-width: 0;
}
.app-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-500), var(--violet-600));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: -.5px;
  box-shadow: var(--shadow-brand);
}
.app-brand-text { display: grid; line-height: 1.15; }
.app-brand-text b { font-size: 15px; font-weight: 900; letter-spacing: -.01em; color: var(--slate-900); }
.app-brand-text small { font-size: 11px; color: var(--muted); font-weight: 600; }

.app-nav {
  display: flex;
  gap: 2px;
  padding: 4px;
  background: var(--slate-100);
  border-radius: var(--r-md);
}
.app-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--slate-600);
  transition: background .14s var(--ease), color .14s var(--ease);
}
.app-nav a:hover { color: var(--slate-900); background: rgba(255,255,255,.6); }
.app-nav a.active {
  background: var(--card);
  color: var(--brand-700);
  box-shadow: var(--shadow-xs);
}
.app-nav .nav-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-meta {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.app-meta .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--ok-bg);
  border: 1px solid var(--ok-bd);
  color: var(--ok-fg);
  font-size: 11px;
  font-weight: 800;
}
.app-meta .badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok-fg);
  box-shadow: 0 0 0 4px rgba(4,120,87,.12);
}

/* ---------- Hero (page title block) ---------- */
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-5);
  margin-bottom: var(--s-5);
  flex-wrap: wrap;
}
.hero h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -.02em;
  color: var(--slate-900);
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero h1 .crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}
.hero p {
  margin: 6px 0 0;
  max-width: 640px;
  color: var(--sub);
  font-size: 13.5px;
  line-height: 1.6;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); }
.card .head {
  min-height: 56px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  font-size: 15px;
  font-weight: 800;
  color: var(--slate-900);
  background: linear-gradient(180deg, #fbfdff, var(--card));
}
.card .head > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.card .body { padding: 20px; }

/* ---------- Tags / chips ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 10px;
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  color: var(--brand-700);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
}
.tag.muted { background: var(--slate-100); border-color: var(--slate-200); color: var(--slate-600); }
.tag.ok { background: var(--ok-bg); border-color: var(--ok-bd); color: var(--ok-fg); }
.tag.warn { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-fg); }
.tag.bad { background: var(--bad-bg); border-color: var(--bad-bd); color: var(--bad-fg); }

/* ---------- Stats grid ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.stat {
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
}
.stat .k {
  color: var(--sub);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat .v {
  margin-top: 6px;
  color: var(--text);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stat .s { margin-top: 2px; color: var(--muted); font-size: 11px; }

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: var(--s-5);
  align-items: start;
}

/* ---------- Forms ---------- */
.field { margin-bottom: var(--s-4); }
.field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--slate-700);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .01em;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-sm);
  background: var(--slate-0);
  color: var(--text);
  outline: none;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.5;
  box-shadow: var(--shadow-xs);
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease), background .14s var(--ease);
}
.field input:hover,
.field textarea:hover,
.field select:hover { border-color: var(--slate-300); }
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px var(--brand-100);
  background: var(--slate-0);
}
.field input.invalid,
.field textarea.invalid,
.field select.invalid {
  border-color: #f87171;
  box-shadow: 0 0 0 4px #fee2e2;
}
.field textarea {
  min-height: 100px;
  resize: vertical;
}
.field textarea#inputRaw {
  min-height: 132px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--slate-50);
}
.field-error {
  display: none;
  margin-top: 6px;
  color: var(--bad-fg);
  font-size: 12px;
  font-weight: 600;
}
.tiny {
  color: var(--sub);
  font-size: 11.5px;
  line-height: 1.55;
}
.tiny code {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--brand-100);
  background: var(--brand-50);
  color: var(--brand-700);
  font-family: var(--font-mono);
  font-size: 11px;
}

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1.2fr .72fr .86fr; gap: 10px; align-items: start; }

/* ---------- Relay picker (preserved v1 behavior) ---------- */
.relay-field { min-width: 0; }
.relay-picker {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
}
.relay-picker select,
.relay-picker input { height: 40px; }
.relay-picker select {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 700;
  border-color: var(--brand-100);
}
.relay-combobox { position: relative; }
.relay-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  display: none;
  max-height: 220px;
  overflow: auto;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  z-index: 30;
}
.relay-menu.show { display: grid; gap: 4px; }
.relay-option {
  width: 100%;
  min-height: 32px;
  display: block;
  background: transparent;
  border: 0;
  color: var(--slate-700);
  border-radius: 9px;
  padding: 7px 9px;
  text-align: left;
  font-size: 12px;
  cursor: pointer;
}
.relay-option b { display: block; font-weight: 800; }
.relay-option small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.relay-option:hover { background: var(--brand-50); color: var(--brand-700); }
.relay-empty {
  padding: 9px;
  color: var(--muted);
  font-size: 12px;
}

.relay-summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-sm);
  background: var(--slate-50);
  color: var(--slate-500);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}
.relay-summary.ok { color: var(--brand-700); background: var(--brand-50); border-color: var(--brand-200); }
.relay-summary.warn { color: var(--warn-fg); background: var(--warn-bg); border-color: var(--warn-bd); }

.relay-multi-field { margin-top: -2px; }
.relay-chip-grid { display: grid; gap: 8px; }
.relay-line {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 92px;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card);
  cursor: pointer;
  transition: border-color .12s var(--ease), background .12s var(--ease), box-shadow .12s var(--ease);
}
.relay-line:hover { border-color: var(--brand-200); background: var(--brand-50); }
.relay-line.active {
  background: var(--brand-50);
  border-color: var(--brand-300);
  box-shadow: inset 0 0 0 1px var(--brand-200);
}
.relay-check {
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--slate-300);
  color: transparent;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  transition: all .14s var(--ease);
}
.relay-line.active .relay-check {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
}
.relay-info { min-width: 0; }
.relay-info b {
  display: block;
  color: var(--slate-800);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.relay-line.active .relay-info b { color: var(--brand-700); }
.relay-info small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.relay-port-input {
  height: 34px !important;
  padding: 7px 9px !important;
  border-radius: 9px !important;
  text-align: center;
  font-size: 12px !important;
  background: var(--slate-0) !important;
}
.relay-line:not(.active) .relay-port-input { opacity: .45; }
.relay-line:not(.active) .relay-port-input:focus { opacity: 1; }

/* 端口重复提示：标红 + 抖动 */
.relay-port-input.port-dup {
  border-color: #f87171 !important;
  background: #fef2f2 !important;
  color: #b91c1c !important;
  animation: port-dup-shake .35s var(--ease);
}
.relay-port-input.port-dup::placeholder { color: #fca5a5; }
@keyframes port-dup-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

/* ---------- Buttons (v1 classes preserved) ---------- */
button,
.btn-primary,
.btn-soft,
.btn-ghost,
.btn-danger,
.btn-package {
  min-height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .01em;
  transition: background .14s var(--ease), border-color .14s var(--ease), color .14s var(--ease), transform .04s var(--ease), box-shadow .14s var(--ease);
}
button:active, .btn-primary:active, .btn-soft:active, .btn-ghost:active, .btn-danger:active, .btn-package:active { transform: translateY(1px); }

.btn-primary {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #fff;
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover { background: var(--brand-700); border-color: var(--brand-700); }

.btn-package {
  background: var(--brand-50);
  border-color: var(--brand-100);
  color: var(--brand-700);
}
.btn-package:hover { background: var(--brand-100); border-color: var(--brand-200); }

.btn-soft {
  background: var(--card);
  border-color: var(--slate-200);
  color: var(--slate-700);
}
.btn-soft:hover { background: var(--slate-50); border-color: var(--slate-300); color: var(--slate-900); }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--sub);
}
.btn-ghost:hover { background: var(--slate-50); color: var(--text); }

.btn-danger {
  background: var(--bad-bg);
  border-color: var(--bad-bd);
  color: var(--bad-fg);
}
.btn-danger:hover { background: #fde2e2; border-color: #fca5a5; }

.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* ---------- Status ---------- */
.status {
  margin-top: var(--s-3);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--slate-50);
  border: 1px solid var(--line);
  color: var(--slate-700);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--slate-300);
  flex-shrink: 0;
}
.status.ok { color: var(--ok-fg); background: var(--ok-bg); border-color: var(--ok-bd); }
.status.ok::before { background: var(--ok-fg); }
.status.warn { color: var(--warn-fg); background: var(--warn-bg); border-color: var(--warn-bd); }
.status.warn::before { background: var(--warn-fg); }
.status.bad { color: var(--bad-fg); background: var(--bad-bg); border-color: var(--bad-bd); }
.status.bad::before { background: var(--bad-fg); }

/* ---------- Result / output ---------- */
.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: var(--s-5);
  align-items: start;
}
.output {
  width: 100%;
  min-height: 76px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--slate-800);
  background: var(--slate-50);
}
.result-grid .field { margin-bottom: 12px; }
.result-grid .field:nth-child(1),
.result-grid .field:nth-child(2),
.result-grid .field:nth-child(3) { grid-column: 1; }
.result-grid .field:nth-child(2) textarea { min-height: 118px; }
.result-actions {
  grid-column: 1;
  display: grid;
  grid-template-columns: 1.15fr 1.05fr repeat(3, minmax(0, .7fr));
  gap: 8px;
  margin-top: 4px;
}
.result-actions button { height: 40px; font-size: 12.5px; }
.result-actions .btn-package { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }

.package-hint {
  grid-column: 1;
  margin-top: var(--s-3);
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--brand-50), #fbfdff);
  border: 1px solid var(--brand-100);
  color: var(--slate-700);
  font-size: 12px;
  line-height: 1.6;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.package-hint::before {
  content: 'i';
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand-500);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  font-style: italic;
  margin-top: 1px;
}
.package-hint a { color: var(--brand-700); font-weight: 700; word-break: break-all; }

/* ---------- QR Panel ---------- */
.qr-panel { padding: 0 0 4px; }
.qr-title {
  margin: 2px 0 12px;
  text-align: center;
  color: var(--slate-700);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .02em;
}
.qrBox {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 226px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(31,104,255,.04), rgba(115,64,240,.04)),
    var(--card);
  border: 1px dashed var(--brand-200);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .14s var(--ease), background .14s var(--ease);
}
.qrBox:hover { border-color: var(--brand-400); background: var(--brand-50); }
.qrBox canvas, .qrBox img {
  display: block;
  max-width: 190px !important;
  max-height: 190px !important;
  width: auto !important;
  height: auto !important;
  border-radius: 8px;
}
.qrBox + .tiny { margin-top: 8px; color: var(--muted); text-align: center; }

/* ---------- Tables ---------- */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
}
table {
  width: 100%;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
}
th, td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
  font-size: 12.5px;
}
th {
  background: var(--slate-50);
  color: var(--slate-600);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 1;
}
td { color: var(--slate-700); }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: var(--brand-50); }

.ledger-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--slate-50);
  margin-bottom: var(--s-3);
}
.search { min-width: 220px; flex: 1; }

.empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.record-list { display: grid; gap: 10px; }
.record-item {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  box-shadow: var(--shadow-xs);
}
.record-item .top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.record-item .title { font-weight: 800; }
.record-item .meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: pre-wrap;
}
.record-item .ops {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.backup-box { display: grid; gap: 12px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.footer {
  margin-top: var(--s-6);
  padding: var(--s-4) 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  border-top: 1px solid var(--line-soft);
}
.footer a { color: var(--slate-500); }

/* ---------- Loading ---------- */
.global-loading {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15,23,42,.36);
  backdrop-filter: blur(8px);
  z-index: 9999;
}
.global-loading-card {
  min-width: 200px;
  padding: 22px 26px;
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.global-loading-text { font-size: 13px; font-weight: 700; color: var(--slate-700); text-align: center; }
.spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid var(--brand-100);
  border-top-color: var(--brand-500);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   v1 compatibility block — keep ALL old selectors working.
   These mirror the v1 utility classes so app.js + old markup
   keep rendering exactly as before, even if not yet ported.
   ============================================================ */

.btns--old-pill {
  display: flex;
  gap: 4px;
  padding: 5px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.btns--old-pill a {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--slate-600) !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none !important;
  white-space: nowrap;
}
.btns--old-pill a.active { color: var(--brand-700) !important; background: var(--brand-50) !important; }

/* Generate workbench layout (v1) */
.subscription-grid { grid-template-columns: 460px minmax(0, 1fr); }
.node-pool {
  max-height: 430px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fbfdff;
}
.node-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--slate-150);
  border-radius: var(--r-sm);
  background: var(--card);
  cursor: pointer;
}
.node-item:hover { border-color: var(--brand-200); background: var(--brand-50); }
.node-item input { margin-top: 3px; }
.node-item b { display: block; color: var(--slate-700); font-size: 13px; }
.node-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  word-break: break-all;
}

.quick-sub-box, .selected-sub-box {
  margin: 12px 0;
  padding: 10px;
  border: 1px solid var(--brand-100);
  border-radius: var(--r-md);
  background: var(--brand-50);
}
.quick-sub-list { display: grid; gap: 7px; max-height: 150px; overflow: auto; }
.quick-sub-item {
  display: grid;
  gap: 3px;
  justify-items: start;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card);
  color: var(--slate-700);
  text-align: left;
}
.quick-sub-item:hover, .quick-sub-item.active {
  border-color: var(--brand-300);
  background: var(--brand-50);
  color: var(--brand-700);
}
.quick-sub-item b {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.quick-sub-item small {
  color: var(--slate-500);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.selected-sub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--slate-700);
  font-size: 12px;
  font-weight: 800;
}
.selected-node-list { display: grid; gap: 8px; max-height: 260px; overflow: auto; }
.selected-node-item {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card);
}
.selected-node-item.virtual { border-style: dashed; background: #fffdf7; }
.selected-node-item.editable {
  grid-template-columns: 1fr auto;
  align-items: start;
}
.node-edit-grid {
  grid-column: 1;
  display: grid;
  grid-template-columns: 1fr 1fr 74px;
  gap: 7px;
}
.field.mini { margin-bottom: 0; }
.field.mini label { margin-bottom: 4px; font-size: 10px; }
.field.mini input { height: 32px !important; padding: 6px 8px !important; font-size: 12px !important; }
.node-edit-meta { grid-column: 1/-1; color: var(--muted); font-size: 11px; }
.sub-qr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 8px 0 10px;
}
.sub-qr-grid .qrBox { min-height: 170px; }
.sub-qr-grid .qrBox canvas, .sub-qr-grid .qrBox img {
  max-width: 138px !important;
  max-height: 138px !important;
}

/* Responsive */
@media (max-width: 1080px) {
  .wrap { max-width: 100%; }
  .grid { grid-template-columns: 1fr; }
  .subscription-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: minmax(0, 1fr) 220px; }
  .row3 { grid-template-columns: 1fr 1fr 1fr; }
  .app-nav { flex-wrap: wrap; }
  .app-header { flex-wrap: wrap; }
}
@media (max-width: 760px) {
  .wrap { padding: var(--s-4) var(--s-3) var(--s-8); }
  .hero h1 { font-size: 22px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row, .row3, .split { grid-template-columns: 1fr; }
  .relay-picker { grid-template-columns: 1fr; }
  .card .body { padding: 14px; }
  .result-grid { grid-template-columns: 1fr; }
  .result-grid .field, .result-actions, .package-hint, .qrBox, .qrBox + .tiny {
    grid-column: 1;
    grid-row: auto;
  }
  .qrBox { min-height: 230px; }
  .qrBox canvas, .qrBox img { max-width: 210px !important; max-height: 210px !important; }
  table { min-width: 760px; }
  .app-nav { width: 100%; justify-content: space-between; }
  .app-nav a { padding: 0 8px; font-size: 12px; }
}

/* ============================================================
   Generate-workbench specific (preserved from v1)
   ============================================================ */
.generate-workbench {
  grid-template-columns: 400px minmax(0, 1fr);
  gap: var(--s-5);
}
.create-node-card .body {
  display: grid;
  gap: var(--s-4);
  padding: 16px;
}
.create-section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fbfdff;
}
.section-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 10px;
  align-items: center;
  margin-bottom: 12px;
}
.section-title span {
  grid-row: 1 / 3;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-500), var(--violet-600));
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .02em;
  box-shadow: 0 4px 10px rgba(41,82,219,.18);
}
.section-title b {
  color: var(--slate-900);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
}
.section-title em {
  font-style: normal;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.relay-summary-inline.ok { color: var(--brand-700); }
.relay-summary-inline.warn { color: var(--warn-fg); }
.raw-section .field, .base-section .field { margin-bottom: 0; }
.raw-section textarea#inputRaw {
  min-height: 110px;
  border-color: var(--brand-100);
  background: var(--card);
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.create-form-grid {
  display: grid;
  grid-template-columns: 1fr .9fr;
  gap: 10px;
}
.create-form-grid .field:nth-child(3) { grid-column: 1 / -1; max-width: 200px; }
.create-form-grid .field input { height: 40px; }
.relay-section .field-error { margin: -4px 0 8px; }
.relay-section .relay-chip-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  max-height: 216px;
  overflow: auto;
  padding-right: 2px;
}
.create-node-card .relay-line {
  grid-template-columns: 24px minmax(0, 1fr) 84px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--card);
}
.create-node-card .relay-check { width: 22px; height: 22px; min-height: 22px; font-size: 13px; }
.create-node-card .relay-info b { font-size: 12.5px; }
.create-node-card .relay-info small { font-size: 10.5px; }
.create-node-card .relay-port-input { height: 32px !important; font-size: 11px !important; }
.create-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.create-actions button { height: 44px; border-radius: var(--r-md); font-size: 13px; }
.create-actions #btnGenerate { box-shadow: var(--shadow-brand); }
.create-actions #btnGenerateSub { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }
.create-actions #btnGenerateSub:hover { background: var(--brand-100); }
.action-hint { margin: 8px 2px 0; color: var(--sub); text-align: center; font-size: 11.5px; }

/* v1 cards: first card with .btns as actions grid */
.card:first-child .btns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.card:first-child .btns.primary-only { display: block; margin-top: 2px; }
.card:first-child #btnGenerate {
  width: 100%;
  grid-column: 1 / -1;
  height: 44px;
  font-size: 13px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-brand);
}
.card:first-child #btnExportPackage {
  background: var(--brand-50);
  border-color: var(--brand-200);
  color: var(--brand-700);
}

/* v1 selector for first card section-card buttons when in create-actions:
   override the .card:first-child .btns rules */
.create-actions.btns,
.create-actions { grid-template-columns: 1fr 1fr; }
.create-actions.btns #btnGenerate { grid-column: auto; height: 44px; }

/* ============================================================
   Subscription workbench v202607010246
   ============================================================ */
.sub-wrap { max-width: 1480px; }
.sub-hero { margin-bottom: var(--s-4); }
.sub-workbench {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: var(--s-4);
  align-items: start;
}
.sub-sidebar, .sub-main { display: grid; gap: var(--s-4); }
.sub-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}
.sub-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--slate-900);
  font-size: 14px;
  font-weight: 800;
}
.sub-search {
  width: 100%;
  height: 42px;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-sm);
  background: var(--slate-50);
  color: var(--text);
  padding: 0 14px;
  font-size: 13.5px;
  font-weight: 600;
  outline: none;
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
.sub-search:focus { border-color: var(--brand-400); box-shadow: 0 0 0 4px var(--brand-100); background: var(--card); }

.quick-sub-list { max-height: 360px; }
.quick-sub-item { min-height: 58px; border-radius: var(--r-sm); padding: 10px 12px; }
.quick-sub-item b { font-size: 13px; }
.quick-sub-item small { font-size: 11px; }
.quick-sub-item.ledger-result { border-style: dashed; }

.pool-panel .node-pool { max-height: 420px; }
.compact-tools { padding: 8px; margin-bottom: 10px; }
.compact-tools .search { min-width: 0; }
.customer-panel { position: sticky; top: 10px; z-index: 2; }
.sub-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sub-form-grid .wide { grid-column: 1 / -1; }
.primary-editor { margin-top: 2px; background: #fbfdff; }
.primary-editor .selected-node-list { max-height: 360px; }
.node-edit-grid { grid-template-columns: 1.05fr 1fr 86px; }
.selected-node-item.editable { border-radius: var(--r-sm); padding: 12px; }
.node-edit-meta { font-size: 11px; }
.sub-action-bar {
  display: grid;
  grid-template-columns: .7fr .8fr 1fr 1.25fr;
  gap: 8px;
  margin-top: 12px;
}
.sub-action-bar button { height: 40px; }
.sub-output-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 250px;
  gap: 12px;
  align-items: start;
}
.sub-output-grid textarea { min-height: 180px; }
.compact-qr { grid-template-columns: 1fr; gap: 10px; margin: 0; }
.compact-qr .qrBox { min-height: 128px; }
.compact-qr .qrBox canvas, .compact-qr .qrBox img {
  max-width: 105px !important;
  max-height: 105px !important;
}
.helper-panel summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--slate-700);
  list-style: none;
  padding: 4px 0;
}
.helper-panel summary::-webkit-details-marker { display: none; }
.helper-panel summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 6px;
  transition: transform .14s var(--ease);
}
.helper-panel[open] summary::before { transform: rotate(90deg); }

.customer-panel { position: relative !important; top: auto !important; z-index: auto !important; }
.primary-editor .selected-node-list { max-height: 280px; overflow: auto; }
.sub-main { align-items: start; }
.output-panel { position: relative; z-index: 1; }

.soft-divider { border: 0; border-top: 1px solid var(--line-soft); margin: 14px 0; }
.helper-panel .node-pool { max-height: 260px; }
.helper-panel .sub-panel-title { margin-top: 10px; }

.mini-btn { min-height: 28px; padding: 5px 10px; border-radius: 9px; }
.node-editor-tip { margin: -4px 0 8px; color: var(--sub); }

.clean-node-card {
  grid-template-columns: 1fr auto !important;
  background: var(--card) !important;
  border-style: solid !important;
}
.clean-node-card .node-edit-grid { grid-template-columns: 1.15fr 1fr 76px; }
.node-sk5-line {
  grid-column: 1;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 7px 9px;
  border-radius: 9px;
  background: var(--slate-50);
  border: 1px solid var(--slate-150);
  color: var(--slate-500);
  font-size: 11px;
}
.node-sk5-line span { font-weight: 800; color: var(--slate-600); }
.node-sk5-line code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--slate-700);
  font-family: var(--font-mono);
}
.clean-node-card .node-edit-meta { color: var(--muted); }
.primary-editor .selected-node-list { max-height: 330px; }

.quick-sub-item.customer-result {
  display: grid;
  gap: 7px;
  min-height: 0;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--card);
  text-align: left;
}
.customer-result .result-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.customer-result .result-main b {
  font-size: 13px;
  color: var(--slate-900);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-result .result-main span {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: 11px;
  font-weight: 800;
}
.customer-result .result-line {
  font-size: 11px;
  color: var(--slate-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.customer-result .result-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.customer-result .result-foot code {
  background: var(--slate-50);
  border: 1px solid var(--slate-150);
  border-radius: 7px;
  padding: 2px 6px;
  color: var(--slate-500);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-result .result-foot em {
  font-style: normal;
  color: var(--brand-700);
  font-size: 11px;
  font-weight: 800;
}
.customer-result.active {
  border-color: var(--brand-400);
  background: var(--brand-50);
  box-shadow: inset 3px 0 0 var(--brand-500);
}
.customer-result.active .result-main b { color: var(--brand-700); }

.sub-sidebar { min-width: 0; }
.search-panel, .quick-sub-list, .quick-sub-item { min-width: 0; }
.quick-sub-item.customer-result {
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
}
.customer-result .result-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}
.customer-result .result-main b,
.customer-result .result-line,
.customer-result .result-foot code {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.customer-result .result-line {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--slate-50);
  border: 1px solid var(--slate-150);
  border-radius: 8px;
  padding: 4px 6px;
}
.customer-result .result-foot {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}
.customer-result .result-main span {
  max-width: 74px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quick-sub-list { padding-right: 2px; }

/* ============================================================
   Bulk domain replace v202607010337
   ============================================================ */
.bulk-domain-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.bulk-domain-box input {
  height: 38px;
  border: 1px solid var(--brand-100);
  border-radius: var(--r-sm);
  padding: 0 10px;
  font-size: 12px;
  outline: none;
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
.bulk-domain-box input:focus {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px var(--brand-100);
}
.bulk-domain-box span { color: var(--sub); font-weight: 700; }
.bulk-domain-box button { height: 38px; }
.bulk-tip { margin-top: 8px; }
@media (max-width: 760px) {
  .bulk-domain-box { grid-template-columns: 1fr; }
  .bulk-domain-box span { display: none; }
}

/* ============================================================
   Ledger / records / backup polish
   ============================================================ */
.mini-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.mini-stats span {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--slate-50);
  color: var(--sub);
  font-size: 12px;
}
.mini-stats b {
  display: block;
  margin-top: 2px;
  color: var(--slate-900);
  font-size: 18px;
  font-weight: 800;
}
.backup-dashboard .backup-box { gap: 14px; }
.backup-actions-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 10px;
}
.backup-actions-grid button { height: 44px; }
.backup-note {
  padding: 12px 14px;
  border: 1px solid var(--brand-100);
  border-radius: var(--r-md);
  background: var(--brand-50);
  color: var(--slate-700);
  font-size: 12px;
  line-height: 1.65;
}
.hidden-backup-json {
  position: absolute;
  left: -9999px;
  width: 1px !important;
  height: 1px !important;
  opacity: 0;
}
.table-wrap td:nth-child(2) {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.record-list { max-height: 720px; overflow: auto; }
@media (max-width: 760px) {
  .mini-stats, .backup-actions-grid { grid-template-columns: 1fr; }
  .table-wrap td:nth-child(2) { max-width: 180px; }
}

/* ============================================================
   Ledger card layout
   ============================================================ */
.ledger-list { display: grid; gap: 10px; }
.ledger-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  box-shadow: var(--shadow-xs);
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease), transform .14s var(--ease);
}
.ledger-card:hover {
  border-color: var(--brand-200);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.ledger-main { min-width: 0; }
.ledger-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.ledger-title-block { min-width: 0; }
.ledger-title-block b {
  display: block;
  color: var(--slate-900);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ledger-title-block small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.ledger-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  color: var(--slate-600);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.ledger-status.ok { background: var(--ok-bg); border-color: var(--ok-bd); color: var(--ok-fg); }
.ledger-status.warn { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-fg); }
.ledger-status.bad { background: var(--bad-bg); border-color: var(--bad-bd); color: var(--bad-fg); }

.ledger-sk5 {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--slate-150);
  border-radius: var(--r-sm);
  background: var(--slate-50);
}
.ledger-sk5 span, .ledger-meta-grid span, .ledger-subline span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}
.ledger-sk5 code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--slate-700);
  font-family: var(--font-mono);
  font-size: 11px;
}
.ledger-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr .7fr;
  gap: 8px;
  margin-top: 8px;
}
.ledger-meta-grid div {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--slate-150);
  border-radius: var(--r-sm);
  background: #fbfdff;
}
.ledger-meta-grid b {
  display: block;
  margin-top: 3px;
  color: var(--slate-700);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   Record timeline
   ============================================================ */
.record-list { padding-right: 2px; }
.record-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 200px;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  box-shadow: var(--shadow-xs);
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease), transform .14s var(--ease);
}
.record-row:hover {
  border-color: var(--brand-200);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.record-badge {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-50), var(--violet-50));
  border: 1px solid var(--brand-100);
  color: var(--brand-700);
  font-size: 12px;
  font-weight: 800;
}
.record-content { min-width: 0; }
.record-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.record-title b { color: var(--slate-900); font-size: 13px; font-weight: 800; }
.record-title span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--slate-700);
  font-size: 13px;
  font-weight: 600;
}
.record-detail {
  margin-top: 6px;
  min-height: 22px;
  padding: 5px 8px;
  border: 1px solid var(--slate-150);
  border-radius: 9px;
  background: var(--slate-50);
  color: var(--sub);
  font-size: 11.5px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.record-side { display: grid; gap: 8px; justify-items: end; }
.record-side time { color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.record-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  width: 100%;
}
.record-actions button {
  width: 100%;
  min-height: 32px;
  padding: 6px 9px;
  border-radius: 9px;
}
.record-empty {
  border: 1px dashed var(--brand-100);
  border-radius: var(--r-md);
  background: #fbfdff;
}
@media (max-width: 860px) {
  .record-row { grid-template-columns: 40px minmax(0, 1fr); }
  .record-side {
    grid-column: 2;
    grid-template-columns: 1fr auto;
    align-items: center;
    justify-items: stretch;
  }
  .record-side time { order: 2; text-align: right; }
  .record-actions { max-width: 200px; }
}
@media (max-width: 560px) {
  .record-row { grid-template-columns: 1fr; gap: 10px; }
  .record-badge { width: auto; height: 32px; border-radius: 999px; padding: 0 12px; }
  .record-side { grid-column: auto; grid-template-columns: 1fr; }
}