:root {
  --primary: #0b57d0;
  --primary-strong: #0842a0;
  --primary-soft: #d3e3fd;
  --surface: #fbfcff;
  --surface-alt: #f3f6fb;
  --panel: #ffffff;
  --text: #1f2328;
  --muted: #5f6673;
  --line: #d8dee8;
  --danger: #b3261e;
  --success: #1b873f;
  --warning: #8a5a00;
  --shadow: 0 14px 34px rgba(20, 34, 66, 0.10);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans KR", "Segoe UI", system-ui, sans-serif;
  background: var(--surface);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  min-height: 0;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: #f8fafd;
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.brand span,
.account-mini span,
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
}

.nav-item {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 700;
}

.account-mini {
  flex: 0 0 auto;
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.account-mini strong {
  display: block;
  margin: 4px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-login-button {
  width: 100%;
  min-height: 34px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.main {
  min-width: 0;
  background: var(--surface);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 76px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 252, 255, 0.92);
  backdrop-filter: blur(12px);
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: 22px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-button {
  display: none;
}

.server-status {
  min-width: 88px;
  color: var(--muted);
  font-size: 13px;
}

.view {
  display: none;
  padding: 28px 32px 48px;
}

.view.active {
  display: block;
}

.hero {
  max-width: 960px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero h2 {
  max-width: 760px;
  margin: 8px 0 24px;
  font-size: 34px;
  line-height: 1.25;
}

.summary-form {
  display: grid;
  gap: 14px;
}

.summary-form input[type="url"],
.category-row select,
.search-input,
.schedule-form input,
.schedule-form select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  color: var(--text);
}

.density-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.density-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.category-row label {
  display: grid;
  gap: 6px;
  max-width: 260px;
  color: var(--muted);
  font-size: 13px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.ghost-button,
.text-button,
.secondary-button,
.danger-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
}

.primary-button {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.ghost-button {
  border-color: var(--line);
  background: #fff;
  color: var(--primary);
}

.text-button {
  background: transparent;
  color: var(--primary);
}

.secondary-button {
  border-color: #f0d48a;
  background: #fff9e6;
  color: #8a5d00;
}

.danger-button {
  border-color: #f1c7c3;
  background: #fff7f6;
  color: var(--danger);
}

.confirm-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.38);
}

.confirm-layer[hidden] {
  display: none;
}

.confirm-dialog {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: #fff;
  box-shadow: var(--shadow);
}

.confirm-dialog h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.confirm-dialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.confirm-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.form-status {
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
}

.muted-text {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 960px;
  margin: 20px 0;
}

.metric,
.panel,
.help-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric {
  padding: 18px;
}

.metric span,
.account-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.section-block {
  max-width: 960px;
}

.transcript-panel {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.transcript-box {
  max-height: 360px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: keep-all;
  line-height: 1.7;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f7f9fc;
  color: var(--text);
  font-family: "Noto Sans KR", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2,
.section-head h3 {
  margin: 0;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(420px, 1.15fr);
  gap: 18px;
}

.panel {
  min-width: 0;
  padding: 20px;
}

.summary-list,
.reservation-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.summary-card,
.reservation-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.summary-card.selected {
  border-color: var(--primary);
  background: #f5f9ff;
}

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

.detail-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge,
.limit-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.badge.ok {
  background: #dff5e6;
  color: var(--success);
}

.badge.warn {
  background: #fff0cf;
  color: var(--warning);
}

.badge.error {
  background: #fde7e9;
  color: var(--danger);
}

.summary-card h3,
.reservation-card h3 {
  margin: 0;
  font-size: 16px;
}

.summary-card p,
.reservation-card p,
.help-card p,
.account-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.summary-card .summary-meta {
  font-size: 12px;
}

.detail-panel {
  min-height: 520px;
}

.empty-state {
  display: grid;
  min-height: 280px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.detail-content {
  display: grid;
  gap: 18px;
}

.detail-content h2 {
  margin: 0;
}

.detail-section {
  display: grid;
  gap: 8px;
}

.detail-section h3 {
  margin: 0;
  font-size: 15px;
}

.detail-section ul {
  margin: 0;
  padding-left: 20px;
}

.stt-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.stt-progress p {
  grid-column: 1 / -1;
  margin: 0;
}

.stt-progress progress {
  width: 100%;
  height: 8px;
}

.note-text {
  white-space: pre-wrap;
}

.tts-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.prompt-debug-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f7f9fc;
}

.prompt-debug-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.prompt-debug-head h3,
.prompt-debug-head p {
  margin: 0;
}

.info-mark {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.inline-info {
  display: inline-grid;
  margin-left: 6px;
  vertical-align: middle;
}

.checkbox-fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.checkbox-fieldset legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.checkbox-fieldset label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.checkbox-fieldset input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
}

.reservation-history-panel {
  grid-column: 1 / -1;
}

.error-detail-section {
  border-color: #f2b8b5;
  background: #fff7f7;
}

.error-detail-text {
  white-space: pre-wrap;
  color: #9f1d1d;
}

.prompt-debug-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.prompt-debug-item + .prompt-debug-item {
  margin-top: 10px;
}

.prompt-debug-item summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 700;
}

.prompt-debug-item h4 {
  margin: 12px 0 6px;
  font-size: 13px;
}

.prompt-usage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.prompt-usage-grid div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.prompt-usage-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.prompt-usage-grid strong {
  display: block;
  margin-top: 4px;
}

.prompt-cost {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.prompt-debug-item pre {
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: keep-all;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcff;
  color: var(--text);
  font-family: "Noto Sans KR", "Segoe UI", system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.6;
}

.schedule-form {
  display: grid;
  gap: 12px;
}

.schedule-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 980px;
}

.help-card {
  padding: 22px;
}

.help-card h2 {
  margin: 0 0 10px;
}

.account-panel {
  max-width: 760px;
}

.login-panel {
  max-width: 560px;
}

.auth-actions,
.email-auth-form {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.email-auth-form input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

.admin-shell {
  min-height: 100vh;
  background: var(--surface);
}

.admin-login-panel {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  position: sticky;
  top: 0;
}

.admin-main {
  min-height: 100vh;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.admin-table th {
  color: var(--muted);
  font-size: 13px;
}

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

.account-grid div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.account-grid strong {
  display: block;
  margin-top: 6px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .sidebar.open {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    display: flex;
    width: 280px;
    box-shadow: var(--shadow);
  }

  .menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .topbar {
    padding: 0 16px;
  }

  .topbar-actions {
    display: none;
  }

  .view {
    padding: 18px 16px 32px;
  }

  .hero {
    padding: 22px;
  }

  .hero h2 {
    font-size: 26px;
  }

  .metrics-grid,
  .split-layout,
  .help-grid,
  .account-grid,
  .prompt-usage-grid {
    grid-template-columns: 1fr;
  }
}
