/* Badger app — same brand system as the landing page.
   Phone-first: designed at 375px, fine on desktop. 44px touch targets,
   16px inputs (no iOS zoom-on-focus).
   Palette: Denim Blue #4A73A8 · Charcoal #1D1D1F · Off-White #F7F7F5 */
:root {
  --denim-900: #1f3350;
  --denim-800: #2c4668;
  --denim-700: #3a5c88;
  --denim-600: #4a73a8;
  --denim-400: #7d9fce;
  --denim-100: #dbe4f0;
  --denim-50:  #eef2f8;
  --charcoal:  #1d1d1f;
  --offwhite:  #f7f7f5;

  --surface: #ffffff;
  --ink: var(--charcoal);
  --ink-soft: #5a6472;
  --border: #dde2ea;
  --brand: var(--denim-600);
  --brand-strong: var(--denim-700);
}

* { box-sizing: border-box; }
body {
  margin: 0; padding-bottom: 76px;
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.55;
  color: var(--ink); background: var(--offwhite);
  -webkit-font-smoothing: antialiased;
}
main { max-width: 640px; margin: 0 auto; padding: 12px 14px; }

a { color: var(--brand-strong); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.topbar :focus-visible { outline-color: var(--offwhite); }

/* ── Top bar: denim gradient, same as the landing hero ── */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--denim-800), var(--denim-600));
  color: #fff;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; /* Poppins SemiBold — primary typeface */
  font-size: 19px; letter-spacing: 0.01em;
}
.brand-logo {
  width: 30px; height: auto; flex: none;
  background: var(--offwhite); border-radius: 8px; padding: 3px;
}
.topbar .link { color: #dfe7f2; }

h1 { font-size: 23px; font-weight: 700; line-height: 1.25; margin: 12px 0 8px; }
h2 { font-size: 17px; font-weight: 600; margin: 20px 0 8px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(18, 35, 61, 0.05);
}
.card .meta, .meta { color: var(--ink-soft); font-size: 14px; }
.money { font-weight: 700; }

/* ── Badger's morning brief ── */
.brief {
  background: var(--denim-50); border: 1px solid var(--denim-100);
  border-radius: 14px; padding: 14px 16px; margin-bottom: 14px;
}
.brief-head {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 14px; color: var(--denim-800);
  margin-bottom: 6px;
}
.brief-head img { width: 24px; height: auto; flex: none; }
.brief-body { white-space: pre-line; }

/* ── Buttons: denim pills, like the landing CTAs ── */
button, .btn {
  display: inline-block; min-height: 44px; padding: 10px 20px;
  border: 0; border-radius: 999px; font: inherit; font-size: 16px; font-weight: 600;
  background: var(--brand); color: #fff; cursor: pointer; text-decoration: none;
  transition: background 0.15s;
}
button:hover, .btn:hover { background: var(--brand-strong); }
button.secondary, .btn.secondary {
  background: var(--denim-50); color: var(--denim-800);
  box-shadow: inset 0 0 0 1px var(--denim-100);
}
button.secondary:hover, .btn.secondary:hover { background: var(--denim-100); }
button.danger { background: #b91c1c; }
button.danger:hover { background: #991b1b; }
button.link {
  background: none; color: inherit; font-weight: 400; padding: 4px;
  min-height: 0; text-decoration: underline; border-radius: 4px;
}
button.link:hover { background: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.sticky-action { position: sticky; bottom: 84px; text-align: center; margin-top: 12px; }
.sticky-action button { width: 100%; max-width: 640px; box-shadow: 0 6px 18px rgba(18, 35, 61, 0.25); }

input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; font-size: 16px;
  border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--denim-100);
}
form.stack label { display: block; margin: 10px 0 4px; font-weight: 600; font-size: 14px; }
form.inline { display: inline; }
form.inline input { width: auto; }
.row-form { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.row-form > div { flex: 1 1 120px; }

.flashes { max-width: 640px; margin: 8px auto 0; padding: 0 14px; }
.flash {
  background: var(--denim-50); border: 1px solid var(--denim-100); color: var(--denim-800);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; font-size: 15px; font-weight: 500;
}

/* ── Tab bar ── */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex;
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 10px; font-size: 11px; font-weight: 500;
  color: #77808c; text-decoration: none; min-height: 44px;
}
.tabbar svg { width: 22px; height: 22px; }
.tabbar .tab-badger { width: 22px; height: auto; opacity: 0.45; }
.tabbar a.active { color: var(--brand); font-weight: 600; }
.tabbar a.active .tab-badger { opacity: 1; }

/* ── Paid-vs-unpaid meter on customer cards ── */
.paybar { clear: both; margin-top: 8px; }
.paybar-track {
  height: 6px; border-radius: 999px; overflow: hidden;
  background: var(--denim-100);
}
.paybar-fill { height: 100%; border-radius: 999px; background: var(--brand); }
.paybar-label { margin-top: 3px; font-size: 13px; }

.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px;
  border-radius: 999px; background: var(--denim-50); color: var(--denim-800); }
.pill.warn { background: #fef3c7; color: #92400e; }
.pill.bad { background: #fee2e2; color: #991b1b; }
.pill.good { background: #dcfce7; color: #166534; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 3px solid var(--denim-100); padding: 6px 0 6px 12px; margin-left: 6px; }
.timeline .when { color: var(--ink-soft); font-size: 12px; }

details { margin-top: 8px; }
details summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }

/* ── Auth screens ── */
.auth-box { max-width: 400px; margin: 32px auto; }
.auth-box h1 { font-size: 20px; }
.auth-brand { text-align: center; margin: 4px 0 10px; }
.auth-brand img { width: 62px; height: auto; }
.auth-brand .tagline {
  margin: 2px 0 0; font-size: 14px; font-weight: 600; color: var(--brand-strong);
}

/* ── Ask Badger chat ── */
.chat-thread { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 16px; }
.bubble-you {
  align-self: flex-end; max-width: 85%;
  background: var(--brand); color: #fff;
  padding: 10px 14px; border-radius: 16px 16px 4px 16px;
}
.chat-row { display: flex; gap: 8px; align-items: flex-end; max-width: 90%; }
.chat-avatar { width: 28px; height: auto; flex: none; margin-bottom: 2px; }
.bubble-badger {
  background: var(--surface); border: 1px solid var(--border);
  padding: 10px 14px; border-radius: 16px 16px 16px 4px;
  white-space: pre-line; min-width: 0;
  box-shadow: 0 1px 3px rgba(18, 35, 61, 0.05);
}
.ask-bar { display: flex; gap: 8px; align-items: center; }
.ask-bar input { flex: 1; border-radius: 999px; padding: 10px 16px; }
.ask-bar button { flex: none; }
.ask-bar button:disabled { background: var(--denim-400); cursor: default; }

/* "Badger is thinking" indicator while the answer is being produced */
.bubble-badger.thinking { color: var(--ink-soft); }
.thinking-dots { display: inline-flex; gap: 4px; margin-left: 6px; }
.thinking-dots span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--denim-400);
  animation: thinking-bounce 1.2s infinite ease-in-out;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinking-bounce {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .thinking-dots span { animation: none; }
}

table { width: 100%; border-collapse: collapse; font-size: 15px; }
td, th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.empty { color: var(--ink-soft); text-align: center; padding: 30px 10px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ── Ops console (staff only) ──
   Desktop-first, unlike the rest of the app: ops work happens on a computer,
   so the console gets a fixed left nav and a wide content pane. */
.ops-body { padding-bottom: 0; display: flex; min-height: 100vh; align-items: stretch; }
.ops-sidebar {
  width: 232px; flex: none; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--denim-900), var(--denim-800));
  color: #dfe7f2; padding: 20px 14px 14px;
  position: sticky; top: 0; height: 100vh;
}
.ops-sidebar .brand { color: #fff; margin: 0 10px 22px; }
.ops-sidebar :focus-visible { outline-color: var(--offwhite); }
.ops-nav { display: flex; flex-direction: column; gap: 2px; }
.ops-nav a {
  display: block; color: #dfe7f2; text-decoration: none;
  padding: 9px 12px; border-radius: 8px; font-weight: 500; font-size: 15px;
}
.ops-nav a:hover { background: rgba(255, 255, 255, 0.08); }
.ops-nav a.active { background: rgba(255, 255, 255, 0.16); color: #fff; font-weight: 600; }
.ops-nav .subhead {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: #9fb3cf; margin: 18px 12px 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ops-sidebar .foot { margin-top: auto; padding: 10px 12px; font-size: 14px; }
.ops-sidebar .foot .who { margin: 0 0 4px; color: #b9c8dd; font-weight: 500; }
.ops-sidebar .foot .link { color: #dfe7f2; }
.ops-main { flex: 1; min-width: 0; max-width: 1280px; padding: 20px 36px 48px; }
.ops-flashes { max-width: none; margin: 0 0 8px; padding: 0; }
.ops-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 6px;
}
.ops-head h1 { margin-bottom: 4px; }
.ops-search { min-width: 420px; }
.ops-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.ops-grid .card { margin: 0; }
.ops-grid .span2 { grid-column: 1 / -1; }
.ops-grid h2 { margin-top: 4px; }
.ops-note { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 10px; }
.table-scroll { overflow-x: auto; }

/* the console still degrades gracefully on a small screen */
@media (max-width: 900px) {
  .ops-body { flex-direction: column; }
  .ops-sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px;
    padding: 10px 14px;
  }
  .ops-sidebar .brand { margin: 0 12px 0 0; }
  .ops-nav { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .ops-nav .subhead { margin: 0 4px; }
  .ops-sidebar .foot { margin: 0 0 0 auto; display: flex; gap: 10px; align-items: baseline; padding: 0; }
  .ops-sidebar .foot .who { margin: 0; }
  .ops-main { padding: 14px; }
  .ops-grid { grid-template-columns: 1fr; }
  .ops-search { min-width: 0; width: 100%; }
}
.viewas-banner {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #fef3c7; color: #92400e; font-size: 14px; font-weight: 600;
  padding: 8px 14px;
}
.viewas-banner .link { color: inherit; text-decoration: underline; }
