/* ==========================================================================
   TFR Billing Desk - design system
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-variable.woff2") format("woff2-variations"),
       url("/static/fonts/inter-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, "Noto Sans", "DejaVu Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --ink-900: #0b1220;
  --ink-800: #101828;
  --ink-700: #1d2939;
  --ink-600: #344054;
  --ink-500: #475467;
  --muted: #667085;
  --muted-2: #98a2b3;

  --line: #eaecf0;
  --line-2: #f2f4f7;
  --line-strong: #d0d5dd;

  --bg: #f7f8fa;
  --card: #ffffff;

  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-700: #3730a3;
  --brand-soft: #eef2ff;
  --brand-soft-2: #e0e7ff;

  --green: #067647;
  --green-soft: #ecfdf3;
  --green-line: #abefc6;
  --amber: #b54708;
  --amber-soft: #fffaeb;
  --amber-line: #fedf89;
  --red: #b42318;
  --red-soft: #fef3f2;
  --red-line: #fecdca;
  --blue: #175cd3;
  --blue-soft: #eff8ff;
  --blue-line: #b2ddff;
  --slate-soft: #f2f4f7;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .1), 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, .1), 0 2px 4px -2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 20px -4px rgba(16, 24, 40, .08), 0 4px 6px -2px rgba(16, 24, 40, .04);
  --ring: 0 0 0 4px rgba(79, 70, 229, .14);

  --r-sm: 8px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --sidebar-w: 250px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-700);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }
h1 { font-size: 24px; line-height: 1.2; font-weight: 640; letter-spacing: -.021em;
  color: var(--ink-900); margin: 0; }
h2 { font-size: 15px; font-weight: 620; letter-spacing: -.01em; color: var(--ink-800);
  margin: 0; }
h3 { font-size: 13.5px; font-weight: 620; color: var(--ink-800); margin: 0 0 8px; }
p { margin: 6px 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
code { background: var(--slate-soft); border: 1px solid var(--line);
  border-radius: 6px; padding: 1px 6px; font-size: 12px; font-family: var(--font-mono); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }
.center { text-align: center; }
.ic { width: 16px; height: 16px; flex: 0 0 auto; stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic-lg { width: 20px; height: 20px; }
.plain { list-style: none; margin: 0; padding: 0; }

/* ---------------------------------------------------------------- shell -- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, #0b1220 0%, #111a2e 60%, #131d33 100%);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  background: linear-gradient(135deg, #6366f1, #4338ca 60%, #7c3aed);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; letter-spacing: .03em;
  box-shadow: 0 4px 10px rgba(79, 70, 229, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-name { color: #f8fafc; font-weight: 620; font-size: 14.5px; letter-spacing: -.01em; }
.brand-sub { color: #64748b; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .13em; margin-top: 1px; }

.sidebar nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: 11px;
  color: #a7b4c6; font-size: 13.5px; font-weight: 500;
  padding: 9px 11px; border-radius: 10px;
  transition: background .14s ease, color .14s ease;
}
.sidebar nav a .ic { width: 17px; height: 17px; opacity: .85; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .06); color: #f1f5f9; }
.sidebar nav a.active {
  background: rgba(99, 102, 241, .18);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, .35);
}
.sidebar nav a.active .ic { opacity: 1; color: #c7d2fe; }

.side-foot { border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 10px;
  display: flex; flex-direction: column; gap: 2px; }
.side-foot a, .side-foot .link-btn {
  color: #7d8ba1; font-size: 12.5px; padding: 7px 11px; border-radius: 8px;
  display: flex; align-items: center; gap: 9px; background: none; border: 0;
  font-family: inherit; cursor: pointer; text-align: left;
}
.side-foot a:hover, .side-foot .link-btn:hover { color: #e2e8f0; background: rgba(255, 255, 255, .05); }
.side-foot .ic { width: 15px; height: 15px; }
.side-foot form { margin: 0; }

main { flex: 1; padding: 30px 34px 70px; max-width: 1260px; min-width: 0; }

@media (max-width: 1080px) {
  :root { --sidebar-w: 78px; }
  .brand { justify-content: center; padding: 4px 0 20px; }
  .brand > div:last-child { display: none; }
  .sidebar nav a { justify-content: center; padding: 11px 0; }
  .sidebar nav a span { display: none; }
  .sidebar nav a .ic { width: 19px; height: 19px; }
  .side-foot a span, .side-foot .link-btn span { display: none; }
  .side-foot a, .side-foot .link-btn { justify-content: center; }
}
@media (max-width: 780px) {
  .layout { flex-direction: column; }
  .sidebar { position: static; height: auto; width: 100%; flex: none;
    flex-direction: row; align-items: center; padding: 10px 12px; gap: 8px; }
  .brand { padding: 0 8px 0 0; }
  .brand > div:last-child { display: block; }
  .sidebar nav { flex-direction: row; gap: 4px; }
  .sidebar nav a { padding: 8px 10px; }
  .sidebar nav a span { display: inline; }
  .side-foot { border: 0; flex-direction: row; padding: 0; margin-left: auto; }
  .side-foot a span, .side-foot .link-btn span { display: none; }
  main { padding: 20px 16px 60px; }
}

/* --------------------------------------------------------------- header -- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start;
  gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 5px; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------- cards -- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-xs);
}
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 20px 24px 0; margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 16px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: 1.4fr 1fr; }
.cols-2e { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1000px) { .cols-2, .cols-2e, .cols-3 { grid-template-columns: 1fr; } }

.section-title { font-size: 11px; font-weight: 620; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted-2); margin: 30px 0 12px; }
.section-title:first-child { margin-top: 0; }

/* ---------------------------------------------------------------- flash -- */
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 15px;
  border-radius: var(--r); margin-bottom: 18px; font-size: 13.5px; font-weight: 500;
  border: 1px solid transparent; box-shadow: var(--shadow-xs); }
