/* Words on the dashboard and the checkout page (5 Dec 2026; engine/src/lekh_web/billing.py). The rest of the dashboard
   is styled in app.css (.dash, .use, .rows, .row ...). Only the shared tokens are used here (--ink, --sheet, --paper,
   --line, --cobalt ...), so the page follows the site's theme. House rules: slight corners, flat colour, white only
   under text, vermilion only for AI (never for money or words). */

/* ---------- the words left, on the Overview */
.wd-sum { margin: 26px 0 0; padding: 20px 0 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); max-width: 720px; }
.wd-total { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; color: var(--ink-2); font-size: 17px; }
.wd-total b { font: 700 clamp(40px, 5vw, 56px)/1 var(--font-display); letter-spacing: -0.03em; color: var(--ink); }
.wd-split { margin: 8px 0 12px; color: var(--ink-2); font-size: 16px; }
.wd-bar { max-width: 420px; }
.wd-bar i, .wd-use .use-bar i { background: var(--cobalt, var(--monal)); }
.wd-note { margin: 10px 0 0; color: var(--ink-3); }
.wd-go { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; margin: 16px 0 0; }
.wd-link { font-size: 15px; }
.wd-empty { margin-top: 18px; }
.wd-bought { margin: 22px 0 0; }                  /* back from a checkout: above whichever view is open */

/* ---------- the Words view */
.wd-use { margin-top: 22px; }
.wd-sub { margin: 8px 0 0; color: var(--ink-3); }
.wd-lead { margin: 8px 0 0; color: var(--ink-2); max-width: 60ch; }
.packs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 18px 0 0; max-width: 860px; }
.pack { display: flex; flex-direction: column; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-sheet);
  padding: 20px 20px 18px; }
.pack-words { margin: 0; color: var(--ink-2); font-size: 16px; }
.pack-words b { display: block; font: 700 28px/1.1 var(--font-display); letter-spacing: -0.02em; color: var(--ink); }
.pack-price { margin: 14px 0 0; font: 700 34px/1 var(--font-display); letter-spacing: -0.02em; color: var(--ink); }
.pack-per { margin: 6px 0 18px; color: var(--ink-3); }
.pack .btn { margin-top: auto; justify-content: center; width: 100%; }
.wd-closed, .wd-by { margin: 12px 0 0; color: var(--ink-2); }
#packs-msg { margin: 12px 0 0; color: var(--error, var(--ink)); }
.wd-rates { max-width: 680px; margin-top: 12px; }
.wd-rates tbody th { font-weight: 400; }
.wd-fine { margin: 10px 0 0; color: var(--ink-3); max-width: 68ch; }

/* ---------- the usage list */
.ledger { border-top: 1px solid var(--line); margin-top: 12px; max-width: 860px; }
.lg-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(96px, auto); gap: 2px 24px; align-items: baseline;
  padding: 11px 0; border-bottom: 1px solid var(--line); }
.lg-row p { margin: 0; }
.lg-what span { display: block; }
.lg-what .lg-detail { color: var(--ink-3); font-size: 14px; margin-top: 2px; }
.lg-when { color: var(--ink-3); font-size: 14px; white-space: nowrap; }
.lg-amt { text-align: right; font-weight: 600; white-space: nowrap; }
.lg-amt.is-out { color: var(--ink-2); font-weight: 400; }

/* ---------- the checkout page */
.co { max-width: 640px; }
.co-card { margin: 24px 0 0; max-width: 460px; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-sheet);
  padding: 22px 24px 24px; }
.co-test { margin: 0 0 14px; color: var(--ink-3); }
.co-pack { margin: 0; color: var(--ink-2); }
.co-pack b { display: block; font: 700 32px/1.1 var(--font-display); letter-spacing: -0.02em; color: var(--ink); }
.co-price { margin: 10px 0 20px; font: 700 36px/1 var(--font-display); color: var(--ink); }
.co-go { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 0; }
.co-back { margin: 28px 0 0; }

