:root {
  --bg: #f7f2ea;
  --paper: #fffdf8;
  --paper-strong: #fffefa;
  --paper-soft: #fffaf2;
  --panel: rgba(255, 253, 248, 0.9);
  --bg-top: #fbf7ef;
  --bg-bottom: #f5efe6;
  --ink: #302a22;
  --muted: #6f6256;
  --line: #e6d9c9;
  --accent: #376b5f;
  --accent-strong: #285247;
  --accent-soft: #e3efe9;
  --accent-ghost: rgba(55, 107, 95, 0.14);
  --header-line: rgba(230, 217, 201, 0.85);
  --nav-bg: rgba(255, 253, 248, 0.74);
  --nav-line: rgba(55, 107, 95, 0.22);
  --toolbar-button-bg: #edf3ee;
  --toolbar-button-hover: #dcebe3;
  --weekday-bg: #f4eadc;
  --empty-day-bg: #f6efe5;
  --calendar-active-bg: #fbfff8;
  --input-bg: #fffefa;
  --input-line: #d8c7b6;
  --upload-bg: #e3efe9;
  --upload-line: #cbb9a6;
  --photo-link-bg: #f8f1e8;
  --more-badge-bg: #f1e3ce;
  --warn: #a44d36;
  --success: #28734f;
  --holiday: #c53a3a;
  --holiday-soft: rgba(197, 58, 58, 0.12);
  --shadow: 0 18px 48px rgba(70, 52, 32, 0.12);
}

:root[data-theme="dark"] {
  --bg: #090a0a;
  --paper: #111314;
  --paper-strong: #151819;
  --paper-soft: #171b1c;
  --panel: rgba(17, 19, 20, 0.94);
  --bg-top: #121415;
  --bg-bottom: #050606;
  --ink: #f3f1ea;
  --muted: #a7ada9;
  --line: #262c2a;
  --accent: #8dc1a5;
  --accent-strong: #c4ebd4;
  --accent-soft: rgba(141, 193, 165, 0.16);
  --accent-ghost: rgba(141, 193, 165, 0.14);
  --header-line: rgba(47, 54, 52, 0.9);
  --nav-bg: rgba(20, 23, 24, 0.96);
  --nav-line: rgba(141, 193, 165, 0.24);
  --toolbar-button-bg: #1c2021;
  --toolbar-button-hover: #24292a;
  --weekday-bg: #171b1c;
  --empty-day-bg: #111415;
  --calendar-active-bg: #102019;
  --input-bg: #0e1011;
  --input-line: #313837;
  --upload-bg: #121616;
  --upload-line: #36403e;
  --photo-link-bg: #171b1c;
  --more-badge-bg: #2e2a25;
  --warn: #ff9277;
  --success: #86d7ac;
  --holiday: #ff7878;
  --holiday-soft: rgba(255, 120, 120, 0.18);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, var(--accent-ghost), transparent 34rem),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 44%, var(--bg-bottom) 100%);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", "Apple SD Gothic Neo",
    sans-serif;
  line-height: 1.6;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.site-header {
  padding: 56px 20px 38px;
  border-bottom: 1px solid var(--header-line);
}

