:root {
  color-scheme: light;
  --ink: #1e2a32;
  --muted: #64727c;
  --line: #d8e1e7;
  --soft: #f4f7f8;
  --brand: #0f6f7e;
  --brand-dark: #0b4e59;
  --accent: #c7532c;
  --paper: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #edf2f4;
  color: var(--ink);
  font-family: Arial, "Noto Sans KR", sans-serif;
  line-height: 1.55;
}

.app-shell,
.admin-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.survey-panel,
.admin-header,
.login-card,
.admin-content {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(28, 47, 58, 0.08);
}

.survey-panel {
  padding: 28px;
}

.topbar,
.admin-header,
.admin-tools,
.report-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
}

.admin-link,
.ghost-btn,
.primary-btn {
  min-height: 42px;
  border-radius: 6px;
  border: 1px solid var(--brand);
  padding: 10px 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.admin-link,
.ghost-btn {
  background: #fff;
  color: var(--brand-dark);
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: #fff;
}

.intro-band {
  display: grid;
  gap: 4px;
  margin: 24px 0;
  padding: 16px;
  background: #e8f3f5;
  border-left: 5px solid var(--brand);
}

.welcome-step {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.welcome-step h2 {
  margin-bottom: 10px;
  color: var(--brand-dark);
  font-size: 24px;
}

.welcome-step p {
  color: var(--muted);
}

.purpose-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.purpose-grid div {
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: #fff;
}

.purpose-grid strong,
.principle-box strong {
  display: block;
  margin-bottom: 8px;
  color: var(--brand-dark);
  font-size: 15px;
}

.purpose-grid span {
  color: var(--muted);
  font-size: 14px;
}

.principle-box {
  border: 1px solid #d9e7eb;
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  padding: 16px;
  background: #fff7f3;
}

.principle-box p {
  margin-bottom: 0;
}

.customer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  font: inherit;
}

.masked-admin-input {
  -webkit-text-security: disc;
}

textarea {
  resize: vertical;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 24px 0;
  padding: 0;
  list-style: none;
}

.stepper li {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.stepper li::before {
  content: attr(data-step-label);
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink);
}

.stepper li.active {
  border-color: var(--brand);
  background: #e8f3f5;
  color: var(--brand-dark);
}

.stepper li.active::before {
  background: var(--brand);
  color: #fff;
}

.wizard-step h2 {
  margin-bottom: 8px;
  color: var(--brand-dark);
}

.step-copy {
  color: var(--muted);
}

.question-list {
  display: grid;
  gap: 14px;
}

.question-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.question-card legend {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--brand-dark);
  font-weight: 800;
}

.question-card legend span {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
}

.question-card p {
  margin: 10px 0 14px;
  font-weight: 700;
}

.choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.choice-row label {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  font-weight: 500;
}

.choice-row input {
  width: 18px;
  min-height: 18px;
}

.choice-row strong {
  color: var(--brand-dark);
}

.scale-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) repeat(5, 48px) minmax(160px, 1fr);
  align-items: center;
  gap: 8px;
}

.scale-row > span {
  color: var(--muted);
  font-size: 13px;
}

.scale-choice {
  display: block;
  position: relative;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--brand-dark);
  cursor: pointer;
}

.scale-choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  opacity: 0;
  cursor: pointer;
}

.scale-choice strong {
  display: grid;
  place-items: center;
  width: 100%;
  height: 48px;
}

.scale-choice:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}

.form-actions.split {
  justify-content: space-between;
}

.hidden {
  display: none !important;
}

.report-wrap {
  display: grid;
  gap: 18px;
}

.report-actions {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 12px;
  background: rgba(237, 242, 244, 0.94);
  backdrop-filter: blur(8px);
}

.report-page {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 20mm;
  background: #fff;
  box-shadow: 0 12px 34px rgba(28, 47, 58, 0.12);
}

.report-cover {
  border-bottom: 4px solid var(--brand);
  margin-bottom: 18mm;
  padding-bottom: 10mm;
}

.report-cover h2 {
  margin: 0;
  font-size: 30px;
}

.report-cover.compact {
  margin-bottom: 13mm;
}

.report-meta {
  display: flex;
  gap: 18px;
  margin-top: 10px;
  color: var(--muted);
  font-weight: 700;
}

.result-hero {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 16px;
  margin-bottom: 12mm;
  padding: 18px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.result-hero p,
.result-hero h3 {
  margin-bottom: 4px;
}

.result-hero h3 {
  color: var(--brand-dark);
  font-size: 32px;
}

dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-weight: 700;
}

dd {
  margin: 0;
  font-weight: 800;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 16px 0 8mm;
}

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

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

.score-grid strong {
  color: var(--brand-dark);
  font-size: 24px;
}

.report-page section {
  margin-bottom: 10mm;
}

.report-page h3 {
  margin-bottom: 8px;
  color: var(--brand-dark);
  font-size: 20px;
}

.report-page li {
  margin-bottom: 8px;
}

.message-box,
.next-step,
.danger-box {
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  padding: 14px 16px;
  background: #fff8f5;
}

