:root {
  color-scheme: light;
  --ink: #161a1d;
  --muted: #5d676f;
  --paper: #f4f5f1;
  --panel: #ffffff;
  --line: #c9cdd0;
  --rail: #2b3033;
  --blue: #246a8f;
  --green: #19735d;
  --yellow: #f2c84b;
  --red: #b33f31;
  --wash: #e7edf0;
  --shadow: 0 14px 36px rgba(33, 39, 43, 0.12);
  font-family: "Aptos", "Segoe UI", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(43, 48, 51, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(43, 48, 51, 0.045) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px clamp(14px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  background: rgba(244, 245, 241, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 900;
}

.brand span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  background: var(--rail);
  color: var(--yellow);
}

.brand strong {
  overflow-wrap: anywhere;
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.topbar nav a {
  padding: 8px 10px;
  color: var(--muted);
  font-weight: 800;
}

.workbench {
  display: grid;
  gap: clamp(14px, 2.5vw, 24px);
  padding: clamp(14px, 3vw, 34px);
}

.control-band,
.grid,
.boundary {
  width: min(100%, 1640px);
  margin: 0 auto;
}

.control-band {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 16px;
  align-items: stretch;
}

.title-block,
.panel,
.boundary article,
.metrics article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.title-block {
  min-height: 170px;
  padding: clamp(18px, 3vw, 28px);
}

.kicker {
  margin: 0;
  color: var(--blue);
  font-size: 0.74rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p,
td,
th {
  overflow-wrap: anywhere;
}

h1 {
  margin: 8px 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 5vw, 5rem);
  line-height: 0.9;
  letter-spacing: 0;
}

h2 {
  margin: 6px 0 0;
  font-size: clamp(1.12rem, 2vw, 1.55rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.notice,
.boundary p {
  color: var(--muted);
  line-height: 1.5;
}

.notice {
  margin: 14px 0 0;
  min-height: 24px;
  font-weight: 750;
}

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

.metrics article {
  min-height: 170px;
  display: grid;
  align-content: space-between;
  padding: 16px;
}

.metrics span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.metrics strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 0.9;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.55fr);
  gap: 16px;
  align-items: start;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #f7f8f5);
}

.panel-head.compact {
  padding-bottom: 14px;
}

.stack {
  display: grid;
  gap: 16px;
}

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

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

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid #e3e5e5;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f0f2ef;
  color: #48515a;
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
}

td strong {
  display: block;
  font-size: 0.95rem;
}

td span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.status {
  display: inline-grid;
  place-items: center;
  min-width: 78px;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 950;
  font-style: normal;
}

.status-ok {
  background: rgba(25, 115, 93, 0.12);
  color: var(--green);
}

.status-reorder {
  background: rgba(242, 200, 75, 0.26);
  color: #796006;
}

.status-critical {
  background: rgba(179, 63, 49, 0.14);
  color: var(--red);
}

button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--rail);
  border-radius: 7px;
  padding: 0 13px;
  background: var(--rail);
  color: #fff;
  cursor: pointer;
  font-weight: 900;
  transition: transform 140ms ease-out, box-shadow 140ms ease-out, background 140ms ease-out;
}

button:hover,
.file-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 18px rgba(22, 26, 29, 0.18);
}

button:active,
.file-button:active {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
  box-shadow: none;
}

button:focus-visible,
a:focus-visible,
textarea:focus,
input:focus,
.file-button:focus-within {
  outline: 3px solid rgba(36, 106, 143, 0.28);
  outline-offset: 2px;
}

.alert-list,
.event-log {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 16px;
  list-style: none;
}

.alert-list li,
.event-log li {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid #e0e4e4;
  border-radius: 7px;
  background: #f9faf8;
}

.alert-list span,
.event-log span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.38;
}

.empty-alert {
  color: var(--green);
  font-weight: 850;
}

form,
.import-panel {
  display: grid;
  gap: 12px;
}

form,
.import-panel > label,
.import-panel > .button-row,
.event-panel .event-log {
  padding: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fcfdfb;
  color: var(--ink);
  padding: 10px 11px;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.45;
  resize: vertical;
}

.file-button {
  justify-self: start;
  margin: 16px 16px 0;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding-top: 0;
}

.button-row.no-pad {
  padding: 0;
}

.button-row button + button {
  background: #fff;
  color: var(--rail);
}

.boundary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.boundary article {
  padding: 20px;
}

code {
  background: var(--wash);
  border-radius: 5px;
  padding: 2px 5px;
  font-size: 0.9em;
}

@media (max-width: 1080px) {
  .control-band,
  .grid,
  .boundary {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
  }

  .topbar nav {
    display: none;
  }

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

  .metrics article {
    min-height: 118px;
  }

  .panel-head,
  .button-row {
    align-items: stretch;
    flex-direction: column;
  }

  button,
  .file-button {
    width: 100%;
  }
}
