:root {
  --bg: #f3f5f1;
  --sidebar: #10231c;
  --sidebar-soft: #23372f;
  --surface: #ffffff;
  --surface-soft: #f7faf7;
  --ink: #071411;
  --muted: #61706b;
  --line: #d8dfda;
  --green: #1d6f5a;
  --green-dark: #155946;
  --mint: #e2f3ed;
  --blue-soft: #e7f0fb;
  --red-soft: #ffe8e8;
  --red: #c95d62;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  border-top: 3px solid #b4ead7;
  font-family: Arial, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 14px 28px;
  background: var(--sidebar);
  color: #f6fbf8;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f6fbf8;
  color: var(--sidebar);
  font-size: 15px;
  font-weight: 900;
}

.brand span,
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.brand span {
  color: #b8d1c8;
}

.brand strong {
  display: block;
  margin-top: 2px;
  font-size: 19px;
  line-height: 1.2;
}

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

.nav-list a {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  color: #dceae5;
  text-decoration: none;
  border-radius: 7px;
  font-weight: 800;
}

.nav-list a.active,
.nav-list a:hover {
  background: var(--sidebar-soft);
  color: #ffffff;
}

.nav-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.09);
  color: #e7f6ef;
  font-size: 15px;
}

.side-note {
  margin-top: auto;
  padding: 18px 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.17);
}

.side-note strong {
  display: block;
  margin-bottom: 8px;
  color: #b8d1c8;
  font-size: 13px;
}

.side-note p {
  margin: 0;
  color: #f3f8f5;
  font-size: 14px;
  line-height: 1.65;
  font-weight: 700;
}

main {
  padding: 28px;
  display: grid;
  gap: 14px;
}

.topbar {
  order: 0;
}

#dashboard {
  order: 1;
}

.briefing-flow {
  order: 2;
}

#orders {
  order: 3;
}

.cs-flow {
  order: 4;
}

#wms {
  order: 5;
}

#connections {
  order: 6;
}

#money {
  order: 7;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 4px;
}

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

h1 {
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

.top-actions,
.section-head,
.setup-title,
.form-actions,
.segmented-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions {
  flex: 0 0 auto;
}

.section-head,
.setup-title {
  justify-content: space-between;
}

.section-head {
  margin-bottom: 18px;
}

.primary-button,
.secondary-button,
.icon-button,
.segmented-control button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 900;
}

.primary-button {
  background: var(--green);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--green-dark);
}

.secondary-button {
  background: #edf2ee;
  color: var(--ink);
}

.icon-button {
  width: 42px;
  padding: 0;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink);
}

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

.metric-card,
.panel,
.setup-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 1px 2px rgba(15, 34, 27, 0.04);
}

.metric-card {
  min-height: 112px;
  padding: 18px;
}

.metric-card span,
.setup-card p,
.transaction-list span,
.preview-card p,
.cs-list p,
.task-list small {
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
  line-height: 1;
}

.metric-card p {
  margin-top: 8px;
}

.panel {
  padding: 18px;
}

.badge,
.status {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  min-width: 64px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.badge,
.status.pending {
  color: #285985;
  background: var(--blue-soft);
}

.status.ready {
  color: var(--green-dark);
  background: var(--mint);
}

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

.setup-card {
  padding: 16px;
}

.setup-title {
  align-items: flex-start;
  margin-bottom: 18px;
}

.setup-title p {
  margin-top: 8px;
}

.wms-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 14px;
  align-items: stretch;
}

.wms-connect-card,
.stock-summary article {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.wms-connect-card {
  padding: 16px;
}

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

.stock-summary {
  display: grid;
  gap: 10px;
}

.stock-summary article {
  padding: 16px;
}

.stock-summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.stock-summary strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.stock-summary p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.inventory-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin: 14px 0;
}

.search-field {
  width: min(320px, 100%);
  margin: 0;
}

.search-field span {
  color: var(--muted);
}

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

#inventoryTable td:first-child strong,
#inventoryTable td:first-child span {
  display: block;
}

#inventoryTable td:first-child span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.stock-badge {
  display: inline-grid;
  place-items: center;
  min-width: 48px;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
}

.stock-badge.ok {
  color: var(--green-dark);
  background: var(--mint);
}

