/* ivoflow Hub: the modern layer. Loaded after styles.css, so it refines the old tokens and
   adds the components of the new pages (lists, drawers, dialogs, wizards, workflow). */

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --border: #e3e6ee;
  --border-strong: #cfd4e1;
  --text: #121827;
  --muted: #667085;
  --brand: #4f46e5;
  --brand-strong: #4338ca;
  --brand-soft: #eef0ff;
  --ok: #12805c;
  --ok-soft: #e6f6ef;
  --warn: #a15c07;
  --warn-soft: #fff4e0;
  --err: #c0262d;
  --err-soft: #feecec;
  --radius: 12px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-2: 0 8px 28px rgba(16, 24, 40, .10);
  --shadow-3: 0 24px 64px rgba(16, 24, 40, .22);
  --ring: 0 0 0 3px rgba(79, 70, 229, .22);
}
:root[data-theme="dark"] {
  --bg: #0d1017; --surface: #151922; --surface-2: #181d28; --border: #252b3a; --border-strong: #343c50;
  --text: #e9ecf4; --muted: #98a2b8; --brand: #8b93ff; --brand-strong: #a3aaff; --brand-soft: #1f2447;
  --ok: #4cc38a; --ok-soft: #12301f; --warn: #e5a847; --warn-soft: #33270f; --err: #f2707a; --err-soft: #381a1d;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35); --shadow-2: 0 8px 28px rgba(0, 0, 0, .45); --shadow-3: 0 24px 64px rgba(0, 0, 0, .6);
  --ring: 0 0 0 3px rgba(139, 147, 255, .3);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1017; --surface: #151922; --surface-2: #181d28; --border: #252b3a; --border-strong: #343c50;
    --text: #e9ecf4; --muted: #98a2b8; --brand: #8b93ff; --brand-strong: #a3aaff; --brand-soft: #1f2447;
    --ok: #4cc38a; --ok-soft: #12301f; --warn: #e5a847; --warn-soft: #33270f; --err: #f2707a; --err-soft: #381a1d;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .35); --shadow-2: 0 8px 28px rgba(0, 0, 0, .45); --shadow-3: 0 24px 64px rgba(0, 0, 0, .6);
    --ring: 0 0 0 3px rgba(139, 147, 255, .3);
  }
}

body { font: 14px/1.55 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
       -webkit-font-smoothing: antialiased; }
h1, h2, h3 { letter-spacing: -.01em; }
a { color: var(--brand); }

