:root {
  --ink: #11191e;
  --muted: #5f6d75;
  --surface: #ffffff;
  --surface-subtle: #f2f6f6;
  --line: #d8e0e1;
  --cyan: #087f8c;
  --cyan-strong: #00606b;
  --green: #16835b;
  --red: #bd3c3c;
  --amber: #ad651c;
  --focus: #0d99a7;
  --radius: 8px;
  --shadow: 0 10px 28px rgb(17 25 30 / 10%);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--surface-subtle);
  letter-spacing: 0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 280px;
  min-height: 100dvh;
  background: var(--surface-subtle);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }

button { min-height: 44px; cursor: pointer; }

button:focus-visible, dialog:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 65%, transparent);
  outline-offset: 2px;
}

button:disabled { cursor: not-allowed; opacity: 0.45; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: max(10px, env(safe-area-inset-top)) 18px 10px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(18px);
}

.brand-lockup { display: flex; align-items: center; gap: 10px; }
.brand-lockup img { border-radius: 6px; }
.brand-lockup div { display: grid; gap: 1px; }
.brand-lockup strong { font-size: 1rem; }
.brand-lockup span { color: var(--muted); font-size: 0.74rem; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: currentColor;
  font-size: 1.45rem;
}

main {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 14px 16px calc(88px + var(--safe-bottom));
}

.status-band {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  margin-bottom: 24px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.status-band div { display: grid; gap: 2px; min-width: 0; }
.status-band strong { font-size: 0.87rem; }
.status-band span:not(.status-indicator) { color: var(--muted); font-size: 0.75rem; overflow-wrap: anywhere; }

.status-indicator {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 13%, transparent);
}

.status-indicator.current { background: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 13%, transparent); }
.status-indicator.blocked { background: var(--red); box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 13%, transparent); }

.view[hidden] { display: none; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 0 2px 16px; }
.eyebrow { margin: 0 0 4px; color: var(--cyan-strong); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
h1, h2, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: 1.65rem; line-height: 1.14; }
h2 { margin: 0; font-size: 1rem; line-height: 1.3; }

.count-badge {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 15px;
  background: var(--ink);
  color: var(--surface);
  font-size: 0.8rem;
  font-weight: 700;
}

.setup-panel, .system-panel, .action-panel, .empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.setup-panel { display: grid; justify-items: center; gap: 12px; padding: 30px 20px; text-align: center; }
.setup-panel img { border-radius: 8px; }
.setup-panel p { max-width: 44ch; margin: 0; color: var(--muted); font-size: 0.87rem; line-height: 1.5; }

.action-panel { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; padding: 14px; border-color: color-mix(in srgb, var(--cyan) 40%, var(--line)); }
.action-panel p { margin: 3px 0 0; color: var(--muted); font-size: 0.78rem; }

.decision-list { display: grid; gap: 10px; }
.decision-card {
  display: grid;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 2px 10px rgb(17 25 30 / 3%);
}

.decision-card header { display: flex; justify-content: space-between; gap: 12px; }
.decision-card h2 { font-size: 0.98rem; }
.decision-card p { margin: 3px 0 0; color: var(--muted); font-size: 0.77rem; }
.decision-card .priority { color: var(--amber); font-size: 0.72rem; font-weight: 700; white-space: nowrap; }

.primary-button, .secondary-button, .approve-button, .deny-button, .defer-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 15px;
  border-radius: 6px;
  font-weight: 650;
}

.primary-button { border: 1px solid var(--cyan-strong); background: var(--cyan-strong); color: #ffffff; }
.secondary-button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.decision-card .secondary-button { width: 100%; }
.approve-button { border: 1px solid var(--green); background: var(--green); color: #ffffff; }
.deny-button { border: 1px solid var(--red); background: var(--red); color: #ffffff; }
.defer-button { border: 1px solid var(--amber); background: var(--amber); color: #ffffff; }

.empty-state { display: grid; justify-items: center; gap: 8px; padding: 34px 20px; text-align: center; }
.empty-state > span { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; color: var(--green); font-size: 1.25rem; }
.empty-state p { max-width: 42ch; margin: 0; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }

.activity-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.activity-list li { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: start; padding: 14px 2px; border-bottom: 1px solid var(--line); }
.activity-list .event-dot { width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: var(--cyan); }
.activity-list strong { display: block; font-size: 0.85rem; }
.activity-list p, .activity-list time { margin: 2px 0 0; color: var(--muted); font-size: 0.74rem; }

.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 0 0 14px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); }
.metric-grid div { min-height: 90px; padding: 15px; background: var(--surface); }
.metric-grid dt { color: var(--muted); font-size: 0.74rem; }
.metric-grid dd { margin: 10px 0 0; font-size: 1.25rem; font-weight: 700; }
.system-panel { padding: 16px; }
.system-panel p { color: var(--muted); font-size: 0.82rem; line-height: 1.5; }

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 5px max(10px, env(safe-area-inset-right)) calc(5px + var(--safe-bottom)) max(10px, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(18px);
}

.bottom-nav[hidden] { display: none; }

.bottom-nav button { display: grid; justify-items: center; gap: 2px; min-height: 50px; border: 0; background: transparent; color: var(--muted); font-size: 0.68rem; }
.bottom-nav button span { font-size: 1.1rem; }
.bottom-nav button[aria-current="page"] { color: var(--cyan-strong); font-weight: 700; }

dialog {
  width: min(calc(100% - 24px), 560px);
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgb(5 10 13 / 62%); backdrop-filter: blur(4px); }
dialog form { padding: 18px; }
.dialog-header { display: flex; justify-content: space-between; gap: 16px; }
.decision-details { display: grid; gap: 0; margin: 20px 0; border-top: 1px solid var(--line); }
.decision-details div { display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.decision-details dt { color: var(--muted); font-size: 0.76rem; }
.decision-details dd { margin: 0; font-family: ui-monospace, "SFMono-Regular", monospace; font-size: 0.73rem; overflow-wrap: anywhere; }
.boundary-copy { color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.decision-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }

.toast { position: fixed; right: 16px; bottom: calc(82px + var(--safe-bottom)); left: 16px; z-index: 50; max-width: 520px; margin: auto; padding: 12px 14px; border-radius: var(--radius); background: var(--ink); color: #ffffff; box-shadow: var(--shadow); font-size: 0.82rem; }

@media (min-width: 760px) {
  main { padding-top: 24px; }
  .bottom-nav { right: auto; top: 92px; bottom: auto; left: max(18px, calc((100vw - 1040px) / 2)); grid-template-columns: 1fr; width: 126px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius); }
  .bottom-nav button { grid-template-columns: 22px 1fr; justify-items: start; align-items: center; padding: 0 10px; text-align: left; }
  main { transform: translateX(70px); }
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #edf5f5;
    --muted: #9cadb0;
    --surface: #11191d;
    --surface-subtle: #0b1115;
    --line: #29363b;
    --cyan: #59c6cf;
    --cyan-strong: #74d3da;
    --green: #45b986;
    --red: #ef6c6c;
    --amber: #e7a256;
    --shadow: 0 14px 34px rgb(0 0 0 / 36%);
  }
  .primary-button { color: #071114; }
  .approve-button, .deny-button, .defer-button { color: #071114; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
