:root {
  --paper: #f1f4f9;
  --ink: #161c29;
  --navy: #1f3864;
  --steel: #5b6472;
  --line: #dfe5ee;
  --card: #ffffff;
  --bad: #b00020;
}

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

/* #login { display: flex } is more specific than the UA [hidden] rule. */
[hidden] { display: none !important; }

html, body { min-height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.45;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel);
}

h1 { font-size: 1.45rem; font-weight: 650; letter-spacing: -0.02em; }

#login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#login-form {
  width: 100%;
  max-width: 340px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 22px 22px;
}

#login-form .lead {
  color: var(--steel);
  font-size: 0.95rem;
  margin: 6px 0 18px;
}

input[type="password"],
button {
  width: 100%;
  min-height: 44px;
  font-size: 1rem;
  font-family: inherit;
  border-radius: 10px;
}

input[type="password"] {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  padding: 10px 12px;
}

.err {
  color: var(--bad);
  font-size: 0.9rem;
  min-height: 1.3em;
  margin: 8px 0 10px;
}

button {
  border: none;
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  padding: 0 16px;
}

button:active { transform: scale(0.98); }

button.secondary {
  width: auto;
  background: var(--paper);
  color: var(--navy);
  border: 1px solid var(--line);
}

#app header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 5;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#copy-week {
  width: auto;
  min-width: 44px;
}

#empty, #net-err {
  padding: 28px 16px;
  color: var(--steel);
  font-size: 1rem;
}

#harvest-banner {
  margin: 12px 16px 0;
  padding: 10px 14px;
  background: #fff4e0;
  color: #7a4b08;
  border: 1px solid #f0d9a8;
  border-radius: 10px;
  font-size: 0.95rem;
}

#board {
  padding: 12px 16px 32px;
}

#board-empty {
  padding: 20px 4px;
  color: var(--steel);
}

.chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
}

button.chip {
  width: auto;
  flex: 0 0 auto;
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  background: var(--paper);
  color: var(--navy);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 0.95rem;
}

button.chip[aria-pressed="true"] {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

button.chip-archived {
  margin-left: auto;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

button.card {
  display: block;
  width: 100%;
  min-height: 44px;
  text-align: left;
  background: var(--card);
  color: var(--ink);
  font-weight: 400;
  border: 1px solid var(--line);
  border-left: 4px solid var(--navy);
  border-radius: 12px;
  padding: 12px 14px;
}

button.card.excel-stale {
  border-left-color: #d48b0c;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.customer {
  font-weight: 650;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-chip {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  color: var(--navy);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}

.price {
  margin-left: auto;
  flex: 0 0 auto;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.lbs-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
  color: var(--steel);
}

.lbs-row .bar {
  flex: 1;
  min-width: 48px;
}

.bar {
  display: block;
  width: 100%;
  height: 6px;
  border: 0;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}

.bar::-webkit-progress-bar {
  background: var(--line);
  border-radius: 99px;
}

.bar::-webkit-progress-value {
  background: var(--navy);
  border-radius: 99px;
}

.bar::-moz-progress-bar {
  background: var(--navy);
  border-radius: 99px;
}

.card-meta {
  margin-top: 8px;
  color: var(--steel);
  font-size: 0.88rem;
}

.card-meta .initials {
  font-weight: 650;
  color: var(--ink);
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 28, 41, 0.4);
}

.drawer-sheet {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(420px, 100%);
  background: var(--card);
  overflow: auto;
  padding: 16px;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
}

button.drawer-close {
  min-height: 44px;
  min-width: 44px;
  margin-bottom: 12px;
}

.drawer-header {
  margin-bottom: 16px;
}

.drawer-header h2 {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.drawer-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.status-pill {
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--navy);
}

.owner-name {
  color: var(--steel);
}

#drawer-body section {
  margin: 18px 0;
}

#drawer-body h3 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 8px;
}

.kv-list {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 6px 12px;
}

.kv {
  display: contents;
}

.kv dt {
  color: var(--steel);
}

.kv dd {
  font-variant-numeric: tabular-nums;
}

.stack {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stack li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.empty-copy {
  color: var(--steel);
}

.narrative, .next-action {
  margin-bottom: 8px;
}

.link-note {
  color: var(--steel);
}

body.drawer-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .drawer-sheet {
    width: 100%;
    height: 100%;
    box-shadow: none;
  }
}


:root { --amber: #c47b17; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 12px 16px 0;
}
.tabs a {
  min-height: 44px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--steel);
  font-weight: 650;
  border-bottom: 3px solid transparent;
}
.tabs a.is-on, .tabs a[aria-current="page"] {
  color: var(--navy);
  border-bottom-color: var(--navy);
}

.prospect-card { text-align: left; }
.prospect-card.stale, .card.stale { border-left: 4px solid var(--amber); }
.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}
.timeline-item { padding: 10px 0; border-top: 1px solid var(--line); }
.timeline-item:first-of-type { border-top: 0; }
.timeline-meta { font-size: 0.85rem; color: var(--steel); }
.timeline-summary { font-weight: 600; }
.timeline-snippet { color: var(--steel); font-size: 0.92rem; }

@media (max-width: 720px) {
  .tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-top: 1px solid var(--line);
    background: var(--card);
    z-index: 6;
  }
  .cards, #board-empty {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }
}

#as-of { font-size: 0.85rem; color: var(--steel); }
#as-of.late { color: var(--amber, #c47b17); font-weight: 650; }
#kpi-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 12px 16px;
}
.kpi {
  min-width: 140px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
}
.kpi-num { font-size: 18px; font-weight: 700; color: var(--navy); }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--steel); }
#sot-footer { padding: 12px 16px 24px; color: var(--steel); font-size: 0.85rem; }
#harvest-banner.late { background: #fff4e0; }
#board.excel-miss .card { border-left: 4px solid var(--amber, #c47b17); }
