*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  :root {
    --gold:     #B8963E;
    --gold-lt:  #D4AF6A;
    --navy:     #112920;
    --navy-lt:  #1C3D2E;
    --sage:     #A8B99A;
    --off-white:#F7F5F2;
    --muted:    #8A8A8A;
    --border:   #D8D4CE;
    --success:  #3D7A5A;
    --error:    #C0392B;
    --radius:   6px;
  }

  body {
    background: var(--off-white);
    font-family: 'DM Sans', sans-serif;
    font-weight: 300;
    color: var(--navy);
    min-height: 100vh;
  }

  /* ── HEADER ── */
  header {
    background: #112920;
    padding: 0;
    text-align: center;
    border-bottom: 2px solid #A8B99A;
    overflow: hidden;
  }
  .header-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    padding: 32px 40px 28px;
    flex-wrap: wrap;
  }
  .header-logo {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
  }
  .header-text {
    text-align: left;
  }
  .clinic-name {
    font-family: 'Cormorant Garamond', serif;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: #A8B99A;
    margin-bottom: 6px;
  }
  header h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 28px;
    font-weight: 300;
    color: #FFFFFF;
    letter-spacing: 0.03em;
    line-height: 1.15;
  }
  header p.subtitle {
    margin-top: 6px;
    font-size: 11px;
    color: #A8B99A;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .header-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #A8B99A44, transparent);
    margin: 0 40px;
  }
  @media (max-width: 520px) {
    .header-inner { flex-direction: column; gap: 16px; text-align: center; }
    .header-text { text-align: center; }
  }

  /* ── WRAPPER ── */
  .form-wrapper {
    max-width: 780px;
    margin: 0 auto;
    padding: 48px 24px 80px;
  }

  /* ── SECTION ── */
  .section {
    margin-bottom: 44px;
  }
  .section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
  }
  .section-icon {
    width: 32px;
    height: 32px;
    border: 1px solid var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .section-icon svg { width: 14px; height: 14px; stroke: var(--gold); fill: none; stroke-width: 1.8; }
  .section-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--navy);
  }

  /* ── GRID ── */
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
  .col-full { grid-column: 1 / -1; }
  .stack { display: flex; flex-direction: column; gap: 16px; }
  .stack-sm { gap: 12px; }

  @media (max-width: 580px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .col-full { grid-column: 1; }
    header { padding: 28px 20px 22px; }
    .form-wrapper { padding: 32px 16px 60px; }
  }

  /* ── FIELD ── */
  .field { display: flex; flex-direction: column; gap: 6px; }
  .field label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .field input[type="text"],
  .field input[type="email"],
  .field input[type="date"],
  .field input[type="number"],
  .field textarea,
  .field select {
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 11px 14px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 300;
    color: var(--navy);
    transition: border-color 0.2s;
    width: 100%;
    outline: none;
    -webkit-appearance: none;
  }
  .field input:focus,
  .field textarea:focus,
  .field select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(184,150,62,0.1);
  }
  .field.is-invalid input,
  .field.is-invalid textarea,
  .field.is-invalid select {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(192,57,43,0.08);
  }
  .field-error {
    color: var(--error);
    font-size: 11px;
    line-height: 1.35;
    margin-top: 4px;
  }
  .field textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
  .field-offset { margin-top: 10px; }
  .textarea-large { min-height: 100px; }

  /* ── RADIO / CHECKBOX GROUP ── */
  .radio-group, .check-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 2px;
  }
  .radio-group label, .check-group label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 300;
    letter-spacing: 0;
    text-transform: none;
    color: var(--navy);
    cursor: pointer;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 40px;
    background: #FFF;
    transition: border-color 0.2s, background 0.2s;
    user-select: none;
  }
  .radio-group input[type="radio"],
  .check-group input[type="checkbox"] {
    display: none;
  }
  .radio-group label.selected,
  .check-group label.selected {
    border-color: #B8963E;
    background: rgba(184,150,62,0.09);
    color: #B8963E;
    font-weight: 500;
  }

  /* ── TOGGLE CARD (sim/não) ── */
  .toggle-card {
    background: #FFF;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
  }
  .toggle-card.is-invalid,
  .health-card.is-invalid,
  .consent-card.is-invalid {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(192,57,43,0.08);
  }
  .toggle-card .card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
  }
  .toggle-card .card-label {
    font-size: 14px;
    font-weight: 300;
    color: var(--navy);
    flex: 1 1 160px;
  }
  .toggle-card .card-extra {
    margin-top: 12px;
    display: none;
  }
  .toggle-card .card-extra.visible { display: block; }

  .health-card {
    background: #FFF;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
  }
  .health-title {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 14px;
  }

  /* Doença rows */
  .health-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  @media (max-width: 480px) { .health-grid { grid-template-columns: 1fr; } }

  /* ── CONSENT ── */
  .section-compact { margin-bottom: 0; }
  .consent-card {
    background: #FFF;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
  }
  .consent-copy {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 16px;
  }
  .consent-control { margin-top: 4px; }
  #consent-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: #FFF;
    transition: border-color 0.18s, background 0.18s;
    user-select: none;
  }
  #consent-check {
    flex-shrink: 0;
    margin-top: 1px;
    width: 18px;
    height: 18px;
    border: 1.5px solid #C0C0C0;
    border-radius: 3px;
    background: #FFF;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s, border-color 0.18s;
  }
  #consent-tick {
    width: 12px;
    height: 10px;
    opacity: 0;
    transition: opacity 0.15s;
  }
  #consent-box.is-checked {
    border-color: #112920;
    background: #f0f6f2;
  }
  #consent-box.is-checked #consent-check {
    background: #112920;
    border-color: #112920;
  }
  #consent-box.is-checked #consent-tick { opacity: 1; }
  .consent-label {
    font-size: 13px;
    font-weight: 400;
    color: var(--navy);
    line-height: 1.5;
  }
  .hidden-checkbox { display: none; }
  .date-field { margin-top: 16px; }

  /* ── SIGNATURE BLOCK ── */
  .signature-block {
    background: #FFF;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .sig-line {
    border-bottom: 1px solid var(--navy);
    height: 40px;
    width: 100%;
    position: relative;
  }
  .sig-hint {
    font-size: 11px;
    color: var(--muted);
    text-align: center;
  }

  /* ── SUBMIT ── */
  .submit-area {
    text-align: center;
    margin-top: 48px;
  }
  .btn-submit {
    background: var(--gold);
    color: #FFF;
    border: none;
    border-radius: var(--radius);
    padding: 15px 52px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
  }
  .btn-submit:hover { background: #A07D2E; }
  .btn-submit:active { transform: scale(0.98); }
  .btn-submit:disabled {
    cursor: wait;
    opacity: 0.72;
    transform: none;
  }

  /* ── TOAST ── */
  #toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--success);
    color: #FFF;
    padding: 14px 28px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 400;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    z-index: 999;
    white-space: nowrap;
  }
  #toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }

  /* ── SUBMISSIONS PANEL ── */
  #submissions-panel {
    max-width: 780px;
    margin: 0 auto 60px;
    padding: 0 24px;
    display: none;
  }
  #submissions-panel.is-visible { display: block; }
  #submissions-panel h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 22px;
    font-weight: 400;
    color: var(--navy);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
  }
  .submission-card {
    background: #FFF;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 12px;
  }
  .submission-card .sc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
  }
  .sc-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--navy);
  }
  .sc-date {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.04em;
  }
  .sc-detail {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.7;
  }
  .sc-detail strong { color: var(--navy); font-weight: 500; }
  .submission-actions {
    margin-top: 10px;
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    align-items: center;
  }
  .btn-card-pdf,
  .btn-card-remove {
    background: none;
    font-size: 11px;
    cursor: pointer;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .btn-card-pdf {
    border: 1px solid #112920;
    color: #112920;
    border-radius: 4px;
    padding: 5px 12px;
  }
  .btn-card-remove {
    border: none;
    color: var(--error);
  }

  .submissions-toggle-wrap {
    max-width: 780px;
    margin: 0 auto 16px;
    padding: 0 24px;
    text-align: center;
  }
  .btn-toggle-submissions {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
    border-radius: var(--radius);
    padding: 9px 24px;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
  }
  .btn-toggle-submissions:hover { background: rgba(184,150,62,0.07); }

  .btn-export {
    background: var(--navy);
    color: #FFF;
    border: none;
    border-radius: var(--radius);
    padding: 9px 20px;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: background 0.2s;
  }
  .btn-export:hover { background: var(--navy-lt); }
  .btn-export-danger { background: var(--error); }
  .btn-export-danger:hover { background: #A93226; }

  .submissions-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
  }
  .submissions-toolbar span {
    font-size: 12px;
    color: var(--muted);
    flex: 1;
  }

  .empty-state {
    text-align: center;
    padding: 40px;
    color: var(--muted);
    font-size: 14px;
  }

  hr.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 8px 0;
  }

  /* ── CONDITION CHECKBOXES ── */
  .cond-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s;
    user-select: none;
    background: #fff;
  }
  .cond-item:hover { border-color: #A8B99A; background: #f5f9f5; }
  .cond-item[aria-checked="true"] { border-color: #112920; background: #f0f6f2; }
  .cond-item.cond-nenhuma[aria-checked="true"] { border-color: var(--muted); background: #f8f8f8; }
  .cond-box {
    width: 18px; height: 18px;
    border: 1.5px solid #C0C0C0;
    border-radius: 3px;
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background 0.18s, border-color 0.18s;
    pointer-events: none;
  }
  .cond-box svg { opacity: 0; width: 12px; height: 10px; transition: opacity 0.15s; pointer-events: none; }
  .cond-item[aria-checked="true"] .cond-box { background: #112920; border-color: #112920; }
  .cond-item[aria-checked="true"] .cond-box svg { opacity: 1; }
  .cond-item.cond-nenhuma[aria-checked="true"] .cond-box { background: #888; border-color: #888; }
  .cond-label { font-size: 13px; font-weight: 300; color: var(--navy); line-height: 1.3; pointer-events: none; }
  .cond-item[aria-checked="true"] .cond-label { font-weight: 500; color: #112920; }
  .cond-item.cond-nenhuma[aria-checked="true"] .cond-label { color: #666; font-weight: 400; }
