/* BenDesk — design system, v2.
   Calm, monochrome chrome in the manner of Mercury and Linear. Colour is kept
   for meaning only: green / amber / red are the state of your money, and violet
   is your time. Everything else is ink, paper and hairlines.
   Theme: light by default, dark via [data-theme="dark"], or follow the system. */

:root {
  --bg: #F6F5F2;
  --surface: #FFFFFF;
  --surface-2: #FAFAF8;
  --surface-3: #F0EFEB;
  --line: #E8E6E0;
  --line-2: #D9D6CE;
  --ink: #111110;
  --ink-2: #5B5953;
  --ink-3: #8E8B83;
  --btn: #111110;  --btn-ink: #FFFFFF;  --btn-hover: #2A2927;

  --time: #6A57F5; --time-soft: #EFECFE; --time-text: #4A34DA;

  --ok: #16A34A;   --ok-bg: #E4F4EA;   --ok-text: #0E6A33;
  --warn: #E3950B; --warn-bg: #FCEFD6; --warn-text: #8A5200;
  --bad: #E0464B;  --bad-bg: #FBE7E7;  --bad-text: #A2262B;
  --cost-bg: #F5E4E9; --cost-text: #8A1F3D;   /* burgundy: a cost's icon */
  --none: #A7A39A; --none-bg: #EFEDE8; --none-text: #5E5B54;

  --chart-in: #DCD8CF; --chart-out: #8E8B83;

  --r-card: 14px; --r-ctl: 10px; --r-sm: 8px;
  --shadow: 0 1px 2px rgba(17, 17, 16, .04);
  --shadow-hi: 0 0 #0000;
  --shadow-pop: 0 16px 40px -14px rgba(17, 17, 16, .28), 0 0 0 1px rgba(17, 17, 16, .06);
  --ring: 0 0 0 3px color-mix(in srgb, var(--time) 32%, transparent);
  --scrim: rgba(17, 17, 16, .38);

  --f-head: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --f-ui: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

/* Dark: Linear-style elevated surfaces with a faint top highlight. The same
   values appear twice — for an explicit choice and for "follow the system". */
:root[data-theme="dark"] {
  --bg: #09090B; --surface: #111114; --surface-2: #16161A; --surface-3: #1C1C21;
  --line: #222228; --line-2: #2E2E36;
  --ink: #EDEDEF; --ink-2: #A3A3AC; --ink-3: #6E6E78;
  --btn: #EDEDEF; --btn-ink: #0A0A0C; --btn-hover: #FFFFFF;
  --time: #8B7BFF; --time-soft: #1E1A3A; --time-text: #B5AAFF;
  --ok-bg: #0D2618; --ok-text: #5FD58C; --warn-bg: #2B1F07; --warn-text: #F2C15E;
  --bad-bg: #2F1214; --bad-text: #FF8A8E; --none-bg: #1F1F25; --none-text: #A1A0A8;
  --cost-bg: #33141D; --cost-text: #E8809A;
  --chart-in: #42424D; --chart-out: #8A8A95;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-hi: inset 0 1px 0 rgba(255, 255, 255, .04);
  --shadow-pop: 0 20px 50px -12px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .06);
  --scrim: rgba(0, 0, 0, .6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #09090B; --surface: #111114; --surface-2: #16161A; --surface-3: #1C1C21;
    --line: #222228; --line-2: #2E2E36;
    --ink: #EDEDEF; --ink-2: #A3A3AC; --ink-3: #6E6E78;
    --btn: #EDEDEF; --btn-ink: #0A0A0C; --btn-hover: #FFFFFF;
    --time: #8B7BFF; --time-soft: #1E1A3A; --time-text: #B5AAFF;
    --ok-bg: #0D2618; --ok-text: #5FD58C; --warn-bg: #2B1F07; --warn-text: #F2C15E;
    --bad-bg: #2F1214; --bad-text: #FF8A8E; --none-bg: #1F1F25; --none-text: #A1A0A8;
    --cost-bg: #33141D; --cost-text: #E8809A;
    --chart-in: #42424D; --chart-out: #8A8A95;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-hi: inset 0 1px 0 rgba(255, 255, 255, .04);
    --shadow-pop: 0 20px 50px -12px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .06);
    --scrim: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 14.5px/1.55 var(--f-ui);
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  -webkit-font-smoothing: antialiased;
  transition: background .2s;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.u { font-size: .62em; font-weight: 500; color: var(--ink-3); letter-spacing: 0; margin: 0 .04em; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
kbd { font: 500 11px/1 var(--f-ui); padding: 3px 6px; border-radius: 5px; border: 1px solid var(--line-2);
      background: var(--surface-2); color: var(--ink-3); }

/* ── Icons ── */
.i { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
     stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 14px; height: 14px; }
.i.lg { width: 21px; height: 21px; }

/* ── The light — the one ornament ── */
.orb { --c: var(--none); width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--c);
       box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent),
                   0 0 12px 0 color-mix(in srgb, var(--c) 50%, transparent); }
.orb.big { width: 13px; height: 13px; box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 16%, transparent),
                   0 0 24px 3px color-mix(in srgb, var(--c) 45%, transparent); }
.s-healthy { --c: var(--ok); }
.s-watch   { --c: var(--warn); }
.s-losing  { --c: var(--bad); }
.s-empty   { --c: var(--none); }
@media (prefers-reduced-motion: no-preference) {
  .orb.pulse { animation: pulse 2.8s var(--ease) infinite; }
  @keyframes pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--c) 7%, transparent),
                               0 0 30px 6px color-mix(in srgb, var(--c) 32%, transparent); } }
}

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 7px;
        border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.4; }
.pill.s-healthy { background: var(--ok-bg); color: var(--ok-text); }
.pill.s-watch   { background: var(--warn-bg); color: var(--warn-text); }
.pill.s-losing  { background: var(--bad-bg); color: var(--bad-text); }
.pill.s-empty   { background: var(--none-bg); color: var(--none-text); }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px;
       background: var(--surface-3); color: var(--ink-2); font-size: 12px; font-weight: 500; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px;
       min-height: 36px; padding: 0 14px; border-radius: var(--r-ctl); border: 1px solid var(--line-2);
       background: var(--surface); color: var(--ink); font-weight: 600; font-size: 13.5px;
       box-shadow: var(--shadow), var(--shadow-hi);
       transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
.btn.primary:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.danger { color: var(--bad-text); }
.btn.danger:hover { border-color: var(--bad); background: var(--bad-bg); }
.btn.sm { min-height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn.lg { min-height: 44px; padding: 0 18px; font-size: 14.5px; }
.btn.block { width: 100%; }
.btn[aria-busy="true"] { opacity: .55; pointer-events: none; }
.btn kbd { margin-left: 2px; background: transparent; border-color: color-mix(in srgb, currentColor 25%, transparent); color: inherit; opacity: .7; }
.icon-btn { width: 36px; height: 36px; border-radius: var(--r-ctl); border: 1px solid var(--line);
            background: var(--surface); display: inline-grid; place-items: center; color: var(--ink-2); }
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); }

/* ── Forms ── */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 12.5px; color: var(--ink-3); }
.input, select.input, textarea.input {
  width: 100%; min-height: 40px; padding: 9px 12px; border-radius: var(--r-ctl);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  transition: border-color .15s, box-shadow .15s; }
textarea.input { min-height: 80px; resize: vertical; }
.input:hover { border-color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--time); box-shadow: var(--ring); }
.input::placeholder { color: var(--ink-3); }
.input.big { font-size: 34px; font-weight: 600; min-height: 68px; letter-spacing: -.03em; padding: 8px 14px;
             font-variant-numeric: tabular-nums; }
.money-wrap { position: relative; }
.money-wrap .cur { position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
                   font-size: 22px; color: var(--ink-3); pointer-events: none; }
.money-wrap .input.big { padding-left: 34px; }
/* every other money field: a small $ and room for it, unless its row sets its own (the hourly rate in Settings had neither) */
.money-wrap .input:not(.big) { padding-left: 26px; }
.money-wrap:not(:has(.big)) .cur { left: 12px; font-size: 15px; }
.err { color: var(--bad-text); font-size: 13px; font-weight: 500; }
.err:empty { display: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px;
       background: var(--surface-3); border-radius: var(--r-ctl); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; border-radius: 7px; min-height: 34px;
              font-weight: 600; font-size: 13px; color: var(--ink-2); display: flex; gap: 6px;
              align-items: center; justify-content: center; transition: background .15s, color .15s; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.seg.icons button { min-height: 28px; padding: 0 9px; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none;
          font-weight: 600; font-size: 13.5px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 36px; height: 22px; border-radius: 999px; background: var(--line-2); position: relative;
                 transition: background .2s var(--ease); flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
                        border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3);
                        transition: transform .2s var(--ease); }
.switch input:checked + .track { background: var(--time); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
        padding: 5px 12px; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
        display: inline-flex; align-items: center; gap: 6px; transition: all .15s; }
