:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1a1f2e;
  --muted: #5c667a;
  --border: #d8dee9;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #047857;
  --error: #b91c1c;
  --warning: #b45309;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

body.menu-open {
  overflow: hidden;
}

.app-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* ── Hero main ── */
.hero-skeleton {
  min-height: 100dvh;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #7c3aed 100%);
}
.hero {
  position: relative;
  min-height: 100dvh;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #7c3aed 100%);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: #fff;
  padding: 24px;
  max-width: 640px;
}

.hero-eyebrow {
  font-size: 0.95rem;
  opacity: 0.9;
  margin: 0 0 8px;
}

.hero-title {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  margin: 0 0 12px;
  font-weight: 700;
}

.hero-deadline {
  font-size: 0.95rem;
  opacity: 0.85;
  margin: 0 0 16px;
}

.hero-status {
  font-size: 0.9rem;
  opacity: 0.85;
  margin: 0 0 16px;
}

.hero-menu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  max-width: 520px;
  margin: 0 auto 12px;
}

.hero-menu[hidden] {
  display: none !important;
}

.hero-menu .menu-box {
  min-height: 110px;
}

.hero .offline-hint {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.8rem;
  margin: 8px 0 0;
}

.admin-link {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 1.4rem;
  padding: 8px;
}

/* ── Menu overlay ── */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.menu-overlay[hidden] {
  display: none !important;
}

.menu-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.menu-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 24px 20px 32px;
  box-shadow: var(--shadow);
  max-height: 85dvh;
  overflow-y: auto;
}

.menu-close {
  position: absolute;
  top: 12px;
  right: 16px;
  border: none;
  background: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--muted);
}

.menu-panel h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
}

.menu-hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 20px;
}

.menu-boxes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.menu-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fafc;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color 0.15s, transform 0.15s;
}

.menu-box:hover:not(.disabled) {
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.menu-box.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.menu-box-icon {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.menu-box strong {
  font-size: 1.05rem;
}

.menu-box span:last-child {
  font-size: 0.85rem;
  color: var(--muted);
}

.offline-hint {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

/* ── Panel / forms ── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.panel-header h2 {
  margin: 4px 0 0;
}

.eyebrow {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.hint {
  color: var(--muted);
  margin: 8px 0 0;
  font-size: 0.92rem;
}

.banner.warning {
  padding: 12px;
  border-radius: 10px;
  background: #fff7ed;
  color: var(--warning);
  border: 1px solid #fed7aa;
  margin-bottom: 16px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field span em {
  color: var(--error);
  font-style: normal;
}

.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin: 16px 0 12px;
  flex-wrap: wrap;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.notice-slot {
  margin: 16px 0;
}

.notice-slot[hidden] {
  display: none !important;
}

.notice-box {
  padding: 14px 16px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  line-height: 1.6;
  word-break: keep-all;
}

.field-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}

.notice-preview {
  min-height: 48px;
}

.notice-preview-empty .hint {
  margin: 0;
  color: var(--muted);
}

.color-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-pick-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.color-pick-btn.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
}

.size-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.size-pick-btn {
  min-width: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  cursor: pointer;
}

.size-pick-btn.active {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
  font-weight: 600;
}

.grid-host {
  width: 100%;
  height: 400px;
}

/* AG Grid — 신청/수정 명단 칸 구분선 */
.grid-host.ag-theme-quartz {
  --ag-border-color: #c5cdd8;
  --ag-row-border-color: #c5cdd8;
  --ag-header-background-color: #eef2f7;
  --ag-header-foreground-color: #1a1f2e;
  --ag-odd-row-background-color: #fafbfc;
  --ag-cell-horizontal-border: solid #c5cdd8;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.grid-host.ag-theme-quartz .ag-header-cell,
.grid-host.ag-theme-quartz .ag-cell {
  border-right: 1px solid #c5cdd8;
}

.grid-host.ag-theme-quartz .ag-row {
  border-bottom: 1px solid #c5cdd8;
}

.grid-host.ag-theme-quartz .ag-header-cell-label {
  font-weight: 600;
}

.verify-box {
  padding: 16px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.form-actions {
  margin-top: 20px;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font: inherit;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #e2e8f0;
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding-left: 0;
}

.status {
  margin-top: 16px;
  min-height: 1.4em;
}

.status.error {
  color: var(--error);
}

.status.success {
  color: var(--success);
}

.success-box {
  padding: 20px;
  border-radius: 12px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  margin-top: 16px;
}

.success-box h3 {
  margin: 0 0 8px;
  color: var(--success);
}

.preview-dialog {
  border: none;
  border-radius: 16px;
  padding: 24px;
  max-width: 90vw;
  max-height: 80vh;
  overflow: auto;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 12px 0;
}

.preview-table th,
.preview-table td {
  border: 1px solid var(--border);
  padding: 8px;
}

.preview-table th {
  background: #f1f5f9;
}

/* ── Admin ── */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.create-event-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: #f8fafc;
  margin-bottom: 4px;
}

.create-event-box .hint {
  margin: 0;
}

.sheet-link-box {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.sheet-open-btn {
  text-decoration: none;
}

.sheet-id-hint {
  margin: 0;
  word-break: break-all;
}

.sheet-id-hint code {
  font-size: 0.85rem;
  color: var(--muted, #64748b);
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.admin-tab {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
  font: inherit;
}

.admin-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr 80px 70px 60px 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.field-row input,
.field-row select {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  min-width: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 16px;
  border-radius: 12px;
  background: #f1f5f9;
  text-align: center;
}

.stat-card strong {
  display: block;
  font-size: 1.6rem;
  color: var(--primary);
}

.stat-card span {
  font-size: 0.85rem;
  color: var(--muted);
}

[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .field-row {
    grid-template-columns: 1fr 1fr;
  }

  .grid-host {
    height: 320px;
  }
}
