/* SmartQ console. The light theme takes the design tokens of the platform SmartQ joins (toollad.com's site.css,
   D135: the same blues, surfaces, radii and shadows), so the module looks like the site; the dark theme is their
   night counterpart. Direction-neutral (logical properties) for right-to-left pages. */
:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #f2f4f8;
  --surface-3: #eaeef5;
  --line: #e3e7ef;
  --line-strong: #cdd5e2;
  --fg: #0f1729;
  --fg-2: #445064;
  --muted: #687588;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #eef4ff;
  --on-accent: #ffffff;
  --gradient: linear-gradient(135deg, #2563eb 0%, #6d28d9 100%);
  --ok: #15803d;
  --ok-soft: #edfcf2;
  --warn: #b45309;
  --warn-soft: #fff8e8;
  --bad: #dc2626;
  --bad-soft: #fef1f1;
  --info: #2563eb;
  --info-soft: #edf3ff;
  --header: rgba(255, 255, 255, 0.92);
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.07), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 12px 32px -14px rgba(16, 24, 40, 0.22), 0 4px 10px -6px rgba(16, 24, 40, 0.08);
  --ring: 0 0 0 3px rgba(37, 99, 235, 0.22);
  --radius-sm: 10px;
  --radius: 14px;
  --gutter: 24px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans", "Microsoft YaHei", "Noto Sans", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --surface: #121a2b;
    --surface-2: #182136;
    --surface-3: #1f2a42;
    --line: #26314a;
    --line-strong: #34415e;
    --fg: #e6eaf2;
    --fg-2: #b4bfd2;
    --muted: #8b97ad;
    --accent: #6b9bff;
    --accent-strong: #8db2ff;
    --accent-soft: rgba(107, 155, 255, 0.14);
    --on-accent: #0b1020;
    --gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --ok: #34d399;
    --ok-soft: rgba(52, 211, 153, 0.12);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.12);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, 0.12);
    --info: #6b9bff;
    --info-soft: rgba(107, 155, 255, 0.12);
    --header: rgba(18, 26, 43, 0.9);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 12px 32px -14px rgba(0, 0, 0, 0.6);
    --ring: 0 0 0 3px rgba(107, 155, 255, 0.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
/* An element the script hides stays hidden, whatever display its own style gives it. */
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
::selection { background: var(--accent-soft); }

/* ----- the header ----- */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 60px;
  padding: 8px var(--gutter);
  background: var(--header);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--fg);
  flex: none;
}
.brand:hover { color: var(--fg); text-decoration: none; }
.brand::before {
  content: "Q";
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--gradient);
  color: #fff;
  font-size: .95rem;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}
