/* Brand tokens are injected at runtime from the active company profile
   (see config/profiles/*.js). The values below are fallbacks only.
   Matched to evolveecoblasting.com: base #050505, Neue Montreal 300/400/500/700,
   uppercase wide-tracked eyebrows, pill CTA in lime on near-black. */

@font-face {
  font-family: "Neue Montreal";
  src: url("/fonts/NeueMontreal-Light.otf") format("opentype");
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Neue Montreal";
  src: url("/fonts/NeueMontreal-Regular.otf") format("opentype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Neue Montreal";
  src: url("/fonts/NeueMontreal-Medium.otf") format("opentype");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Neue Montreal";
  src: url("/fonts/NeueMontreal-Bold.otf") format("opentype");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --bg: #0a0a0a;
  --bg-deep: #050505;
  --panel: #101212;
  --panel-2: #161918;
  --line: rgba(255, 255, 255, 0.10);
  --line-soft: rgba(255, 255, 255, 0.055);
  --line-bright: rgba(255, 255, 255, 0.25);
  --text: #f3f4f6;
  --muted: rgba(255, 255, 255, 0.60);
  --dim: rgba(255, 255, 255, 0.38);
  --green: #4ade80;
  --lime: #00ff41;
  --amber: #fbbf24;
  --red: #f87171;
  --radius: 10px;
  --font: "Neue Montreal", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* The site's signature eyebrow: small, uppercase, widely tracked, green rule. */
.eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
}
.rule {
  height: 2px;
  width: 44px;
  background: var(--green);
  margin: 12px 0 0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }

/* ---- login ---------------------------------------------------------------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(74, 222, 128, 0.10), transparent 70%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 34px 28px;
}
/* Display headings mirror the site: large, medium weight, tight negative
   tracking, uppercase. */
.login-card h1 {
  margin: 0 0 6px;
  font-size: 34px;
  letter-spacing: -0.02em;
  line-height: 0.94;
  text-transform: uppercase;
  font-weight: 500;
}
.login-card h1 span + span { color: var(--green); }
.login-card .sub {
  color: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  margin-bottom: 26px;
}
.login-rule { height: 2px; width: 46px; background: var(--green); margin: 16px 0 20px; }

label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
}
input, select, textarea {
  width: 100%;
  background: #0d0f0e;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  margin-bottom: 15px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.13);
}
textarea { min-height: 76px; resize: vertical; }

/* Pill CTA, as on the live site: full radius, near-black text on green,
   bold uppercase at ~0.14em tracking. */
.btn {
  background: var(--green);
  color: #050505;
  border: none;
  border-radius: 100px;
  padding: 12px 22px;
  font-family: var(--font);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12.5px;
  transition: background 0.15s ease;
}
.btn:hover { background: var(--lime); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-full { width: 100%; }
.btn-ghost {
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line-bright);
  border-radius: 100px;
  letter-spacing: 0.1em;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }

.error {
  color: var(--red);
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 18px;
}

/* ---- shell ---------------------------------------------------------------- */
.app { display: none; min-height: 100vh; }
.app.active { display: block; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(10, 10, 10, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 14px;
  white-space: nowrap;
}
.brand #brand-suffix { color: var(--green); }
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  color: var(--muted);
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); display: inline-block; margin-right: 6px;
}

.nav {
  display: flex;
  gap: 2px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--bg);
  position: sticky;
  top: 49px;
  z-index: 29;
}
.nav::-webkit-scrollbar { display: none; }
.nav button {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 12px 14px;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 300;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}
.nav button:hover { color: var(--text); }
.nav button.active { color: var(--green); border-bottom-color: var(--green); }

main { padding: 22px; max-width: 1560px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }

/* ---- cards / grid --------------------------------------------------------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
}
.kpi .label {
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}
.kpi .value { font-size: 25px; font-weight: 700; letter-spacing: -0.02em; }
.kpi .value.green { color: var(--green); }
.kpi .value.amber { color: var(--amber); }
.kpi .value.red { color: var(--red); }
.kpi .foot { font-size: 11.5px; color: var(--dim); margin-top: 5px; }

.cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(430px, 1fr));
  gap: 16px;
  align-items: start;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--green);
}
.card-head .count {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.card-body { padding: 14px 16px; }
.card-body.flush { padding: 0; }

/* ---- tables --------------------------------------------------------------- */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--panel-2);
  position: sticky;
  top: 0;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, 0.022); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12px; }