@media (max-width: 760px) {
  .packs { grid-template-columns: minmax(0, 1fr); }
  .lg-row { grid-template-columns: minmax(0, 1fr) auto; }
  .lg-when { grid-column: 1; grid-row: 2; }
  .lg-amt { grid-column: 2; grid-row: 1; }
}

/* The queue (5 Dec 2026): a job's page (/job/<id>), the status page (/status) and the dashboard's Queue view */
.jb-card { margin: 20px 0 0; max-width: 720px; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-sheet);
  padding: 18px 20px; }
.jb-text { white-space: pre-wrap; font: 400 17px/1.6 var(--font-read); color: var(--ink); margin: 8px 0 0; }
.jb-acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.jb-back { margin: 22px 0 0; }
.qs-grid { display: grid; gap: 16px; margin: 22px 0 8px; }
.qs-card { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-sheet); padding: 14px 16px; overflow-x: auto; }
.qs-card h2 { font-size: 18px; margin: 0 0 8px; }
.qs-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.qs-table th, .qs-table td { text-align: left; padding: 6px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.qs-table .num { white-space: nowrap; }   /* words wrap so the table fits a phone; numbers stay whole */
@media (max-width: 520px) { .qs-table { font-size: 14px; } .qs-table th, .qs-table td { padding: 6px 5px; } .qs-card { padding: 12px 10px; } }
.qs-table thead th { border-top: 0; color: var(--ink-2); font-weight: 600; }
.qs-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.qs-why { margin: 32px 0 0; max-width: 40em; }
.qs-why p { margin: 10px 0; line-height: 1.55; }
.dq-list { list-style: none; padding: 0; margin: 10px 0 0; }
.dq-list li { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line); }
.dq-what { font-weight: 600; }
.dq-meta { color: var(--ink-2); font-size: 14px; }
.dq-tier { margin: 8px 0 0; }

/* ---------- the dashboard, redone 5 Dec 2026 (owner: "too wordy, too formal; simple and to the point, visually
   pleasing"). Scoped to .dash2 so the queue and checkout pages keep their look. A greeting, the words left on a cobalt
   card, three colour tiles for the tools, two short lists; pill tabs; cards instead of rules; rates as chips. */
