:root {
  --bg: #f2ede1;
  --panel: rgba(255, 252, 245, 0.92);
  --panel-strong: #fffaf1;
  --line: rgba(34, 48, 64, 0.12);
  --text: #1e2b38;
  --muted: #6e766f;
  --brand: #21574d;
  --brand-dark: #163a34;
  --brand-soft: #dbeee7;
  --shadow: 0 18px 40px rgba(35, 42, 51, 0.08);
  --warn: #a86b00;
  --warn-soft: #f7ebd1;
  --ok: #2b7d4c;
  --ok-soft: #dff2e6;
  --danger: #b34335;
  --danger-soft: #f8dfdb;
  --blue: #2a5fa8;
  --blue-soft: #e4eefc;
  --violet: #6343ba;
  --violet-soft: #ede7ff;
  --teal: #0f708f;
  --teal-soft: #e2f6fb;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top right, rgba(33, 87, 77, 0.13), transparent 26%),
    radial-gradient(circle at bottom left, rgba(184, 106, 29, 0.13), transparent 22%),
    linear-gradient(180deg, #f8f4ea 0%, var(--bg) 100%);
}

.page-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 28px 20px 42px;
}

.card {
  background: var(--panel);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.9fr);
  gap: 18px;
  margin-bottom: 18px;
}

.hero-panel {
  padding: 30px 30px 24px;
  position: relative;
  overflow: hidden;
}

.hero-panel::after {
  content: "";
  position: absolute;
  right: -90px;
  top: -60px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(33, 87, 77, 0.18), transparent 68%);
  pointer-events: none;
}

.hero-side {
  display: grid;
  gap: 18px;
}

.side-panel,
.control-panel,
.detail-panel {
  padding: 22px;
}

.eyebrow,
.section-kicker,
.label {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow {
  font-size: 12px;
  margin-bottom: 14px;
}

.section-kicker {
  font-size: 14px;
  margin-bottom: 12px;
  font-weight: 700;
}

h1 {
  font-size: clamp(40px, 5vw, 64px);
  line-height: 0.92;
  margin: 0 0 14px;
  font-weight: 600;
}

.lede {
  max-width: 60ch;
  font-size: 18px;
  line-height: 1.52;
  color: #354655;
  margin: 0 0 24px;
}

.lookup-bar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

button {
  border: 0;
  border-radius: 16px;
  padding: 13px 16px;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, box-shadow 120ms ease;
}

button:hover { transform: translateY(-1px); }
button:disabled { transform: none; opacity: 0.56; cursor: not-allowed; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-brand {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: 0 12px 24px rgba(33, 87, 77, 0.22);
}

.btn-soft {
  color: var(--brand);
  background: var(--brand-soft);
}

.btn-danger {
  color: #83261a;
  background: var(--danger-soft);
}

.route-note,
.hint,
.mono {
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
}

.route-note { margin-top: 14px; }
.hint { line-height: 1.55; }

.chip-stack,
.action-row,
.status-selector,
.pill-row,
.workspace-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.workspace-stat {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,0.74);
}

.workspace-stat .label {
  display: block;
  font-size: 11px;
  margin-bottom: 6px;
}

.workspace-stat .value {
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.chip,
.status-chip,
.item-chip,
.info-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.82);
  color: var(--text);
}

.chip {
  cursor: pointer;
  text-decoration: none;
}

.status-chip,
.item-chip {
  font-weight: 700;
}

.status-selector {
  margin-bottom: 14px;
}

.status-pill,
.quick-pill {
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 13px;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.75);
}

.status-pill.active,
.quick-pill.active {
  box-shadow: inset 0 0 0 2px rgba(22, 28, 34, 0.14);
}

.status-PENDING,
.status-OPEN,
.status-UNREVIEWED {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: rgba(168,107,0,0.14);
}

.status-ALLOCATED,
.status-PICKED {
  background: var(--violet-soft);
  color: var(--violet);
  border-color: rgba(99,67,186,0.14);
}

.status-PACKED,
.status-SHIPPED {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: rgba(42,95,168,0.14);
}

.status-DELIVERED {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: rgba(43,125,76,0.14);
}

.status-BACKORDERED {
  background: var(--teal-soft);
  color: var(--teal);
  border-color: rgba(15,112,143,0.14);
}

.status-CANCELLED {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(179,67,53,0.14);
}

.workspace-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.88fr);
  gap: 18px;
  align-items: start;
}

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

.detail-title {
  font-size: clamp(30px, 3.4vw, 48px);
  line-height: 0.98;
}

.detail-meta {
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
}

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

.summary-card,
.data-card,
.item-card,
.timeline-card,
.issue-banner {
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.76);
}

.summary-card,
.data-card {
  padding: 16px;
}

.summary-card .label,
.data-card .label {
  display: block;
  font-size: 11px;
  margin-bottom: 8px;
}

.summary-card .number {
  font-size: 30px;
  line-height: 1;
  margin-bottom: 5px;
}

.summary-card .subtext,
.data-card .subtext {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

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

.data-value {
  font-size: 15px;
  line-height: 1.6;
  word-break: break-word;
}

.issue-banner {
  padding: 16px 18px;
  margin-bottom: 18px;
}

.issue-banner strong {
  display: block;
  font-size: 16px;
  margin-bottom: 6px;
}

.section-title {
  font-size: 22px;
  margin: 0 0 12px;
}

.item-stack,
.timeline-stack {
  display: grid;
  gap: 14px;
}

.item-card {
  padding: 18px;
}

.item-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 12px;
}

.item-title {
  font-size: 20px;
  line-height: 1.16;
  margin-bottom: 6px;
}

.item-qty-box {
  min-width: 130px;
}

.item-qty-box .label {
  display: block;
  font-size: 11px;
  margin-bottom: 6px;
}

.quick-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

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

.item-form-grid .wide,
.field-grid .wide {
  grid-column: 1 / -1;
}

.item-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

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

.timeline-card {
  padding: 16px;
}

.timeline-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.timeline-message {
  font-size: 15px;
  line-height: 1.52;
}

.empty-note,
.empty-state {
  padding: 22px;
  border: 1px dashed rgba(34,48,64,0.18);
  border-radius: 20px;
  background: rgba(255,255,255,0.56);
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  min-width: 260px;
  max-width: 440px;
  padding: 14px 16px;
  border-radius: 18px;
  color: #fff;
  background: rgba(30,43,56,0.96);
  box-shadow: 0 18px 42px rgba(0,0,0,0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: rgba(126,37,27,0.97);
}

@media (max-width: 1120px) {
  .workspace-layout,
  .hero-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .lookup-bar,
  .summary-grid,
  .info-grid,
  .workspace-grid,
  .item-form-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .detail-head,
  .item-header {
    flex-direction: column;
  }

  .page-shell {
    padding: 18px 14px 32px;
  }

  .hero-panel,
  .detail-panel,
  .side-panel,
  .control-panel {
    padding: 18px;
  }
}
