
  :root {
    --bg: #f6f4ef; --card: #ffffff; --ink: #1d1b17; --muted: #6b665c; --line: #e5e0d5;
    --gold: #a8842c; --good: #2f7d4f; --bad: #b3372c; --warn: #a86a12; --bar: #d8c69a;
  }
  @media (prefers-color-scheme: dark) {
    :root { --bg: #16140f; --card: #211e17; --ink: #f1ede4; --muted: #a39c8d; --line: #37322a;
            --gold: #d7b25a; --good: #6cc38f; --bad: #ef7d70; --warn: #e3a64a; --bar: #6b5a2c; }
  }
  * { box-sizing: border-box; }
  body { margin: 0; background: var(--bg); color: var(--ink);
         font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
  header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
           padding: 16px 20px; border-bottom: 1px solid var(--line); background: var(--card); }
  .brand { font-weight: 700; letter-spacing: .02em; }
  .brand span { color: var(--gold); }
  nav a { color: var(--muted); text-decoration: none; margin-right: 16px; font-weight: 600; }
  nav a.on { color: var(--ink); border-bottom: 2px solid var(--gold); padding-bottom: 3px; }
  main { max-width: 1060px; margin: 0 auto; padding: 18px 16px 48px; }
  .range { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
  .range button, .range input { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink);
                                border-radius: 8px; padding: 6px 10px; }
  .range button.on { border-color: var(--gold); color: var(--gold); font-weight: 600; }
  .note { color: var(--muted); font-size: 13px; margin: 4px 0 16px; }
  .head { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 14px; }
  .head .label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
  .head .big { font-size: 36px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 0; }
  .head .sub { color: var(--muted); }
  .tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
  .tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
  .tile .label { color: var(--muted); font-size: 12.5px; }
  .tile b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; margin-top: 2px; }
  .tile .sub { color: var(--muted); font-size: 12.5px; }
  .tile.later b { color: var(--muted); font-weight: 600; font-size: 15px; }
  .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-bottom: 14px; }
  .card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; overflow-x: auto; }
  .card h3 { margin: 0 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
  table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
  td, th { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; }
  th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
  .num { text-align: right; white-space: nowrap; }
  td.day { white-space: nowrap; }
  tr.total td { font-weight: 700; border-bottom: 0; }
  .muted { color: var(--muted); }
  .good { color: var(--good); } .bad { color: var(--bad); }
  .barwrap { height: 6px; background: var(--line); border-radius: 3px; margin-top: 4px; }
  .barwrap span { display: block; height: 6px; background: var(--gold); border-radius: 3px; }
  .chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding: 8px 0 0; }
  .chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 18px; }
  .chart .bar { width: 100%; max-width: 44px; background: var(--bar); border-radius: 4px 4px 0 0; }
  .chart .v { font-size: 11px; color: var(--muted); }
  .chart .d { font-size: 11px; color: var(--muted); }
  .err { background: var(--card); border: 1px solid var(--bad); color: var(--bad); border-radius: 12px; padding: 14px; }
  @media (max-width: 560px) { .head .big { font-size: 30px; } header { padding: 12px 16px; } }
  nav a { cursor: pointer; }
  .signout { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; }
  .login { max-width: 360px; margin: 12vh auto; background: var(--card); border: 1px solid var(--line);
           border-radius: 14px; padding: 24px; }
  .login h1 { font-size: 18px; margin: 0 0 4px; }
  .login input { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
                 background: var(--bg); color: var(--ink); margin: 14px 0 10px; }
  .login button, .dl button { font: inherit; font-weight: 600; background: var(--gold); color: #fff; border: 0;
                  border-radius: 8px; padding: 10px 14px; cursor: pointer; }
  .login button { width: 100%; }
  /* The launcher link looks like the main button. */
  .login a.button { display: block; text-align: center; text-decoration: none; font-weight: 600; background: var(--gold);
    color: #fff; border-radius: 8px; padding: 10px 12px; margin: 8px 0 12px; }
  /* !important: ".login a.button" is MORE specific than ".login [hidden]", so
     without it the launcher button showed (and went nowhere) on an app with
     no launcher key (live, 2026-10-02). */
  .login [hidden] { display: none !important; }
  .login .msg { color: var(--bad); min-height: 1.4em; font-size: 14px; }
  .hours { display: flex; align-items: flex-end; gap: 4px; height: 130px; }
  .hours .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 14px; }
  .hours .bar { width: 100%; background: var(--bar); border-radius: 3px 3px 0 0; }
  .hours .d, .hours .v { font-size: 10.5px; color: var(--muted); }
  .dl { display: grid; gap: 12px; }
  .dl .card p { margin: 4px 0 12px; color: var(--muted); }
  .warn { color: var(--warn); }
  tr.dim td { color: var(--muted); }
  .card h3.gap { margin-top: 14px; }
  /* Every block on a page sits 14px from the next one. */
  #page > .card, #page > .grid, #page > .tiles, #page > .head { margin-bottom: 14px; }
  .grid > .card { margin: 0; }
  .chart .bar.hit { background: var(--gold); }
  .tile.goodtile b { color: var(--good); } .tile.badtile b { color: var(--bad); }
  /* The menu wraps between whole links (the links touch in the HTML, so inline text has nowhere to break). */
  nav { display: flex; flex-wrap: wrap; align-items: baseline; row-gap: 6px; }
  nav a { white-space: nowrap; }
  /* Food cost on a phone: the two peso columns go, so the % and the margin stay in view. */
  @media (max-width: 560px) { table.dishes td:nth-child(3), table.dishes th:nth-child(3),
    table.dishes td:nth-child(4), table.dishes th:nth-child(4) { display: none; } }
  /* Labour: the pay period headings sit apart; on a phone the day table keeps hours and per hour in view. */
  table.periods th { text-align: left; padding-top: 12px; }
  table.periods th.num { text-align: right; }
  @media (max-width: 560px) { table.days td:nth-child(3), table.days th:nth-child(3) { display: none; } }
  /* Analysis tab: the section switches and the Generate card. */
  .analysis .sw { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0;
                  border-bottom: 1px solid var(--line); cursor: pointer; }
  .analysis .sw span { display: flex; flex-direction: column; }
  .analysis .sw .muted { font-size: 12.5px; }
  .analysis .sw.off { color: var(--muted); cursor: default; }
  .analysis .sw input { width: 20px; height: 20px; flex: none; }
  .analysis .field { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 12px; }
  .analysis select { font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
  .analysis button.primary { width: 100%; font: inherit; font-weight: 600; background: var(--gold); color: #fff; border: 0;
                             border-radius: 8px; padding: 11px 14px; cursor: pointer; }
  .analysis button.primary:disabled { opacity: .6; cursor: wait; }
  /* The right-hand cards stack; the AI cost card and the last runs (A4). */
  .analysis .stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
  .analysis .stack > .card { margin: 0; }
  .analysis .callout { border: 1px solid var(--warn); border-radius: 8px; padding: 9px 12px; font-size: 13px; margin: 0 0 12px; }
  .analysis .capset { display: flex; gap: 8px; }
  .analysis .capset input { width: 90px; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
                            background: var(--bg); color: var(--ink); }
  .analysis .capset button, .analysis .run button { font: inherit; font-weight: 600; border: 1px solid var(--line); border-radius: 8px;
                            background: var(--card); color: var(--ink); padding: 6px 12px; cursor: pointer; }
  .analysis .run { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 10px; padding: 8px 0;
                   border-bottom: 1px solid var(--line); font-size: 13.5px; }
  .analysis .run > span:first-child { display: flex; flex-direction: column; flex: 1 1 150px; min-width: 0; }
  .analysis .run .muted { font-size: 12.5px; }
  .analysis .run .num { text-align: right; white-space: nowrap; margin-left: auto; }
  /* The Telegram card (A4b). */
  .analysis .tglink { margin: 12px 0; }
  .analysis .tglink button, .analysis .run button.tgrm { font: inherit; font-weight: 600; border: 1px solid var(--line); border-radius: 8px;
                            background: var(--card); color: var(--ink); padding: 6px 12px; cursor: pointer; }
  .analysis .capset input#tglabel { width: auto; flex: 1 1 120px; min-width: 0; }
  .analysis .code { font: 600 16px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 6px 0; word-break: break-all; }

