/* ============================================================
   Atlanta Center for TMJ — Face Pain Decision App
   Clinical/professional palette: deep slate + warm copper accent
   ============================================================ */

:root {
  /* Atlanta Center for TMJ palette — light blue + navy */
  --bg:        #f4f8fb;   /* very light blue-tinted surface */
  --surface:   #ffffff;
  --ink:       #0f2b52;   /* deep navy from logo wordmark */
  --ink-2:     #2d4670;
  --muted:     #6b7a92;
  --line:      #dbe6f0;
  --line-2:    #c4d5e6;
  --accent:    #3aa8dc;   /* bright light blue from logo mark */
  --accent-2:  #1e7ab0;   /* deeper light blue for hover / text */
  --accent-soft:#e6f3fb;  /* pale blue wash */
  --success:   #2f6b4f;
  --focus:     #3aa8dc;
  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 1px 2px rgba(15,43,82,.05), 0 6px 20px -8px rgba(15,43,82,.10);
  --shadow-lg: 0 2px 6px rgba(15,43,82,.06), 0 20px 40px -16px rgba(15,43,82,.15);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
h1 { font-size: 26px; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 0 0 14px; }
h3 { font-size: 15px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .08em; font-family: 'Inter', sans-serif; font-weight: 600; color: var(--ink-2); }
h4 { font-size: 13px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .06em; font-family: 'Inter', sans-serif; font-weight: 600; color: var(--muted); }
p  { margin: 0 0 10px; color: var(--ink-2); }
.lede { color: var(--muted); font-size: 14.5px; max-width: 720px; }
.hint { color: var(--muted); font-size: 13px; margin: -6px 0 12px; }
.fine { color: var(--muted); font-size: 12px; margin-top: 10px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.num   { text-align: right; font-variant-numeric: tabular-nums; font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* ---------- HEADER ---------- */
.app-header {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 28px;
  min-height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 14px; color: var(--ink); min-width: 0; }
.brand-logo { height: 34px; width: auto; max-width: 175px; object-fit: contain; flex: none; display: block; }
.brand-name { font-family: 'Fraunces', serif; font-weight: 600; font-size: 14px; line-height: 1.1; color: var(--ink); }
.brand-sub  { font-size: 10.5px; color: var(--accent-2); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-top: 2px; }
.step-nav { display: flex; gap: 6px; flex: 1; margin-left: 16px; flex-wrap: wrap; }
.step {
  font-size: 12px; padding: 6px 12px; border-radius: 999px;
  background: transparent; color: var(--muted);
  border: 1px solid transparent; letter-spacing: .02em;
}
.step.active { background: var(--ink); color: #fff; }
.step.done   { color: var(--ink); border-color: var(--line-2); }

/* ---------- MAIN + VIEWS ---------- */
.app-main { max-width: 1080px; margin: 0 auto; padding: 32px 24px 80px; }
.view-head { margin-bottom: 20px; }

/* ---------- CARDS + FORMS ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 780px) { .grid-2 { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field label {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600;
}
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font: inherit; color: var(--ink); background: #fbfdfe;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(58,168,220,.20);
  background: #fff;
}

/* chips */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  border: 1px solid var(--line-2); background: #fbfdfe;
  padding: 7px 12px; border-radius: 999px;
  font: inherit; font-size: 13px; color: var(--ink-2);
  cursor: pointer; transition: all .12s;
}
.chip:hover  { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.chip.selected {
  background: var(--ink); color: #fff; border-color: var(--ink);
}

/* diagnosis + treatment grids */
.dx-grid, .tx-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px;
  margin-bottom: 12px;
}
@media (max-width: 780px) { .dx-grid, .tx-grid { grid-template-columns: 1fr; } }
.dx-item, .tx-item {
  display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start;
  padding: 8px 10px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .12s;
}
.dx-item:hover, .tx-item:hover { background: var(--accent-soft); }
.dx-item input, .tx-item input { margin-top: 3px; accent-color: var(--accent); }
.dx-item .dx-code, .tx-item .tx-code {
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  color: var(--accent-2); font-weight: 600; letter-spacing: .02em;
}
.dx-item .dx-desc, .tx-item .tx-desc { font-size: 14px; color: var(--ink); }
.tx-item .tx-fee { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- CTA / BUTTONS ---------- */
.cta-row {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 20px; flex-wrap: wrap;
}
.btn-primary, .btn-ghost {
  font: inherit; font-weight: 600; font-size: 14px;
  padding: 11px 20px; border-radius: var(--radius-sm);
  cursor: pointer; transition: all .12s; border: 1px solid transparent;
}
.btn-primary {
  background: var(--ink); color: #fff;
}
.btn-primary:hover { background: #081d3a; transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-ghost {
  background: transparent; color: var(--ink); border-color: var(--line-2);
}
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }

/* ---------- BRANCH CARDS ---------- */
.branch-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 900px) { .branch-grid { grid-template-columns: 1fr; } }
.branch-card {
  text-align: left; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; cursor: pointer;
  box-shadow: var(--shadow);
  transition: all .15s; font: inherit;
  display: flex; flex-direction: column; gap: 8px;
}
.branch-card:hover {
  border-color: var(--accent); transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.branch-num {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif; font-size: 15px; font-weight: 600;
  margin-bottom: 4px;
}
.branch-card h3 {
  font-family: 'Fraunces', serif; text-transform: none; letter-spacing: -0.01em;
  font-size: 17px; color: var(--ink); margin: 0;
}
.branch-card p { color: var(--muted); font-size: 13.5px; margin: 0; }

/* ============================================================
   PRINTABLE SHEET
   ============================================================ */
.sheet {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px 48px; margin: 0 auto 20px;
  max-width: 820px; box-shadow: var(--shadow-lg);
  color: #1c2434;
}
.sheet-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding-bottom: 16px; border-bottom: 2px solid var(--ink); margin-bottom: 22px;
  gap: 20px;
}
.sheet-brand-block { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.sheet-logo { height: 42px; width: auto; max-width: 220px; object-fit: contain; display: block; }
.sheet-brand-text { display: block; }
.sheet-brand-text .sheet-brand { display: none; }  /* logo already contains the wordmark */
.sheet-brand-text .sheet-sub { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-2); font-weight: 600; }
.sheet-office { font-size: 10.5px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.sheet-brand {
  font-family: 'Fraunces', serif; font-size: 20px; font-weight: 600;
  color: var(--ink); letter-spacing: -0.01em;
}
.sheet-sub { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-2); margin-top: 4px; font-weight: 600; }
.sheet-meta {
  font-size: 12px; text-align: right; color: var(--ink-2);
  min-width: 200px;
}
.sheet-meta div { margin-bottom: 3px; }
.sheet-meta span { color: var(--muted); }

.sheet-block { margin-bottom: 22px; }
.sheet-block h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent-2); margin-bottom: 10px;
  padding-bottom: 4px; border-bottom: 1px solid var(--line);
}

