:root {
  --bg: #09111f;
  --panel: #0f172a;
  --panel-soft: #111c34;
  --line: rgba(148, 163, 184, 0.18);
  --ink: #e5edf9;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.18);
  --green: #34d399;
  --yellow: #fbbf24;
  --rose: #fb7185;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, Pretendard, -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(circle at top, #12213c 0, #09111f 42%, #050a13 100%);
  color: var(--ink);
}
button, input, select, textarea { font: inherit; }
.page-shell {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(8, 15, 30, 0.86);
  backdrop-filter: blur(18px);
  padding: 24px;
  overflow-y: auto;
  display: grid;
  gap: 18px;
  align-content: start;
}
.main-area {
  padding: 24px;
  display: grid;
  gap: 18px;
  grid-auto-rows: max-content;
  align-content: start;
}
.brand-row, .panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.brand-row p { color: var(--muted); line-height: 1.55; margin-top: 8px; }
.brand-row .data-warning {
  color: #fde68a;
  background: rgba(251,191,36,.08);
  border: 1px solid rgba(251,191,36,.22);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 600;
}
.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  color: #7dd3fc;
}
h1, h2, p { margin: 0; }
h1 { font-size: 28px; margin-top: 8px; }
h2 { font-size: 22px; margin-top: 6px; }
.hero-title-row {
  margin-top: 8px;
}
.hero-title {
  margin-top: 0;
}
.title-soft-note {
  display: inline-block;
  margin-left: 8px;
  color: rgba(148, 163, 184, 0.78);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: normal;
  vertical-align: middle;
}
.pill, .status-pill {
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(125, 211, 252, 0.14);
  color: #bae6fd;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.panel {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.95), rgba(9, 15, 28, 0.92));
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}
.item-adjust-panel {
  display: flex;
  flex-direction: column;
  min-height: clamp(760px, 88vh, 1120px);
  max-height: calc(100vh + 180px);
}
.summary-panel,
.report-panel {
  display: flex;
  flex-direction: column;
}
.panel-title-row {
  margin-bottom: 10px;
}
.panel-title {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 10px;
}
.panel-title-note {
  display: inline-block;
  margin-left: 6px;
  color: rgba(148, 163, 184, 0.78);
  font-size: 12px;
  font-weight: 600;
  vertical-align: middle;
}
.tooltip-anchor {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tooltip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.24);
  background: rgba(56, 189, 248, 0.1);
  color: #bae6fd;
  font-size: 11px;
  font-weight: 700;
  cursor: help;
}
.tooltip-box {
  position: absolute;
  left: 0;
  top: calc(100% + 10px);
  z-index: 20;
  width: min(460px, calc(100vw - 72px));
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(56, 189, 248, 0.18);
  background: rgba(9, 15, 28, 0.97);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
  color: #dbeafe;
  font-size: 12px;
  line-height: 1.55;
  font-weight: 500;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
  pointer-events: none;
}
.tooltip-anchor:hover .tooltip-box,
.tooltip-anchor:focus-within .tooltip-box {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.panel-header.compact { margin-bottom: 10px; }
.field-grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
label span {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}
.soft-note {
  color: rgba(148, 163, 184, 0.78);
  font-style: normal;
  font-weight: 600;
}
input, select, textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.25);
  background: rgba(15, 23, 42, 0.9);
  color: var(--ink);
  padding: 12px 14px;
}
textarea {
  min-height: 140px;
  line-height: 1.5;
  resize: vertical;
}
.helper {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  margin-top: 10px;
}
.legend-list {
  display: grid;
  gap: 10px;
  align-items: start;
}
.legend-list-horizontal {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.legend-list > div {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.62);
}
.legend-list p { color: var(--muted); font-size: 12px; margin-top: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.chip.single { background: rgba(52,211,153,.18); color: #6ee7b7; }
.chip.mixed { background: rgba(251,191,36,.16); color: #fde68a; }
.chip.hold { background: rgba(251,113,133,.16); color: #fda4af; }
.primary-button, .ghost-button {
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 800;
}
.button-stack {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.button-stack-equal {
  flex-wrap: nowrap;
}
.panel-header-vertical {
  display: block;
}
.panel-header-vertical > div:first-child {
  margin-bottom: 12px;
}
.panel-action-button {
  min-width: 132px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.item-action-row {
  align-items: stretch;
}
.item-action-row-top {
  justify-content: flex-start;
}
.button-stack-bottom {
  margin-top: 14px;
  justify-content: stretch;
}
.button-stack-bottom .panel-action-button {
  flex: 1 1 0;
}
.primary-button { background: linear-gradient(135deg, #38bdf8, #6366f1); color: white; }
.ghost-button { background: rgba(148,163,184,.12); color: var(--ink); }
.confirm-banner {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(56,189,248,.08);
  border: 1px solid rgba(56,189,248,.18);
  color: #dbeafe;
  font-size: 13px;
  line-height: 1.55;
}
.item-list {
  display: grid;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  margin-right: -2px;
}
.item-list::-webkit-scrollbar {
  width: 10px;
}
.item-list::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.08);
  border-radius: 999px;
}
.item-list::-webkit-scrollbar-thumb {
  background: rgba(125, 211, 252, 0.28);
  border-radius: 999px;
  border: 2px solid rgba(15, 23, 42, 0.92);
}
.item-list::-webkit-scrollbar-thumb:hover {
  background: rgba(125, 211, 252, 0.42);
}
.report-panel textarea {
  flex: 1;
  min-height: 170px;
  max-height: 230px;
}
.item-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(15,23,42,.64);
  padding: 14px;
  display: grid;
  gap: 12px;
}
.item-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.item-top input[type='checkbox'] { width: 18px; height: 18px; margin-top: 4px; }
.item-name { font-weight: 800; }
.item-meta { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.5; }
.item-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(340px, 0.88fr);
  gap: 18px;
  align-items: stretch;
}
.guide-panel {
  margin-top: -2px;
}
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.summary-card {
  border-radius: 18px;
  border: 1px solid var(--line);
  padding: 14px;
  background: linear-gradient(180deg, rgba(17,28,52,.95), rgba(15,23,42,.7));
}
.summary-card .label { color: var(--muted); font-size: 12px; }
.summary-card .value { margin-top: 10px; font-size: 24px; font-weight: 800; }
.summary-card .sub { color: #cbd5e1; font-size: 12px; margin-top: 6px; line-height: 1.45; }
.table-wrap { overflow: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1180px;
  table-layout: fixed;
}
th, td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th {
  color: #bae6fd;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  line-height: 1.25;
}
th:not(.col-prom-cost):not(.col-coupang-cost) {
  white-space: nowrap;
}
td { font-size: 14px; }
th.col-item,
td:first-child {
  width: 260px;
}
th.col-notes,
td:last-child {
  width: 430px;
}
th.col-shortage,
th.col-suggested {
  width: 62px;
}
th.col-packing {
  width: 72px;
}
th.col-single-pallet,
th.col-mixed-box {
  width: 78px;
}
th.col-pallet-usage {
  width: 82px;
}
th.col-prom-cost,
th.col-coupang-cost {
  width: 132px;
}
.badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.badge.single { background: rgba(52,211,153,.16); color: #6ee7b7; }
.badge.mixed { background: rgba(251,191,36,.16); color: #fde68a; }
.badge.hold { background: rgba(251,113,133,.16); color: #fda4af; }
.truck-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 18px;
}
.truck-card {
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(13,19,33,.98), rgba(10,15,26,.85));
  padding: 16px;
}
.truck-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}
.truck-sub { color: var(--muted); font-size: 12px; margin-top: 6px; }
.truck-progress-wrap { margin-bottom: 14px; }
.truck-progress-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(148,163,184,.16);
  overflow: hidden;
  border: 1px solid rgba(148,163,184,.16);
}
.truck-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8, #22c55e);
}
.truck-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.slot {
  min-height: 88px;
}
.block {
  border-radius: 16px;
  padding: 12px;
  height: 100%;
  color: white;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 10px 24px rgba(0,0,0,.18);
  min-height: 88px;
  border: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.block.empty {
  background: rgba(71,85,105,.16);
  border: 1px dashed rgba(148,163,184,.24);
  color: #64748b;
}
.single-block { background: linear-gradient(135deg, var(--slot-accent), #0f172a); }
.mixed-block { background: linear-gradient(135deg, #172554, #1e3a8a); }
.block-label { font-size: 12px; font-weight: 800; }
.block-meta { margin-top: 6px; font-size: 11px; opacity: .92; }
.segment-stack {
  display: flex;
  min-height: 32px;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 8px;
  border: 1px solid rgba(255,255,255,.16);
}
.segment {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  padding: 6px 4px;
  color: rgba(255,255,255,.92);
  text-align: center;
}
.truck-detail-list {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}
.truck-line {
  display: grid;
  grid-template-columns: 72px minmax(0,1fr);
  gap: 10px;
  align-items: start;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(15,23,42,.52);
  padding: 10px 12px;
}
.truck-line-slot {
  color: #bae6fd;
  font-size: 12px;
  font-weight: 800;
}
.truck-line-body {
  display: grid;
  gap: 4px;
}
.truck-line-body strong { font-size: 13px; }
.truck-line-body span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.truck-line.empty .truck-line-body,
.truck-line.empty .truck-line-slot { color: #64748b; }
.space-bottom { margin-bottom: 14px; }
.mono { font-variant-numeric: tabular-nums; }
@media (max-width: 1280px) {
  .page-shell { grid-template-columns: 1fr; }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .item-adjust-panel {
    min-height: auto;
    max-height: none;
  }
  .item-list {
    max-height: 620px;
  }
  .top-grid { grid-template-columns: 1fr; }
  .legend-list-horizontal { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .sidebar,
  .main-area {
    padding: 18px;
  }
  .summary-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .truck-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  h1 {
    font-size: 24px;
    line-height: 1.25;
  }
  h2 {
    font-size: 19px;
    line-height: 1.3;
  }
  .brand-row,
  .panel-header,
  .truck-head {
    flex-direction: column;
    align-items: stretch;
  }
  .brand-row .pill,
  .panel-header .status-pill,
  .truck-head .status-pill {
    align-self: flex-start;
  }
  .field-grid.two,
  .item-grid,
  .summary-cards,
  .truck-grid,
  .legend-list-horizontal {
    grid-template-columns: 1fr;
  }
  .button-stack,
  .button-stack-equal,
  .item-action-row {
    flex-direction: column;
  }
  .panel-action-button,
  .ghost-button,
  .primary-button {
    width: 100%;
  }
  .report-panel textarea {
    min-height: 220px;
    max-height: none;
  }
  .tooltip-box {
    width: min(360px, calc(100vw - 40px));
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }
  .sidebar,
  .main-area {
    padding: 14px;
  }
  .panel {
    border-radius: 18px;
    padding: 14px;
  }
  .item-card,
  .summary-card,
  .truck-card,
  .truck-line {
    border-radius: 16px;
  }
  .item-top {
    gap: 10px;
  }
  .item-meta,
  .summary-card .sub,
  .truck-sub,
  .truck-line-body span,
  .legend-list p,
  .confirm-banner {
    font-size: 11px;
  }
  .table-wrap {
    overflow: visible;
  }
  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }
  table {
    min-width: 0;
  }
  thead {
    display: none;
  }
  tbody {
    display: grid;
    gap: 12px;
  }
  tr {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.62);
    padding: 12px;
  }
  td {
    width: 100% !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    padding: 10px 0 10px 92px;
    position: relative;
    min-height: 36px;
    font-size: 13px;
  }
  td:last-child {
    border-bottom: none;
  }
  td::before {
    position: absolute;
    left: 0;
    top: 10px;
    width: 82px;
    color: #7dd3fc;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.35;
    content: '';
  }
  td:nth-child(1)::before { content: '품목'; }
  td:nth-child(2)::before { content: '부족수량'; }
  td:nth-child(3)::before { content: '제안수량'; }
  td:nth-child(4)::before { content: '패킹방식'; }
  td:nth-child(5)::before { content: '단독 파레트'; }
  td:nth-child(6)::before { content: '혼적 박스'; }
  td:nth-child(7)::before { content: '파레트 사용량'; }
  td:nth-child(8)::before { content: '프롬나드 작업비'; }
  td:nth-child(9)::before { content: '쿠팡 작업비'; }
  td:nth-child(10)::before { content: '비고'; }
  .truck-line {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
