/* Restrita Podium - mobile and tablet layout fixes */

html {
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

.menu-toggle {
  display: none;
}

@media screen and (max-width: 768px) {
  div#cabecalho {
    height: auto;
    min-height: 0;
    padding: 10px 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
  }

  div#cabecalho span.logo {
    position: static;
    width: 220px;
    max-width: 85vw;
    height: 48px;
    background-size: contain;
    left: auto;
    top: auto;
  }

  div#cabecalho span.titulo {
    position: static;
    right: auto;
    top: auto;
    width: 100%;
    max-width: 100%;
    font-size: 11px;
    line-height: 1.35;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 12px;
    text-align: center;
    box-sizing: border-box;
  }

  div#cabecalho span.titulo .username {
    font-size: 12px;
    margin-left: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1 1 auto;
    min-width: 0;
  }

  div#cabecalho span.titulo .username a {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
  }

  small#sair {
    margin-left: 0;
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .menu-toggle {
    display: block;
    width: calc(100% - 20px);
    margin: 0 10px 0;
    padding: 12px 16px;
    border: 0;
    border-radius: 4px;
    background: #4a4a4a;
    color: #fff;
    font-size: 15px;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    box-sizing: border-box;
  }

  .menu-toggle:focus {
    outline: 2px solid #bfa232;
    outline-offset: 2px;
  }

  div#menu {
    height: auto;
    margin-bottom: 0.5em;
    background: #2b2b2b;
  }

  div#menu ul.ul_menu {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  div#menu.menu-open ul.ul_menu {
    display: flex;
  }

  div#menu ul li {
    float: none;
    width: 100%;
    height: auto;
    min-height: 44px;
    border-right: 0;
    border-left: 0;
    border-bottom: 1px solid #444;
    padding: 0;
  }

  div#menu ul li a {
    display: block;
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.35;
    box-sizing: border-box;
  }

  div#container {
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-sizing: border-box;
  }

  div#wrapper {
    margin-bottom: calc(56px + env(safe-area-inset-bottom, 0));
    padding-left: 8px;
    padding-right: 8px;
    padding-bottom: 16px;
    padding-top: env(safe-area-inset-top, 0);
    box-sizing: border-box;
  }

  .home-buttons {
    margin: 16px auto 24px;
    padding: 0 4px;
    gap: 10px;
    justify-content: center;
  }

  .home-buttons a {
    width: calc(50% - 8px);
    min-width: 0;
    max-width: none;
    flex: 1 1 calc(50% - 8px);
    height: auto;
    min-height: 88px;
    padding: 12px 8px;
    font-size: 16px;
    box-sizing: border-box;
  }

  .home-buttons a figure {
    flex-direction: column;
    text-align: center;
    margin: 0;
    width: 100%;
  }

  .home-buttons a figure img {
    margin: 0 auto 6px;
    max-width: 40px;
  }

  .home-buttons a figure figcaption {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 11px;
    line-height: 1.25;
    word-wrap: break-word;
  }

  .principal-panel {
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 24px !important;
    padding: 0 8px !important;
    box-sizing: border-box;
    font-size: 16px !important;
  }

  #scrollbar {
    height: auto;
    max-height: 220px;
    text-align: left;
  }

  form fieldset {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
  }

  form input,
  form select,
  form textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  form label {
    float: none;
    width: 100%;
    height: auto;
    padding-left: 0;
    margin-bottom: 4px;
  }

  span.titulo {
    width: 100% !important;
    float: none !important;
    margin-top: 0;
    text-align: left !important;
    display: block;
  }

  form input.atualizar {
    margin-left: 0;
  }

  /* div.submit is fixed at 325px in estilo.css; on narrow phones (<=345px)
     it overflows. Let it fill the panel and the buttons wrap naturally. */
  div.submit {
    width: auto !important;
    max-width: 100%;
  }

  form.restrito {
    width: 94% !important;
    padding: 12px !important;
  }

  form#login fieldset {
    width: 100% !important;
  }

  form#login input,
  form#login select {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  img.logo-topo {
    max-width: 92%;
    height: auto;
    margin-top: 16px;
  }

  .form-wrapper {
    margin-top: 6%;
    padding: 0 8px;
    box-sizing: border-box;
  }

  .modal-content {
    width: 92% !important;
    max-width: 92% !important;
    margin: 10% auto !important;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Panels/fieldsets that use fixed pixel widths inline must fit the screen.
     #wrapper raises specificity above page-level `fieldset { ... !important }`. */
  #wrapper fieldset {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    /* fieldset defaults to min-inline-size:min-content, which lets long
       unbreakable content (e.g. email links) push it past width:100% */
    min-inline-size: 0;
    min-width: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }

  /* Images and embeds never exceed the viewport.
     Bare selectors keep .home-buttons icon sizing (higher specificity) intact. */
  img {
    max-width: 100%;
    height: auto;
  }

  /* Wide content tables (HTML width attr, DataTables, Bootstrap .table) scroll
     horizontally inside their box instead of overflowing the whole page. */
  table.tabela,
  table.produtos,
  table.totais,
  #wrapper table[width],
  #wrapper table.table,
  .dataTables_wrapper table {
    width: 100% !important;
    margin-left: 0 !important;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .dataTables_wrapper {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Boletos: each table row becomes a card on mobile.
     Placed after the generic wide-table rule so it wins the cascade. */
  #wrapper table.boletos-tabela {
    display: block;
    width: 100% !important;
    border: 0 !important;
    overflow: visible;
    background: transparent;
  }

  table.boletos-tabela tbody {
    display: block;
  }

  table.boletos-tabela tr.boletos-titulo,
  table.boletos-tabela tr.boletos-cabecalho {
    display: none;
  }

  table.boletos-tabela tr.boleto-row {
    display: block;
    box-sizing: border-box;
    margin: 0 0 12px;
    padding: 8px 14px;
    border: 1px solid #d8cf9f;
    border-radius: 8px;
    background: #fff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    height: auto !important;
    text-align: left !important;
  }

  table.boletos-tabela tr.boleto-row td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border: 0;
    border-bottom: 1px solid #f0ead2;
    font-size: 14px;
    text-align: right;
  }

  table.boletos-tabela tr.boleto-row td:last-child {
    border-bottom: 0;
  }

  table.boletos-tabela tr.boleto-row td:before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-weight: bold;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #7d6709;
    text-align: left;
  }

  table.boletos-tabela tr.boleto-row td.boleto-valor {
    font-weight: bold;
    font-size: 16px;
  }

  /* status colors per card */
  table.boletos-tabela tr[data-status="pago"] td.boleto-situacao {
    color: #1d7a2c;
  }

  table.boletos-tabela tr[data-status="pendente"] td.boleto-situacao {
    color: #8a6d00;
    font-weight: bold;
  }

  table.boletos-tabela tr[data-status="vencido"] td.boleto-situacao {
    color: #c0392b;
    font-weight: bold;
  }

  table.boletos-tabela tr[data-status="vencido"] {
    border-color: #c0392b;
  }

  /* Acao entre Amigos (form_rifa) */
  .rifa-page h3 {
    font-size: 18px;
    line-height: 1.35;
    margin: 12px 0 16px;
    padding: 0 4px;
    text-shadow: none;
  }

  .rifa-page form#rifa fieldset {
    padding: 14px 12px 16px;
    margin-bottom: 14px;
  }

  .rifa-page form legend {
    font-size: 15px;
    padding: 6px 10px;
    max-width: calc(100% - 24px);
    box-sizing: border-box;
    margin-left: 0;
    float: none;
    display: inline-block;
  }

  .rifa-page form input:not([type="submit"]):not(.cadastrar),
  .rifa-page form select,
  .rifa-page form textarea {
    min-height: 44px;
    padding: 10px 12px !important;
    font-size: 16px;
    color: #222;
    background: #fff !important;
    margin-top: 4px;
    margin-bottom: 10px;
  }

  .rifa-page form input[disabled],
  .rifa-page form input[readonly] {
    color: #444;
    background: #f3f3f3 !important;
    opacity: 1;
  }

  .rifa-page .rifa-avisos {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #e8dfc0;
  }

  .rifa-page .rifa-aviso {
    color: #b00020;
    margin: 0 0 8px;
    padding: 0;
    font-size: 13px;
    line-height: 1.45;
    text-align: left;
  }

  .rifa-page .rifa-aviso:last-child {
    margin-bottom: 0;
  }

  .rifa-page .rifa-regulamento {
    text-align: center;
    margin: 12px 0 4px;
    font-size: 16px;
    font-weight: bold;
    line-height: 1.4;
  }

  .rifa-page div.submit {
    width: 100% !important;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 8px 0 4px;
    margin: 0;
  }

  .rifa-page a.btn_voltar,
  .rifa-page form input.cadastrar {
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 44px;
    height: auto;
    margin: 0 !important;
    padding: 12px 16px;
    font-size: 15px;
    line-height: 1.25;
    box-sizing: border-box;
    text-align: center;
  }

  .rifa-page form input.cadastrar {
    background: #9c810b !important;
    border: 1px solid #7d6709 !important;
    color: #fff !important;
    font-weight: bold;
    -webkit-text-fill-color: #fff;
    cursor: pointer;
  }

  .rifa-page .dataTables_wrapper {
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible;
    margin-top: 8px;
    padding-bottom: 12px;
  }

  .rifa-page .dataTables_wrapper .dataTables_length,
  .rifa-page .dataTables_wrapper .dataTables_filter {
    float: none;
    width: 100%;
    padding: 8px 0;
    box-sizing: border-box;
    text-align: left;
  }

  .rifa-page .dataTables_wrapper .dataTables_filter {
    margin-top: 4px;
  }

  .rifa-page .dataTables_wrapper .dataTables_filter label,
  .rifa-page .dataTables_wrapper .dataTables_length label {
    display: block;
    width: 100%;
    font-size: 14px;
    font-weight: bold;
    color: #333;
  }

  .rifa-page .dataTables_wrapper .dataTables_filter input {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 44px;
    margin: 6px 0 0;
    padding: 10px 12px;
    display: block;
    box-sizing: border-box;
    font-size: 16px;
  }

  .rifa-page .dataTables_wrapper .dataTables_length select {
    min-height: 40px;
    width: auto !important;
    min-width: 72px;
    margin-top: 6px;
    font-size: 15px;
  }

  .rifa-page .dataTables_wrapper .dataTables_info {
    float: none;
    width: 100%;
    text-align: center;
    margin: 10px 0;
    padding: 8px;
    box-sizing: border-box;
    font-size: 13px;
  }

  .rifa-page .dataTables_wrapper .dataTables_paginate {
    float: none;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin: 8px 0 20px;
    padding-bottom: env(safe-area-inset-bottom, 8px);
  }

  .rifa-page .dataTables_wrapper .dataTables_paginate a,
  .rifa-page .dataTables_wrapper .dataTables_paginate span {
    min-height: 40px;
    min-width: 40px;
    line-height: 40px;
    padding: 0 10px;
    font-size: 13px;
    box-sizing: border-box;
  }

  .rifa-page table#imoveis.rifa-tabela {
    display: block;
    width: 100% !important;
    margin: 12px 0 0;
    border: 0;
    overflow: visible;
    background: transparent;
  }

  .rifa-page table#imoveis.rifa-tabela thead {
    display: none;
  }

  .rifa-page table#imoveis.rifa-tabela tbody {
    display: block;
  }

  .rifa-page table#imoveis.rifa-tabela tbody tr {
    display: block;
    box-sizing: border-box;
    margin: 0 0 12px;
    padding: 8px 14px;
    border: 1px solid #d8cf9f;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    height: auto !important;
    text-align: left !important;
  }

  .rifa-page table#imoveis.rifa-tabela tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 7px 0;
    border: 0;
    border-bottom: 1px solid #f0ead2;
    font-size: 14px;
    text-align: right;
    word-break: break-word;
  }

  .rifa-page table#imoveis.rifa-tabela tbody td:before {
    content: attr(data-title);
    flex: 0 0 auto;
    max-width: 42%;
    font-weight: bold;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #7d6709;
    text-align: left;
  }

  .rifa-page table#imoveis.rifa-tabela tbody td:last-child {
    border-bottom: 0;
  }
}

@media screen and (max-width: 420px) {
  .home-buttons a {
    flex: 1 1 100%;
    width: 100%;
  }

  div#cabecalho span.titulo {
    flex-direction: column;
    gap: 4px;
  }

  div#cabecalho span.titulo .username {
    white-space: normal;
    word-break: break-word;
  }
}

@media screen and (min-width: 769px) {
  div#menu ul.ul_menu {
    flex-wrap: wrap;
  }

  div#menu ul li a {
    font-size: 11px;
    line-height: 1.2;
  }
}
