:root {
  color-scheme: light;
  --bg: #edf3f5;
  --surface: #ffffff;
  --surface-soft: #f6f9fa;
  --ink: #12211f;
  --muted: #66736f;
  --line: #d9e2e3;
  --line-strong: #c7d3d4;
  --accent: #08766f;
  --accent-strong: #075f5a;
  --accent-soft: #e0f2ef;
  --danger-bg: #fee2e2;
  --danger-ink: #991b1b;
  --shadow: 0 16px 38px rgba(25, 48, 46, 0.11);
  font-family:
    Inter, "Noto Sans KR", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(100%, 1360px);
  margin: 0 auto;
  padding: 22px 24px 28px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1.08;
}

h2 {
  font-size: 1.04rem;
}

.status-pill {
  min-width: 104px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 8px 22px rgba(20, 42, 39, 0.08);
}

.control-band,
.results-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.control-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) minmax(210px, 1.2fr) 108px;
  gap: 12px;
  align-items: end;
  padding: 15px 16px;
  margin-bottom: 16px;
}

.range-note {
  grid-column: 1 / -1;
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr;
}

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

.field-group {
  display: grid;
  gap: 6px;
}

label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 118, 111, 0.13);
}

input:disabled {
  background: #edf4f2;
  color: #53625f;
  opacity: 1;
}

.primary-button,
.filter-button,
.segment-button {
  min-height: 44px;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}

.primary-button {
  border: 0;
  background: var(--accent);
  color: #fff;
}

.filter-button {
  border: 1px solid var(--line-strong);
  background: var(--surface-soft);
  color: var(--accent-strong);
  padding: 9px 12px;
  white-space: nowrap;
}

.filter-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  min-height: 44px;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
}

.segment-button {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 8px;
}

.segment-button.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 5px 12px rgba(8, 118, 111, 0.16);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 15px;
}

.metric {
  min-height: 82px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.metric span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.metric strong {
  display: block;
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  line-height: 1.1;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: min(100%, 500px);
}

.table-toolbar input {
  max-width: 280px;
}

.table-wrap {
  overflow-x: hidden;
  overflow-y: auto;
  max-height: min(56vh, 620px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  scrollbar-gutter: stable;
}

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

th,
td {
  padding: 9px 7px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 0.82rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef6f4;
  color: #53625f;
  font-size: 0.75rem;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 1px 0 var(--line), 0 8px 14px rgba(18, 33, 31, 0.06);
}

td {
  font-weight: 750;
}

th:nth-child(1),
td:nth-child(1) {
  width: 12%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 14%;
}

td:nth-child(3) {
  width: 28%;
  text-align: left;
}

th:nth-child(3) {
  width: 28%;
  text-align: center;
}

th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5),
th:nth-child(6),
td:nth-child(6),
th:nth-child(7),
td:nth-child(7),
th:nth-child(8),
td:nth-child(8) {
  width: 9.2%;
}

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

tbody tr:nth-child(even) {
  background: #fbfdfd;
}

.product-name {
  display: grid;
  gap: 2px;
}

.product-name small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.move-alert,
.move-ok {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 26px;
  border-radius: 999px;
  font-weight: 900;
}

.move-alert {
  background: var(--danger-bg);
  color: var(--danger-ink);
}

.move-ok {
  color: var(--muted);
}

.empty-state {
  height: 180px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1120px) {
  .control-band {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .control-band .field-group:nth-child(5),
  .primary-button {
    grid-column: span 3;
  }

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

@media (max-width: 820px) {
  .app-shell {
    padding: 18px 14px 22px;
  }

  h1 {
    font-size: 2rem;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .status-pill {
    width: 100%;
  }

  .control-band {
    grid-template-columns: 1fr 1fr;
    padding: 12px;
  }

  .control-band .field-group:nth-child(3),
  .control-band .field-group:nth-child(4),
  .control-band .field-group:nth-child(5),
  .primary-button {
    grid-column: 1 / -1;
  }

  .results-panel {
    padding: 12px;
  }

  .metric {
    min-height: 74px;
    padding: 11px;
  }

  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .table-actions {
    min-width: 0;
    width: 100%;
  }

  .table-actions input {
    max-width: none;
  }

  th,
  td {
    padding: 8px 5px;
    font-size: 0.74rem;
  }

  th {
    font-size: 0.68rem;
  }

  .table-wrap {
    max-height: 58vh;
  }

  .move-alert,
  .move-ok {
    min-width: 34px;
    min-height: 24px;
  }
}
