/* Design tokens ported from ../../assets/app.css (the private-practice
   FollowOps app) — same restrained neutral black/white/gray structure,
   6px radius, soft pastel status triples, bordered "ghost" controls with
   one bold primary action per view. Deliberately copied rather than
   `@import`ed: this app deploys to its own subdomain/docroot with no
   runtime dependency on the parent app's assets (same reasoning as
   ../../recall/assets/recall.css).

   Indigo accent: --primary swaps from the practice app's teal-blue and
   recall's clay/bronze to indigo (#4338ca — WCAG contrast ~8.6:1 against
   white). Third product under the FollowOps umbrella, third distinct
   accent — lets anyone glance at a screenshot and tell which deployment
   they're looking at, while keeping the same quiet, mostly-neutral
   visual language as both sibling apps. */
:root{
  --black:#111;
  --muted:#6b7280;
  --border:#e5e7eb;
  --bg:#f6f6fb;
  --white:#fff;
  --radius:6px;
  --primary:#4338ca;--primary-bg:#eef2ff;--primary-border:#c7d2fe;
  --success-bg:#f0fdf4;--success-border:#bbf7d0;--success-text:#166534;
  --error-bg:#fef2f2;--error-border:#fecaca;--error-text:#991b1b;
  --warning-bg:#fffbeb;--warning-border:#fde68a;--warning-text:#92400e;
  --max-w:1200px;
}
*,*::before,*::after{box-sizing:border-box}
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;background:var(--bg);color:var(--black);font-size:1rem;line-height:1.6}
h1,h2,h3{font-weight:600;letter-spacing:-0.01em;margin:0}
a{color:inherit}

/* Header (nav) */
header{background:var(--white);border-bottom:1px solid var(--border);padding:0 28px;min-height:60px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:14px}
header .brand{display:flex;align-items:center}
.logo-dot{width:10px;height:10px;border-radius:50%;background:var(--primary);margin-right:9px;flex:none}
header strong{font-size:0.9375rem;font-weight:600;letter-spacing:-0.01em;color:var(--black);margin-right:12px}
header span{color:var(--muted);font-size:0.875rem}
.actions{display:flex;align-items:center;gap:10px;padding:10px 0}
.actions a{font-size:0.875rem;font-weight:500;color:var(--muted);text-decoration:none;padding:7px 4px;border-radius:4px}
.actions a:hover{color:var(--black)}
.actions a:focus-visible{outline:2px solid var(--primary);outline-offset:2px}

main{max-width:var(--max-w);margin:25px auto;padding:0 18px}

/* Buttons — bordered "ghost" style by default; .primary is the one bold
   action per view, in the module's accent. */
button{font:inherit;font-size:0.875rem;font-weight:500;color:var(--black);background:var(--white);border:1px solid var(--border);border-radius:var(--radius);padding:8px 14px;cursor:pointer;transition:border-color .15s,opacity .15s;min-height:36px}
button:hover{border-color:var(--black)}
button:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
button:disabled{opacity:.45;cursor:not-allowed}
button.primary{background:var(--primary);color:var(--white);border-color:var(--primary)}
button.primary:hover:not(:disabled){opacity:.85;border-color:var(--primary)}
button.ghostlink{border:none;background:none;color:var(--primary);padding:4px 0;min-height:auto;text-decoration:underline}

td button{padding:5px 10px;font-size:0.8125rem;min-height:auto}

/* KPI cards */
.cards{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:18px}
.card,.panel{background:var(--white);border:1px solid var(--border);border-radius:8px}
.card{padding:18px}
.card small{display:block;color:var(--muted);font-size:0.8125rem}
.card b{font-size:1.875rem;font-weight:600;letter-spacing:-0.02em;display:block;margin-top:5px;color:var(--black)}
.card.clickable{cursor:pointer;transition:border-color .15s,background .15s}
.card.clickable:not(.alert):not(.good):hover{border-color:var(--primary)}
.card.clickable:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
.card.alert{background:var(--error-bg);border-color:var(--error-border)}
.card.alert b{color:var(--error-text)}
.card.good{background:var(--success-bg);border-color:var(--success-border)}
.card.good b{color:var(--success-text)}

/* Panel / toolbar / table */
.panel{overflow:hidden}
.toolbar{padding:14px;border-bottom:1px solid var(--border);display:flex;gap:8px;flex-wrap:wrap}
.toolbar input{flex:1;min-width:200px}
.tablewrap{overflow:auto}
table{width:100%;border-collapse:collapse}
th,td{text-align:left;padding:12px 14px;border-bottom:1px solid var(--border);white-space:nowrap}
th{background:var(--bg);color:var(--muted);font-size:0.75rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em}

