/* Bresca glass: translucent navigation, quiet opaque reading surfaces. */
/* The bundled Manrope file is Regular, not variable. This display alias lets
   the browser synthesize bold instead of treating Regular as a 700 face. */
@font-face {
  font-family: "Bresca Display";
  src: url('/fonts/manrope.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
:root {
  --paper: oklch(96% .014 150);
  --surface: oklch(99% .004 150);
  --line: oklch(86% .021 150);
  --glass: oklch(99% .007 150 / .78);
  --glass-edge: oklch(100% .005 150 / .9);
  --glass-shadow: 0 12px 40px oklch(28% .035 160 / .07), inset 0 1px 0 var(--glass-edge);
}
body {
  background: radial-gradient(ellipse at 95% 0%, oklch(89% .07 85 / .6), transparent 45%),
    radial-gradient(ellipse at 5% 70%, oklch(86% .055 155 / .5), transparent 55%), var(--paper);
  background-attachment: fixed;
}
.sidebar {
  inset: 16px auto 16px 16px;
  width: 228px;
  padding: 28px 14px 20px;
  border: 1px solid var(--glass-edge);
  border-radius: 28px;
  background: var(--glass);
  color: var(--ink);
  box-shadow: var(--glass-shadow);
  z-index: 3;
}
.sidebar, .topbar {
  -webkit-backdrop-filter: blur(24px) saturate(145%);
  backdrop-filter: blur(24px) saturate(145%);
}
.brand { gap: 6px; padding-bottom: 24px; }
.brand img { width: 42px; height: 42px; }
.brand-sub, .nav-label, .sidebar-bottom small { color: var(--muted); }
.sidebar nav a { color: var(--ink); border-radius: 14px; min-height: 44px; }
/* Keep keyboard focus inside the scrolling navigation's clipping boundary. */
.sidebar nav a:focus-visible { outline-offset: -3px; outline-color: var(--ink); }
.sidebar nav a[aria-current="page"]:focus-visible { outline-color: var(--surface); }
.sidebar nav a[aria-current="page"] {
  background: var(--green); color: var(--surface);
  box-shadow: 0 4px 12px oklch(30% .04 160 / .15), inset 0 1px 0 oklch(80% .03 150 / .25);
}
.avatars i { color: var(--surface); border-color: var(--surface); }
.workspace { margin-left: 260px; }
.workspace, main, .topbar, .topbar > div { min-width: 0; }
.topbar {
  position: sticky; top: 16px; z-index: 2;
  margin: 16px 32px 0; padding: 12px 20px; min-height: 64px;
  border: 1px solid var(--glass-edge); border-radius: 22px;
  background: var(--glass); box-shadow: var(--glass-shadow);
}
main { padding: 36px 32px; }
h1 { font-family: Manrope, sans-serif; font-weight: 700; font-size: 2.5rem; letter-spacing: -.055em; }
.paper, .table-wrap { border-radius: 20px; background: var(--surface); }
.paper { box-shadow: 0 4px 20px oklch(28% .03 160 / .025); }
.notice { border-radius: 16px; }
.badge { border-radius: 100px; padding: 4px 10px; }
.button, .mobile-toggle { border-radius: 100px; min-height: 44px; }
input, select, textarea { border-radius: 12px; }
.button, .sidebar nav a, .mobile-toggle {
  transition: transform 180ms cubic-bezier(.2,.8,.2,1), background-color 180ms ease, box-shadow 180ms ease;
  touch-action: manipulation;
}
.button, .mobile-toggle { min-inline-size: 44px; }
.button:active:not(:disabled), .sidebar nav a:active, .mobile-toggle:active { transform: scale(.97); }
.page { animation: none; }
/* Stronger display hierarchy with the existing, locally hosted typeface. */
h1 { font-family: "Bresca Display", Manrope, sans-serif; font-size: 3rem; line-height: 1.06; letter-spacing: -.055em; }
/* Keep the operational UI geometric; document previews retain their own brand typography. */
#content :is(h2, h3):not(.proposal-document *) {
  font-family: "Bresca Display", Manrope, sans-serif;
  font-weight: 700;
  letter-spacing: -.035em;
}
.heading { margin-bottom: 32px; }
.heading .subtitle { max-width: 58ch; }
.paper, .table-wrap { border-radius: 12px; box-shadow: none; }
.section .section { margin-bottom: 16px; }
.ops-overview h2, .hermes-workspace h2 { font-family: "Bresca Display", Manrope, sans-serif; font-weight: 700; font-size: 1.35rem; letter-spacing: -.035em; }
.ops-overview .ops-job { padding-block: 20px; }
.ops-overview .ops-job h3 { font-size: 1.1rem; }
.ops-overview .ops-destinations { gap: 12px 28px; padding-block: 20px; }
.ops-overview .ops-destinations a { font-size: .95rem; }
.ops-job-details summary { color: var(--muted); font-size: .8rem; }
.ops-job-details p { font-size: .85rem; overflow-wrap: anywhere; }
.ops-explanation { padding-block: 12px; }
.ops-explanation summary { font-size: .9rem; }
.ops-job-details summary, .ops-explanation summary, .hermes-disclosure summary { cursor: pointer; padding-block: 12px; min-height: 44px; }
.hermes-intro { display: grid; gap: 16px; margin-bottom: 24px; }
.hermes-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 24px; }
.hermes-links { max-width: 100%; }
.hermes-links > * { flex: 0 1 auto; min-width: 0; }
.hermes-links a {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  min-inline-size: 44px;
  text-underline-offset: 4px;
}
.hermes-links > a:not(.button) { padding-inline: 4px; }
.hermes-status-summary { margin-bottom: 24px; }
.hermes-status-summary .facts { margin-block: 16px; }
.hermes-status-summary .facts strong { font-size: 1rem; }
.hermes-disclosure { border-top: 1px solid var(--line); }
.hermes-disclosure > summary { padding-block: 20px; font-weight: 700; font-size: 1.05rem; }
.hermes-disclosure-body { padding-bottom: 24px; }
.hermes-disclosure-body .facts strong { font-size: 1rem; overflow-wrap: anywhere; }
.hermes-disclosure-body .columns { gap: 24px; }
.hermes-workspace #hermes-chat .paper { border: 1px solid var(--line); }
.hermes-workspace #hermes-chat .muted { font-size: .9rem; }
.hermes-workspace #hermes-chat textarea { max-width: 100%; }
#stripe-wallet-chart,
#stripe-receivables-chart {
  width: 100%;
  max-width: 100%;
  margin: 0 0 36px;
  overflow-x: auto;
}
#stripe-wallet-chart > svg,
#stripe-receivables-chart > svg {
  display: block;
  width: 100%;
  min-width: 36rem;
  max-width: none;
  height: auto;
}
@media (hover: hover) {
  .sidebar nav a:hover { background: oklch(92% .025 150 / .8); }
  .button:hover:not(:disabled) { transform: translateY(-1px); }
  .button.primary:hover { background: oklch(41% .05 160); }
}
@media (max-width: 1100px) and (min-width: 768px) {
  .sidebar { width: 204px; inset-inline-start: 12px; }
  .workspace { margin-left: 228px; }
  .topbar { margin-inline: 20px; }
  main { padding-inline: 20px; }
}
@media (max-width: 767px) {
  body { background-attachment: scroll; }
  .sidebar {
    position: relative;
    inset: auto;
    width: auto;
    margin-block: max(12px, env(safe-area-inset-top)) 12px;
    margin-inline-start: max(12px, env(safe-area-inset-left));
    margin-inline-end: max(12px, env(safe-area-inset-right));
    padding: 16px clamp(12px, 4vw, 16px);
    border-radius: 24px;
  }
  .brand { padding: 0; }
  .workspace { margin-left: 0; }
  .topbar {
    position: relative;
    top: auto;
    margin-block: 0;
    margin-inline-start: max(12px, env(safe-area-inset-left));
    margin-inline-end: max(12px, env(safe-area-inset-right));
    padding: 12px clamp(12px, 4vw, 16px);
    border-radius: 20px;
  }
  .topbar > div { gap: 8px; }
  .topbar .button { flex-shrink: 0; }
  main {
    padding-block: 24px 40px;
    padding-inline-start: max(16px, env(safe-area-inset-left));
    padding-inline-end: max(16px, env(safe-area-inset-right));
  }
  .mobile-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink); border-color: var(--line); background: var(--surface); }
  h1 { font-size: 2rem; }
  .heading, .section-head { align-items: flex-start; flex-wrap: wrap; }
  .columns { gap: 24px; }
  .hermes-links { gap: 8px 12px; }
  .paper { padding: clamp(16px, 5.13vw, 22px); }
  .notice { padding-inline: clamp(14px, 4.1vw, 16px); }
  .proposal { padding: clamp(20px, 6.15vw, 24px); }
  .toolbar input { flex-basis: 100%; min-width: 0; }
}
@supports not (backdrop-filter: blur(1px)) {
  .sidebar, .topbar { background: var(--surface); }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .sidebar, .topbar { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; border-color: var(--muted); }
  body { background: var(--paper); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .button, .sidebar nav a, .mobile-toggle { transform: none !important; }
}
@media (prefers-contrast: more) {
  :root { --line: var(--ink); --muted: var(--ink); }
  /* Form borders in the base stylesheet use a literal, not --line. */
  input, select, textarea { border-color: var(--ink); }
}

/* Finance lane: compact views, native details for drill-down, and no fixed canvas. */
.finance-shell { max-width: 1100px; margin-inline: auto; min-width: 0; }
.finance-shell #stripe-wallet-chart, .finance-shell #stripe-receivables-chart { overflow: visible; margin-bottom: 0; }
.finance-shell #stripe-wallet-chart > svg, .finance-shell #stripe-receivables-chart > svg { min-width: 0; max-width: 100%; }
.finance-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.finance-toolbar h2 { margin: 2px 0 4px; }
.finance-toolbar .muted { margin: 0; max-width: 46rem; }
.eyebrow { margin: 0; color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.icon-button { display: inline-grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: var(--surface); cursor: pointer; transition: transform .2s ease, background-color .2s ease, box-shadow .2s ease; }
.icon-button:hover:not(:disabled) { transform: translateY(-1px); background: var(--surface); box-shadow: var(--glass-shadow); }
.icon-button:active:not(:disabled) { transform: scale(.96); }
.icon-button:disabled { opacity: .55; cursor: wait; }
.finance-tabs { display: inline-flex; max-width: 100%; gap: 4px; margin-bottom: 18px; padding: 4px; overflow-x: auto; border: 1px solid var(--line); border-radius: 999px; background: var(--wash); scrollbar-width: none; }
.finance-tabs::-webkit-scrollbar { display: none; }
.finance-tab { min-height: 40px; padding: 8px 15px; border: 0; border-radius: 999px; color: var(--muted); background: transparent; font: inherit; font-size: .88rem; font-weight: 700; white-space: nowrap; cursor: pointer; transition: color .2s ease, background-color .2s ease, transform .2s ease; }
.finance-tab:hover { color: var(--ink); }
.finance-tab:active { transform: scale(.97); }
.finance-tab.is-active { color: var(--ink); background: var(--surface); box-shadow: 0 2px 8px rgb(29 52 39 / .08); }
.finance-panel, .finance-provider-status { min-width: 0; margin-bottom: 16px; padding: clamp(16px, 2.6vw, 24px); border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--glass-shadow); }
.finance-panel h2, .finance-provider-status h2 { margin: 0; font-size: 1.05rem; }
.finance-panel .section-head { margin-bottom: 16px; }
.finance-currency-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(12rem, 100%), 1fr)); gap: 12px; margin-bottom: 16px; }
.finance-currency { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--wash); }
.finance-currency strong { display: block; margin-block: 6px 2px; overflow-wrap: anywhere; font-size: 1.2rem; letter-spacing: -.025em; }
.finance-currency .muted { font-size: .78rem; }
.finance-chart { min-width: 0; }
.finance-chart-groups { display: grid; gap: 18px; min-width: 0; }
.finance-chart-group { min-width: 0; }
.finance-chart-group h3 { margin: 0 0 10px; color: var(--muted); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.finance-chart-plot { display: grid; gap: 12px; min-width: 0; }
.finance-bar-row { display: grid; grid-template-columns: minmax(5.5rem, 7rem) minmax(5rem, 1fr) max-content; align-items: center; gap: 10px; min-width: 0; }
.finance-bar-label, .finance-bar-row strong { font-size: .82rem; overflow-wrap: anywhere; }
.finance-bar-row strong { text-align: right; }
.finance-bar-track { display: block; min-width: 0; height: 10px; overflow: hidden; border-radius: 999px; background: oklch(88% .025 150 / .68); }
.finance-bar { display: block; width: 100%; height: 100%; transform: scaleX(var(--bar-scale, 0%)); transform-origin: left center; border-radius: inherit; background: var(--green); transition: transform .55s cubic-bezier(.2,.8,.2,1); }
.finance-bar.pending { background: var(--accent); }
.finance-bar.receivable { background: var(--muted); }
.finance-chart-note, .finance-source { margin: 14px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.finance-accessible-data { display: grid; gap: 2px; margin-top: 10px; color: var(--muted); font-size: .75rem; }
.finance-empty-state { margin: 0; padding: 14px; border-radius: 12px; color: var(--muted); background: var(--wash); }
.invoice-list { display: grid; gap: 8px; }
.invoice-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--wash); }
.invoice-card summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; padding: 12px 14px; list-style: none; cursor: pointer; }
.invoice-card summary::-webkit-details-marker { display: none; }
.invoice-card summary::after { content: '+'; flex: 0 0 auto; color: var(--muted); font-size: 1.15rem; }
.invoice-card[open] summary::after { content: '−'; }
.invoice-card summary > span { display: grid; gap: 3px; min-width: 0; }
.invoice-card summary strong { overflow-wrap: anywhere; }
.invoice-card summary small { color: var(--muted); font-size: .76rem; font-weight: 600; }
.invoice-detail { padding: 0 14px 14px; border-top: 1px solid var(--line); }
.invoice-detail dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin: 14px 0; }
.invoice-detail dl div { min-width: 0; }
.invoice-detail dt { color: var(--muted); font-size: .72rem; }
.invoice-detail dd { margin: 2px 0 0; overflow-wrap: anywhere; font-weight: 700; }
.finance-provider-status { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.finance-provider-status h2 { margin-top: 4px; }
.finance-provider-status p { margin: 4px 0 0; }
.status-dot { display: block; flex: 0 0 10px; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px oklch(78% .1 84 / .16); }
.finance-provider-status.is-ready .status-dot { background: var(--green); box-shadow: 0 0 0 5px oklch(60% .1 150 / .16); }

/* Integration checks become readable records on narrow screens. The scope
   stays local so dense cronjob and operational tables keep their semantics. */
.integrations-table { min-width: 0; }
@media (max-width: 767px) {
  .integrations-table thead { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .integrations-table,
  .integrations-table tbody,
  .integrations-table tr,
  .integrations-table td { display: block; width: 100%; }
  .integrations-table tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .integrations-table tr:last-child { border-bottom: 0; }
  .integrations-table td { display: grid; grid-template-columns: minmax(7rem, 38%) minmax(0, 1fr); gap: 10px; min-width: 0; padding: 6px 0; overflow-wrap: anywhere; }
  .integrations-table td::before { content: attr(data-label); color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
}

/* Keep the shell navigation calm and make its mobile reveal animate without layout jumps. */
.sidebar nav a { align-items: center; }
.sidebar nav a > span:first-child { display: inline-grid; place-items: center; flex: 0 0 20px; width: 20px; height: 20px; min-height: 20px; line-height: 0; }
.sidebar nav a > span:first-child svg { display: block; }
@media (max-width: 767px) {
  .sidebar nav { display: flex; max-height: 0; margin-top: 0; overflow: hidden; visibility: hidden; opacity: 0; transform: translateY(-6px); transition: max-height .28s cubic-bezier(.2,.8,.2,1), margin-top .28s cubic-bezier(.2,.8,.2,1), opacity .2s ease, transform .28s cubic-bezier(.2,.8,.2,1), visibility 0s linear .28s; }
  .sidebar nav.open { max-height: 70vh; margin-top: 14px; visibility: visible; opacity: 1; transform: translateY(0); transition-delay: 0s; }
  .finance-toolbar { gap: 12px; }
  .finance-toolbar > div { min-width: 0; }
  .finance-tabs { display: flex; width: 100%; }
  .finance-tab { flex: 1 0 auto; }
  .finance-bar-row { grid-template-columns: minmax(4.5rem, 5.5rem) minmax(3rem, 1fr) max-content; gap: 8px; }
  .finance-bar-row strong { max-width: 8rem; font-size: .76rem; }
  .invoice-card summary { gap: 8px; padding-inline: 12px; }
  .invoice-card summary > strong { max-width: 9rem; font-size: .86rem; }
  .invoice-detail { padding-inline: 12px; }
  .invoice-detail dl { grid-template-columns: 1fr; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .icon-button, .finance-tab, .finance-bar, .sidebar nav { transition: none; }
}