.danger-box {
  background: #fff4f0;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-list span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
}

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

.strategy-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.strategy-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.strategy-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--brand-dark);
  font-size: 20px;
}

.completion-card {
  width: 210mm;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

.report-page footer {
  margin-top: 14mm;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.admin-header {
  margin-bottom: 16px;
  padding: 22px;
}

.login-card {
  max-width: 460px;
  padding: 24px;
}

.admin-login-wide {
  max-width: none;
  margin-bottom: 18px;
}

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

.admin-login-wide form {
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: end;
}

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

.form-error {
  margin: 12px 0 0;
  border: 1px solid #f0b8a4;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff4ef;
  color: #8a2f16;
  font-size: 14px;
  font-weight: 700;
}

.form-error[data-state="pending"] {
  border-color: #b8dce6;
  background: #eaf4f7;
  color: #24566a;
}

.form-error[data-state="success"] {
  border-color: #a9d8b8;
  background: #eef8f1;
  color: #1f6b3c;
}

.primary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.header-copy {
  margin: 8px 0 0;
  color: var(--muted);
}

.warning-note {
  margin: 0 0 16px;
  border: 1px solid #f0c9bc;
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff7f3;
  color: #7c3d27;
  font-weight: 700;
}

.admin-content {
  padding: 18px;
}

.admin-tools {
  justify-content: flex-start;
  margin-bottom: 16px;
}

.admin-query-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.admin-summary article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--soft);
}

.admin-summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-summary strong {
  display: block;
  margin-top: 4px;
  color: var(--brand-dark);
  font-size: 22px;
}

.admin-filters {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.developer-panel {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 18px;
}

.developer-panel h2 {
  color: var(--brand-dark);
}

.approval-manager-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: #fff;
}

.approval-form {
  display: grid;
  grid-template-columns: repeat(4, 1fr) auto auto;
  align-items: end;
  gap: 12px;
}

.compact-approval-form {
  grid-template-columns: minmax(220px, 1.35fr) minmax(190px, 1.1fr) minmax(140px, 0.85fr) minmax(180px, 1fr) auto;
}

.compact-approval-form .primary-btn {
  align-self: end;
}

.checkbox-label {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.checkbox-label input {
  width: auto;
  min-height: auto;
}

.approval-unlimited {
  grid-column: 1 / -1;
  min-height: 28px;
}

.approval-history-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 0;
}

.approval-history-actions input {
  flex: 1;
  min-width: 200px;
  width: auto;
}

.approval-history-actions button {
  flex-shrink: 0;
}

.download {
  text-decoration: none;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.db-table {
  font-size: 14px;
}

.approval-table th,
.approval-table td {
  text-align: center;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  white-space: nowrap;
}

th {
  background: var(--soft);
  color: var(--brand-dark);
}

small {
  color: var(--muted);
}

.small-btn {
  min-height: 32px;
  padding: 6px 10px;
}

.danger-btn {
  border-color: #c0392b;
  color: #c0392b;
}

.danger-btn:disabled {
  border-color: #d9d9d9;
  color: #a8a8a8;
  cursor: not-allowed;
}

.danger-btn[data-state="danger"] {
  background: #c0392b;
  color: #fff;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
}

.modal-box h2 {
  margin-top: 0;
}

.modal-warning {
  background: #fff4e5;
  border: 1px solid #e8a33d;
  color: #8a5a00;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
}

.low-signal-banner {
  background: #fff4e5;
  border: 1px solid #e8a33d;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.low-signal-banner h3 {
  color: #8a5a00;
  margin-top: 0;
}

.finish-btn {
  min-height: 42px;
  border-radius: 6px;
  border: 1px solid #1b3a63;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  background: #1b3a63;
  color: #fff;
}

.finish-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.detail-row td {
  background: #fbfcfd;
  white-space: normal;
}

.detail-box {
  display: grid;
  gap: 6px;
  color: var(--ink);
}

.detail-box p {
  margin: 0;
}

.empty {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 760px) {
  .app-shell,
  .admin-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 16px;
  }

  .survey-panel {
    padding: 18px;
  }

  .topbar,
  .admin-header,
  .admin-tools:not(.admin-query-bar),
  .approval-history-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .approval-history-actions input {
    width: 100%;
  }

  .customer-grid,
  .purpose-grid,
  .choice-row,
  .result-hero,
  .score-grid,
  .stepper,
  .scale-row,
  .strategy-grid,
  .admin-summary,
  .admin-filters,
  .approval-form,
  .admin-login-wide form,
  .admin-query-bar {
    grid-template-columns: 1fr;
  }

  .admin-query-bar .primary-btn,
  .admin-query-bar .ghost-btn,
  .admin-query-bar .download,
  .compact-approval-form .primary-btn {
    width: 100%;
  }

  .report-page {
    width: 100%;
    min-height: auto;
    padding: 22px;
  }

  .completion-card {
    width: 100%;
  }
}

@media print {
  body {
    background: #fff;
  }

  .no-print {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .report-wrap {
    display: block;
  }

  .report-page {
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    box-shadow: none;
    page-break-after: always;
  }
}
