/* Round 2+: forms, tabs and settings-page building blocks. Uses only tokens.css variables. */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 10px 14px; border: 0; background: none; cursor: pointer; white-space: nowrap;
  font: inherit; font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text-primary); }
.tab[aria-selected="true"] { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 600; }
.tab-panel[hidden] { display: none; }

.section { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 32px; padding: 28px 0; border-bottom: 1px solid var(--border); }
.section:last-child { border-bottom: 0; }
.section > *, .field-row > *, .field-row-3 > * { min-width: 0; }
.tabs { max-width: 100%; }
.section-intro h2 { font-size: var(--text-base); }
.section-intro p { color: var(--text-muted); font-size: var(--text-sm); margin-top: 6px; }

.fields { display: flex; flex-direction: column; gap: 20px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.field-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.field label, .field .label { display: block; font-size: var(--text-sm); font-weight: 600; margin-bottom: 6px; color: var(--text-primary); }
.field .help { font-size: var(--text-xs); color: var(--text-muted); margin-top: 6px; }
.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--bg-surface); color: var(--text-primary);
  font: inherit; font-size: var(--text-sm);
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-a20); }
.textarea { min-height: 140px; resize: vertical; font-family: var(--font-mono); font-size: var(--text-xs); line-height: 1.6; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .suffix { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; background: var(--bg-muted); color: var(--text-muted); font-size: var(--text-sm); white-space: nowrap; }

.switch-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.switch-row .t { font-size: var(--text-sm); font-weight: 600; }
.switch-row .d { font-size: var(--text-xs); color: var(--text-muted); margin-top: 3px; }
.switch { display: inline-block; position: relative; width: 40px; height: 22px; flex: none; margin-top: 2px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--border-strong); transition: background 0.15s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.switch input:checked + span { background: var(--color-primary); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:disabled + span { opacity: 0.5; }
.switch input:disabled { cursor: not-allowed; }
.switch input:focus-visible + span { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--color-primary); }
.range-row output { min-width: 48px; text-align: right; font-size: var(--text-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.range-ends { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; }

.choice-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.choice { position: relative; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 12px; cursor: pointer; background: var(--bg-surface); }
.choice input { position: absolute; opacity: 0; }
.choice:has(input:checked) { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-a20); }
.choice:has(input:focus-visible) { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.choice .thumb { height: 70px; border-radius: var(--radius); background: var(--bg-muted); margin-bottom: 10px; position: relative; overflow: hidden; }
.choice b { display: block; font-size: var(--text-sm); }
.choice small { display: block; color: var(--text-muted); font-size: var(--text-xs); margin-top: 2px; }

.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.color-field { display: flex; align-items: center; gap: 10px; }
.color-field input[type="color"] { width: 38px; height: 38px; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg-surface); cursor: pointer; flex: none; }
.color-field .cf-text b { display: block; font-size: var(--text-sm); font-weight: 600; }
.color-field .cf-text span { display: block; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); }

details.advanced { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-surface); }
details.advanced > summary { list-style: none; cursor: pointer; padding: 14px 18px; font-size: var(--text-sm); font-weight: 600; display: flex; align-items: center; gap: 10px; }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::before { content: "›"; font-size: 18px; line-height: 1; color: var(--text-muted); transition: transform 0.15s; }
details.advanced[open] > summary::before { transform: rotate(90deg); }
details.advanced > summary .hint { margin-left: auto; font-weight: 400; color: var(--text-muted); font-size: var(--text-xs); }
details.advanced > .inner { padding: 4px 18px 18px; display: flex; flex-direction: column; gap: 20px; }

.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-lg); font-size: var(--text-sm); }
.alert b { display: block; }
.alert-info { background: var(--color-info-light); color: var(--color-info-text); }
.alert-success { background: var(--color-success-light); color: var(--color-success-text); }
.alert-warning { background: var(--color-warning-light); color: var(--color-warning-text); }
.alert-danger { background: var(--color-danger-light); color: var(--color-danger-text); }

.keybox { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--bg-muted); font-family: var(--font-mono); font-size: var(--text-sm); }
.keybox code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.action-list { display: flex; flex-direction: column; }
.action { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.action:last-child { border-bottom: 0; }
.action .t { font-size: var(--text-sm); font-weight: 600; }
.action .d { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }
.action .end { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.action .last { font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }

.danger-zone { border-color: var(--color-danger-light); }
.btn-danger { background: var(--bg-surface); color: var(--color-danger-text); border-color: var(--color-danger); }
.btn-danger:hover { background: var(--color-danger-light); }

.save-bar {
  position: fixed; left: 260px; right: 0; bottom: 0; z-index: 25; padding: 14px 32px;
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-surface); border-top: 1px solid var(--border); box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.08);
  transform: translateY(110%); transition: transform 0.2s ease;
}
.save-bar.show { transform: none; }
.save-bar .msg { font-size: var(--text-sm); color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.save-bar .msg::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--color-warning); }
.save-bar .btns { margin-left: auto; display: flex; gap: 10px; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 24px; align-items: start; }
.sticky-col { position: sticky; top: 92px; min-width: 0; }