/* ── controls ────────────────────────────────────────── */
button { border-radius: 9px; font-weight: 600; transition: background .12s, border-color .12s, box-shadow .12s, transform .06s; }
button:active:not(:disabled) { transform: translateY(1px); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: none; box-shadow: var(--ring); }
.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--shadow-1); }
:root[data-theme="dark"] .primary { color: #0d1017; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .primary { color: #0d1017; } }
.primary:hover:not(:disabled) { filter: none; background: var(--brand-strong); border-color: var(--brand-strong); }
.ghost { background: var(--surface); border-color: var(--border-strong); box-shadow: var(--shadow-1); }
.ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--brand); }
.btn-danger { background: var(--surface); color: var(--err); border: 1px solid var(--border-strong); }
.btn-danger:hover:not(:disabled) { background: var(--err-soft); border-color: var(--err); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-icon { padding: 6px; width: 32px; height: 32px; display: inline-grid; place-items: center; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: none !important; box-shadow: var(--ring); border-color: var(--brand); }
label { font-weight: 600; color: var(--muted); }
label.check { font-weight: 500; color: var(--text); }
.card { border-radius: var(--radius); box-shadow: var(--shadow-1); }

/* ── shell ───────────────────────────────────────────── */
.shell { grid-template-columns: 264px 1fr; }
.sidebar { background: var(--surface); padding: 16px 12px; }
.brand b { font-size: 15px; letter-spacing: -.01em; }
.dot { border-radius: 10px; background: linear-gradient(135deg, var(--brand), #9b8cff); box-shadow: 0 4px 12px rgba(79, 70, 229, .35); }
.menu-label { margin: 18px 12px 6px; letter-spacing: .08em; }
.menu-item { padding: 8px 12px; border-radius: 9px; font-weight: 600; font-size: 13.5px; }
.menu-item .ico { font-size: 18px; width: 22px; }
.menu-item small { font-size: 11.5px; }
.menu-item:hover { background: var(--bg); }
.menu-item.is-active { background: var(--brand-soft); color: var(--brand); }
.menu-item.is-active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand); }
.project-chip { border-radius: 10px; background: var(--surface-2); }
.content { padding: 28px 36px 96px; max-width: 1360px; }
.content.wide { max-width: none; }   /* the live view uses the whole width */

/* ── page bar: title left, actions right ─────────────── */
.pagebar { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; }
.pagebar h1 { font-size: 24px; letter-spacing: -.02em; margin: 0; }
.pagebar p { color: var(--muted); margin: 4px 0 0; font-size: 14px; max-width: 70ch; }
.pagebar .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumb { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; text-decoration: none;
         margin-bottom: 6px; font-weight: 600; }
.crumb:hover { color: var(--brand); }

/* ── badges, dots ────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; line-height: 1;
         padding: 5px 9px; border-radius: 99px; background: var(--bg); color: var(--muted); border: 1px solid transparent; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--err-soft); color: var(--err); }
.badge.info { background: var(--brand-soft); color: var(--brand); }
.badge.busy::before { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 9px;
        border-radius: 8px; background: var(--bg); color: var(--text); border: 1px solid var(--border); text-decoration: none; }
a.chip:hover { border-color: var(--brand); color: var(--brand); }
.avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 11px; font-weight: 700;
          background: var(--brand-soft); color: var(--brand); text-transform: uppercase; flex: none; }
.who { display: inline-flex; gap: 8px; align-items: center; }

/* ── toolbar, segmented, tabs ────────────────────────── */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.toolbar input[type=search], .toolbar input[type=text] { margin: 0; width: 260px; }
.toolbar select { margin: 0; width: auto; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; color: var(--muted); font-size: 13px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; overflow-y: hidden; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; text-decoration: none; border-bottom: 2px solid transparent;
          white-space: nowrap; font-size: 13.5px; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.tabs .count { margin-left: 6px; font-size: 11px; background: var(--bg); padding: 1px 7px; border-radius: 99px; }

/* ── data list (table) ───────────────────────────────── */
.dt-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.dt { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.dt th { background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
         text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.dt td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.dt tr:last-child td { border-bottom: 0; }
.dt tbody tr.click { cursor: pointer; }
.dt tbody tr.click:hover td { background: var(--surface-2); }
.dt .name { font-weight: 650; color: var(--text); }
.dt .sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.dt .right { text-align: right; white-space: nowrap; }
.dt .row-actions { display: inline-flex; gap: 6px; }
.stack { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }

/* ── empty state ─────────────────────────────────────── */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .ico { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--brand-soft);
              color: var(--brand); font-size: 22px; margin-bottom: 12px; }
.empty h3 { margin: 0 0 6px; text-transform: none; letter-spacing: -.01em; font-size: 16px; color: var(--text); }
.empty p { max-width: 46ch; margin: 0 auto 14px; }

/* ── stat cards ──────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-1); }
.stat-card .n { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-card .l { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat-card.ok .n { color: var(--ok); } .stat-card.bad .n { color: var(--err); } .stat-card.warn .n { color: var(--warn); }

/* ── key/value, panels ───────────────────────────────── */
.panel2 { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1); margin-bottom: 16px; }
.panel2 > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel2 > header h2 { margin: 0; font-size: 14px; letter-spacing: -.005em; }
.panel2 > .body { padding: 16px 18px; }
.panel2 > .body.flush { padding: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 600; font-size: 13px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.copyline { display: flex; gap: 8px; align-items: center; background: var(--bg); border: 1px solid var(--border); border-radius: 9px; padding: 6px 6px 6px 12px; }
.copyline code { flex: 1; background: none; padding: 0; font-size: 12.5px; overflow-wrap: anywhere; }

/* ── progress / workflow ─────────────────────────────── */
.flow { display: flex; gap: 0; align-items: stretch; flex-wrap: wrap; }
.flow-step { flex: 1; min-width: 150px; display: flex; gap: 10px; align-items: flex-start; padding: 4px 14px 4px 0; position: relative; }
.flow-step .n { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12.5px;
                background: var(--bg); color: var(--muted); border: 1px solid var(--border-strong); }
.flow-step.done .n { background: var(--ok); color: #fff; border-color: var(--ok); }
.flow-step.now .n { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: var(--ring); }
.flow-step.busy .n { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.flow-step b { display: block; font-size: 13.5px; }
.flow-step small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.flow-step::after { content: ""; position: absolute; top: 14px; left: 36px; right: 8px; height: 2px; background: var(--border); z-index: 0; }
.flow-step:last-child::after { display: none; }
.flow-step .t { position: relative; z-index: 1; background: var(--surface); padding-right: 6px; }
.flow-step.done::after { background: var(--ok); }
.flow-step a { font-size: 12px; font-weight: 600; }
.mini-steps { display: inline-flex; gap: 3px; }
.mini-steps i { width: 14px; height: 5px; border-radius: 3px; background: var(--border-strong); }
.mini-steps i.on { background: var(--ok); }
.mini-steps i.now { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }

/* ── project cards ───────────────────────────────────── */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; box-shadow: var(--shadow-1);
         display: flex; flex-direction: column; gap: 14px; transition: border-color .12s, box-shadow .12s; }
.pcard:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.pcard.is-open { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow-1); }
.pcard h3 { margin: 0; font-size: 16px; text-transform: none; letter-spacing: -.01em; color: var(--text); }
.pcard .meta { color: var(--muted); font-size: 12px; }
.pcard .flow-step { min-width: 0; padding-right: 6px; }
.pcard .flow-step small { display: none; }
.pcard .flow-step.now small { display: block; }
.pcard .foot { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── dialogs and drawers ─────────────────────────────── */
.ov { position: fixed; inset: 0; background: rgba(9, 12, 20, .55); backdrop-filter: blur(2px); z-index: 60; display: grid;
      place-items: center; padding: 20px; animation: fade .12s ease-out; }
.ov.side { place-items: stretch end; padding: 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.985); } }
@keyframes slide { from { transform: translateX(28px); opacity: 0; } }
.dlg { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-3); width: min(560px, 100%); max-height: calc(100vh - 40px);
       display: flex; flex-direction: column; animation: rise .16s ease-out; border: 1px solid var(--border); }
.dlg.wide { width: min(820px, 100%); }
.dlg.small { width: min(420px, 100%); }
.side .dlg { border-radius: 0; width: min(760px, 100%); max-height: none; height: 100vh; animation: slide .18s ease-out; border-width: 0 0 0 1px; }
.dlg > header { padding: 18px 22px 14px; display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.dlg > header h2 { margin: 0; font-size: 18px; letter-spacing: -.015em; }
.dlg > header p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.dlg > .body { padding: 4px 22px 18px; overflow-y: auto; flex: 1; }
.dlg > footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; align-items: center; background: var(--surface-2); border-radius: 0 0 16px 16px; }
.dlg > footer .left { margin-right: auto; }
.x { border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.x:hover { background: var(--bg); color: var(--text); }

/* ── wizard ──────────────────────────────────────────── */
.wiz-steps { display: flex; gap: 6px; padding: 0 22px 12px; }
.wiz-steps span { flex: 1; font-size: 12px; font-weight: 600; color: var(--muted); padding-top: 8px; border-top: 3px solid var(--border); }
.wiz-steps span.on { color: var(--brand); border-top-color: var(--brand); }
.wiz-steps span.done { color: var(--ok); border-top-color: var(--ok); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12.5px; font-weight: 650; color: var(--text); margin-bottom: 4px; }
.field > small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.field input, .field select, .field textarea { margin: 0; width: 100%; padding: 9px 11px; font: inherit; }
.choice { display: grid; gap: 10px; }
.choice label { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border-strong); border-radius: 12px; padding: 12px 14px;
                margin: 0; cursor: pointer; color: var(--text); font-weight: 500; background: var(--surface); }
.choice label:hover { border-color: var(--brand); }
.choice label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand); }
.choice input { margin-top: 3px; }
.choice b { display: block; font-size: 14px; }
.choice small { color: var(--muted); font-size: 12.5px; }
.summary { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.preview-line { background: var(--bg); border: 1px dashed var(--border-strong); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; color: var(--muted); }
.preview-line b { color: var(--text); }

/* ── timeline, checks, logs ──────────────────────────── */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: grid; grid-template-columns: 20px 1fr; gap: 12px; padding-bottom: 14px; position: relative; }
.tl li::before { content: ""; position: absolute; left: 9px; top: 20px; bottom: 0; width: 2px; background: var(--border); }
.tl li:last-child::before { display: none; }
.tl .d { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; font-size: 11px; }
.tl .done .d { background: var(--ok); border-color: var(--ok); color: #fff; }
.tl .now .d { border-color: var(--brand); box-shadow: var(--ring); }
.tl small { color: var(--muted); display: block; font-size: 12px; }
.tl b { font-size: 13.5px; }
.checks { display: flex; flex-direction: column; gap: 8px; }
.check-group { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.check-group > header { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--surface-2); font-weight: 650; }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 13px; }
.check-row .mark { width: 18px; flex: none; font-weight: 800; }
.check-row.ok .mark { color: var(--ok); } .check-row.no .mark { color: var(--err); }
.check-row .why { color: var(--err); font-size: 12.5px; overflow-wrap: anywhere; }
.logview { background: #0b0e14; color: #d6dbe8; border-radius: 12px; padding: 14px 16px; font: 12px/1.55 var(--mono); max-height: 520px; overflow: auto;
           white-space: pre-wrap; word-break: break-word; margin: 0; border: 1px solid #1c2230; }
.logview.err { color: #ff9aa2; }
.loghead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.loghead select { margin: 0; width: auto; }

/* ── callouts ────────────────────────────────────────── */
.note-box { display: flex; gap: 12px; align-items: flex-start; border-radius: 12px; padding: 12px 14px; background: var(--brand-soft); color: var(--text); margin-bottom: 16px; }
.note-box.warn { background: var(--warn-soft); } .note-box.bad { background: var(--err-soft); } .note-box.ok { background: var(--ok-soft); }
.note-box .ico { font-size: 18px; flex: none; margin-top: 1px; }
.note-box.warn .ico { color: var(--warn); } .note-box.bad .ico { color: var(--err); } .note-box.ok .ico { color: var(--ok); } .note-box:not(.warn):not(.bad):not(.ok) .ico { color: var(--brand); }
.note-box p { margin: 0; } .note-box .actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.next { border: 1px solid var(--brand); background: var(--brand-soft); border-radius: 14px; padding: 16px 18px; margin-bottom: 16px; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.next h3 { margin: 0 0 2px; text-transform: none; letter-spacing: -.01em; font-size: 15px; color: var(--text); }
.next p { margin: 0; color: var(--muted); }
.svg-ico { display: inline-grid; place-items: center; line-height: 0; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--border), var(--surface-2), var(--border)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── toast ───────────────────────────────────────────── */
.toast { border-radius: 12px; box-shadow: var(--shadow-2); }

@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; } .cols-3 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .content { padding: 20px 16px 80px; }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; }
  .dt-wrap { overflow-x: auto; }
}