.dash2 { --d2-r: 10px; }
.dash2 .dash-head { align-items: center; }
.dash2 .dash-head h1 { font-size: clamp(30px, 3.6vw, 42px); margin: 0; }
.dash2 .dash-who { display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border-radius: 999px; background: var(--sheet);
  border: 1px solid var(--line); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.dash2 .dash-who:empty { display: none; }
.dash2 .dash-tabs { gap: 6px; border-bottom: 0; margin-top: 20px; padding: 4px; background: var(--paper-2); border-radius: 999px; width: max-content; max-width: 100%; }
.dash2 .dash-tabs a { padding: 8px 16px; border: 0; margin: 0; border-radius: 999px; font-weight: 500; }
.dash2 .dash-tabs a[aria-current="page"] { background: var(--sheet); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(23, 24, 42, .08); }
.dash2 .dash-tabs a[hidden] { display: none; }
.dash2 .dash-view { padding-top: 24px; }
.dash2 .dash-note { border-radius: var(--d2-r); }
.d2-card { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--d2-r); padding: 20px 22px; }
.d2-label { margin: 0 0 6px; font: 600 13px/1.2 var(--font-text); letter-spacing: .02em; color: var(--ink-2); }
.d2-h { margin-top: 36px; }
.d2-chip { display: inline-flex; align-items: center; min-height: 32px; padding: 0 14px; border-radius: 999px; background: var(--brand-soft, #e7eafb);
  color: var(--ink); font-size: 14.5px; font-weight: 600; margin: 0 0 16px; }

/* home: balance card + tool tiles */
.d2-top { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; align-items: stretch; }
.d2-balance { background: var(--cobalt); border: 0; color: #fff; display: flex; flex-direction: column; margin: 0; max-width: none; padding: 24px 26px; }
.d2-balance .d2-label { color: rgba(255, 255, 255, .78); }
.d2-balance .wd-total { color: #fff; }
.d2-balance .wd-total b { color: #fff; font-size: clamp(46px, 5.6vw, 64px); }
.d2-balance .wd-bar { background: rgba(255, 255, 255, .25); max-width: none; margin: 14px 0 0; height: 6px; border-radius: 3px; }
.d2-balance .wd-bar i { background: #fff; }
.d2-balance .wd-split { color: rgba(255, 255, 255, .92); margin: 12px 0 0; font-size: 15.5px; }
.d2-balance .wd-note { color: rgba(255, 255, 255, .7); margin: 2px 0 0; font-size: 14px; }
.d2-balance .wd-go { margin-top: auto; padding-top: 18px; }
.d2-btn-light { background: #fff; color: var(--cobalt); border-color: #fff; font-weight: 700; }
.d2-btn-light:hover { background: #eef0fb; border-color: #eef0fb; color: var(--cobalt); }
.d2-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; }
.d2-act { display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; min-height: 168px; padding: 18px; border-radius: var(--d2-r);
  text-decoration: none; transition: transform 180ms var(--ease-out), background-color 180ms var(--ease); }
.d2-act .icon { width: 28px; height: 28px; margin-bottom: auto; }
.d2-act b { font: 700 20px/1.15 var(--font-display); letter-spacing: -0.02em; }
.d2-act span { font-size: 14px; line-height: 1.35; opacity: .82; }
.d2-act-ink { background: var(--ink); color: #fff; --ic-a: #ffc94a; }
.d2-act-cobalt { background: #dfe4fb; color: var(--ink); --ic-a: var(--cobalt); }
.d2-act-sand { background: #f6ecd0; color: var(--ink); --ic-a: #c9341c; }
.d2-act:hover { transform: translateY(-2px); }
.d2-act:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .d2-act, .d2-act:hover { transition: none; transform: none; } }

/* home: two short lists */
.d2-lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.d2-list { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--d2-r); padding: 16px 20px 6px; min-width: 0; }
.d2-list-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.d2-list-h .dash-h { margin: 0; font-size: 18px; }
.d2-list-h a { font-size: 14.5px; font-weight: 600; }
.d2-list .rows { border-top: 0; margin-top: 6px; }
.d2-list .row { grid-template-columns: minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.d2-list .row:last-child { border-bottom: 0; }
.d2-list .row-act { display: none; }
.d2-list .row-res { min-width: 0; }
.d2-list .row-meta { padding-left: 0; }
.dash2 .rows-empty { color: var(--ink-2); margin: 10px 0 14px; }

/* words view */
.d2-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 760px; margin-top: 0; }
.d2-stats .use-n b { font-size: 44px; }
.d2-stats .use-bar { margin-top: 12px; height: 6px; border-radius: 3px; }
.d2-stats .wd-sub { margin-top: 10px; color: var(--ink-3); font-size: 14px; }
.dash2 .packs { margin-top: 14px; }
.dash2 .pack { position: relative; border-radius: var(--d2-r); padding: 22px 22px 20px; transition: border-color 160ms var(--ease); }
.dash2 .pack:hover { border-color: var(--ink-3); }
.dash2 .pack.is-best { border: 2px solid var(--cobalt); padding: 21px 21px 19px; }
.pack-tag { position: absolute; top: -12px; left: 18px; padding: 3px 10px; border-radius: 999px; background: var(--cobalt); color: #fff;
  font: 700 12px/1.4 var(--font-text); letter-spacing: .02em; }
.d2-rates { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.d2-rates li { display: inline-flex; align-items: baseline; gap: 8px; padding: 10px 14px; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--d2-r); }
.d2-rates b { font-weight: 700; color: var(--cobalt); white-space: nowrap; }
.d2-rates span { color: var(--ink-2); font-size: 15px; }
.dash2 .wd-fine { margin-top: 12px; }
.dash2 .ledger { border-top: 0; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--d2-r); padding: 2px 18px; }
.dash2 .lg-row:last-child { border-bottom: 0; }
.dash2 .ledger .rows-empty { margin: 12px 0; }
.d2-kept { margin: 0 0 6px; color: var(--ink-3); }

/* invite */
.d2-invite { max-width: 760px; padding: 26px 26px 22px; }
.d2-invite-h { margin: 0 0 16px; font: 700 clamp(24px, 2.6vw, 30px)/1.15 var(--font-display); letter-spacing: -0.02em; color: var(--ink); }
.d2-steps { list-style: none; counter-reset: s; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 18px 0 0; padding: 0; border: 0; }
.d2-steps li { counter-increment: s; display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--paper); border: 0; border-radius: var(--d2-r); font-size: 15px; }
.d2-steps li::before { content: counter(s); flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--cobalt); color: #fff; font: 700 13px/1 var(--font-text); }
.dash2 .invite-count { margin: 16px 0 0; color: var(--ink-2); }

/* account */
.d2-acc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 900px; align-items: start; }
.d2-acc .acc-facts { margin: 16px 0 0; }
.d2-acc .acc-actions { margin-top: 16px; }
.d2-danger { max-width: 900px; margin: 22px 0 0; border: 1px solid var(--line); border-radius: var(--d2-r); padding: 0 20px; background: var(--sheet); }
.d2-danger summary { cursor: pointer; padding: 14px 0; font-weight: 600; color: var(--ink-2); list-style-position: inside; }
.d2-danger[open] { padding-bottom: 18px; }
.d2-danger .acc-actions { margin-top: 12px; }

@media (max-width: 900px) {
  .d2-top { grid-template-columns: minmax(0, 1fr); }
  .d2-lists, .d2-acc { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .d2-actions { grid-template-columns: minmax(0, 1fr); }
  .d2-act { min-height: 0; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 2px 12px; padding: 16px; }
  .d2-act .icon { margin: 0; }
  .d2-act span { flex-basis: 100%; padding-left: 40px; }
  .d2-stats, .d2-steps { grid-template-columns: minmax(0, 1fr); }
  .dash2 .dash-tabs { width: 100%; }
}
.wrap.page.dash2 > * { max-width: none; }          /* the full width of the site, like the other pages (owner, 5 Dec 2026) */
.dash2 .d2-stats, .dash2 .d2-invite, .dash2 .d2-acc, .dash2 .d2-danger { max-width: none; }
.dash2 .packs { max-width: none; }
@media (max-width: 560px) { .d2-act { justify-content: flex-start; } }
.dash2 .d2-list .rows-empty { border: 0; padding-bottom: 4px; }
.dash2 .acc-row { margin-top: 0; }

/* API keys (5 Dec 2026, /agents): the Account view's card */
.d2-keys { margin-top: 16px; }
.d2-keys-h .dash-h { margin: 0; font-size: 18px; }
.d2-keys-h .small { margin: 4px 0 0; color: var(--ink-2); }
.d2-keys #key-form { margin-top: 14px; max-width: 560px; }
.d2-newkey { margin: 14px 0 0; padding: 14px 16px; background: var(--brand-soft, #e7eafb); border-radius: var(--d2-r); max-width: 760px; }
.d2-newkey p { margin: 0 0 10px; }
.d2-newkey .copyable { margin: 0; }
.d2-keylist { list-style: none; margin: 14px 0 0; padding: 0; }
.d2-key { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.d2-key-name { font-weight: 600; }
.d2-key-hint { font-size: 13.5px; color: var(--ink-2); background: var(--paper); padding: 2px 6px; border-radius: 4px; }
.d2-key-meta { color: var(--ink-3); font-size: 14px; flex: 1 1 220px; }
.d2-key-none { color: var(--ink-2); padding: 10px 0 0; }