.chip:hover { border-color: var(--line-2); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
.chip .ct { opacity: .55; font-weight: 500; font-variant-numeric: tabular-nums; }

/* ── App shell: a dark module rail on the left (Acumatica-style), the open module on the right ── */
.app { display: grid; grid-template-columns: 84px minmax(0, 1fr); min-height: 100vh; }
.rail { --rail: #111110; --rail-ink: #8F8D86; --rail-hi: #F4F3EF; --rail-hover: rgba(255,255,255,.06); --rail-on: rgba(255,255,255,.1);
        position: sticky; top: 0; height: 100vh; z-index: 25; display: flex; flex-direction: column; align-items: stretch;
        padding: 14px 8px 12px; background: var(--rail); border-right: 1px solid var(--line); color: var(--rail-ink); }
:root[data-theme="dark"] .rail { --rail: #131317; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rail { --rail: #131317; } }
.rail-brand { display: grid; place-items: center; height: 40px; margin-bottom: 14px; text-decoration: none; }
.rail-brand { color: #F4F3EF; }
.rail-brand .bt-logo { width: 40px; height: auto; display: block; transition: transform .2s var(--ease); }
.rail-brand:hover .bt-logo { transform: scale(1.06); }
.rail-nav, .rail-foot { display: grid; gap: 4px; }
.rail-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.08); justify-items: stretch; }
.mod { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 2px 8px;
       border-radius: 10px; text-decoration: none; color: var(--rail-ink); transition: background .15s, color .15s; }
.mod:hover { background: var(--rail-hover); color: var(--rail-hi); }
.mod[aria-current="page"] { background: var(--rail-on); color: var(--rail-hi); }
.mod[aria-current="page"]::before { content: ""; position: absolute; left: -8px; top: 12px; bottom: 12px; width: 3px;
       border-radius: 0 3px 3px 0; background: #37D67A; box-shadow: 0 0 10px rgba(55,214,122,.6); }
.mod-ic { position: relative; display: grid; place-items: center; }
.mod-l { font-size: 11px; font-weight: 600; letter-spacing: .01em; line-height: 1.1; text-align: center; }
.mod-badge { position: absolute; top: -6px; right: -12px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
             background: #2A2A27; color: var(--rail-hi); font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
             font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px var(--rail); }
.rail-me { display: grid; place-items: center; padding: 8px 0 2px; border-radius: 10px; text-decoration: none; }
.rail-me .avatar { width: 34px; height: 34px; background: #2A2A27; color: var(--rail-hi); border-color: rgba(255,255,255,.12); }
.rail-me:hover .avatar { border-color: #37D67A; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-3); color: var(--ink-2);
          display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; border: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: #111110; color: #F4F3EF; display: grid; place-items: center;
              box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.brand-mark .bt-logo { width: 21px; height: auto; display: block; }
.brand-name { font-family: var(--f-head); font-weight: 700; font-size: 17px; letter-spacing: -.025em; }

/* the workspace's own header: where you are, search, who you are */
.work { min-width: 0; }
.workbar { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr minmax(220px, 380px) 1fr;
           align-items: center; gap: 16px; height: 56px; padding: 0 clamp(18px, 3vw, 40px);
           background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px);
           border-bottom: 1px solid var(--line); }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; white-space: nowrap; }
.crumb-app { font-family: var(--f-head); font-weight: 700; font-size: 15.5px; letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.crumb-sep { color: var(--line-2); }
.crumb-mod { color: var(--ink-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.search-btn { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 0 10px;
              border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); color: var(--ink-3);
              font-size: 13px; box-shadow: var(--shadow), var(--shadow-hi); }
.search-btn:hover { border-color: var(--line-2); color: var(--ink-2); }
.search-btn kbd { margin-left: auto; }
.wb-acts { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.wb-who { font-size: 13px; font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { padding: 26px clamp(18px, 3vw, 40px) 110px; max-width: 1280px; width: 100%; }
.topbar, .tabbar { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
             flex-wrap: wrap; margin-bottom: 20px; }
.eyebrow { font-size: 12.5px; font-weight: 500; color: var(--ink-3); margin: 0 0 3px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
h1.title { font-family: var(--f-head); font-weight: 700; font-size: clamp(26px, 3vw, 34px);
           letter-spacing: -.035em; line-height: 1.08; margin: 0; }
h2.h2 { font-size: 14px; font-weight: 650; letter-spacing: -.01em; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
        box-shadow: var(--shadow), var(--shadow-hi); padding: 18px; }

/* ── Overview ── */
.overview { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }
.hero { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.3fr); gap: 22px; align-items: stretch; padding: 20px 22px; }
.hero .lbl { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.hero .big { font-weight: 650; font-size: clamp(52px, 5.6vw, 72px); letter-spacing: -.05em; line-height: .95; margin: 16px 0 10px; }
.hero .big .u { font-size: .45em; color: var(--ink-3); }
.hero .verdict { font-family: var(--f-head); font-weight: 650; font-size: 18px; letter-spacing: -.02em; line-height: 1.25; margin: 0 0 6px; }
.hero .sub { color: var(--ink-3); font-size: 12.5px; }
.hero .left { display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }

.chart { position: relative; display: flex; flex-direction: column; min-width: 0; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.chart-head .t { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--ink-3); flex-wrap: wrap; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.legend i.line { height: 2px; width: 12px; border-radius: 1px; background: var(--ink); vertical-align: 3px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .bar-in { fill: var(--chart-in); }
.chart .bar-out { fill: var(--chart-out); }
.chart .grid-l { stroke: var(--line); stroke-dasharray: 2 3; }
.chart .zero { stroke: var(--line-2); }
.chart .axis { fill: var(--ink-3); font: 500 11px var(--f-ui); }
.chart .profit { fill: none; stroke: var(--ink); stroke-width: 1.8; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .col .hover-bg { fill: transparent; }
.chart .col:hover .hover-bg, .chart .col.on .hover-bg { fill: var(--surface-3); }
.tip { position: absolute; pointer-events: none; z-index: 5; background: var(--surface); border: 1px solid var(--line-2);
       border-radius: var(--r-ctl); box-shadow: var(--shadow-pop); padding: 10px 12px; font-size: 12.5px; min-width: 170px;
       transform: translate(-50%, -100%); white-space: nowrap; }
.tip .m { font-weight: 650; margin-bottom: 6px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tip .r { display: flex; justify-content: space-between; gap: 16px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tip .r b { color: var(--ink); font-weight: 600; }

.glance { display: flex; flex-direction: column; gap: 14px; }
.stack-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.stack-bar i { background: var(--c); }
.glance-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.glance-row .n { font-weight: 650; min-width: 16px; font-variant-numeric: tabular-nums; }
.glance-row .l { color: var(--ink-2); }
.glance-row .p { margin-left: auto; color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; }
.kpi .k { font-size: 12.5px; font-weight: 500; color: var(--ink-3); display: flex; align-items: center; gap: 7px; }
.kpi .v { font-weight: 650; font-size: clamp(22px, 2.1vw, 28px); letter-spacing: -.04em; margin-top: 8px; line-height: 1.05; }
.kpi .d { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.kpi.time .k, .kpi.time .v { color: var(--time-text); }
.kpi.time .v .u { color: var(--time-text); opacity: .6; }

.insight { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--r-card);
           border: 1px solid color-mix(in srgb, var(--time) 25%, var(--line)); background: var(--time-soft);
           color: var(--time-text); font-weight: 600; font-size: 13.5px; margin-bottom: 18px; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .grow { flex: 1; }
.find { position: relative; min-width: 200px; flex: 0 1 260px; }
.find .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.find .input { min-height: 34px; padding-left: 32px; font-size: 13px; }
.toolbar select.input { min-height: 34px; width: auto; padding: 5px 30px 5px 12px; font-size: 13px; font-weight: 600; }

/* ── Items: cards ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.item { display: flex; flex-direction: column; gap: 12px; text-align: left; width: 100%;
        cursor: pointer; color: inherit; font: inherit;
        transition: border-color .15s, box-shadow .15s, transform .15s var(--ease); }
.item:hover { border-color: var(--line-2); box-shadow: var(--shadow-pop); transform: translateY(-1px); }
.item.closed { opacity: .6; }
.item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.item-name { font-weight: 650; font-size: 15px; letter-spacing: -.015em; line-height: 1.3; margin: 0; overflow-wrap: anywhere; }
.item-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.item-meta .who { font-size: 12px; color: var(--ink-3); }
.item-margin { display: flex; align-items: baseline; gap: 7px; }
.item-margin .m { font-weight: 650; font-size: 30px; letter-spacing: -.045em; line-height: 1; }
.item-margin .l { font-size: 12.5px; color: var(--ink-3); }
.bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; position: relative; }
.bar i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--c, var(--ink-3)); }
.bar .t { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); opacity: .35; }
.nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.nums .k { font-size: 11.5px; color: var(--ink-3); }
.nums .v { font-weight: 600; font-size: 13.5px; }
.warn-line { display: flex; gap: 7px; align-items: center; font-size: 12px; font-weight: 600; color: var(--warn-text);
             background: var(--warn-bg); padding: 6px 10px; border-radius: var(--r-sm); }

/* ── Items: list — each row is its own small card, a few pixels apart ── */
.table-wrap { overflow-x: auto; padding: 0 2px 4px; margin: 0 -2px; }
table.list { width: 100%; min-width: 760px; font-size: 13.5px;
             border-collapse: separate; border-spacing: 0 6px; margin-top: -6px; }
table.list th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 0;
                background: transparent; white-space: nowrap; }
table.list th button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 5px; width: 100%;
                       padding: 4px 16px 2px; cursor: pointer; border-radius: 6px; }
table.list th button:hover { color: var(--ink); }
table.list th button:focus-visible { box-shadow: var(--ring); }
table.list th.r button { justify-content: flex-end; }
table.list th[aria-sort] button { color: var(--ink); }

table.list td { padding: 13px 16px; vertical-align: middle; background: var(--surface);
                border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
                transition: border-color .15s, background .15s; }
table.list td:first-child { border-left: 1px solid var(--line); border-radius: 12px 0 0 12px; }
table.list td:last-child  { border-right: 1px solid var(--line); border-radius: 0 12px 12px 0; }
table.list tbody tr { cursor: pointer; filter: drop-shadow(0 1px 1px rgba(17, 17, 16, .04)); outline: none; }
table.list tbody tr:hover td { border-color: var(--line-2); background: var(--surface-2); }
table.list tbody tr:focus-visible td { border-color: var(--time); }
table.list tbody tr.closed { opacity: .6; }
table.list td.r { text-align: right; font-variant-numeric: tabular-nums; }
table.list .nm { font-weight: 600; }
table.list .sub { font-size: 12px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; margin-top: 3px; }
table.list .mbar { width: 64px; display: inline-block; vertical-align: middle; margin-left: 10px; }

.empty { text-align: center; padding: 52px 24px; }
.empty .orbs { display: flex; gap: 14px; justify-content: center; margin-bottom: 20px; }
.empty h2 { font-family: var(--f-head); font-size: 26px; letter-spacing: -.035em; margin: 0 0 8px; }
.empty p { color: var(--ink-2); max-width: 440px; margin: 0 auto 20px; }
.empty .acts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ── Item detail ── */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); text-decoration: none;
        font-weight: 500; font-size: 13px; margin-bottom: 12px; }
.back:hover { color: var(--ink); }
.detail { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 12px; }
.stack { display: grid; gap: 12px; align-content: start; }
.verdict-card .vt { font-family: var(--f-head); font-weight: 650; font-size: 21px; letter-spacing: -.025em; line-height: 1.25; margin: 12px 0 6px; }
.verdict-card p { color: var(--ink-2); margin: 0; }
.fix { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: stretch; margin-top: 16px; }
.fix .opt { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 12px 14px; }
.fix .opt .k { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.fix .opt .v { font-weight: 650; font-size: 22px; letter-spacing: -.035em; margin-top: 3px; }
.fix .or { align-self: center; font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; }

.split-row { display: grid; grid-template-columns: 118px 1fr auto; gap: 12px; align-items: center; padding: 7px 0; }
.split-row .n { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split-row .v { font-weight: 600; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.split-row .bar i { background: var(--chart-out); }
.split-row.time .n, .split-row.time .v { color: var(--time-text); }
.split-row.time .bar i { background: var(--time); }

.budget-bars { display: grid; gap: 14px; }
.budget-bars .row { display: grid; gap: 7px; }
.budget-bars .row .top { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; }
.budget-bars .row .top span:last-child { color: var(--ink-2); font-weight: 500; }
.range { width: 100%; accent-color: var(--ink); }

.entries { display: grid; }
.entry { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center;
         padding: 9px 6px; border-top: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer;
         text-align: left; background: transparent; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; }
.entry:first-child { border-top: 0; }
.entry:hover { background: var(--surface-2); }
.entry .ic { width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.entry.income .ic { background: var(--ok-bg); color: var(--ok-text); }
.entry.time .ic { background: var(--time-soft); color: var(--time-text); }
.entry.cost .ic { background: var(--cost-bg); color: var(--cost-text); }
.entry .t1 { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.entry .t2 { font-size: 12px; color: var(--ink-3); }
.entry .amt { font-weight: 600; font-size: 13.5px; text-align: right; font-variant-numeric: tabular-nums; }
.entry.income .amt { color: var(--ok-text); }
.entry.time .amt { color: var(--time-text); }

/* ── Sheets ── */
.scrim { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(2px);
         display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .16s var(--ease); }
.sheet { width: min(540px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface);
         border-radius: 16px; box-shadow: var(--shadow-pop); padding: 22px; animation: rise .2s var(--ease); }
.sheet.wide { width: min(700px, 100%); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet-head h2 { font-family: var(--f-head); font-weight: 700; font-size: 21px; letter-spacing: -.03em; margin: 0; }
.sheet-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.sheet-foot .spacer { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.985); } }
@media (prefers-reduced-motion: reduce) { .scrim, .sheet, .palette { animation: none; } .item:hover { transform: none; } }

.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 6px; }
.type { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-ctl);
        padding: 10px 11px; transition: border-color .15s, background .15s; }
.type:hover { border-color: var(--line-2); background: var(--surface-2); }
.type .n { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13.5px; }
.type .h { display: block; font-size: 12px; color: var(--ink-3); line-height: 1.4; margin-top: 3px; }
.type[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); background: var(--surface); }

.preview { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center;
           background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 12px 14px; margin: 4px 0 14px; }
.preview .side-p { display: grid; gap: 4px; justify-items: start; }
.preview .side-p .k { font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.preview .side-p .m { font-weight: 650; font-size: 24px; letter-spacing: -.04em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.preview .arrow { color: var(--ink-3); }
.preview .side-p:last-child { text-align: right; justify-items: end; }

/* ── Command menu ── */
.pal-scrim { place-items: start center; padding-top: 12vh; }
.palette { width: min(600px, 100%); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-pop);
           overflow: hidden; animation: rise .16s var(--ease); }
.palette .q { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.palette .q .i { color: var(--ink-3); }
.palette .q input { flex: 1; border: 0; background: transparent; min-height: 52px; font-size: 15px; outline: none; color: var(--ink); }
.palette .q input::placeholder { color: var(--ink-3); }
.palette .q input:focus-visible { box-shadow: none; }   /* the whole panel is the focus */
.palette .res { max-height: 360px; overflow: auto; padding: 6px; }
.palette .grp { font-size: 11.5px; font-weight: 600; color: var(--ink-3); padding: 10px 10px 4px; }
.palette .opt { display: flex; align-items: center; gap: 11px; width: 100%; border: 0; background: transparent; text-align: left;
                padding: 9px 10px; border-radius: var(--r-sm); font-size: 13.5px; color: var(--ink); }
.palette .opt .i { color: var(--ink-3); }
.palette .opt .meta { margin-left: auto; font-size: 12px; color: var(--ink-3); display: flex; gap: 8px; align-items: center; }
.palette .opt[aria-selected="true"] { background: var(--surface-3); }
.palette .none { padding: 26px; text-align: center; color: var(--ink-3); font-size: 13.5px; }
.palette .foot { display: flex; gap: 14px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--ink-3); background: var(--surface-2); }

/* ── Settings ── */
.settings { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.cat-row { display: flex; gap: 6px; align-items: center; padding: 4px 0; }
.cat-row .input { min-height: 36px; }
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-opt { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-ctl); padding: 8px 8px 10px;
             text-align: left; display: grid; gap: 9px; font-weight: 600; font-size: 13px; }
.theme-opt:hover { border-color: var(--line-2); }
.theme-opt[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.theme-opt .pv { height: 64px; border-radius: 7px; overflow: hidden; display: grid; grid-template-columns: 30% 1fr; border: 1px solid var(--line); }
.theme-opt .pv .s { padding: 6px; display: grid; gap: 4px; align-content: start; }
.theme-opt .pv .s i, .theme-opt .pv .m i { display: block; height: 5px; border-radius: 3px; }
.theme-opt .pv .m { padding: 7px; display: grid; gap: 5px; align-content: start; }
.pv.light { background: #F6F5F2; } .pv.light .s { background: #EFEEE9; } .pv.light i { background: #D9D6CE; } .pv.light .m i:first-child { background: #111110; width: 60%; }
.pv.dark { background: #09090B; } .pv.dark .s { background: #111114; } .pv.dark i { background: #2E2E36; } .pv.dark .m i:first-child { background: #EDEDEF; width: 60%; }
.pv.system { background: linear-gradient(135deg, #F6F5F2 50%, #09090B 50%); }
.pv.system .s { background: transparent; } .pv.system i { background: #8E8B83; }
.theme-opt .lb { display: flex; align-items: center; gap: 7px; padding: 0 2px; }

/* ── Auth ── */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--bg); }
.auth-art { position: relative; overflow: hidden; background: #0B0B0D; color: #F2F1EE; padding: 40px;
            display: flex; flex-direction: column; justify-content: space-between; }
.auth-art .brand { color: #F2F1EE; padding: 0; }
.auth-art h1 { font-family: var(--f-head); font-weight: 700; font-size: clamp(36px, 4.4vw, 60px);
               letter-spacing: -.045em; line-height: .98; margin: 0 0 16px; max-width: 12ch; position: relative; }
.auth-art p { color: #9B988F; font-size: 15.5px; max-width: 40ch; margin: 0; position: relative; }
.lights { position: absolute; right: -58px; top: 50%; transform: translateY(-50%); display: grid; gap: 24px; }
.lights .orb { width: 112px; height: 112px; opacity: .92;
               box-shadow: 0 0 0 14px color-mix(in srgb, var(--c) 9%, transparent),
                           0 0 80px 14px color-mix(in srgb, var(--c) 42%, transparent),
                           inset 0 -18px 30px rgba(0,0,0,.2), inset 0 14px 24px rgba(255,255,255,.2); }
.lights .orb:nth-child(2) { margin-left: 66px; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-form form { width: min(380px, 100%); }
.auth-form h2 { font-family: var(--f-head); font-weight: 700; font-size: 28px; letter-spacing: -.035em; margin: 0 0 6px; }
.auth-form .lead { color: var(--ink-2); margin: 0 0 24px; }
.auth-form .alt { text-align: center; margin-top: 16px; font-size: 13.5px; color: var(--ink-2); }
.auth-form .alt a { color: var(--ink); font-weight: 600; }
.auth-box { width: min(380px, 100%); }
.auth-form form { width: 100%; }
.auth-tabs { margin-bottom: 28px; }
.seg a { border-radius: 7px; min-height: 34px; font-weight: 600; font-size: 13px; color: var(--ink-2);
         display: flex; align-items: center; justify-content: center; text-decoration: none; transition: background .15s, color .15s; }
.seg a:hover { color: var(--ink); }
.seg a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.pw { position: relative; }
.pw .input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px;
             border: 0; background: transparent; color: var(--ink-3); border-radius: 7px; display: grid; place-items: center; }
.pw-toggle:hover { color: var(--ink); background: var(--surface-3); }
.gbtn { display: flex; justify-content: center; min-height: 44px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 12px; margin: 18px 0 16px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.fine { font-size: 12px; color: var(--ink-3); margin: 22px 0 0; display: flex; gap: 7px; align-items: center; justify-content: center; text-align: center; }
.note { background: var(--surface-3); color: var(--ink-2); border-radius: var(--r-ctl);
        padding: 11px 13px; font-size: 13px; margin-top: 14px; overflow-wrap: anywhere; }
.note.ok { background: var(--ok-bg); color: var(--ok-text); }
.note a { color: inherit; font-weight: 600; }

/* ── Toast ── */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 80;
         background: var(--btn); color: var(--btn-ink); padding: 10px 16px; border-radius: 999px;
         font-weight: 600; font-size: 13.5px; box-shadow: var(--shadow-pop); display: flex; gap: 9px; align-items: center;
         animation: rise .2s var(--ease); }

/* ── Skeleton ── */
.sk { background: linear-gradient(90deg, var(--surface-3) 25%, color-mix(in srgb, var(--surface-3) 45%, var(--surface)) 50%, var(--surface-3) 75%);
      background-size: 200% 100%; border-radius: 6px; }
@media (prefers-reduced-motion: no-preference) { .sk { animation: shimmer 1.3s linear infinite; } }
@keyframes shimmer { to { background-position: -200% 0; } }
.loading { display: grid; place-items: center; min-height: 60vh; }

/* ── Responsive ── */
@media (max-width: 1180px) {
  .overview { grid-template-columns: 1fr; }
  .glance { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .glance h2 { flex: 1 1 100%; margin: 0; }
  .glance .stack-bar { flex: 1 1 100%; }
  .glance-row { flex: 1 1 140px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail { grid-template-columns: 1fr; }
  .settings { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }   /* never wider than the screen, whatever is inside */
  .rail, .workbar { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
            position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 85%, transparent);
            backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
  .topbar .brand { padding: 0; }
  .topbar .acts { display: flex; gap: 6px; }
  .main { padding: 16px 14px 120px; }
  .hero { grid-template-columns: 1fr; gap: 16px; padding: 18px; }
  .hero .big { font-size: 56px; margin: 12px 0 8px; }
  .tabbar { display: grid; grid-template-columns: 1fr 1fr auto 1fr 1fr; align-items: center; position: fixed;
            left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30;
            background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
            box-shadow: var(--shadow-pop); padding: 6px; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none;
              color: var(--ink-3); font-size: 11px; font-weight: 600; padding: 4px; }
  .tabbar a[aria-current="page"] { color: var(--ink); }
  .fab { width: 52px; height: 52px; border-radius: 14px; border: 0; background: var(--btn); color: var(--btn-ink);
         display: grid; place-items: center; box-shadow: 0 8px 20px -8px rgba(0,0,0,.5); }
  .fab .i { width: 24px; height: 24px; }
  .head-actions .hide-m, .find { display: none; }
  .scrim { place-items: end center; padding: 0; }
  .pal-scrim { place-items: start center; padding: 10px; }
  .sheet { width: 100%; border-radius: 18px 18px 0 0; max-height: 92vh;
           padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .sheet::before { content: ""; display: block; width: 38px; height: 4px; border-radius: 3px;
                   background: var(--line-2); margin: -4px auto 14px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 24px 20px 30px; }
  .auth-art h1 { font-size: 38px; margin-top: 28px; }
  .lights { display: none; }
  .fix { grid-template-columns: 1fr; }
  .fix .or { text-align: center; }
}
@media (max-width: 460px) {
  .kpis { gap: 8px; }
  .kpi { padding: 13px 14px; }
  .kpi .v { font-size: 21px; }
  .grid { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  .themes { gap: 6px; }
}

/* ── Example item ── */
.tag.example { background: var(--time-soft); color: var(--time-text); border-color: transparent; }
.example-note { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 18px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); font-size: 13.5px; color: var(--ink-2); }
.example-note > svg { color: var(--time); flex: none; }
.example-note span { flex: 1 1 260px; }
.example-note b { color: var(--ink); }

/* ── First visit: a pointer at New project ── */
.coach { position: fixed; z-index: 45; width: min(320px, calc(100vw - 24px)); padding: 16px 16px 14px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: var(--shadow-pop); animation: coach-in .3s var(--ease); }
@keyframes coach-in { from { opacity: 0; transform: translateY(-6px); } }
.coach.up { animation-name: coach-in-up; }
@keyframes coach-in-up { from { opacity: 0; transform: translateY(6px); } }
.coach-arrow { position: absolute; top: -7px; width: 12px; height: 12px; margin-left: -6px; transform: rotate(45deg);
  background: var(--surface); border-left: 1px solid var(--line-2); border-top: 1px solid var(--line-2); }
.coach.up .coach-arrow { top: auto; bottom: -7px; transform: rotate(225deg); }
.coach-k { margin: 0; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--time-text); }
.coach h3 { font: 700 17px/1.3 var(--f-head); margin: 4px 0 6px; letter-spacing: -.01em; }
.coach p:not(.coach-k) { font-size: 14px; line-height: 1.55; color: var(--ink-2); margin: 0 0 14px; }
.coach-foot { display: flex; justify-content: flex-end; gap: 8px; }
.coach-ring { position: relative; z-index: 1; box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--time) !important;
  animation: coach-pulse 1.8s ease-in-out infinite; }
@keyframes coach-pulse { 50% { box-shadow: 0 0 0 3px var(--bg), 0 0 0 9px color-mix(in srgb, var(--time) 35%, transparent) !important; } }
@media (prefers-reduced-motion: reduce) { .coach, .coach-ring { animation: none; } }

/* ── Budget indicator on item cards ── */
.budget { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--ink-3);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.budget svg { width: 14px; height: 14px; flex: none; }
.budget circle { fill: none; stroke-width: 2.6; }
.budget .bg { stroke: var(--surface-3); }
.budget .fg { stroke-linecap: round; }
.budget.b-ok .fg { stroke: var(--ok); }
.budget.b-warn { color: var(--warn-text); } .budget.b-warn .fg { stroke: var(--warn); }
.budget.b-over { color: var(--bad-text); } .budget.b-over .fg { stroke: var(--bad); }

/* ── Project status, customers ── */
.tag.pstat-hold { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.tag.pstat-closed { background: var(--surface-3); color: var(--ink-3); border-color: transparent; }
/* Status dropdown on a project */
.pdrop { position: relative; }
.pdrop .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.st-active { --c: var(--ok); } .st-hold { --c: var(--warn); } .st-closed { --c: var(--ink-3); }
.pdrop-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 10px 0 12px;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--ink);
  font: 600 13px var(--f-ui); cursor: pointer; box-shadow: var(--shadow), var(--shadow-hi);
  transition: border-color .15s var(--ease), background .15s var(--ease); }
.pdrop-btn:hover { background: var(--surface-2); }
.pdrop-btn .i { color: var(--ink-3); transition: transform .2s var(--ease); }
.pdrop.open .pdrop-btn { border-color: var(--ink-3); }
.pdrop.open .pdrop-btn .i { transform: rotate(180deg); }
.pdrop-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; width: 290px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-pop);
  animation: pdrop-in .16s var(--ease); transform-origin: top right; }
@keyframes pdrop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.pdrop-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px;
  background: none; color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.pdrop-opt:hover, .pdrop-opt:focus-visible { background: var(--surface-3); outline: none; }
.pdrop-opt[aria-selected="true"] { background: var(--surface-2); }
.pdrop-opt .t { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pdrop-opt .t strong { font-size: 13.5px; }
.pdrop-opt .t span { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.pdrop-opt .tick { width: 16px; color: var(--ink); display: grid; place-items: center; }
@media (max-width: 640px) { .pdrop-menu { width: min(290px, calc(100vw - 24px)); } }
@media (prefers-reduced-motion: reduce) { .pdrop-menu { animation: none; } .pdrop-btn .i { transition: none; } }
.cust-pick { display: flex; gap: 8px; align-items: center; }
.cust-pick select { flex: 0 1 280px; min-width: 0; }
.cust-pick .btn { flex: none; }

/* Customers: rows like a real list, a small gap between each */
.cust-rows { display: grid; gap: 6px; }
.cust-row { display: grid; grid-template-columns: minmax(0, 2.2fr) 1fr 1fr 1fr .8fr 130px; align-items: center; gap: 12px;
  width: 100%; text-align: left; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px; cursor: pointer; }
button.cust-row:hover { border-color: var(--line-2); background: var(--surface-2); }
.cust-row.head { background: none; border: 0; padding: 0 16px 2px; cursor: default; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.cust-row .r { text-align: right; }
.cust-row .nm { display: flex; flex-direction: column; min-width: 0; }
.cust-row .nm strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cust-row .meta { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.cust-row .cnt { color: var(--ink-2); }
.cust-row .st { display: flex; justify-content: flex-end; }
@media (max-width: 760px) {
  .cust-row.head { display: none; }
  .cust-row { grid-template-columns: 1fr auto; grid-template-areas: "nm st" "cnt m"; row-gap: 4px; }
  .cust-row .nm { grid-area: nm; } .cust-row .st { grid-area: st; }
  .cust-row .cnt { grid-area: cnt; font-size: 12.5px; color: var(--ink-3); }
  .cust-row [data-l="Income"], .cust-row [data-l="Profit"] { display: none; }
  .cust-row [data-l="Margin"] { grid-area: m; }
}
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; cursor: pointer; }


/* ── Phones: everything fits the screen ── */
body { overflow-x: clip; }                       /* last line of defence; nothing should need it */
.item-name, h1.title, .item-meta .who, .eyebrow, table.list .nm, table.list .sub, .cust-row .nm strong { overflow-wrap: anywhere; }
@media (max-width: 820px) {
  /* 16px text stops iPhone Safari zooming in when a box is tapped */
  .input, select.input, textarea.input, .find .input, .toolbar select.input { font-size: 16px; }
  .input.big { font-size: 32px; }
  .toolbar { flex-wrap: wrap; }
  .toolbar select.input { max-width: 100%; }
  .head-actions { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  /* List view: each project becomes a compact row instead of a wide table */
  .table-wrap { overflow: visible; margin: 0; padding: 0; }
  table.list { min-width: 0; border-spacing: 0; display: block; }
  table.list thead { display: none; }
  table.list tbody { display: grid; gap: 6px; }
  table.list tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center;
    padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
  table.list td { display: block; padding: 0; background: none; border: 0 !important; border-radius: 0 !important; min-width: 0; }
  table.list td:nth-child(1) { grid-column: 1; grid-row: 1; }
  table.list td:nth-child(2) { grid-column: 2; grid-row: 1; justify-self: end; }
  table.list td:nth-child(3) { grid-column: 1; grid-row: 2; text-align: left; display: flex; align-items: center; gap: 8px; }
  table.list td:nth-child(3) .mbar { flex: 1; max-width: 120px; }
  table.list td:nth-child(6) { grid-column: 2; grid-row: 2; text-align: right; }
  table.list td:nth-child(6)::before { content: "Profit "; color: var(--ink-3); font-weight: 500; font-size: 12px; }
  table.list td:nth-child(4), table.list td:nth-child(5), table.list td:nth-child(7) { display: none; }
}

/* ── Phones: typing with the on-screen keyboard ── */
@media (max-width: 820px) {
  /* The form backdrop covers only what the keyboard leaves visible, so the form sits right above the keys */
  .scrim { inset: auto 0 auto 0; top: var(--vvtop, 0); height: var(--vvh, 100dvh); }
  .sheet { max-height: calc(var(--vvh, 100dvh) - 8px); overscroll-behavior: contain; }
  /* Save stays reachable at the bottom of a long form */
  .sheet-foot { position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); z-index: 2; margin: 10px -16px 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  html.kb-open .sheet-foot { padding-bottom: 12px; }
  html.kb-open .sheet { padding-bottom: 18px; }
  html.kb-open .tabbar { display: none; }          /* the bottom bar would float over the keyboard */
  /* A project's window too (D92): with the keyboard up it fits what's above it, so every field can scroll into view */
  html.kb-open .pv-scrim { top: var(--vvtop, 0); bottom: auto; height: var(--vvh, 100dvh); }
  /* …and nothing of the page shows through the see-through keyboard under a form */
  html.kb-open .scrim:not(.pal-scrim) { box-shadow: 0 0 0 100vmax var(--bg); }
}
@media (max-width: 820px) { .sheet-foot kbd { display: none; } }   /* no Enter-key hint on a phone */

/* ── Detail window: a project or customer opens over its module, which stays behind it ── */
html.pv-open body { overflow: hidden; }   /* body only: locking html too would unstick the rail */
.pv-scrim { position: fixed; inset: 0 0 0 84px; z-index: 35; display: flex; justify-content: center; align-items: center;
  padding: 18px 24px;
  background: color-mix(in srgb, var(--bg) 35%, rgba(17, 17, 16, .32)); animation: fade .18s var(--ease); }
.pv { position: relative; display: flex; flex-direction: column; width: min(1080px, 100%); height: 100%; max-height: 900px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; outline: none;
  box-shadow: var(--shadow-pop); animation: pv-in .26s var(--ease); }
@keyframes pv-in { from { transform: translateY(14px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
.pv-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none;
  height: 54px; padding: 0 12px 0 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.pv-nav { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; white-space: nowrap; }
.pv-nav strong { overflow: hidden; text-overflow: ellipsis; font-weight: 650; }
.pv-mod { color: var(--ink-3); font-weight: 500; }
.pv-back { margin-left: -8px; }
.pv-body { flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 22px clamp(18px, 2.6vw, 32px) 40px; }   /* never sideways */
.pv-body .loading { min-height: 50vh; }
@media (max-width: 820px) {
  .pv-scrim { inset: 0; padding: 0; background: none; }
  .pv { width: 100%; max-height: none; border: 0; border-radius: 0; box-shadow: none; }
  .pv-head { padding: 0 8px 0 14px; padding-top: env(safe-area-inset-top); height: calc(54px + env(safe-area-inset-top)); }
  .pv-body { padding: 16px 14px 120px; }                         /* clear of the bottom bar with its + */
  html.pv-open .tabbar { z-index: 40; }
}
@media (prefers-reduced-motion: reduce) { .pv, .pv-scrim { animation: none; } }

/* ── Customer form, tabs, details and the notes log ── */
.row3 { display: grid; grid-template-columns: .8fr 1fr 1fr; gap: 12px; }
.sheet-sub { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3);
  margin: 6px 0 10px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width: 640px) { .row3 { grid-template-columns: 1fr; gap: 0; } .row2 { gap: 0; } }

.ptabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px 0 18px; overflow-x: auto; scrollbar-width: none; }
.ptabs button, .ptabs a { position: relative; display: inline-flex; align-items: center; gap: 7px; border: 0; background: none;
  padding: 10px 12px 12px; font-weight: 600; font-size: 13.5px; color: var(--ink-3); white-space: nowrap; border-radius: 8px 8px 0 0; }
.ptabs button:hover, .ptabs a:hover { color: var(--ink); background: var(--surface-3); }
.ptabs button[aria-selected="true"], .ptabs a[aria-selected="true"] { color: var(--ink); }
.ptabs button[aria-selected="true"]::after, .ptabs a[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px;
  border-radius: 2px; background: var(--ink); }
.ptabs .ct { font-size: 11.5px; font-weight: 600; color: var(--ink-3); background: var(--surface-3); border-radius: 10px;
  padding: 1px 7px; font-variant-numeric: tabular-nums; }

.dl-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.dl { margin: 6px 0 0; }
.kv-row { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.kv-row:first-child { border-top: 0; }
.dl dt { color: var(--ink-3); font-size: 13px; }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.dl dd a { color: var(--ink); text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.dl dd a:hover { text-decoration-color: currentColor; }
@media (max-width: 900px) { .dl-cards { grid-template-columns: 1fr; } }
@media (max-width: 460px) { .kv-row { grid-template-columns: 1fr; gap: 2px; } }

.note-add { display: flex; gap: 8px; margin-bottom: 14px; }
.note-add .input { flex: 1; min-width: 0; }
.note-log { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow), var(--shadow-hi); overflow: hidden; }
.note-line { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; align-items: start; gap: 14px;
  padding: 12px 10px 12px 16px; border-top: 1px solid var(--line); }
.note-line:first-child { border-top: 0; }
.note-line .when { font-size: 12.5px; color: var(--ink-3); padding-top: 2px; font-variant-numeric: tabular-nums; }
.note-line .body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-line .icon-btn { opacity: 0; transition: opacity .15s; }
.note-line:hover .icon-btn, .note-line .icon-btn:focus-visible { opacity: 1; }
@media (hover: none) { .note-line .icon-btn { opacity: .7; } }
@media (max-width: 640px) {
  .note-line { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "when del" "body body"; row-gap: 4px; }
  .note-line .when { grid-area: when; } .note-line .body { grid-area: body; } .note-line .icon-btn { grid-area: del; }
}
.icon-btn.sm { width: 30px; height: 30px; }

/* ── IDs: fixed once given ── */
.code { font-size: 11.5px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.eyebrow .code, .item-meta .code, table.list .sub .code { margin-right: 2px; }
.id-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -4px 0 14px; font-size: 13px; color: var(--ink-2); }
.id-chip { font-weight: 700; font-variant-numeric: tabular-nums; padding: 2px 8px; border-radius: 6px;
  background: var(--surface-3); border: 1px solid var(--line); color: var(--ink); }
a.id-link { text-decoration: none; } a.id-link:hover { border-color: var(--ink-3); }
/* the project's head, like a quote's (D77): its details on the left, how it's doing on the right third */
.doc-head.proj-head { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 900px) {   /* on a narrow screen, how it's doing comes first */
  .doc-head.proj-head { grid-template-columns: minmax(0, 1fr); }
  .proj-head .proj-sum { order: -1; border-top: 0; border-bottom: 1px solid var(--line); padding: 0 0 12px; }
}
.proj-head .ro-val a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.proj-head .ro-val a:hover { text-decoration-color: currentColor; }
.proj-sum .ps-margin { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.proj-sum .ps-margin .k { width: 100%; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.proj-sum .ps-margin .v { font-size: 30px; font-weight: 700; letter-spacing: -.03em; color: var(--ink); }
.proj-sum .t-row > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.proj-sum .ps-note { margin: -4px 0 2px; font-size: 12px; color: var(--ink-3); text-align: right; }
.proj-sum .ps-note:empty { display: none; }
/* a project won from a quote (D72): the quote's number, in its header */
.q-from { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); text-decoration: none; }
.q-from:hover { color: var(--ink); text-decoration: underline; }

/* a customer's projects: just names, each opening its project */
.plinks { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden;
  box-shadow: var(--shadow), var(--shadow-hi); }
.plink { display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px 12px 16px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; color: var(--ink); }
.plink:first-child { border-top: 0; }
.plink:hover { background: var(--surface-2); }
.plink .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plink .i { color: var(--ink-3); transform: rotate(-90deg); }
.plink.closed .nm { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line-2); }

/* ───────────────────────────── invoices (D20) ───────────────────────────── */
.kpi.bad .k, .kpi.bad .v { color: var(--bad-text); }
.ipill { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600;
  white-space: nowrap; vertical-align: middle; letter-spacing: 0; font-family: var(--f-ui); }
h1.title .ipill { font-size: 13px; margin-left: 6px; vertical-align: 6px; }
.ip-draft   { background: var(--none-bg); color: var(--none-text); }
.ip-sent    { background: var(--time-soft); color: var(--time-text); }
.ip-overdue { background: var(--bad-bg); color: var(--bad-text); }
.ip-paid    { background: var(--ok-bg); color: var(--ok-text); }
.ip-void    { background: transparent; color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line-2); text-decoration: line-through; }

/* the list */
.inv-rows { display: grid; gap: 6px; }
.inv-row { display: grid; grid-template-columns: 96px minmax(0, 2fr) 80px 104px 120px 92px; align-items: center; gap: 12px;
  width: 100%; padding: 12px 16px; text-align: left; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-ctl); box-shadow: var(--shadow), var(--shadow-hi); }
button.inv-row:hover { border-color: var(--line-2); background: var(--surface-2); }
.inv-row.head { background: none; border: 0; box-shadow: none; padding: 0 16px 2px; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.inv-row .no { font-weight: 650; font-variant-numeric: tabular-nums; }
.inv-row .no em { font-style: normal; color: var(--ink-3); font-weight: 600; }
.inv-row .who { display: flex; flex-direction: column; min-width: 0; }
.inv-row .who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-row .meta { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-row .dt { font-size: 13px; color: var(--ink-2); }
.inv-row .r { text-align: right; }
.inv-row .st { display: flex; justify-content: flex-end; }
.inv-row.s-void { opacity: .65; }
@media (max-width: 760px) {
  .inv-row.head { display: none; }
  .inv-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "no amt" "who st" "dt dt2"; row-gap: 3px; }
  .inv-row .no { grid-area: no; } .inv-row .amt { grid-area: amt; } .inv-row .who { grid-area: who; } .inv-row .st { grid-area: st; }
  .inv-row .dt[data-l="Date"] { grid-area: dt; font-size: 12px; color: var(--ink-3); }
  .inv-row .dt[data-l="Due"] { grid-area: dt2; font-size: 12px; color: var(--ink-3); text-align: right; }
  .inv-row:not(.s-paid):not(.s-void) .dt[data-l="Due"]::before { content: "Due "; }
}

/* a project's invoices, and billing on its income */
.mini-invs { display: grid; gap: 4px; }
.mini-inv { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink); text-align: left; font-size: 13.5px; }
.mini-inv:hover { border-color: var(--line-2); }
.mini-inv .no { font-weight: 650; } .mini-inv .no em { font-style: normal; color: var(--ink-3); }
.bill-note { display: block; font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.bill-bar { position: relative; display: block; height: 4px; max-width: 220px; margin-top: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bill-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; }
.bill-bar .d { background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--time) 30%, transparent) 0 4px, transparent 4px 7px); }
.bill-bar .b { background: color-mix(in srgb, var(--time) 45%, transparent); }
.bill-bar .p { background: var(--ok); }
.bill-box { border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface-2); padding: 12px 14px; margin-bottom: 14px; }
.bill-box-t { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.bill-box-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 8px 0 10px; font-size: 13.5px; }
.bill-box-links a { font-weight: 600; }

/* the draft editor */
.save-state { min-width: 64px; text-align: right; }
.bill-list { display: grid; gap: 8px; }
.bill-row { border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 10px 12px; transition: border-color .15s, background .15s; }
.bill-row.on { border-color: color-mix(in srgb, var(--time) 45%, var(--line)); background: color-mix(in srgb, var(--time-soft) 40%, transparent); }
.bill-row.done { opacity: .6; }
.bill-check { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; cursor: pointer; }
.bill-row.done .bill-check { cursor: default; }
.bill-check input { width: 17px; height: 17px; accent-color: var(--time); }
.bill-t { display: flex; flex-direction: column; min-width: 0; }
.bill-t strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bill-left { font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bill-amt { display: grid; gap: 8px; margin: 10px 0 2px 27px; }
.bill-now { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bill-now .money-wrap { flex: 1 1 140px; max-width: 200px; }
.bill-now .money-wrap .input, .own-row .money-wrap .input { padding-left: 24px; }
.bill-now .money-wrap .cur, .own-row .money-wrap .cur { left: 11px; font-size: 14px; }
.seg.mini { flex: none; }
.seg.mini button { min-height: 30px; padding: 0 10px; font-size: 12.5px; }
.bill-max.bad { color: var(--bad-text); font-weight: 600; }
.own-head, .own-row { display: grid; grid-template-columns: minmax(0, 1fr) 64px 120px 96px 30px; gap: 8px; align-items: center; }
.own-head { font-size: 12px; color: var(--ink-3); font-weight: 600; margin-bottom: 6px; }
.own-head .r, .own-amt { text-align: right; }
.own-lines { display: grid; gap: 8px; }
.own-amt { font-weight: 600; font-size: 13.5px; }
@media (max-width: 640px) {
  .own-head { display: none; }
  .own-row { grid-template-columns: 64px minmax(0, 1fr) auto 30px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .own-row > .input:first-child { grid-column: 1 / -1; }
  .bill-amt { margin-left: 0; }
}
.totals-card .t-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; color: var(--ink-2); }
.totals-card .t-total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; font-size: 20px; font-weight: 700;
  color: var(--ink); letter-spacing: -.02em; }

/* a sent invoice */
.inv-banner { display: flex; align-items: flex-start; gap: 9px; padding: 11px 14px; margin-bottom: 14px; border-radius: var(--r-ctl);
  font-size: 13.5px; background: var(--surface-3); color: var(--ink-2); }
.inv-banner .i { margin-top: 2px; }
.ib-sent { background: var(--time-soft); color: var(--time-text); }
.ib-overdue { background: var(--bad-bg); color: var(--bad-text); }
.ib-paid { background: var(--ok-bg); color: var(--ok-text); }
.inv-more { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.inv-more .hint { margin-left: 4px; }

/* the paper: an invoice always prints and previews on white */
.inv-paper { background: color-mix(in srgb, var(--surface-3) 70%, transparent); border-radius: var(--r-card); padding: clamp(10px, 3vw, 28px); }
.inv-paper.in-sheet { padding: 0; background: none; }
.inv-doc { position: relative; max-width: 800px; margin: 0 auto; background: #fff; color: #18181b; border-radius: 6px;
  padding: clamp(22px, 5vw, 52px); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 12px 32px -12px rgba(0, 0, 0, .25);
  font: 400 13.5px/1.5 Helvetica, Arial, sans-serif; overflow: hidden; color-scheme: light; }   /* Helvetica: the font of the PDF (D59), so the two match */
.inv-doc .d-top { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-bottom: 22px; border-bottom: 2px solid #18181b; }
.inv-doc .d-biz { font: 700 20px/1.2 Helvetica, Arial, sans-serif; margin-bottom: 6px; }
.inv-doc .d-small { font-size: 12.5px; color: #52525b; }
.inv-doc .d-title { font: 700 26px/1 Helvetica, Arial, sans-serif; text-align: right; margin-bottom: 10px; color: #9a7b45; text-transform: uppercase; }
.inv-doc dl { display: grid; grid-template-columns: auto auto; gap: 3px 16px; margin: 0; font-size: 12.5px; }
.inv-doc dt { color: #71717a; text-align: right; } .inv-doc dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.inv-doc .d-bill { padding: 20px 0; }
.inv-doc .d-k { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #9a7b45; margin-bottom: 6px; }
.inv-doc .d-name { font-weight: 600; font-size: 14.5px; }
.inv-doc .d-faint { color: #a1a1aa; }
.inv-doc .d-lines { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.inv-doc .d-lines th { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #71717a; text-align: left;
  padding: 9px 8px; border-bottom: 1px solid #d4d4d8; background: #fafafa; }
.inv-doc .d-lines td { padding: 10px 8px; border-bottom: 1px solid #ececef; vertical-align: top; }
.inv-doc .d-lines .r { text-align: right; white-space: nowrap; }
.inv-doc .d-totals { margin: 16px 0 0 auto; width: min(320px, 100%); font-variant-numeric: tabular-nums; }
.inv-doc .d-totals > div { display: flex; justify-content: space-between; gap: 16px; padding: 5px 8px; }
.inv-doc .d-totals .d-total { border-top: 2px solid #18181b; margin-top: 4px; padding-top: 9px; font-weight: 700; font-size: 16px; }
.inv-doc .d-notes { margin-top: 28px; padding-top: 16px; border-top: 1px solid #ececef; font-size: 12.5px; color: #3f3f46; }
.inv-doc .d-stamp { position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%) rotate(-18deg); font: 700 92px/1 Helvetica, Arial, sans-serif;
  letter-spacing: .08em; text-transform: uppercase; color: rgba(220, 38, 38, .14); border: 8px solid rgba(220, 38, 38, .14);
  padding: 4px 24px; border-radius: 14px; pointer-events: none; }
.inv-doc .d-stamp.paid { color: rgba(22, 163, 74, .13); border-color: rgba(22, 163, 74, .13); }
@media (max-width: 520px) { .inv-doc .d-title, .inv-doc dt, .inv-doc dd { text-align: left; } .inv-doc .d-stamp { font-size: 54px; } }

/* "Download PDF": only the invoice goes to the printer */
#printDoc { display: none; }
@media print {
  @page { margin: 12mm; }
  html, body { background: #fff !important; overflow: visible !important; height: auto !important; }
  body > *:not(#printDoc) { display: none !important; }
  #printDoc { display: block; }
  #printDoc .inv-doc { box-shadow: none; border-radius: 0; max-width: none; padding: 0; }
  #printDoc .d-lines th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* a heading with its action, at the top of a tab */
.tab-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 12px; }

/* ── project tabs: Entries actions, Insights, Budget ── */
.proj-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.hourly .hr-big { font-weight: 700; font-size: clamp(30px, 3.4vw, 40px); letter-spacing: -.04em; line-height: 1.05; margin-top: 6px; }
.hr-bars { display: grid; gap: 8px; }
.hr-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) 64px; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.hr-row b { text-align: right; color: var(--ink); }
.hr-row .bar { height: 8px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.hr-row .bar i { display: block; height: 100%; border-radius: 5px; }
.hr-row .bar i.ok { background: var(--ok); } .hr-row .bar i.low { background: var(--warn); } .hr-row .bar i.rate { background: var(--time); }
.hourly b.g { color: var(--ok-text); } .hourly b.a { color: var(--warn-text); }
.forecast { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0 0; padding: 10px 12px; border-radius: var(--r-ctl); font-size: 13.5px; }
.forecast .i { margin-top: 2px; }
.forecast.ok { background: var(--ok-bg); color: var(--ok-text); }
.forecast.bad { background: var(--bad-bg); color: var(--bad-text); }
.budget-set { display: flex; gap: 8px; flex-wrap: wrap; }
.budget-set .money-wrap { flex: 0 1 220px; }
.budget-set .money-wrap .input { padding-left: 26px; }
.budget-set .money-wrap .cur { left: 12px; font-size: 15px; }
/* five tabs on a phone: tighter, without the counts, so every one is visible */
@media (max-width: 480px) {
  .ptabs { gap: 0; }
  .ptabs button, .ptabs a { padding: 10px 7px 12px; font-size: 13px; }
  .ptabs .ct { display: none; }
  .ptabs button[aria-selected="true"]::after, .ptabs a[aria-selected="true"]::after { left: 6px; right: 6px; }
}

/* ── planned modules: in the panel with a "Soon" badge, and their page (D23) ── */
.mod.soon { color: color-mix(in srgb, var(--rail-ink) 70%, transparent); }
.mod.soon .mod-ic { opacity: .7; }
.mod-soon { font-size: 8.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #b8965a;
  border: 1px solid rgba(184,150,90,.45); border-radius: 6px; padding: 0 4px; line-height: 13px; margin-top: 1px; }
.rail-nav { overflow-y: auto; scrollbar-width: none; min-height: 0; }
.soon-card { max-width: 640px; padding: clamp(22px, 4vw, 34px); }
.soon-card h2 { font: 700 clamp(20px, 2.4vw, 24px)/1.3 var(--f-head); letter-spacing: -.02em; margin: 14px 0 16px; }
.soon-tag { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #9a7b45;
  background: color-mix(in srgb, #b8965a 16%, transparent); border-radius: 99px; padding: 4px 11px; }
.soon-card ul { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 10px; }
.soon-card li { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-2); }
.soon-card li .i { color: var(--ok); margin-top: 3px; }
.soon-card .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* ── Settings tabs, logo ── */
.set-tabs { margin-top: 4px; }
.set-tabs .short { display: none; }
/* the short names until there's room for all eight in full */
@media (max-width: 1240px) { .set-tabs .full { display: none; } .set-tabs .short { display: inline; } }
.logo-box { display: grid; place-items: center; min-height: 120px; padding: 18px; border-radius: var(--r-ctl);
  border: 1px solid var(--line); background: repeating-conic-gradient(var(--surface-3) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; }
.logo-box img { max-width: 100%; max-height: 110px; object-fit: contain; }
.logo-box.empty { background: var(--surface-2); border-style: dashed; }
.logo-box.empty span { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink-3); font-size: 13px; }
.logo-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.soon-list ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.soon-list li { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-2); font-size: 14px; }
.soon-list li .i { margin-top: 3px; color: var(--time); }
.soon-list b { color: var(--ink); }
.inv-doc .d-logo { display: block; max-width: 220px; max-height: 80px; object-fit: contain; margin-bottom: 12px; }

/* ── welcome steps, kind of work, tax notes (D26) ── */
.w-steps { display: flex; gap: 6px; margin-bottom: 18px; }
.w-steps i { width: 28px; height: 4px; border-radius: 3px; background: var(--line-2); }
.w-steps i.on { background: var(--ok); }
.w-work { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.w-opt { display: flex; align-items: center; gap: 9px; padding: 12px 13px; border: 1px solid var(--line-2); border-radius: var(--r-ctl);
  background: var(--surface); color: var(--ink); text-align: left; font-weight: 600; font-size: 13.5px; transition: border-color .15s, background .15s; }
.w-opt:hover { border-color: var(--ink-3); }
.w-opt[aria-checked="true"] { border-color: var(--ok); background: var(--ok-bg); }
.w-opt .i { color: var(--ink-3); flex: none; }
.w-foot { display: flex; gap: 8px; margin-top: 6px; }
.w-foot .btn.primary { flex: 1; }
@media (max-width: 420px) { .w-work { grid-template-columns: 1fr; } }
.note-line-hint { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 14px; padding: 10px 12px; border-radius: var(--r-ctl);
  font-size: 13px; background: var(--warn-bg); color: var(--warn-text); }
.note-line-hint.ok { background: var(--ok-bg); color: var(--ok-text); }
.note-line-hint .i { margin-top: 2px; flex: none; }
.note-line-hint a { color: inherit; font-weight: 700; }
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl);
  margin-bottom: 8px; cursor: pointer; font-size: 13.5px; }
.radio input { margin-top: 3px; accent-color: var(--time); }
.radio:has(input:checked) { border-color: color-mix(in srgb, var(--time) 50%, var(--line)); background: color-mix(in srgb, var(--time-soft) 50%, transparent); }

/* ── vendors and bills (D27) ── */
.vend-rows .cust-row { grid-template-columns: minmax(0, 2.2fr) 1fr 1fr 1fr .2fr 130px; }
@media (max-width: 760px) {
  .vend-rows .cust-row { grid-template-columns: 1fr auto; grid-template-areas: "nm st" "cnt m"; }
  .vend-rows .cust-row [data-l="Spent"] { display: none; }
  .vend-rows .cust-row [data-l="To pay"] { grid-area: m; }
}
.inv-row .amt { display: flex; flex-direction: column; align-items: flex-end; }
.inv-row .amt .meta { font-weight: 500; }
.bl-head, .bl-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1.1fr) minmax(0, .85fr) 100px 88px 30px; gap: 8px; align-items: center; }
.bl-head { font-size: 12px; color: var(--ink-3); font-weight: 600; margin-bottom: 6px; }
.bl-head .r { text-align: right; }
.bl-lines { display: grid; gap: 8px; }
.bl-row .money-wrap .input { padding-left: 24px; }
.bl-row .money-wrap .cur { left: 11px; font-size: 14px; }
.bl-row.linked { grid-template-columns: minmax(0, 1fr) auto 30px; padding: 9px 12px; border-radius: var(--r-ctl);
  border: 1px dashed color-mix(in srgb, var(--time) 45%, var(--line)); background: color-mix(in srgb, var(--time-soft) 40%, transparent); }
.bl-link { display: flex; gap: 9px; align-items: flex-start; min-width: 0; }
.bl-link .i { color: var(--time-text); margin-top: 3px; flex: none; }
.bl-link > span { display: flex; flex-direction: column; min-width: 0; }
.bl-amt { font-weight: 650; font-size: 14px; }
.bl-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.bl-tax { align-items: center; }
.bl-tax .money-wrap { width: 130px; }
.bl-tax .money-wrap .input { padding-left: 24px; min-height: 36px; text-align: right; }
.bl-tax .money-wrap .cur { left: 11px; font-size: 14px; }
.bl-split { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.bl-split span { display: inline-flex; align-items: center; gap: 6px; }
.bl-split b { color: var(--ink); }
@media (max-width: 640px) {
  .bl-head { display: none; }
  .bl-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 30px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  .bl-row > select:nth-of-type(1) { grid-column: 1; }
  .bl-row > select:nth-of-type(2) { grid-column: 2 / 4; }
  .bl-row > input.input { grid-column: 1 / -1; }
  .bl-row > select:nth-of-type(3) { grid-column: 1; }
  .bl-row > div:nth-of-type(1) { grid-column: 2 / 4; }
  .bl-row > div:nth-of-type(2) { grid-column: 1 / 3; }
}
  border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); color: var(--ink); }
.more-list { display: grid; gap: 6px; }
.more-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 13px 14px; text-decoration: none;
  color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); }
.more-row > span { display: flex; flex-direction: column; }
.more-row > .i:last-child { transform: rotate(-90deg); color: var(--ink-3); }

/* ── a cost's or income's own tabs, and the shortcut at the end of its row (D28) ── */
  border: 1px dashed var(--line-2); border-radius: var(--r-sm); background: transparent; color: var(--ink-3); font-size: 11.5px; font-weight: 650; }
.e-tabs { margin: -4px 0 16px; }
.tax-row { display: flex; gap: 8px; align-items: center; }
.tax-row .money-wrap { flex: 0 1 180px; }
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 13.5px; }
.split-row.tax .bar i { background: repeating-linear-gradient(135deg, var(--warn) 0 4px, color-mix(in srgb, var(--warn) 55%, transparent) 4px 8px); }
.split-row.tax .n { font-style: italic; }

/* ── Entries: income on the left, costs on the right; smaller summary boxes (D29) ── */
.ecols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
@media (max-width: 980px) { .ecols { grid-template-columns: minmax(0, 1fr); } }
.ecol { padding: 14px 14px 8px; }
.ecol-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.ecol-head .h2 { margin: 0; display: flex; align-items: center; gap: 7px; }
.ecol-n { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.ecol-sum { margin-left: auto; font-weight: 700; font-size: 14px; }
.ecol-income .ecol-sum { color: var(--ok-text); }
.ecol-empty { margin: 8px 2px 12px; }
.ecol .entry.ecard { padding: 10px 12px; }
.cost-mode { margin: -2px 0 14px; }
.cost-mode button { flex: 1; }
.kpis.compact { gap: 8px; margin-bottom: 14px; }
.kpis.compact .kpi { padding: 10px 12px; }
.kpis.compact .kpi .k { font-size: 12px; }
.kpis.compact .kpi .v { font-size: 19px; margin-top: 2px; }
.kpis.compact .kpi .d { font-size: 11.5px; margin-top: 2px; }

/* ── locked cost/income, billing status, numbered chips (D30) ── */
#entryForm.locked .seg, #entryForm.locked .chip, #entryForm.locked .input { opacity: .75; }
#entryForm.locked .input:disabled { cursor: default; }
.lock-note { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; }
.bst { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; margin-right: 4px; }
.bst-invoiced { background: var(--ok-bg); color: var(--ok-text); }
.bst-partial { background: var(--time-soft); color: var(--time-text); }
.bst-draft { background: var(--none-bg); color: var(--none-text); }
.bst-none { background: var(--warn-bg); color: var(--warn-text); }
#entryForm.locked .sheet-foot .spacer { display: none; }

/* ── Entries rows as small cards, with a tiny "2 invoices" / "1 bill" label (D31) ── */
.ecol .entries { display: grid; gap: 6px; }
.ecard { border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface-2); padding: 10px 12px; }
.ecard:first-child { border-top: 1px solid var(--line); }
.ecard:hover { background: var(--surface-3); border-color: var(--line-2); }

/* ── a cost's bill / an income's invoices: one simple row each (D32) ── */
.link-rows { display: grid; gap: 6px; }
.link-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-ctl);
  border: 1px solid color-mix(in srgb, var(--time) 35%, var(--line)); background: color-mix(in srgb, var(--time-soft) 45%, var(--surface)); }
.link-row > .i { color: var(--time-text); flex: none; }
.lr-no { font-weight: 700; font-size: 14px; }
.lr-amt { margin-left: auto; font-weight: 600; font-size: 13.5px; }
.lr-open { border: 0; background: none; padding: 0; font-size: 12px; font-weight: 600; color: var(--ink-3); text-decoration: underline; cursor: pointer; }
.lr-open:hover { color: var(--ink); }

/* ── the cost/income form: one small "project margin" line, category dropdown (D33) ── */
#entryForm .preview { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin: 2px 0 12px; min-height: 0; }
#entryForm .preview:empty { display: none; }
#entryForm .preview .k { font-size: 12px; color: var(--ink-3); font-weight: 600; }
#entryForm .preview .m { margin-left: auto; font-weight: 700; font-size: 15px; }
.lr-open { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; text-decoration: none; }
.lr-open:hover { background: var(--surface-3); }
.lr-open .i { width: 14px; height: 14px; }

/* ── a small pop-up over a blurred page: adding a category from the form (D34) ── */
.scrim.blur { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sheet.small { width: min(380px, calc(100vw - 32px)); }
@media (max-width: 820px) { .scrim.blur { place-items: center; padding: 16px; } .scrim.blur .sheet.small { border-radius: 18px; } .scrim.blur .sheet.small::before { display: none; } }

/* a vendor's projects, with what each cost (D35) */
.plink:has(.pl-amt) { grid-template-columns: 60px minmax(0, 1fr) auto 16px; }
.plink .pl-amt { font-weight: 600; font-size: 13.5px; }
.plink.static { cursor: default; }
.plink.static:hover { background: transparent; }
.bl-row.is-cost > select:nth-of-type(2) { border-color: color-mix(in srgb, var(--time) 45%, var(--line)); }

/* ── documents (bills, invoices) laid out like an ERP: bar, header, tabs, lines (D36) ── */
.doc-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.doc-title { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.doc-title h1 { margin: 0; font: 700 22px/1.2 var(--f-head); letter-spacing: -.02em; overflow-wrap: anywhere; }
.doc-kind { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.doc-acts { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; min-width: 0; max-width: 100%; }
.doc-head { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 18px; padding: 16px 18px; margin-bottom: 14px; }
.doc-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; align-content: start; }
.doc-fields .field { margin-bottom: 10px; min-width: 0; }
.doc-fields .field.span2 { grid-column: span 2; }
.doc-fields .field.span3 { grid-column: 1 / -1; }
.doc-fields label, .doc-fields .label { font-size: 12px; }
.doc-fields .input { min-height: 38px; }
.ro-val { min-height: 38px; display: flex; align-items: center; padding: 0 12px; border-radius: var(--r-ctl); background: var(--surface-2);
  border: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-sum { border-left: 1px solid var(--line); padding-left: 18px; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.doc-sum .t-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14px; color: var(--ink-2); }
.doc-sum .t-total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 9px; font-size: 20px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.doc-tabs { margin: 0 0 12px; }
.doc-lines { padding: 14px 16px; }
.dl-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1.1fr) minmax(0, .85fr) 100px 88px 30px; gap: 8px; align-items: center; }
.dl-row.pst { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, .8fr) 96px 84px 80px 30px; }
.dl-row.head { font-size: 12px; color: var(--ink-3); font-weight: 600; margin-bottom: 6px; }
.dl-row.head .r { text-align: right; }
.dl-body { display: grid; gap: 8px; }
.dl-row .money-wrap .input { padding-left: 24px; }
.dl-row .money-wrap .cur { left: 11px; font-size: 14px; }
.dl-row.is-cost > select:nth-of-type(2) { border-color: color-mix(in srgb, var(--time) 45%, var(--line)); }
.doc-menu { position: fixed; z-index: 90; min-width: 210px; padding: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-ctl); box-shadow: var(--shadow-pop); display: grid; gap: 2px; }
.doc-menu button { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 0; background: none; border-radius: var(--r-sm);
  color: var(--ink); font-size: 13.5px; text-align: left; cursor: pointer; }
.doc-menu button:hover, .doc-menu button:focus { background: var(--surface-3); outline: none; }
.doc-menu button.danger { color: var(--bad-text); }
@media (max-width: 900px) {
  .doc-head { grid-template-columns: minmax(0, 1fr); }
  .doc-sum { border-left: 0; border-top: 1px solid var(--line); padding: 12px 0 0; }
  .doc-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.il-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 64px 120px 100px 30px; gap: 8px; align-items: center; }
.il-row.head { font-size: 12px; color: var(--ink-3); font-weight: 600; margin-bottom: 6px; }
.il-row .r { text-align: right; }
.il-row.ro { grid-template-columns: minmax(0, 1fr) 64px 110px 110px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.il-row.ro:last-child { border-bottom: 0; }
.il-from { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.il-from b { color: var(--ok-text); font-weight: 650; }
.il-qty { color: var(--ink-3); }
.il-amt { font-weight: 650; font-size: 13.5px; }
.il-amt.bad { color: var(--bad-text); font-size: 12px; }
.il-row .money-wrap .input { padding-left: 24px; }
.il-row .money-wrap .cur { left: 11px; font-size: 14px; }
.il-add { max-width: 340px; min-height: 34px; font-size: 13px; }
.ro-note { font-size: 14px; color: var(--ink-2); line-height: 1.55; }
@media (max-width: 700px) {
  .il-row.ro { grid-template-columns: minmax(0, 1fr) auto; }
  .il-row.ro > span:nth-child(2), .il-row.ro > span:nth-child(3) { display: none; }
}
.il-row.ro.head { border-bottom: 0; padding: 0 2px; font-size: 12px; }
/* every form shows its number (D37) */
.doc-no { font-variant-numeric: tabular-nums; letter-spacing: .02em; color: var(--ink); }
.title-no { display: inline-block; vertical-align: 5px; margin-right: 10px; padding: 2px 8px; border-radius: 7px; font: 700 13px/1.5 var(--f-ui);
  letter-spacing: .03em; color: var(--ink-2); background: var(--surface-3); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
/* a small warning with a tiny explanation on hover (D38) */
.tip { position: relative; display: inline-grid; place-items: center; cursor: pointer; }
.tip.warn { color: var(--warn); margin-right: 6px; vertical-align: -2px; }
.tip.warn .i { width: 15px; height: 15px; }
.tip[data-tip]:hover::after, .tip[data-tip]:focus::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); right: -8px; z-index: 50;
  width: max-content; max-width: 240px; padding: 7px 10px; border-radius: 8px; background: var(--ink); color: var(--bg);
  font: 500 12px/1.4 var(--f-ui); white-space: normal; text-align: left; box-shadow: var(--shadow-pop); pointer-events: none; }
.il-row.is-inc > select:first-child { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.il-row { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.4fr) 64px 120px 110px 30px; }
/* an income billed past what's left: its amounts go red, and Save waits with the reason beside it (D38) */
.money-wrap.over .input { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad-text); }
.save-why { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--bad-text); max-width: 300px; }
.save-why .i { flex: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.tax-lines { max-width: 360px; border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 6px 12px; background: var(--surface-2); }
.tax-lines .t-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; color: var(--ink-2); }
.tax-grid { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 0 12px; max-width: 460px; }
/* Bill to: the customer's details, locked until overridden (D40) */
.bt-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.doc-fields.locked .input:disabled { background: var(--surface-2); color: var(--ink-2); opacity: 1; cursor: default; resize: none; }
/* bill lines without tax columns; a category that's needed (D41) */
.dl-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1.15fr) minmax(0, .9fr) 120px 30px; }
.input.need { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 18%, transparent); }
.dl-row select:disabled { background: var(--surface-2); color: var(--ink-3); opacity: 1; }

/* ── lines: a row on a wide window, a labelled card on a narrow one — phones, tablets, a narrow window (D42) ── */
.doc-lines { container-type: inline-size; }
.cell { min-width: 0; }
.cell .input, .cell .money-wrap { width: 100%; }
.c-del { display: flex; justify-content: flex-end; }
.c-amt { text-align: right; }
@container (max-width: 760px) {
  .dl-row.head, .il-row.head:not(.ro) { display: none; }
  .dl-row, .il-row:not(.ro) { position: relative; gap: 8px 10px; padding: 12px 12px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface-2); }
  .dl-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "proj proj" "cost cost" "desc desc" "cat amt"; }
  .il-row:not(.ro) { grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "from from from" "desc desc desc" "qty price amt"; }
  .dl-row .c-proj { grid-area: proj; padding-right: 34px; } .dl-row .c-cost { grid-area: cost; } .dl-row .c-desc, .il-row .c-desc { grid-area: desc; }
  .dl-row .c-cat { grid-area: cat; } .dl-row .c-amt, .il-row .c-amt { grid-area: amt; }
  .il-row .c-from { grid-area: from; padding-right: 34px; } .il-row .c-qty { grid-area: qty; } .il-row .c-price { grid-area: price; }
  .c-del { position: absolute; top: 8px; right: 8px; }
  .cell[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-3); margin: 0 0 4px 2px; }
  .il-row .c-amt { display: flex; flex-direction: column; justify-content: flex-end; }
  .il-row .c-amt .il-amt { min-height: 40px; display: flex; align-items: center; justify-content: flex-end; font-size: 15px; }
  .il-qty { display: flex; align-items: center; min-height: 40px; }
  .dl-body { gap: 10px; }
  .c-amt { text-align: left; }
  .il-row .c-amt::before { text-align: right; }
}
@container (max-width: 280px) {
  .dl-row { grid-template-areas: "proj proj" "cost cost" "desc desc" "cat cat" "amt amt"; }
  .il-row:not(.ro) { grid-template-columns: 64px minmax(0, 1fr); grid-template-areas: "from from" "desc desc" "qty price" "amt amt"; }
}
/* the header: two columns of fields and the totals below when the window is narrow */
.doc-head { container-type: inline-size; }
@container (max-width: 640px) { .doc-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 270px) { .doc-fields { grid-template-columns: minmax(0, 1fr); } .doc-fields .field.span2 { grid-column: auto; } }
@container (min-width: 520px) and (max-width: 760px) {
  .dl-row { grid-template-areas: "proj cost" "desc desc" "cat amt"; }
  .dl-row .c-proj { padding-right: 0; } .dl-row .c-cost { padding-right: 34px; }
  .il-row:not(.ro) { grid-template-columns: 90px minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "from from from" "desc desc desc" "qty price amt"; }
}

/* a line can be left out of tax (D43) */
.dl-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1.1fr) minmax(0, .9fr) 112px 78px 30px; }
.il-row { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.35fr) 60px 116px 104px 78px 30px; }
.tx-box { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.tx-box input { width: 16px; height: 16px; accent-color: var(--time); }
@container (max-width: 760px) {
  .dl-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "proj proj" "cost cost" "desc desc" "cat amt" "tx tx"; }
  .il-row:not(.ro) { grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "from from from" "desc desc desc" "qty price amt" "tx tx tx"; }
  .c-tx { grid-area: tx; }
}
@container (min-width: 520px) and (max-width: 760px) {
  .dl-row { grid-template-areas: "proj cost" "desc desc" "cat amt" "tx tx"; }
}
@container (min-width: 520px) and (max-width: 760px) {
  .il-row:not(.ro) { grid-template-columns: 90px minmax(0, 1fr) minmax(0, 1fr); }
}
@container (max-width: 280px) {
  .dl-row { grid-template-areas: "proj proj" "cost cost" "desc desc" "cat cat" "amt amt" "tx tx"; }
  .il-row:not(.ro) { grid-template-columns: 64px minmax(0, 1fr); grid-template-areas: "from from" "desc desc" "qty price" "amt amt" "tx tx"; }
}
/* Save sits right after the status; how it stands is tiny type inside it (D44) */
.save-btn { min-height: 36px; padding: 4px 12px; }
.save-btn .sv { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.save-btn .sv-s { font-size: 9.5px; font-weight: 600; letter-spacing: .02em; color: var(--ink-3); white-space: nowrap; }
.save-btn .sv-s:empty { display: none; }
.doc-title .save-why { margin-left: 2px; }

/* ── the app uses the whole screen: wide monitors, zoomed out, any window size (D45) ── */
.main { max-width: 1920px; margin: 0 auto; }
.pv { width: min(1440px, 100%); max-height: min(1200px, 100%); }
.q-big { font-weight: 700; font-size: clamp(26px, 2.6vw, 34px); letter-spacing: -.04em; line-height: 1.05; margin-top: 4px; }
.inv-st { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 2px 0; font-size: 12.5px; color: var(--ink-3); }

/* ── invoiced / paid on an income's card, on bill / paid on a cost's (D47) ── */
.e-figs { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; }
.e-fig { display: inline-flex; flex-direction: column; line-height: 1.2; }
.e-fig .fl { font-size: 10.5px; font-weight: 600; letter-spacing: .02em; color: var(--ink-3); text-transform: uppercase; }
.e-fig .num { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.e-fig.full .num { color: var(--ok-text); }
.e-fig.zero .num { color: var(--ink-3); font-weight: 500; }

/* entry cards: icons 15% bigger */
.ecard { grid-template-columns: 37px minmax(0, 1fr) auto; }
.ecard .ic { width: 37px; height: 37px; }
.ecard .ic .i { width: 16px; height: 16px; }

/* an income's Invoices tab: what's there, and a small New invoice button on the right */
.li-empty { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px;
  border: 1px dashed var(--line-2); border-radius: var(--r-ctl); }
.li-empty.after { margin-top: 12px; }
.li-acts { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.li-draft { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.li-draft .input { flex: 1; min-width: 0; }

.li-acts .linkish { font-size: 12.5px; }
.li-form { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-ctl); }
.li-go { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.li-empty .btn:disabled { cursor: not-allowed; }

/* an invoice's Preview / PDF window: wide enough for the page */
.sheet.doc-preview { width: min(900px, 100%); }


/* ── Reports (D50): a menu beside the rail, a list page for phones, and the reports ── */
.rail-fly { position: fixed; z-index: 60; width: 300px; padding: 8px; border-radius: 14px; background: var(--surface);
  border: 1px solid var(--line-2); box-shadow: var(--shadow-pop); }
.rf-head { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 6px 10px 8px; }
.rf-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.rf-item:hover, .rf-item:focus-visible { background: var(--surface-3); outline: none; }
.rf-item.soon { opacity: .7; }
.rf-ic { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: var(--r-sm); background: var(--surface-3); color: var(--ink-2); }
.rf-t { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.rf-t strong { font-size: 13.5px; font-weight: 600; }
.rf-t span { font-size: 12px; color: var(--ink-3); }
.rail-fly .mod-soon { position: static; }
.rep-list { display: grid; gap: 8px; max-width: 720px; }
.rep-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: var(--ink); text-decoration: none; }
.rep-card:hover { border-color: var(--line-2); background: var(--surface-2); }
.rep-card .rf-ic { width: 38px; height: 38px; }
.rep-card.soon { opacity: .75; }
.rep-period { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rep-period .input { width: auto; min-height: 38px; padding-top: 6px; padding-bottom: 6px; }
.rep-basis { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.rep-basis .input { width: auto; min-height: 38px; padding-top: 6px; padding-bottom: 6px; }
.rep-sec { margin-bottom: 14px; }
.rep-sec .h2 { margin: 0 0 10px; }
.rep-scroll { overflow-x: auto; margin: 0 -4px; }
.rep-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rep-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rep-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rep-table .r { text-align: right; }
.rep-table tbody tr[data-go] { cursor: pointer; }
.rep-table tbody tr[data-go]:hover, .rep-table tbody tr[data-go]:focus-visible { background: var(--surface-2); outline: none; }
.rep-table tfoot td { font-weight: 700; border-bottom: 0; }
.rep-table .code { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.rep-table .late { color: var(--bad-text); font-weight: 600; }
.rep-table .neg { color: var(--bad-text); }
.rep-foot { margin: 4px 2px 0; max-width: 820px; }
.kpi.good .k, .kpi.good .v { color: var(--ok-text); }
.aging { display: grid; gap: 10px; }
.ag { display: grid; grid-template-columns: 110px minmax(0, 1fr) 110px; gap: 12px; align-items: center; font-size: 13.5px; }
.ag .num { text-align: right; font-weight: 600; }
.ag-l { color: var(--ink-2); }
.ag-bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.ag-bar i { display: block; height: 100%; border-radius: 99px; background: var(--bad); }
@media (max-width: 640px) {
  .ag { grid-template-columns: 90px minmax(0, 1fr) 84px; gap: 8px; }
  .page-head .rep-period { width: 100%; }
}
.rep-card > .i:last-child { transform: rotate(-90deg); color: var(--ink-3); }

/* ── your account: a small window over BenDesk, everything behind it blurred (D52) ── */
.sheet.small.acct-sheet { width: min(440px, calc(100vw - 32px)); }
.acct { display: grid; gap: 18px; }
.acct-me { display: flex; align-items: center; gap: 14px; }
.avatar.lg { width: 52px; height: 52px; font-size: 17px; flex: none; }
.acct-who { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.acct-who strong { font-size: 16px; }
.acct-who > span { font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }
.acct-chips { display: flex; gap: 6px; margin-top: 6px; }
.acct-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px;
  background: var(--surface-3); color: var(--ink-3); }
.acct-chip.on { background: var(--ok-bg); color: var(--ok-text); }
.acct-chip .i { width: 11px; height: 11px; }
.acct-sec { display: grid; gap: 6px; }
.acct-h { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.acct-name { display: flex; gap: 8px; }
.acct-name .input { flex: 1; min-width: 0; }
.acct-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--r-ctl);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); text-decoration: none; }
.acct-row:hover { border-color: var(--line-2); background: var(--surface-3); }
.acct-row > span { display: flex; flex-direction: column; min-width: 0; }
.acct-row strong { font-size: 13.5px; font-weight: 600; }
.acct-row > span > span { font-size: 12px; color: var(--ink-3); }
.acct-row > .i:last-child { transform: rotate(-90deg); color: var(--ink-3); }
.acct-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.acct-del { color: var(--bad-text); font-size: 13px; }
.acct-delbox { display: grid; gap: 8px; padding: 12px; border-radius: var(--r-ctl); border: 1px solid color-mix(in srgb, var(--bad) 40%, var(--line)); background: var(--bad-bg); }
.acct-delbox p { margin: 0; font-size: 13px; color: var(--ink-2); }
.acct-delbox label { font-size: 13px; }
.btn.danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-solid:disabled { opacity: .45; }

/* ── plans & billing (D53) ── */
.mod-lock { position: absolute; top: -6px; right: -10px; display: grid; place-items: center; width: 17px; height: 17px; border-radius: 50%;
  background: #2A2A27; color: #b8965a; border: 1px solid rgba(255,255,255,.12); }
.mod-lock .i { width: 10px; height: 10px; }
.plan-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600;
  text-decoration: none; color: #9a7b45; background: color-mix(in srgb, #b8965a 16%, transparent); white-space: nowrap; }
.plan-tag.bad { color: var(--bad-text); background: var(--bad-bg); }
.plan-tag .i { width: 12px; height: 12px; }
.upgrade-card { max-width: 640px; padding: 28px; }
.upgrade-card h2 { font-size: 22px; letter-spacing: -.02em; margin: 10px 0 14px; }
.upgrade-card ul, .plan-card ul { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.upgrade-card li, .plan-card li { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.upgrade-card li .i, .plan-card li .i { color: var(--ok-text); margin-top: 3px; flex: none; }
.upgrade-card .acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.save-tag { font-size: 11px; font-weight: 700; color: var(--ok-text); background: var(--ok-bg); border-radius: 99px; padding: 1px 7px; margin-left: 4px; }
.plan-now { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 20px; margin-bottom: 14px; }
.plan-now > div:first-child { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.plan-now .k { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.plan-now strong { font-size: 18px; }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
@media (max-width: 900px) { .plan-grid { grid-template-columns: minmax(0, 1fr); } }
.plan-card { display: flex; flex-direction: column; padding: 20px; }
.plan-card.current { border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); }
.plan-card.soon { opacity: .75; }
.plan-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-top h3 { margin: 0; font-size: 17px; }
.plan-cur { font-size: 11.5px; font-weight: 700; color: var(--ok-text); background: var(--ok-bg); border-radius: 99px; padding: 2px 9px; }
.plan-price { font-size: 30px; font-weight: 700; letter-spacing: -.03em; margin: 10px 0 2px; }
.plan-price span { font-size: 14px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.plan-card ul { margin-top: 14px; flex: 1; }
.plan-foot { display: grid; gap: 8px; }
.plan-foot .btn { justify-content: center; }
.billing { max-width: 1100px; }

/* ── AI Assistant (D54): a log of what you asked, cards to confirm, and the box ── */
.ai-wrap { display: flex; flex-direction: column; max-width: 860px; height: calc(100vh - 220px); min-height: 420px; padding: 0; overflow: hidden; }
.ai-log { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.ai-hello p { margin: 0 0 12px; color: var(--ink-2); }
.ai-ex { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-me { align-self: flex-end; max-width: 80%; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.ai-me > span:last-child:not(.ai-filechip) { background: var(--btn); color: var(--btn-ink); padding: 9px 13px; border-radius: 14px 14px 4px 14px; font-size: 14px; white-space: pre-wrap; }
.ai-bot { align-self: flex-start; max-width: 92%; display: grid; gap: 8px; }
.ai-bot > p { margin: 0; font-size: 14px; color: var(--ink-2); white-space: pre-wrap; }
.ai-md { font-size: 14px; line-height: 1.55; color: var(--ink-2); display: grid; gap: 8px; min-width: 0; }
.ai-md p, .ai-md ul, .ai-md ol { margin: 0; }
.ai-md ul, .ai-md ol { padding-left: 20px; display: grid; gap: 3px; }
.ai-md b { color: var(--ink); font-weight: 650; }
.ai-md a { color: var(--ink); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--ink) 35%, transparent); text-underline-offset: 2px; }
.ai-md a:hover { text-decoration-color: currentColor; }
.ai-tbl { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; }
.ai-tbl table { border-collapse: collapse; font-size: 13px; width: 100%; }
.ai-tbl th, .ai-tbl td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ai-tbl th { font-weight: 600; color: var(--ink-3); font-size: 12px; }
.ai-tbl tr:last-child td { border-bottom: 0; }
.ai-tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ai-tbl td.neg, .ai-kpi .v.neg { color: var(--bad-text); }
/* Ben's number tiles: the figures that answer the question, big */
.ai-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.ai-kpi { display: grid; align-content: start; gap: 2px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2, transparent); min-width: 0; }
.ai-kpi .k { font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; }
.ai-kpi .v { font-size: clamp(16px, 4.4vw, 20px); font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.2; }
.ai-kpi .d { font-size: 12px; color: var(--ink-3); }
/* A project's light, an invoice's state — as coloured words in Ben's tables */
.ai-pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.ai-pill.ok { color: var(--ok-text, #1f7a4d); background: var(--ok-bg, rgba(31,122,77,.12)); }
.ai-pill.warn { color: var(--warn-text, #8a5a00); background: var(--warn-bg, rgba(214,150,0,.14)); }
.ai-pill.bad { color: var(--bad-text); background: var(--bad-bg); }
.ai-pill.mute { color: var(--ink-3); background: color-mix(in srgb, var(--ink) 8%, transparent); }
/* Follow-ups to tap */
.ai-next { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-next .chip { font-size: 13px; }
/* The mic (D63): red and pulsing while it listens */
.ai-mic.on { color: #fff; background: var(--bad, #d64545); border-color: transparent; animation: ai-mic-pulse 1.4s ease-in-out infinite; }
@keyframes ai-mic-pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--bad, #d64545) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { .ai-mic.on { animation: none; } }
/* Ben is an AI, and says so on every reply (D57) — so nobody mistakes it for Ben the person. */
.ai-who { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; color: var(--ink); }
.ai-badge { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 6px; border-radius: 99px;
  color: var(--time-text); background: var(--time-soft); vertical-align: middle; }
.ai-badge.lg { font-size: 11px; padding: 3px 9px; margin-left: 6px; position: relative; top: -3px; }
.ai-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line-2); border-radius: var(--r-ctl); background: var(--surface-2); }
.ai-card.done { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.ai-card.skipped { opacity: .55; }
.ai-switch { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 8px 12px 0; padding: 10px 12px;
  border-radius: 10px; border: 1px solid color-mix(in srgb, var(--warn, #d9a33a) 45%, var(--line)); background: color-mix(in srgb, var(--warn, #d9a33a) 8%, transparent); font-size: 13px; }
.ai-switch-acts { display: flex; gap: 6px; margin-left: auto; }
.ben-dock .ai-switch { margin: 0 0 2px; }
.ai-switch-t { display: grid; gap: 2px; min-width: 0; flex: 1 1 220px; line-height: 1.4; }
.ai-switch-t span { color: var(--ink-2); font-size: 12.5px; }
@media (max-width: 820px) { .ai-switch-acts { width: 100%; } .ai-switch-acts .btn { flex: 1; min-height: 40px; } }
.ai-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r-sm); background: var(--surface-3); color: var(--ink-2); }
.ai-sum { font-size: 13.5px; font-weight: 600; }
.ai-acts { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ai-ok { display: inline-flex; align-items: center; gap: 4px; color: var(--ok-text); font-size: 12.5px; font-weight: 600; }
.ai-err { grid-column: 2 / -1; color: var(--bad-text); font-size: 12.5px; }
.ai-filechip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600;
  background: var(--surface-3); color: var(--ink-2); align-self: flex-start; }
.ai-me .ai-filechip { align-self: flex-end; padding-right: 10px; }
.ai-box { border-top: 1px solid var(--line); padding: 12px; display: grid; gap: 8px; background: var(--surface); }
.ai-row { display: flex; align-items: flex-end; gap: 8px; }
.ai-row textarea { flex: 1; resize: none; min-height: 40px; max-height: 160px; }
.ai-row label.icon-btn { cursor: pointer; height: 40px; width: 40px; }
.ai-dots { display: inline-flex; gap: 4px; margin-right: 8px; }
.ai-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: aiDot 1s infinite ease-in-out; }
.ai-dots i:nth-child(2) { animation-delay: .15s; } .ai-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes aiDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .ai-dots i { animation: none; } }
@media (max-width: 640px) {
  .ai-wrap { height: calc(100dvh - 230px); }
  .ai-card { grid-template-columns: auto minmax(0, 1fr); }
  .ai-acts { grid-column: 1 / -1; justify-content: flex-end; }
}
.ai-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.ai-top label { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.ai-top .input { width: auto; max-width: 320px; min-height: 36px; padding-top: 5px; padding-bottom: 5px; }
.ai-top .hint { font-size: 12px; }
.ai-sum { display: flex; flex-direction: column; gap: 6px; }
.ai-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 99px; font-size: 11px; font-weight: 700; color: #9a7b45;
  background: color-mix(in srgb, #b8965a 16%, transparent); vertical-align: 1px; }
.ai-proj { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.ai-proj span { font-size: 12px; color: var(--ink-3); }
.ai-proj .input { width: auto; max-width: 300px; min-height: 32px; padding-top: 3px; padding-bottom: 3px; font-size: 13px; }
.pro-tag { font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #9a7b45; background: color-mix(in srgb, #b8965a 16%, transparent);
  border-radius: 99px; padding: 1px 6px; margin-left: 2px; }
.scan-wrap { display: inline-flex; }

/* ── the welcome's last step: choose a plan (D56) ── */
.w-plans { display: grid; gap: 10px; margin-bottom: 8px; }
.w-plan { display: grid; gap: 4px; text-align: left; width: 100%; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 14px;
  background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; }
.w-plan:hover { border-color: var(--ink-3); }
.w-plan[aria-checked="true"] { border-color: var(--ok); background: var(--ok-bg); box-shadow: 0 0 0 1px var(--ok) inset; }
.w-plan-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.w-plan-top strong { font-size: 15.5px; }
.w-tag { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #9a7b45;
  background: color-mix(in srgb, #b8965a 18%, transparent); border-radius: 99px; padding: 2px 8px; }
.w-plan-price { font-size: 20px; font-weight: 750; letter-spacing: -.02em; }
.w-plan-note { font-size: 12.5px; color: var(--ink-3); }
.w-plan-pts { display: grid; gap: 4px; margin-top: 6px; font-size: 13px; color: var(--ink-2); }
.w-plan-pts span { display: flex; gap: 6px; align-items: flex-start; }
.w-plan-pts .i { color: var(--ok-text); flex: none; margin-top: 2px; }
/* the trial tag also on phones: short */
.topbar .plan-tag { font-size: 11.5px; padding: 3px 8px; }
@media (max-width: 420px) { .topbar .plan-tag { max-width: 150px; overflow: hidden; text-overflow: ellipsis; } }
.trial-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 18px; padding: 12px 14px; border-radius: var(--r-ctl);
  border: 1px solid color-mix(in srgb, #b8965a 45%, var(--line)); background: color-mix(in srgb, #b8965a 10%, var(--surface)); font-size: 13.5px; }
.trial-banner > .i { color: #b8965a; flex: none; }
.trial-banner > span { flex: 1; min-width: 220px; }

/* Phones and tablets (D56): text boxes at 16px, or iOS zooms the page in on every tap — the page then sits
   off to one side and has to be scrolled back. Desktop keeps its smaller fields. */
@media (hover: none) and (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not(.big), select:not(.big), textarea, .input:not(.big) { font-size: 16px !important; }
}
/* Welcome on a phone (D56): just a slim header strip, so the question is the first thing on screen */
@media (max-width: 820px) {
  .auth-art { padding: 14px 18px; }
  .auth-art > div, .auth-art .lights, .auth-art > p { display: none; }
  .auth-form { padding-top: 18px; }
}
/* The visible screen, not the area behind the browser's bars — and, with the keyboard up, only what's above it (D92: this
   rule came after the keyboard one and won, so a long form stayed full height and its top went off the screen). */
@media (max-width: 820px) { .sheet { max-height: min(92dvh, calc(var(--vvh, 100dvh) - 8px)); } }

/* ── AI Assistant, round two (D56): quick actions, Confirm all, New chat, drop a receipt, and phones ── */
.ai-quick { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.ai-quick::-webkit-scrollbar { display: none; }
.ai-quick .chip { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.ai-all { display: flex; justify-content: flex-end; }
.ai-top .ai-new { margin-left: auto; }
.ai-bot.err > p { color: var(--bad-text); }
.ai-wrap.drop { outline: 2px dashed #b8965a; outline-offset: -6px; }
.ai-wrap { height: calc(100dvh - 220px); }
@media (max-width: 820px) {
  .ai-head-pg { display: none; }                         /* the top bar already says where you are */
  .ai-wrap { height: calc(100dvh - 150px - env(safe-area-inset-bottom)); min-height: 360px; border-radius: 16px; margin: -6px -4px 0; }
  .ai-top { padding: 8px 12px; gap: 8px; }
  .ai-top .input { flex: 1; max-width: none; }
  .ai-top-hint { display: none; }
  .ai-log { padding: 14px 12px; gap: 12px; }
  .ai-box { padding: 8px 10px; }
  .ai-row .btn.primary { padding-left: 14px; padding-right: 14px; }
  .ai-card { padding: 10px; gap: 8px; }
  .ai-proj { flex-wrap: wrap; } .ai-proj .input { max-width: 100%; width: 100%; }
  .ai-acts { gap: 8px; } .ai-acts .btn { flex: 1; justify-content: center; }
  .ai-me, .ai-bot { max-width: 100%; }
  /* Phones: Ben's chat works like a chat app. It fills the visible screen under the top bar, the bottom bar steps aside,
     the messages scroll, and the typing box sits at the bottom — on top of the keyboard when it's open. The page
     itself never moves: everything follows the part of the screen the keyboard leaves (--vvh, --vvtop). */
  html.ai-page, html.ai-page body { overflow: hidden; overscroll-behavior: none; height: 100%; }
  html.ai-page .tabbar { display: none; }
  html.ai-page .topbar { position: fixed; left: 0; right: 0; top: var(--vvtop, 0px); }
  html.ai-page .ai-wrap { position: fixed; left: 0; right: 0; margin: 0; min-height: 0; z-index: 15; border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0;
    top: calc(var(--vvtop, 0px) + var(--tbh, 62px));
    height: calc(var(--vvh, 100dvh) - var(--tbh, 62px)); }
  html.ai-page .ai-top { padding: 6px 12px; }
  html.ai-page .ai-top label { display: none; }
  html.ai-page .ai-top .input { height: 36px; font-size: 16px; padding-top: 4px; padding-bottom: 4px; }
  html.ai-page .ai-box { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  html.ai-page.kb-open .ai-box { padding-bottom: 8px; }
  html.ai-page.kb-open .ai-quick { display: none; }       /* while typing, the space goes to the messages */
  html.ai-page .ai-hello .ai-ex { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  html.ai-page .ai-hello .ai-ex .chip { flex: none; }
  html.ai-page .ai-row textarea { font-size: 16px; }      /* 16px or more: iPhones don't zoom the page when you tap it */
}
/* the new-project form: the rest folds under "More details" (D56) */
.more-details { margin: 0 0 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.more-details > summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--ink-2); list-style: none; margin-bottom: 4px; }
.more-details > summary::-webkit-details-marker { display: none; }
.more-details > summary::before { content: "+ "; color: var(--ink-3); }
.more-details[open] > summary::before { content: "− "; }
.more-details[open] > summary { margin-bottom: 12px; }
.empty .acts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* Email an invoice (D59) */
.em-file { display: flex; align-items: center; gap: 6px; margin: -4px 0 14px; }
.em-go { width: 100%; justify-content: center; }
.em-how { margin: 8px 0 0; font-size: 12px; line-height: 1.5; text-align: center; }
.em-foot { flex-wrap: wrap; align-items: center; gap: 8px; }
.em-dl { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); cursor: pointer; }
.em-dl input { width: 14px; height: 14px; margin: 0; accent-color: var(--ink); }

/* Phones: a document's buttons get their own row and share it, the ⋯ stays at the end, nothing pokes past the edge */
@media (max-width: 640px) {
  .doc-acts { width: 100%; margin-left: 0; flex-wrap: nowrap; }
  .doc-acts > .btn { flex: 1 1 0; min-width: 0; justify-content: center; padding-left: 8px; padding-right: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .doc-acts > .icon-btn { flex: none; }
}
.sheet { overflow-x: hidden; }
.l-short { display: none; }
@media (max-width: 640px) { .l-full { display: none; } .l-short { display: inline; } }

/* ── Date fields on iPhones (2026-10) ──
   iPhone Safari draws a date box with its own minimum width and centred text, so it can poke out of a
   form even when every other field fits (desktop browsers, and their phone preview, don't do this).
   Made an ordinary field: as wide as its column and no wider, its date on the left like the others. */
input[type="date"], input[type="time"], input[type="month"] { -webkit-appearance: none; appearance: none;
  display: block; width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; text-align: left; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
input[type="date"]::-webkit-calendar-picker-indicator { margin-left: auto; }
.field, .grid2 > *, .doc-fields > * { min-width: 0; }

/* The page itself never slides sideways under a finger on a phone. */
@media (max-width: 820px) { html { overflow-x: hidden; } }   /* on html only: it passes to the window, so pinned bars still pin */
.h2-act { display: flex; align-items: center; justify-content: space-between; gap: 10px; }   /* a heading with its own small + on the right */
/* Settings → your account: who you are on one line, the two buttons on the next (they never sit on your name) */
.acct-card { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.set-who { display: flex; align-items: center; gap: 12px; flex: 1 1 220px; min-width: 0; }
.set-who .avatar { flex: none; }
.acct-mail { overflow-wrap: anywhere; }
.acct-acts { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 820px) {
  .acct-acts { width: 100%; } .acct-acts .btn { flex: 1; justify-content: center; }
  .hide-phone { display: none !important; }        /* keyboard shortcuts mean nothing on a phone */
}
/* Phones: the Settings tabs stay under the top bar while you scroll, and slide sideways in their own row only */
@media (max-width: 820px) {
  .set-tabs { position: sticky; top: var(--tbh, 61px); z-index: 12; background: var(--bg); margin-left: -14px; margin-right: -14px;
    padding: 0 14px; overscroll-behavior-x: contain; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; }
  .set-tabs button { flex: none; }
}
/* Save: a small amber dot while there are unsaved changes (invoices and bills) */
.save-btn { position: relative; }
.save-btn.is-dirty::after { content: ""; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--warn); box-shadow: 0 0 0 2px var(--surface); }
/* Phones: Save is a big button at the bottom of the screen, where the thumb is (the form scrolls above it) */
@media (max-width: 820px) {
  .pv .save-btn { position: fixed; left: 14px; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 40; min-height: 52px;
    justify-content: center; font-size: 16px; border-radius: 14px; background: var(--btn); color: var(--btn-ink); border-color: transparent;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
  .pv .save-btn .sv { flex-direction: row; align-items: baseline; gap: 8px; }
  .pv .save-btn .sv-s { color: inherit; opacity: .7; font-size: 11px; }
  .pv .save-btn.is-dirty::after { top: 8px; right: 12px; width: 10px; height: 10px; box-shadow: none; }
  .pv:has(.save-btn) .pv-body { padding-bottom: 96px; }
  html:has(.pv .save-btn) .tabbar { display: none; }        /* the Save button takes the bottom of the screen */
  /* While typing it sits just above the keyboard (the visible area's bottom), smaller, so it's never out of reach */
  html.kb-open .pv .save-btn { top: calc(var(--vvtop, 0px) + var(--vvh, 100vh) - 54px); bottom: auto; min-height: 44px; box-shadow: 0 4px 14px rgba(0, 0, 0, .3); }
}
/* A paused project (D64): its Add button looks unavailable; tapping it says why and offers to reopen */
.btn.is-off { opacity: .45; }
.paused-note { margin: 0 0 14px; }
.paused-note .linkish { font-weight: 600; }
/* A form (or Ben's sheet on a phone) is open: the page behind stays put — the body pinned at its scroll position by
   lockScroll; a swipe inside the form scrolls only the form. A project window under it isn't touched: changing its
   overflow made an iPhone move it. */
html.scroll-locked body { position: fixed; left: 0; right: 0; overflow: hidden; }
.sheet { overscroll-behavior: contain; }
.scrim { overscroll-behavior: contain; }
/* All of it on paper (D65): income fully invoiced — a faint green card; a cost all on bills — a faint purple one */
.ecard.is-invoiced { background: color-mix(in srgb, var(--ok) 4%, var(--surface-2)); border-color: color-mix(in srgb, var(--ok) 20%, var(--line)); }
.ecard.is-invoiced:hover { background: color-mix(in srgb, var(--ok) 7%, var(--surface-2)); }
.ecard.is-billed { background: color-mix(in srgb, #8b5cf6 4%, var(--surface-2)); border-color: color-mix(in srgb, #8b5cf6 20%, var(--line)); }
.ecard.is-billed:hover { background: color-mix(in srgb, #8b5cf6 7%, var(--surface-2)); }
.ai-proj .input.need { border-color: var(--warn); }

/* ── Ben's panel (D67): beside every page — docked on a wide screen, over the side of a medium one, a sheet on a phone ── */
:root { --bendw: 400px; }
.ben-dock { position: fixed; z-index: 38; display: flex; flex-direction: column; background: var(--bg); }
.ben-dock[hidden] { display: none; }
.ben-dock .ai-wrap { flex: 1; display: flex; flex-direction: column; max-width: none; width: 100%; height: auto; min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
.ben-dock .ai-top { padding: 8px 14px; gap: 8px; flex-wrap: nowrap; }
.ben-dock .ai-top .input { flex: 1; max-width: none; min-width: 0; }
.ben-dock .ai-log { padding: 14px; gap: 12px; }
.ben-dock .ai-box { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
.ben-dock .ai-me, .ben-dock .ai-bot { max-width: 100%; }
.ben-dock .ai-hello .ai-ex { display: flex; flex-wrap: wrap; gap: 6px; }
.bd-head { display: flex; align-items: center; gap: 8px; padding: 0 8px 0 14px; height: 50px; flex: none; position: relative;
  border-bottom: 1px solid var(--line); background: var(--surface); }
.bd-title { display: inline-flex; align-items: center; gap: 7px; font-weight: 650; font-size: 14.5px; }
.bd-title svg { color: #b8965a; }
.bd-left { font-size: 11.5px; }
.bd-sp { flex: 1; }
.bd-grab { display: none; }
@keyframes ben-in-r { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ben-in-up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }

/* Wide: a column on the right; the app and its windows make room for it */
@media (min-width: 1100px) {
  .ben-dock { top: 0; right: 0; bottom: 0; width: var(--bendw); border-left: 1px solid var(--line); animation: ben-in-r .22s var(--ease); }
  html.ben-open:not(.ben-full) .app { padding-right: var(--bendw); }
  html.ben-open:not(.ben-full) .pv-scrim { right: var(--bendw); }
  html.ben-open:not(.ben-full) .toast { margin-left: calc(var(--bendw) / -2); }
}
/* Medium: over the right side */
@media (min-width: 821px) and (max-width: 1099px) {
  .ben-dock { top: 12px; right: 12px; bottom: 12px; width: min(var(--bendw), calc(100vw - 120px)); border: 1px solid var(--line-2);
    border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-pop); animation: ben-in-r .22s var(--ease); }
}
/* The big window (D84): over the whole page, which is blurred behind it, like a project's window; the small icon in his
   top bar docks him on the right instead. Not on a phone, which keeps its sheet. */
@media (min-width: 821px) {
  html.ben-full .ben-scrim { display: block; inset: 0 0 0 84px; background: color-mix(in srgb, var(--bg) 35%, rgba(17, 17, 16, .32));
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
  html.ben-full .ben-dock { top: 18px; bottom: 18px; left: 84px; right: 0; margin: auto; width: min(1180px, calc(100vw - 84px - 48px));
    max-height: 900px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-pop);
    animation: pv-in .26s var(--ease); }
  html.ben-full .ben-dock .ai-log { padding: 22px clamp(18px, 3vw, 40px); gap: 14px; }
  html.ben-full .ben-dock .ai-me, html.ben-full .ben-dock .ai-bot { max-width: min(760px, 100%); }
  html.ben-full .ben-dock .ai-box, html.ben-full .ben-dock .ai-top { padding-left: clamp(18px, 3vw, 40px); padding-right: clamp(18px, 3vw, 40px); }
}
@media (max-width: 820px) { .bd-mode { display: none; } }
/* Activity (D85): what Ben has done, one item per chat — a column in the big window, a list over the chat elsewhere */
.ben-dock.bd-wide { flex-direction: row; }
.bd-body { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.bd-acts { width: 272px; flex: none; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--surface); }
.bd-acts-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 50px; flex: none; padding: 0 10px 0 16px;
  border-bottom: 1px solid var(--line); font-weight: 650; font-size: 14.5px; }
.bd-acts-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 8px 16px; }
.bd-acts-day { padding: 14px 8px 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.bd-acts-empty { margin: 0; padding: 16px; line-height: 1.5; }
.bd-act { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer; }
.bd-act:hover { background: var(--surface-2); }
.bd-act.on { background: color-mix(in srgb, #b8965a 13%, var(--surface)); }
.ba-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-3); }
.ba-proj { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--ink-2); }
.ba-date { flex: none; }
.ba-title { font-size: 13.5px; font-weight: 600; }
.ba-ask { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--ink-3); }
.bd-over { position: absolute; inset: 0; z-index: 3; overflow-y: auto; overscroll-behavior: contain; background: var(--bg); }
.bd-over .bd-acts-list { overflow: visible; padding: 4px 8px 20px; }
.bd-detail { padding: 16px clamp(16px, 3vw, 40px) 28px; }
.bd-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.bd-d-title { margin: 0 0 4px; font-size: 17px; font-weight: 650; }
.bd-d-meta { margin: 0 0 12px; }
.bd-d-ask { margin: 0 0 16px; color: var(--ink-2); font-style: italic; }
.bd-d-lines { display: flex; flex-direction: column; gap: 8px; }
.bd-d-line { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.bd-d-line.undone { opacity: .6; }
.bd-d-sum { min-width: 0; font-size: 13.5px; line-height: 1.45; }
.bd-d-acts { display: flex; align-items: center; gap: 8px; }
.bd-d-foot { margin-top: 18px; }
.bd-actbtn.on { color: #b8965a; }
html.ben-full .bd-actbtn { display: none; }
@media (max-width: 560px) { .bd-d-line { grid-template-columns: auto 1fr; } .bd-d-acts { grid-column: 2; } }
/* Phone: a sheet from the bottom, the page dimmed but still there behind it; it follows the keyboard */
@media (max-width: 820px) {
  .ben-dock { left: 0; right: 0; top: calc(var(--vvtop, 0px) + 44px + env(safe-area-inset-top)); height: calc(var(--vvh, 100dvh) - 44px - env(safe-area-inset-top));
    border-radius: 18px 18px 0 0; border-top: 1px solid var(--line-2); overflow: hidden;
    animation: ben-in-up .26s var(--ease); overscroll-behavior: contain; }
  .ben-dock .ai-log, .ben-dock textarea { overscroll-behavior: contain; }
  .bd-head { height: 54px; padding-top: 8px; }
  .bd-grab { display: block; position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 99px; background: var(--line-2); }
  .ben-dock .ai-top label { display: none; }
  .ben-dock .ai-top .input, .ben-dock .ai-row textarea { font-size: 16px; }       /* no zoom when tapped on an iPhone */
  html.kb-open .ben-dock .ai-quick { display: none; }
  html.kb-open .ben-dock .ai-box { padding-bottom: 8px; }
  html.ben-open .tabbar { visibility: hidden; }
}

/* Minimized: a small "Ben" button, out of the way, that says when he's thinking or has answered */
.ben-pill-wrap { position: fixed; z-index: 39; right: 18px; bottom: 20px; display: flex; align-items: center; }
.ben-pill-wrap[hidden] { display: none; }
.ben-pill { display: inline-flex; align-items: center; gap: 9px; height: 46px; padding: 0 16px 0 6px; border-radius: 999px; cursor: pointer;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop); font: inherit; font-weight: 600; font-size: 14px;
  animation: fade .18s var(--ease); }
.ben-pill:hover { border-color: var(--ink-3); }
.bp-av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, #b8965a 22%, transparent); color: #b8965a; }
.ben-pill.busy .bp-av { animation: ai-mic-pulse 1.4s ease-in-out infinite; }
.ben-pill.new .bp-t::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 7px; border-radius: 50%; background: var(--ok); vertical-align: 1px; }
.ben-pill-x { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; padding: 0;
  background: var(--surface); color: var(--ink-3); border: 1px solid var(--line-2); cursor: pointer; opacity: 0; transition: opacity .15s; }
.ben-pill-x svg { width: 12px; height: 12px; }
.ben-pill-wrap:hover .ben-pill-x, .ben-pill-x:focus-visible { opacity: 1; }
@media (max-width: 820px) {
  .ben-pill-wrap { right: 14px; bottom: calc(84px + env(safe-area-inset-bottom)); }
  .ben-pill { height: 42px; font-size: 13.5px; padding-right: 14px; }
  .bp-av { width: 30px; height: 30px; }
  .ben-pill-x { opacity: 1; }
  html.kb-open .ben-pill-wrap { display: none; }
}
@media (prefers-reduced-motion: reduce) { .ben-dock, .ben-pill { animation: none; } .ben-pill.busy .bp-av { animation: none; } }

/* ── Feeling like an app (D67) ── */
html { -webkit-tap-highlight-color: transparent; }                   /* no grey flash where you tap */
a, button, .chip, select, label, .tabbar a { touch-action: manipulation; }   /* no double-tap zoom, no tap delay */
/* Installed on a home screen: no rubber-band bounce or pull-to-refresh, and the app's own chrome isn't selectable text */
@media (display-mode: standalone) {
  html, body { overscroll-behavior-y: none; }
  .rail, .tabbar, .topbar, .pv-head, .bd-head, .doc-bar, button, .chip, .ben-pill { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}
/* No connection: a slim bar at the top says so, and goes when it's back */
.net-bar { position: fixed; z-index: 85; left: 50%; top: calc(10px + env(safe-area-inset-top)); transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--bad-bg); color: var(--bad-text); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); box-shadow: var(--shadow-pop);
  white-space: nowrap; max-width: calc(100vw - 24px); }
.net-bar[hidden] { display: none; }
/* "Get the app": once, on a phone's home page, until it's installed or waved away */
.install-card { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.install-card .ic-app { flex: none; width: 42px; height: 42px; border-radius: 11px; background: #111110; display: grid; place-items: center; }
.install-card .ic-app img { width: 42px; height: 42px; border-radius: 11px; }
.install-card .t { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.4; color: var(--ink-2); }
.install-card .t b { display: block; color: var(--ink); font-size: 14px; }
.install-steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; line-height: 1.5; }

/* Ben asks you to pick (D68, D71): one field in his answer, opening the app's picker */
.ai-pickbox { width: min(340px, 100%); margin: 6px 0 2px; }
.ai-hint { display: block; font-size: 12px; margin-top: 2px; }

/* Behind Ben's sheet on a phone: a dimmed layer that takes every touch (D70) */
.ben-scrim { position: fixed; inset: 0; z-index: 37; background: rgba(0, 0, 0, .38); touch-action: none; animation: fade .2s var(--ease); }
.ben-scrim[hidden] { display: none; }
@media (min-width: 821px) { .ben-scrim { display: none; } }
/* A phone (D86): the page behind Ben is blurred and mostly hidden, so it never competes with him — and while the keyboard
   is up it's hidden entirely: the keyboard is see-through, and the page used to show between Ben and the keys. */
@media (max-width: 820px) {
  .ben-scrim { background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
  html.kb-open.ben-open .ben-scrim { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* ── Home (D70): how money moves — a live flow; every step opens its form or list ── */
.flow { --in: var(--ok); --out: #E07A4F; --wire: var(--ink-3); max-width: 760px; margin: 8px auto 40px; }
.fl-top, .fl-bottom { display: flex; justify-content: center; }
.fl-top .fl-node, .fl-bottom .fl-node { width: min(360px, 100%); }
.fl-lanes { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.fl-lane { display: flex; flex-direction: column; align-items: stretch; --c: var(--in); }
.fl-lane.out { --c: var(--out); }
.fl-lane-t { display: inline-flex; align-items: center; gap: 6px; align-self: center; margin: 0 0 10px; padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); }
.fl-node { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%;
  padding: 14px 14px 14px 12px; border-radius: 16px; cursor: pointer; text-align: left; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 0 rgba(0, 0, 0, .04);
  transition: transform .18s var(--ease), border-color .18s, box-shadow .18s;
  animation: fl-in .45s var(--ease) both; animation-delay: var(--d, 0ms); }
.fl-lane .fl-node { border-left: 3px solid var(--c); }
.fl-node:hover, .fl-node:focus-visible { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c, var(--ink-3)) 55%, var(--line));
  box-shadow: 0 10px 24px rgba(0, 0, 0, .12); outline: none; }
.fl-node:active { transform: translateY(0) scale(.99); }
.fl-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--c, var(--ink));
  background: color-mix(in srgb, var(--c, var(--ink)) 14%, transparent); }
.fl-top .fl-ic, .fl-bottom .fl-ic { --c: #b8965a; }
.fl-tx { display: grid; gap: 1px; min-width: 0; }
.fl-t { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.fl-s { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.fl-h { font-size: 12px; color: var(--ink-3); }
.fl-warn { color: var(--bad-text); font-weight: 650; }
.fl-go { color: var(--ink-3); transform: rotate(-90deg); transition: transform .18s var(--ease); }
.fl-node:hover .fl-go { transform: rotate(-90deg) translateY(3px); }
/* the wires: dashes that flow downwards, in the lane's colour */
.fl-arrow { position: relative; display: flex; justify-content: center; height: 30px; color: var(--c); }
.fl-arrow i { width: 2px; height: calc(100% - 6px); background: repeating-linear-gradient(to bottom, currentColor 0 5px, transparent 5px 10px);
  background-size: 2px 10px; animation: fl-flow .9s linear infinite; opacity: .8; }
.fl-arrow::after { content: ""; position: absolute; bottom: 2px; left: 50%; width: 8px; height: 8px; margin-left: -4px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); opacity: .9; }
.fl-back-wrap { height: 38px; }
.fl-back { position: absolute; top: 50%; left: calc(50% + 12px); transform: translateY(-50%); white-space: nowrap; font-size: 11px; font-weight: 600;
  color: var(--ink-3); padding: 2px 8px; border: 1px dashed var(--line-2); border-radius: 999px; }
.fl-back::before { content: "↺ "; }
.fl-split, .fl-join { position: relative; width: calc(50% + 14px); margin: 0 auto; height: 40px; color: var(--wire); }
.fl-split::before { content: ""; position: absolute; left: 50%; top: 0; height: 50%; border-left: 2px dashed currentColor; }
.fl-split::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; bottom: 6px; border: 2px dashed currentColor; border-bottom: 0; border-radius: 14px 14px 0 0; }
.fl-split i { position: absolute; bottom: 4px; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.fl-split i:first-child { left: -3px; color: var(--in); } .fl-split i:last-child { right: -3px; color: var(--out); }
.fl-join::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 50%; border: 2px dashed currentColor; border-top: 0; border-radius: 0 0 14px 14px; }
.fl-join::after { content: ""; position: absolute; left: 50%; top: 50%; bottom: 6px; border-left: 2px dashed currentColor; }
.fl-join i { position: absolute; bottom: 4px; left: 50%; width: 8px; height: 8px; margin-left: -3px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
@keyframes fl-flow { to { background-position: 0 10px; } }
@keyframes fl-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.fl-pick { display: grid; gap: 8px; }
.fl-pick-b { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--ink); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.fl-pick-b:hover { border-color: var(--ink-3); }
.fl-pick-b svg { margin-left: auto; transform: rotate(-90deg); color: var(--ink-3); }
@media (max-width: 820px) {
  .fl-lanes { gap: 12px; }
  .fl-split, .fl-join { width: calc(50% + 6px); }
  .fl-node { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px; border-radius: 14px; }
  .fl-ic { width: 32px; height: 32px; border-radius: 10px; }
  .fl-go { display: none; }
  .fl-s { font-size: 15.5px; }
  .fl-top .fl-node, .fl-bottom .fl-node { grid-template-columns: auto minmax(0, 1fr); }
  .fl-h { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }     /* both lanes' cards stay the same height */
  .fl-back { left: calc(50% + 10px); width: 22px; height: 22px; padding: 0; display: grid; place-items: center; font-size: 0; }   /* just ↺ beside the wire */
  .fl-back::before { content: "↺"; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { .fl-arrow i { animation: none; } .fl-node { animation: none; } }
/* A step the plan doesn't include (D70): greyed, with its lock — still tappable, to see what Standard adds */
.fl-node.is-locked { --c: var(--ink-3); filter: grayscale(1); opacity: .5; border-style: dashed; }
.fl-node.is-locked:hover, .fl-node.is-locked:focus-visible { opacity: .75; transform: none; box-shadow: none; }
.fl-lane .fl-node.is-locked { border-left-style: dashed; }

/* ── The picker (D71): projects, customers, vendors, incomes and costs, all chosen the same way ── */
.pick-native { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; opacity: 0; pointer-events: none; padding: 0 !important; border: 0 !important; }
.pick-btn { display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer; font: inherit; }
.pick-btn > svg { flex: none; margin-left: auto; color: var(--ink-3); }
.pick-btn:disabled { cursor: default; opacity: .6; }
.pick-btn.need { border-color: var(--warn); }
.pk-v { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.pk-v.ph { color: var(--ink-3); }
.pk-v .code, .pk-row .code { flex: none; font-size: 11px; font-weight: 700; letter-spacing: .02em; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.pk-layer { position: fixed; inset: 0; z-index: 100; }
.pk { position: fixed; display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: var(--shadow-pop); overflow: hidden; animation: pk-in .14s var(--ease); }
@keyframes pk-in { from { opacity: 0; transform: translateY(-4px); } }
.pk-search { position: relative; display: block; padding: 8px; border-bottom: 1px solid var(--line); }
.pk-search > svg { position: absolute; left: 19px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.pk-search .input { padding-left: 32px; min-height: 38px; }
.pk-list { overflow-y: auto; overscroll-behavior: contain; padding: 6px; display: grid; gap: 1px; align-content: start; }
.pk-h { margin: 8px 8px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.pk-row { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: none; color: var(--ink);
  font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.pk-row:hover, .pk-row.at { background: var(--surface-2); }
.pk-row:focus-visible { outline: 2px solid var(--time); outline-offset: -2px; }
.pk-row.on { font-weight: 600; }
.pk-row.off { opacity: .45; cursor: not-allowed; }
.pk-row.add { color: var(--time-text, var(--ink)); font-weight: 600; }
.pk-t { display: grid; min-width: 0; }
.pk-l, .pk-s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-s { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.pk-tick { margin-left: auto; color: var(--ok); display: flex; }
.pk-none { margin: 14px 10px; color: var(--ink-3); font-size: 13.5px; }
/* A phone: a sheet from the bottom, over everything (Ben too), with the page dimmed behind it */
.pk-layer.phone { background: var(--scrim); }
.pk-layer.phone .pk { left: 0; right: 0; bottom: 0; max-height: min(78dvh, calc(var(--vvh, 100dvh) - 40px)); border-radius: 18px 18px 0 0; border-bottom: 0;
  padding-bottom: env(safe-area-inset-bottom); animation: pk-up .2s var(--ease); }
@keyframes pk-up { from { transform: translateY(30%); opacity: .4; } }
.pk-top { display: flex; align-items: center; gap: 8px; padding: 14px 12px 6px 16px; position: relative; }
.pk-top b { font-size: 15px; }
.pk-top .icon-btn { margin-left: auto; }
.pk-grab { position: absolute; left: 50%; top: 6px; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--line-2); }
.pk-layer.phone .pk-row { padding: 12px 10px; font-size: 15px; }
.pk-layer.phone .pk-search .input { font-size: 16px; }                  /* 16px: iPhones don't zoom into it */
@media (prefers-reduced-motion: reduce) { .pk, .pk-layer.phone .pk { animation: none; } }

/* ── Quotes (D72): before the project ── */
.ip-q-draft    { background: var(--none-bg); color: var(--none-text); }
.ip-q-sent     { background: var(--time-soft); color: var(--time-text); }
.ip-q-expired  { background: var(--warn-bg); color: var(--warn-text); }
.ip-q-accepted { background: var(--ok-bg); color: var(--ok-text); }
.ip-q-declined { background: transparent; color: var(--ink-3); box-shadow: inset 0 0 0 1px var(--line-2); }
.q-row.s-declined { opacity: .65; }
.qm-t-g { color: var(--ok-text) !important; } .qm-t-a { color: var(--warn-text) !important; } .qm-t-r { color: var(--bad-text) !important; }
@media (max-width: 760px) {
  .q-row .dt[data-l="Until"] { grid-area: dt2; font-size: 12px; color: var(--ink-3); text-align: right; }
  .q-row.s-sent .dt[data-l="Until"]::before, .q-row.s-draft .dt[data-l="Until"]::before { content: "Until "; }
}

/* the margin meter: what you'd really make at this price, once your hours count */
.qm { padding: 16px 18px; margin: 0 0 14px; border-left: 4px solid var(--qc, var(--line-2)); }
.qm-g { --qc: var(--ok); } .qm-a { --qc: var(--warn); } .qm-r { --qc: var(--bad); }
.qm-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.qm-k { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.qm-light { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 650; color: var(--qc); }
.qm-light i { width: 10px; height: 10px; border-radius: 50%; background: var(--qc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--qc) 18%, transparent); }
.qm-big { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin: 6px 0 10px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.qm-big span { font-size: 14px; font-weight: 600; letter-spacing: 0; color: var(--ink-2); }
.qm-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--surface-3); margin: 0 0 12px; }
.qm-bar i { display: block; height: 100%; transition: width .3s var(--ease); }
.qm-bar .c { background: var(--chart-out, #E07A4F); } .qm-bar .t { background: var(--time); } .qm-bar .p { background: var(--ok); }
.qm-rows { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; font-size: 13.5px; color: var(--ink-2); }
.qm-rows b { text-align: right; color: var(--ink); font-weight: 650; }
.qm-tip { margin: 12px 0 0; padding: 9px 12px; border-radius: var(--r-ctl); background: color-mix(in srgb, var(--qc) 10%, transparent); font-size: 13.5px; }

/* quote lines: type · description · qty or hours · price · your cost · amount · tax · remove */
.ql-row { display: grid; grid-template-columns: 146px minmax(0, 1.4fr) 60px 108px 124px 100px 78px 30px; gap: 8px; align-items: center; }
.ql-row.head { font-size: 12px; color: var(--ink-3); font-weight: 600; margin-bottom: 6px; }
.ql-row .r { text-align: right; }
.ql-row .money-wrap .input { padding-left: 24px; }
.ql-row .money-wrap .cur { left: 11px; font-size: 14px; }
.ql-row .c-amt .il-amt { display: block; font-weight: 650; }
.q-time { font-size: 12.5px; white-space: nowrap; } .q-time b { color: var(--ink); font-weight: 650; }
.ql-row.ro { grid-template-columns: minmax(0, 1fr) 72px 104px 110px 100px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.ql-row.ro:last-child { border-bottom: 0; } .ql-row.ro.head { border-bottom: 0; padding: 0 2px; font-size: 12px; }
.qk { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 1px 6px; border-radius: 5px; margin-right: 4px;
  background: var(--surface-2); color: var(--ink-3); vertical-align: 1px; }
.qk-labour { background: var(--time-soft); color: var(--time-text); }
@container (max-width: 760px) {
  .ql-row.head:not(.ro) { display: none; }
  .ql-row:not(.ro) { position: relative; gap: 8px 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface-2);
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "kind kind kind" "desc desc desc" "qty price amt" "cost cost tx"; }
  .ql-row .c-kind { grid-area: kind; padding-right: 34px; } .ql-row .c-desc { grid-area: desc; } .ql-row .c-qty { grid-area: qty; }
  .ql-row .c-price { grid-area: price; } .ql-row .c-amt { grid-area: amt; display: flex; flex-direction: column; justify-content: flex-end; }
  .ql-row .c-amt .il-amt { min-height: 40px; display: flex; align-items: center; justify-content: flex-end; font-size: 15px; }
  .ql-row .c-cost { grid-area: cost; } .ql-row .c-tx { grid-area: tx; align-self: end; justify-self: end; padding-bottom: 10px; }
  .ql-row.ro { grid-template-columns: minmax(0, 1fr) auto; }
  .ql-row.ro > span:nth-child(2), .ql-row.ro > span:nth-child(3), .ql-row.ro > span:nth-child(5) { display: none; }
}
@container (max-width: 300px) {
  .ql-row:not(.ro) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "kind kind" "desc desc" "qty price" "amt amt" "cost tx"; }
}

/* won: what the project starts with */
.qa-rows { padding: 12px 14px; border-radius: var(--r-ctl); background: var(--surface-2); margin: 0 0 14px; }
.qa-inc { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; cursor: pointer; }
.qa-inc input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--time); flex: none; }

/* the project: quoted against actual */
.qv-row { display: grid; gap: 6px; margin: 0 0 12px; }
.qv-row .top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--ink-2); }
.qv-row .top b { color: var(--ink); }
.qv-warn { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--bad-text); font-weight: 600; }

/* Home: Quote comes before Project */
.fl-q { --c: #b8965a; }
.fl-yes::before { content: "✓ " !important; }

/* ── Item categories (D73): one list for costs and quotes ── */
.ic-wrap { display: block; }
.ic-card { max-width: 760px; }
.ic-row { display: grid; grid-template-columns: minmax(0, 1fr) 84px 84px 40px; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ic-row:last-child { border-bottom: 0; }
.ic-head { font-size: 12px; font-weight: 600; color: var(--ink-3); padding-top: 0; }
.ic-head span:nth-child(2), .ic-head span:nth-child(3) { text-align: center; }
.ic-name { display: grid; gap: 3px; min-width: 0; }
.ic-tag { font-size: 11.5px; padding-left: 2px; }
.ic-check { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.ic-check input { width: 18px; height: 18px; accent-color: var(--time); }
.ic-check input:disabled { opacity: .35; cursor: not-allowed; }
.ic-row:not(.ic-add) .ic-check span { display: none; }          /* the column says Cost or Quote */
.ic-add { margin-top: 8px; padding-top: 12px; border-top: 1px dashed var(--line-2); border-bottom: 0; grid-template-columns: minmax(0, 1fr) 84px 84px auto; }
@media (max-width: 560px) {
  .ic-row { grid-template-columns: minmax(0, 1fr) 52px 52px 36px; gap: 6px; }
  .ic-add { grid-template-columns: minmax(0, 1fr) auto auto; } .ic-add .btn { grid-column: 1 / -1; }
  .ic-add .ic-check span { display: inline; }
}
/* quoted vs actual, per category */
.qv-cats { display: grid; gap: 4px; margin: -4px 0 12px 12px; padding-left: 12px; border-left: 2px solid var(--line); }
.qv-cat { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--ink-2); }
.qv-cat b { color: var(--ink); font-weight: 650; }
.qv-cat.over b { color: var(--bad-text); }

/* D74: a Rate column — Hourly or Unit */
.ic-row { grid-template-columns: minmax(0, 1fr) 104px 64px 64px 40px; }
.ic-add { grid-template-columns: minmax(0, 1fr) 104px 64px 64px auto; }
.ic-head span:nth-child(3), .ic-head span:nth-child(4) { text-align: center; }
.ic-head span:nth-child(2) { text-align: left; }
.ic-rate { min-height: 36px; padding: 6px 10px; font-size: 13.5px; }
.is-hourly .ic-rate { color: var(--time-text); border-color: color-mix(in srgb, var(--time) 40%, var(--line-2)); }
@media (max-width: 560px) {   /* the name gets its own line; Rate, Cost and Quote sit under it */
  .ic-row { grid-template-columns: minmax(0, 1fr) 44px 44px 36px; gap: 6px 8px; padding: 10px 0; }
  .ic-row .ic-name { grid-column: 1 / -1; }
  .ic-head .ic-hname, .ic-head span:first-child { display: none; }
  .ic-add { grid-template-columns: minmax(0, 1fr) auto auto; } .ic-add .ic-check { justify-content: flex-start; } .ic-add .btn { grid-column: 1 / -1; }
}
.ic-rate:disabled, .ds-seg button:disabled { opacity: .5; cursor: not-allowed; }   /* Standard's, on Free (D76) */

/* ── Document style (D75): the page follows the workspace's colour, layout and logo size ── */
.inv-doc { --dc: #9a7b45; }
.inv-doc .d-title, .inv-doc .d-k { color: var(--dc); }
.inv-doc.d-logo-s .d-logo { max-width: 140px; max-height: 48px; }
.inv-doc.d-logo-l .d-logo { max-width: 300px; max-height: 120px; }
.inv-doc .d-foot { margin-top: 24px; text-align: center; font-size: 11.5px; color: #71717a; }
.inv-doc.d-bold .d-top { background: var(--dc); color: #fff; border-bottom: 0; padding: 22px 24px; margin: -6px -6px 6px; border-radius: 6px 6px 0 0; }
.inv-doc.d-bold .d-top .d-small, .inv-doc.d-bold .d-top .d-title, .inv-doc.d-bold .d-top dd, .inv-doc.d-bold .d-top .d-biz { color: #fff; }
.inv-doc.d-bold .d-top dt { color: rgba(255,255,255,.75); }
.inv-doc.d-bold .d-totals .d-total { border-top-color: var(--dc); }
.inv-doc.d-compact { font-size: 12.5px; line-height: 1.35; }
.inv-doc.d-compact .d-top { padding-bottom: 12px; } .inv-doc.d-compact .d-bill { padding: 12px 0; }
.inv-doc.d-compact .d-lines td, .inv-doc.d-compact .d-lines th { padding: 6px 8px; }
.inv-doc.d-compact .d-totals > div { padding: 3px 8px; } .inv-doc.d-compact .d-title { font-size: 22px; } .inv-doc.d-compact .d-biz { font-size: 17px; }
.inv-doc.d-compact .d-notes { margin-top: 16px; padding-top: 10px; }

/* the Settings tab: choices on the left, the page on the right */
.ds-wrap { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
.ds-preview { position: sticky; top: 16px; display: grid; gap: 10px; }
.ds-pv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ds-paper .inv-doc { max-width: 680px; }
.ds-swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ds-sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); background: var(--c); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; }
.ds-sw.on { box-shadow: 0 0 0 2px var(--ink); }
.ds-custom { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; margin-left: 4px; }
.ds-custom input { width: 30px; height: 30px; padding: 0; border: 0; background: none; cursor: pointer; }
.ds-layouts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ds-lay { display: grid; gap: 4px; padding: 10px; border: 1px solid var(--line-2); border-radius: var(--r-ctl); cursor: pointer; font-size: 13px; }
.ds-lay.on { border-color: var(--time); box-shadow: var(--ring); }
.ds-lay input { position: absolute; opacity: 0; pointer-events: none; }
.ds-lay .hint { font-size: 11.5px; line-height: 1.3; }
.ds-mini { display: grid; gap: 3px; padding: 6px; border-radius: 5px; background: #fff; height: 46px; }
.ds-mini i { display: block; border-radius: 2px; background: #e4e4e7; }
.ds-mini i:first-child { height: 10px; background: #a1a1aa; } .ds-mini-bold i:first-child { height: 14px; background: #9a7b45; }
.ds-mini-compact { gap: 2px; } .ds-mini-compact i { height: 5px; }
.ds-seg { display: inline-flex; }
.ds-checks { display: grid; gap: 8px; margin: 2px 0 4px; }
.ds-acts { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 1000px) { .ds-wrap { grid-template-columns: minmax(0, 1fr); } .ds-preview { position: static; } }

/* ── Tabs, solid (Ben): one track, the chosen tab a filled pill; nothing moves or changes size when you choose ── */
.ptabs { position: relative; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
  margin: 0 0 18px; scroll-padding-inline: 6px; }
.ptabs button, .ptabs a { border-radius: 8px; padding: 8px 14px; color: var(--ink-2); transition: background .15s, color .15s; }
.ptabs button:hover, .ptabs a:hover { background: transparent; color: var(--ink); }
.ptabs button[aria-selected="true"], .ptabs a[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.ptabs button[aria-selected="true"]::after, .ptabs a[aria-selected="true"]::after { display: none; }
.ptabs button[aria-selected="true"] .ct, .ptabs a[aria-selected="true"] .ct { background: color-mix(in srgb, var(--bg) 22%, transparent); color: var(--bg); }
.ptabs button:focus { outline: none; }
.ptabs button:focus-visible, .ptabs a:focus-visible { outline: 2px solid var(--time); outline-offset: 1px; }
.doc-tabs { margin: 0 0 12px; }
@media (max-width: 480px) {
  .ptabs { gap: 2px; padding: 3px; }
  .ptabs button, .ptabs a { padding: 8px 10px; font-size: 13px; }
}
/* Settings on a phone: the tabs sit in a solid bar that sticks right under the top bar — full width, no gap, nothing showing round it */
.set-tabs-bar { margin: 4px 0 18px; }
.set-tabs-bar .set-tabs { margin: 0; }
@media (max-width: 820px) {
  .set-tabs-bar { position: sticky; top: var(--tbh, 61px); z-index: 12; background: var(--bg); margin: 0 -14px 14px; padding: 8px 14px;
    border-bottom: 1px solid var(--line); }
  .set-tabs-bar .set-tabs { position: relative; top: auto; padding: 3px; overscroll-behavior-x: contain; touch-action: pan-x pan-y; }
}

/* ── a project's tasks (D79): scopes, and tasks under them, like Microsoft To Do ── */
.tk { display: grid; gap: 12px; }
.tk-head { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 12px 16px; }
.tk-prog { flex: 1 1 220px; display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--ink-2); min-width: 0; }
.tk-prog b { color: var(--ink); }
.tk-bar { flex: 1; max-width: 220px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.tk-bar i { display: block; height: 100%; background: var(--ok); border-radius: 3px; transition: width .3s; }
.tk-newscope { display: flex; gap: 8px; flex: 0 1 320px; }
.tk-newscope .input { min-height: 34px; padding: 6px 10px; font-size: 14px; }
.tk-scope { padding: 12px 14px 8px; }
.tk-sh { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.tk-sn { margin: 0; font-size: 15px; font-weight: 700; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tk-ct { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tk-list { display: grid; gap: 2px; min-height: 4px; }
.tk-row { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 0; border-radius: 10px; background: var(--surface); }
.tk-row:hover { background: var(--surface-2); }
.tk-grip { display: grid; place-items: center; width: 22px; height: 32px; color: var(--ink-3); cursor: grab; touch-action: none; opacity: .5; flex: none; }
.tk-row:hover .tk-grip { opacity: 1; }
.tk-check { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink-3); background: transparent; display: grid; place-items: center;
  padding: 0; cursor: pointer; color: transparent; transition: background .15s, border-color .15s; }
.tk-check .i { width: 13px; height: 13px; stroke-width: 3; }
.tk-check:hover { border-color: var(--ok); color: var(--ok); }
.tk-title { flex: 1; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 2px 10px; text-align: left; background: none; border: 0; padding: 6px 4px;
  font: inherit; font-size: 14.5px; color: var(--ink); cursor: pointer; }
.tk-t { overflow-wrap: anywhere; }
.tk-due { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); }
.tk-due.soon { color: var(--warn-text); } .tk-due.late { color: var(--bad-text); font-weight: 600; }
.tk-star { flex: none; width: 32px; height: 32px; display: grid; place-items: center; background: none; border: 0; border-radius: 8px; color: var(--ink-3); cursor: pointer; }
.tk-star:hover { color: #d4a72c; }
.tk-star[aria-pressed="true"] { color: #d4a72c; } .tk-star[aria-pressed="true"] .i { fill: currentColor; }
.tk-row.is-done .tk-check { background: var(--ok); border-color: var(--ok); color: #fff; }
.tk-row.is-done .tk-t { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--ink-3); }
.tk-row.is-done { padding-left: 28px; }
.tk-row.is-dragging { box-shadow: 0 10px 30px rgba(0,0,0,.25); background: var(--surface-2); opacity: .95; }
.tk-gap { border-radius: 10px; border: 2px dashed var(--line-2); background: var(--surface-2); }
.tk-add { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 28px; margin-top: 2px; border-radius: 10px; }
.tk-add:focus-within { background: var(--surface-2); }
.tk-plus { color: var(--ink-3); display: grid; place-items: center; width: 22px; }
.tk-in { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 14.5px; color: var(--ink); padding: 8px 4px; outline: none; }
.tk-in::placeholder { color: var(--ink-3); }
.tk-done { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 4px; }
.tk-done summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.tk-done summary::-webkit-details-marker { display: none; }
.tk-done summary .i { transition: transform .15s; } .tk-done[open] summary .i { transform: rotate(90deg); }
.tk-done summary .ct { color: var(--ink-3); font-weight: 500; }
.sc-move { display: flex; gap: 8px; margin: -4px 0 12px; }
@media (max-width: 560px) {
  .tk-newscope { flex: 1 1 100%; }
  .tk-grip { opacity: 1; }
}

/* the layout switch (D79): scopes stacked, or side by side as columns that scroll sideways */
.tk-scopes { display: grid; gap: 12px; }
.tk-view { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); margin-left: auto; flex: none; }
.tk-view button { width: 28px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 7px; background: none; color: var(--ink-3); cursor: pointer; padding: 0; }
.tk-view button:hover { color: var(--ink); }
.tk-view button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.tk-board .tk-scopes { grid-auto-flow: column; grid-auto-columns: minmax(270px, 320px); grid-template-columns: none; align-items: start;
  overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
.tk-board .tk-scope { scroll-snap-align: start; }
@media (max-width: 560px) { .tk-board .tk-scopes { grid-auto-columns: 82%; } }

/* ── sending from your own email (D80) ── */
.em-from { margin: 0 0 12px; }
.em-send { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.em-when { display: grid; grid-template-columns: auto minmax(0, 220px) auto; align-items: center; gap: 8px 10px; padding: 12px; margin-bottom: 8px;
  border-radius: var(--r-ctl); background: var(--surface-2); border: 1px solid var(--line); }
.em-when[hidden] { display: none; }
.em-when label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.em-when .hint { grid-column: 1 / -1; margin: 0; }
.em-alt { margin: 4px 0 10px; }
.em-alt summary { cursor: pointer; font-size: 13px; color: var(--ink-2); padding: 6px 0; }
.em-alt[open] summary { margin-bottom: 8px; }
.sends { display: grid; gap: 4px; margin: -2px 0 12px; }
.sends .note-line-hint { margin: 0; align-items: center; }
.sends .linkish { margin-left: auto; }
.note-line-hint.bad { background: var(--bad-bg); color: var(--bad-text); }
.mail-on { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-ctl); background: var(--ok-bg); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); }
.mail-ic { color: var(--ok-text); display: grid; place-items: center; }
.mail-who { flex: 1; min-width: 0; display: grid; gap: 2px; overflow-wrap: anywhere; }
.mail-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.mail-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.mail-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink-2); }
.mail-list li .i { flex: none; margin-top: 2px; color: var(--ink-3); }
.mail-list b { color: var(--ink); }
@media (max-width: 560px) { .em-when { grid-template-columns: minmax(0, 1fr); } }
/* a task's description, under its title (D81) */
.tk-note { flex-basis: 100%; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Ben's chat, like the chat apps people know (D86): a start screen with the box in the middle and suggestions under it,
   one rounded box (attach, project, mic and a send arrow inside), Stop while he thinks, Copy and Try again under answers ── */
.bd-body.start { justify-content: safe center; overflow-y: auto; overscroll-behavior: contain; }
.bd-body.start .ai-log { flex: none; overflow: visible; padding-bottom: 6px; }
.bd-body.start .ai-box { width: 100%; max-width: 720px; margin: 0 auto; }
.ai-start { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 8px 8px 4px; }
.ai-start-av { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; color: #b8965a;
  background: color-mix(in srgb, #b8965a 14%, var(--surface)); border: 1px solid color-mix(in srgb, #b8965a 30%, var(--line)); }
.ai-start h2 { margin: 6px 0 0; font-size: clamp(20px, 2.4vw, 26px); font-weight: 650; letter-spacing: -.01em; color: var(--ink); }
.ai-start p { margin: 0; max-width: 460px; font-size: 14px; line-height: 1.5; color: var(--ink-3); }
.ben-dock .ai-box { border-top: 0; background: var(--bg); padding: 6px 14px calc(10px + env(safe-area-inset-bottom)); display: grid; gap: 8px; }
html.ben-full .ben-dock .bd-body:not(.start) .ai-box > * { width: 100%; max-width: 760px; margin-left: auto; margin-right: auto; }
.ai-input { display: flex; flex-direction: column; gap: 4px; padding: 10px 8px 8px 16px; border: 1px solid var(--line-2); border-radius: 22px;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 18px -10px rgba(0, 0, 0, .18); transition: border-color .15s; }
.ai-input:focus-within { border-color: var(--ink-3); }
.ai-input textarea { width: 100%; min-height: 26px; max-height: 200px; padding: 4px 8px 4px 0; border: 0; outline: 0; resize: none;
  background: transparent; color: var(--ink); font: inherit; font-size: 15px; line-height: 1.5; box-shadow: none; scrollbar-width: none; }
.ai-input textarea::placeholder { color: var(--ink-3); }
.ai-tools { display: flex; align-items: center; gap: 4px; min-width: 0; }
.ai-tools .bd-sp { flex: 1; }
.ai-tool { cursor: pointer; }
.ai-proj-chip { min-width: 0; }
.ai-proj-chip .pick-btn { width: auto; max-width: min(280px, 46vw); height: 32px; min-height: 32px; padding: 0 10px 0 12px; gap: 6px;
  border-radius: 999px; background: var(--surface-2); font-size: 13px; }
.ai-proj-chip .pick-btn > svg { margin-left: 2px; }
.ai-send { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--btn); color: var(--btn-ink); transition: opacity .15s, transform .1s; }
.ai-send:active { transform: scale(.94); }
.ai-send.off { opacity: .3; }
.ai-send svg { width: 17px; height: 17px; }
.ai-sugs { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-top: 6px; }
.ai-sug { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 1px; align-items: center; padding: 11px 14px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface); color: inherit; font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.ai-sug:hover { border-color: var(--ink-3); background: var(--surface-2); }
.ai-sug-ic { grid-row: span 2; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--ink-2); background: var(--surface-2); }
.ai-sug-t { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.ai-sug-s { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--ink-3); }
.ai-fine { margin: 0; text-align: center; font-size: 11.5px; color: var(--ink-3); }
.ai-msg-tools { align-self: flex-start; display: flex; gap: 2px; margin-top: -8px; }
.ai-msg-tools .icon-btn { color: var(--ink-3); border-color: transparent; background: none; }
.ai-msg-tools .icon-btn:hover { color: var(--ink); background: var(--surface-2); }
.ai-think { display: inline-flex; align-items: center; }
.ai-bot.note > p { color: var(--ink-3); font-style: italic; }
html.ben-full .ben-dock .ai-log { align-items: stretch; }
html.ben-full .ben-dock .ai-log > * { width: 100%; max-width: 760px; margin-left: auto; margin-right: auto; }
html.ben-full .ben-dock .ai-log > .ai-me { width: auto; margin-right: max(0px, calc((100% - 760px) / 2)); }
@media (max-width: 820px) {
  .ai-sugs { grid-template-columns: 1fr 1fr; gap: 8px; }
  .ai-sug { padding: 10px 12px; grid-template-columns: 1fr; }
  .ai-sug-ic { grid-row: auto; width: 26px; height: 26px; margin-bottom: 4px; }
  .ai-sug-s { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .ai-input textarea { font-size: 16px; }                       /* no zoom when tapped on an iPhone */
  html.kb-open .ai-fine { display: none; }
  /* Phones first (D86): fingers, not a mouse — every button in the box and under answers is a comfortable tap */
  .ai-tools { gap: 6px; }
  .ai-tools .icon-btn, .ai-msg-tools .icon-btn { width: 40px; height: 40px; }
  .ai-send { width: 40px; height: 40px; }
  .ai-proj-chip .pick-btn { height: 38px; min-height: 38px; font-size: 14px; max-width: calc(100vw - 190px); }
  .ai-input { padding: 10px 8px 8px 14px; border-radius: 24px; }
  .ai-msg-tools { margin-top: -6px; }
  .bd-head .icon-btn { width: 40px; height: 40px; }
  .ai-sug { min-height: 96px; align-content: start; }
  /* Typing on the start screen: the greeting shrinks to its line, so the box stays in view above the keyboard */
  html.kb-open .bd-body.start { justify-content: flex-end; }      /* like any chat: the box right above the keyboard */
  html.kb-open .bd-body.start .ai-start { padding-bottom: 10px; }
  html.kb-open .ai-start-av, html.kb-open .ai-start p, html.kb-open .ai-sugs { display: none; }
  html.kb-open .ai-start h2 { font-size: 18px; margin-top: 0; }
  .bd-d-acts .btn, .bd-d-acts .linkish { min-height: 36px; display: inline-flex; align-items: center; }
  .bd-act { padding: 11px 12px; }
}

/* While anything is on top on a phone, the page never bounces or drifts behind it (D87) */
@media (max-width: 820px) { html.pv-open, html.ben-open, html.scroll-locked { overscroll-behavior: none; } html.pv-open body, html.scroll-locked body { overscroll-behavior: none; } }

/* Ben writing (D88): his words appear as they come, with a soft caret; what he's doing shows until the first words */
.ai-live-md:empty { display: none; }
.ai-live-md > :last-child::after { content: ""; display: inline-block; width: 7px; height: 1.05em; margin-left: 3px; vertical-align: -2px;
  border-radius: 2px; background: var(--ink-3); animation: ai-caret 1s steps(1) infinite; }
@keyframes ai-caret { 50% { opacity: 0; } }
.ai-think[hidden] { display: none; }
.ai-step { transition: opacity .2s; }
@media (prefers-reduced-motion: reduce) { .ai-live-md > :last-child::after { animation: none; } }

