/* remote-ui/web/styles.css — mobile-first styling for the #491 P3 read-only slot shell (#539).
   System-font, dark-mode-aware, large tap-comfortable rows. No external fonts/assets (CSP 'self';
   BSC11 no external egress). Purely presentational — no behavior. */

:root {
  --bg: #f7f7f8;
  --card: #ffffff;
  --ink: #1c1c1e;
  --muted: #6b6b70;
  --line: #e2e2e6;
  --accent: #0a84ff;
  --warn: #d2691e;
  --pending: #b8860b;
  --ok: #2e8b57;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f10;
    --card: #1c1c1e;
    --ink: #f2f2f7;
    --muted: #9b9ba1;
    --line: #2c2c2e;
    --accent: #409cff;
    --warn: #ffa057;
    --pending: #e6b800;
    --ok: #54c98a;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.ru-app {
  max-width: 720px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 12px calc(24px + env(safe-area-inset-bottom));
}

.ru-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 4px 12px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}
.ru-title { font-size: 1.25rem; margin: 0; }
.ru-readonly-badge {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}
.ru-asof { width: 100%; margin: 0; font-size: 0.74rem; color: var(--muted); }

.ru-slots { list-style: none; margin: 0; padding: 0; }

.ru-slot {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 12px 0;
  padding: 12px 14px;
}

.ru-slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ru-slot-num { font-weight: 600; font-size: 1.05rem; }

.ru-status {
  font-size: 0.78rem;
  border-radius: 999px;
  padding: 2px 10px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.ru-status-busy { color: var(--accent); border-color: var(--accent); } /* the SSOT active token */
.ru-status-waiting { color: var(--pending); border-color: var(--pending); }
.ru-status-idle { color: var(--muted); }
.ru-status-none { color: var(--muted); } /* "-" = no claude session (cockpit join.py) */
.ru-status-unknown { color: var(--muted); font-style: italic; }

.ru-branch {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  word-break: break-all;
  margin: 6px 0 8px;
}

.ru-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 0.82rem;
  color: var(--muted);
}
.ru-dirty { color: var(--warn); }
.ru-pending-count.ru-has-pending { color: var(--pending); font-weight: 600; }
.ru-pending-count.ru-no-pending { color: var(--muted); }

.ru-pending { list-style: none; margin: 10px 0 0; padding: 0; }
.ru-gate {
  border-top: 1px solid var(--line);
  padding: 10px 0 4px;
}
.ru-gate-ctx {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--muted);
}
.ru-gate-slot { font-weight: 600; }
.ru-gate-branch {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}
.ru-gate-kind {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent);
}
.ru-gate-title {
  margin: 2px 0 0;
  font-size: 1rem;
  font-weight: 600; /* the title is PROMINENT — the T3 mis-tap mitigation (spec §5.1) */
}

.ru-error {
  background: var(--card);
  border: 1px solid var(--warn);
  color: var(--warn);
  border-radius: 12px;
  padding: 14px;
  margin: 16px 0;
}
.ru-empty { color: var(--muted); padding: 24px 4px; text-align: center; }

/* ===== #572 tap-to-answer — interactive surfaces (Slice B) ================================
   The answer affordance + the per-gate choice buttons + the result/tunnel screens. Touch-first:
   every tappable target is >= 44px tall (the iOS HIG minimum), with explicit :active / :focus
   feedback (the #539 styles had NONE — no touch state existed before this). */

:root {
  --btn-bg: #ffffff;
  --btn-ink: var(--accent);
  --btn-line: var(--accent);
  --btn-active-bg: #eef6ff;
  --ok-bg: #eaf7f0;
  --fail-bg: #fdeeee;
  --fail: #c0392b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --btn-bg: #15233a;
    --btn-ink: #6bb6ff;
    --btn-line: #2f5d8f;
    --btn-active-bg: #1d3a5f;
    --ok-bg: #16301f;
    --fail-bg: #3a1c1a;
    --fail: #ff7a6b;
  }
}

/* Shared tappable button base — large hit target, visible focus ring, instant :active feedback. */
.ru-answer-btn,
.ru-choice-btn,
.ru-back-btn,
.ru-retry-btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px; /* iOS HIG minimum tap target */
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid var(--btn-line);
  background: var(--btn-bg);
  color: var(--btn-ink);
  cursor: pointer;
  touch-action: manipulation; /* no 300ms tap delay, no double-tap zoom on the control */
  transition: background-color 0.12s ease, transform 0.04s ease;
}
.ru-answer-btn:focus-visible,
.ru-choice-btn:focus-visible,
.ru-back-btn:focus-visible,
.ru-retry-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.ru-answer-btn:active,
.ru-choice-btn:active,
.ru-back-btn:active,
.ru-retry-btn:active {
  background: var(--btn-active-bg);
  transform: scale(0.98); /* tactile press feedback */
}

