:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-soft: #fff5f5;
  --ink: #15171a;
  --muted: #747b83;
  --line: #e4e6ea;
  --red: #e60012;
  --red-dark: #a8000c;
  --red-soft: #fff0f1;
  --charcoal: #252d2f;
  --charcoal-soft: #475657;
  --teal: var(--red);
  --teal-dark: var(--red-dark);
  --blue: #2563eb;
  --coral: #e60012;
  --amber: #b7791f;
  --green: #16835f;
  --shadow: 0 22px 55px rgba(21, 23, 26, 0.08);
  --shadow-soft: 0 10px 28px rgba(21, 23, 26, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #ffffff 0, #f4f5f7 260px),
    var(--bg);
  color: var(--ink);
  font-family: "Pretendard", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

.respond-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(230, 0, 18, 0.09), transparent 34%),
    linear-gradient(180deg, #ffffff 0, #f4f5f7 100%);
}

.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(230, 0, 18, 0.12), transparent 32%),
    linear-gradient(135deg, #ffffff 0%, #f6f7f9 58%, #fff1f2 100%);
}

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

.login-card {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.login-brand img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  filter: drop-shadow(0 14px 22px rgba(230, 0, 18, 0.14));
}

.login-brand span {
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
}

.login-brand h1 {
  margin: 5px 0 0;
  font-size: 26px;
}

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

.login-message {
  min-height: 20px;
  margin: 0;
  color: var(--red-dark);
  font-size: 13px;
  font-weight: 700;
}

.respond-page-root {
  min-height: 100vh;
  display: grid;
  align-items: start;
  padding: 34px 18px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 282px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--line);
  box-shadow: 10px 0 35px rgba(21, 23, 26, 0.04);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 8px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #d6f4e8;
  color: #0f4c45;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
}

.brand-logo-img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 12px;
  filter: drop-shadow(0 10px 18px rgba(230, 0, 18, 0.16));
}

.brand-copy {
  min-width: 0;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 17px;
  letter-spacing: 0;
}

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #5c646b;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
  position: relative;
  font-weight: 700;
}

.nav-item:hover,
.nav-item.active {
  background: var(--red-soft);
  color: var(--red-dark);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 4px;
  height: 26px;
  border-radius: 999px;
  background: var(--red);
}

.nav-icon {
  width: 22px;
  text-align: center;
  color: var(--red);
  font-weight: 700;
}

.sidebar-panel {
  margin-top: auto;
  padding: 16px;
  border: 1px solid #2f383a;
  border-radius: 8px;
  background: var(--charcoal);
  color: #ffffff;
  box-shadow: var(--shadow-soft);
}

.panel-label,
.eyebrow {
  margin: 0 0 7px;
  font-size: 12px;
  color: var(--muted);
}

.sidebar-panel .panel-label {
  color: #c8ced1;
}

.sidebar-panel strong {
  display: block;
  font-size: 15px;
}

.sidebar-panel p {
  margin: 8px 0 0;
  color: #c8ced1;
  font-size: 13px;
  line-height: 1.5;
}

.main {
  min-width: 0;
}

.topbar {
  min-height: 90px;
  padding: 20px 34px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(14px);
}

.topbar h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 800;
}

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

.search {
  width: 280px;
  height: 42px;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}

.search span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.view-root {
  padding: 30px 34px 52px;
}

