/* TechTeamHQ remote: one stylesheet for every page.
   Layout: single column on phones, cards in a readable column on wide screens. */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --fg: #142030;
  --muted: #586579;
  --line: #d9e0ea;
  --accent: #1f5fd6;
  --accent-fg: #ffffff;
  --ok: #1d7a46;
  --ok-bg: #e3f4ea;
  --warn: #8a5a00;
  --warn-bg: #fdf1d8;
  --bad: #b3261e;
  --bad-bg: #fbe6e4;
  --code-bg: #f0f3f8;
  --shadow: 0 1px 2px rgba(20, 32, 48, 0.06), 0 4px 16px rgba(20, 32, 48, 0.05);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e141c; --surface: #161e29; --surface-2: #1d2734; --fg: #e5ebf2; --muted: #9aa7b8;
    --line: #2a3646; --accent: #6f9eff; --accent-fg: #0b1220; --ok: #6fd39b; --ok-bg: #143223;
    --warn: #f0c060; --warn-bg: #3a2c0c; --bad: #ff8a80; --bad-bg: #3d1614; --code-bg: #0f1620;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e141c; --surface: #161e29; --surface-2: #1d2734; --fg: #e5ebf2; --muted: #9aa7b8;
  --line: #2a3646; --accent: #6f9eff; --accent-fg: #0b1220; --ok: #6fd39b; --ok-bg: #143223;
  --warn: #f0c060; --warn-bg: #3a2c0c; --bad: #ff8a80; --bad-bg: #3d1614; --code-bg: #0f1620;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 var(--font);
}
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 12px; padding-block: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; font-weight: 650; flex: 1; min-width: 0; }
.brand img { width: 32px; height: 32px; flex: none; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

main { padding-block: 24px 40px; display: flex; flex-direction: column; gap: 20px; }

h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.2; margin: 0; text-wrap: balance; }
h2 { font-size: 1.2rem; margin: 0; text-wrap: balance; }
h3 { font-size: 1rem; margin: 0; }
p { margin: 0; }
.lead { color: var(--muted); font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

.hero { display: flex; flex-direction: column; gap: 12px; padding-block: 8px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
  background: var(--ok-bg); color: var(--ok); font-size: 0.875rem; font-weight: 600;
}

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
.card-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.step {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--accent); color: var(--accent-fg); font-weight: 700; font-size: 0.875rem;
}
.card-head h2 { flex: 1; min-width: 0; }

.grid-buttons { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.grid-buttons .btn { flex-direction: column; gap: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--fg); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; text-align: center;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 0.875rem; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.btn .sub { display: block; font-weight: 400; font-size: 0.8rem; color: var(--muted); }
.btn.primary .sub { color: inherit; opacity: 0.85; }
.icon-btn { min-width: 44px; padding: 8px; }

.note { padding: 12px 14px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-size: 0.925rem; }
.note.info { background: var(--surface-2); color: var(--fg); }

ol.steps, ul.plain { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 6px; }

code, pre, .mono { font-family: var(--mono); font-size: 0.875rem; }
code { background: var(--code-bg); padding: 1px 6px; border-radius: 6px; overflow-wrap: anywhere; }
pre {
  margin: 0; background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-all;
}

/* label / value rows with a copy button */
.kv { display: flex; flex-direction: column; gap: 10px; }
.kv-row { display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.kv-row dt { font-weight: 600; color: var(--muted); font-size: 0.9rem; }
.kv-row dd { margin: 0; min-width: 0; font-family: var(--mono); font-size: 0.875rem; overflow-wrap: anywhere; background: var(--code-bg); padding: 8px 10px; border-radius: 8px; }
@media (max-width: 560px) {
  .kv-row { grid-template-columns: minmax(0, 1fr) auto; }
  .kv-row dt { grid-column: 1 / -1; }
}

/* status pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.02em; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.idle { background: var(--surface-2); color: var(--muted); }

.status-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; align-items: start; }
.status-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.status-item .label, .status-actions .label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }
.status-actions { position: relative; display: flex; flex-direction: column; gap: 6px; }

/* in-page confirmation popover (never confirm()) */
.popover {
  position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; width: min(340px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18); padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.popover .row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.tab { border: 1px solid transparent; background: none; color: var(--muted); font: inherit; font-weight: 600; padding: 8px 12px; border-radius: 8px; cursor: pointer; min-height: 40px; }
.tab[aria-selected="true"] { background: var(--surface-2); color: var(--fg); border-color: var(--line); }
.tab-panel { display: flex; flex-direction: column; gap: 12px; }

.checks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.checks li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font-size: 0.925rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }

/* forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; }
.field input {
  font: inherit; padding: 10px 12px; min-height: 44px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--fg); width: 100%;
}
.alert { padding: 10px 12px; border-radius: 10px; background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.alert.notice { background: var(--ok-bg); color: var(--ok); }
.alert:empty { display: none; }
.signin { width: 100%; max-width: 420px; margin: 0 auto; }

/* site map */
.sitemap-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sitemap-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px; border-radius: 10px; background: var(--surface-2); }
.sitemap-list .desc { grid-column: 1 / -1; color: var(--muted); font-size: 0.9rem; }
.graph-box { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.graph-box svg { display: block; min-width: 560px; width: 100%; height: auto; }
.graph-box text { fill: var(--fg); font-family: var(--font); font-size: 13px; }
.graph-box .sub { fill: var(--muted); font-size: 11px; font-family: var(--mono); }
.graph-box .node rect { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.graph-box .node.admin rect { stroke: var(--accent); }
.graph-box .edge { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.graph-box .arrow { fill: var(--muted); }
.graph-box .col { fill: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }

footer { border-top: 1px solid var(--line); }
footer .wrap { padding-block: 16px; display: flex; gap: 8px 16px; flex-wrap: wrap; color: var(--muted); font-size: 0.85rem; }

[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
