/* LoopBite Ledger console. A ledger sheet: cool paper, ink, debit green, credit red only where
   something needs attention. System faces only - the console loads nothing from elsewhere. */
:root {
  --paper: #f3f5f4;
  --sheet: #ffffff;
  --ink: #18221f;
  --ink-2: #51605b;
  --rule: #dbe2df;
  --rule-strong: #b3c0bb;
  --accent: #1d6b57;
  --accent-soft: #dcece6;
  --warn: #9a6a06;
  --warn-soft: #f6ebcf;
  --bad: #b23a2e;
  --bad-soft: #f7e0dd;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1513;
    --sheet: #161e1b;
    --ink: #e5ece9;
    --ink-2: #a5b3ae;
    --rule: #26312d;
    --rule-strong: #3a4843;
    --accent: #5cc4a6;
    --accent-soft: #173a31;
    --warn: #e0b24f;
    --warn-soft: #3a2f14;
    --bad: #ef8a7e;
    --bad-soft: #3f1f1b;
    color-scheme: dark;
  }
}
* {
  box-sizing: border-box;
}
html, body {
  margin: 0;
}
body {
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.5 var(--sans);
}
a {
  color: var(--accent);
  text-underline-offset: 3px;
}
button, input, select {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}
nav.side {
  background: var(--sheet);
  border-right: 1px solid var(--rule);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.brand {
  font-weight: 700;
  font-size: 16px;
  padding: 4px 10px 14px;
  letter-spacing: -0.01em;
}
.brand small {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: var(--ink-2);
}
nav.side a {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
}
nav.side a:hover {
  background: var(--paper);
}
nav.side a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
nav.side .spacer {
  flex: 1;
}
nav.side button.link {
  background: none;
  border: 0;
  text-align: left;
  padding: 7px 10px;
  color: var(--ink-2);
  cursor: pointer;
}

main {
  padding: 24px 28px 48px;
  min-width: 0;
  display: grid;
  gap: 18px;
  align-content: start;
}
h1 {
  font-size: 22px;
  margin: 0;
  letter-spacing: -0.01em;
}
h2 {
  font-size: 15px;
  margin: 0;
}
.sub {
  color: var(--ink-2);
  margin: 0;
}
.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
}
.card {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 12px;
  min-width: 0;
}
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.tile {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 14px 16px;
  display: grid;
  gap: 4px;
}
.tile .label {
  font-size: 12px;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tile .value {
  font: 600 22px/1.2 var(--mono);
  font-variant-numeric: tabular-nums;
}
.tile.bad {
  border-color: var(--bad);
}
.tile.good .value {
  color: var(--accent);
}
.tile.bad .value {
  color: var(--bad);
}

.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  padding: 8px 10px;
  border-bottom: 1px solid var(--rule-strong);
  white-space: nowrap;
}
td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
td.num, th.num {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
tr.click {
  cursor: pointer;
}
tr.click:hover td {
  background: var(--paper);
}
tfoot td {
  font-weight: 600;
  border-top: 1px solid var(--rule-strong);
  border-bottom: 0;
}
.mono {
  font-family: var(--mono);
  font-size: 13px;
}
.muted {
  color: var(--ink-2);
}

.pill {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-2);
  white-space: nowrap;
}
.pill.ok {
  background: var(--accent-soft);
  color: var(--accent);
}
.pill.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.pill.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

label.field {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-2);
}
input, select {
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  padding: 7px 9px;
  min-width: 0;
}
button, a.button {
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
}
a.button {
  display: inline-block;
  color: var(--ink);
  text-decoration: none;
}
button.primary, a.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--sheet);
  font-weight: 600;
}
button.danger {
  color: var(--bad);
  border-color: var(--bad);
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}

