/* ==========================================================================
   Application shell — design tokens and the chrome every bill screen shares.

   Split out of upload.css when the Bills screens arrived, so the pages sharing
   it have one theme rather than several copies of one that drift apart.
   Anything here is used by more than one page; anything used by exactly one
   page lives in that page's own stylesheet.

   The consumer dashboard joined the three bill screens here rather than staying
   on style.css: a user moving from Bills to Dashboard was changing products.

   The login page and the admin dashboard still use style.css and are
   deliberately untouched by this.
   ========================================================================== */

:root {
  --bg: #F5F1E8;
  --bg-subtle: #EFEAD9;
  --bg-hover: #E8DFC9;
  --bg-card: #FBF8F1;
  --border: #E0D5BB;
  --border-strong: #C9B894;
  --text: #2D2418;
  --text-muted: #7A6A52;
  --text-subtle: #A89980;
  --accent: #B86E3C;
  --accent-hover: #A05E30;
  --accent-soft: #F2E4D2;
  /* One hue per status, so a column of pills can be told apart by colour alone
     and not only by reading it. Two statuses sharing a colour was the old
     arrangement — Queued and Waiting were both amber, Uploaded and Extraction
     completed both green, Reviewed the same green as the status beside it. */
  --waiting: #8A7F6A;
  --waiting-bg: #EDE7D8;
  --uploading: #6A5AA0;
  --uploading-bg: #E8E4F3;
  --upload-failed: #A33A55;
  --upload-failed-bg: #F6DEE4;
  --uploaded: #5E6E7D;
  --uploaded-bg: #E3E7EB;
  --pending: #B8862C;
  --pending-bg: #F5EBD0;
  --processing: #4A6FA5;
  --processing-bg: #E5EBF2;
  --completed: #5C8A4E;
  --completed-bg: #E4ECDD;
  --failed: #B85A3A;
  --failed-hover: #A14C2E;
  --failed-bg: #F5E1D8;
  --edited: #9C4A72;
  --edited-bg: #F4DFE9;
  --reviewed: #2F7D74;
  --reviewed-bg: #DAEAE6;
  --tally-planned: #5A5F9E;
  --tally-planned-bg: #E4E5F2;
  --tally-pushed: #2F6B3C;
  --shadow-sm: 0 1px 2px rgba(45, 36, 24, 0.05);
  --shadow-md: 0 2px 8px rgba(45, 36, 24, 0.08);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* minmax(0, 1fr), never a bare 1fr: a 1fr track grows to its widest content, so
   the bills table made the whole page 1,707px wide on a 1,440px laptop, its
   toolbar and filters cut off at the right (pre-launch QA, section C). A wide
   table scrolls inside its own .table-wrap instead, as below 860px (B3). */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  padding: 6px 10px 18px;
  display: flex; align-items: center; gap: 8px;
  font-family: var(--serif);
  font-weight: 500; font-size: 21.5px; letter-spacing: -0.01em;
  color: var(--text); text-decoration: none;
}
.brand-mark {
  width: 26px; height: 26px;
  background: var(--accent); color: white;
  border-radius: 6px;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 16px; font-weight: 500; font-style: italic;
}
.nav-section {
  font-size: 12.5px; text-transform: uppercase;
  color: var(--text-subtle); font-weight: 500;
  letter-spacing: 0.06em; padding: 12px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 6px;
  color: var(--text-muted); font-size: 15.5px; font-weight: 500;
  cursor: pointer; user-select: none; text-decoration: none;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active {
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.nav-item.active svg { color: var(--accent); }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--accent-soft); color: var(--accent-hover);
  font-size: 12.5px; font-weight: 600;
  padding: 1px 8px; border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.nav-badge:empty { display: none; }

/* The month's allowance. One colour at every level on purpose: running out is
   said in words, and a bar that changed hue would be a second way to say it. */
.usage-card {
  display: block;
  margin: 16px 2px 0;
  padding: 11px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text); text-decoration: none;
}
.usage-card[hidden] { display: none; }
.usage-card:hover { border-color: var(--accent); }
.usage-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.usage-plan { font-size: 13px; font-weight: 600; letter-spacing: 0.02em; }
.usage-left { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.usage-bar {
  height: 6px; margin: 8px 0;
  background: var(--bg-hover); border-radius: 999px; overflow: hidden;
}
.usage-fill {
  height: 100%; width: 0;
  background: var(--accent); border-radius: 999px;
  transition: width 0.3s ease;
}
.usage-foot {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: 12.5px; color: var(--text-subtle);
}
.usage-action { color: var(--accent-hover); font-weight: 500; }
.usage-card:hover .usage-action { text-decoration: underline; }
/* The bonus sits inside the same card, under a rule, in the same single colour. */
.usage-bonus { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.usage-bonus[hidden] { display: none; }

.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px;
  border: 1px solid transparent;
  color: var(--text); text-decoration: none;
}
/* It links to the profile page, and looks like a nav item when hovered or
   current so that is discoverable without a second "Profile" entry. */
.user-chip:hover { background: var(--bg-hover); }
.user-chip.active {
  background: var(--bg-card);
  border-color: var(--border); box-shadow: var(--shadow-sm);
}
.user-chip-go {
  margin-left: auto; flex-shrink: 0;
  color: var(--text-subtle); display: grid;
}
.user-chip-go svg { width: 15px; height: 15px; }
.user-chip:hover .user-chip-go, .user-chip.active .user-chip-go { color: var(--accent); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #B86E3C, #8B4F22);
  color: white; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 600; flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-name { font-size: 15px; font-weight: 500; }
.user-email {
  font-size: 12.5px; color: var(--text-subtle);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn-signout {
  width: 100%; margin-top: 6px;
  height: 34px; border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-muted);
  font-family: inherit; font-size: 14.5px; font-weight: 500;
  cursor: pointer;
}
.btn-signout:hover { background: var(--bg-hover); color: var(--text); }

/* Send feedback: quieter than Sign out, since it is an invitation and not an
   action anyone has to take. */
.btn-feedback {
  width: 100%; margin-bottom: 8px;
  height: 34px; border-radius: 6px; padding: 0 10px;
  border: 1px dashed var(--border-strong);
  background: transparent; color: var(--text-muted);
  font-family: inherit; font-size: 14.5px; font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer;
}
.btn-feedback:hover { background: var(--bg-card); color: var(--accent-hover); border-color: var(--accent); }
.btn-feedback svg { width: 15px; height: 15px; }

/* ---------- Main + page header ----------
   The cap is set by the widest thing these screens have to hold, which is the
   bills table's nine columns — at 1480px its Actions column fell off the right
   edge on a maximised window. Everything in .main is fluid, so the topbar
   buttons and the filter bar follow the table out to the same edge. */
.main { padding: 32px 40px 60px; max-width: 1720px; }

.topbar {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 24px; flex-wrap: wrap; gap: 16px;
}
.page-title {
  font-family: var(--serif);
  font-size: 36.5px; font-weight: 500;
  letter-spacing: -0.01em; line-height: 1.1;
}
.page-subtitle {
  font-size: 16px; color: var(--text-muted);
  margin-top: 8px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.page-subtitle b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.dot-sep { color: var(--text-subtle); }
.toolbar { display: flex; align-items: center; gap: 8px; }

/* ---------- Buttons ---------- */
.btn {
  height: 39px; padding: 0 16px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text);
  font-family: inherit; font-size: 15px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; }
.btn.is-busy svg { animation: spin 0.8s linear infinite; }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--failed); color: white; border-color: var(--failed); }
.btn-danger:hover:not(:disabled) { background: var(--failed-hover); border-color: var(--failed-hover); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 14.5px; }
.btn-sm svg { width: 12px; height: 12px; }