.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: var(--text-sm); }
.list-plain li:last-child { border-bottom: 0; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: var(--bg-muted); border: 1px solid var(--border); font-size: var(--text-xs); font-weight: 500; color: var(--text-primary); }
.chip button { border: 0; background: none; color: var(--text-muted); cursor: pointer; padding: 0; font-size: 14px; line-height: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.segmented { display: inline-flex; padding: 3px; border-radius: var(--radius); background: var(--bg-muted); gap: 2px; }
.segmented button { border: 0; background: none; padding: 6px 12px; border-radius: 6px; font: inherit; font-size: var(--text-xs); font-weight: 600; color: var(--text-secondary); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; transition: all 0.2s; background: #1E1B4B; color: #fff; padding: 10px 16px; border-radius: var(--radius); font-size: var(--text-sm); z-index: 60; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%); }

.step-dots { display: flex; gap: 6px; }

/* Team member viewing a client's dashboard */
.imp-bar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 8px 20px; background: #B45309; color: #fff; font-size: var(--text-sm); }
.imp-bar span { opacity: 0.9; }
.imp-bar .imp-time { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; opacity: 1; }
.imp-bar .btn { background: #fff; color: #B45309; }
body.has-imp .sidebar { top: 40px; height: calc(100vh - 40px); }
body.has-imp .topbar { top: 40px; }

/* Team area */
.health-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.h-green { background: var(--color-success); } .h-amber { background: var(--color-warning); } .h-red { background: var(--color-danger); } .h-setup { background: var(--border-strong); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters .input, .filters .select { width: auto; }
.search-input { position: relative; flex: 1; min-width: 220px; }
.search-input svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); }
.search-input .input { padding-left: 36px; width: 100%; }
.table-wrap { overflow-x: auto; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--bg-muted); }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; font-size: var(--text-sm); color: var(--text-muted); }
.note { padding: 12px 14px; border-radius: var(--radius); background: var(--color-warning-light); font-size: var(--text-sm); }
.note .meta { font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; }
.timeline { display: flex; gap: 3px; }
.timeline i { flex: 1; height: 22px; border-radius: 3px; }
.proposal { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-secondary); background: var(--bg-purple-tint); border: 1px dashed var(--color-primary-a20); padding: 1px 7px; border-radius: 99px; vertical-align: 2px; }
.kbd { font-family: var(--font-mono); font-size: var(--text-xs); padding: 1px 6px; border-radius: 4px; border: 1px solid var(--border-strong); background: var(--bg-muted); }

@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
  .sticky-col { position: static; }
}
@media (max-width: 860px) {
  .section { grid-template-columns: 1fr; gap: 14px; padding: 20px 0; }
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
  .save-bar { left: 0; padding: 12px 16px; }
  .action { flex-wrap: wrap; }
  .action .end { margin-left: 0; }
}
.save-bar:not(.show) { visibility: hidden; }
.kv-stack div { flex-direction: column; gap: 2px; justify-content: flex-start; }
.kv-stack dd { text-align: left; }

/* Live progress list (connect guide) */
.live-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.live-steps li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); }
.live-steps li[data-state="doing"] { background: var(--bg-purple-tint); }
.live-steps li[data-state="error"] { background: var(--color-danger-light); }
.live-steps .ls-icon { width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center; margin-top: 1px; font-size: 13px; font-weight: 700; }
.live-steps li[data-state="waiting"] .ls-icon { border: 2px solid var(--border-strong); }
.live-steps li[data-state="doing"] .ls-icon { border: 3px solid var(--color-primary-a20); border-top-color: var(--color-primary); animation: spin 0.9s linear infinite; }
.live-steps li[data-state="done"] .ls-icon { background: var(--color-success); color: #fff; }
.live-steps li[data-state="error"] .ls-icon { background: var(--color-danger); color: #fff; }
.live-steps li[data-state="done"] .ls-icon::before { content: "✓"; }
.live-steps li[data-state="error"] .ls-icon::before { content: "!"; }
.live-steps .ls-t { font-size: var(--text-sm); font-weight: 600; }
.live-steps li[data-state="waiting"] .ls-t { color: var(--text-muted); }
.live-steps .ls-d { font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }
.live-steps li[data-state="error"] .ls-d { color: var(--color-danger-text); }
.live-steps .ls-time { margin-left: auto; font-size: var(--text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
@keyframes spin { to { transform: rotate(360deg); } }
