﻿:root {
  --teal: #007d86;
  --teal-dark: #005d65;
  --petrol: #123b49;
  --petrol-2: #0d2d38;
  --ink: #13242e;
  --muted: #627682;
  --line: #d8e4e8;
  --paper-line: #2f2f2f;
  --danger: #a42424;
  --ok: #0f766e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 18% 0%, rgba(0, 125, 134, .15), transparent 34rem), linear-gradient(135deg, #fbfdfd 0%, #eef6f7 48%, #e8f0f2 100%);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14.8px;
}

button, input, select { font: inherit; }
button { border: 0; cursor: pointer; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 292px minmax(0, 1fr); }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px 18px 16px;
  background: linear-gradient(180deg, #fff 0%, #f5faf9 100%);
  border-right: 1px solid rgba(18, 59, 73, .12);
}

.brand { padding-bottom: 20px; margin-bottom: 18px; border-bottom: 1px solid rgba(18, 59, 73, .12); }
.brand-logo { display: block; width: 148px; max-height: 70px; object-fit: contain; object-position: center center; margin: 0 auto 15px; }
.brand h1 { margin: 0; color: var(--petrol-2); font-size: 23px; line-height: 1.08; letter-spacing: 0; }
.brand p { margin: 6px 0 0; color: var(--muted); font-size: 13.2px; font-weight: 600; }
.model-list { display: grid; gap: 9px; }
.model-card { width: 100%; min-height: 72px; padding: 12px 13px 12px 15px; text-align: left; background: rgba(255, 255, 255, .9); border: 1px solid rgba(18, 59, 73, .13); border-radius: 8px; box-shadow: 0 8px 22px rgba(18, 59, 73, .045); position: relative; overflow: hidden; transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease; }
.model-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: transparent; }
.model-card:hover { transform: translateY(-1px); border-color: rgba(0, 125, 134, .38); box-shadow: 0 12px 28px rgba(18, 59, 73, .075); }
.model-card.active { background: linear-gradient(135deg, #fff, #eef9f8); border-color: rgba(0, 125, 134, .62); box-shadow: 0 14px 30px rgba(0, 125, 134, .13); }
.model-card.active::before { background: var(--teal); }
.model-card span { display: block; margin-bottom: 5px; color: var(--teal-dark); font-size: 11.3px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.model-card strong { display: block; color: var(--ink); font-size: 14.8px; line-height: 1.2; }
.site-footer { color: #7a8990; font-size: 11.5px; letter-spacing: .01em; }

.workspace { display: grid; grid-template-columns: minmax(420px, 610px) minmax(720px, 1fr); gap: 20px; align-items: start; padding: 20px; }
.panel { background: rgba(255, 255, 255, .93); border: 1px solid rgba(18, 59, 73, .12); border-radius: 10px; box-shadow: 0 18px 46px rgba(18, 59, 73, .08); }
.form-panel, .preview-panel { padding: 17px; }
.panel-header, .preview-header, .action-strip { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.panel-header { margin-bottom: 14px; }
.preview-header { margin-bottom: 13px; }
.section-kicker { display: block; margin-bottom: 4px; color: var(--teal-dark); font-size: 11.3px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
h2 { margin: 0; color: var(--petrol-2); font-size: 23px; line-height: 1.12; letter-spacing: 0; }
fieldset { margin: 0 0 13px; padding: 14px 14px 15px; border: 1px solid rgba(18, 59, 73, .13); border-radius: 9px; background: linear-gradient(180deg, #fff 0%, #fbfdfd 100%); position: relative; }
fieldset::before { content: ""; position: absolute; inset: 10px auto 10px 0; width: 3px; border-radius: 999px; background: var(--teal); }
.accent-blue::before { background: #2f6f91; }
.accent-slate::before { background: #607d8b; }
.accent-mint::before { background: #2aa889; }
.accent-warm::before { background: #b58a3a; }
legend { padding: 0 7px; color: var(--petrol); font-size: 12.3px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
label { display: grid; gap: 6px; color: #243943; font-size: 14.8px; font-weight: 730; }
label small { color: var(--muted); font-size: 12px; font-weight: 650; }
input, select { width: 100%; min-height: 41px; padding: 8px 10px; color: #10242c; background: #fbfdfd; border: 1px solid #b9cbd2; border-radius: 7px; font-size: 14.8px; }
input:focus, select:focus { outline: 3px solid rgba(0, 125, 134, .16); border-color: var(--teal); background: #fff; }
.grid { display: grid; gap: 12px; }
.grid + .grid { margin-top: 12px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.attendance-fields .grid.three { align-items: end; }
.attendance-fields .grid.three:has(.periodo-fields:not(.hidden)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.checkbox-card { min-height: 41px; display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; padding: 10px; border: 1px solid #d7e2e7; border-radius: 8px; background: #fffaf0; }
.checkbox-card input { width: 19px; min-height: 19px; height: 19px; margin-top: 1px; accent-color: var(--teal); }
.checkbox-card label { display: block; font-size: 13.5px; line-height: 1.35; }
.preview-column { display: grid; gap: 12px; }
.action-strip { position: sticky; top: 12px; z-index: 5; padding: 11px; background: rgba(255, 255, 255, .9); border: 1px solid rgba(18, 59, 73, .12); border-radius: 10px; box-shadow: 0 16px 34px rgba(18, 59, 73, .1); backdrop-filter: blur(10px); }
.clear-button, .print-button { min-height: 46px; padding: 0 18px; border-radius: 8px; font-size: 15.3px; font-weight: 850; }
.clear-button { flex: 1.15; color: #513600; background: linear-gradient(135deg, #fff3c9, #f7cc63); }
.clear-button.confirm { color: #fff; background: var(--ok); }
.print-button { flex: 1; color: #fff; background: linear-gradient(135deg, var(--teal), var(--petrol-2)); }
.toast { min-height: 0; padding: 0 14px; color: #fff; background: var(--ok); border-radius: 8px; font-weight: 760; line-height: 0; opacity: 0; transform: translateY(-4px); transition: opacity .2s ease, transform .2s ease, padding .2s ease, line-height .2s ease; }
.toast.show { padding: 10px 14px; line-height: 1.3; opacity: 1; transform: translateY(0); }
.doctor-status { padding: 7px 10px; color: #7a271a; background: #fff1ee; border: 1px solid #ffd2ca; border-radius: 999px; font-size: 12px; font-weight: 850; }
.doctor-status.ready { color: #075d56; background: #e6f7f4; border-color: #b7e6dd; }

.paper {
  width: 210mm;
  min-height: 297mm;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  padding: 18mm 20mm 14mm;
  color: #111;
  background: #fff;
  border: 1px solid #cfd8dc;
  box-shadow: 0 18px 42px rgba(15, 23, 42, .17);
  font-family: "Times New Roman", Times, serif;
  font-size: 12pt;
  line-height: 1.5;
}

.paper-header {
  display: grid;
  grid-template-columns: 58mm 1fr;
  gap: 12mm;
  align-items: end;
  min-height: 31mm;
  padding-bottom: 6mm;
  border-bottom: 1px solid var(--paper-line);
  position: relative;
}
.paper-header::after { content: ""; position: absolute; left: 0; bottom: -1.7mm; width: 34mm; border-bottom: 2px solid #666; }
.paper-logo-frame { display: flex; align-items: flex-end; }
.paper-logo { width: 53mm; max-height: 24mm; object-fit: contain; object-position: left bottom; filter: grayscale(1) contrast(1.1); }
.paper-clinic { display: grid; justify-items: end; gap: 1.15mm; text-align: right; color: #222; font-size: 9.2pt; line-height: 1.22; }
.paper-clinic strong { font-size: 10.6pt; font-weight: 700; letter-spacing: .02em; }

.document-content { max-width: 166mm; margin: 0 auto; padding-top: 15mm; width: 100%; }
.title-block { display: flex; flex-direction: column; align-items: center; gap: 5mm; text-align: center; margin-bottom: 13mm; }
.paper h3 { display: inline-block; margin: 0; padding-bottom: 3mm; border-bottom: 1px solid #777; text-align: center; font-size: 13.4pt; font-weight: 700; letter-spacing: .08em; }
.title-ornament { color: #111; font-size: 19pt; font-style: italic; line-height: 1; letter-spacing: .08em; }
.paper-body { width: 158mm; min-height: 62mm; margin: 0 auto; }
.paper-body p { margin: 0 0 7mm; text-align: justify; font-size: 12pt; line-height: 1.65; text-indent: 0; }
.paper-date { width: 158mm; margin: 16mm auto 0; text-align: left; font-size: 12pt; }

.paper-footer { margin-top: auto; }
.paper-footer p { margin: 0; }
.signature-block { width: 82mm; margin: 22mm auto 0; text-align: center; }
.signature-line { width: 76mm; margin: 0 auto 3.6mm; border-bottom: 1px solid #111; }
.doctor-name { font-family: "Arial Black", Arial, Helvetica, sans-serif; font-weight: 900; font-size: 10.9pt; line-height: 1.16; letter-spacing: .02em; }
.doctor-registry { margin-top: 1.2mm !important; font-family: Arial, Helvetica, sans-serif; font-size: 9.3pt; line-height: 1.18; }
.doctor-specialty { margin-top: 1.2mm !important; font-family: Arial, Helvetica, sans-serif; font-size: 9.1pt; line-height: 1.15; }
.unit-footer { margin-top: 14mm; padding-top: 3.5mm; border-top: 1px solid #333; color: #222; text-align: center; font-size: 8.8pt; line-height: 1.25; }

.hidden { display: none !important; }
.error-outline { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(164, 36, 36, .13); }

@media (max-width: 1280px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; gap: 18px; }
  .model-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .workspace, .sidebar { padding: 14px; }
  .model-list, .grid.two, .grid.three { grid-template-columns: 1fr; }
  .action-strip { flex-direction: column; align-items: stretch; }
  .brand-logo { width: 130px; }
  h2 { font-size: 22px; }
  .preview-panel { overflow-x: auto; }
}

@page { size: A4; margin: 0; }

@media print {
  html, body { width: 210mm; min-height: 297mm; background: #fff !important; }
  .sidebar, .form-panel, .no-print, .toast { display: none !important; }
  .app-shell, .workspace, .preview-column, .preview-panel { display: block !important; padding: 0 !important; margin: 0 !important; background: #fff !important; border: 0 !important; box-shadow: none !important; }
  .paper { width: 210mm; min-height: 297mm; margin: 0; padding: 18mm 20mm 14mm; border: 0; box-shadow: none; color: #000; background: #fff !important; font-family: "Times New Roman", Times, serif; font-size: 12pt; line-height: 1.5; page-break-after: avoid; }
}


