
:root {
  --paper: #fafafa; --surface: #ffffff; --ink: #111111; --muted: #6b6b6b; --rule: #e1e1e1; --rule-soft: #eeeeee; --hover: rgba(0, 0, 0, .03);
  --accent: #0b7a3c; --accent-ink: #ffffff; --in: #0b7a3c; --out: #b45309;
  --ok: #0b7a3c; --warn: #b45309; --bad: #c62828;
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; color-scheme: light dark;
  color: var(--ink); background: var(--paper);
}
@media (prefers-color-scheme: dark) { :root { --paper: #0a0a0a; --surface: #141414; --ink: #ededed; --muted: #8f8f8f; --rule: #262626; --rule-soft: #1f1f1f; --hover: rgba(255, 255, 255, .04); --accent: #3dd68c; --accent-ink: #06130c; --in: #3dd68c; --out: #f5a524; --ok: #3dd68c; --warn: #f5a524; --bad: #ff6369; } }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-size: 15px; line-height: 1.5; background: var(--paper); color: var(--ink); }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px 64px; }

/* first screen */
.boot { min-height: 70vh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); }
.boot p { margin: 0; font-size: 14px; }
.logo { display: block; border-radius: 7px; }
.logo.small { align-self: end; margin-bottom: 5px; }

/* sign in */
.signin { display: grid; grid-template-columns: 1fr; gap: 28px; max-width: 860px; margin: 12vh auto 0; padding: 0 20px; align-items: center; }
@media (min-width: 760px) { .signin { grid-template-columns: 1fr 360px; gap: 64px; } }
.brand .logo { margin-bottom: 14px; }
.brand h1 { font-size: 34px; line-height: 1.1; margin: 0 0 10px; letter-spacing: -0.03em; font-weight: 650; }
.brand p { color: var(--muted); margin: 0; max-width: 34ch; }
.signin-card { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 26px 24px 24px; }
.signin-card h2 { font-size: 18px; margin: 0 0 18px; letter-spacing: -0.01em; }
.signin .btn { width: 100%; margin-top: 4px; padding: 11px 16px; }
.signin .err:empty { min-height: 1.4em; margin: 8px 0; }
.label { font-weight: 600; font-size: 14px; }
.codeboxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.codeboxes input.codebox { width: 100%; min-width: 0; height: 52px; padding: 0; text-align: center; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); caret-color: var(--accent); }
.codeboxes input.codebox:focus { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent); outline-offset: 0; }
.codetools { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font-size: 13px; }
.codearea input#recovery { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .04em; height: 52px; }

/* header */
.top { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 14px; padding: 22px 0 8px; }
.top .who { margin-left: auto; }
.pick { display: flex; flex-direction: column; min-width: 0; }
.pick label { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.pick select { font-size: 14px; font-weight: 600; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 5px 30px 5px 10px; min-height: 32px; width: auto; max-width: 220px; cursor: pointer; }
.who { font-size: 13px; color: var(--muted); display: flex; gap: 14px; align-items: center; }

/* tabs: plain text, the open one underlined */
nav[aria-label="Sections"] { display: flex; flex-wrap: wrap; gap: 2px 22px; border-bottom: 1px solid var(--rule); margin: 6px 0 28px; }
nav button { background: none; border: 0; padding: 10px 0; margin-bottom: -1px; border-bottom: 2px solid transparent; cursor: pointer; color: var(--muted); font-weight: 500; font-size: 14px; }
nav button:hover { color: var(--ink); }
nav button[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

h2 { font-size: 24px; font-weight: 650; margin: 0 0 12px; letter-spacing: -0.02em; }
h3 { font-size: 15px; font-weight: 600; margin: 28px 0 10px; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 14px; max-width: 64ch; }

/* controls */
.btn { transition: filter .12s; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: var(--radius); padding: 8px 16px; font-weight: 600; cursor: pointer; }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.quiet:hover:not(:disabled) { border-color: var(--muted); filter: none; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { padding: 4px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: var(--ink); padding: 4px 0; cursor: pointer; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.link:hover { text-decoration-color: var(--ink); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.field label, .field legend { font-weight: 600; font-size: 13px; }
.field small { color: var(--muted); font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=datetime-local], select, textarea {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 9px 12px; min-height: 40px; width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 0; border-color: var(--accent); }
textarea { min-height: 76px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; }
.row > .field { flex: 1 1 160px; }
.err { color: var(--bad); font-weight: 500; margin: 8px 0; min-height: 1.4em; }
.err:empty { min-height: 0; margin: 0; }
.ok { color: var(--ok); font-weight: 500; }
fieldset.field { border: 0; padding: 0; margin: 0 0 14px; }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; }

/* ledger lines */
.lines { margin: 0 0 8px; padding: 0; }
.lines > div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--rule-soft); }
.lines dt { color: var(--muted); }
.lines dd { margin: 0; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.cols { display: grid; grid-template-columns: 1fr; gap: 0 48px; }
@media (min-width: 760px) { .cols { grid-template-columns: 1fr 1fr; } }

/* the cash strip */
.strip { background: transparent; border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 14px 4px; margin-bottom: 26px; }
.strip svg { display: block; width: 100%; height: 190px; }
.strip .axis { stroke: var(--muted); stroke-width: 1; }
.strip .in { fill: var(--in); }
.strip .out { fill: var(--out); }
.strip text { fill: var(--muted); font-size: 11px; }
.strip .legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted); padding: 4px 0 8px; align-items: center; }
.strip .legend span.k::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 2px; background: var(--in); }
.strip .legend span.k.o::before { background: var(--out); }
.strip .dates { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); padding: 2px 2px 0; }
.strip .legend select { width: auto; min-height: 30px; padding: 2px 8px; margin-left: auto; }

