:root {
  color-scheme: light;
  --ink: #20242c;
  --muted: #657082;
  --line: #d8dee8;
  --panel: #ffffff;
  --page: #f4f7fa;
  --nav: #15202b;
  --accent: #2477b3;
  --accent-strong: #145f93;
  --good: #1f8a5b;
  --warn: #b26b22;
  --soft: #eef5fa;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans KR", Arial, sans-serif;
  color: var(--ink);
  background: var(--page);
}

button,
input,
select {
  font: inherit;
}

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

.sidebar {
  background: var(--nav);
  color: #fff;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 14px;
  align-items: center;
}

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

.brand h1,
.toolbar h2,
.panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 20px;
}

.brand p,
.toolbar p,
.panel-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.brand p {
  color: #b9c6d4;
  font-size: 13px;
}

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

.step-list a {
  color: #d8e4ef;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.step-list a.active,
.step-list a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.quality-box {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.quality-box span {
  font-weight: 700;
}

.quality-box ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: #d0dce7;
  line-height: 1.65;
  font-size: 13px;
}

.workspace {
  padding: 28px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.toolbar,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 32px rgba(21, 32, 43, 0.06);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  align-items: center;
}

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

.panel {
  padding: 22px;
}

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

.panel h3 {
  font-size: 18px;
}

.status-pill {
  min-width: 64px;
  text-align: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.drop-zone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 128px;
  border: 2px dashed #a9bdd0;
  border-radius: 8px;
  background: #f7fbfd;
  cursor: pointer;
  margin-bottom: 18px;
  text-align: center;
}

.drop-zone input {
  display: none;
}

.drop-zone span {
  color: var(--accent-strong);
  font-weight: 800;
}

.drop-zone strong {
  font-size: 15px;
}

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

.form-grid.compact {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
}

label {
  display: grid;
  gap: 7px;
  color: #354052;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid #c8d2de;
  border-radius: 7px;
  padding: 0 11px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 3px solid rgba(36, 119, 179, 0.18);
  border-color: var(--accent);
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.chip-grid label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid #c8d2de;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.segmented label {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #c8d2de;
  background: #f8fafc;
  cursor: pointer;
}

.segmented label:last-child {
  border-right: 0;
}

.segmented label:has(input:checked) {
  background: var(--accent);
  color: #fff;
}

.segmented input {
  width: auto;
  height: auto;
}

.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 16px 0;
}

.option-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.option-row input,
.chip-grid input {
  width: auto;
  height: auto;
}

button {
  border: 0;
  border-radius: 7px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  min-height: 48px;
  width: 100%;
  background: var(--accent);
  color: #fff;
}

.primary-button:hover,
.small-button:hover {
  background: var(--accent-strong);
}

.ghost-button,
.small-button {
  min-height: 38px;
  padding: 0 14px;
}

.ghost-button {
  color: var(--accent-strong);
  background: var(--soft);
}

.small-button {
  color: #fff;
  background: var(--accent);
}

.small-button:disabled {
  background: #a8b5c3;
  cursor: not-allowed;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

th:first-child,
td:first-child,
th:nth-child(3),
td:nth-child(3),
th:nth-child(4),
td:nth-child(4) {
  text-align: left;
}

th {
  color: #495567;
  background: #f5f8fb;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 30px 8px;
}

.preview-wrap {
  display: grid;
  gap: 12px;
}

canvas {
  width: 100%;
  max-height: 470px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.detail-box {
  padding: 14px;
  min-height: 84px;
  border-radius: 8px;
  background: #f6f8fb;
  border: 1px solid var(--line);
  color: #384557;
  line-height: 1.55;
  font-size: 13px;
}

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

  .sidebar {
    min-height: auto;
  }

  .form-grid,
  .form-grid.compact,
  .result-layout {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .toolbar,
  .panel-heading {
    display: grid;
  }

  .form-grid,
  .form-grid.compact,
  .result-layout,
  .segmented {
    grid-template-columns: 1fr;
  }

  .segmented label {
    border-right: 0;
    border-bottom: 1px solid #c8d2de;
  }

  .segmented label:last-child {
    border-bottom: 0;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