.notice {
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--warn-soft);
  color: var(--warn);
}
.notice.bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.notice.ok {
  background: var(--accent-soft);
  color: var(--accent);
}
pre.json {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 10px;
  overflow-x: auto;
  font: 12px/1.45 var(--mono);
  margin: 0;
}
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}
.tabs button, .tabs a {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  padding: 8px 10px;
  color: var(--ink-2);
  text-decoration: none;
}
.tabs button[aria-selected="true"], .tabs a[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.signin {
  max-width: 420px;
  margin: 12vh auto;
}
.signin button.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  justify-self: start;
}
/* A field the form does not need yet (the code, the organisation) - over label.field's grid. */
[hidden] {
  display: none !important;
}
.who {
  padding: 0 10px 12px;
  font-size: 13px;
}
.who small {
  display: block;
  color: var(--ink-2);
}
/* The company switcher, in a tenant that keeps several companies (ADR-0035). */
label.company {
  display: grid;
  gap: 4px;
  padding: 0 10px 12px;
  font-size: 12px;
  color: var(--ink-2);
}
label.company select {
  width: 100%;
}
.m0 {
  margin: 0;
}
.stack {
  display: grid;
  gap: 12px;
}
.stack.wide {
  gap: 16px;
}
/* A report's output: one column that may shrink, so a wide table scrolls inside its card rather than
   widening the card (and the page) to its own width. */
.shrink {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.row.between {
  justify-content: space-between;
  align-items: center;
}
.loading {
  padding: 24px;
}

@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
  }
  nav.side {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    padding: 10px;
  }
  .brand {
    width: 100%;
    padding-bottom: 6px;
  }
  .who,
  label.company {
    width: 100%;
    padding-bottom: 6px;
  }
  nav.side .spacer {
    display: none;
  }
  main {
    padding: 16px;
  }
}

/* Line editors: inputs inside a table fill their cell. */
td input, td select {
  width: 100%;
  min-width: 6em;
}
td.narrow input {
  min-width: 4em;
}
.secret {
  font: 13px/1.4 var(--mono);
  word-break: break-all;
  user-select: all;
}
.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}
.checks label {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Platform > New organisation: one card per industry, the chosen one outlined. */
.choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 10px;
}
.choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  align-items: start;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  cursor: pointer;
}
.choice > :not(input) {
  grid-column: 2;
}
.choice > strong {
  grid-row: 1;
}
.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* The inbox: a generous drop zone, big buttons for a phone, the original beside what was read. */
.dropzone {
  border: 2px dashed var(--rule-strong);
  border-radius: 10px;
  padding: 24px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.dropzone.over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.row.center {
  justify-content: center;
}
button.big {
  padding: 12px 20px;
  font-size: 15px;
}
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 860px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
}
.preview img {
  max-width: 100%;
  border-radius: 6px;
  display: block;
}
.preview pre.xml {
  margin: 0;
  max-height: 70vh;
  overflow: auto;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre;
}

/* The phone count screen: one place, one big field per ingredient, Submit always within reach. Inputs
   are 18px so a phone does not zoom in on focus. */
.count-screen {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 16px 24px;
  display: grid;
  gap: 12px;
  align-content: start;
}
.count-head {
  display: grid;
  gap: 6px;
}
.count-head h1 {
  font-size: 26px;
}
.count-progress {
  display: grid;
  gap: 4px;
  font-weight: 600;
}
.count-progress progress {
  width: 100%;
  height: 8px;
  accent-color: var(--accent);
}
.count-places {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.count-places a.pill {
  text-decoration: none;
  padding: 4px 10px;
}
.count-places a[aria-current="page"] {
  font-weight: 600;
}
.count-lines {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 8px;
}
.count-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--rule);
  align-items: center;
}
.count-line:last-child {
  border-bottom: 0;
}
.count-line .what {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.count-line .what b {
  font-size: 16px;
  overflow-wrap: anywhere;
}
.count-line .what small {
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.count-line .entry {
  display: flex;
  align-items: center;
  gap: 6px;
}
.count-line input.qty {
  width: 6.5em;
  font: 18px/1.2 var(--mono);
  padding: 10px;
  text-align: right;
}
.count-line .unit {
  color: var(--ink-2);
  min-width: 2.5em;
}
.save-state.ok {
  color: var(--accent);
}
.save-state.bad {
  color: var(--bad);
}
.count-submit {
  position: sticky;
  bottom: 0;
  padding: 10px 0 4px;
  background: var(--paper);
}
.count-submit button {
  width: 100%;
  padding: 16px;
  font-size: 17px;
}
