/* CheckLynx app. Brand follows chaininterlynx.com/checklynx: Inter, slate neutrals, amber accent.
   The work area stays light for readability; the header uses the site's dark slate. */
:root {
  --bg: #f8fafc; --panel: #fff; --ink: #0f172a; --muted: #475569; --line: #e2e8f0; --field: #fff;
  --accent: #f59e0b; --accent-hover: #fbbf24; --accent-ink: #0f172a; --link: #b45309;
  --tint: #fffbeb; --tint-line: #fde68a;
  --head: #020617; --head-ink: #e2e8f0; --head-muted: #94a3b8; --head-line: #1e293b;
  --warn: #92400e; --err: #b91c1c; --focus: #f59e0b;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #020617; --panel: #0f172a; --ink: #e2e8f0; --muted: #94a3b8; --line: #1e293b; --field: #020617;
    --link: #fbbf24; --tint: #1c1408; --tint-line: #78350f; --head: #020617; --head-line: #1e293b;
    --warn: #fbbf24; --err: #fca5a5;
  }
}
* { box-sizing: border-box; }
/* the hidden attribute must win over component display rules */
[hidden] { display: none !important; }
body {
  margin: 0; font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
header {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
  padding: 12px max(16px, calc((100% - 1040px) / 2)); background: var(--head); color: var(--head-ink);
  border-bottom: 1px solid var(--head-line);
}
.brand { display: flex; align-items: center; gap: 8px; color: #f8fafc; text-decoration: none; border-radius: 6px; }
.mark { width: 24px; height: 24px; border-radius: 6px; background: linear-gradient(135deg, #fbbf24, #ef4444); flex: none; }
.wordmark { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
header #company { color: var(--head-muted); font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 2px; }
nav button {
  background: none; border: 0; padding: 6px 10px; border-radius: 6px; color: var(--head-muted);
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
}
nav button:hover { color: #fff; background: #0f172a; }
nav button.active { color: #fff; background: #1e293b; box-shadow: inset 0 -2px 0 var(--accent); }
nav #logout { color: #fbbf24; }

/* ── Layout ── */
main { max-width: 1040px; margin: 0 auto; padding: 20px 16px 48px; }
section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; margin: 0 0 12px; }
h2 { font-size: 15px; font-weight: 600; margin: 28px 0 10px; }
section > h1 + h2 { margin-top: 12px; }
p { margin: 8px 0; }
em { font-style: normal; font-weight: 600; }

/* ── Sign in ── */
#signin { max-width: 640px; margin: 24px auto; padding: 32px; }
#signin h1 { font-size: 28px; font-weight: 800; }
#signin p { color: var(--muted); }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: 0.18em; color: var(--link) !important; font-weight: 600; margin: 0 0 10px; }
.signin-alt { margin-top: 16px; }

/* ── Controls ── */
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--field); border: 1px solid #cbd5e1;
  border-radius: 8px; padding: 8px 10px; max-width: 100%; min-width: 0;
}
@media (prefers-color-scheme: dark) { input, select, textarea { border-color: #334155; } }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); padding: 0; }
label.check { flex-direction: row; align-items: flex-start; gap: 8px; color: var(--ink); font-weight: 400; }
label.check input { margin-top: 3px; flex: none; }
button, .primary {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; border-radius: 8px; padding: 8px 16px;
  border: 1px solid #cbd5e1; background: var(--panel); color: var(--ink); text-decoration: none;
  display: inline-block; line-height: 1.4;
}
button:hover { border-color: #94a3b8; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.small { padding: 5px 12px; font-size: 13px; }
.link { background: none; border: 0; color: var(--link); padding: 0; font-weight: 600; border-radius: 4px; }
.link:hover { text-decoration: underline; text-underline-offset: 2px; }
.link.danger { color: var(--err); }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgb(245 158 11 / .3);
}
header :focus-visible { outline-color: #fbbf24; }
.qbo-btn { display: inline-block; background: #2ca01c; color: #fff; padding: 10px 18px; border-radius: 8px; text-decoration: none; font-weight: 600; }
.qbo-btn:hover { background: #248a16; }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
.row label { flex-direction: row; align-items: center; gap: 8px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; }
.toolbar label { flex-direction: row; align-items: center; gap: 8px; min-width: 0; }
.toolbar select { min-width: 0; }
.toolbar.end { justify-content: flex-end; margin-top: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 14px; }
.grid .wide { grid-column: 1 / -1; }
.grid h2.wide { margin-bottom: 0; }

.muted { color: var(--muted); } .warn { color: var(--warn); } .err { color: var(--err); }
.notice { background: var(--tint); border: 1px solid var(--tint-line); border-radius: 8px; padding: 12px 14px; }

/* ── Getting started ── */
.steps { list-style: none; counter-reset: step; padding: 0; margin: 16px 0 0; display: grid; gap: 12px; }
.steps li {
  counter-increment: step; position: relative; padding: 14px 16px 14px 56px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
}
.steps li::before {
  content: counter(step); position: absolute; left: 16px; top: 13px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px; display: grid; place-items: center;
}
.steps li > :first-child { display: block; font-size: 15px; text-align: left; }
.steps .step-title { font-weight: 600; }
.steps li .muted { display: block; font-size: 14px; margin-top: 2px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; margin: 12px 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr:hover td { background: var(--bg); }
th.cb, td.cb { width: 32px; }
td.state { padding: 28px 12px; text-align: center; }
td.state:hover, tbody tr:hover td.state { background: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* ── Bank accounts ── */
.bank { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.bank .grow { flex: 1; min-width: min(220px, 100%); overflow-wrap: anywhere; }
.empty { border: 1px dashed #cbd5e1; border-radius: var(--radius); padding: 20px; text-align: center; color: var(--ink); }
@media (prefers-color-scheme: dark) { .empty { border-color: #334155; } }

/* ── Dialog, toast, billing ── */
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); max-width: 640px; width: calc(100% - 32px); padding: 24px; }
dialog h2 { margin-top: 0; font-size: 18px; }
dialog hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
dialog::backdrop { background: rgb(2 6 23 / .55); }
#toast {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 10;
  background: #0f172a; color: #f8fafc; padding: 10px 16px; border-radius: 8px; border-left: 4px solid var(--accent);
  max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgb(2 6 23 / .25); font-size: 14px;
}
.billing {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: var(--tint);
  border: 1px solid var(--tint-line); border-radius: var(--radius); padding: 10px 16px; margin-bottom: 16px; font-size: 14px;
}
.billing #trialMsg { flex: 1; min-width: min(220px, 100%); }
.billing #billingMsg { flex: 1; min-width: 220px; }

/* ── Narrow screens ── */
@media (max-width: 640px) {
  header { padding: 10px 16px; }
  nav { margin-left: 0; width: 100%; }
  section, #signin { padding: 18px 16px; }
  #signin { margin: 8px 0; }
  #signin h1 { font-size: 24px; }
  .hide-sm { display: none; }
  .toolbar.end { justify-content: space-between; }
  dialog { padding: 18px 16px; }
}
#settingsForm + p { margin-top: 20px; }
.grid label.check { align-self: center; }
#bankForm .wide .link { margin-left: 8px; }
@media (max-width: 640px) {
  .toolbar label { flex-direction: column; align-items: stretch; gap: 4px; flex: 1 1 100%; }
}