/* payments: one quiet line under the main one, so six columns say what nine did */
.two { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.two .top { color: var(--ink); overflow-wrap: anywhere; }
.two .under { color: var(--muted); font-size: 12.5px; }
td.num .two { align-items: flex-end; }
.nowrap, td[data-label="When"] .top, td[data-label="Invoice"] { white-space: nowrap; }
.bar { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; margin: 0 0 18px; }
.seg { display: flex; gap: 20px; }
.seg button { background: none; border: 0; padding: 6px 0; margin-bottom: -1px; border-bottom: 2px solid transparent; cursor: pointer; color: var(--muted); font-weight: 500; font-size: 14px; }
.seg button:hover { color: var(--ink); }
.seg button.on { color: var(--ink); border-bottom-color: var(--accent); }
.bar input[type=search] { flex: 1 1 260px; max-width: 380px; }
.files { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 0; }
.files li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--rule-soft); }
/* tables: flat rows and thin lines, equal padding so columns never touch */
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: transparent; }
caption { text-align: left; color: var(--muted); font-size: 13px; padding: 0 0 10px; caption-side: top; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
th { font-size: 12px; font-weight: 500; color: var(--muted); padding-top: 8px; padding-bottom: 10px; border-bottom-color: var(--rule); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:hover td { background: var(--hover); }
.appframe { width: 100%; height: 78vh; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); }
.copy { margin-left: 2px; font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; letter-spacing: .01em; user-select: all; }
.badge::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; background: var(--muted); }
.badge.paid::before, .badge.succeeded::before, .badge.active::before { background: var(--ok); }
.badge.open::before, .badge.pending::before, .badge.scheduled::before { background: var(--warn); }
.badge.refunded::before, .badge.paused::before, .badge.expired::before, .badge.exhausted::before, .badge.cancelled::before, .badge.revoked::before { background: var(--out); }
.badge.failed::before, .badge.void::before { background: var(--bad); }
.badge.waiting::before { background: var(--warn); }
.badge.free::before { background: transparent; border: 2px solid var(--accent); box-sizing: border-box; }
.badge.closed::before { background: var(--out); }
.thread { margin: 16px 0; display: grid; gap: 10px; }
.msg { border: 1px solid var(--rule); border-radius: 8px; padding: 10px 14px; background: var(--surface); }
.msg.admin { border-color: var(--ok); }
.msg.owner { border-style: dashed; }
.msg-head { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.msg-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
textarea { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 10px 12px; }
.empty { padding: 28px 0; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; align-items: end; }
.filters .field { margin: 0; flex: 1 1 180px; }
.filters select, .filters input { min-height: 42px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.confirm { margin-top: 14px; border-color: var(--bad); }
.confirm p { margin: 0 0 12px; }
.check { display: flex; gap: 10px; align-items: start; margin: 12px 0; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--accent); }

/* connect (MCP) */
.snippet { margin: 0 0 16px; }
.snippet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.snippet pre { margin: 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); overflow-x: auto; font-size: 13px; line-height: 1.55; }
.snippet code { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.copyrow { display: flex; gap: 8px; align-items: stretch; }
.copyrow input { flex: 1 1 auto; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
.newkey { border-color: var(--accent); margin: 14px 0 20px; }
.newkey h3 { margin-top: 0; }

/* loading placeholders */
.skeleton { display: grid; gap: 14px; max-width: 640px; padding-top: 8px; }
.sk { display: block; height: 13px; border-radius: 6px; background: var(--rule-soft); }
.sk.title { height: 20px; width: 38%; }
.sk.short { width: 62%; }

@media (max-width: 640px) {
  table, thead, tbody, tr, th, td { display: block; }
  thead { position: absolute; left: -9999px; }
  tr { border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 10px; padding: 6px 0; }
  td, td:first-child, td:last-child { border: 0; padding: 4px 14px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: 0 0 38%; }
  td.num { text-align: right; }
  td:empty { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .strip .in, .strip .out { transition: opacity .2s; }
  .boot .logo { animation: pulse 1.6s ease-in-out infinite; }
  .skeleton .sk { background: linear-gradient(90deg, var(--rule-soft) 0%, var(--rule) 50%, var(--rule-soft) 100%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
}
@keyframes pulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
