:root {
  --bg: #f5f6f8; --card: #fff; --ink: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --brand: #1f6feb; --brand-ink: #fff; --brand-soft: #e8f0fe;
  --ok: #137333; --ok-soft: #e6f4ea; --err: #b3261e; --err-soft: #fce8e6; --warn: #8a5300; --warn-soft: #fef3e0;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.bar { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.logo-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 13px; }
nav { display: flex; gap: 4px; }
nav button { background: none; border: 0; padding: 7px 12px; border-radius: 8px; color: var(--muted); font: inherit; cursor: pointer; }
nav button.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.who { margin-left: auto; color: var(--muted); font-size: 13px; }
main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 15px; margin: 0 0 10px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .spacer { flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.hint { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 5px; }
input[type=text], input[type=url], input[type=number], input[type=password], input[type=datetime-local], input:not([type]), select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cfd4dc; border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.btn { border: 1px solid #cfd4dc; background: #fff; color: var(--ink); padding: 7px 13px; border-radius: 8px; font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f3f4f6; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { color: var(--err); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline > input, .inline > select { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 160px; gap: 12px; }
.banner { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.err { background: var(--err-soft); color: var(--err); }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.search { max-width: 280px; }

/* Dashboard */
.client-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.client-head .spacer { flex: 1; }
.conn { display: grid; grid-template-columns: minmax(0, 1.3fr) 20px minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.conn .arrow { color: var(--muted); text-align: center; }
.conn a { color: var(--brand); text-decoration: none; font-weight: 600; }
.conn a:hover { text-decoration: underline; }
.conn .acts { display: flex; gap: 4px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { grid-column: 1 / -1; font-size: 13px; padding: 6px 10px; border-radius: 6px; }
.status.running { background: var(--brand-soft); color: var(--brand); }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.err { background: var(--err-soft); color: var(--err); }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.pill { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: #eef0f3; color: var(--muted); vertical-align: middle; }
.pill.active { background: var(--ok-soft); color: var(--ok); }

/* Editor */
.step { display: grid; grid-template-columns: 30px 1fr; gap: 12px; }
.step-n { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.step.locked { opacity: .55; pointer-events: none; }
.step-body > label:first-of-type { margin-top: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.map td:first-child { width: 42%; }
.map .col-letter { display: inline-block; min-width: 26px; text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); background: #eef0f3; border-radius: 4px; padding: 1px 4px; margin-right: 8px; }
.map tr.mapped td:first-child { font-weight: 600; }
.map .fixed { margin-top: 6px; }
.map-tools { display: flex; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.chips span { display: inline-block; margin: 3px 4px 0 0; padding: 2px 8px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); font-size: 12px; }
.radio { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin: 8px 0; cursor: pointer; }
.radio input { margin-top: 3px; }
.save-bar { display: flex; gap: 12px; align-items: center; justify-content: flex-end; }

.log td { font-size: 12.5px; }
.log .ERROR { color: var(--err); font-weight: 600; }
.log .OK { color: var(--ok); font-weight: 600; }
details summary { cursor: pointer; color: var(--brand); margin-top: 10px; }
details ol { padding-left: 20px; }
code { background: #eef0f3; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }

dialog { border: 0; border-radius: 12px; padding: 20px; width: min(460px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(20,24,33,.4); }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1d2330; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13.5px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; z-index: 20; }
#toast.show { opacity: 1; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .conn { grid-template-columns: 1fr; gap: 6px; }
  .conn .arrow { display: none; }
  .conn .acts { justify-content: flex-start; }
  .grid2 { grid-template-columns: 1fr; }
  .map td:first-child { width: auto; }
}

a.btn { display: inline-block; text-decoration: none; }

/* Login page */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: min(380px, 100%); box-shadow: 0 6px 30px rgba(0,0,0,.06); }
.auth-card h1 { margin: 14px 0 6px; }
.auth-logo { margin-bottom: 4px; }
.auth-btn { width: 100%; margin-top: 18px; padding: 10px; }
.auth-card .banner { margin: 12px 0 0; }

/* Accounts */
.acct { display: flex; gap: 14px; align-items: flex-start; }
.acct-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px; flex: none; }
.acct-icon.fb { background: #1877f2; }
.acct-icon.g { background: #0f9d58; }
.acct-body { flex: 1; min-width: 0; }
.acct-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #c4c9d1; margin-right: 6px; }
.dot.on { background: var(--ok); }
.logout-form { margin: 0; }
.logout-form button { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 7px 10px; border-radius: 8px; }
.logout-form button:hover { background: #f3f4f6; }
.who { margin-left: auto; display: flex; align-items: center; gap: 8px; }