.clean-list { margin: 0; padding: 0; list-style: none; }
.clean-list li {
  padding: 4px 0; font-size: 14px; color: var(--ink);
}
.clean-list li .code {
  font-family: 'JetBrains Mono', monospace; font-size: 12.5px;
  color: var(--accent-2); font-weight: 600; margin-right: 10px;
}

.fee-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.fee-table th, .fee-table td {
  padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line);
}
.fee-table thead th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--ink-2);
}
.fee-table tbody td.code { font-family: 'JetBrains Mono', monospace; color: var(--accent-2); font-weight: 600; font-size: 12.5px; }
.fee-table tfoot th { font-size: 13px; border-top: 2px solid var(--ink); border-bottom: none; padding-top: 14px; }

.sheet-foot {
  display: grid; grid-template-columns: 2fr 1fr; gap: 24px;
  margin-top: 40px; padding-top: 20px;
}
.sheet-foot:has(.sig-block:nth-child(3)) { grid-template-columns: 2fr 1fr 2fr; }
.sig-block { display: flex; flex-direction: column; }
.sig-line { border-bottom: 1px solid var(--ink); height: 32px; }
.sig-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 6px; }

.notes-field {
  width: 100%; min-height: 80px;
  border: 1px dashed var(--line-2); border-radius: var(--radius-sm);
  background: #fbfdfe; padding: 10px 12px; font: inherit; color: var(--ink);
  resize: vertical;
}
.notes-field:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(58,168,220,.15); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

.ol-clean { margin: 0; padding-left: 20px; }
.ol-clean li { margin-bottom: 8px; font-size: 13.5px; }
.ol-clean.questions li { margin-bottom: 10px; }

.return-form { width: 100%; border-collapse: collapse; font-size: 13px; }
.return-form th, .return-form td {
  padding: 10px 12px; text-align: left; border: 1px solid var(--line-2);
  vertical-align: top;
}
.return-form th {
  background: var(--accent-soft); font-weight: 600; color: var(--ink-2);
  width: 40%; font-size: 12.5px;
}
.return-form td { min-height: 30px; background: #fff; }

.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li {
  display: grid; grid-template-columns: 24px 1fr; align-items: start; gap: 10px;
  padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--line);
}
.check-list .cb {
  display: inline-block; width: 16px; height: 16px;
  border: 1.5px solid var(--ink-2); border-radius: 3px; margin-top: 2px;
}

.ack { padding-left: 20px; }
.ack li { margin-bottom: 6px; font-size: 13.5px; }

/* ---------- PRINT ---------- */
@media print {
  @page { size: letter; margin: 0.5in; }
  body { background: #fff; font-size: 12px; }
  .no-print, .app-header { display: none !important; }
  .app-main { padding: 0; max-width: none; }
  .view { display: block !important; }
  /* Hide all views not being printed */
  .view[hidden] { display: none !important; }
  .sheet {
    box-shadow: none; border: none; margin: 0; padding: 0;
    max-width: none;
  }
  .sheet-head { break-inside: avoid; }
  .sheet-block { break-inside: avoid; }
  .page-break { break-before: page; page-break-before: always; }
  .notes-field {
    border: none; background: #fff; padding: 0;
  }
  h1, h2, h3, h4 { break-after: avoid; }
  .fee-table { break-inside: auto; }
  .fee-table tr { break-inside: avoid; }
}
