/* TrueMedAI contract templates — shared print-first stylesheet.
   Aligned to the marketing site design system (MarketingWebsite/FrontEndWebSite/
   css/variables.css, base.css, components/privacy.css): Inter body, Fraunces
   display headings, teal-700 primary, coral accent, warm-white background.
   Presentation only — the agreement fingerprints (SHA-256) cover the HTML, not
   this file. */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Fraunces:ital,opsz,wght@0,9..144,600;0,9..144,700;1,9..144,600&family=Caveat:wght@500&display=swap');

:root {
  /* marketing site tokens (css/variables.css) */
  --teal-50:  #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-200: #99f6e4;
  --teal-400: #2dd4bf;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --teal-800: #115e59;
  --teal-900: #134e4a;
  --teal-950: #042f2e;
  --coral:    #ff6b6b;
  --coral-w:  #ff8c42;
  --warm-white: #fafaf8;
  --warm-100: #f5f5f4;
  --warm-200: #e7e5e4;
  --text-p: #1a1a2e;
  --text-s: #64748b;
  --text-m: #94a3b8;
  --border: rgba(0, 0, 0, 0.08);
  --sh-sm: 0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.04);
  --sh-md: 0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
  --r-sm: 8px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-f:  9999px;
  --ease: 0.3s cubic-bezier(.4, 0, .2, 1);

  /* contract-specific */
  --coral-50: #fff1f0;
  --field:    #fffbeb;
  --field-bd: #f5c26b;
  --field-ph: #b7852f;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--warm-white);
  color: var(--text-p);
  font: 16px/1.7 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Toolbar (screen only) — marketing legal hero gradient ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--teal-950) 0%, var(--teal-800) 100%);
  color: #fff;
  font-size: 14px;
}
.toolbar a { color: var(--teal-200); text-decoration: none; font-weight: 600; }
.toolbar a:hover { color: #fff; }
.toolbar strong { color: #fff; }
.toolbar .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  appearance: none; border: 1.5px solid transparent; border-radius: var(--r-f);
  padding: 8px 18px; cursor: pointer;
  font: 600 13px/1 'Inter', system-ui, sans-serif;
  transition: all var(--ease); white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
.btn-primary {
  background: linear-gradient(135deg, var(--teal-600), var(--teal-500));
  color: #fff; box-shadow: 0 4px 20px rgba(13,148,136,.4);
}
.btn-primary:hover { box-shadow: 0 8px 30px rgba(13,148,136,.5); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.btn-ghost:hover { border-color: #fff; background: rgba(255,255,255,.1); }
.save-status { font-size: 12px; color: rgba(255,255,255,.6); min-width: 90px; }

/* ---------- Page ---------- */
.page {
  max-width: 880px;
  margin: 32px auto 72px;
  padding: 56px 64px;
  background: #fff;
  border: 1px solid var(--warm-200);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-md);
}

.draft-banner {
  margin: 0 0 28px;
  padding: 12px 16px;
  border-left: 4px solid var(--coral);
  background: var(--coral-50);
  border-radius: var(--r-sm);
  font-size: 13px; line-height: 1.55;
  color: #9f1239;
}

.doc-head {
  display: flex; justify-content: space-between; gap: 24px; align-items: flex-start;
  border-bottom: 1px solid var(--warm-200); padding-bottom: 20px; margin-bottom: 32px;
}
.brand { font: 800 22px/1 'Inter', system-ui, sans-serif; color: var(--text-p); letter-spacing: -.02em; }
.brand span {
  background: linear-gradient(135deg, var(--teal-600), var(--teal-400));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub { font-size: 12px; line-height: 1.4; color: var(--text-s); margin-top: 6px; }
.doc-meta { font-size: 12px; line-height: 1.8; color: var(--text-s); text-align: right; }

h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 700; line-height: 1.15;
  color: var(--text-p); margin: 0 0 8px; letter-spacing: -.02em;
}
.subtitle { color: var(--text-s); margin: 0 0 32px; font-size: 1.05rem; line-height: 1.75; }
h2 {
  font-size: 1.15rem; font-weight: 700; line-height: 1.35;
  color: var(--text-p);
  margin: 40px 0 14px; padding-top: 28px;
  border-top: 1px solid var(--warm-200);
}
h3 { font-size: 1rem; font-weight: 700; line-height: 1.4; color: var(--teal-800); margin: 24px 0 8px; }
p { margin: 0 0 14px; color: var(--text-p); }
ol, ul { margin: 0 0 14px; padding-left: 22px; }
li { margin-bottom: 8px; }
a { color: var(--teal-700); font-weight: 500; text-underline-offset: 2px; }
a:hover { color: var(--teal-600); }
strong { color: var(--text-p); font-weight: 700; }
.muted { color: var(--text-s); }
.small { font-size: 13px; }

/* numbered clauses: 1.1, 1.2 … */
.clauses { counter-reset: clause; list-style: none; padding-left: 0; }
.clauses > li { counter-increment: clause; position: relative; padding-left: 46px; }
.clauses > li::before {
  content: attr(data-sec) "." counter(clause);
  position: absolute; left: 0; top: 0;
  font-size: 12px; font-weight: 700; line-height: 1.7rem; color: var(--teal-600);
}

.callout {
  margin: 18px 0; padding: 16px 20px;
  border-radius: var(--r-md); background: var(--teal-50); border: 1px solid var(--teal-100);
  font-size: 15px;
}
.callout.warn { background: var(--coral-50); border-color: #fecdd3; }
.callout strong:first-child {
  display: block; margin-bottom: 6px;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--teal-700);
}
.callout.warn strong:first-child { color: #be123c; }

/* ---------- Fillable blanks ---------- */
.blank, textarea.blank, select.blank {
  font: inherit; color: var(--teal-900);
  background: var(--field);
  border: 0; border-bottom: 1.5px solid var(--field-bd);
  border-radius: 4px 4px 0 0;
  padding: 1px 6px; margin: 0 2px;
  min-width: 120px; max-width: 100%;
  transition: background var(--ease), border-color var(--ease), box-shadow var(--ease);
}
.blank::placeholder { color: var(--field-ph); font-style: italic; opacity: 1; }
.blank:hover { background: #fef3c7; }
.blank:focus { outline: none; background: #fff; border-bottom-color: var(--teal-500); box-shadow: 0 2px 0 var(--teal-500); }
.blank[readonly] { cursor: default; }
.blank[readonly]:hover { background: var(--field); }
.blank.xs { width: 70px; min-width: 70px; }
.blank.sm { width: 140px; }
.blank.md { width: 240px; }
.blank.lg { width: 360px; }
.blank.full { display: block; width: 100%; margin: 6px 0; }
textarea.blank { display: block; width: 100%; min-height: 72px; padding: 10px; margin: 6px 0; resize: vertical; border: 1px solid var(--field-bd); border-radius: var(--r-sm); }
.blank.sig { font-family: Caveat, cursive; font-size: 26px; min-width: 240px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--teal-700); width: 16px; height: 16px; vertical-align: -2px; margin-right: 6px; }

.choice-group { display: grid; gap: 10px; margin: 12px 0 18px; }
.choice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 14px 16px; border: 1.5px solid var(--warm-200); border-radius: var(--r-md); background: #fff;
  cursor: pointer; transition: border-color var(--ease), background var(--ease), box-shadow var(--ease);
}
.choice:hover { border-color: var(--teal-400); box-shadow: var(--sh-sm); }
.choice:has(input:checked) { border-color: var(--teal-600); background: var(--teal-50); }
.choice input { margin-top: 5px; }
.choice b { font-size: 15px; font-weight: 700; color: var(--text-p); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 14px 0 20px; border: 1px solid var(--warm-200); border-radius: var(--r-md); }
table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.5; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--warm-200); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th { background: var(--warm-100); color: var(--text-s); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.total td { font-weight: 700; color: var(--teal-800); background: var(--teal-50); border-top: 1.5px solid var(--teal-200); }
table .blank { min-width: 60px; font-size: 14px; }

/* ---------- Grid of labelled fields ---------- */
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin: 14px 0 20px; }
.field label { display: block; font-size: 11px; font-weight: 700; line-height: 1.4; text-transform: uppercase; letter-spacing: .08em; color: var(--text-s); margin-bottom: 4px; }
.field .blank { width: 100%; margin: 0; }
.field.span2 { grid-column: 1 / -1; }

/* ---------- Signatures ---------- */
.sig-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 18px; page-break-inside: avoid; }
.sig-block { border: 1px solid var(--warm-200); border-radius: var(--r-md); padding: 18px 20px; background: #fff; box-shadow: var(--sh-sm); }
.sig-block h3 { margin-top: 0; }
.sig-block .field { margin-bottom: 10px; }

/* ---------- Index page cards ---------- */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 20px 0 8px; }
.card {
  display: block; padding: 20px 22px; border: 1px solid var(--warm-200); border-radius: var(--r-md);
  background: #fff; text-decoration: none; color: inherit; font-weight: 400; box-shadow: var(--sh-sm);
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}
.card:hover { transform: translateY(-3px); border-color: var(--teal-400); box-shadow: var(--sh-md); color: inherit; }
.card .tag {
  display: inline-flex; font-size: 11px; font-weight: 700; line-height: 1; letter-spacing: .08em; text-transform: uppercase;
  color: var(--teal-700); background: var(--teal-50); border: 1px solid var(--teal-100);
  border-radius: var(--r-f); padding: 5px 10px; margin-bottom: 10px;
}
.card h3 { margin: 0 0 6px; font-size: 17px; color: var(--text-p); }
.card p { margin: 0; font-size: 14px; color: var(--text-s); }

.checklist { list-style: none; padding-left: 0; }
.checklist li { position: relative; padding-left: 28px; }
.checklist li::before {
  content: "✓"; position: absolute; left: 0; top: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--teal-50); color: var(--teal-600);
  font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
}

footer.doc-foot { margin-top: 44px; padding-top: 16px; border-top: 1px solid var(--warm-200); font-size: 12px; line-height: 1.6; color: var(--text-m); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .page { margin: 0; padding: 28px 16px; border-radius: 0; border: 0; box-shadow: none; }
  .doc-head { flex-direction: column; }
  .doc-meta { text-align: left; }
  .fields, .sig-grid, .cards { grid-template-columns: 1fr; }
  .blank.md, .blank.lg { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .btn:hover, .card:hover { transform: none; }
}

/* ---------- Print ---------- */
@media print {
  @page { margin: 18mm 16mm; }
  body { background: #fff; font-size: 10.5pt; }
  .toolbar, .no-print { display: none !important; }
  .page { box-shadow: none; border: 0; margin: 0; padding: 0; max-width: none; }
  .brand span { color: var(--teal-700); -webkit-text-fill-color: var(--teal-700); background: none; }
  .blank, textarea.blank { background: transparent; border-bottom: 1px solid #555; box-shadow: none; }
  textarea.blank { border: 1px solid #999; }
  .blank::placeholder { color: transparent; }
  .choice, .card, .sig-block { border-color: #bbb; background: #fff !important; box-shadow: none; }
  h2 { page-break-after: avoid; }
  .sig-grid, table { page-break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