.brand-banner {
  min-height: 176px;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(105deg, #ffffff 0%, #ffffff 46%, #fff3f4 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 26px;
  position: relative;
}

.brand-banner::after {
  content: "";
  position: absolute;
  right: -50px;
  top: -44px;
  width: 210px;
  height: 260px;
  border-radius: 28px;
  background: var(--red);
  transform: rotate(18deg);
  opacity: 0.08;
}

.brand-banner-copy {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.brand-banner-copy img {
  width: 76px;
  height: 76px;
  object-fit: contain;
  object-position: center;
  padding: 8px;
  border: 1px solid #f0f1f3;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 28px rgba(230, 0, 18, 0.12);
}

.brand-banner-copy span {
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.brand-banner-copy h2 {
  margin: 7px 0 8px;
  font-size: 26px;
  line-height: 1.25;
}

.brand-banner-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.brand-banner-side {
  width: 138px;
  min-width: 138px;
  min-height: 120px;
  border-radius: 8px;
  background: var(--charcoal);
  color: white;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.brand-banner-side strong {
  font-size: 36px;
  line-height: 1;
}

.brand-banner-side span {
  color: #cbd2d6;
  font-size: 13px;
}

.stack {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}

.stat-card,
.panel,
.table-wrap,
.response-shell,
.mobile-form,
.schema-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat-card {
  min-height: 118px;
  min-width: 0;
  padding: 18px 18px 16px;
  display: grid;
  align-content: space-between;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 3px;
  background: var(--red);
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  font-size: 32px;
  line-height: 1;
}

.stat-card b {
  color: var(--red);
  font-size: 13px;
}

.stat-card span,
.stat-card strong,
.stat-card b {
  overflow-wrap: anywhere;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.8fr);
  gap: 18px;
  min-width: 0;
}

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

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-head h2,
.panel h2,
.schema-block h2 {
  margin: 0;
  font-size: 18px;
}

.panel-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.button,
.icon-button,
.text-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  border-radius: 8px;
  min-height: 38px;
  padding: 0 14px;
}

.button.primary {
  border-color: var(--red);
  background: var(--red);
  color: white;
  box-shadow: 0 10px 24px rgba(230, 0, 18, 0.16);
}

.button.blue {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
}

.button.ghost {
  background: #f8f9fb;
}

.button.danger {
  border-color: #f0c6c1;
  background: #fff4f2;
  color: #b63126;
}

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

.icon-button {
  width: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-weight: 800;
}

.icon-button.danger {
  border-color: #f0c6c1;
  color: #b63126;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--red);
  padding: 0 4px;
}

.tabs,
.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #f0f2f4;
  border-radius: 8px;
}

.tabs button,
.segmented button {
  border: 0;
  border-radius: 6px;
  min-height: 32px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
}

.tabs button.active,
.segmented button.active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(20, 33, 31, 0.08);
}

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

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

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  background: #f8f9fb;
  font-size: 13px;
  font-weight: 700;
}

td {
  font-size: 14px;
}

tr:last-child td {
  border-bottom: 0;
}

.row-title {
  display: grid;
  gap: 4px;
}

.row-title strong {
  font-size: 15px;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #f0f2f4;
  color: #4e565c;
}

.badge.published,
.badge.done {
  background: #e4f6ed;
  color: var(--green);
}

.badge.draft,
.badge.pending {
  background: #fff4da;
  color: var(--amber);
}

.badge.closed {
  background: #eef1f5;
  color: #667085;
}

.badge.student {
  background: #e9f0ff;
  color: var(--blue);
}

.badge.guardian {
  background: var(--red-soft);
  color: var(--red-dark);
}

.progress {
  min-width: 120px;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #eceff2;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), #252d2f);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

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

.field.grow {
  flex: 1;
}

.field.compact {
  width: 160px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  min-height: 40px;
  padding: 9px 11px;
  color: var(--ink);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search:focus-within {
  border-color: rgba(230, 0, 18, 0.5);
  outline: 3px solid rgba(230, 0, 18, 0.09);
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  min-width: 0;
}

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

.question-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 14px;
}

.question-head {
  display: flex;
  align-items: end;
  gap: 10px;
}

.drag-handle {
  color: var(--muted);
  padding-bottom: 10px;
  letter-spacing: 0;
}

.question-controls,
.checkline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.question-controls {
  margin-top: 12px;
  flex-wrap: wrap;
}

.question-options-field {
  margin-top: 12px;
}

.question-options-field textarea {
  min-height: 112px;
  line-height: 1.6;
}

.checkline {
  color: var(--muted);
  font-size: 13px;
}

.survey-link {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--surface-soft);
  border-radius: 8px;
}

.survey-link p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.survey-link code {
  overflow-wrap: anywhere;
  color: var(--red-dark);
}

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

.service-link-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.service-link-card.dark {
  background: var(--charcoal);
  color: #ffffff;
  border-color: var(--charcoal);
}