.icon-btn {
  width: 32px; height: 32px;
  border-radius: 5px; border: none;
  background: transparent; color: var(--text-subtle);
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.danger:hover { background: rgba(184, 90, 58, 0.12); color: var(--failed); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.icon-btn svg { width: 15px; height: 15px; }

.link-btn {
  font-size: 14.5px; font-weight: 500;
  color: var(--accent); text-decoration: none;
  background: none; border: none; cursor: pointer;
  font-family: inherit;
}
.link-btn:hover { text-decoration: underline; }

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-box {
  flex: 1; min-width: 240px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 11px; height: 39px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(184, 110, 60, 0.15);
}
.search-box svg { width: 15px; height: 15px; color: var(--text-subtle); flex-shrink: 0; }
.search-box input {
  border: none; background: transparent; outline: none;
  flex: 1; font-family: inherit; font-size: 15.5px; color: var(--text);
}
.search-box input::placeholder { color: var(--text-subtle); }

.filter-chip {
  height: 39px; padding: 0 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: inline-flex; align-items: center; gap: 6px;
}
.filter-chip:focus-within { border-color: var(--accent); }
.filter-chip .lbl { color: var(--text-muted); font-size: 15px; font-weight: 500; }
.filter-chip select {
  border: none; background: transparent; outline: none;
  font-family: inherit; font-size: 15px; font-weight: 500;
  color: var(--text); cursor: pointer;
}

/* ---------- Table base ---------- */
.table-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  overflow: hidden;
}
.table-wrap { overflow-x: auto; }
/* A table wider than its card fades out at the edge that has more behind it,
   so columns past the edge read as there to scroll to rather than as missing
   (pre-launch QA, section C). The classes are watchTableEdges()'s, in shell.js. */
.table-wrap.more-right {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
}
.table-wrap.more-left {
  -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 48px), transparent);
          mask-image: linear-gradient(to left, #000 calc(100% - 48px), transparent);
}
.table-wrap.more-left.more-right {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent);
          mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent);
}
.table-panel table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table-panel thead th {
  text-align: left; font-weight: 500;
  font-size: 13px; text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  white-space: nowrap;
}
.table-panel thead th.center { text-align: center; }
.table-panel thead th.right { text-align: right; }

