:root {
  --bg: #07141f;
  --surface: rgba(13, 31, 44, 0.86);
  --surface-strong: #0f2331;
  --surface-soft: #132b3b;
  --line: rgba(130, 176, 190, 0.18);
  --line-strong: rgba(109, 216, 208, 0.4);
  --text: #eef7f7;
  --muted: #8fa8b3;
  --teal: #58dfcf;
  --teal-deep: #1e9d9b;
  --danger: #ff747c;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 5%, rgba(25, 104, 119, 0.16), transparent 35%),
    linear-gradient(160deg, #07141f 0%, #091824 48%, #06121b 100%);
  font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
  letter-spacing: -0.02em;
}

button, input { font: inherit; }
button { cursor: pointer; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.12;
}

.ambient-one { top: -160px; right: 5%; background: var(--teal); }
.ambient-two { bottom: -220px; left: 18%; background: #54a9ff; }

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 20%, rgba(45, 151, 158, 0.2), transparent 38%),
    rgba(4, 13, 21, 0.97);
  backdrop-filter: blur(22px);
}

.access-gate.hidden { display: none; }

.access-card {
  width: min(430px, 100%);
  padding: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(18, 42, 56, 0.96), rgba(8, 23, 34, 0.97));
  box-shadow: var(--shadow);
}

.access-card h1 { margin: 14px 0 8px; font-size: 31px; }
.muted { color: var(--muted); }
.field-label { display: block; margin: 26px 0 8px; color: var(--muted); font-size: 13px; }

.access-card input {
  width: 100%;
  min-height: 52px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: 0;
  background: rgba(4, 16, 25, 0.78);
  color: var(--text);
}

.access-card input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(88, 223, 207, 0.1); }
.access-submit { width: 100%; margin-top: 12px; min-height: 52px; }
.error { min-height: 20px; margin: 10px 0 0; color: var(--danger); font-size: 13px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(93, 235, 217, 0.55);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(78, 228, 210, 0.18), rgba(76, 161, 255, 0.08));
  color: var(--teal);
  font-weight: 800;
  letter-spacing: -0.05em;
  box-shadow: inset 0 0 20px rgba(70, 214, 202, 0.08);
}

.brand-mark.small { width: 40px; height: 40px; border-radius: 13px; font-size: 13px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 20, 31, 0.82);
  backdrop-filter: blur(18px);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 16px; }
.brand span { margin-top: 2px; color: var(--muted); font-size: 11px; letter-spacing: 0.08em; }

.status-pill {
  padding: 7px 11px;
  border: 1px solid rgba(103, 230, 161, 0.28);
  border-radius: 999px;
  color: #67e6a1;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.07em;
}

.status-pill::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 12px currentColor; }

.content { width: min(1220px, calc(100% - 48px)); margin: 0 auto; padding: 68px 0 80px; }
.hero { margin-bottom: 34px; }
.eyebrow { margin: 0 0 10px; color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: 0.14em; }
.hero h1 { margin: 0; font-size: clamp(34px, 5vw, 56px); letter-spacing: -0.055em; }
.hero > p:last-child { margin: 14px 0 0; color: var(--muted); font-size: 16px; }

