/* Triune AV Planner — print.css (paginação A4 real para PDF)
   #print-root fica oculto na tela e vira o documento na impressão.
   Quebras naturais: o navegador pagina sozinho, sem amontoar. */

#print-root { display: none; }

@media print {
  html, body { background: #fff !important; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block !important; }

  @page { size: A4; margin: 14mm; }

  .a4-doc { font-family: 'Inter', system-ui, sans-serif; color: #1a1a1a; font-size: 11px; line-height: 1.5; }
  .a4-mono { font-family: 'JetBrains Mono', monospace; }
  -webkit-print-color-adjust: exact; print-color-adjust: exact;

  .a4-head { display: flex; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid #DD2A1B; padding-bottom: 12px; margin-bottom: 14px; }
  .a4-head-left { display: flex; align-items: flex-start; gap: 16px; }
  .a4-brand { display: flex; align-items: flex-start; gap: 10px; }
  .a4-brand-txt { display: flex; flex-direction: column; }
  .a4-brand-divider { width: 1.5px; height: 34px; background: #E6E9EE; align-self: center; }
  .a4-logo { width: 34px; height: 34px; border-radius: 7px; background: #DD2A1B; display: flex; align-items: center; justify-content: center; print-color-adjust: exact; -webkit-print-color-adjust: exact; overflow: hidden; }
  .a4-logo-img { width: auto; max-width: 150px; height: 40px; background: transparent !important; border: none; border-radius: 0; overflow: visible; }
  .a4-logo-img img { max-width: 150px; max-height: 40px; width: auto; height: auto; object-fit: contain; }
  .a4-brand-name { font-size: 15px; font-weight: 700; }
  .a4-brand-sub { font-size: 10px; color: #777; }
  .a4-company-details { font-size: 8.5px; color: #555; line-height: 1.4; text-align: left; margin-top: 3px; }
  .a4-userline { font-size: 9.5px; color: #888; margin: -8px 0 12px; padding-bottom: 4px; }
  .a4-docid { text-align: right; }
  .a4-docid .a4-mono { font-size: 12px; font-weight: 600; }
  .a4-docdate { font-size: 9.5px; color: #999; }

  .a4-top-info-grid { display: grid; grid-template-columns: 1.2fr 1.6fr 0.8fr 1.4fr; gap: 16px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 0.75px solid #EEDCDA; }
  .a4-info-box { display: flex; flex-direction: column; gap: 4px; }
  .a4-info-lbl { font-size: 8.5px; font-weight: 700; letter-spacing: 0.5px; color: #999; text-transform: uppercase; }
  .a4-info-val { font-size: 11px; font-weight: 600; color: #1a1a1a; }

  .a4-people-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; row-gap: 8px; margin-bottom: 16px; }
  .a4-people-row { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #E6E9EE; padding-bottom: 4px; font-size: 11px; }
  .a4-people-role { color: #555; font-weight: 400; text-transform: uppercase; font-size: 9px; letter-spacing: 0.4px; }
  .a4-people-name { color: #1a1a1a; font-weight: 700; text-align: right; }

  .a4-resumo { font-size: 10px; color: #555; margin-bottom: 12px; }

  .a4-sec { margin-bottom: 14px; break-inside: avoid-page; }
  .a4-sec-t { font-size: 10px; font-weight: 700; letter-spacing: .5px; color: #DD2A1B; text-transform: uppercase; margin-bottom: 7px; break-after: avoid; }

  .a4-row { break-inside: avoid; }
  .a4-thead { font-size: 8.5px !important; font-weight: 700; letter-spacing: .4px; color: #666; text-transform: uppercase; border-bottom: 0.75px solid #D0D4DA; }
  .a4-thead b, .a4-thead i { color: #666 !important; }

  .a4-patch { display: grid; grid-template-columns: 26px 92px 1fr 16px 1fr 48px 60px; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid #F0F2F5; }
  .a4-c-n { color: #999; }
  .a4-c-cab { display: inline-flex; align-items: center; gap: 6px; }
  .a4-c-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; print-color-adjust: exact; -webkit-print-color-adjust: exact; border: 1px solid rgba(0,0,0,0.15); }
  .a4-c-ep b { font-weight: 600; }
  .a4-c-ep i { font-style: normal; color: #888; }
  .a4-c-ar { text-align: center; color: #999; }
  .a4-c-len, .a4-c-id { color: #555; }

  /* Legenda de tipos de cabo (resumo no topo da patch list) */
  .a4-tipos { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px dashed #E6E9EE; }
  .a4-tipo-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 9.5px; color: #555; padding: 3px 8px; background: #FAFBFC; border: 1px solid #E6E9EE; border-radius: 10px; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .a4-tipo-chip b { font-weight: 700; color: #1a1a1a; font-family: 'JetBrains Mono', monospace; }
  .a4-tipo-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; print-color-adjust: exact; -webkit-print-color-adjust: exact; border: 1px solid rgba(0,0,0,0.15); }

  /* Lista de fornecedores */
  .a4-forn { display: grid; grid-template-columns: 26px 1.6fr 1fr 1.2fr 70px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid #F0F2F5; }
  .a4-c-fn b { font-weight: 600; }
  .a4-c-fn i { font-style: normal; color: #888; }
  .a4-c-ct, .a4-c-it { color: #555; font-size: 10px; }
  .a4-c-vl { text-align: right; font-weight: 600; color: #1a1a1a; }

  .a4-chk { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid #F0F2F5; }
  .a4-box { width: 13px; height: 13px; border: 1px solid #999; border-radius: 3px; flex-shrink: 0; }
  .a4-chk-txt { flex: 1; }
  .a4-chk-txt i { font-style: normal; color: #999; font-size: 10px; }
  .a4-chk-q { font-weight: 600; }
  .a4-acc-row { padding: 2px 0 2px 22px; border-bottom: none; }
  .a4-box-sm { width: 10px; height: 10px; border-width: 1px; border-color: #bbb; }
  .a4-acc-txt { font-size: 10px; color: #666; }

  .a4-people { display: flex; flex-wrap: wrap; gap: 8px 22px; }
  .a4-pgrp { display: flex; flex-direction: column; gap: 2px; min-width: 150px; break-inside: avoid; }
  .a4-pgrp b { font-size: 9px; text-transform: uppercase; letter-spacing: .5px; }
  .a4-pgrp span { font-size: 10.5px; }
  .a4-pgrp i { font-style: normal; color: #888; }

  /* Equipe com avatar — espelha o protótipo */
  .a4-pgroup { margin-bottom: 10px; break-inside: avoid; }
  .a4-pgroup-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
  .a4-pgroup-dot { width: 7px; height: 7px; border-radius: 2px; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .a4-pgroup-head b { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
  .a4-pgroup-n { font-family: 'JetBrains Mono', monospace; font-size: 9px; color: #888; }
  .a4-pgroup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 14px; }
  .a4-person { display: flex; align-items: center; gap: 9px; padding: 4px 0; }
  .a4-person-av {
    width: 26px; height: 26px; border-radius: 50%;
    border: 1px solid; display: inline-flex; align-items: center; justify-content: center;
    font-size: 9.5px; font-weight: 600; flex-shrink: 0;
    background: #FAFBFC;
  }
  .a4-person-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
  .a4-person-main b { font-size: 11px; font-weight: 600; color: #1a1a1a; }
  .a4-person-main i { font-size: 9.5px; color: #777; font-style: normal; }
  .a4-person-tel { font-size: 9px; color: #999; font-family: 'JetBrains Mono', monospace; }

  .a4-sign-row { display: flex; gap: 28px; margin-top: 8px; break-inside: avoid; }
  .a4-sign-row > div { flex: 1; }
  .a4-sign { border-bottom: 1px solid #bbb; height: 32px; margin-bottom: 4px; }
  .a4-sign-row span { font-size: 9px; color: #999; }

  .a4-foot { margin-top: 16px; padding-top: 8px; border-top: 1px solid #ddd; font-size: 9px; color: #999; }

  /* ===== STUDIO (planta baixa) ===== */
  .a4-st-wrap { display: flex; justify-content: center; margin: 8px 0 18px; }
  .a4-st-room {
    position: relative;
    background: #FAFBFC;
    border: 1px solid #555;
    border-radius: 6px;
    margin-top: 22px; margin-left: 22px;
    print-color-adjust: exact; -webkit-print-color-adjust: exact;
  }
  .a4-st-dim-top {
    position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
    font-family: 'JetBrains Mono', monospace; font-size: 10px; color: #666;
    background: #fff; padding: 0 6px;
  }
  .a4-st-dim-left {
    position: absolute; left: -22px; top: 50%; transform: translateY(-50%) rotate(-90deg); transform-origin: center;
    font-family: 'JetBrains Mono', monospace; font-size: 10px; color: #666;
    background: #fff; padding: 0 6px;
  }
  .a4-st-el {
    position: absolute;
    border: 1px solid;
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    print-color-adjust: exact; -webkit-print-color-adjust: exact;
  }
  .a4-st-el-lbl {
    font-size: 9px; font-weight: 700; letter-spacing: 0.5px;
    text-transform: uppercase;
    text-align: center; padding: 2px 4px;
    background: rgba(255,255,255,0.85);
    border-radius: 3px;
    max-width: 90%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .a4-st-text {
    position: absolute;
    font-size: 10px; font-weight: 600;
    background: rgba(255,255,255,0.85);
    padding: 1px 4px;
    border-radius: 3px;
  }
  .a4-st-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; }
  .a4-st-leg-item {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 9px;
    background: #FAFBFC; border: 1px solid #E6E9EE; border-radius: 12px;
    font-size: 10px;
  }
  .a4-st-leg-dot {
    width: 10px; height: 10px; border-radius: 3px;
    print-color-adjust: exact; -webkit-print-color-adjust: exact;
  }
  .a4-st-leg-item b { font-weight: 700; color: #1a1a1a; letter-spacing: 0.4px; }
  .a4-st-leg-n { font-family: 'JetBrains Mono', monospace; color: #888; }

  /* Studio em landscape — usuário escolhe orientação no diálogo de impressão.
     Sugerimos paisagem porque sala normalmente é mais larga que alta. */
  body.printing-studio .a4-doc { font-size: 10.5px; }
}
@page :left { size: A4; }
body.printing-studio { /* marker p/ JS detectar via document.body.className se precisar */ }