.header-inner,
.page-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 780px;
  margin-bottom: 12px;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.lead {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.quick-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  margin-top: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.quick-nav::-webkit-scrollbar {
  display: none;
}

.quick-nav a,
.quick-nav-button {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  white-space: nowrap;
  padding: 9px 13px;
  border: 1px solid var(--nav-line);
  border-radius: 8px;
  background: var(--nav-bg);
  color: var(--accent-strong);
  font-size: 0.94rem;
  font-weight: 800;
  text-decoration: none;
}

.theme-toggle {
  min-width: 0;
  min-height: 42px;
  box-shadow: none;
}

.theme-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.page-shell {
  display: grid;
  gap: 28px;
  padding: 32px 0 56px;
}

.section-block,
.form-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.section-block {
  padding: 24px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
  line-height: 1.25;
}

.section-note {
  max-width: 360px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.loading-note {
  min-height: 1.4em;
  margin: 8px 0 0;
  color: var(--accent-strong);
  font-size: 0.88rem;
  font-weight: 700;
}

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

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

.history-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
}

.history-card-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.history-name {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
}

.history-count {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 800;
}

.history-meta {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.history-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.history-list li {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.history-list li:first-child {
  padding-top: 0;
  border-top: 0;
}

.history-list span,
.history-list p {
  margin: 0;
}

.history-list p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.record-card {
  min-height: 170px;
  padding: 18px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.record-card-button {
  width: 100%;
  min-width: 0;
  min-height: 170px;
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--paper-soft);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.record-card-button:hover {
  border-color: var(--accent);
  background: var(--paper);
  color: var(--ink);
  transform: translateY(-1px);
}

.record-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.record-card h3 {
  margin: 0 0 8px;
  font-size: 1.02rem;
}

.record-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.96rem;
}

.record-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.84rem;
}

.record-hint {
  color: var(--accent-strong);
  font-weight: 800;
}

.record-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
}

.record-tag {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 800;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.calendar-panel,
.reservation-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
}

.calendar-panel {
  overflow: hidden;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.calendar-toolbar strong {
  text-align: center;
  font-size: 1.14rem;
}

.secondary-button {
  min-width: 44px;
  width: 44px;
  min-height: 44px;
  padding: 0;
  background: var(--toolbar-button-bg);
  color: var(--accent-strong);
  font-size: 1.45rem;
}

.secondary-button:hover {
  background: var(--toolbar-button-hover);
}

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

.weekday-row {
  border-bottom: 1px solid var(--line);
  background: var(--weekday-bg);
}

.weekday-row span {
  padding: 10px 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-align: center;
}

.calendar-day {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 104px;
  padding: 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--paper-strong);
}

.calendar-day:nth-child(7n) {
  border-right: 0;
}

.calendar-day.is-empty {
  background: var(--empty-day-bg);
}

.calendar-day.is-today time {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 850;
}

.calendar-day.has-reservation {
  background: var(--calendar-active-bg);
}

.calendar-day.is-holiday {
  background: var(--holiday-soft);
}

.calendar-day.is-holiday time {
  color: var(--holiday);
}

.calendar-day.is-holiday.is-today time {
  background: var(--holiday);
  color: #ffffff;
}

.calendar-day time {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
}

.reservation-badges {
  display: grid;
  gap: 4px;
}

.reservation-badge,
.holiday-badge,
.more-badge {
  min-width: 0;
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.more-badge {
  width: fit-content;
  background: var(--more-badge-bg);
  color: var(--muted);
}

.holiday-badge {
  background: var(--holiday-soft);
  color: var(--holiday);
}

.reservation-panel {
  display: grid;
  gap: 22px;
  padding: 18px;
}

.reservation-panel h3 {
  margin: 0;
  font-size: 1.04rem;
}

.compact-form {
  gap: 14px;
}

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

.compact-submit {
  gap: 12px;
}

.upcoming-box {
  display: grid;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

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

.upcoming-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
}

.upcoming-item strong {
  color: var(--accent-strong);
}

.upcoming-item-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.upcoming-item span,
.upcoming-item p,
.empty-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.text-action-button,
.upcoming-lock {
  flex: 0 0 auto;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.2;
}

.text-action-button {
  cursor: pointer;
}

.text-action-button:hover {
  background: transparent;
  color: var(--accent);
  transform: none;
  text-decoration: underline;
}

.text-action-button:disabled {
  opacity: 0.6;
}

.upcoming-lock {
  color: var(--muted);
}

.form-card {
  padding: 28px;
}

.form-heading {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

form {
  display: grid;
  gap: 22px;
}

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

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

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

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field span {
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 750;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--input-line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--ink);
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

input {
  min-height: 46px;
  padding: 10px 12px;
  min-width: 0;
}

input[type="date"] {
  max-width: 100%;
  min-width: 0;
  padding-right: 8px;
}

input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  margin-left: 4px;
}

textarea {
  min-height: 112px;
  resize: vertical;
  padding: 12px;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  background: var(--paper);
  box-shadow: 0 0 0 4px var(--accent-ghost);
}

.upload-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px dashed var(--upload-line);
  border-radius: 8px;
  background: var(--upload-bg);
}

.file-field {
  flex: 1;
}

.photo-count {
  min-width: 160px;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: right;
}

.submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.status-message {
  min-height: 1.5em;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.status-message.success {
  color: var(--success);
}

.status-message.error {
  color: var(--warn);
}

.detail-modal[hidden] {
  display: none;
}

.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  width: auto;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(32, 25, 18, 0.48);
}

.detail-backdrop:hover {
  background: rgba(32, 25, 18, 0.48);
  transform: none;
}

.detail-dialog {
  position: relative;
  z-index: 1;
  width: min(880px, 100%);
  max-height: min(88vh, 920px);
  padding: 24px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 22px 60px rgba(38, 30, 21, 0.22);
}

.detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.detail-close {
  flex: none;
}

.history-dialog {
  width: min(980px, 100%);
}

.history-toolbar {
  align-items: start;
}

.history-modal-note {
  max-width: none;
  margin-bottom: 18px;
}

.detail-header h2 {
  margin-bottom: 8px;
  font-size: 1.45rem;
}

.detail-header-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.detail-header-top h2 {
  margin-bottom: 0;
}

.detail-delete-button {
  width: auto;
}

.detail-range,
.detail-created {
  margin-bottom: 0;
  color: var(--muted);
}

.detail-created {
  margin-top: 8px;
  font-size: 0.92rem;
}

.detail-sections {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.detail-section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-soft);
}