.flash .ic { margin-top: 1px; }
.flash.ok { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.flash.bad { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }

/* --------------------------------------------------------------- stats -- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.stats.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1000px) { .stats, .stats.three { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .stats, .stats.three { grid-template-columns: 1fr; } }
.stat { position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow-xs);
  overflow: hidden; }
.stat::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), #7c3aed); opacity: 0; }
.stat.attention::after, .stat.bad::after { opacity: 1; }
.stat.attention::after { background: linear-gradient(90deg, #f59e0b, #f97316); }
.stat.bad::after { background: linear-gradient(90deg, #ef4444, #b42318); }
.stat .k { font-size: 11px; font-weight: 620; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted-2); }
.stat .v { font-size: 27px; font-weight: 640; letter-spacing: -.025em; margin-top: 8px;
  color: var(--ink-900); font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.stat .ic-wrap { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px;
  border-radius: 10px; background: var(--brand-soft); color: var(--brand-600);
  display: flex; align-items: center; justify-content: center; }
.stat.bad .ic-wrap { background: var(--red-soft); color: var(--red); }
.stat.attention .ic-wrap { background: var(--amber-soft); color: var(--amber); }

/* --------------------------------------------------------------- strip -- */
.strip {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-left: 0;
  border-radius: var(--r-lg); padding: 14px 20px; margin-bottom: 18px;
  font-size: 13.5px; box-shadow: var(--shadow-xs); position: relative; overflow: hidden;
}
.strip::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--brand), #7c3aed); }
.strip .item { display: flex; align-items: center; gap: 9px; color: var(--ink-600); }
.strip .item b { color: var(--ink-900); font-weight: 620; }
.strip .grow { flex: 1; }

/* ---------------------------------------------------------------- tabs -- */
.chips { display: inline-flex; gap: 3px; padding: 4px; border-radius: 12px;
  background: var(--slate-soft); border: 1px solid var(--line); margin-bottom: 18px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px;
  border-radius: 9px; font-size: 13px; font-weight: 550; color: var(--ink-600);
  transition: background .14s ease, color .14s ease, box-shadow .14s ease; }
.chip:hover { color: var(--ink-900); text-decoration: none; }
.chip.active { background: #fff; color: var(--ink-900); box-shadow: var(--shadow-sm); }
.chip .n { font-size: 11.5px; font-weight: 600; color: var(--muted-2);
  background: rgba(16, 24, 40, .06); border-radius: 20px; padding: 1px 8px; }
.chip.active .n { background: var(--brand-soft); color: var(--brand-600); }

/* ------------------------------------------------------------- toolbar -- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .field { flex: 1; min-width: 160px; }
.toolbar .field.narrow { flex: 0 0 160px; }
.toolbar .field.wide { flex: 2; }
.field { position: relative; }
.field .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted-2); pointer-events: none; }
.field .ic + input { padding-left: 36px; }

/* --------------------------------------------------------------- table -- */
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th {
  font-size: 11px; font-weight: 620; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted-2); text-align: left; padding: 10px 14px;
  background: #fcfcfd; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 13px 14px; border-bottom: 1px solid var(--line-2); font-size: 13.5px;
  vertical-align: middle; color: var(--ink-700); }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #fbfbfe; }
