:root {
  --background: #f8f5ef;
  --background-end: #efe8dc;
  --surface: #fffefa;
  --surface-soft: #f4efe6;
  --ink: #211e1a;
  --text: #2d2924;
  --muted: #7d746a;
  --faint: #aaa095;
  --line: #ded4c6;
  --line-strong: #c9b9a6;
  --accent: #806343;
  --accent-deep: #2a241d;
  --gold: #a38352;
  --sage: #707766;
  --danger: #963f35;
  --shadow: 0 28px 72px rgba(42, 36, 29, 0.075);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(130, 109, 83, 0.035) 1px, transparent 1px) 0 0 / 80px 80px,
    linear-gradient(180deg, var(--background) 0%, var(--background-end) 100%);
  overflow-x: hidden;
  font-family: "Noto Sans JP", "Zen Kaku Gothic New", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button,
input,
select,
textarea {
  font: inherit;
  min-width: 0;
  max-width: 100%;
  font-weight: 400;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 620px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 14px 40px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(201, 185, 166, 0.58);
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--accent-deep);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: rgba(255, 254, 250, 0.72);
  font-family: "Shippori Mincho", "Noto Serif JP", serif;
  font-size: 17px;
  font-weight: 500;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-name {
  margin: 0;
  color: var(--ink);
  font-family: "Shippori Mincho", "Noto Serif JP", serif;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.25;
}

.brand-subtitle {
  margin: 0;
  color: var(--muted);
  font-family: "Cormorant Garamond", serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.1;
}

.screen {
  animation: fade-in 460ms ease both;
  min-width: 0;
}

.card {
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  border: 1px solid rgba(201, 185, 166, 0.84);
  border-radius: 3px;
  background: rgba(255, 254, 250, 0.94);
  box-shadow: var(--shadow);
}

.card-section {
  position: relative;
  min-width: 0;
  padding: 30px 22px;
}

.card-section + .card-section {
  border-top: 1px solid rgba(222, 212, 198, 0.88);
}

