/* -------------------------------------------------------
   ESTILOS ORIGINAIS (alguns ajustados para responsividade,
   feedback visual e acessibilidade)
------------------------------------------------------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  .skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #ffe;
    color: #000;
    padding: 8px;
    z-index: 1000;
    text-decoration: none;
  }
  .skip-link:focus {
    top: 0;
  }
  
  body {
    background: #efe7da;
    color: #3a2e2e;
    font-family: "Georgia", serif;
    padding: 20px;
    transition: background 0.3s, color 0.3s;
  }
  body.high-contrast {
    background: #000;
    color: #fff;
  }
  h1, h2, h3, h4, legend {
    margin-bottom: 10px;
    font-weight: normal;
    color: inherit;
  }
  h1 {
    font-size: 2rem;
    margin-bottom: 20px;
    text-shadow: 1px 1px #fff;
  }
  label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
  }
  input[type="text"],
  input[type="date"],
  input[type="number"],
  select,
  textarea {
    display: block;
    width: 100%;
    padding: 8px;
    margin-bottom: 15px;
    border: 1px solid #bdae9d;
    border-radius: 4px;
    background: #fffaf0;
    font-family: "Georgia", serif;
    color: #3a2e2e;
  }
  input[type="radio"],
  input[type="checkbox"] {
    margin-right: 5px;
  }
  button {
    cursor: pointer;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    margin-right: 10px;
    font-weight: bold;
    font-family: "Georgia", serif;
    color: #ffffff;
    text-shadow: 1px 1px #333;
    box-shadow: 2px 2px 0 #6f6f6f;
    transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.1s ease;
  }
  button:active {
    transform: translate(2px, 2px);
    box-shadow: 0px 0px 0 #6f6f6f;
    opacity: 0.95;
  }
  .btn-primary {
    background: #8b4513;
  }
  .btn-secondary {
    background: #556b2f;
  }
  .btn-success {
    background: #2e8b57;
  }
  .btn-warning {
    background: #d2691e;
  }
  .btn-danger {
    background: #8b0000;
  }
  .fieldset {
    background: #faf4ee;
    border: 2px solid #d2c2a0;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 6px;
  }
  .afastamento-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 15px;
    align-items: flex-end;
  }
  .afastamento-row > div {
    flex: 1 1 200px;
  }
  #resultadoContainer {
    display: none;
    background: #fffaf0;
    border: 2px solid #d2c2a0;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
  }
  #resultadoContainer h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
  }
  #resultadoPreenchido {
    white-space: pre-wrap;
  }
  #historySection {
    background: #faf4ee;
    border: 2px solid #d2c2a0;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
  }
  .search-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
  }
  .history-record {
    background: #f2e9da;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #d2c2a0;
  }
  .history-record p {
    margin: 0;
    font-weight: normal;
  }
  .history-record button {
    margin-left: 5px;
    margin-top: 5px;
  }
  .required-field {
    border: 2px solid #8b0000 !important;
    background-color: #ffe4e1;
    position: relative;
    transition: background-color 0.5s;
  }
  .required-field::after {
    content: "✖";
    position: absolute;
    right: 5px;
    top: 5px;
    color: #8b0000;
    font-weight: bold;
  }
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  .fade-in {
    animation: fadeIn 0.7s ease forwards;
  }
  
  #modalOverlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
  }
  #modalBox {
    background: #fff8e7;
    border: 2px solid #d2c2a0;
    border-radius: 8px;
    padding: 20px;
    max-width: 400px;
    text-align: center;
  }
  #modalBox h4 {
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: inherit;
  }
  #modalBox p {
    margin-bottom: 20px;
    color: inherit;
  }
  #modalCloseBtn,
  #modalConfirmYesBtn,
  #modalConfirmNoBtn {
    background: #8b4513;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-family: "Georgia", serif;
    cursor: pointer;
    box-shadow: 2px 2px 0 #6f6f6f;
    text-shadow: 1px 1px #333;
    margin-right: 10px;
    margin-top: 10px;
  }
  #modalCloseBtn:active,
  #modalConfirmYesBtn:active,
  #modalConfirmNoBtn:active {
    transform: translate(2px, 2px);
    box-shadow: 0px 0px 0 #6f6f6f;
  }
  
  #editModalOverlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
  }
  #editModalBox {
    background: #fff8e7;
    border: 2px solid #d2c2a0;
    border-radius: 8px;
    padding: 20px;
    max-width: 450px;
    text-align: center;
  }
  #editModalBox h4 {
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: inherit;
  }
  #editModalBox p {
    margin-bottom: 20px;
    color: inherit;
  }
  .editModalInput {
    width: 100%;
    margin-bottom: 10px;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #bdae9d;
  }
  .btn-edit-confirm,
  .btn-edit-cancel {
    margin-top: 10px;
  }
  .btn-edit-confirm {
    background: #2e8b57; 
  }
  .btn-edit-cancel {
    background: #8b0000; 
  }
  
  @media (max-width: 768px) {
    .afastamento-row {
      flex-direction: column;
    }
    button {
      margin-bottom: 10px;
    }
  }
  
  #resultadoPreenchido,
  #modalMessage {
    white-space: pre-wrap;
  }
  
  /* Estatísticas */
  #estatisticasContainer {
    white-space: pre-wrap;
    background: #fffaf0;
    border: 2px solid #d2c2a0;
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
  }
  /* ---------------------------
     Estilos para tela de Login
  ---------------------------- */
  #loginOverlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
  }
  #loginBox {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
  }
  #loginBox input[type="password"] {
    padding: 10px;
    width: 200px;
    margin-bottom: 10px;
  }
  #loginBox button {
    padding: 10px 20px;
  }
  