.detail-section h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.detail-section p {
  margin-bottom: 0;
  white-space: pre-wrap;
}

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

.detail-photo-link {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--photo-link-bg);
  text-decoration: none;
}

.detail-photo-link img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

button {
  min-width: 132px;
  min-height: 48px;
  padding: 12px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  transition:
    background-color 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

@media (max-width: 940px) {
  .calendar-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .site-header {
    padding-top: 42px;
  }

  .section-heading,
  .submit-row,
  .upload-box,
  .record-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .section-note {
    max-width: none;
  }

  .records-grid,
  .history-grid,
  .form-grid,
  .textarea-grid,
  .compact-grid {
    grid-template-columns: 1fr;
  }

  .photo-count {
    min-width: 0;
    text-align: left;
  }

  .record-tags {
    justify-content: start;
  }

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

  .detail-header-top {
    flex-direction: column;
    align-items: stretch;
  }

  button {
    width: 100%;
  }

  .text-action-button {
    width: auto;
  }

  .secondary-button {
    width: 44px;
  }
}

@media (max-width: 520px) {
  .header-inner,
  .page-shell {
    width: min(100% - 24px, 1080px);
  }

  .section-block,
  .form-card {
    padding: 18px;
  }

  h1 {
    font-size: 2.2rem;
  }

  .calendar-toolbar {
    grid-template-columns: 40px 1fr 40px;
    gap: 8px;
    padding: 12px;
  }

  .calendar-toolbar strong {
    font-size: 1rem;
  }

  input[type="date"] {
    padding: 10px 8px;
    font-size: 0.95rem;
  }

  .calendar-day {
    gap: 4px;
    min-height: 74px;
    padding: 6px 4px 5px;
  }

  .calendar-day time {
    font-size: 0.78rem;
  }

  .calendar-day.is-today time {
    width: 22px;
    height: 22px;
  }

  .weekday-row span {
    padding: 8px 0 7px;
    font-size: 0.73rem;
  }

  .reservation-badges {
    gap: 3px;
  }

  .reservation-badge,
  .holiday-badge,
  .more-badge {
    padding: 2px 4px;
    font-size: 0.62rem;
    line-height: 1.2;
    border-radius: 5px;
    text-align: center;
  }

  .secondary-button {
    min-width: 40px;
    width: 40px;
    min-height: 40px;
    font-size: 1.2rem;
  }

  .detail-modal {
    padding: 12px;
  }

  .detail-dialog {
    padding: 18px;
  }

  .detail-photo-grid {
    grid-template-columns: 1fr;
  }

  .theme-toggle {
    width: auto;
  }

  .upcoming-item-top {
    align-items: center;
  }

  .quick-nav {
    gap: 8px;
    margin-top: 20px;
  }

  .quick-nav a,
  .quick-nav-button {
    padding: 8px 11px;
    font-size: 0.88rem;
  }
}