/* Status pills — same soft-bg/border/text triples as the practice app,
   mapped onto the invoice lifecycle: draft=neutral, generated=warning
   (ready but not sent), sent=primary tint (in flight), paid=success,
   unpaid=error, partial=warning (needs the same attention as generated). */
.pill{padding:3px 10px;border-radius:100px;font-size:0.75rem;font-weight:500;border:1px solid transparent}
.draft{background:var(--bg);border-color:var(--border);color:var(--muted)}
.generated{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}
.sent{background:var(--primary-bg);border-color:var(--primary-border);color:var(--primary)}
.paid{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}
.unpaid{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}
.partial{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}

/* Modal */
.modal{position:fixed;inset:0;background:rgba(0,0,0,.4);display:grid;place-items:center;padding:20px;z-index:100}
.hidden{display:none}
.dialog{background:var(--white);border:1px solid var(--border);width:min(600px,100%);border-radius:8px;padding:28px;max-height:90vh;overflow:auto}
.dialog.wide{width:min(920px,95vw)}
.dialoghead{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:4px}
.dialoghead h2{font-size:1.25rem}
.dialoghead button{background:none;border:none;color:var(--muted);font-size:1.25rem;cursor:pointer;padding:4px;border-radius:4px;line-height:1;min-width:44px;min-height:44px;display:flex;align-items:center;justify-content:center}
.dialoghead button:hover{color:var(--black);border-color:transparent}

/* Forms */
form{display:grid;gap:14px}
label{display:grid;gap:6px;font-weight:500;font-size:0.875rem}
input[type="text"],input[type="email"],input[type="password"],input[type="tel"],input[type="date"],input[type="number"],
.toolbar input,.toolbar select,form input,form select,textarea{
  width:100%;padding:9px 12px;font-size:0.9375rem;color:var(--black);background:var(--white);
  border:1px solid var(--border);border-radius:var(--radius);transition:border-color .15s;font-family:inherit;
}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--primary);box-shadow:0 0 0 3px var(--primary-bg)}
input::placeholder,textarea::placeholder{color:#9ca3af}
input[readonly]{background:var(--bg);color:var(--muted)}
textarea{min-height:90px;resize:vertical}
.formactions{display:flex;justify-content:flex-end;gap:8px;margin-top:4px}

/* Line item required-field error state — the ICD-10-per-line rule is the
   single most important UX constraint in this app, so it gets a visible
   state beyond the generic alert() the rest of the codebase uses. */
input.error,select.error{border-color:var(--error-text);box-shadow:0 0 0 3px var(--error-bg)}
.fielderror{color:var(--error-text);font-size:0.75rem;margin-top:2px}
.required-mark{color:var(--error-text);font-weight:600;font-size:0.75rem}

/* Invoice line-item rows — a bordered card per line, not a dense table
   row, since each line needs date/tariff/ICD-10(x3)/NAPPI/qty/rate all
   visible at once. */
.lineitem{border:1px solid var(--border);border-radius:8px;padding:16px;margin-bottom:12px;background:var(--bg)}
.lineitem .linehead{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}
.lineitem .linehead b{font-size:0.8125rem;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}
.linegrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px}
.linetotal{text-align:right;font-weight:600;margin-top:8px}
.typeahead{position:relative}
.typeahead .results{position:absolute;top:100%;left:0;right:0;background:var(--white);border:1px solid var(--border);border-radius:var(--radius);max-height:220px;overflow:auto;z-index:10;box-shadow:0 4px 12px rgba(0,0,0,.08)}
.typeahead .results div{padding:8px 12px;cursor:pointer;font-size:0.875rem}
.typeahead .results div:hover{background:var(--primary-bg)}

/* Tabs (settings.php: Practice / Tariffs / NAPPI) */
.tabs{display:flex;gap:8px;margin:16px 0 4px}
.tab{font-size:0.8125rem;font-weight:500;color:var(--black);background:var(--white);border:1px solid var(--border);border-radius:100px;padding:6px 16px;cursor:pointer;transition:border-color .15s,background .15s,color .15s;min-height:auto}
.tab:hover{border-color:var(--primary)}
.tab.active{background:var(--primary);color:var(--white);border-color:var(--primary)}
.tab:focus-visible{outline:2px solid var(--primary);outline-offset:2px}

.muted{color:var(--muted);font-size:0.8125rem;margin:4px 0 0}

@media(max-width:800px){
  .cards{grid-template-columns:repeat(2,1fr)}
  header{padding:14px 20px}
  .toolbar{flex-wrap:wrap}
  .toolbar input{min-width:100%}
}