td .muted { font-size: 12px; }
.table-foot { display: flex; justify-content: flex-end; gap: 24px; padding: 14px;
  font-size: 13px; color: var(--ink-600); border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- pill -- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 560; white-space: nowrap;
  border: 1px solid transparent; letter-spacing: .005em; }
.pill .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor;
  flex: 0 0 auto; }
.p-draft { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.p-numbered { background: var(--blue-soft); color: var(--blue); border-color: var(--blue-line); }
.p-sent { background: var(--blue-soft); color: var(--blue); border-color: var(--blue-line); }
.p-paid { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.p-overdue { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }
.p-cancelled, .p-skipped { background: var(--slate-soft); color: var(--muted);
  border-color: var(--line-strong); }
.p-failed { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }
.p-simulated { background: var(--brand-soft); color: var(--brand-600);
  border-color: var(--brand-soft-2); }
.p-logged { background: var(--slate-soft); color: var(--ink-600); border-color: var(--line-strong); }
.p-active { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.p-off { background: var(--slate-soft); color: var(--muted); border-color: var(--line-strong); }

/* -------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--r);
  background: linear-gradient(180deg, #5b53e8, var(--brand-600));
  color: #fff; border: 1px solid var(--brand-600);
  font-size: 13.5px; font-weight: 560; font-family: inherit; letter-spacing: -.005em;
  cursor: pointer; box-shadow: 0 1px 2px rgba(16, 24, 40, .12), inset 0 1px 0 rgba(255, 255, 255, .16);
  transition: filter .14s ease, transform .06s ease, box-shadow .14s ease;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn .ic { width: 15px; height: 15px; }
.btn.secondary {
  background: #fff; color: var(--ink-700); border-color: var(--line-strong);
  box-shadow: var(--shadow-xs);
}
.btn.secondary:hover { background: #fcfcfd; filter: none; color: var(--ink-900); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand-600);
  box-shadow: none; padding: 0 10px; }
.btn.ghost:hover { background: var(--brand-soft); color: var(--brand-700); filter: none; }
.btn.solid-danger { background: linear-gradient(180deg, #d92d20, var(--red));
  border-color: var(--red); }
.btn.small { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn.small .ic { width: 14px; height: 14px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 2px 0; font-family: inherit;
  font-size: 13px; font-weight: 550; color: var(--brand-600); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
form.inline, .inline { display: inline; }

/* --------------------------------------------------------------- forms -- */
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=email], select, textarea {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  font-size: 13.5px; font-family: inherit; color: var(--ink-800); background: #fff;
  box-shadow: var(--shadow-xs);
  transition: border-color .14s ease, box-shadow .14s ease;
}
textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical;
  line-height: 1.5; }
select { appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: var(--ring);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
label { display: block; font-size: 12.5px; font-weight: 560; color: var(--ink-600);
  margin: 14px 0 6px; }
label.check { display: flex; align-items: flex-start; gap: 10px; margin: 10px 0;
  font-size: 13.5px; font-weight: 460; color: var(--ink-700); cursor: pointer; }
label.check input { width: auto; height: auto; margin: 3px 0 0; accent-color: var(--brand);
  box-shadow: none; }
label.inline { display: inline-flex; align-items: center; gap: 8px; margin: 8px 14px 0 0;
  font-size: 13px; font-weight: 460; }
label.inline input { width: auto; height: auto; accent-color: var(--brand); }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 7px; line-height: 1.45; }
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.row > div { flex: 1; min-width: 150px; }
.row > div.btn-cell { flex: 0 0 auto; }

/* ------------------------------------------------------------- details -- */
details { margin-top: 14px; }
summary {
  display: flex; align-items: center; gap: 10px; list-style: none;
  cursor: pointer; font-size: 13.5px; font-weight: 570; color: var(--ink-700);
  padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--r);
  background: #fff; box-shadow: var(--shadow-xs);
  transition: background .14s ease, border-color .14s ease;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: ""; width: 15px; height: 15px; flex: 0 0 auto;
  background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E") no-repeat center / contain;
  transition: transform .16s ease;
}
details[open] > summary::before { transform: rotate(90deg); }
summary:hover { background: #fcfcfd; border-color: var(--line-strong); }
details[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0;
  border-bottom-color: transparent; box-shadow: none; }
details > .card, details > form.card { border-top-left-radius: 0; border-top-right-radius: 0;
  margin-top: 0; border-top-color: var(--line-2); }
details > .card:last-child { margin-bottom: 0; }
.section-title + details { margin-top: 0; }

/* -------------------------------------------------------- attention etc -- */
.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-list li { display: flex; align-items: center; gap: 14px; padding: 13px 0;
  border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.attention-list li:last-child { border-bottom: 0; }
.attention-list .count {
  width: 32px; height: 32px; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 12.5px; font-weight: 640; flex: 0 0 auto; }
.count.amber { background: var(--amber-soft); color: var(--amber); }
.count.red { background: var(--red-soft); color: var(--red); }
.count.blue { background: var(--blue-soft); color: var(--blue); }
.attention-list .txt { flex: 1; color: var(--ink-800); font-weight: 540; }
.attention-list .txt .sub { color: var(--muted); font-size: 12.5px; font-weight: 440;
  margin-top: 1px; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 11px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.feed li:last-child { border-bottom: 0; }
.feed .when { color: var(--muted-2); font-size: 11.5px; margin-top: 3px; }
.feed .kind { display: inline-block; font-size: 10.5px; font-weight: 640;
  text-transform: uppercase; letter-spacing: .07em; color: var(--brand-600);
  background: var(--brand-soft); border-radius: 5px; padding: 1px 6px; margin-right: 8px; }

.empty { padding: 34px 12px; text-align: center; color: var(--muted); font-size: 13px; }
.empty-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--slate-soft);
  color: var(--muted-2); display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 10px; }

.kv { display: grid; grid-template-columns: minmax(120px, 170px) 1fr; gap: 8px 20px;
  font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink-700); }

