/* ═══ Autopoint — warm paper, cobalt accent ═══ */

:root {
  --bg: #f6f4ee;
  --card: #fffefb;
  --border: #e5e0d3;
  --border-strong: #d4cebd;
  --ink: #191b1d;
  --ink-soft: #4c5257;
  --ink-dim: #8b9095;
  --accent: #2450e0;
  --accent-deep: #1a3cb0;
  --accent-soft: #eef1fd;
  --green: #0f8a52;
  --green-soft: #e7f5ee;
  --amber: #b7791f;
  --red: #d2453d;
  --red-soft: #fdeeed;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --body: "Instrument Sans", system-ui, sans-serif;
  --display: "Bricolage Grotesque", var(--body);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(25, 27, 29, 0.04), 0 8px 24px -12px rgba(25, 27, 29, 0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

html { color-scheme: light; }

body {
  font-family: var(--body);
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  background-image: radial-gradient(ellipse 70% 40% at 50% -5%, rgba(36, 80, 224, 0.06), transparent);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* production fundamentals */
::selection { background: rgba(36, 80, 224, 0.16); }
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.mono, .inst-ip, .inst-meta, .stat-value, td.rec-ttl, td.rec-name, td.rec-content,
th, .rec-type, .verdict, .inst-name-text ~ * { font-variant-numeric: tabular-nums; }
button { font: inherit; }

/* ── sign-in gate ── */
.gate {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(36,80,224,0.10), transparent),
    var(--bg);
}
.gate-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 38px 34px;
  width: 340px; max-width: calc(100vw - 40px);
  text-align: center;
}
.gate-card h1 { font-family: var(--display); font-size: 22px; font-weight: 700; }
.gate-sub { color: var(--ink-dim); font-size: 13.5px; margin-top: -6px; margin-bottom: 4px; }
.gate-card input { text-align: center; }
.gate-card .cta { width: 100%; margin-top: 4px; }
.gate-error { color: var(--red); font-size: 12.5px; font-weight: 600; min-height: 16px; }
.brand-badge.lg { width: 52px; height: 52px; border-radius: 15px; font-size: 26px; }

/* ── app layout ── */
.layout {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}
@media (max-width: 760px) { .layout { grid-template-columns: 64px 1fr; } }

.sidebar {
  display: flex; flex-direction: column;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 22px; }
.brand-word { font-family: var(--display); font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.brand-mark {
  display: grid; place-items: center;
  width: 30px; height: 30px; flex-shrink: 0;
  color: var(--card);
  background: var(--ink);
  border-radius: 9px;
}
.brand-mark.lg { width: 52px; height: 52px; border-radius: 14px; }
@media (max-width: 760px) { .brand-word { display: none; } }

.sb-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-dim);
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  font-family: var(--body); font-size: 14px; font-weight: 500;
  color: var(--ink-soft);
  background: none; border: none; border-radius: 9px;
  padding: 9px 10px; cursor: pointer;
  transition: background .12s, color .12s;
}
.nav-item svg { color: var(--ink-dim); flex-shrink: 0; transition: color .12s; }
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }
.nav-item.active svg { color: var(--accent); }
.nav-item .count {
  margin-left: auto; font-family: var(--mono); font-size: 11px;
  color: var(--ink-dim); background: var(--bg); border-radius: 20px; padding: 1px 7px;
}
.nav-item.active .count { color: var(--accent-deep); background: #fff; }

.sb-foot { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.sb-foot .statuses { flex-direction: column; gap: 6px; }
.logout {
  font-family: var(--body); font-size: 13px; font-weight: 600;
  color: var(--ink-soft); background: none; border: 1px solid var(--border-strong);
  border-radius: 9px; padding: 8px; cursor: pointer;
  transition: background .12s, color .12s;
}
.logout:hover { background: var(--red-soft); color: var(--red); border-color: #f0c4c1; }

@media (max-width: 760px) {
  .sb-brand .brand-text, .nav-label, .nav-item span:not(.count), .sb-foot .statuses { display: none; }
  .nav-item { justify-content: center; }
}

.main { padding: 26px 32px 48px; min-width: 0; }
.main-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.main-head h1 { font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.view-sub { color: var(--ink-soft); font-size: 14px; margin-top: 3px; }
.main-head-tools { display: flex; gap: 8px; }

.view { animation: fade .3s ease both; }
.view[hidden] { display: none; }

/* ── traffic stat row ── */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 15px 16px; box-shadow: var(--shadow);
}
.stat-label { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-dim); }
.stat-value { font-family: var(--display); font-size: 26px; font-weight: 700; margin-top: 5px; }
.stat.passed .stat-value { color: var(--green); }
.stat.blocked .stat-value { color: var(--red); }
.stat.decoyed .stat-value { color: var(--amber); }

.verdict {
  font-family: var(--body); font-size: 11.5px; font-weight: 600;
  border-radius: 20px; padding: 2px 9px; display: inline-block;
}
.verdict.passed { color: var(--green); background: var(--green-soft); }
.verdict.blocked { color: var(--red); background: var(--red-soft); }
.verdict.decoyed { color: var(--amber); background: #fdf6ea; }
.verdict.failing { color: var(--amber); background: #fdf6ea; }
.verdict.seen { color: var(--ink-dim); background: var(--bg); }

.warn-banner {
  background: #fdf6ea; border: 1px solid #ecd9b4; color: var(--amber);
  border-radius: 10px; padding: 11px 14px; margin-bottom: 16px; font-size: 13px;
}

/* ── legacy topbar (unused in SPA, kept for safety) ── */
.topbar {
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 28px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-badge {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--accent);
  color: #fff;
  font-family: var(--display);
  font-weight: 700; font-size: 19px;
  border-radius: 11px;
  box-shadow: 0 4px 12px -4px rgba(36, 80, 224, 0.5);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-family: var(--display); font-size: 17px; font-weight: 600; }
.brand-text span { font-size: 12px; color: var(--ink-dim); }

.statuses { display: flex; gap: 8px; }
.pill {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 500;
  color: var(--ink-dim);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 6px 13px;
}
.lamp { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-dim); }
.pill.ok { color: var(--green); border-color: #bfe3d1; background: var(--green-soft); }
.pill.ok .lamp { background: var(--green); }
.pill.err { color: var(--red); border-color: #f0c4c1; background: var(--red-soft); }
.pill.err .lamp { background: var(--red); }

/* ── layout ── */
.wrap { max-width: 1120px; margin: 0 auto; padding: 34px 28px 64px; }

.hero { margin-bottom: 28px; animation: fade .5s ease both; }
.hero h1 {
  font-family: var(--display);
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.hero p { color: var(--ink-soft); margin-top: 6px; max-width: 52ch; }

.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 880px) { .columns { grid-template-columns: 1fr; } }

/* ── cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  animation: fade .5s ease both;
}
.card:nth-child(2) { animation-delay: .07s; }
#panel-records { animation-delay: .14s; }

@keyframes fade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; gap: 12px;
}
.step-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.step-num {
  width: 24px; height: 24px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--display);
  font-size: 13px; font-weight: 700;
  border-radius: 8px;
}
.card-head h2 {
  font-family: var(--display);
  font-size: 16.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-head .sub { color: var(--ink-dim); font-weight: 500; font-size: 14px; }
.card-tools { display: flex; gap: 8px; align-items: center; }

/* ── controls ── */
select,
input[type="text"],
input[type="password"],
input[type="search"],
input[type="email"] {
  width: 100%;
  font-family: var(--body);
  font-size: 14.5px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 13px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
/* native select caret (appearance:none removes it) */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%238b9095' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
select:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(36, 80, 224, 0.13);
}
/* form fields carry their own focus treatment — no extra outline ring */
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
select { cursor: pointer; }
input.mono { font-family: var(--mono); font-size: 13.5px; }
input::placeholder { color: var(--ink-dim); font-family: var(--body); font-size: 14px; }

.select-sm { width: auto; font-size: 13px; padding: 6px 28px 6px 10px; border-radius: 8px; background-position: right 9px center; }

.icon-btn {
  flex-shrink: 0;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 15px;
  cursor: pointer;
  transition: color .15s, border-color .15s, transform .3s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn svg { display: block; }
.icon-btn.spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── instance list ── */
.list { display: flex; flex-direction: column; gap: 10px; }

.instance {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  font-family: var(--body);
  font-size: 14.5px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 15px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.instance:hover { border-color: var(--accent); box-shadow: 0 2px 10px -4px rgba(36, 80, 224, 0.25); }
.instance:active { transform: scale(.995); }
.instance.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.instance:disabled { opacity: .5; cursor: not-allowed; }
.instance:disabled:hover { border-color: var(--border); box-shadow: none; }

.inst-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.inst-name {
  font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.inst-lamp { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-dim); flex-shrink: 0; }
.instance[data-state="running"] .inst-lamp { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.instance[data-state="stopped"] .inst-lamp { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.instance[data-state="pending"] .inst-lamp,
.instance[data-state="stopping"] .inst-lamp { background: var(--amber); }

.inst-meta { font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); }
.inst-sites {
  font-family: var(--mono); font-size: 11.5px; font-weight: 500;
  color: var(--green);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.inst-sites:empty { display: none; }

.inst-ip {
  font-family: var(--mono); font-size: 13px; font-weight: 500;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 7px;
  padding: 4px 9px;
}
.inst-ip.none { color: var(--ink-dim); background: var(--bg); font-style: italic; }
.instance.selected .inst-ip { background: #fff; }

.inst-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.inst-actions { display: flex; gap: 6px; }
.inst-deploy, .inst-settings {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--body); font-size: 12px; font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 4px 10px;
  transition: background .15s, border-color .15s, color .15s;
}
.inst-deploy svg, .inst-settings svg { flex-shrink: 0; }
.inst-deploy:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.inst-settings { color: var(--ink-soft); }
.inst-settings:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.inst-deploy.disabled, .inst-settings.disabled {
  color: var(--ink-dim); border-color: var(--border); background: var(--bg);
  cursor: not-allowed; opacity: .7;
}
.inst-deploy.disabled:hover, .inst-settings.disabled:hover { background: var(--bg); color: var(--ink-dim); border-color: var(--border); }

.inst-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
  border-radius: 20px; padding: 1px 8px; margin-left: 2px;
}
.inst-badge:empty { display: none; }
.inst-badge.warn { color: var(--amber); background: #fdf6ea; }
.inst-badge.stopped { color: var(--ink-dim); background: var(--bg); }
.dot-spin {
  width: 7px; height: 7px; border-radius: 50%;
  border: 1.5px solid rgba(183,121,31,.35); border-top-color: var(--amber);
  animation: spin .7s linear infinite;
}

.mode-plus { display: inline-flex; margin-right: 5px; vertical-align: -2px; }

.empty {
  color: var(--ink-dim);
  text-align: center;
  padding: 26px 8px;
  font-size: 13.5px;
}

/* ── form ── */
#link-form { display: flex; flex-direction: column; gap: 15px; }

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 4px;
}
.mode-btn {
  font-family: var(--body);
  font-size: 13.5px; font-weight: 600;
  color: var(--ink-dim);
  background: none;
  border: none;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.mode-btn:hover { color: var(--ink-soft); }
.mode-btn.active {
  color: var(--accent-deep);
  background: #fff;
  box-shadow: 0 1px 3px rgba(25,27,29,.08);
}

.launch-note {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  background: #fdf6ea;
  border: 1px solid #ecd9b4;
  border-radius: 10px;
  padding: 11px 13px;
}
.launch-note .mono { font-family: var(--mono); font-size: 11.5px; }
.launch-note strong { color: var(--amber); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 12px; font-weight: 600;
  letter-spacing: .03em;
  color: var(--ink-soft);
}
.field-label em { color: var(--accent); font-style: normal; font-weight: 500; }

.join { display: flex; }
.join input {
  border-top-right-radius: 0; border-bottom-right-radius: 0;
  border-right: none;
  flex: 1; min-width: 0;
}
.join-suffix {
  display: flex; align-items: center;
  font-family: var(--mono); font-size: 13px;
  color: var(--ink-dim);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-top-right-radius: 10px; border-bottom-right-radius: 10px;
  padding: 0 13px;
  white-space: nowrap;
}

.preview {
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px;
  background: var(--green-soft);
  border: 1px solid #bfe3d1;
  border-radius: 10px;
  padding: 11px 14px;
  overflow-x: auto;
}
.preview .mono { font-family: var(--mono); }
.preview-arrow { color: var(--green); font-weight: 600; }
.preview-ip { color: var(--green); font-weight: 500; }

.chip {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  border-radius: 6px;
  padding: 2px 8px;
  flex-shrink: 0;
}
.chip-a { background: var(--green); color: #fff; }

/* ── CTA ── */
.cta {
  margin-top: 2px;
  font-family: var(--display);
  font-size: 15.5px; font-weight: 600;
  letter-spacing: .01em;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 11px;
  padding: 13px;
  cursor: pointer;
  box-shadow: 0 4px 14px -4px rgba(36, 80, 224, 0.5);
  transition: background .15s, transform .1s, box-shadow .15s;
}
.cta:hover { background: var(--accent-deep); box-shadow: 0 6px 18px -4px rgba(36, 80, 224, 0.55); }
.cta:active { transform: translateY(1px); }
.cta:disabled { opacity: .55; cursor: wait; }
.cta.confirm {
  background: var(--amber);
  box-shadow: 0 4px 14px -4px rgba(183, 121, 31, 0.5);
  font-size: 13.5px;
}

/* ── feed ── */
.feed {
  margin-top: 14px;
  display: flex; flex-direction: column-reverse; gap: 5px;
  max-height: 120px; overflow-y: auto;
  font-family: var(--mono);
  font-size: 12px;
}
.feed:empty { display: none; }
.feed-line { color: var(--ink-dim); }
.feed-line .t { color: var(--border-strong); margin-right: 8px; }
.feed-line.ok { color: var(--green); }
.feed-line.err { color: var(--red); }

/* ── records table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-dim);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-strong);
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--bg); }

.rec-type {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  color: var(--ink-soft);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
}
.rec-type.A { color: var(--accent-deep); background: var(--accent-soft); border-color: #c9d4f8; }
td.rec-name, td.rec-content { font-family: var(--mono); font-size: 13px; }
td.rec-content { color: var(--ink-soft); max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.rec-ttl { color: var(--ink-dim); font-family: var(--mono); font-size: 12.5px; }

.rec-del {
  font-family: var(--body); font-size: 12.5px;
  color: var(--ink-dim);
  background: none; border: 1px solid transparent;
  border-radius: 7px;
  padding: 3px 9px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.rec-del:hover { color: var(--red); background: var(--red-soft); }
.rec-del.confirm { color: #fff; background: var(--red); border-color: var(--red); }

/* ── deploy modal ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(25, 27, 29, 0.4);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: 20px; z-index: 50;
  animation: fade .2s ease;
}
.modal {
  width: 100%; max-width: 560px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 60px -20px rgba(25,27,29,.4);
  overflow: hidden;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 20px 22px 14px; gap: 12px;
}
.modal-head h3 { font-family: var(--display); font-size: 18px; font-weight: 600; }
.modal-sub { font-family: var(--mono); font-size: 12.5px; color: var(--ink-dim); margin-top: 3px; }
.modal-body { padding: 0 22px; overflow-y: auto; }
.modal-body .field { margin-bottom: 4px; }
.modal-body .hint { margin: 10px 0 4px; font-style: normal; }
.modal-body .hint .mono { font-family: var(--mono); color: var(--ink-soft); }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 22px 20px;
}
.modal-foot .cta { margin: 0; padding: 11px 20px; }

.btn-ghost {
  font-family: var(--body); font-size: 14.5px; font-weight: 600;
  color: var(--ink-soft);
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  padding: 11px 18px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-ghost:disabled { opacity: .5; cursor: not-allowed; }

.repo-line {
  font-size: 13px;
  color: var(--ink-soft);
  background: var(--accent-soft);
  border: 1px solid #c9d4f8;
  border-radius: 9px;
  padding: 9px 12px;
  margin-bottom: 14px;
}
.repo-line .mono { font-family: var(--mono); font-size: 12px; color: var(--accent-deep); }

.country-status {
  font-size: 12.5px; font-weight: 600;
  margin-top: 4px;
  min-height: 16px;
}
.country-status.ok { color: var(--green); }
.country-status.warn { color: var(--red); }

input.field-error {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 3px var(--red-soft) !important;
  animation: shake .3s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.deploy-log {
  margin: 12px 0 4px;
  background: #14161a;
  color: #cdd6d0;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.55;
  border-radius: 10px;
  padding: 14px 16px;
  max-height: 320px; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
}

/* ── settings modal ── */
.settings-loading { color: var(--ink-dim); padding: 20px 4px; text-align: center; }
.settings-section {
  padding: 16px 0;
  border-top: 1px solid var(--border);
}
.settings-section:first-child { border-top: none; padding-top: 6px; }
.settings-section h4 {
  font-family: var(--display); font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.settings-note { font-size: 12.5px; color: var(--ink-soft); margin: 5px 0 12px; line-height: 1.5; }
.settings-note .mono { font-family: var(--mono); font-size: 11.5px; }
.settings-row { display: flex; gap: 8px; align-items: stretch; }
.settings-row.end { justify-content: flex-end; }
.settings-row input { flex: 1; }
.settings-section .field { margin-bottom: 10px; }
.cta-sm { margin: 0; padding: 9px 16px; font-size: 14px; border-radius: 10px; white-space: nowrap; }

.settings-section.danger { border-top-color: #f0c4c1; }
.settings-section.danger h4 { color: var(--red); }
.btn-danger {
  font-family: var(--display); font-weight: 600; font-size: 14px;
  color: #fff; background: var(--red); border: none;
  border-radius: 10px; padding: 9px 16px; cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn-danger:hover:not(:disabled) { background: #b83a33; }
.btn-danger:disabled { background: #e6b3af; cursor: not-allowed; }

.detect-box {
  border-radius: 10px;
  padding: 10px 13px;
  margin: 0 0 10px;
  font-size: 12.5px; line-height: 1.5;
}
.detect-box.ok { background: var(--green-soft); border: 1px solid #bfe3d1; color: var(--green); font-weight: 600; }
.detect-box.wait { background: var(--accent-soft); border: 1px solid #c9d4f8; color: var(--ink-soft); }
.detect-link {
  display: inline-block; margin-top: 6px;
  font-weight: 600; color: var(--accent); text-decoration: none;
}
.detect-link:hover { text-decoration: underline; }

.voice-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.voice-name { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); }
.voice-current { font-size: 12.5px; font-weight: 600; color: var(--accent); text-decoration: none; }
.voice-current:hover { text-decoration: underline; }
#voice-preview { width: 100%; height: 38px; margin-top: 12px; }

.tg-badge {
  font-family: var(--body); font-size: 11px; font-weight: 600;
  border-radius: 6px; padding: 2px 8px;
}
.tg-badge.ok { color: var(--green); background: var(--green-soft); }
.tg-badge.warn { color: var(--amber); background: #fdf6ea; }

/* ── traffic replay ── */
.play-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 24px;
  color: var(--accent);
  background: var(--accent-soft); border: 1px solid #c9d4f8;
  border-radius: 7px; cursor: pointer;
  transition: background .12s, color .12s, transform .1s;
}
.play-btn svg { margin-left: 1px; }
.play-btn:hover { background: var(--accent); color: #fff; }
.play-btn:active { transform: scale(.94); }
.faint { color: var(--ink-dim); }

.replay-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(10, 12, 16, 0.72);
  backdrop-filter: blur(3px);
  display: none; place-items: center; padding: 24px;
}
.replay-overlay.open { display: grid; }
.replay-modal {
  width: 100%; max-width: 1100px; height: min(80vh, 760px);
  display: flex; flex-direction: column;
  background: #14161a; border: 1px solid #2a2f37; border-radius: 14px;
  overflow: hidden; box-shadow: 0 30px 80px -20px rgba(0,0,0,.6);
}
.replay-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid #2a2f37;
  color: #cdd6d0; font-size: 13.5px;
}
.replay-title { font-family: var(--display); font-weight: 600; }
.replay-sid { font-size: 11.5px; color: #7d8891; }
.replay-spacer { flex: 1; }
.replay-note-inline { font-size: 11.5px; color: #7d8891; }
.replay-ext { color: var(--accent); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.replay-ext:hover { text-decoration: underline; }
.replay-bar .btn-ghost { padding: 5px 12px; font-size: 13px; background: none; color: #cdd6d0; border-color: #2a2f37; }
.replay-bar .btn-ghost:hover { background: #1e2229; color: #fff; }
.replay-parts { display: flex; gap: 6px; flex-wrap: wrap; }
.replay-parts button {
  font-family: var(--mono); font-size: 11px; color: #9aa4ad;
  background: #1e2229; border: 1px solid #2a2f37; border-radius: 6px;
  padding: 3px 8px; cursor: pointer;
}
.replay-parts button.on { color: #06281a; background: var(--phosphor, #52f2a5); border-color: transparent; }

#replay-stage { flex: 1; background: #0a0b0c; display: grid; place-items: center; min-height: 0; }
.replay-msg { display: flex; flex-direction: column; align-items: center; gap: 10px; color: #9aa4ad; font-size: 13px; text-align: center; padding: 24px; }
.replay-msg .err { color: var(--red); max-width: 460px; }
.replay-msg .links { display: flex; gap: 14px; font-size: 12.5px; }
.replay-msg .links a { color: var(--accent); }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid #2a2f37; border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
/* rrweb-player theming to match the dark modal (chrome only — not the recording itself) */
#replay-stage .rr-player { float: none; box-shadow: none; border-radius: 0; background: #0a0b0c; }
#replay-stage .rr-controller { border-radius: 0; background: #14161a; color: #cdd6d0; }
#replay-stage .rr-timeline__time { color: #9aa4ad; font-variant-numeric: tabular-nums; }
#replay-stage .rr-progress { background: #2a2f37; border-top-color: #14161a; border-bottom-color: #14161a; }
#replay-stage .rr-progress__step { background: #3a414b; }
#replay-stage .rr-progress__handler { background: var(--accent); }
#replay-stage .rr-controller__btns button { color: #9aa4ad; }
#replay-stage .rr-controller__btns button:hover { color: #fff; }
#replay-stage .rr-controller__btns button:active { background: #1e2229; }
#replay-stage .rr-controller__btns button.active { background: var(--accent); color: #fff; }

/* scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