/* links that look like buttons */
a.primary, a.ghost { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; padding: 8px 14px; border-radius: 9px;
                     border: 1px solid transparent; font-weight: 600; cursor: pointer; }
a.ghost { border-color: var(--border-strong); color: var(--text); background: var(--surface); }
a.ghost:hover { border-color: var(--brand); }
a.primary { color: #fff; }
:root[data-theme="dark"] a.primary { color: #0d1017; }
a.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.modal-box { border-radius: 16px; box-shadow: var(--shadow-3); }

.toolbar input[type=search]{padding-left:12px}
.pcard .flow{flex-direction:column;gap:6px}
.pcard .flow-step::after{display:none}
.pcard .flow-step .t{background:none}
a.primary { background: var(--brand); border-color: var(--brand); }
a.primary:hover { filter: brightness(1.08); }
.flow-step a, .flow-step button.link { text-decoration: none; font-size: 12px; font-weight: 600; background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; }
.flow-step a:hover, .flow-step button.link:hover { text-decoration: underline; }
.pcard .flow-step small { display: none !important; }
.pcard .flow-step.now small { display: block !important; }

.tabs .count.ok { background: var(--ok-soft); color: var(--ok); }
.tabs .count.warn { background: var(--warn-soft); color: var(--warn); }
.tabs .count.bad { background: #fde8e8; color: #c0392b; }
.next.wait { border-color: var(--border-strong); background: var(--bg); }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 8px; animation: livepulse 1.6s ease-in-out infinite; }
@keyframes livepulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.reconframe { display: block; width: 100%; height: 72vh; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
/* full screen: the live view takes the window, its toolbar stays on top */
.reconframe.full { position: fixed; inset: 52px 0 0 0; width: 100vw; height: calc(100vh - 52px); z-index: 1000; border-radius: 0; border: 0; border-top: 1px solid var(--border); }
.toolbar.reconbar-full { position: fixed; top: 0; left: 0; right: 0; height: 52px; z-index: 1001; margin: 0; padding: 0 16px; background: var(--surface); }

/* signed-in user, bottom left */
.usercard { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); margin: 10px 0 6px; }
.usercard .avatar { width: 32px; height: 32px; font-size: 12px; flex: none; }
.uc-who { min-width: 0; }
.uc-who b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uc-who small { color: var(--muted); font-size: 11.5px; }
.uc-actions { display: flex; gap: 6px; margin-bottom: 8px; }
.uc-actions button { flex: 1; }
/* the project at the top of importer and studio */
.projbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; padding: 7px 8px 7px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); width: fit-content; max-width: 100%; }
.projbar .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
/* things that run by themselves move */
.spin { display: inline-block; width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--brand); animation: spin .8s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.tl .now .d { border-color: var(--brand); border-top-color: transparent; box-shadow: none; animation: spin .9s linear infinite; }
.tl li.now b::after { content: " …"; animation: pulse 1.2s ease-in-out infinite; }
.buildbar { height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; margin: 2px 0 12px; }
.buildbar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand-strong, var(--brand)), var(--brand)); background-size: 200% 100%; animation: bar 1.4s linear infinite; transition: width .6s ease; }
@keyframes bar { to { background-position: -200% 0; } }
.flow-step.busy .n { animation: pulse 1.2s ease-in-out infinite; }
.next.wait h3 { display: flex; align-items: center; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--surface-2); }
.badge.busy { position: relative; }