.wrap { min-width: 220px; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.sub { color: var(--dim); font-size: 11.5px; display: block; margin-top: 2px; }

.pill {
  display: inline-block;
  padding: 2.5px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 600;
  border: 1px solid;
  white-space: nowrap;
}
.pill.open  { color: var(--green); border-color: rgba(74,222,128,.35); background: rgba(74,222,128,.09); }
.pill.won   { color: #34d399; border-color: rgba(52,211,153,.35); background: rgba(52,211,153,.09); }
.pill.lost  { color: var(--dim); border-color: var(--line); background: transparent; }
.pill.void  { color: var(--dim); border-color: var(--line); background: transparent; text-decoration: line-through; }
.pill.warn  { color: var(--amber); border-color: rgba(251,191,36,.35); background: rgba(251,191,36,.09); }
.pill.bad   { color: var(--red); border-color: rgba(248,113,113,.35); background: rgba(248,113,113,.09); }
.pill.draft { color: #93c5fd; border-color: rgba(147,197,253,.35); background: rgba(147,197,253,.08); }
.pill.other { color: var(--muted); border-color: var(--line); }

.empty { padding: 26px 16px; color: var(--dim); text-align: center; font-size: 13px; }
.loading { padding: 40px 16px; color: var(--muted); text-align: center; font-size: 13px; }

/* ---- alerts --------------------------------------------------------------- */
.alert-row {
  display: flex;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft);
  align-items: flex-start;
}
.alert-row:last-child { border-bottom: none; }
.alert-bar { width: 3px; border-radius: 2px; background: var(--green); flex: 0 0 3px; align-self: stretch; }
.alert-bar.warn { background: var(--amber); }
.alert-bar.bad { background: var(--red); }
.alert-main { flex: 1; min-width: 0; }
.alert-main .t { font-size: 13px; }
.alert-meta { font-size: 11.5px; color: var(--dim); margin-top: 3px; }

/* ---- price history bars --------------------------------------------------- */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 34px; }
.spark i {
  flex: 1;
  min-width: 4px;
  background: rgba(74, 222, 128, 0.42);
  border-radius: 2px 2px 0 0;
  display: block;
}
.spark i.last { background: var(--green); }

/* ---- forms ---------------------------------------------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0 14px;
}
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.form-msg { font-size: 13px; }
.form-msg.ok { color: var(--green); }
.form-msg.err { color: var(--red); }
.hint { font-size: 11.5px; color: var(--dim); margin: -8px 0 14px; }

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar input, .toolbar select { margin-bottom: 0; width: auto; min-width: 190px; }

/* ---- section hero --------------------------------------------------------- */
.hero {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  min-height: 132px;
  display: flex;
  align-items: flex-end;
  border: 1px solid var(--line);
  background: var(--bg-deep);
}
.hero-tall { min-height: 210px; }
.hero-img, .hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-size: cover;
  background-position: center 40%;
}
/* The site runs its media dark so headline text stays legible; same here. */
.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5,5,5,0.94) 0%, rgba(5,5,5,0.72) 45%, rgba(5,5,5,0.35) 100%),
    linear-gradient(0deg, rgba(5,5,5,0.85) 0%, rgba(5,5,5,0.10) 70%);
}
.hero-body { position: relative; padding: 20px 24px; }
.hero-title {
  margin: 8px 0 0;
  font-size: clamp(26px, 3.4vw, 42px);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

/* ---- charts --------------------------------------------------------------- */
/* Chart.js owns the canvas width/height attributes and its own device-pixel
   scaling. Forcing a CSS width on the canvas desynchronises the drawing buffer
   from the element and squashes every mark, so only the parent is sized here. */
.chart-box { position: relative; width: 100%; min-width: 0; }
.chart-note {
  font-size: 11.5px;
  color: var(--dim);
  margin-top: 12px;
  line-height: 1.45;
}
.notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  background: rgba(74, 222, 128, 0.05);
  border-radius: 8px;
  padding: 12px 15px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 16px;
  line-height: 1.5;
}
.notice.warn { border-left-color: var(--amber); background: rgba(251, 191, 36, 0.05); }
.warn-note {
  border-left: 3px solid var(--amber);
  background: rgba(251, 191, 36, 0.06);
  padding: 11px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.8);
  margin: 14px 0;
  line-height: 1.5;
}

/* ---- receipts ------------------------------------------------------------- */
.receipt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 14px;
}
.receipt-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  padding: 0;
  text-align: left;
  color: inherit;
  font: inherit;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.receipt-card:hover { border-color: var(--green); transform: translateY(-2px); }
