:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --paper: #ffffff;
  --ink: #16202a;
  --muted: #657180;
  --line: #d9dee5;
  --accent: #0f8b8d;
  --accent-strong: #0b6769;
  --signal: #d75f3f;
  --signal-soft: #fff0eb;
  --mint-soft: #e8f7f4;
  --blue-soft: #edf3ff;
  --shadow: 0 18px 45px rgba(22, 32, 42, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(15, 139, 141, 0.08), transparent 260px),
    var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
}

.gate-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 440px);
  gap: 32px;
  align-items: center;
  min-height: 100vh;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 40px 0;
}

.gate-visual {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 28px;
  align-items: center;
}

.brand-mark {
  width: 112px;
  height: 112px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2.7rem, 6vw, 5.6rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.gate-copy {
  max-width: 620px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.gate-panel {
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding: 4px;
  margin-bottom: 24px;
  background: #eef1f4;
  border-radius: 8px;
}

.tab {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.tab.is-active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(22, 32, 42, 0.12);
}

.gate-form {
  display: grid;
  gap: 16px;
}

.gate-form h2 {
  margin: 0 0 2px;
  font-size: 1.55rem;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 13px 14px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 139, 141, 0.15);
}

.primary-button,
.ghost-button,
.danger-button,
.text-button {
  min-height: 44px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.ghost-button,
.text-button {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.danger-button {
  border: 1px solid var(--signal);
  background: var(--signal-soft);
  color: var(--signal);
}

.form-note {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.is-hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(190px, auto) 1fr 48px;
  gap: 20px;
  align-items: center;
  min-height: 70px;
  padding: 0 max(20px, calc((100vw - 1240px) / 2));
  background: rgba(246, 247, 249, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand-link {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font-size: 1rem;
  font-weight: 900;
}

.brand-link img {
  width: 34px;
  height: 34px;
}

.topnav {
  display: inline-flex;
  gap: 8px;
  justify-content: center;
}

.topnav a {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
}

.topnav a:hover {
  background: var(--paper);
  color: var(--ink);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1.2rem;
}

.portal {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 48px;
}

.intro-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding: 34px 0 28px;
}

.intro-band h1 {
  max-width: 780px;
  font-size: clamp(2.1rem, 4.5vw, 4.4rem);
}

.session-chip {
  justify-self: end;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--muted);
  font-weight: 750;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.sidebar {
  position: sticky;
  top: 88px;
  display: grid;
  gap: 14px;
}

.sidebar-header {
  display: grid;
  gap: 12px;
}

.sidebar h2,
.meeting-view h2 {
  margin: 0;
  font-size: 1.3rem;
}

.meeting-list {
  display: grid;
  gap: 10px;
}

.meeting-card {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  text-align: left;
}

.meeting-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 139, 141, 0.12);
}

.meeting-card strong {
  font-size: 1rem;
}

.meta-row,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: #254369;
  font-size: 0.78rem;
  font-weight: 800;
}

.meeting-view {
  display: grid;
  gap: 18px;
}

.hero-strip,
.content-section,
.member-section,
.request-section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hero-strip {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.hero-strip h2 {
  font-size: clamp(1.8rem, 3vw, 3.1rem);
  line-height: 1.06;
}

.hero-summary {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 1.25rem;
}

.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.section-tabs button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--muted);
  font-weight: 800;
}

.section-tabs button.is-active {
  border-color: var(--accent);
  background: var(--mint-soft);
  color: var(--accent-strong);
}

.content-section {
  padding: 22px;
}

.content-grid {
  display: grid;
  gap: 14px;
}

.overview-stack,
.action-panel {
  display: grid;
  gap: 18px;
}

.chapter-list,
.flow-list {
  display: grid;
  gap: 12px;
}

.highlight-grid,
.next-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.highlight-card,
.next-card,
.map-card,
.chapter-card,
.arc-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.highlight-card span,
.next-card span,
.map-index,
.detail-label,
.chapter-head span,
.arc-card span {
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 900;
}

.highlight-card strong,
.next-card strong,
.map-card strong,
.chapter-card strong {
  color: var(--ink);
  line-height: 1.5;
}

.arc-card {
  background: var(--mint-soft);
}

.arc-card p {
  margin: 0;
  color: var(--ink);
  line-height: 1.68;
}

.map-board {
  display: grid;
  gap: 16px;
}

.map-center {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--mint-soft);
}

.map-center span {
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 900;
}

.map-center strong {
  font-size: 1.2rem;
  line-height: 1.45;
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-row button {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  font-weight: 800;
}

.topic-item,
.flow-item,
.reflection-item,
.member-item,
.request-item {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.topic-item:last-child,
.flow-item:last-child,
.reflection-item:last-child,
.member-item:last-child,
.request-item:last-child {
  border-bottom: 0;
}

.topic-item h3,
.flow-item h3,
.reflection-item h3,
.next-card h3,
.map-card h3,
.chapter-card h3,
.member-item h3,
.request-item h3 {
  margin: 0;
  font-size: 1.02rem;
}

.topic-item p,
.flow-item p,
.reflection-item p,
.next-card p,
.map-card p,
.chapter-card p,
.member-item p,
.request-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.62;
}

.chapter-card {
  background: #fff;
}

.chapter-head {
  display: grid;
  gap: 6px;
}

.chapter-gist {
  color: var(--ink) !important;
  font-weight: 700;
}

.moment-list {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-left: 3px solid var(--line);
  background: #fbfcfd;
}

.flow-item {
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: start;
}

.timeline-time {
  color: var(--signal);
  font-size: 0.82rem;
  font-weight: 900;
}

.quote-line {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: var(--mint-soft);
  color: var(--ink);
  line-height: 1.62;
}

.evidence-line {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  color: var(--ink) !important;
  font-weight: 700;
}

.subhead {
  margin: 4px 0 -6px;
  font-size: 1.05rem;
}

.member-section,
.request-section {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 880px) {
  .gate-layout,
  .workspace-grid,
  .intro-band {
    grid-template-columns: 1fr;
  }

  .gate-visual {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .brand-mark {
    width: 76px;
    height: 76px;
  }

  .topbar {
    grid-template-columns: 1fr 48px;
  }

  .topnav {
    grid-column: 1 / -1;
    justify-content: start;
    overflow-x: auto;
    padding-bottom: 10px;
  }

  .session-chip {
    justify-self: start;
  }

  .sidebar {
    position: static;
  }

  .highlight-grid,
  .next-grid,
  .map-grid {
    grid-template-columns: 1fr;
  }

  .flow-item {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .gate-layout,
  .portal {
    width: min(100% - 24px, 1240px);
  }

  .gate-panel,
  .hero-strip,
  .content-section,
  .member-section,
  .request-section {
    padding: 16px;
  }

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