/* A business console in the Ruta Stitch colours: ink leads, the app's peach
   is the accent. Agreed with the owner on the mockup of 2026-10-16. */
:root {
  --ink: #1f1e23;
  --ink-2: #3d3c43;
  --muted: #6b6974;
  --line: #e3e3e8;
  --line-2: #efeff3;
  --card: #ffffff;
  --page: #f5f5f7;
  --accent: #d99d91;
  --accent-ink: #1f1e23;
  --accent-soft: #f7e7e3;
  --up: #2f7d55;
  --bad: #b4443a;
  --sans: Roboto, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f2eeeb; --ink-2: #d8d2ce; --muted: #a9a29d; --line: #36332f; --line-2: #2b2926; --card: #1f1d1b; --page: #161514;
    --accent: #e4b5ac; --accent-ink: #1f1e23; --accent-soft: #3a2c29; --up: #6cc797; --bad: #ec8a80;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.45; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gut { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.in { max-width: 1080px; margin: 0 auto; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12px; }

.bar { background: var(--card); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.bar .in { display: flex; align-items: center; gap: 22px; min-height: 56px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.brand span { color: var(--muted); font-weight: 400; }
.icon { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line); }
.icon.big { width: 48px; height: 48px; border-radius: 11px; }
nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; }
nav button { border: 0; background: transparent; padding: 18px 10px 16px; border-bottom: 2px solid transparent; cursor: pointer; color: var(--muted); white-space: nowrap; }
nav button[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
nav button:disabled { cursor: default; }
.soon, .tag { font-size: 10.5px; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 6px; color: var(--muted); font-weight: 400; }
.acct { position: relative; }
.acct > button { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 5px 10px; cursor: pointer; }
.avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.acct ul { position: absolute; right: 0; top: calc(100% + 6px); list-style: none; margin: 0; padding: 5px; min-width: 180px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgb(0 0 0 / .14); z-index: 5; }
.acct li button { width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.acct li button:hover { background: var(--page); }

main { padding-block: 24px 48px; }
.head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
.head p { margin: 3px 0 0; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; }
.period { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.period button { border: 0; background: transparent; border-radius: 6px; padding: 5px 11px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.period button[aria-pressed="true"] { background: var(--ink); color: var(--card); }
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.sm { padding: 3px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.linkbtn { border: 0; background: transparent; padding: 0; margin-top: 4px; color: var(--ink-2); font-size: 12.5px; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.card.spaced { margin-top: 16px; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-h h2 { font-size: 14px; font-weight: 600; margin: 0; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { padding: 16px 18px; min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--line-2); }
.kpi .label { color: var(--muted); font-size: 12.5px; }
.kpi .value { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 4px; letter-spacing: -0.01em; }
.kpi .delta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .delta.up { color: var(--up); }

.grid2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.side { display: grid; gap: 16px; align-content: start; }
.chart { padding: 10px 18px 12px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--sans); }
.chart .grid { stroke: var(--line-2); stroke-width: 1; }
.chart .bar-fill { fill: var(--accent); }
.codebox { padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.codebox strong { font-size: 16px; letter-spacing: .08em; }

.badges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 18px; }
.badge { margin: 0; display: grid; gap: 10px; min-width: 0; }
.badge .swatch { display: grid; place-items: center; padding: 14px; border-radius: 10px; background: var(--page);
  aspect-ratio: 2 / 1; position: relative; }
.badge img { position: absolute; inset: 14px; width: calc(100% - 28px); height: calc(100% - 28px); object-fit: contain; }
.badge figcaption { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
a.btn { color: inherit; text-decoration: none; }
.qrwrap { padding: 18px; display: grid; place-items: center; background: var(--page); border-radius: 0 0 12px 12px; }
.qrcard canvas { display: block; width: min(360px, 100%); height: auto; }
select { font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 14px; text-align: right; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; border-bottom: 1px solid var(--line); }
td { border-bottom: 1px solid var(--line-2); }
th:first-child, td:first-child { text-align: left; padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
td .nm { font-weight: 600; }
td.zero { color: var(--muted); }
tfoot td { font-weight: 600; border-bottom: 0; background: var(--line-2); }
.acts { display: inline-flex; gap: 6px; }

.terms .kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; margin: 0; padding: 6px 18px 14px; }
.terms .kv div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.terms .kv div:nth-child(3) { grid-column: 1 / -1; border-bottom: 0; }
.terms dt { color: var(--muted); }
.terms dd { margin: 0; font-weight: 600; text-align: right; }

.balance { display: grid; grid-template-columns: 1fr 1fr auto; gap: 16px 24px; align-items: center; padding: 18px; }
.balance .label { color: var(--muted); font-size: 12.5px; }
.balance .value { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.balance .go { display: grid; gap: 6px; justify-items: end; }

.signin { max-width: 380px; margin: 64px auto; padding: 28px 26px; display: grid; gap: 14px; justify-items: start; }
.signin form { display: grid; gap: 8px; width: 100%; }
.signin label { color: var(--muted); font-size: 12.5px; }
.signin input { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; }
.signin .btn { padding: 10px; margin-top: 4px; }
.signin p { margin: 0; }
.error { color: var(--bad); }

.sheet { border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); padding: 22px; width: min(320px, calc(100vw - 32px)); text-align: center; }
.sheet::backdrop { background: rgb(0 0 0 / .35); }
.sheet .qr { width: 220px; height: 220px; border-radius: 8px; border: 1px solid var(--line); display: block; margin: 0 auto 10px; }
.sheet .row { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--card); padding: 8px 16px; border-radius: 8px; font-size: 13px; z-index: 10; }

@media (max-width: 900px) {
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .bar .in { gap: 0 12px; min-height: 0; padding-top: 10px; }
  .brand { flex: 1; }
  .acct .nm { display: none; }
  .acct > button { padding: 4px; border-radius: 50%; }
  .avatar { width: 28px; height: 28px; }
  nav { order: 3; flex-basis: 100%; margin-top: 6px; }
  nav button { flex: 1; padding: 11px 8px 10px; }
  .tools { width: 100%; }
  .period { flex: 1; }
  .period button { flex: 1; padding: 6px 4px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi + .kpi { border-left: 0; }
  .kpi:nth-child(even) { border-left: 1px solid var(--line-2); }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line-2); }
  .kpi { padding: 14px; }
  .kpi .value { font-size: 22px; }
  .kpi .delta { font-size: 11.5px; }
  .terms .kv { grid-template-columns: 1fr; }
  .terms .kv div:nth-child(3) { border-bottom: 0; }
  .balance { grid-template-columns: 1fr 1fr; }
  .badges { grid-template-columns: 1fr; }
  .balance .go { grid-column: 1 / -1; justify-items: stretch; text-align: center; }
}
