:root {
  color-scheme: light;
  --navy: #17324d;
  --blue: #1e6f8a;
  --teal: #299d8f;
  --teal-dark: #14766c;
  --ink: #263640;
  --muted: #64737e;
  --line: #d8e0e5;
  --soft: #f3f7f8;
  --soft-teal: #eaf6f3;
  --warning: #9b6b16;
  --warning-soft: #fff6df;
  --danger: #a33c3c;
  --danger-soft: #fff0f0;
  --success: #1f795f;
  --success-soft: #e8f7f1;
  --white: #fff;
  --shadow: 0 14px 36px rgba(23, 50, 77, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: #f7f9fa;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--blue);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--navy);
  line-height: 1.18;
}

h1 {
  margin-bottom: 0.75rem;
  font-size: clamp(2rem, 4vw, 3.3rem);
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 0.65rem;
  font-size: clamp(1.35rem, 2vw, 1.85rem);
}

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(23, 50, 77, 0.97);
  color: var(--white);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 2rem));
  min-height: 68px;
  margin: 0 auto;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand strong,
.brand span {
  display: block;
}

.brand > div > span {
  color: #c8d6df;
  font-size: 0.82rem;
}

.brand-mark {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 12px;
  background: var(--teal);
  color: var(--white);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.page-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.7fr);
  align-items: center;
  gap: 2rem;
  padding: clamp(1.4rem, 3.5vw, 2.7rem);
  border-radius: 24px;
  background:
    radial-gradient(circle at 95% 0%, rgba(41, 157, 143, 0.2), transparent 32%),
    linear-gradient(135deg, #fff, #eef5f6);
  box-shadow: var(--shadow);
}

.hero-panel p:last-child {
  margin-bottom: 0;
}

.eyebrow {
  margin-bottom: 0.5rem;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.progress-card {
  padding: 1.25rem;
  border: 1px solid rgba(30, 111, 138, 0.15);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--navy);
}

.progress-track {
  height: 10px;
  margin: 0.75rem 0;
  overflow: hidden;
  border-radius: 999px;
  background: #dce6e9;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--teal));
  transition: width 280ms ease;
}

.progress-card small {
  color: var(--muted);
}

.guidance-panel {
  margin: 1.5rem 0;
  padding: 1.25rem 1.4rem;
  border-left: 5px solid var(--teal);
  border-radius: 0 16px 16px 0;
  background: var(--soft-teal);
}

.guidance-panel h2 {
  margin-bottom: 0.4rem;
  font-size: 1.15rem;
}

.guidance-panel ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0.7rem 0;
  padding-left: 1.5rem;
  gap: 0.4rem 2rem;
}

.guidance-panel p:last-child {
  margin-bottom: 0;
}

.filter-bar {
  position: sticky;
  z-index: 40;
  top: 68px;
  display: flex;
  margin: 1.5rem 0;
  padding: 0.55rem;
  overflow-x: auto;
  gap: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 26px rgba(23, 50, 77, 0.07);
  backdrop-filter: blur(12px);
}

.filter-button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.55rem 0.85rem;
  white-space: nowrap;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--navy);
  cursor: pointer;
  font-weight: 700;
  gap: 0.45rem;
}

.filter-button span {
  display: inline-grid;
  min-width: 24px;
  height: 24px;
  padding: 0 0.35rem;
  place-items: center;
  border-radius: 999px;
  background: var(--soft);
  font-size: 0.76rem;
}

.filter-button:hover,
.filter-button.active {
  background: var(--navy);
  color: var(--white);
}

.filter-button.active span {
  background: rgba(255, 255, 255, 0.15);
}

.decision-group {
  margin-top: 2.7rem;
}

.decision-group[hidden],
.decision-card[hidden] {
  display: none;
}

.group-heading {
  display: flex;
  justify-content: space-between;
  padding-bottom: 0.85rem;
  border-bottom: 2px solid var(--teal);
}

.group-heading p:last-child {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
}

.decision-list {
  display: grid;
  margin-top: 1rem;
  gap: 0.85rem;
}

.decision-card {
  overflow: clip;
  border: 1px solid var(--line);
  border-left: 5px solid #aebbc3;
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 6px 18px rgba(23, 50, 77, 0.045);
}

.decision-card.status-in_progress {
  border-left-color: #d89b2b;
}

.decision-card.status-done {
  border-left-color: var(--success);
}

.decision-card > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  min-height: 92px;
  padding: 1rem 1.15rem;
  list-style: none;
  cursor: pointer;
  gap: 1rem;
}

.decision-card > summary::-webkit-details-marker {
  display: none;
}

.decision-card > summary:hover {
  background: #fbfcfc;
}

