:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --line: #d9dee7;
  --text: #172033;
  --muted: #667085;
  --primary: #126b5f;
  --primary-soft: #e6f3ef;
  --deadline: #d92d20;
  --start: #2563eb;
  --saved: #16a34a;
  --always: #8a5cf6;
  font-family: Arial, "Noto Sans KR", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

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

.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  padding: 18px 16px 88px;
}

.top-bar,
.section-heading,
.filter-row,
.summary-strip,
.bottom-nav,
.benefit-head,
.status-row,
.dialog-head {
  display: flex;
  align-items: center;
}

.top-bar,
.section-heading,
.benefit-head,
.status-row,
.dialog-head {
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

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

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 16px;
}

.icon-button,
.month-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--deadline);
  font-weight: 800;
}

.icon-button.small {
  width: 34px;
  height: 34px;
  color: var(--muted);
}

.search-panel,
.view,
.info-panel {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.search-box,
.profile-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-box input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.search-box input {
  height: 44px;
  padding: 0 12px;
  font-size: 15px;
}

.filter-row {
  gap: 8px;
  margin-top: 10px;
}

select {
  height: 40px;
  padding: 0 10px;
}

.summary-strip {
  gap: 8px;
  margin-top: 12px;
}

.summary-strip article {
  flex: 1;
  min-width: 0;
  padding: 12px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.summary-strip strong,
.summary-strip span {
  display: block;
}

.summary-strip strong {
  font-size: 20px;
}

.summary-strip span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.section-heading.compact {
  margin-bottom: 12px;
}

.below-calendar {
  margin-top: 16px;
}

.month-button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 24px;
}

.text-button {
  border: 0;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 8px;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
}

.legend,
.weekday-grid,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.dot.start {
  background: var(--start);
}

.dot.deadline {
  background: var(--deadline);
}

.dot.saved {
  background: var(--saved);
}

.dot.always {
  background: var(--always);
}

.weekday-grid {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.weekday-grid span {
  padding: 6px 0;
}

.calendar-grid {
  gap: 4px;
}

.day-cell {
  min-height: 54px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text);
  padding: 6px 4px;
  text-align: left;
  cursor: pointer;
}

.day-cell.is-muted {
  opacity: 0.35;
}

.day-cell.is-today {
  border-color: var(--primary);
}

.day-cell.is-selected {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.day-number {
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.day-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 7px;
}

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

.benefit-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.benefit-card h3 {
  line-height: 1.35;
}

.badge {
  flex: 0 0 auto;
  min-width: 46px;
  height: 26px;
  border-radius: 999px;
  padding: 5px 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.badge.deadline {
  background: var(--deadline);
}

.badge.start {
  background: var(--start);
}

.badge.always {
  background: var(--always);
}

.benefit-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.score {
  color: var(--primary);
}

.status-row {
  margin-top: 10px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.benefit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.benefit-actions.stacked {
  grid-template-columns: 1fr;
}

.benefit-actions button,
.primary-link {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}

.benefit-actions button.primary,
.primary-link {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.profile-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.info-panel {
  margin-top: 10px;
}

.info-panel p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.legal-links {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.legal-links a,
.back-link {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  border-radius: 8px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 800;
}

.document-page {
  padding-bottom: 24px;
}

.check-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.empty-state {
  padding: 22px 10px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.detail-dialog {
  width: min(calc(100% - 28px), 460px);
  max-height: calc(100vh - 36px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--text);
}

.detail-dialog::backdrop {
  background: rgb(23 32 51 / 50%);
}

.detail-summary {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.detail-grid {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.detail-grid div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background: #f8fafc;
}

.detail-grid dt {
  color: var(--muted);
  font-weight: 700;
}

.detail-grid dd {
  margin: 0;
}

.source-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.source-list article {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.source-list strong {
  color: var(--text);
  line-height: 1.4;
}

.source-list span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  width: min(100%, 480px);
  margin: 0 auto;
  height: 68px;
  border-top: 1px solid var(--line);
  background: #fff;
  justify-content: space-around;
  z-index: 5;
}

.bottom-nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.bottom-nav button.active {
  color: var(--primary);
}

@media (min-width: 900px) {
  .app-shell {
    width: min(100%, 980px);
    display: grid;
    grid-template-columns: 1fr 390px;
    gap: 16px;
    align-items: start;
  }

  .top-bar,
  .search-panel,
  .summary-strip {
    grid-column: 1 / -1;
  }

  .view.is-active {
    grid-column: 1 / -1;
  }

  .calendar-section.is-active {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 16px;
  }

  .calendar-section .section-heading:first-child,
  .calendar-section .legend,
  .calendar-section .weekday-grid,
  .calendar-section .calendar-grid {
    grid-column: 1;
  }

  .below-calendar,
  #benefitList {
    grid-column: 2;
  }

  .below-calendar {
    margin-top: 0;
  }

  .bottom-nav {
    width: min(100%, 980px);
  }
}