.service-link-card span,
.distribution-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.service-link-card.dark span {
  color: #c8ced1;
}

.service-link-card strong {
  display: block;
  margin: 8px 0;
  font-size: 18px;
}

.service-link-card code,
.distribution-row code {
  display: block;
  overflow-wrap: anywhere;
  color: var(--red-dark);
  font-size: 13px;
}

.service-link-card.dark code {
  color: #ffd6d9;
}

.distribution-list {
  display: grid;
  gap: 8px;
}

.distribution-row {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid rgba(230, 0, 18, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
}

.response-shell {
  max-width: 760px;
  margin: 0 auto;
  overflow: hidden;
}

.response-hero {
  padding: 24px;
  background:
    linear-gradient(135deg, #242b2d 0%, #171a1c 68%, #560006 100%);
  color: white;
}

.response-logo {
  width: 82px;
  height: 82px;
  object-fit: contain;
  object-position: center;
  display: block;
  margin-bottom: 18px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.18);
}

.response-hero h2 {
  margin: 8px 0 7px;
  font-size: 24px;
}

.response-hero p {
  margin: 0;
  color: #d6dcdf;
}

.mobile-form {
  border: 0;
  box-shadow: none;
  padding: 22px 24px 24px;
}

.respondent-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.respondent-summary {
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.respondent-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.respondent-summary strong {
  font-size: 18px;
}

.respondent-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.response-question {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.response-question:first-of-type {
  border-top: 0;
}

.response-question h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.option-grid {
  display: grid;
  gap: 9px;
}

.option-chip {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: #ffffff;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.option-chip:has(input:checked),
.rating-row label:has(input:checked) {
  border-color: var(--red);
  background: var(--red-soft);
}

.rating-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.rating-row label {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #ffffff;
}

.answer-bars {
  display: grid;
  gap: 12px;
}

.answer-bar {
  display: grid;
  gap: 6px;
}

.answer-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.bar-track {
  height: 10px;
  background: #eceff2;
  border-radius: 999px;
  overflow: hidden;
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--red);
}

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

.quote {
  border-left: 3px solid var(--red);
  padding: 10px 12px;
  background: #fbfcfd;
  border-radius: 0 8px 8px 0;
}

.quote p {
  margin: 0 0 6px;
}

.quote span {
  color: var(--muted);
  font-size: 12px;
}

.people-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  min-width: 0;
}

.schema-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}

.schema-block {
  padding: 18px;
}

.schema-block ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.8;
}

.empty {
  padding: 30px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfd;
  text-align: center;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 13px 16px;
  border-radius: 8px;
  color: white;
  background: var(--charcoal);
  box-shadow: var(--shadow);
  z-index: 20;
}

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

  .sidebar {
    position: static;
    padding: 16px;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sidebar-panel {
    display: none;
  }

  .content-grid,
  .builder-layout,
  .people-grid,
  .service-link-grid,
  .schema-grid {
    grid-template-columns: 1fr;
  }

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

  .brand-banner {
    align-items: stretch;
  }

  .brand-banner-copy {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-banner-side {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .sidebar {
    gap: 14px;
  }

  .brand {
    padding: 2px 4px;
  }

  .brand-logo-img {
    width: 46px;
    height: 46px;
  }

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

  .nav-item {
    min-height: 42px;
  }

  .topbar {
    position: static;
    display: grid;
    padding: 18px;
  }

  .topbar-actions,
  .respondent-bar,
  .form-grid,
  .question-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .search,
  .field.compact {
    width: 100%;
  }

  .view-root {
    padding: 18px;
  }

  .brand-banner {
    display: grid;
    padding: 20px;
  }

  .brand-banner-copy img {
    width: 72px;
    max-width: none;
    height: 72px;
  }

  .brand-banner-copy h2 {
    font-size: 21px;
  }

  .brand-banner-side {
    width: 100%;
    min-width: 0;
    min-height: 92px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 12px 10px;
  }

  .rating-row {
    grid-template-columns: repeat(5, minmax(42px, 1fr));
  }
}