.decision-card[open] > summary {
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.decision-id,
.participant-code {
  display: inline-grid;
  min-width: 50px;
  height: 34px;
  padding: 0 0.55rem;
  place-items: center;
  border-radius: 10px;
  background: var(--navy);
  color: var(--white);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.decision-summary-text strong,
.decision-summary-text small {
  display: block;
}

.decision-summary-text strong {
  color: var(--navy);
  line-height: 1.35;
}

.decision-summary-text small {
  margin-top: 0.25rem;
  color: var(--muted);
  line-height: 1.4;
}

.gate-badge,
.status-badge {
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 800;
}

.gate-badge {
  background: #eaf0f4;
  color: var(--blue);
}

.status-badge {
  background: #eef1f3;
  color: var(--muted);
}

.status-in_progress .status-badge {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-done .status-badge {
  background: #e7f6ef;
  color: var(--success);
}

.decision-form {
  padding: 1.25rem;
}

.context-box {
  padding: 1rem;
  border-radius: 12px;
  background: var(--soft);
}

.context-box > p {
  margin: 0.2rem 0 0.65rem;
}

.hypothesis-box {
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
}

.hypothesis-box summary {
  color: var(--blue);
  cursor: pointer;
  font-weight: 700;
}

.hypothesis-box p {
  margin: 0.55rem 0 0;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1.1rem;
  gap: 1rem;
}

.form-grid-meta {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

label {
  display: grid;
  color: var(--navy);
  font-size: 0.9rem;
  font-weight: 750;
  gap: 0.4rem;
}

textarea,
input[type="text"],
input[type="url"],
select {
  width: 100%;
  border: 1px solid #bac7ce;
  border-radius: 11px;
  outline: none;
  background: var(--white);
  color: var(--ink);
  font-weight: 400;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

textarea {
  min-height: 128px;
  padding: 0.8rem;
  resize: vertical;
  line-height: 1.5;
}

select {
  min-height: 45px;
  padding: 0.55rem 0.7rem;
}

textarea:focus,
input[type="text"]:focus,
input[type="url"]:focus,
select:focus,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(41, 157, 143, 0.2);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.1rem;
  gap: 1rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.65rem 1rem;
  border: 1px solid transparent;
  border-radius: 11px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 800;
}

.button-primary {
  background: var(--teal-dark);
  color: var(--white);
}

.button-primary:hover {
  background: #0f655d;
}

.button-secondary {
  border-color: var(--blue);
  background: var(--white);
  color: var(--blue);
}

.button-quiet {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

.save-indicator {
  color: var(--muted);
  font-size: 0.82rem;
}

.save-indicator.dirty,
.save-indicator.saving {
  color: var(--warning);
}

.save-indicator.success {
  color: var(--success);
}

.save-indicator.error {
  color: var(--danger);
  font-weight: 700;
}

.global-message {
  color: var(--muted);
  text-align: center;
}

.site-footer {
  padding: 1.5rem 1rem 2.5rem;
  color: var(--muted);
  text-align: center;
}

.access-page {
  display: grid;
  min-height: 100vh;
  padding: 1rem;
  place-items: center;
  background:
    radial-gradient(circle at 10% 10%, rgba(41, 157, 143, 0.22), transparent 30%),
    radial-gradient(circle at 90% 90%, rgba(30, 111, 138, 0.18), transparent 35%),
    var(--soft);
}

.access-card {
  width: min(560px, 100%);
  padding: clamp(1.6rem, 5vw, 3rem);
  border-radius: 24px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.access-card .brand-mark {
  margin-bottom: 1.4rem;
}

.privacy-note {
  margin: 1.2rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.alert {
  padding: 0.9rem 1rem;
  border-radius: 11px;
}

.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.alert-success {
  background: var(--success-soft);
  color: var(--success);
}

.setup-card {
  width: min(760px, 100%);
}

.setup-form,
.setup-links {
  display: grid;
  margin-top: 1.4rem;
  gap: 1rem;
}

.setup-name-grid {
  margin-top: 0;
}

.setup-form input {
  min-height: 45px;
  padding: 0.65rem 0.75rem;
}

.setup-submit {
  justify-self: start;
  margin-top: 0.35rem;
}

.setup-links textarea {
  min-height: 76px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.82rem;
}

.organizer-hero {
  grid-template-columns: minmax(0, 1.6fr) auto;
}

.export-actions {
  display: grid;
  gap: 0.7rem;
}

.organizer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1.5rem;
  gap: 1rem;
}

.participant-card {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 6px 18px rgba(23, 50, 77, 0.045);
}

.participant-card-header {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
  gap: 0.75rem;
}

.participant-card-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.participant-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 1rem 0 0;
  gap: 0.6rem;
}

.participant-stats div {
  padding: 0.65rem;
  border-radius: 10px;
  background: var(--soft);
}

.participant-stats dt {
  color: var(--muted);
  font-size: 0.72rem;
}

.participant-stats dd {
  margin: 0.15rem 0 0;
  color: var(--navy);
  font-weight: 800;
}

.export-guidance {
  margin-top: 1.5rem;
}

@media (max-width: 820px) {
  .hero-panel,
  .organizer-hero,
  .organizer-grid,
  .form-grid,
  .guidance-panel ol {
    grid-template-columns: 1fr;
  }

  .decision-card > summary {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .gate-badge,
  .status-badge {
    grid-column: 2;
    justify-self: start;
  }

  .form-grid-meta {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 15px;
  }

  .topbar-inner,
  .page-shell {
    width: min(100% - 1rem, 1180px);
  }

  .brand > div > span,
  .topbar .button {
    font-size: 0.75rem;
  }

  .topbar .button {
    min-height: 38px;
    padding: 0.5rem 0.65rem;
  }

  .hero-panel,
  .decision-form {
    padding: 1rem;
  }

  .decision-card > summary {
    min-height: 78px;
    padding: 0.85rem;
    gap: 0.7rem;
  }

  .decision-summary-text small {
    display: none;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .participant-stats {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }
}
