:root {
  --ink: #111111;
  --muted: #6e706f;
  --paper: #faf9f5;
  --panel: #ffffff;
  --line: #dedbd2;
  --soft: #f0eee8;
  --green: #0b6b57;
  --amber: #9a6b00;
  --red: #ad2e24;
  --blue: #245f91;
  --shadow: 0 18px 50px rgba(17, 17, 17, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 6vw, 4.5rem);
  line-height: 0.95;
  font-weight: 850;
  max-width: 760px;
}

h2 {
  font-size: 1.05rem;
  line-height: 1.2;
  font-weight: 820;
}

.header-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 210px;
  color: var(--muted);
  font-size: 0.86rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--panel);
  font-weight: 750;
}

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

.metric-card {
  min-height: 126px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(17, 17, 17, 0.03);
}

.metric-card.dark {
  color: #ffffff;
  background: #111111;
  border-color: #111111;
}

.metric-card .label {
  display: block;
  margin-bottom: 10px;
  color: inherit;
  opacity: 0.68;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.metric-card .value {
  display: block;
  font-size: clamp(2rem, 5vw, 3.3rem);
  line-height: 0.92;
  font-weight: 900;
}

.metric-card .sub {
  display: block;
  margin-top: 9px;
  color: inherit;
  opacity: 0.62;
  font-size: 0.82rem;
  font-weight: 650;
}

.workspace {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 18px;
}

.control-panel,
.manual-panel,
.toolbar,
.table-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.control-panel,
.manual-panel {
  padding: 16px;
}

.panel-head,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-head {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.panel-head h2 {
  color: var(--ink);
}

.file-drop {
  display: grid;
  place-items: center;
  min-height: 124px;
  margin-bottom: 12px;
  padding: 18px;
  border: 1px dashed #b8b5aa;
  border-radius: 8px;
  background: #fbfaf7;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease;
}

.file-drop.is-dragging {
  border-color: var(--green);
  background: #edf7f2;
}

.drop-title {
  display: block;
  font-size: 1.05rem;
  font-weight: 850;
}

.drop-meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.segment {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 820;
}

.segment.active {
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 1px 4px rgba(17, 17, 17, 0.08);
}

.actions {
  display: flex;
  gap: 8px;
}

.actions button,
.primary {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  font-weight: 820;
}

.actions .ghost {
  color: var(--ink);
  background: var(--panel);
}

.primary {
  width: 100%;
  margin-top: 12px;
}

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

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 780;
  text-transform: uppercase;
}

.field.compact {
  margin-bottom: 12px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
  padding: 9px 10px;
  font-size: 0.92rem;
  font-weight: 650;
  text-transform: none;
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 180px;
  gap: 12px;
  margin-bottom: 26px;
  padding: 14px;
}

.section-head {
  align-items: center;
  margin: 0 0 14px;
}

.section-head > span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 760;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.product-card {
  min-height: 206px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.product-brand {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.product-title {
  margin-top: 2px;
  font-size: 1.18rem;
  line-height: 1.1;
  font-weight: 900;
}

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 730;
}

.phase {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}

.phase.transit {
  background: #e8f3ee;
  color: var(--green);
}

.phase.arrival {
  background: #edf2f7;
  color: var(--blue);
}

.phase.attention {
  background: #fbedea;
  color: var(--red);
}

.phase.scheduled {
  background: #f7f1df;
  color: var(--amber);
}

.breakdown-list {
  display: grid;
  gap: 10px;
}

.breakdown-row {
  display: grid;
  gap: 5px;
}

.breakdown-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 760;
}

.bar-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #eeeeea;
}

.bar-fill {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: var(--ink);
}

.product-total {
  margin-top: 14px;
  font-size: 0.88rem;
  font-weight: 900;
}

.product-total span {
  color: var(--muted);
  font-weight: 700;
}

.table-section {
  overflow: hidden;
}

.compact-head {
  margin: 0;
  padding: 16px 16px 0;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

td {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 650;
}

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

.empty {
  grid-column: 1 / -1;
  min-height: 160px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
  font-weight: 760;
  text-align: center;
}

@media (max-width: 980px) {
  .metrics,
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 720px) {
  .shell {
    width: min(100% - 22px, 1180px);
    padding-top: 18px;
  }

  .topbar {
    display: grid;
  }

  .header-meta {
    justify-content: flex-start;
  }

  .metrics,
  .product-grid,
  .toolbar,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 110px;
  }
}