/* The per-gate "Answer" affordance on the slots overview — full-width, comfortably below the title. */
.ru-answer-btn {
  width: 100%;
  margin-top: 10px;
}

/* The answer-enabled mode badge (mirrors the read-only badge, accent-tinted to signal write-capable). */
.ru-mode-badge { /* shared shape with .ru-readonly-badge already defined above */ }
.ru-mode-answer {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 2px 8px;
}

/* ----- the approvals (choice) screen ----- */
.ru-approve .ru-gate-prompt {
  margin: 8px 0 16px;
  color: var(--muted);
}
.ru-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0 20px;
}
.ru-choice-btn {
  width: 100%;
  font-size: 1.05rem;
  padding: 14px 16px; /* the primary action of the whole flow — extra-large */
}
/* [EDGE-1] once a choice is tapped, all choice buttons disable (one answer intent leaves the
   device); show the disabled state clearly so the user sees their tap landed + can't re-tap. */
.ru-choice-btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.ru-choice-btn:disabled:active {
  transform: none; /* no press feedback on a dead button */
}
.ru-gate-gone,
.ru-gate-noanswer {
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
}

/* Back / Retry — secondary, lower visual weight (muted border, transparent fill). */
.ru-back-btn,
.ru-retry-btn {
  margin-top: 8px;
  color: var(--muted);
  border-color: var(--line);
  background: transparent;
  font-weight: 500;
}

/* ----- the result screen ----- */
.ru-result-ok,
.ru-result-fail {
  border-radius: 12px;
  padding: 18px;
  margin: 16px 0;
}
.ru-result-ok {
  background: var(--ok-bg);
  border: 1px solid var(--ok);
}
.ru-result-fail {
  background: var(--fail-bg);
  border: 1px solid var(--fail);
}
.ru-result-headline {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 700;
}
.ru-result-ok .ru-result-headline { color: var(--ok); }
.ru-result-fail .ru-result-headline { color: var(--fail); }
.ru-result-detail { margin: 0; color: var(--ink); word-break: break-word; }

/* ----- Slice C: the tunnel-inactive recovery screen ----- */
.ru-tunnel-inactive {
  background: var(--card);
  border: 1px solid var(--warn);
  border-radius: 12px;
  padding: 18px;
  margin: 16px 0;
}
.ru-tunnel-headline {
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--warn);
}
.ru-tunnel-body { margin: 0 0 12px; color: var(--ink); }
.ru-tunnel-cmd {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  display: inline-block;
  user-select: all; /* one tap selects the whole command to copy */
}

/* ── #589: the 3 backend-only surfaces (backlog / skills / crs) + the nav tab bar ───────────── */

/* Nav tab bar — a sticky row of large tap targets at the top of every view. */
.ru-nav {
  display: flex;
  gap: 4px;
  padding: 6px;
  margin-bottom: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.ru-nav-tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
}
.ru-nav-active { background: var(--accent); color: #fff; }

/* Backlog — one row per item: #num · priority badge · status · title. */
.ru-backlog-list, .ru-skills-list, .ru-crs-list, .ru-cr-drafts-list, .ru-slot-pick-list {
  list-style: none; margin: 0; padding: 0;
}
.ru-backlog-item, .ru-skill-item, .ru-cr-item, .ru-slot-pick {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 12px; margin-bottom: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
}
.ru-bk-num { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.ru-bk-pri { font-size: 12px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--line); }
.ru-bk-status { font-size: 12px; color: var(--muted); }
.ru-bk-title, .ru-cr-title, .ru-skill-desc { flex-basis: 100%; }

/* Skills — name + desc + a Request-run button (only for remote_invocable) OR a muted lock tag. */
.ru-skill-name, .ru-cr-id { font-weight: 700; }
.ru-skill-locked { font-size: 12px; color: var(--muted); font-style: italic; }
.ru-request-btn, .ru-cr-open-btn, .ru-copy-btn, .ru-slot-pick-btn {
  padding: 10px 16px; border: none; border-radius: 8px;
  background: var(--accent); color: #fff; font: inherit; font-weight: 600;
}
.ru-cr-open-btn, .ru-copy-btn { background: var(--card); color: var(--accent); border: 1px solid var(--accent); }
.ru-request-ok { color: var(--ok); padding: 12px; }

/* CRs — list cards + a detail meta block + read-only draft comments with a Copy button. */
.ru-cr-author, .ru-cr-state { font-size: 12px; color: var(--muted); }
.ru-cr-meta { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; }
.ru-cr-draft { padding: 12px; margin-bottom: 8px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; }
.ru-cr-draft-text { white-space: pre-wrap; word-break: break-word; margin: 0 0 8px;
  font: 14px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
