/* PM+ app shell (WP-17b). Tokens from the PM+ prototype (apps/prototype), light and dark. */
:root {
  color-scheme: light dark;
  --bg: #f3f6f5;
  --panel: #ffffff;
  --panel2: #eef3f1;
  --fg: #122220;
  --muted: #5b6d69;
  --line: #dbe4e1;
  --brand: #0e6b5f;
  --brand-ink: #ffffff;
  --brand-soft: #dcefeb;
  --ok: #1f7a3a;
  --ok-soft: #e1f2e5;
  --warn: #a05c00;
  --warn-soft: #fbefd8;
  --bad: #b4322a;
  --bad-soft: #fbe5e3;
  --focus: #1d5fd6;
  --radius: 12px;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1514;
    --panel: #141f1d;
    --panel2: #1a2826;
    --fg: #e3ecea;
    --muted: #9bb0ac;
    --line: #273836;
    --brand: #4fc2b1;
    --brand-ink: #06201c;
    --brand-soft: #173a35;
    --ok: #7fd295;
    --ok-soft: #173322;
    --warn: #f0b65c;
    --warn-soft: #3a2b12;
    --bad: #f08c84;
    --bad-soft: #3d1c1a;
    --focus: #8fb5ff;
  }
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.45 var(--f-body);
}
body {
  padding-bottom: env(safe-area-inset-bottom);
}
a {
  color: var(--brand);
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

.top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 0;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.logo {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  padding-bottom: 10px;
}
.logo b {
  color: var(--brand);
}
.tabs {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.tabs a {
  padding: 10px 12px 12px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 3px solid transparent;
}
.tabs a:hover {
  color: var(--fg);
}
/* Selected: two cues, colour and the underline (KZ-002). */
.tabs a[aria-current="page"] {
  color: var(--fg);
  border-bottom-color: var(--brand);
}

main {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}
h1 {
  font-size: 22px;
  margin: 4px 0 2px;
  letter-spacing: -0.01em;
}
h2 {
  font-size: 15px;
  margin: 22px 0 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sub {
  color: var(--muted);
  margin: 0 0 12px;
}
.state {
  color: var(--muted);
  padding: 24px 0;
  text-align: center;
}
.state.error {
  color: var(--bad);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 0 0 10px;
}
.row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.name {
  font-weight: 700;
  font-size: 17px;
  overflow-wrap: anywhere;
}
.meta {
  color: var(--muted);
  font-size: 14px;
  margin-top: 2px;
}
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel2);
  color: var(--muted);
  white-space: nowrap;
}
.badge.overdue {
  background: var(--bad-soft);
  color: var(--bad);
}
.badge.new {
  background: var(--brand-soft);
  color: var(--brand);
}
.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.stages {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.stages button {
  flex: 1 1 auto;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.stages button:hover {
  border-color: var(--brand);
}
.stages button:active {
  transform: translateY(1px);
}
/* The lead's current stage: filled and marked with a tick (two cues). */
.stages button[aria-pressed="true"] {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: var(--brand);
}
.stages button[aria-pressed="true"]::before {
  content: "✓ ";
}
.stages button.lost[aria-pressed="false"] {
  color: var(--bad);
}
.stages button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: var(--brand-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
.btn.secondary {
  background: transparent;
  color: var(--brand);
}
.btn:hover {
  filter: brightness(1.05);
}
.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}
.btn + .btn {
  margin-top: 8px;
}

label {
  display: block;
  font-weight: 600;
  margin: 12px 0 6px;
}
input[type="email"],
input[type="text"] {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--fg);
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
}
.check input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex: none;
}

ol.steps {
  padding-left: 22px;
  margin: 8px 0 0;
}
ol.steps li {
  margin: 6px 0;
}
.note {
  background: var(--panel2);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 14px;
}
.msg {
  margin-top: 10px;
  font-size: 14px;
}
.msg.ok {
  color: var(--ok);
}
.msg.bad {
  color: var(--bad);
}
ul.devices {
  list-style: none;
  padding: 0;
  margin: 0;
}
ul.devices li {
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
ul.devices li:first-child {
  border-top: 0;
}

form > .btn {
  margin-top: 14px;
}
form > .btn + .btn {
  margin-top: 8px;
}

/* Card editor: grouped choices (template, featured listings). */
fieldset {
  border: 0;
  padding: 0;
  margin: 12px 0 0;
}
legend {
  font-weight: 600;
  padding: 0;
  margin-bottom: 4px;
}
fieldset .check {
  margin: 8px 0;
}
.check input[type="checkbox"]:disabled + span {
  color: var(--muted);
}

/* Focus moved to a new screen's heading for screen readers: no ring (it is not a control). */
h1[tabindex="-1"]:focus {
  outline: none;
}

/* A link waiting on its request (e.g. "Send a new code"): not tappable again yet. */
a.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Pull to refresh (installed app): a strip above the page that grows as the agent pulls. */
/* No iOS rubber-band bounce in the installed app; our own pull strip shows the refresh. */
html,
body {
  overscroll-behavior-y: none;
}

.pull {
  height: 0;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--muted, #6b7280);
  transition: height 0.15s ease;
}
