:root {
  --gh-olive: #585828;
  --gh-cream: #F8F8E8;
  --gh-olive-muted: #809060;
  --gh-sage: #D8E0C0;
  --gh-sky: #D8F0F8;
  --gh-white: #FFFFFF;
  --gh-warn: #8A5A2B; /* warm brown for negatives, per brand guidance */

  --gh-font: 'Chapeau', 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--gh-cream);
  color: var(--gh-olive);
  font-family: var(--gh-font);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: var(--gh-olive);
  color: var(--gh-cream);
}

.topbar h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.topbar-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--gh-sage);
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--gh-olive-muted);
  color: var(--gh-cream);
  white-space: nowrap;
}

.topbar-user {
  font-size: 13px;
  color: var(--gh-sage);
}

.topbar-user a {
  color: var(--gh-cream);
}

.container {
  padding: 24px 32px 48px;
  max-width: 1400px;
  margin: 0 auto;
}


.card {
  background: var(--gh-white);
  border: 1px solid var(--gh-sage);
  border-radius: 12px;
  padding: 20px 22px;
}

.card h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 14px;
  color: var(--gh-olive);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
}

.kpi {
  background: var(--gh-sage);
  border-radius: 10px;
  padding: 14px 16px;
  min-width: 0;
}

.kpi .label {
  font-size: 12px;
  color: var(--gh-olive-muted);
  margin-bottom: 4px;
}

.kpi .value {
  font-size: 22px;
  font-weight: 700;
  overflow-wrap: break-word;
}

section.block {
  margin-bottom: 28px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--gh-sage);
}

th {
  color: var(--gh-olive-muted);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

th.sortable::after {
  content: ' \2195';
  font-size: 11px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--gh-sky);
}

.status-success { color: var(--gh-olive-muted); }
.status-error { color: var(--gh-warn); }

.login-wrap {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
}

.login-wrap h1 { font-size: 28px; }






.btn {
  background: var(--gh-olive);
  color: var(--gh-cream);
  border: none;
  border-radius: 8px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--gh-font);
}

.btn:hover { background: var(--gh-olive-muted); }



select {
  font-family: var(--gh-font);
  border: 1px solid var(--gh-sage);
  border-radius: 6px;
  padding: 6px 10px;
  background: var(--gh-white);
  color: var(--gh-olive);
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--gh-sage);
}

.tab-btn {
  font-family: var(--gh-font);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 12px 4px;
  margin-right: 24px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gh-olive-muted);
  cursor: pointer;
}

.tab-btn.active {
  color: var(--gh-olive);
  border-bottom-color: var(--gh-olive);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }




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









/* ---- Shortage dashboard additions ---- */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.kpi .value.short { color: var(--gh-warn); }
.kpi .sub { font-size: 12px; color: var(--gh-olive-muted); margin-top: 2px; }

.banner {
  border: 1px solid var(--gh-warn);
  color: var(--gh-warn);
  background: var(--gh-white);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 14px;
}
.banner[hidden] { display: none; }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-head .hint { font-size: 12px; color: var(--gh-olive-muted); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
  margin: 4px 0 14px;
}
.filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--gh-olive-muted);
}
.filters input[type="date"], .filters input[type="search"] {
  font-family: var(--gh-font);
  border: 1px solid var(--gh-sage);
  border-radius: 6px;
  padding: 5px 8px;
  background: var(--gh-white);
  color: var(--gh-olive);
}
.filters label.check { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; color: var(--gh-olive); }
.filters .btn { padding: 8px 14px; font-size: 13px; }
.btn.secondary { background: var(--gh-sage); color: var(--gh-olive); }
.btn.secondary:hover { background: var(--gh-olive-muted); color: var(--gh-cream); }

td.num, th.num { text-align: right; white-space: nowrap; }
td.short { color: var(--gh-warn); font-weight: 700; }
td.nowrap { white-space: nowrap; }
td.details { font-size: 12px; color: var(--gh-olive-muted); min-width: 260px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--gh-cream); }
tr.selected { background: var(--gh-sage); }

.lines-table { font-size: 13px; }
.lines-table th, .lines-table td { padding: 6px 8px; }
.lines-table thead th { position: sticky; top: 0; background: var(--gh-white); }
/* Sized so the headline totals and the order lines fit on one screen; the table scrolls inside. */
/* First table on each page. Its height is set by fitRows() in the page's script to show
   40 rows before it scrolls inside; this is only the starting height until then. */
.lines-scroll { max-height: 1200px; overflow: auto; }
.count { font-size: 13px; color: var(--gh-olive-muted); margin: 0 0 8px; }

details.card summary { cursor: pointer; font-weight: 600; font-size: 16px; }
details.card[open] summary { margin-bottom: 14px; }
.warnings li { font-size: 13px; margin-bottom: 4px; }

.login-wrap p.error { color: var(--gh-warn); font-size: 14px; margin: 0; }

@media (max-width: 720px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; }
  .topbar-meta { flex-wrap: wrap; gap: 8px 12px; }
  .container { padding: 16px 16px 40px; }
  .card { padding: 16px; }
  .topbar-badge { white-space: normal; }
}

.filters select { max-width: 100%; }
.filters label { max-width: 100%; }
td.wide { min-width: 200px; }

/* ---- Page tabs (Blue Dot / Nashua & CDS) ---- */
.page-tabs {
  display: flex;
  gap: 4px;
  padding: 0 32px;
  background: var(--gh-olive);
  border-top: 1px solid var(--gh-olive-muted);
}
.page-tabs a {
  padding: 10px 14px;
  color: var(--gh-sage);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 3px solid transparent;
}
.page-tabs a:hover { color: var(--gh-cream); }
.page-tabs a.active { color: var(--gh-cream); border-bottom-color: var(--gh-cream); }
.note { font-size: 13px; color: var(--gh-olive-muted); margin: -8px 0 16px; }
@media (max-width: 720px) { .page-tabs { padding: 0 8px; } }
.summary-table tr.group-start td { border-top: 2px solid var(--gh-olive-muted); }
.summary-table td.group { font-weight: 700; }
.summary-table a { color: var(--gh-olive); font-weight: 600; }
.summary-table tr.product.open { background: var(--gh-sage); }
.summary-table td.sku { font-weight: 600; }
.summary-table .caret { display: inline-block; width: 1em; color: var(--gh-olive-muted); }
.summary-table tr.order-line td { font-size: 12px; background: var(--gh-cream); border-top: none; }
.summary-table tr.order-line.covered td { color: var(--gh-olive-muted); }
.summary-table td.open-page { padding-top: 4px; padding-bottom: 10px; }
.sl-result { border: 1px solid var(--gh-sage); border-radius: 8px; padding: 12px 16px; margin: 8px 0 12px; font-size: 14px; }
.sl-result.error { border-color: var(--gh-warn); color: var(--gh-warn); }
.sl-result ul { padding-left: 20px; }
.sl-changes { font-size: 13px; margin: 6px 0; max-width: 520px; }
#shelf-life a.btn { text-decoration: none; display: inline-block; }
