/* Tooth Implant Co. — Expedientes. Same palette and type as the public site (paper · ink · antique gold). */
@font-face { font-family: "Urbanist"; src: url("/static/urbanist-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/static/manrope-latin.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  --paper: #fbfaf6; --paper-2: #f3f0e8; --card: #ffffff;
  --ink: #0e0d0b; --ink-2: #2a2824; --mute: #6f6a60;
  --gold: #a8844a; --gold-2: #c8a86c; --gold-3: #e6d4ab;
  --line: rgba(14, 13, 11, .12);
  --ok: #2f6b4a; --ok-bg: #e7f1ea; --err: #a1342b; --err-bg: #f8e6e3; --warn: #8a5a12; --warn-bg: #fbefd9;
  --head: "Urbanist", Arial, sans-serif; --sans: "Manrope", Arial, sans-serif;
  --r: 10px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: .2em; }
a:hover { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--head); margin: 0; letter-spacing: -.02em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 300; line-height: 1.1; }
h1 b { font-weight: 700; color: var(--gold); }
h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 14px; }
h3 { font-size: .95rem; font-weight: 700; margin: 18px 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--mute); }
.small { font-size: .84rem; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
.eyebrow { font: 700 .72rem/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; }
.eyebrow a { text-decoration: none; }
.count { font-family: var(--sans); font-size: .8rem; font-weight: 700; background: var(--paper-2); color: var(--mute); border-radius: 99px; padding: 2px 9px; vertical-align: middle; }
code.secret { font-size: .95rem; letter-spacing: .08em; background: var(--paper-2); padding: 2px 6px; border-radius: 6px; word-break: break-all; }

/* ---------- Header ---------- */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px; padding: 10px 24px; background: var(--ink); color: var(--paper); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { height: 34px; width: auto; }
.brand span { font: 300 1rem var(--head); letter-spacing: .02em; color: var(--gold-3); border-left: 1px solid rgba(255,255,255,.2); padding-left: 12px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a, .me a { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; text-decoration: none; color: rgba(251,250,246,.75); font-weight: 600; font-size: .9rem; white-space: nowrap; }
.nav a:hover, .me a:hover { color: var(--paper); background: rgba(255,255,255,.07); }
.nav a[aria-current] { color: var(--ink); background: var(--gold-3); }
.nav svg, .me svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.me { display: flex; align-items: center; gap: 6px; }
.me span { display: flex; flex-direction: column; line-height: 1.15; }
.me small { font-weight: 500; font-size: .72rem; color: var(--gold-2); }
.me .link { color: rgba(251,250,246,.7); }

.wrap { max-width: 1240px; margin: 0 auto; padding: 28px 24px 80px; }
.head, .patient-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.patient-head { align-items: flex-start; }
.patient-head .meta { margin: 6px 0 0; color: var(--ink-2); }
.patient-side { display: flex; flex-direction: column; gap: 12px; align-items: flex-end; }

/* ---------- Cards / grids ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; margin-bottom: 18px; }
.card.empty { text-align: center; color: var(--mute); padding: 40px 22px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 18px; align-items: start; }
.grid2 > .card { margin: 0; }
.grid2 + * { margin-top: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.stat span { display: block; font-size: .78rem; color: var(--mute); font-weight: 600; }
.stat strong { font: 700 1.5rem/1.2 var(--head); font-variant-numeric: tabular-nums; }
.stat.due strong, .balance.due strong { color: var(--err); }
.balance { text-align: right; }
.balance span { display: block; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--mute); }
.balance strong { font: 700 1.8rem/1.1 var(--head); }
.balance small { display: block; color: var(--mute); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; padding-top: 0; }

/* ---------- Alerts, tags, flash ---------- */
.alerts { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.alert { background: var(--err-bg); color: var(--err); font-weight: 700; font-size: .8rem; padding: 4px 10px; border-radius: 99px; }
.tag { display: inline-block; font-size: .74rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--paper-2); color: var(--ink-2); white-space: nowrap; }
.s-aceptado { background: #e8eef8; color: #2b4a7a; }
.s-en_proceso { background: var(--warn-bg); color: var(--warn); }
.s-terminado { background: var(--ok-bg); color: var(--ok); }
.s-cancelado { background: var(--err-bg); color: var(--err); }
.flash { padding: 12px 16px; border-radius: var(--r); margin-bottom: 18px; font-weight: 600; background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--err-bg); color: var(--err); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; font-weight: 600; color: var(--mute); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--gold); }
.tabs a span { font-size: .75rem; background: var(--paper-2); border-radius: 99px; padding: 1px 7px; margin-left: 4px; }

/* ---------- Forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 700 .9rem var(--sans); padding: 10px 18px; border-radius: 8px; border: 1px solid var(--ink); background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--gold); color: var(--gold); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn.ghost { border-color: var(--line); }
.btn.sm { padding: 6px 12px; font-size: .8rem; }
.btn:disabled { opacity: .5; cursor: progress; }
.link { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: inherit; text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
.link.danger, .danger { color: var(--err); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: .8rem; font-weight: 700; color: var(--ink-2); }
.field small { color: var(--mute); font-size: .76rem; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
input, select, textarea { font: inherit; color: inherit; width: 100%; padding: 10px 12px; border: 1px solid rgba(14,13,11,.22); border-radius: 8px; background: #fff; min-width: 0; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-2); outline-offset: 0; border-color: var(--gold); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.checks { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-bottom: 16px; padding: 12px 14px; background: var(--paper); border-radius: 8px; }
.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 14px; }
.cols .wide { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.form .card .field + .field, .card > .cols + .field { margin-top: 14px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form > .actions { position: sticky; bottom: 0; background: var(--paper); padding: 14px 0; border-top: 1px solid var(--line); }
.search { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.search input[type=search] { flex: 1; min-width: 200px; }
.search select { width: auto; }
.search.big input { padding: 14px 16px; font-size: 1.05rem; }
.row-edit summary { list-style: none; }
.row-edit summary::-webkit-details-marker { display: none; }
.row-edit[open] { position: relative; }
.row-edit[open] > form { position: absolute; right: 0; z-index: 5; width: min(92vw, 640px); margin-top: 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: 0 20px 50px rgba(14,13,11,.18); }
.danger-zone { margin-top: 8px; }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--mute); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:hover { background: var(--paper); }
.table tfoot td { font-weight: 700; border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table a { text-decoration: none; }
.table a:hover { text-decoration: underline; }
tr.voided td { color: var(--mute); text-decoration: line-through; text-decoration-color: rgba(161,52,43,.4); }
tr.voided td:last-child { text-decoration: none; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 18px 0; }

/* ---------- Definition lists, notes ---------- */
.dl { margin: 0; display: grid; gap: 10px; }
.dl div { display: grid; grid-template-columns: 170px 1fr; gap: 12px; }
.dl dt { color: var(--mute); font-size: .84rem; font-weight: 600; }
.dl dd { margin: 0; white-space: pre-wrap; }
.dl.two { grid-template-columns: 1fr 1fr; }
.dl.two div { grid-template-columns: 1fr; gap: 0; }
.notes { list-style: none; margin: 0; padding: 0; }
.notes li { padding: 16px 0; border-top: 1px solid var(--line); }
.notes li:first-child { border-top: 0; padding-top: 0; }
.notes header { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin-bottom: 6px; }
.note-body { white-space: pre-wrap; }

/* ---------- Documents ---------- */
.drop { position: relative; border: 2px dashed rgba(14,13,11,.2); border-radius: var(--r); padding: 26px; text-align: center; background: var(--paper); transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--gold); background: #fffaf0; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop label { cursor: pointer; }
.drop .picked { margin-top: 8px; font-weight: 600; }
.upload-status { font-weight: 600; }
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.doc { margin: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--paper); display: flex; flex-direction: column; }
.doc > a { display: block; aspect-ratio: 4 / 3; background: var(--paper-2); }
.doc img { width: 100%; height: 100%; object-fit: cover; }
.doc .file { display: grid; place-items: center; height: 100%; font: 700 1.3rem var(--head); color: var(--gold); letter-spacing: .1em; }
.doc figcaption { padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; font-size: .86rem; }
.doc figcaption strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Auth ---------- */
.bare { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth { width: min(100%, 420px); background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 34px 30px; }
.auth > img { height: 54px; width: auto; margin-bottom: 18px; }
.auth h1 { font-size: 1.7rem; margin-bottom: 18px; }
.auth form + form { margin-top: 10px; }
.steps { padding-left: 20px; margin: 0 0 10px; }
.qr { width: 200px; margin: 6px auto 12px; }

/* ---------- Statement (print) ---------- */
.print-page { background: #fff; }
.statement { max-width: 820px; margin: 0 auto; padding: 32px 24px; }
.statement > header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; border-bottom: 2px solid var(--ink); padding-bottom: 16px; margin: 18px 0 22px; }
.statement address { font-style: normal; font-size: .82rem; text-align: right; color: var(--ink-2); }
.statement h1 { font-size: 1.7rem; font-weight: 700; margin-bottom: 18px; }
.statement h1 span { display: block; font-size: .9rem; font-weight: 400; color: var(--mute); }
.statement h2 { margin-top: 26px; }
.statement tr.due td { font-size: 1.1rem; border-top: 2px solid var(--ink); }
@media print {
  .no-print { display: none !important; }
  .statement { padding: 0; }
  body { font-size: 12px; }
}

@media (max-width: 900px) {
  .top { flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px; }
  .nav { order: 3; flex-basis: 100%; }
  .nav span { display: none; }
  .nav a { padding: 8px 10px; }
  .me { margin-left: auto; }
  .me span { display: none; }
  .wrap { padding: 20px 16px 80px; }
  .patient-side { align-items: flex-start; }
  .balance { text-align: left; }
  .dl div { grid-template-columns: 1fr; gap: 2px; }
  .card { padding: 18px 16px; }
}
@media (max-width: 1100px) and (min-width: 901px) { .nav span { display: none; } }