/* ---------------------------------------------------------- radio cards -- */
.radio-cards { display: flex; gap: 14px; flex-wrap: wrap; }
.radio-card { position: relative; flex: 1; min-width: 230px; border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px 18px; cursor: pointer; background: #fff;
  margin: 0; transition: border-color .14s ease, box-shadow .14s ease, background .14s ease; }
.radio-card:hover { border-color: var(--line-strong); }
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card .t { display: flex; align-items: center; gap: 9px; font-weight: 620;
  font-size: 13.5px; color: var(--ink-800); }
.radio-card .t::before { content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 1.6px solid var(--line-strong); background: #fff;
  box-shadow: inset 0 0 0 4px #fff; transition: border-color .14s ease, background .14s ease; }
.radio-card .d { color: var(--muted); font-size: 12.5px; margin-top: 6px; padding-left: 25px; }
.radio-card.selected { border-color: var(--brand); background: linear-gradient(180deg, #fdfdff, var(--brand-soft));
  box-shadow: 0 0 0 1px var(--brand), var(--shadow-sm); }
.radio-card.selected .t::before { border-color: var(--brand); background: var(--brand); }

/* ------------------------------------------------------------ save bar -- */
.save-bar {
  position: sticky; bottom: 18px; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 12px 16px; margin-top: 22px; box-shadow: var(--shadow-lg);
}
.save-bar .txt { font-size: 12.5px; color: var(--muted); }

/* -------------------------------------------------------------- login --- */
.login-body { display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
  background: radial-gradient(1200px 600px at 15% -10%, #eef2ff, transparent 55%),
    radial-gradient(900px 500px at 110% 10%, #f5f3ff, transparent 50%), #f7f8fa; }
.login-shell { display: grid; grid-template-columns: 1fr 1fr; width: 100%; max-width: 780px;
  background: #fff; border: 1px solid var(--line); border-radius: 22px; overflow: hidden;
  box-shadow: var(--shadow-lg); }
.login-side { background: linear-gradient(160deg, #101a2e, #1d2a4a 55%, #312e81); color: #e0e7ff;
  padding: 38px 34px; display: flex; flex-direction: column; justify-content: space-between; }
.login-side .brand-mark { width: 42px; height: 42px; border-radius: 13px; font-size: 14px; }
.login-side h2 { color: #fff; font-size: 21px; letter-spacing: -.02em; margin-top: 26px; }
.login-side p { color: #a5b4fc; font-size: 13px; margin-top: 8px; }
.login-side ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; }
.login-side li { display: flex; gap: 10px; font-size: 12.5px; color: #c7d2fe; align-items: center; }
.login-side li .ic { color: #818cf8; }
.login-form { padding: 38px 36px; }
.login-form h1 { font-size: 20px; }
.login-form input { margin: 14px 0 12px; height: 40px; }
.login-form .btn { width: 100%; height: 40px; }
@media (max-width: 720px) { .login-shell { grid-template-columns: 1fr; }
  .login-side { display: none; } }

/* ------------------------------------------------------- invoice on web -- */
.inv-doc { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 32px 36px; box-shadow: var(--shadow-xs); position: relative; overflow: hidden; }
.inv-doc::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--brand), #7c3aed); }
.inv-head { display: flex; justify-content: space-between; gap: 26px;
  padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.inv-head h1 { font-size: 19px; }
.inv-title { text-align: right; }
.inv-title h2 { font-size: 12px; letter-spacing: .2em; color: var(--brand-600);
  font-weight: 680; margin: 0 0 10px; text-transform: uppercase; }
.inv-meta { margin-left: auto; width: auto; }
.inv-meta td { border: 0; padding: 2px 6px; font-size: 12.5px; white-space: nowrap;
  background: none; }
.inv-meta td:first-child { color: var(--muted); }
.inv-meta td:last-child { font-weight: 560; color: var(--ink-800);
  font-variant-numeric: tabular-nums; }
.inv-parties { display: flex; justify-content: space-between; gap: 30px; margin: 22px 0; }
.inv-parties .label { font-size: 10.5px; font-weight: 620; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted-2); margin-bottom: 5px; }
.inv-lines th { background: #f9fafb; }
.inv-lines td, .inv-lines th { padding: 10px 12px; }
.inv-lines td { font-size: 13px; }
.inv-totals { display: flex; justify-content: flex-end; margin-top: 16px; }
.inv-totals table { width: 300px; }
.inv-totals td { border: 0; padding: 5px 8px; font-size: 13px; color: var(--ink-600); }
.inv-totals td:last-child { text-align: right; font-variant-numeric: tabular-nums;
  font-weight: 550; color: var(--ink-800); }
.inv-totals tr.grand td { border-top: 2px solid var(--ink-900); font-weight: 660;
  font-size: 15px; color: var(--ink-900); padding-top: 9px; }
.inv-words { margin-top: 14px; font-size: 12.5px; background: #f9fafb;
  border: 1px dashed var(--line-strong); padding: 10px 12px; border-radius: var(--r); }
.inv-note { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.inv-foot { margin-top: 22px; font-size: 11.5px; color: var(--muted-2);
  border-top: 1px solid var(--line); padding-top: 12px; }
.stamp { position: absolute; top: 26px; right: 34px; transform: rotate(-6deg);
  border: 2px solid var(--green); color: var(--green); border-radius: 10px;
  padding: 4px 14px; font-size: 13px; font-weight: 700; letter-spacing: .18em;
  opacity: .55; pointer-events: none; }

@media print {
  .sidebar, .page-head, .actions, .save-bar, .chips, .toolbar, .flash { display: none !important; }
  main { padding: 0; max-width: none; }
  .inv-doc { border: 0; box-shadow: none; padding: 0; }
}

details.actions-more > summary { display: inline-flex; }
.attention-list li:last-child { padding-bottom: 4px; }
.card .empty { padding: 26px 12px; }

/* rendered markdown pages */
.doc { font-size: 14.5px; }
.doc h1 { font-size: 22px; margin-bottom: 14px; }
.doc h2 { font-size: 16px; margin: 26px 0 10px; padding-top: 6px; }
.doc h2:first-child { margin-top: 0; }
.doc h3 { font-size: 14px; margin: 18px 0 8px; }
.doc p, .doc li { line-height: 1.6; }
.doc ul, .doc ol { padding-left: 22px; margin: 8px 0; }
.doc li { margin: 4px 0; }
.doc table { margin: 12px 0; }
.doc code { white-space: nowrap; }
.doc strong { color: var(--ink-900); }