.sheet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.sheet-card {
  position: relative;
  min-height: 210px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(16, 38, 52, 0.94), rgba(8, 25, 36, 0.95));
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.file-card { cursor: pointer; }
.file-card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.file-card.ready { border-color: var(--teal); background: linear-gradient(145deg, rgba(24, 68, 74, 0.78), rgba(10, 31, 43, 0.96)); }
.output-card.complete { border-color: var(--teal); }
.sheet-card input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.sheet-number { color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: 0.12em; }
.sheet-name { display: block; margin-top: 31px; color: var(--muted); font-size: 13px; }
.sheet-card strong { display: block; margin-top: 9px; overflow: hidden; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.sheet-hint { display: block; margin-top: 14px; color: #688390; font-size: 12px; }

.action-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 24px; }
.action-button {
  min-height: 82px;
  padding: 18px 22px;
  border-radius: 17px;
  font-size: 16px;
  font-weight: 800;
}

.action-button span { display: block; margin-bottom: 5px; font-size: 11px; letter-spacing: 0.12em; opacity: 0.72; }

.primary {
  border: 1px solid rgba(88, 223, 207, 0.44);
  background: linear-gradient(135deg, #2db4aa, #278ba0);
  color: white;
  box-shadow: 0 12px 30px rgba(36, 157, 162, 0.2);
}

.primary:hover:not(:disabled) { filter: brightness(1.08); }
.secondary { border: 1px solid var(--line); background: rgba(255, 255, 255, 0.025); color: var(--muted); }
.secondary:hover { border-color: rgba(255, 116, 124, 0.42); color: #ffc0c4; }
button:disabled { cursor: not-allowed; opacity: 0.38; box-shadow: none; }

.work-status {
  min-height: 52px;
  margin: 18px 0 0;
  padding: 16px 18px;
  border-left: 3px solid var(--teal);
  border-radius: 0 12px 12px 0;
  background: rgba(21, 55, 68, 0.45);
  color: var(--muted);
  font-size: 13px;
}

.work-status.error-state { border-left-color: var(--danger); color: #ffb4b9; }

.mapping-audit {
  margin-top: 24px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(16, 38, 52, 0.9), rgba(8, 25, 36, 0.94));
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
}

.section-heading h2, .dialog-heading h2 { margin: 0; font-size: 24px; }
.section-heading > div > p:last-child { margin: 9px 0 0; color: var(--muted); font-size: 13px; }

.outline-button, .icon-button, .register-button {
  border: 1px solid var(--line-strong);
  background: rgba(88, 223, 207, 0.06);
  color: var(--teal);
}

.outline-button { min-height: 44px; padding: 0 16px; border-radius: 12px; font-weight: 750; }
.outline-button:hover, .register-button:hover { background: rgba(88, 223, 207, 0.12); }

.mapping-summary {
  margin-top: 22px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted);
  font-size: 13px;
}

.mapping-summary.success { border-color: rgba(103, 230, 161, 0.32); color: #78e9ac; background: rgba(70, 180, 126, 0.07); }
.mapping-summary.warning { border-color: rgba(255, 176, 72, 0.36); color: #ffc875; background: rgba(255, 153, 42, 0.07); }
.unmatched-list { display: grid; gap: 10px; margin-top: 12px; }

.unmatched-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 18px;
  border: 1px solid rgba(255, 176, 72, 0.25);
  border-radius: 14px;
  background: rgba(25, 28, 31, 0.36);
}

.unmatched-card strong { display: block; font-size: 15px; }
.unmatched-card p { margin: 5px 0; color: var(--muted); font-size: 13px; }
.unmatched-card span { color: #ffc875; font-size: 12px; }
.register-button { flex: 0 0 auto; min-height: 40px; padding: 0 14px; border-radius: 11px; font-weight: 750; }

.mapping-library {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(4, 18, 27, 0.42);
}

.mapping-library summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

.mapping-library summary::-webkit-details-marker { display: none; }
.mapping-library summary span { font-weight: 800; }
.mapping-library summary strong { color: var(--teal); font-size: 12px; }
.library-help { margin: 0; padding: 0 18px 14px; color: var(--muted); font-size: 12px; }
.mapping-library-list { display: grid; gap: 10px; max-height: 520px; padding: 0 12px 12px; overflow-y: auto; }

.mapping-rule-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(12, 36, 49, 0.72);
}

.mapping-rule-card > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mapping-rule-card > div span { flex: 0 0 auto; color: var(--teal); font-size: 10px; font-weight: 800; }
.mapping-rule-card p { margin: 8px 0 0; line-height: 1.55; }
.rule-source { color: var(--muted); font-size: 12px; }
.rule-explanation { color: #dceced; font-size: 13px; }
.handoff-note { padding: 10px 12px; border-left: 3px solid #ffc875; background: rgba(255, 176, 72, 0.06); color: #ffd79c; font-size: 12px; }

.mapping-dialog {
  width: min(720px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: #0b202e;
  color: var(--text);
  box-shadow: var(--shadow);
}

.mapping-dialog::backdrop { background: rgba(2, 9, 15, 0.82); backdrop-filter: blur(8px); }
.mapping-dialog form { padding: 28px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.icon-button { width: 38px; height: 38px; border-radius: 10px; font-size: 25px; line-height: 1; }

.privacy-note {
  margin: 20px 0;
  padding: 13px 15px;
  border-left: 3px solid var(--teal);
  background: rgba(88, 223, 207, 0.06);
  color: var(--muted);
  font-size: 12px;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid label { display: grid; gap: 8px; }
.form-grid label > span { color: var(--muted); font-size: 12px; }
.form-grid .full-width { grid-column: 1 / -1; }

.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: #071823;
  color: var(--text);
}

.form-grid textarea { min-height: 92px; padding-top: 12px; padding-bottom: 12px; resize: vertical; line-height: 1.55; }
.form-grid textarea[readonly] { color: #bcd7d9; background: rgba(6, 24, 35, 0.74); }
.form-grid small { color: #6f8c98; font-size: 11px; line-height: 1.45; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(88, 223, 207, 0.09); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.save-mapping { min-height: 44px; padding: 0 18px; border-radius: 12px; font-weight: 800; }

@media (max-width: 820px) {
  .topbar { padding: 0 18px; }
  .status-pill { display: none; }
  .content { width: min(100% - 28px, 680px); padding-top: 42px; }
  .sheet-grid, .action-panel { grid-template-columns: 1fr; }
  .sheet-card { min-height: 170px; }
  .section-heading, .unmatched-card { align-items: stretch; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full-width { grid-column: auto; }
}