.bar nav { display: flex; flex-wrap: nowrap; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.bar nav::-webkit-scrollbar { display: none; }
/* The menu on a row of its own when it does not fit beside the rest (fitHeader in app.js). */
.bar.stacked { flex-wrap: wrap; row-gap: 6px; padding-bottom: 6px; }
.bar.stacked nav { order: 5; flex-basis: 100%; margin: 0 -4px; }
.bar nav a {
  color: var(--fg-2);
  padding: 7px 11px;
  border-radius: 9px;
  font-size: .93rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.bar nav a:hover { background: var(--surface-2); color: var(--fg); text-decoration: none; }
.bar nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.bar nav a.owner-nav { color: var(--muted); }
.bar nav a.owner-nav[aria-current="page"] { color: var(--accent); }
.bar > a, .bar > button { white-space: nowrap; }
.bar > a.link { color: var(--muted); font-size: .9rem; }
.bar > a.link:hover { color: var(--fg); }
.spacer { flex: 1; }
select.lang {
  width: auto;
  max-width: 170px;
  height: 34px;
  padding: 0 28px 0 10px;
  font-size: .88rem;
  background-color: var(--surface);
  border-radius: 9px;
}

/* ----- the page ----- */
main { max-width: 1040px; margin: 28px auto 72px; padding: 0 var(--gutter); }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.narrow { max-width: 420px; margin: 56px auto; padding: 28px; box-shadow: var(--shadow-md); }
.narrow h1 { text-align: center; }
.narrow button[type="submit"] { width: 100%; height: 42px; }
h1 { font-size: 1.5rem; line-height: 1.25; font-weight: 700; letter-spacing: -0.015em; margin: 0 0 14px; }
h2 { font-size: 1.06rem; line-height: 1.35; font-weight: 650; letter-spacing: -0.005em; margin: 0 0 12px; }
h3 { font-size: .98rem; font-weight: 650; margin: 14px 0 8px; }
p { margin: 8px 0; }
ul, ol { padding-inline-start: 22px; }
li { margin: 3px 0; }
strong { font-weight: 650; }
.muted { color: var(--muted); font-size: .9rem; }
.error { color: var(--bad); min-height: 1.2em; font-size: .92rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ----- forms ----- */
label { display: block; margin: 14px 0; }
label > span { display: block; font-size: .88rem; font-weight: 500; color: var(--fg-2); margin-bottom: 6px; }
input, select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; font-family: var(--mono); font-size: .86rem; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
select { cursor: pointer; }
/* A field SmartQ fills (a pool name in place of the customer's domain) reads as not theirs to fill. */
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); border-style: dashed; cursor: not-allowed; }
label.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; }
label.check > input { width: 18px; height: 18px; min-height: 0; flex: none; margin: 2px 0 0; accent-color: var(--accent); }
label.check > span { display: inline; margin: 0; color: var(--fg); font-size: .95rem; font-weight: 400; }
form.inline { margin: 12px 0 4px; padding-top: 12px; border-top: 1px dashed var(--line); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 16px 0; padding: 10px 18px 14px; background: var(--surface-2); }
legend { padding: 0 8px; font-weight: 650; font-size: .95rem; }
input.qty { width: 6em; }
details { margin: 10px 0; }
summary { cursor: pointer; font-weight: 600; color: var(--fg); padding: 4px 0; list-style-position: inside; }
summary:hover { color: var(--accent); }
.card > details:only-child > summary { padding: 0; }
/* The order page: SmartQ's recommendation for the combination, then what it needs; the optional rest folded away. */
.recommend { margin: 14px 0; padding: 12px 16px; border: 1px solid var(--line); border-inline-start: 4px solid var(--info); border-radius: var(--radius); background: var(--info-soft); }
.recommend p { margin: 4px 0 8px; }
.recommend p:last-child { margin-bottom: 0; }
.recommend button { margin: 2px 0 6px; }
/* A command inside a right-to-left sentence (textOf in app.js): its words are not broken. */
bdi > .nobr { white-space: nowrap; }
/* What the customer needs it for: tiles in groups, the one chosen lit. */
fieldset.purpose { background: var(--surface); padding-bottom: 16px; }
.tile-group { margin: 12px 0 6px; font-size: .78rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.tiles.all { margin-top: 14px; }
label.tile { position: relative; display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 10px 12px; padding-inline-start: 36px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
label.tile:hover { border-color: var(--line-strong); background: var(--surface-2); }
label.tile > input { position: absolute; top: 12px; inset-inline-start: 12px; width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; accent-color: var(--accent); }
label.tile > span { display: block; margin: 0; }
label.tile > .tile-title { font-size: .92rem; font-weight: 600; color: var(--fg); }
label.tile > .tile-desc { font-size: .8rem; font-weight: 400; line-height: 1.4; color: var(--muted); }
label.tile:has(> input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
label.tile:has(> input:focus-visible) { box-shadow: var(--ring); }
p.why { margin: -6px 0 12px; padding-inline-start: 2px; }
details.advanced { margin: 16px 0; padding: 8px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
details.advanced[open] { padding-bottom: 12px; }

/* ----- buttons ----- */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: .93rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
button:hover { background: var(--accent-strong); }
button:active { transform: translateY(1px); }
button.secondary { background: var(--surface); color: var(--fg); border-color: var(--line-strong); }
button.secondary:hover { background: var(--surface-2); border-color: var(--muted); }
button:disabled { opacity: .5; cursor: default; transform: none; }
button.link {
  min-height: 0;
  padding: 2px 4px;
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--muted);
  font-weight: 500;
  font-size: .86rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
button.link:hover { background: none; color: var(--fg); }
.bar > button.link { text-decoration: none; font-size: .9rem; }
.row > button, p > button, span > button { margin-inline-end: 4px; }

/* A card's title row with its action (the deployment list's "New deployment"). */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head > h1, .card-head > h2 { margin: 0; }
a.button {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-size: .93rem;
  font-weight: 600;
  box-shadow: var(--shadow-xs);
  text-decoration: none;
}
a.button:hover { background: var(--accent-strong); color: var(--on-accent); text-decoration: none; }
a.button::before { content: "+"; font-size: 1.1rem; line-height: 1; margin-inline-end: 6px; font-weight: 700; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }

/* ----- tables ----- */
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: start; padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: .93rem; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); }
thead th:first-child { border-start-start-radius: var(--radius-sm); border-end-start-radius: var(--radius-sm); }
thead th:last-child { border-start-end-radius: var(--radius-sm); border-end-end-radius: var(--radius-sm); }
thead th { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td a { font-weight: 600; }

/* ----- status chips ----- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--fg-2);
  font-size: .8rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  vertical-align: middle;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip.delivered { background: var(--ok-soft); color: var(--ok); }
.chip.blocked { background: var(--bad-soft); color: var(--bad); }
.chip.converging, .chip.verifying, .chip.awaiting_node { background: var(--warn-soft); color: var(--warn); }
h1 .chip { margin-inline-start: 6px; font-size: .78rem; }

/* ----- code and commands ----- */
pre, code {
  font-family: var(--mono);
}
pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
  font-size: .84rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 8px 0;
}

/* ----- a deployment's cards ----- */
.cardbox {
  position: relative;
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--warn);
  padding: 14px 16px;
  margin: 10px 0;
  background: var(--warn-soft);
  border-radius: var(--radius-sm);
}
.cardbox > strong:first-child, .cardbox > h3:first-child { display: block; font-size: 1rem; margin: 0 0 6px; }
.cardbox.advisory { border-inline-start-color: var(--info); background: var(--info-soft); }
.cardbox.consent { border-inline-start-color: var(--accent); background: var(--accent-soft); }
.cardbox.blocked { border-inline-start-color: var(--bad); background: var(--bad-soft); }
.cardbox.resolved { border-inline-start-color: var(--ok); background: var(--surface-2); opacity: .8; }
.cardbox ol, .cardbox ul { margin: 6px 0 10px; padding-inline-start: 22px; }
.cardbox .cmd { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; }
.cardbox .cmd pre { flex: 1; margin: 0; background: var(--surface); }
.cardbox p:last-child { margin-bottom: 0; }

/* ----- the progress log ----- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: baseline;
  margin: 0;
  padding: 7px 0 7px 18px;
  font-size: .92rem;
  border-bottom: 1px solid var(--line);
}
.timeline li:last-child { border-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  inset-inline-start: 2px;
  top: 15px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
}
.timeline li:last-child::before { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.timeline time { color: var(--muted); flex: none; font-size: .84rem; font-variant-numeric: tabular-nums; }
[dir="rtl"] .timeline li { padding: 7px 18px 7px 0; }

/* ----- tabs (segmented) ----- */
.tabs { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; flex-wrap: wrap; }
.tabs button { min-height: 32px; padding: 6px 12px; box-shadow: none; border: 0; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.tabs button[aria-selected="false"] { background: transparent; color: var(--fg-2); }
.tabs button[aria-selected="false"]:hover { color: var(--fg); background: var(--surface-3); }

/* ----- phones ----- */
@media (max-width: 720px) {
  :root { --gutter: 16px; }
  .bar { flex-wrap: wrap; gap: 8px 10px; padding-top: 10px; padding-bottom: 8px; }
  .brand { font-size: 1rem; }
  .bar > a.link, .bar > button.link { font-size: .82rem; }
  select.lang { max-width: 124px; height: 32px; font-size: .82rem; padding-inline-end: 24px; }
  /* Other tables scroll sideways inside their card; the deployment list becomes one block per deployment. */
  main table { display: block; overflow-x: auto; }
  table.list, table.list tbody { display: block; }
  table.list thead { display: none; }
  table.list tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
  table.list tr:last-child { border-bottom: 0; }
  table.list td { display: block; padding: 0; border: 0; }
  table.list td:nth-child(3) { grid-column: 2; grid-row: 1; }
  table.list td:nth-child(2), table.list td:nth-child(4) { grid-column: 1 / -1; color: var(--muted); font-size: .84rem; }
  table.list td:nth-child(2) { grid-row: 2; }
  table.list tbody tr:hover { background: none; }
  .bar nav { order: 5; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; }
  .bar nav::-webkit-scrollbar { display: none; }
  main { margin-top: 18px; }
  .card { padding: 18px 16px; border-radius: 12px; }
  .narrow { margin: 28px auto; padding: 22px 18px; }
  h1 { font-size: 1.32rem; }
  th, td { padding: 9px 8px; font-size: .88rem; }
  .timeline li { flex-direction: column; gap: 0; }
}
