/* MG Odontologia & Estética — identidade do site (marfim, grafite e dourado; Outfit) */
@font-face {
  font-family: 'Outfit';
  src: url('/fonts/outfit.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  /* paleta do site */
  --paper: #f4efe7;
  --ivory: #fbf8f3;
  --sand: #e9e0d1;
  --stone: #d3c6b0;
  --ink: #1d1e1a;
  --muted: #67635a;
  --gold: #b08d3e;
  --gold-deep: #7a6027;
  --gold-soft: #dcc690;
  --gold-wash: #f3ead8;
  --night: #171814;
  --night-2: #22231e;
  --on-night: #f1ebdf;
  --on-night-muted: #f1ebdfa8;
  --wine: #9a3d36;
  --wine-wash: #f6e7e2;
  --sage: #4f6b4f;
  --sage-wash: #e6ece2;

  /* nomes usados pelo sistema (mapeados para a paleta) */
  --porcelain: var(--paper);
  --surface: var(--ivory);
  --ink-soft: var(--muted);
  --line: #1d1e1a1c;
  --line-strong: #1d1e1a33;
  --teal: var(--gold-deep);
  --teal-strong: #5f4a1d;
  --teal-wash: var(--gold-wash);
  --gum: var(--wine);
  --gum-wash: var(--wine-wash);
  --amber: var(--gold-deep);
  --amber-wash: var(--gold-wash);

  --radius-s: 10px;
  --radius-m: 18px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px #1d1e1a0d, 0 12px 32px -12px #1d1e1a26;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --font-ui: 'Outfit', 'Helvetica Neue', Arial, system-ui, sans-serif;
  --font-display: var(--font-ui);
  --rail: 236px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 400 15px/1.55 var(--font-ui);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; margin: 0; font-weight: 300; letter-spacing: -.025em; }
h1 { font-size: 2.1rem; }
h2 { font-size: 1.45rem; letter-spacing: -.015em; }
h3 { font-size: 1.1rem; font-weight: 400; letter-spacing: -.01em; }
a { color: var(--gold-deep); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::selection { background: var(--gold-soft); color: var(--ink); }
b, strong { font-weight: 500; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 12px; font-size: .7rem; font-weight: 500;
  letter-spacing: .2em; text-transform: uppercase; color: var(--gold-deep);
}
.eyebrow::before { content: ''; width: 28px; height: 1px; background: currentColor; }

/* ---------- Estrutura ---------- */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail {
  background: var(--night);
  color: var(--on-night-muted);
  padding: 26px 16px 20px;
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh;
  background-image: radial-gradient(120% 60% at 0% 0%, #b08d3e1f, transparent 60%);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 26px; text-decoration: none; }
.brand img { width: 62px; height: auto; display: block; }
.brand .bt { border-left: 1px solid #b08d3e66; padding-left: 12px; font-size: .62rem; font-weight: 500; letter-spacing: .22em; text-transform: uppercase; color: var(--on-night); line-height: 1.7; }
.rail a {
  color: inherit; text-decoration: none; padding: 10px 14px; border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 300; letter-spacing: .01em;
  transition: background .25s var(--ease), color .25s var(--ease);
}
.rail a:hover { background: #f1ebdf0f; color: var(--on-night); }
.rail a.active { background: var(--night-2); color: var(--on-night); box-shadow: inset 0 0 0 1px #b08d3e40; }
.rail a.active .full::before { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); margin-right: 10px; vertical-align: 2px; }
.rail .spacer { flex: 1; }
.rail .short { display: none; }
.narrow-only { display: none !important; }
.rail .who { padding: 12px 14px 4px; font-size: .8rem; color: var(--on-night-muted); border-top: 1px solid #f1ebdf1f; margin-top: 8px; }
.badge { background: var(--gold); color: var(--night); border-radius: 99px; padding: 0 7px; font-size: .72rem; font-weight: 600; min-width: 20px; text-align: center; }
main { padding: 34px 40px 64px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }

/* ---------- Controles ---------- */
.btn {
  border: 1px solid var(--line-strong); background: transparent; padding: 9px 18px; border-radius: var(--radius-pill);
  cursor: pointer; font-weight: 500; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--ink); text-decoration: none;
  transition: background .25s var(--ease), border-color .25s var(--ease), color .25s var(--ease);
}
.btn:hover { border-color: var(--ink); background: #1d1e1a08; }
.btn.primary { background: var(--ink); color: var(--ivory); border-color: var(--ink); }
.btn.primary:hover { background: var(--night-2); border-color: var(--gold); }
.btn.danger { color: var(--wine); border-color: #9a3d3655; }
.btn.danger:hover { background: var(--wine-wash); border-color: var(--wine); }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover { border-color: var(--line-strong); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
label.field { display: grid; gap: 6px; font-size: .72rem; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
label.field > input, label.field > select, label.field > textarea { text-transform: none; letter-spacing: normal; font-size: .95rem; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  border: 1px solid var(--line-strong); background: var(--ivory); border-radius: var(--radius-s); padding: 10px 12px; width: 100%;
  color: var(--ink); font-weight: 400; transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
input:not([type=checkbox]):not([type=radio]):focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px #b08d3e26; }
input[type=checkbox], input[type=radio] { accent-color: var(--gold-deep); }
textarea { min-height: 70px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stack { display: grid; gap: 14px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; color: var(--ink); text-transform: none; letter-spacing: normal; font-size: .92rem; }
.panel { background: var(--ivory); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 22px; box-shadow: var(--shadow); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); overflow: hidden; background: var(--ivory); padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; cursor: pointer; border-radius: var(--radius-pill); font-size: .88rem; }
.seg button.on { background: var(--ink); color: var(--ivory); }

/* ---------- Agenda ---------- */
.day-title { font-size: 2.6rem; font-weight: 250; letter-spacing: -.035em; }
.day-title small { display: block; font: 500 .7rem var(--font-ui); color: var(--gold-deep); letter-spacing: .2em; text-transform: uppercase; margin-top: 8px; }
.agenda-wrap { background: var(--ivory); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: auto; max-height: calc(100vh - 200px); box-shadow: var(--shadow); }
.agenda { display: grid; position: relative; min-width: fit-content; }
.agenda .col-head {
  position: sticky; top: 0; z-index: 3; background: var(--ivory); border-bottom: 1px solid var(--line);
  padding: 12px 14px; font-weight: 400; display: flex; align-items: center; gap: 8px; min-width: 190px;
}
.agenda .col-head i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.agenda .corner { position: sticky; left: 0; top: 0; z-index: 4; background: var(--ivory); border-bottom: 1px solid var(--line); }
.agenda .times { position: sticky; left: 0; z-index: 2; background: var(--ivory); border-right: 1px solid var(--line); }
.agenda .times div { font-size: .74rem; color: var(--muted); text-align: right; padding-right: 10px; transform: translateY(-.6em); font-variant-numeric: tabular-nums; }
.agenda .col { position: relative; border-right: 1px solid var(--line); cursor: copy; }
.agenda .col .off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, #e9e0d180 0 6px, transparent 6px 12px); pointer-events: none; }
.agenda .col .off.blocked { background: repeating-linear-gradient(135deg, #9a3d361a 0 6px, transparent 6px 12px); }
.agenda .hline { position: absolute; left: 0; right: 0; border-top: 1px solid #1d1e1a0f; pointer-events: none; }
.agenda .now { position: absolute; left: 0; right: 0; border-top: 1.5px solid var(--gold); z-index: 2; pointer-events: none; }
.agenda .now::before { content: ''; position: absolute; left: -4px; top: -4.5px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.appt {
  position: absolute; left: 4px; right: 4px; border-radius: 10px; padding: 5px 9px; overflow: hidden;
  border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 12%, var(--ivory)); cursor: pointer;
  font-size: .8rem; line-height: 1.3; z-index: 1; text-align: left; border-top: 0; border-right: 0; border-bottom: 0;
  transition: background .2s var(--ease), box-shadow .2s var(--ease);
}
.appt:hover { background: color-mix(in srgb, var(--c) 20%, var(--ivory)); box-shadow: 0 6px 16px -8px #1d1e1a40; }
.appt b { display: block; font-size: .86rem; font-weight: 500; }
.appt.st-confirmed b::after { content: ' ✓'; color: var(--sage); }
.appt.st-done { opacity: .6; }
.appt.st-no_show { background: var(--wine-wash); border-left-color: var(--wine); }
.appt.st-canceled { opacity: .45; text-decoration: line-through; }

.list-day { display: grid; gap: 10px; }
.list-item {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; background: var(--ivory);
  border: 1px solid var(--line); border-left: 3px solid var(--c); border-radius: var(--radius-s); padding: 12px 14px; cursor: pointer; text-align: left;
  transition: box-shadow .2s var(--ease);
}
.list-item:hover { box-shadow: var(--shadow); }
.list-item .t { font-family: var(--font-display); font-size: 1.2rem; font-weight: 300; font-variant-numeric: tabular-nums; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .72rem; font-weight: 500; letter-spacing: .04em; background: var(--sage-wash); color: var(--sage); }
.pill.scheduled { background: var(--sand); color: var(--muted); }
.pill.no_show, .pill.canceled { background: var(--wine-wash); color: var(--wine); }
.pill.done { background: #1d1e1a12; color: var(--ink); }
.pill.agent { background: var(--gold-wash); color: var(--gold-deep); }

/* ---------- Tabelas ---------- */
table { width: 100%; border-collapse: collapse; background: var(--ivory); }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .68rem; color: var(--muted); font-weight: 500; letter-spacing: .16em; text-transform: uppercase; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #e9e0d14d; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius-m); overflow: auto; box-shadow: var(--shadow); }
.table-wrap table tr:last-child td { border-bottom: 0; }

/* ---------- Horários (chips) ---------- */
.slots { display: grid; gap: 12px; max-height: 260px; overflow: auto; padding: 2px; }
.slots .who { font-weight: 500; font-size: .9rem; display: flex; gap: 6px; align-items: center; }
.slots .who i { width: 8px; height: 8px; border-radius: 50%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip { border: 1px solid var(--line-strong); background: var(--ivory); border-radius: var(--radius-pill); padding: 5px 12px; cursor: pointer; font-variant-numeric: tabular-nums; transition: all .2s var(--ease); }
.chip:hover { border-color: var(--gold); }
.chip.on { background: var(--ink); color: var(--ivory); border-color: var(--ink); }

/* ---------- Painel ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.stat { background: var(--ivory); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat::after { content: ''; position: absolute; left: 20px; top: 0; width: 28px; height: 2px; background: var(--gold); }
.stat .v { font-family: var(--font-display); font-size: 2.3rem; font-weight: 250; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* ---------- Diálogo e avisos ---------- */
dialog {
  border: 0; border-radius: 22px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px);
  box-shadow: 0 30px 80px -20px #17181466; color: var(--ink); background: var(--ivory);
}
dialog[open] { animation: rise .35s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
dialog::backdrop { background: #171814a6; backdrop-filter: blur(3px); }
dialog .d-head { display: flex; justify-content: space-between; align-items: center; padding: 22px 24px 8px; }
dialog .d-body { padding: 10px 24px 22px; overflow: auto; max-height: calc(100vh - 170px); }
dialog .d-foot { padding: 14px 24px 20px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--night); color: var(--on-night);
  padding: 12px 22px; border-radius: var(--radius-pill); z-index: 100; box-shadow: 0 16px 40px -12px #17181480; max-width: calc(100vw - 32px);
  border: 1px solid #b08d3e55; animation: rise .3s var(--ease);
}
.toast.err { background: var(--wine); border-color: transparent; color: #fff; }
.empty { padding: 36px; text-align: center; color: var(--muted); font-weight: 300; }
.keybox { font-family: ui-monospace, Menlo, monospace; background: var(--paper); border: 1px dashed var(--gold); padding: 12px; border-radius: var(--radius-s); word-break: break-all; font-size: .85rem; }
pre.code { background: var(--night); color: var(--on-night); padding: 14px; border-radius: var(--radius-s); overflow: auto; font-size: .8rem; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 1.5px solid transparent; white-space: nowrap; font-weight: 300; transition: color .2s var(--ease); }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--gold); font-weight: 400; }
.wh-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: center; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--paper); }
.login .art {
  position: relative; overflow: hidden; background: radial-gradient(70% 60% at 50% 55%, #fbf8f3 0%, #efe6d6 55%, #e3d6bf 100%);
  display: grid; place-items: center; padding: 40px;
}
.login .art .tooth { width: min(360px, 62%); filter: drop-shadow(0 40px 50px #7a602733); position: relative; z-index: 1; animation: float 7s ease-in-out infinite; }
.login .art .ring { position: absolute; border: 1px solid #b08d3e40; border-radius: 50%; width: min(560px, 90%); aspect-ratio: 1; }
.login .art .deco { position: absolute; pointer-events: none; }
.login .art .d-star { width: 74px; right: 16%; top: 18%; animation: float 6s ease-in-out infinite reverse; }
.login .art .d-rings { width: 92px; left: 12%; top: 26%; animation: float 8s ease-in-out infinite; }
.login .art .d-pearl { width: 70px; left: 20%; bottom: 14%; animation: float 9s ease-in-out infinite reverse; }
.login .art .quote { position: absolute; left: 40px; bottom: 34px; right: 40px; z-index: 2; font-size: 1.5rem; font-weight: 250; letter-spacing: -.02em; line-height: 1.2; }
.login .art .quote em { font-style: normal; color: var(--gold-deep); font-weight: 400; }
@keyframes float { 50% { transform: translateY(-10px); } }
.login .side { display: grid; place-items: center; padding: 32px 24px; }
.login form { width: min(380px, 100%); display: grid; gap: 16px; }
.login form img.logo { width: 110px; margin-bottom: 6px; }
.login h1 { font-size: 2.5rem; font-weight: 250; letter-spacing: -.035em; }
.login h1 span { color: var(--gold-deep); font-weight: 400; }
.login .btn.primary { justify-content: center; padding: 14px 20px; margin-top: 6px; }
.login .foot { font-size: .72rem; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; margin-top: 10px; }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login .art { min-height: 34vh; padding: 20px; }
  .login .art .tooth { width: min(170px, 40%); }
  .login .art .quote, .login .art .d-pearl { display: none; }
  .login .art .d-star { width: 46px; } .login .art .d-rings { width: 58px; }
}

/* ---------- Celular ---------- */
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; z-index: 50;
    flex-direction: row; padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); gap: 2px; justify-content: space-around;
    background-image: none; border-top: 1px solid #b08d3e33;
  }
  .rail .brand, .rail .spacer, .rail .who, .rail .logout { display: none; }
  .rail a { flex-direction: column; gap: 0; font-size: .72rem; padding: 7px 6px; flex: 1; text-align: center; border-radius: 14px; }
  .rail .full { display: none; }
  .rail .short { display: inline; }
  main { padding: 20px 16px 96px; }
  .day-title { font-size: 1.9rem; }
  h1 { font-size: 1.8rem; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .agenda-wrap { max-height: calc(100vh - 240px); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
input[type=color] { height: 40px; padding: 3px; cursor: pointer; }

/* ---------- Prontuário ---------- */
:root { --odo-red: #b23a3a; --odo-blue: #2f5596; }
.alert-box { background: var(--wine-wash); border: 1px solid #9a3d3633; border-left: 3px solid var(--wine); border-radius: var(--radius-s); padding: 12px 16px; margin-bottom: 16px; }
.alert-box ul { margin: 4px 0; padding-left: 18px; }
.alert-box.info { background: var(--gold-wash); border-color: #b08d3e40; border-left-color: var(--gold); margin: 0; }
.anam-layout { display: grid; grid-template-columns: 1fr 240px; gap: 20px; align-items: start; }
fieldset.panel { margin: 0; }
fieldset legend { font-family: var(--font-display); font-weight: 400; font-size: 1.05rem; padding: 0 8px; }
.q { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.q:last-child { border-bottom: 0; }
.q .q-det { grid-column: 1 / -1; }
.flag { font-size: .7rem; color: var(--wine); border: 1px solid #9a3d3655; border-radius: 99px; padding: 0 7px; vertical-align: 1px; }
.q-ans label { display: inline-flex; cursor: pointer; }
.q-ans input { position: absolute; opacity: 0; pointer-events: none; }
.q-ans span { padding: 6px 14px; }
.q-ans input:checked + span { background: var(--sage-wash); color: var(--sage); font-weight: 500; }
.q-ans input[value=sim]:checked + span { background: var(--wine-wash); color: var(--wine); }
.q-ans input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: -2px; }
.sticky-save { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--paper) 30%); padding: 14px 0 10px; }
.list-item.hist { grid-template-columns: 70px 1fr auto; }

.odo-wrap { overflow-x: auto; }
svg.odonto { width: 100%; min-width: 640px; height: auto; display: block; }
svg.odonto .face { stroke: #a99d86; stroke-width: 1; cursor: pointer; }
svg.odonto .face:hover { stroke: var(--gold); stroke-width: 2; }
svg.odonto .hit { fill: transparent; cursor: pointer; }
svg.odonto .tooth.sel .hit { fill: var(--gold-wash); stroke: var(--gold); stroke-width: 1.5; }
svg.odonto .tooth.missing .face { opacity: .35; }
svg.odonto .tnum { font: 500 11px var(--font-ui); fill: var(--muted); }
svg.odonto .tooth.sel .tnum { fill: var(--gold-deep); }
svg.odonto .tbadge { font: 600 10px var(--font-ui); }
svg.odonto .axis { stroke: var(--line-strong); stroke-dasharray: 3 4; }
.legend { display: inline-flex; gap: 6px; align-items: center; font-size: .86rem; }
.legend i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.rec-line { display: flex; gap: 10px; align-items: flex-start; }
.rec-line .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex: none; }
.faces-row { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.btn.small { padding: 5px 12px; font-size: .7rem; }

.note { background: var(--ivory); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 18px; }
.note p { margin: 8px 0 0; }
.note.amend { border-left: 3px solid var(--gold); }

@media (max-width: 760px) {
  .anam-layout { grid-template-columns: 1fr; }
  .q { grid-template-columns: 1fr; }
}
svg.odonto.compact { min-width: 0; }
svg.odonto .qlabel { font: 500 11px var(--font-ui); fill: var(--muted); }

/* ---------- Orçamentos ---------- */
.quote-layout { display: grid; grid-template-columns: 1fr 330px; gap: 18px; align-items: start; }
.quote-layout > form { position: sticky; top: 16px; }
table.qitems input { padding: 7px 9px; }
table.qitems td { vertical-align: middle; }
.qsum { display: flex; justify-content: space-between; align-items: baseline; font-variant-numeric: tabular-nums; }
.qsum.total { border-top: 1px solid var(--line); padding-top: 12px; }
.qsum.total b { font-family: var(--font-display); font-size: 1.8rem; font-weight: 300; letter-spacing: -.02em; }
@media (max-width: 960px) { .quote-layout { grid-template-columns: 1fr; } .quote-layout > form { position: static; } }
@media (max-width: 760px) {
  table.qitems thead { display: none; }
  table.qitems tr { display: grid; grid-template-columns: 60px 1fr auto 36px; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.qitems td { border: 0; padding: 0; }
  table.qitems td:first-child { grid-column: 1 / -1; }
}
.stat .v.money { font-size: 1.6rem; white-space: nowrap; }

/* ---------- Financeiro ---------- */
.stat.warn { border-color: #9a3d3640; background: var(--wine-wash); }
.stat.warn::after { background: var(--wine); }
.rec-line.reversed { opacity: .55; text-decoration: line-through; }
.print-only { display: none; }
@media print {
  .rail, .page-head, .tabs, .noprint, .toast, .stats.fin { display: none !important; }
  .shell { display: block; }
  main { padding: 0; }
  body { background: #fff; }
  .print-only { display: block; }
}
@media (max-width: 760px) {
  .rail { overflow-x: auto; justify-content: flex-start; }
  .rail a { flex: 0 0 auto; min-width: 64px; }
}

@media (max-width: 760px) {
  .wide-only { display: none !important; }
  .rail a.narrow-only { display: flex !important; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat .v { font-size: 1.8rem; }
  .stat .v.money { font-size: 1.2rem; }
  a.list-item { text-decoration: none; color: inherit; grid-template-columns: 0 1fr auto; }
}

/* ---------- Arquivos ---------- */
.dropzone { border: 1.5px dashed var(--stone); border-radius: var(--radius-m); padding: 26px; text-align: center; cursor: pointer; display: grid; gap: 4px; background: var(--ivory); transition: all .2s var(--ease); }
.dropzone:hover, .dropzone.over { border-color: var(--gold); background: var(--gold-wash); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.tile { border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--ivory); padding: 0; overflow: hidden; cursor: pointer; text-align: left; display: grid; transition: box-shadow .2s var(--ease); }
.tile:disabled { cursor: not-allowed; opacity: .7; }
.tile:not(:disabled):hover { box-shadow: var(--shadow); border-color: var(--gold-soft); }
.tile .thumb { aspect-ratio: 4 / 3; background: var(--night-2); display: grid; place-items: center; overflow: hidden; }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile .ficon { color: var(--gold-soft); font: 400 1rem var(--font-display); letter-spacing: .12em; }
.tile .tcap { padding: 10px 12px; display: grid; gap: 2px; }
.tile .tcap b { font-size: .9rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
img.preview { max-width: 100%; max-height: 60vh; display: block; margin: 0 auto; border-radius: var(--radius-s); background: var(--night-2); }
iframe.preview.pdf { width: 100%; height: 60vh; border: 1px solid var(--line); border-radius: var(--radius-s); }
@media (max-width: 760px) { .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Documentos ---------- */
textarea.doc-edit, .doc-view { font-family: var(--font-ui); font-weight: 300; font-size: .98rem; line-height: 1.7; }
.doc-view { white-space: pre-wrap; background: var(--ivory); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 18px; max-height: 50vh; overflow: auto; }
