/*
  ╔══════════════════════════════════════════════════════════════╗
  ║  FONTES AUTO-HOSPEDADAS — sem CLS                           ║
  ║                                                              ║
  ║  Para eliminar o CLS causado pelo Google Fonts:             ║
  ║  1. Baixe os arquivos .woff2 em https://gwfh.mranftl.com/  ║
  ║     Inter: pesos 400, 500, 700 (latin)                      ║
  ║     Playfair Display: 400, 400i, 600 (latin)                ║
  ║  2. Coloque-os em /fonts/ na raiz do servidor               ║
  ║  3. Remova os <link> do Google Fonts no .php                ║
  ║  4. font-display:optional = sem swap tardio = CLS zero      ║
  ╚══════════════════════════════════════════════════════════════╝
*/
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url('/fonts/inter-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: optional;
  src: url('/fonts/inter-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: optional;
  src: url('/fonts/inter-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url('/fonts/playfair-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0308, U+0329, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Playfair Display';
  font-style: italic;
  font-weight: 400;
  font-display: optional;
  src: url('/fonts/playfair-400i.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0308, U+0329, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 600;
  font-display: optional;
  src: url('/fonts/playfair-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0308, U+0329, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f2ece2;
  --surface: #fff;
  --border: #d8d0c4; --border2: #c8bfb2;
  --gold: #8a6510; --gold-dim: #a07820;
  --text: #1a1612; --text-2: #2a2420; --text-3: #5a5248;
  --c-madeira: #3a9e5f; --c-fogo: #c94040; --c-terra: #b8832a; --c-metal: #7a8a9a; --c-agua: #2e6aaa;
}
* { margin:0; padding:0; box-sizing:border-box; }
body { background:var(--bg); color:var(--text); font-family:'Inter',sans-serif; font-size:13px; min-height:100vh; }
.page { width:100%; max-width:1600px; margin:0 auto; padding:10px 20px; }
.site-header { text-align:center; margin-bottom:10px; }
.site-header h1 { font-family:'Playfair Display',serif; font-size:clamp(18px,3vw,24px); font-weight:600; color:#1a1612; margin-bottom:2px; }
.site-header .sub { font-family:'Playfair Display',serif; font-style:italic; color:#5a5248; font-size:11px; }
.form-card { background:var(--surface); border:1px solid var(--border); border-radius:8px; padding:12px 16px; margin:0 auto 16px; box-shadow:0 2px 12px rgba(0,0,0,0.07); max-width:800px; }
.form-row { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:8px; }
.field { display:flex; flex-direction:column; gap:2px; flex:1; min-width:90px; }
.field label { font-size:8px; font-weight:700; letter-spacing:0.14em; text-transform:uppercase; color:var(--text-3); }
.field input, .field select { background:#fff; border:1px solid var(--border2); border-radius:5px; color:var(--text); font-family:'Inter',sans-serif; font-size:12px; padding:5px 8px; outline:none; transition:border-color .2s; width:100%; }
.field input:focus,.field select:focus { border-color:var(--gold-dim); }
.loc-wrap { position:relative; }
.ac-drop { position:absolute; top:calc(100% + 4px); left:0; right:0; background:#fff; border:1px solid var(--border2); border-radius:8px; z-index:200; max-height:200px; overflow-y:auto; display:none; box-shadow:0 12px 40px rgba(0,0,0,.15); }
.ac-drop.open { display:block; }
.ac-item { padding:8px 12px; cursor:pointer; font-size:12px; display:flex; gap:8px; align-items:center; border-bottom:1px solid rgba(0,0,0,.05); }
.ac-item:hover { background:rgba(138,101,16,.07); }
.ac-city { color:var(--text); } .ac-reg { color:var(--text-3); font-size:10px; }
.ac-foot { padding:5px 12px; font-size:9px; color:var(--text-3); text-align:right; font-style:italic; }
.loc-meta { margin-top:5px; font-size:10px; color:#5a5248; display:flex; gap:10px; flex-wrap:wrap; font-style:italic; }
.loc-meta .hi { color:#6a4e08; font-style:normal; font-weight:500; }
.opts-row { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:8px; align-items:center; }
.chk { display:flex; gap:4px; align-items:center; cursor:pointer; font-size:10px; color:#2a2420; user-select:none; }
.chk input[type="checkbox"] { width:11px; height:11px; accent-color:#8a6510; }
.solar-info { font-size:9px; color:var(--gold); font-style:italic; background:rgba(138,101,16,.07); border:1px solid rgba(138,101,16,.20); border-radius:4px; padding:2px 6px; display:none; }
.btn-calc { width:100%; padding:7px; background:#8a6510; border:none; border-radius:5px; color:#fff; font-family:'Inter',sans-serif; font-size:10px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; cursor:pointer; transition:opacity .2s,box-shadow .2s; box-shadow:0 2px 14px rgba(138,101,16,.25); }
.btn-calc:hover { opacity:.88; box-shadow:0 4px 22px rgba(138,101,16,.35); }
.err-msg { background:rgba(200,60,60,.08); border:1px solid rgba(200,60,60,.22); border-radius:5px; padding:6px 10px; color:#c03030; font-size:11px; margin-top:6px; display:none; }
.loading { text-align:center; padding:30px; color:var(--text-3); font-style:italic; display:none; }
.spin { display:inline-block; width:15px; height:15px; border:2px solid rgba(138,101,16,.15); border-top-color:var(--gold); border-radius:50%; animation:spin .7s linear infinite; vertical-align:middle; margin-right:6px; }
@keyframes spin { to { transform:rotate(360deg); } }

/* ══════ MAPA ZI WEI DOU SHU ══════ */
#zwds-results { display:none; animation:fadeUp .4s ease; margin-top:10px; width:100%; margin-left:auto; margin-right:auto; contain: layout; }
@keyframes fadeUp { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }

.zwds-map-wrap { background:var(--surface); border:1px solid var(--border); border-radius:12px; overflow:hidden; box-shadow:0 2px 16px rgba(0,0,0,.09); width: 100%; height: auto; display: flex; flex-direction: column; }
.zwds-header { padding:8px 20px; background:#f5f0e8; border-bottom:1px solid var(--border); text-align:center; flex-shrink: 0; }
.zwds-header h2 { font-family:'Playfair Display',serif; font-size:16px; font-weight:600; color:#1a1612; }
.zwds-header .info { font-size:10px; color:#6a4e08; margin-top:2px; }
.zwds-header .info span { margin:0 6px; }

.zwds-grid { display:grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); gap:0; border-collapse: collapse; width: 100%; height: auto; min-height: 500px; aspect-ratio: 1359 / 644; margin: 0 auto; }
.zwds-cell { border:1px solid var(--border); position:relative; min-height:0; display:flex; flex-direction:column; background:var(--card); transition:box-shadow .2s; overflow:hidden; }
.zwds-cell:hover { box-shadow:0 0 0 2px var(--gold-dim); z-index:10; }
.zwds-cell.is-center { background:#f5f0e8; display:flex; flex-direction:column; justify-content:center; align-items:center; padding:16px; box-shadow:none; z-index: 5; }

@media(max-width:768px) {
  /* Ajuste ultra-micro para legibilidade total sem cortes */
  .page { padding: 1px; }
  .form-card { padding: 4px; margin-bottom: 6px; }
  
  .zwds-grid { 
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    grid-template-rows: repeat(4, 1fr) !important;
    width: 100%;
    aspect-ratio: 1 / 1.6; /* fixo — não alterar via JS para evitar CLS */
  }
  
  .zwds-cell { 
    min-height: 0 !important; 
    height: 100% !important;
    padding: 0px; 
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-width: 0.5px;
  }
  
  .zwds-cell.is-center {
    grid-column: 2 / 4 !important;
    grid-row: 2 / 4 !important;
    padding: 1px;
  }
  
  .zwds-cell-corner { 
    font-size: 6px; 
    line-height: 1; 
    transform: scale(0.7);
    transform-origin: left top;
    white-space: normal !important;
    display: block !important;
    padding: 1px 2px;
    width: 120%;
  }
  .zwds-cell-heavenly-stem { 
    font-size: 8px; 
    padding: 0 1px; 
    line-height: 0.2; 
    transform: scale(0.4);
    transform-origin: left top;
  }
  .zwds-cell-palace { 
    font-size: 15px; 
    padding: 0 0px; 
    line-height: 0.1; 
    border-bottom: none; 
    height: auto; 
    font-weight: 800;
    transform: scale(0.6);
    transform-origin: left top;
	white-space: nowrap !important;
    margin-bottom: 0px;
  }
  
  .zwds-stars { 
    padding: 0px 1px; 
    flex: 1; 
    overflow: hidden; 
    display: flex !important;
    flex-direction: column !important;
    gap: 0px !important;
    margin-top: -1px;
  }
  /* Remove as bordas e paddings dos grupos (Major, Aux, Harm) injetados pelo JS */
  .zwds-stars div { 
    border: none !important; 
    padding: 0 !important; 
    margin: 0 !important; 
    display: contents !important;
  }
  
  /* No mobile: transit-tag e rel-names viram estáticos, cada um em sua linha (flex row, alinhados à direita) */
  .palace-transit-tag {
    position: static !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 3px !important;
    width: 100% !important;
    padding: 1px 2px 0 !important;
    order: 2;
  }
  .zwds-rel-names {
    position: static !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-end !important;
    gap: 3px !important;
    width: 100% !important;
    margin-top: 0px !important;
    padding: 0 2px !important;
    order: 3;
  }
  /* Garantir que corner, stem e palace venham primeiro */
  .zwds-cell-corner        { order: 0; }
  .zwds-cell-heavenly-stem { order: 1; }
  .zwds-cell-palace        { order: 2; margin-top: -2px !important; }
  .palace-transit-tag      { order: 3; margin-top: 0px !important; }
  .zwds-rel-names          { order: 4; }
  .zwds-stars              { order: 5; }
  .zwds-decade             { order: 6; }
  .pt-year     { font-size: 6px !important; }
  .pt-age      { font-size: 6px !important; }
  .pt-decade   { font-size: 7px !important; margin-top: 0 !important; color: #8a6510 !important; }
  .pt-year-rel { font-size: 7px !important; margin-top: 0 !important; color: #3a9e5f !important; }
  
  /* CONTROLE TOTAL DAS ESTRELAS - USE ESTES VALORES */
  div.zwds-grid div.zwds-cell div.zwds-stars div.zwds-star { 
    font-size: 15px !important; 
    font-weight: 700 !important;
    line-height: 1.2 !important;
    gap: 2px !important; 
    margin: 0 !important; 
    white-space: nowrap !important; 
    display: flex !important;
    align-items: center !important;
    transform: scale(0.38) !important; /* Reduzido mais um pouco */
    transform-origin: left center !important;
    height: 8px !important; /* Ajustado proporcionalmente */
    color: #000 !important;
  }
  
  /* Ajuste dos componentes internos da estrela */
  div.zwds-star span.name { font-weight: 800 !important; }
  div.zwds-star span.cn { font-size: 1.2em !important; font-weight: 800 !important; }
  div.zwds-star span.sihua-badge { 
    font-size: 2.2em !important; 
    font-weight: 400 !important;
    width: 1.2em !important; 
    height: 1.2em !important; 
    display: inline-flex !important; 
    align-items: center !important; 
    justify-content: center !important; 
    border-radius: 1px !important; 
    padding: 0 !important;
    background-color: #3333FF !important;
  }
  div.zwds-star span.luminosidade { font-size: 30px !important; font-weight: 800 !important; color: #3333FF !important; margin-left: 2px; }
  
  .zwds-decade { 
    font-size: 3.2px; 
    padding: 1px 0; 
    height: auto; 
    position: static !important;
    left: unset;
    right: unset;
    bottom: unset;
    text-align: center;
    background: transparent;
    pointer-events: none;
    order: 10;
  }
  
  .zwds-rel-names {
    order: 9;
  }
  
  .center-name { font-size: 6px; margin-bottom: 1px; line-height: 1; }
  .center-info { font-size: 3.2px; line-height: 1.1; }
  .center-elemento { font-size: 3.2px; margin-top: 1px; }
  
  .center-opts { margin-top: 2px !important; padding-top: 2px !important; gap: 2px !important; }
  .center-opts .chk { font-size: 7px !important; gap: 2px !important; }
  .center-opts .chk input { width: 10px !important; height: 10px !important; }
  
  .zwds-header { padding: 2px; }
  .zwds-header h2 { font-size: 7px; }
  .zwds-header .info { font-size: 4px; }

  /* Garantir que as posições grid-column/row funcionem */
  .zwds-cell[style] { display: flex !important; }

  /* Compact View: Melhora visual mobile quando poucas estrelas são exibidas */
  .zwds-grid.compact-view {
    /* aspect-ratio removido: mantém 1/1.6 fixo para evitar CLS quando JS adiciona esta classe */
  }
  .zwds-grid.compact-view .zwds-stars {
    font-size: 10px !important;
    justify-content: center;
    gap: 2px !important;
  }
  .zwds-grid.compact-view .zwds-star {
    transform: scale(1.6); /* Aumenta o tamanho das estrelas já que há espaço */
    transform-origin: left center;
    margin-bottom: 4px;
    margin-left: 2px;
  }
  .zwds-grid.compact-view .zwds-cell-palace {
    transform: scale(1.0); /* Volta ao tamanho normal (maior que o scale 0.6 padrão mobile) */
    font-size: 10px !important;
    background: rgba(255,255,255,0.8);
    padding: 2px 4px !important;
    z-index: 10;
    line-height: 1;
  }
}
.dest2-label { font-weight: 800; color: #d00000; }
@media(max-width:768px) {
  .dest2-label { display: block !important; margin-top: 0px; }
}
.zwds-cell-corner { font-size:9px; font-weight:700; color:var(--text-3); padding:4px 6px 0; letter-spacing:.05em; }
.zwds-cell-branch { font-size:10px; font-weight:600; color:var(--text-2); padding:0 6px; }
.zwds-cell-palace { font-size:11px; font-weight:700; color:var(--gold); padding:0 6px 4px; }
.zwds-stars { flex:1; padding:1px 4px 12px; overflow:hidden; display:flex; flex-direction:column; gap:0px; }
.zwds-star { font-size:clamp(7.5px, 0.50vw, 10px); line-height:1.15; display:flex; align-items:center; gap:2px; font-weight:600; white-space:nowrap; letter-spacing: 0.01em; }
.zwds-star .name { font-family:'Inter',sans-serif; font-size:1.0em; font-weight: 700; color: #000; }
.zwds-star .cn { font-family:'Noto Serif SC',serif; font-weight:700; font-size:1.1em; color:#000; }
.zwds-star .pt { color:#1a1612; font-size:0.85em; }
.zwds-star .luminosidade { color:#3333FF; font-size:1.05em; font-style:italic; font-weight:700; }
@media(min-width:769px) {
  div.zwds-star span.luminosidade { font-size: 15px !important; font-weight: 800 !important; color: #3333FF !important; margin-left: 2px; }
}
    .zwds-star .sihua-badge { 
      display: inline-flex; 
      align-items: center;
      justify-content: center;
      background: #3333FF; 
      color: #fff; 
      font-size: 1.7em; 
      font-weight: 500; 
      width: 1.5em;
      height: 1.5em;
      border-radius: 1px; 
      margin-left: 4px;
      line-height: 1;
      font-family: 'Noto Serif SC', serif;
      cursor: help;
    }
    .zwds-star .sihua-badge.badge-ji { background: #FF3333 !important; }
    .zwds-star .sihua-badge.badge-lu { background: #2E7D32 !important; }
    .zwds-star .sihua-badge.badge-quan { background: #757575 !important; }.zwds-star.major { color:#1a1612; }
.zwds-star.major .cn { color:#1a1612; font-size:1.05em; }
.zwds-star.major .pt { color:#1a1612; }
.zwds-star.aux { color:#1a1612; }
.zwds-star.aux .cn { color:#1a1612; }
.zwds-star.harm { color:#1a1612; }
.zwds-star.harm .cn { color:#1a1612; }
.zwds-decade { font-size:8px; font-weight:700; color:var(--text-3); text-align:center; padding:0px 0 1px; position:absolute; bottom:2px; left:0; right:0; background:transparent; pointer-events:none; }
.zwds-cell-heavenly-stem { font-size:8px; font-weight:600; color:var(--text-3); padding:0 4px; }

/* Centro do mapa */
/* BaZi Center Table Styles */
.center-bazi-tbl {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 10px;
  width: 100%;
}
.center-bazi-col {
  display: flex;
  flex-direction: column;
  width: 50px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface);
}
.cb-label {
  font-size: 7px;
  font-weight: 700;
  background: #e8e2d8;
  padding: 2px 0;
  text-align: center;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.cb-hs, .cb-eb {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0;
  color: #fff;
}
.cb-char {
  font-family: 'Noto Serif SC', serif;
  font-size: 20px;
  line-height: 1;
}
.cb-name {
  font-size: 7px;
  font-weight: 600;
  text-transform: uppercase;
}
.cb-eb {
  border-top: 1px solid rgba(255,255,255,0.3);
}

@media(max-width:768px) {
  .center-bazi-col { width: 35px; }
  .cb-char { font-size: 14px; }
  .cb-name { font-size: 5px; }
}

.center-name { font-family:'Playfair Display',serif; font-size:16px; font-weight:600; color:#1a1612; margin-bottom:8px; text-align:center; }
.center-info { font-size:11px; color:#2a2420; text-align:center; line-height:1.7; }
.center-info strong { color:#6a4e08; }
.center-elemento { margin-top:8px; font-size:10px; color:var(--gold); font-style:italic; text-align:center; }

/* Cores por elemento */
.elem-madeira { color:var(--c-madeira); } .elem-fogo { color:var(--c-fogo); }
.elem-terra { color:var(--c-terra); } .elem-metal { color:var(--c-metal); }
.elem-agua { color:var(--c-agua); }
.bg-madeira { background:var(--c-madeira); } .bg-fogo { background:var(--c-fogo); }
.bg-terra { background:var(--c-terra); } .bg-metal { background:var(--c-metal); }
.bg-agua { background:var(--c-agua); }

/* Transit controls no centro */
.transit-controls {
  margin-top: 10px;
  padding: 8px 12px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.transit-age-display { font-size: 10px; font-weight: 700; color: var(--text-2); text-align: center; }
.transit-nav { display: flex; align-items: center; gap: 4px; }
.transit-nav button {
  padding: 2px 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  transition: all 0.2s;
}
.transit-nav button:hover { background: var(--gold); color: #fff; }

/* Badges de Transformação Si Hua — cores corretas em desktop e mobile */
.sihua-badge { color: #ffffff !important; background-color: #3333FF !important; }
.sihua-badge.badge-ji { background-color: #FF3333 !important; }
.sihua-badge.badge-lu { background-color: #2E7D32 !important; }
.sihua-badge.badge-quan { background-color: #757575 !important; }
.sihua-badge.badge-ke { background-color: #3333FF !important; }

.sihua-2x {
  font-size: 0.8em;
  font-weight: 800;
  color: #d00000;
  margin-left: 1px;
  vertical-align: super;
}
@media(max-width:768px) {
  .sihua-2x { font-size: 1.8em; margin-left: 0px; }
}

/* Cores das estrelas benéficas (verde) e maléficas (vermelho) */
.estrela-red, .estrela-red .name, .estrela-red .cn { color: #d00000 !important; font-weight: 800 !important; }
.estrela-green, .estrela-green .name, .estrela-green .cn { color: #008800 !important; font-weight: 800 !important; }

/* Checkboxes no centro do mapa */
.center-opts {
  margin-top: 8px;
  padding-top: 8px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.center-opts .chk {
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.05em;
}

/* Transit tag — canto superior direito de cada palácio (desktop) */
.palace-transit-tag {
  position: absolute;
  top: 4px;
  right: 6px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
  pointer-events: none;
  z-index: 5;
  text-align: right;
}
.pt-year { font-size: 9px; font-weight: 700; color: #2e6aaa; display: block; }
.pt-age  { font-size: 8px; font-weight: 600; color: #1a1612; margin-top: 1px; display: block; }
.pt-decade { font-size: 9px; font-weight: 700; color: #8a6510; margin-top: 1px; display: block; }
.pt-year-rel { font-size: 9px; font-weight: 700; color: #3a9e5f; margin-top: 1px; display: block; }

.zwds-rel-names {
  position: absolute;
  top: 22px;
  right: 6px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
  z-index: 5;
  text-align: right;
}

.zwds-rel-names {
  position: absolute;
  top: 22px;
  right: 6px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
  z-index: 5;
  text-align: right;
}

/* Destaque da Década Atual */
.decade-highlight {
  border: 1px solid #d00000 !important;
  background: rgba(208, 0, 0, 0.08) !important;
  color: #d00000 !important;
  font-weight: 800 !important;
  border-radius: 2px;
  padding: 0 2px;
  display: inline-block;
}

@media(max-width:700px) {
  .zwds-grid { grid-template-columns:repeat(2,1fr); grid-template-rows:auto; }
  .zwds-cell.is-center { grid-column:1/3; grid-row:auto; min-height:140px; }
  .zwds-cell { min-height:140px; }
  .form-row { flex-direction:column; }
  .field { min-width:100%; }
}

/* --- Estilos de Autenticação e Toolbar (visual index.html) --- */
.lang-selector-wrap {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}
.lang-selector {
  display: flex;
  gap: 4px;
  background: rgba(138,101,16,0.08);
  border: 1px solid rgba(138,101,16,0.20);
  border-radius: 20px;
  padding: 3px 6px;
}
.lang-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  color: #5a5248;
  padding: 2px 7px;
  border-radius: 12px;
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.04em;
}
.lang-btn:hover { background: rgba(138,101,16,0.12); color: #1a1612; }
.lang-btn.active { background: #8a6510; color: #fff; font-weight: 700; }

#auth-bar {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; margin-bottom: 10px; min-height: 36px;
  contain: layout;
}
.auth-btn {
  background: none; border: 1px solid var(--border2); border-radius: 6px;
  color: var(--text-3); font-family: 'Inter', sans-serif; font-size: 11px;
  font-weight: 500; padding: 5px 12px; cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  letter-spacing: 0.04em;
}
.auth-btn:hover { background: rgba(138,101,16,0.08); border-color: var(--gold-dim); color: var(--text); }
.auth-btn.primary { background: #8a6510; border-color: #8a6510; color: #fff; font-weight: 700; }
.auth-btn.primary:hover { opacity: 0.88; }
.auth-btn.danger { border-color: #c03030; color: #c03030; }
.auth-btn.danger:hover { background: rgba(192,48,48,0.07); }
#auth-user-name {
  font-size: 11px; font-weight: 600; color: var(--gold);
  letter-spacing: 0.03em; padding: 5px 4px;
}

.language-bar { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin: 10px 0; }

/* ══════ OVERLAY / MODAL (visual index.html) ══════ */
.bz-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 16px; animation: bzFadeIn 0.18s ease;
}
@keyframes bzFadeIn { from{opacity:0} to{opacity:1} }
.bz-modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; width: 100%; max-width: 400px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.22); animation: bzSlideUp 0.22s ease;
  overflow: hidden;
}
.bz-modal.wide { max-width: 520px; }
@keyframes bzSlideUp { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:translateY(0)} }
.bz-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 12px; border-bottom: 1px solid var(--border);
  background: #f5f0e8;
}
.bz-modal-title {
  font-size: 13px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: #3a3028;
}
.bz-modal-close {
  background: none; border: none; cursor: pointer; font-size: 18px;
  color: var(--text-3); padding: 0 4px; line-height: 1;
  transition: color 0.15s;
}
.bz-modal-close:hover { color: #c03030; }
.bz-modal-body { padding: 18px 20px 20px; background: var(--surface, #fff); }
.bz-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 18px;
}
.bz-tab {
  flex: 1; padding: 8px 4px; text-align: center; font-size: 11px;
  font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s; background: none; border-top: none;
  border-left: none; border-right: none;
}
.bz-tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.bz-tab-panel { display: none; }
.bz-tab-panel.active { display: block; }
.bz-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.bz-field label {
  font-size: 9px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-3);
}
.bz-field input {
  background: #fff; border: 1px solid var(--border2); border-radius: 6px;
  color: var(--text); font-family: 'Inter', sans-serif; font-size: 13px;
  padding: 8px 11px; outline: none; transition: border-color 0.2s; width: 100%;
}
.bz-field input:focus { border-color: var(--gold-dim); }
.bz-submit {
  width: 100%; padding: 10px; background: #8a6510; border: none;
  border-radius: 7px; color: #fff; font-family: 'Inter', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; cursor: pointer;
  transition: opacity 0.2s; box-shadow: 0 2px 14px rgba(138,101,16,0.25);
  margin-top: 4px;
}
.bz-submit:hover { opacity: 0.88; }
.bz-submit:disabled { opacity: 0.45; cursor: not-allowed; }
.bz-msg {
  font-size: 11px; padding: 8px 12px; border-radius: 6px; margin-bottom: 12px;
  display: none;
}
.bz-msg.error { background: rgba(200,60,60,0.09); border: 1px solid rgba(200,60,60,0.22); color: #c03030; }
.bz-msg.success { background: rgba(46,130,80,0.09); border: 1px solid rgba(46,130,80,0.22); color: #1a5c30; }
.bz-msg.info { background: rgba(138,101,16,0.08); border: 1px solid rgba(138,101,16,0.22); color: #6a4e08; }
.bz-maps-list { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; }
.bz-map-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; gap: 10px;
}
.bz-map-item-name { font-size: 12px; font-weight: 600; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bz-map-actions { display: flex; gap: 6px; }
.bz-map-btn {
  font-size: 10px; font-weight: 600; padding: 4px 10px; border-radius: 5px;
  border: 1px solid var(--border2); background: none; cursor: pointer;
  color: var(--text-3); transition: all 0.15s; white-space: nowrap;
}
.bz-map-btn:hover { border-color: var(--gold); color: var(--gold); background: rgba(138,101,16,0.06); }
.bz-map-btn.del { border-color: rgba(192,48,48,0.3); }
.bz-map-btn.del:hover { border-color: #c03030; color: #c03030; background: rgba(192,48,48,0.06); }
.bz-empty { text-align: center; color: var(--text-3); font-size: 12px; font-style: italic; padding: 24px 0; }
.bz-save-row {
  display: flex; gap: 8px; align-items: center; margin-top: 14px;
  padding-top: 14px; border-top: 1px solid var(--border);
}
.bz-save-row input {
  flex: 1; background: #fff; border: 1px solid var(--border2); border-radius: 6px;
  color: var(--text); font-family: 'Inter', sans-serif; font-size: 12px;
  padding: 7px 10px; outline: none; transition: border-color 0.2s;
}
.bz-save-row input:focus { border-color: var(--gold-dim); }
.bz-save-row button {
  background: #8a6510; border: none; border-radius: 6px; color: #fff;
  font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 700;
  padding: 7px 14px; cursor: pointer; white-space: nowrap;
  transition: opacity 0.2s;
}
.bz-save-row button:hover { opacity: 0.88; }
.bz-profile-section { margin-bottom: 16px; }
.bz-profile-section-title {
  font-size: 9px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 10px;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.bz-pending-badge {
  display: inline-block; font-size: 9px; font-weight: 700; padding: 2px 8px;
  border-radius: 10px; background: rgba(180,120,0,0.12);
  color: #6a4e08; border: 1px solid rgba(138,101,16,0.25); margin-left: 6px;
}
.bz-delete-zone { margin-top: 6px; padding-top: 14px; border-top: 1px solid rgba(200,60,60,0.2); }

/* --- Modal de Perfil --- */


.map-toolbar { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 20px; margin: 20px auto; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; box-shadow: 0 2px 12px rgba(0,0,0,0.07); max-width: 800px; }
.toolbar-btn { padding: 8px 16px; border: none; border-radius: 6px; font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 6px; }
.btn-generate { background: var(--gold); color: #fff; box-shadow: 0 2px 8px rgba(138,101,16,0.2); }
.btn-save-tool { background: #2ea85a; color: #fff; box-shadow: 0 2px 8px rgba(46,168,90,0.2); }
.btn-delete-tool { background: #c03030; color: #fff; }
.toolbar-btn:hover { transform: translateY(-1px); opacity: 0.9; }
.toolbar-btn:active { transform: translateY(0); }
.toolbar-select { padding: 7px 12px; border: 1px solid var(--border2); border-radius: 6px; font-size: 12px; min-width: 200px; background: #fff; color: var(--text); outline: none; }

/* Controle de Visibilidade — sem CLS: reserva espaço, muda só visibilidade */
.logged-only {
  visibility: hidden;
  height: 0;
  overflow: hidden;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  pointer-events: none;
  border: none !important;
  box-shadow: none !important;
}
.guest-only { display: block; }
.is-logged .logged-only {
  visibility: visible;
  height: auto;
  overflow: visible;
  margin-top: 20px !important;
  margin-bottom: 0 !important;
  padding-top: 12px !important;
  padding-bottom: 12px !important;
  pointer-events: auto;
  border: 1px solid var(--border) !important;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07) !important;
}
.is-logged .guest-only { display: none !important; }