.stock-badge.low {
  color: var(--red);
  background: var(--red-soft);
}

.stock-badge.hold {
  color: #8c6419;
  background: #fff4d9;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 14px;
  color: var(--ink);
  background: #ffffff;
  font-weight: 800;
}

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

.webhook-box {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(260px, 0.48fr) 1fr;
  gap: 18px;
  padding: 16px;
  border: 1px dashed #b9c8c1;
  border-radius: 7px;
  background: var(--surface-soft);
}

.webhook-box strong {
  display: block;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.webhook-box p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.briefing-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 0;
}

.briefing-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 900;
  line-height: 1.5;
}

.briefing-list li:last-child {
  border-bottom: 0;
}

.segmented-control {
  padding: 4px;
  border-radius: 8px;
  background: #edf2ee;
}

.segmented-control button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
}

.segmented-control button.active {
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(15, 34, 27, 0.08);
}

.task-list {
  display: grid;
}

.task-list label {
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

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

.task-list input {
  width: 18px;
  min-height: 18px;
}

.task-list strong,
.task-list small {
  display: block;
}

.task-list b {
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--red);
  background: var(--red-soft);
  font-size: 12px;
}

.cs-list,
.transaction-list {
  display: grid;
  gap: 10px;
}

.cs-list article,
.transaction-list article,
.preview-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.transaction-list article {
  justify-content: space-between;
}

.source {
  min-width: 54px;
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.source.kakao {
  background: #8d6e1d;
}

.source.cafe24 {
  background: #2e6f92;
}

.plus {
  color: var(--green);
}

.minus {
  color: var(--red);
}

.upload-zone {
  min-height: 170px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 22px;
  border: 1px dashed #b9c8c1;
  border-radius: 7px;
  background: #fbfdfb;
  text-align: center;
}

.upload-zone input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.upload-zone small {
  max-width: 280px;
  color: var(--muted);
}

.camera-icon {
  width: 52px;
  height: 40px;
  border: 3px solid var(--green);
  border-radius: 8px;
  position: relative;
}

.camera-icon::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 3px solid var(--green);
  border-radius: 50%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.camera-icon::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 8px;
  border-radius: 5px 5px 0 0;
  background: var(--green);
  left: 8px;
  top: -9px;
}

.preview-card {
  margin-top: 12px;
}

.photo-placeholder,
.uploaded-preview {
  width: 74px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.photo-placeholder {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.2), transparent),
    repeating-linear-gradient(0deg, #f7f2e8 0 9px, #e5dbc8 9px 10px);
}

.uploaded-preview {
  object-fit: cover;
}

.chart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 16px;
}

.bar-chart {
  min-height: 260px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 12px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.bar-group {
  min-width: 48px;
  display: grid;
  align-items: end;
  justify-items: center;
  grid-template-rows: 1fr auto;
  gap: 8px;
}

.bars {
  height: 200px;
  display: flex;
  align-items: end;
  gap: 5px;
}

.bar {
  width: 15px;
  min-height: 8px;
  border-radius: 5px 5px 0 0;
}

.bar.order {
  background: var(--green);
}

.bar.return {
  background: var(--red);
}

.bar-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

table {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: #ffffff;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}

th {
  color: var(--muted);
  background: #edf2ee;
}

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

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

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-list a {
    flex: 0 0 auto;
  }

  .side-note {
    margin-top: 0;
  }

  .summary-grid,
  .setup-grid,
  .lower-grid,
  .wms-layout,
  .chart-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 901px) and (max-width: 1050px) {
  .setup-grid,
  .lower-grid,
  .wms-layout,
  .chart-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  main {
    padding: 18px;
  }

  .topbar,
  .section-head,
  .setup-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions,
  .form-actions,
  .segmented-control {
    width: 100%;
  }

  .primary-button,
  .secondary-button,
  .segmented-control button {
    flex: 1;
  }

  h1 {
    font-size: 24px;
  }

  .summary-grid,
  .setup-grid,
  .lower-grid,
  .wms-layout,
  .wms-form-grid,
  .chart-layout,
  .webhook-box {
    grid-template-columns: 1fr;
  }

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

  .transaction-list article,
  .cs-list article {
    align-items: flex-start;
    flex-direction: column;
  }

  .bar-chart {
    overflow-x: auto;
  }
}