.card-section:first-child::before {
  position: absolute;
  top: 0;
  left: 22px;
  width: 56px;
  height: 1px;
  background: var(--accent);
  content: "";
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: "Cormorant Garamond", serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.page-title {
  width: 100%;
  max-width: min(100%, 12.8em);
  margin: 0;
  color: var(--ink);
  font-family: "Shippori Mincho", "Noto Serif JP", serif;
  font-size: clamp(24px, 6vw, 31px);
  font-weight: 500;
  line-height: 1.5;
  line-break: strict;
  overflow-wrap: anywhere;
  white-space: pre-line;
  word-break: break-all;
}

.page-lead {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 2;
}

.form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.field-label {
  color: #332d26;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}

.field-note {
  color: var(--muted);
  font-size: 11px;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid rgba(201, 185, 166, 0.86);
  border-radius: 2px;
  background: #fffdf8;
  color: var(--text);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.input,
.select {
  min-height: 47px;
  padding: 0 13px;
}

.input[type="date"],
.input[type="datetime-local"],
.input[type="time"] {
  appearance: none;
  min-width: 0;
}

.textarea {
  min-height: 108px;
  padding: 13px;
  resize: vertical;
  line-height: 1.75;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(128, 99, 67, 0.7);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(128, 99, 67, 0.095);
}

.input[aria-invalid="true"],
.select[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: rgba(150, 63, 53, 0.68);
}

.error-text {
  color: var(--danger);
  font-size: 12px;
  line-height: 1.7;
}

.button-row {
  display: grid;
  gap: 12px;
}

.button-block {
  margin-top: 16px;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 2px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.button:not(:disabled):active {
  transform: translateY(1px);
}

.button-primary {
  border-color: var(--accent-deep);
  background: var(--accent-deep);
  color: #fffaf0;
  box-shadow: 0 16px 32px rgba(42, 36, 29, 0.12);
}

.button-primary:not(:disabled):hover {
  background: #17140f;
  box-shadow: 0 18px 38px rgba(42, 36, 29, 0.16);
}

.button-secondary {
  border-color: var(--line-strong);
  background: rgba(255, 253, 248, 0.78);
  color: var(--accent-deep);
}

.button-secondary:not(:disabled):hover {
  border-color: var(--accent);
  background: #ffffff;
}

.button-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.button-small {
  min-height: 38px;
  padding: 0 12px;
  font-size: 12px;
}

.summary-list {
  display: grid;
  gap: 13px;
  margin: 0;
}

.summary-row {
  display: grid;
  grid-template-columns: 102px 1fr;
  gap: 12px;
  align-items: baseline;
}

.summary-row dt {
  color: var(--muted);
  font-size: 11px;
}

.summary-row dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.8;
}

.link-box {
  display: grid;
  gap: 12px;
}

.generated-link {
  display: block;
  width: 100%;
  min-height: 84px;
  border: 1px solid rgba(201, 185, 166, 0.84);
  border-radius: 2px;
  padding: 14px;
  background: #fbf7ef;
  color: #4a4239;
  font-size: 13px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  user-select: all;
}

.generated-link-anchor {
  color: var(--accent-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.share-actions {
  display: grid;
  gap: 10px;
}

.share-actions .button {
  width: 100%;
}

.candidate-list {
  display: grid;
  gap: 12px;
}

.candidate-window {
  display: grid;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  gap: 12px;
  border: 1px solid rgba(201, 185, 166, 0.72);
  border-radius: 2px;
  padding: 14px;
  background: rgba(255, 253, 248, 0.62);
}

.candidate-window-head {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.candidate-time-grid {
  display: grid;
  min-width: 0;
  gap: 12px;
}

.candidate-time-grid > .field {
  min-width: 0;
}

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

.choice {
  display: grid;
  grid-template-columns: auto 1fr;
  min-width: 0;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(201, 185, 166, 0.84);
  border-radius: 2px;
  padding: 14px;
  background: #fffdf8;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.choice:has(input:checked) {
  border-color: rgba(128, 99, 67, 0.78);
  background: #fbf7ef;
  box-shadow: inset 3px 0 0 var(--accent);
}

.choice > input[type="radio"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent-deep);
}

.choice-text {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.7;
}

.choice-with-time {
  grid-template-columns: auto 1fr;
}

.choice-time {
  display: grid;
  grid-column: 1 / -1;
  min-width: 0;
  gap: 8px;
}

.notice {
  border: 1px solid rgba(201, 185, 166, 0.72);
  border-radius: 2px;
  padding: 16px;
  background: rgba(244, 239, 230, 0.72);
  color: #5b5147;
  font-size: 12px;
  line-height: 1.9;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.admin-metric {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(201, 185, 166, 0.72);
  border-radius: 2px;
  padding: 14px 12px;
  background: rgba(255, 253, 248, 0.68);
}

.admin-metric-value {
  color: var(--ink);
  font-family: "Cormorant Garamond", serif;
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
}

.admin-metric-label {
  color: var(--muted);
  font-size: 11px;
}

.admin-section {
  display: grid;
  gap: 12px;
}

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

.admin-item {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(201, 185, 166, 0.72);
  border-radius: 2px;
  padding: 14px;
  background: rgba(255, 253, 248, 0.72);
}

.admin-item-title,
.admin-item-meta,
.admin-item-detail {
  margin: 0;
}

.admin-item-title {
  color: var(--ink);
  font-family: "Shippori Mincho", "Noto Serif JP", serif;
  font-size: 15px;
  line-height: 1.55;
}

.admin-item-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.admin-item-detail {
  margin-top: 7px;
  color: #4d453c;
  font-size: 12px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(320px, calc(100vw - 36px));
  border: 1px solid rgba(201, 185, 166, 0.42);
  border-radius: 2px;
  padding: 13px 15px;
  background: rgba(33, 30, 26, 0.96);
  color: #fffaf0;
  box-shadow: 0 18px 40px rgba(42, 36, 29, 0.18);
  font-size: 12px;
  animation: toast-in 240ms ease both;
}

.footer-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-family: "Shippori Mincho", "Noto Serif JP", serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.8;
  text-align: center;
}

[hidden] {
  display: none !important;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 720px) {
  .app-shell {
    padding-top: 46px;
  }

  .card-section {
    padding: 36px 34px;
  }

  .card-section:first-child::before {
    left: 34px;
  }

  .button-row {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

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

  .candidate-time-grid-guest {
    grid-template-columns: minmax(0, 1.2fr) minmax(126px, 0.9fr) minmax(126px, 0.9fr);
  }

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

  .choice-time {
    grid-column: 2;
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding: 22px 11px 40px;
  }

  .brand {
    margin-bottom: 18px;
  }

  .card-section {
    padding: 26px 17px;
  }

  .card-section:first-child::before {
    left: 17px;
  }

  .page-title {
    max-width: min(100%, 12.2em);
    font-size: 21px;
    line-height: 1.65;
  }

  .admin-metrics {
    grid-template-columns: 1fr;
  }
}