.table-panel tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table-panel tbody td.right { text-align: right; font-variant-numeric: tabular-nums; }
.table-panel tbody td.center { text-align: center; }
.table-panel tbody tr:last-child td { border-bottom: none; }

/* ---------- Pager ----------
   Under a .table-panel's table. Shared by the bills list and the admin users
   and feedback lists, which page the same way. */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}
.pager[hidden] { display: none; }
.pager-info {
  font-size: 14.5px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.pager-controls { display: flex; align-items: center; gap: 2px; }
.pager-pages {
  display: inline-flex; align-items: center; gap: 2px;
  margin: 0 4px;
}
.page-btn {
  min-width: 32px; height: 32px;
  padding: 0 8px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit; font-size: 14.5px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.page-btn:hover { background: var(--bg-hover); color: var(--text); }
.page-btn.current {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.page-gap { color: var(--text-subtle); padding: 0 2px; user-select: none; }

.type-badge {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 4px;
  font-size: 12.5px; font-weight: 500;
  font-family: var(--mono);
  background: var(--bg-subtle); color: var(--text-muted);
}

/* ---------- Status pills ----------
   One class per extraction status, plus the client-side upload states that never
   reach the server, plus the user's two marks. Every screen that says what state
   a bill is in draws it from here, so the same bill reads the same on the upload
   list, the bills list and its own page. The dot/tick/bang is generated rather
   than drawn so a new status needs one rule here and nothing else.

   Every pill is one size. A mark is not a footnote to the status beside it — it
   is another fact about the same bill — so nothing in this block sets its own
   font-size and page stylesheets must not either. */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 11px; border-radius: 4px;
  font-size: 13.5px; font-weight: 500;
  line-height: 1.4; white-space: nowrap;
}
.status::before {
  content: ''; width: 5px; height: 5px;
  border-radius: 50%; background: currentColor;
}
.status.waiting        { color: var(--waiting); background: var(--waiting-bg); }
.status.uploading      { color: var(--uploading); background: var(--uploading-bg); }
.status.upload_failed  { color: var(--upload-failed); background: var(--upload-failed-bg); }
.status.not_requested  { color: var(--uploaded); background: var(--uploaded-bg); }
.status.pending        { color: var(--pending); background: var(--pending-bg); }
.status.processing     { color: var(--processing); background: var(--processing-bg); }
.status.completed      { color: var(--completed); background: var(--completed-bg); }
.status.failed         { color: var(--failed); background: var(--failed-bg); }
.status.mark-pill.edited   { color: var(--edited); background: var(--edited-bg); }
.status.mark-pill.reviewed { color: var(--reviewed); background: var(--reviewed-bg); }
/* A bill's progress into Tally, shown in place of "Extraction completed" once a
   plan exists. Planned points onward, since pushing is what is left; pushed is
   the one solid pill in the column, the last state a bill reaches. */
.status.tally-planned { color: var(--tally-planned); background: var(--tally-planned-bg); }
.status.tally-pushed  { color: #fff; background: var(--tally-pushed); }
.status.tally-planned::before {
  content: '→'; width: auto; height: auto;
  background: none; font-size: 12px; font-weight: 700;
}
.status.tally-pushed::before {
  content: '✓'; width: auto; height: auto;
  background: none; font-size: 11.5px; font-weight: 700;
}

.status.completed::before, .status.mark-pill.reviewed::before {
  content: '✓'; width: auto; height: auto;
  background: none; font-size: 11.5px; font-weight: 700;
}
/* The bill arrived; nothing has been asked of it yet. */
.status.not_requested::before {
  content: '↑'; width: auto; height: auto;
  background: none; font-size: 12px; font-weight: 700;
}
.status.mark-pill.edited::before {
  content: '✎'; width: auto; height: auto;
  background: none; font-size: 12px; font-weight: 700;
}
/* A filled disc, so the two failures are the loudest pills in the column. The
   background is named rather than taken from currentColor: this rule sets the
   pseudo-element's own colour, which is what currentColor would then resolve to. */
.status.failed::before, .status.upload_failed::before {
  content: '!'; font-size: 11.5px; font-weight: 700;
  width: 14px; height: 14px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.status.failed::before {
  background: var(--failed); color: var(--failed-bg);
}
.status.upload_failed::before {
  background: var(--upload-failed); color: var(--upload-failed-bg);
}
/* The three live states carry a spinner instead of a dot. */
.status.uploading::before, .status.processing::before, .status.pending::before {
  content: ''; width: 10px; height: 10px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%; background: none;
  animation: spin 0.8s linear infinite;
}

/* ---------- A row's status cell ----------
   Status first, then whichever of the user's marks are set, stacked rather than
   strung across: the status column is the narrowest one carrying words, and
   three pills across would either widen it at the expense of the figures or wrap
   raggedly. Shared by both list screens, which show the same pills for a bill. */
.status-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }

.spinner {
  width: 12px; height: 12px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Empty state ---------- */
.empty-state {
  padding: 46px 20px; text-align: center;
  color: var(--text-muted);
}
.empty-state .empty-title {
  font-family: var(--serif);
  font-size: 20.5px; font-weight: 500;
  color: var(--text); margin-bottom: 4px;
}
.empty-state .empty-sub { font-size: 15px; }

.footer-note {
  margin-top: 20px;
  padding: 12px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14.5px;
  color: var(--accent-hover);
  display: flex; align-items: center; gap: 8px;
}
.footer-note svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text); color: white;
  padding: 10px 18px; border-radius: 8px;
  font-size: 15px; font-weight: 500;
  box-shadow: var(--shadow-md);
  display: inline-flex; align-items: center; gap: 8px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 16px; height: 16px; color: var(--completed); flex-shrink: 0; }
.toast.error svg { color: var(--failed); }

/* ---------- Confirmation dialog ----------
   Sits above the toast, because a delete that fails puts a toast on screen
   while the dialog is still fading out. */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(45, 36, 24, 0.42);
  display: grid; place-items: center;
  padding: 20px;
  opacity: 0;
  /* Inert until shown and again while it fades out, so the frames on either
     side of a visible dialog do not swallow a click meant for the page. */
  pointer-events: none;
  transition: opacity 0.14s ease;
}
.modal-backdrop.show { opacity: 1; pointer-events: auto; }

.modal {
  width: 100%; max-width: 430px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(45, 36, 24, 0.24);
  padding: 20px;
  transform: translateY(8px) scale(0.985);
  transition: transform 0.14s ease;
}
.modal-backdrop.show .modal { transform: none; }

.modal-head { display: flex; align-items: flex-start; gap: 14px; }
.modal-icon {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--bg-subtle); color: var(--text-muted);
}
.modal-icon.danger { background: var(--failed-bg); color: var(--failed); }
.modal-icon svg { width: 18px; height: 18px; }
.modal-copy { min-width: 0; }
.modal-title {
  font-family: var(--serif);
  font-size: 20.5px; font-weight: 500;
  letter-spacing: -0.01em; line-height: 1.3;
}
/* The thing being deleted. Wraps rather than truncates — a name the user cannot
   read in full is a name they cannot check before agreeing. */