.receipt-thumb {
  width: 100%;
  height: 132px;
  object-fit: cover;
  background: #0b0d0c;
  display: block;
}
.receipt-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  font-size: 11.5px;
  text-align: center;
  padding: 10px;
}
.receipt-meta { padding: 11px 12px 13px; }
.receipt-vendor { font-weight: 600; font-size: 13px; line-height: 1.25; }
.receipt-sub { font-size: 11.5px; color: var(--dim); margin-top: 3px; }
.receipt-total { font-size: 15px; font-weight: 600; color: var(--green); margin-top: 7px; }
.receipt-flag { font-size: 10.5px; color: var(--amber); margin-top: 5px; line-height: 1.35; }

/* ---- drawer --------------------------------------------------------------- */
.drawer-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  z-index: 60;
  animation: fade 0.16s ease;
}
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(560px, 100%);
  background: var(--panel);
  border-left: 1px solid var(--line);
  z-index: 61;
  display: flex;
  flex-direction: column;
  animation: slide 0.2s ease;
}
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--green);
  font-weight: 700;
}
.drawer-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  padding: 0 4px;
}
.drawer-close:hover { color: var(--text); }
.drawer-body { padding: 18px 20px 40px; overflow-y: auto; }
body.drawer-open { overflow: hidden; }

.detail-list { margin: 0 0 4px; }
.detail-row {
  display: flex;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.detail-row dt {
  flex: 0 0 152px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding-top: 2px;
}
.detail-row dd { margin: 0; flex: 1; word-break: break-word; }
.detail-block { margin-top: 20px; }
.detail-block-title {
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 9px;
  font-weight: 600;
}
.detail-ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.6; }
.detail-ul li { margin-bottom: 4px; }
.control-detail { font-size: 13px; line-height: 1.6; color: rgba(255,255,255,0.8); margin: 0; }
.control-card { padding: 4px 0 14px; }
.control-title { margin: 10px 0 8px; font-size: 17px; font-weight: 500; }

.lightbox-link { display: block; margin-bottom: 18px; }
.lightbox-img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0b0d0c;
  display: block;
}

.link-btn {
  background: none;
  border: none;
  color: var(--green);
  padding: 0;
  font: inherit;
  font-size: 12.5px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { color: var(--lime); }

/* ---- mobile --------------------------------------------------------------- */
@media (max-width: 860px) {
  main { padding: 14px; }
  .topbar { padding: 11px 12px; gap: 10px; }
  .brand { font-size: 12.5px; letter-spacing: 0.11em; }
  .topbar-right { gap: 8px; font-size: 11.5px; }
  .topbar-right button { white-space: nowrap; padding: 6px 9px !important; }
  #freshness { white-space: nowrap; }
  .nav { padding: 0 8px; top: 47px; }
  .nav button { padding: 11px 11px; font-size: 12px; }
  .cols { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(142px, 1fr)); gap: 9px; }
  .kpi { padding: 12px 13px; }
  .kpi .value { font-size: 21px; }
  .topbar-right .who { display: none; }

  /* Tables become stacked records — no horizontal scrolling on a phone. */
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr {
    border-bottom: 1px solid var(--line);
    padding: 11px 14px;
  }
  table.responsive tr:last-child { border-bottom: none; }
  table.responsive td {
    border: none;
    padding: 3px 0;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: baseline;
  }
  table.responsive td::before {
    content: attr(data-label);
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    flex: 0 0 auto;
  }
  table.responsive td.num { text-align: right; }
  table.responsive td .wrap, table.responsive td .sub { text-align: right; }
  table.responsive td:first-child {
    font-weight: 600;
    padding-bottom: 7px;
  }

  .hero { min-height: 104px; margin-bottom: 15px; }
  .hero-tall { min-height: 150px; }
  .hero-body { padding: 15px 16px; }
  .eyebrow { font-size: 9.5px; letter-spacing: 0.24em; }

  .receipt-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 11px; }
  .receipt-thumb { height: 106px; }

  /* Full-width sheet on a phone, and the detail rows stack. */
  .drawer { width: 100%; top: auto; height: 92vh; border-left: none; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0; }
  @keyframes slide { from { transform: translateY(28px); opacity: 0; } }
  .detail-row { flex-direction: column; gap: 2px; }
  .detail-row dt { flex: none; }

  .toolbar { gap: 8px; }
  .toolbar input, .toolbar select { min-width: 0; flex: 1 1 140px; }
}