.pcard.is-deleting { opacity: .85; border-style: dashed; }
.impact { margin: 6px 0 12px; padding-left: 18px; display: grid; gap: 6px; font-size: 13.5px; }

.field.req > span::after { content: ' *'; color: var(--err); font-weight: 700; }
.field.bad input, .field.bad select, .field.bad textarea, textarea.bad { border-color: var(--err) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 18%, transparent); }
.field .err-msg { color: var(--err); font-weight: 600; }
.sso-list { display: grid; gap: 12px; }
.sso-card { border: 1px solid var(--line, #d8dde6); border-radius: 12px; padding: 14px; background: var(--panel, transparent); }
.sso-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sso-card textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; width: 100%; resize: vertical; }
.step-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; border: 0; background: none; color: var(--muted); padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; }
.step-btn.on { background: var(--brand-soft); color: var(--brand); }
.step-btn .dot { min-width: 18px; height: 18px; border-radius: 9px; background: var(--err); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; padding: 0 5px; }

/* ── nothing may look dead ── */
#busybar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 300; opacity: 0; pointer-events: none; transition: opacity .25s;
  background: linear-gradient(90deg, transparent, var(--brand), transparent) no-repeat; background-size: 40% 100%; animation: busy 1.1s linear infinite; }
#busybar.on { opacity: 1; }
@keyframes busy { from { background-position: -40% 0; } to { background-position: 140% 0; } }
button.is-busy, a.is-busy { position: relative; color: transparent !important; pointer-events: none; }
button.is-busy > *, a.is-busy > * { opacity: 0; }
button.is-busy::after, a.is-busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--brand); animation: spin .7s linear infinite; }
button.primary.is-busy::after, button.btn-danger.is-busy::after, a.primary.is-busy::after { border-color: rgba(255,255,255,.4); border-top-color: #fff; }
body.live-lost .live-dot { background: var(--warn); animation: none; }

/* ── the path of a project: never overlapping, vertical when narrow ── */
.flowwrap { container-type: inline-size; }
.flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.flow-step { min-width: 0; flex: none; padding: 4px 12px 4px 0; }
.flow-step .t { min-width: 0; overflow-wrap: anywhere; }
.flow-step::after { left: 36px; right: 4px; }
@container (max-width: 560px) {
  .flow { grid-template-columns: 1fr; gap: 14px; }
  .flow-step { padding-right: 0; }
  .flow-step::after { left: 13px; right: auto; top: 32px; bottom: -12px; width: 2px; height: auto; }
  .flow-step:last-child::after { display: none; }
  .flow-step .t { background: none; padding-right: 0; }
}

.pcard.click { cursor: pointer; display: grid; gap: 12px; align-content: start; }
.pcard.click:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pcard .pstats { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pcard .pcount { display: inline-flex; gap: 6px; align-items: center; font-weight: 650; font-size: 13.5px; }
.pcard .pdata { margin: 0; display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.pcard .pnext { margin: 0; font-size: 13px; color: var(--muted); }
.pcard .pnext b { color: var(--text); }
.pcard .ok-text { color: var(--ok); font-weight: 650; }

/* path: no connector stubs in the horizontal layout; the vertical one keeps its line */
.flow-step::after { display: none; }
@container (max-width: 560px) { .flow-step::after { display: block; } .flow-step:last-child::after { display: none; } }
.flow-step .t { background: none; padding-left: 0; }

.flow-step.clickable { cursor: pointer; border-radius: 10px; }
.flow-step.clickable:hover .t b, .flow-step.clickable:focus-visible .t b { color: var(--brand); text-decoration: underline; }
.flow-step.clickable:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
body.live-held::after { content: "Live updates wait while you click or select. Click anywhere to continue."; position: fixed; left: 16px; bottom: 16px;
  background: var(--surface); color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; font-size: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,.12); z-index: 50; pointer-events: none; }

.flow-step .t > a, .flow-step .t > button.link { display: inline-block; margin-top: 8px; padding: 2px 0; }

.pagebar .actions { display: flex; gap: 12px; flex-wrap: wrap; }
.row-actions { display: inline-flex; gap: 8px; }

.progress-pill { position: fixed; right: 16px; bottom: 16px; z-index: 60; background: var(--surface); color: var(--text); border: 1px solid var(--brand);
  border-radius: 20px; font-size: 13px; box-shadow: 0 6px 18px rgba(0,0,0,.18); max-width: min(360px, calc(100vw - 32px)); overflow: hidden; }
.pp-top { display: flex; align-items: center; }
.pp-top .pp-head { flex: 1; min-width: 0; }
.pp-min { flex: none; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin-right: 8px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.pp-min svg { width: 12px; height: 12px; }
.pp-min:hover { background: var(--surface-2); color: var(--text); }
.pp-dot { display: none; position: relative; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; color: var(--text); }
.pp-dot svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.pp-track, .pp-ring { fill: none; stroke-width: 3.5; }
.pp-track { stroke: var(--border); }
.pp-ring { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset .4s; }
.pp-ring.inner { stroke: var(--brand); opacity: .55; }
.pp-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.2px; }
.progress-pill.min { box-sizing: border-box; width: 48px; height: 48px; border: 0; border-radius: 50%; }   /* the ring is the outline of the circle */
.progress-pill.min .pp-full { display: none; }
.progress-pill.min .pp-dot { display: block; }
.progress-pill.indeterminate .pp-ring.inner { opacity: 0; }
.progress-pill.indeterminate .pp-ring.outer { stroke-dasharray: 30 200; stroke-dashoffset: 0; transition: none; transform-origin: 24px 24px; animation: pp-spin 1.1s linear infinite; }
@keyframes pp-spin { to { transform: rotate(360deg); } }
.pp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 8px 14px; background: none; border: 0;
  color: inherit; font: inherit; text-align: left; cursor: default; }
.pp-head[aria-expanded] .pp-caret:not([hidden]) { color: var(--muted); }
.pp-head:has(.pp-caret:not([hidden])) { cursor: pointer; }
.pp-body { padding: 10px 14px 4px; border-bottom: 1px solid var(--border); }
.pp-list { max-height: 220px; overflow-y: auto; font-variant-numeric: tabular-nums; }
.pp-step { display: flex; justify-content: space-between; gap: 16px; padding: 1px 0; color: var(--muted); }
.pp-step.done { color: var(--text); }
.pp-step.running { color: var(--brand); font-weight: 600; }
.pp-step.failed { color: var(--err); font-weight: 600; }
.pp-now { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.pp-bar { height: 6px; margin: 8px 0 4px; border-radius: 3px; background: var(--border); overflow: hidden; }
.pp-bar i { display: block; height: 100%; background: var(--brand); transition: width .4s; }
.pp-total { margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.studio .row button.link, #studio-result .row button.link { margin-left: 10px; }

.chip-x { border: 0; background: none; color: var(--muted, #6b7280); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 0 0 2px; }
.chip-x:hover { color: var(--err, #c0392b); }

/* the trail at the top of the data pages */
.projbar .trail { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.projbar .trail a { color: var(--muted); text-decoration: none; font-weight: 600; }
.projbar .trail a:hover { color: var(--brand); }
.projbar .trail a b { color: var(--text, inherit); }
.projbar .trail a:hover b { color: var(--brand); }
.projbar .trail .sep { color: var(--muted); opacity: .6; }
.projbar .trail .here { font-weight: 700; }

.tl-detail td { background: var(--surface-2); padding: 12px 16px 14px; }
.tl-steps { max-width: 640px; }
.tl-steps td, .tl-steps th { padding: 6px 12px; }

/* Demo Data Studio: tabs, and two things side by side instead of one under the other */
.studio-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-top: 16px; }
.studio-split.transfer { grid-template-columns: minmax(300px, 5fr) minmax(0, 7fr); margin-top: 0; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 16px; }
@media (max-width: 1100px) { .studio-split, .studio-split.transfer { grid-template-columns: minmax(0, 1fr); } }

/* the transfer log lives in half a page: tighter cells, long addresses wrap, and what still does not fit scrolls inside the box */
.dt-wrap.tl { overflow-x: auto; }
.tl .dt th, .tl .dt td { padding: 10px 12px; white-space: normal; }
.tl .dt .badge { white-space: nowrap; }
.tl .dt .small { overflow-wrap: anywhere; }
.tl .dt .num-line { margin-top: 4px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* the data tables of a demo run: values that can be changed (✎ in the header, tinted cells), fixed ones in grey, and a search */
th.editable { color: var(--brand); }
th.editable .pencil { margin-left: 5px; font-size: 11px; opacity: .8; }
th.locked, td.locked { color: var(--muted); }
td.editable { cursor: text; background: color-mix(in srgb, var(--brand) 7%, transparent); }
td.editable:hover { background: color-mix(in srgb, var(--brand) 14%, transparent); }
td.editable:focus { outline: none; background: var(--surface); box-shadow: inset 0 0 0 2px var(--brand); text-overflow: clip; }
td.editable.saving { opacity: .55; }
td.editable.saved { background: var(--ok-soft, rgba(22, 163, 74, .18)); transition: background .3s; }
.cell-search { min-width: 240px; padding: 5px 10px; }
.year-actions { white-space: nowrap; }

/* the country list: names, stored as ISO codes */
td.editable[tabindex]:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--brand); }
.country-pop { position: fixed; z-index: 80; width: 250px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,.2); overflow: hidden; }
.country-pop input { width: 100%; box-sizing: border-box; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 8px 10px; font: inherit; }
.country-opt { display: flex; justify-content: space-between; gap: 10px; padding: 6px 10px; cursor: pointer; font-size: 13px; }
.country-opt b { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.country-opt.on, .country-opt:hover { background: var(--brand-soft, rgba(79, 70, 229, .12)); }
.country-none { padding: 8px 10px; color: var(--muted); font-size: 13px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }

.pp-stop { flex: none; margin-right: 8px; padding: 3px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--danger, #b42318); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.pp-stop:hover:not(:disabled) { background: var(--surface-2); }
.pp-stop:disabled { opacity: .6; cursor: default; }
.pp-stop[hidden] { display: none; }