.modal-target {
  margin-top: 7px;
  font-size: 15.5px; font-weight: 600; color: var(--text);
  overflow-wrap: anywhere;
}
.modal-detail { margin-top: 6px; font-size: 15px; color: var(--text-muted); }

/* The box on a prompt dialog. Full width of the modal rather than indented to
   line up with the copy beside the icon: it is the dialog's subject, not a
   note attached to the title. */
.modal-input {
  width: 100%; height: 43px;
  margin-top: 16px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit; font-size: 16px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.modal-input::placeholder { color: var(--text-subtle); }
.modal-input:focus {
  outline: none; background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(184, 110, 60, 0.15);
}

/* ---------- Send feedback dialog ---------- */
.modal.modal-feedback { max-width: 520px; }
.modal-label {
  display: block; margin-top: 16px;
  font-size: 14.5px; font-weight: 500; color: var(--text-muted);
}
.modal-label + .modal-input { margin-top: 6px; }
.modal-label .optional { font-weight: 400; color: var(--text-subtle); }
select.modal-input { cursor: pointer; }
.modal-textarea {
  height: 120px; padding: 10px 14px;
  resize: vertical; line-height: 1.5;
}
.star-rating { display: flex; gap: 2px; margin-top: 4px; }
.star {
  width: 36px; height: 36px; border: 0; border-radius: 6px;
  background: transparent; cursor: pointer;
  font-size: 24px; line-height: 1; color: var(--border-strong);
}
.star:hover { background: var(--bg-hover); }
.star.on { color: #C98A1B; }
.star:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 20px;
}
.modal-actions .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Billing details (js/billing-details.js) ----------
   The fields a GST invoice needs, in the /pricing dialog and on /profile. The
   dialog is the feedback dialog's width, and scrolls inside itself on a short
   screen rather than pushing Save off it. */
.modal.modal-billing { max-width: 520px; max-height: calc(100vh - 40px); overflow-y: auto; }
.bd-lead { margin-top: 10px; font-size: 15px; color: var(--text-muted); }
.bd-field[hidden] { display: none; }
.bd-field .req { color: var(--failed); }
.bd-field .optional { font-weight: 400; color: var(--text-subtle); }
.bd-field .modal-label + .modal-input { margin-top: 6px; }
.bd-mono { font-family: var(--mono); font-size: 15px; text-transform: uppercase; }
.bd-mono::placeholder { text-transform: none; }
.bd-address { display: block; height: 88px; }
.bd-pin { max-width: 160px; }
.bd-hint { display: block; margin-top: 6px; font-size: 13.5px; color: var(--text-subtle); }
.bd-error { margin-top: 12px; font-size: 14.5px; color: var(--failed); }
.bd-error:empty { display: none; }

/* Held while a dialog is up, so the page behind it cannot be scrolled away. */
body.modal-open { overflow: hidden; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  /* minmax(0, 1fr) rather than 1fr: a bare 1fr track is never narrower than
     its widest content, so one wide table, or the footer row below, made every
     page wider than a phone and pushed Sign out off the screen (pre-launch QA
     finding B3). Wide content scrolls inside its own .table-wrap instead. */
  .app { grid-template-columns: minmax(0, 1fr); }
  .main { min-width: 0; }
  .sidebar {
    position: static; height: auto;
    flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 8px; padding: 12px 16px;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .brand { padding: 0 12px 0 0; }
  .nav-section { display: none; }
  /* Wraps rather than widening the bar, and the account chip gives up width
     first, its email ending in an ellipsis, so Sign out always stays on the
     screen. */
  .sidebar-footer {
    margin-top: 0; margin-left: auto;
    padding-top: 0; border-top: none;
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    min-width: 0; max-width: 100%;
  }
  .user-chip { flex: 1 1 auto; min-width: 0; }
  /* A page's buttons wrap onto a second row rather than off the screen. */
  .toolbar { flex-wrap: wrap; max-width: 100%; }
  .btn-signout { width: auto; margin-top: 0; padding: 0 14px; }
  .main { padding: 20px 16px 40px; }
  .page-title { font-size: 29.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .spinner, .btn.is-busy svg,
  .status.uploading::before, .status.processing::before, .status.pending::before { animation: none; }
  .toast { transition: none; }
  .modal-backdrop, .modal { transition: none; }
  .modal { transform: none; }
}

/* ---------- The privacy policy's notice ----------
   One line at the top of every signed-in page for 30 days after the policy
   changes (renderPrivacyNotice in shell.js). */
.site-notice {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; padding: 10px 12px 10px 16px;
  background: var(--accent-soft); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 13.5px; line-height: 1.45;
}
.site-notice > span { flex: 1; min-width: 0; }
.site-notice a { color: var(--accent); font-weight: 500; }
.site-notice a:hover { color: var(--accent-hover); }
.site-notice-close {
  flex: none; width: 28px; height: 28px;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--text-muted); font-size: 14px; cursor: pointer;
}
.site-notice-close:hover { background: var(--bg-hover); color: var(--text); }
/* The review screen's main is one screen tall with its own scrolling columns:
   the notice takes its line and the split the rest. */
.main.detail:has(> .site-notice) { display: flex; flex-direction: column; }
.main.detail > .site-notice { flex: none; margin: 12px 16px 0; }
.main.detail:has(> .site-notice) > .detail-split { flex: 1 1 auto; min-height: 0; height: auto; }
