/* Consolidated Analytics Accepted Orders — interface styles
   A dispatch ledger: quiet chrome, monospace numerics, one accent. */

:root {
  --ink:        #131a24;
  --ink-soft:   #46536a;
  --muted:      #77839a;
  --canvas:     #eceef2;
  --surface:    #ffffff;
  --rule:       #dde1e8;
  --rule-soft:  #eaedf2;
  --accent:     #1f6f5c;
  --accent-dim: #e6f0ed;
  --manual:     #a8681a;
  --manual-dim: #fbf1e2;
  --rush:       #b4342c;

  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }

.rail {
  width: 264px;
  flex: 0 0 264px;
  background: var(--ink);
  color: #cdd5e2;
  padding: 22px 0 32px;
  display: flex;
  flex-direction: column;
}

.brand {
  padding: 0 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,.09);
  margin-bottom: 16px;
}
.brand strong {
  display: block;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand span {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #6f7d94;
}

.rail-label {
  padding: 0 22px 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: #6f7d94;
}

.client-list { list-style: none; margin: 0; padding: 0; flex: 1; overflow-y: auto; }

.client-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 22px;
  color: #cdd5e2;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.client-list a:hover { background: rgba(255,255,255,.05); color: #fff; }
.client-list a.on {
  background: rgba(255,255,255,.08);
  border-left-color: var(--accent);
  color: #fff;
  font-weight: 500;
}
.client-list .count {
  font-family: var(--mono);
  font-size: 11.5px;
  color: #7d8ba3;
}
.client-list a.on .count { color: #9fd8c6; }

.rail-foot {
  padding: 16px 22px 0;
  border-top: 1px solid rgba(255,255,255,.09);
  margin-top: 12px;
}
.rail-foot a { color: #8d9aae; font-size: 12.5px; text-decoration: none; }
.rail-foot a:hover { color: #fff; }

/* ---------- main ---------- */
.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.page-head .sub {
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
}

/* ---------- stats ---------- */
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 7px;
  padding: 11px 16px;
  min-width: 132px;
}
.stat .k {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat .v {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 500;
  margin-top: 2px;
  letter-spacing: -0.02em;
}

/* ---------- toolbar ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.search { flex: 1; min-width: 220px; display: flex; gap: 8px; }

input[type=text], input[type=password], input[type=search],
input[type=datetime-local], select, textarea {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 8px 11px;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.btn {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 6px;
  padding: 8px 15px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { background: #22304a; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.btn.ghost:hover { border-color: var(--ink); background: var(--surface); }
.btn.go { background: var(--accent); border-color: var(--accent); }
.btn.go:hover { background: #1a5b4c; }

/* ---------- table ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
}

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

table.ledger { width: 100%; border-collapse: collapse; }

table.ledger th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  padding: 11px 12px;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
  background: #f7f8fa;
}
table.ledger td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}
table.ledger tbody tr:last-child td { border-bottom: none; }
table.ledger tbody tr:hover { background: #f9fafb; }

td.num, th.num { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
td.money { font-family: var(--mono); font-size: 13px; text-align: right; white-space: nowrap; }

.addr { font-weight: 500; }
.addr small {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}

/* source marker — the one bold move: a tick of colour per row origin */
td.src { width: 4px; padding: 0; }
td.src i { display: block; width: 4px; height: 100%; min-height: 44px; }
td.src i.bot { background: var(--accent); }
td.src i.manual { background: var(--manual); }

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--accent-dim);
  color: var(--accent);
}
.tag.manual { background: var(--manual-dim); color: var(--manual); }
.tag.rush { background: #fbeceb; color: var(--rush); margin-left: 5px; }

/* ---------- empty ---------- */
.empty { padding: 46px 24px; text-align: center; color: var(--muted); }
.empty p { margin: 0 0 4px; }
.empty strong { color: var(--ink); display: block; margin-bottom: 6px; font-size: 15px; }

/* ---------- manual entry ---------- */
details.add { margin-top: 18px; }
details.add > summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 500;
  font-size: 13.5px;
  padding: 8px 15px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
}
details.add > summary::-webkit-details-marker { display: none; }
details.add > summary:hover { border-color: var(--ink); }
details.add[open] > summary { border-radius: 6px 6px 0 0; border-bottom-color: transparent; }

.form-body {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 0 8px 8px 8px;
  padding: 20px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 13px;
}
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}
.field.req label::after { content: " *"; color: var(--rush); }
.form-actions {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--rule-soft);
  display: flex;
  gap: 10px;
  align-items: center;
}
.hint { color: var(--muted); font-size: 12.5px; }

/* ---------- notices ---------- */
.notice {
  padding: 11px 15px;
  border-radius: 7px;
  margin-bottom: 16px;
  font-size: 13.5px;
  border: 1px solid;
}
.notice.ok  { background: var(--accent-dim); border-color: #bcdcd2; color: #14503f; }
.notice.bad { background: #fbecea; border-color: #f0cdc9; color: #8f2a22; }

/* ---------- sign in ---------- */
.signin-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.signin {
  width: 100%;
  max-width: 330px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 28px;
}
.signin h1 { margin: 0 0 4px; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.signin p.sub {
  margin: 0 0 20px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.signin .btn { width: 100%; margin-top: 14px; text-align: center; }

/* ---------- responsive ---------- */
/* ---------- stat cards: sub-line + emphasised first card ---------- */

.stat .s {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
  font-family: var(--sans);
}
.stat.big {
  border-color: #bcdcd2;
  background: var(--accent-dim);
}
.stat.big .v { color: var(--accent); }
.stat.big .k { color: #2c6d5c; }
.stat .v-sub { color: var(--muted); font-size: .62em; font-weight: 500; }

/* ---------- panel heading ---------- */

.panel-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

/* ---------- 14-day bars ---------- */

.spark {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 130px;
}
.spark-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}
.spark-n {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  height: 15px;
  line-height: 15px;
}
.spark-bar {
  width: 100%;
  max-width: 34px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  transition: background .12s;
}
.spark-bar.zero { background: var(--rule); }
.spark-col:hover .spark-bar { background: #2c8a72; }
.spark-d {
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  text-align: center;
  line-height: 1.25;
}
.spark-d small { display: block; font-size: 9px; opacity: .75; }

/* ---------- count pills in the overview table ---------- */

.pill {
  display: inline-block;
  min-width: 26px;
  padding: 2px 7px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
}
.pill.live { background: var(--accent-dim); color: var(--accent); font-weight: 500; }
.pill.zero { background: transparent; color: var(--muted); }

.btn.small { padding: 5px 11px; font-size: 12px; }

table.ledger tfoot td {
  padding: 11px 12px;
  border-top: 1px solid var(--rule);
  background: #f7f8fa;
}

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .rail { width: 100%; flex: none; padding-bottom: 16px; }
  .client-list { display: flex; overflow-x: auto; }
  .client-list a { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; }
  .client-list a.on { border-left: none; border-bottom-color: var(--accent); }
  .main { padding: 20px 16px 50px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
