:root {
  --bg: #eef2f6;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #64748b;
  --border: #d9e2ec;
  --primary: #173b63;
  --primary-hover: #102a46;
  --danger: #b42318;
  --danger-hover: #8f1d14;
  --warning-bg: #fff7e6;
  --warning-border: #ffd591;
  --warning-text: #7a4b00;
  --shadow: 0 6px 18px rgba(15, 23, 42, 0.07);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  background: var(--bg) !important;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13.5px;
  line-height: 1.32;
}

h1, h2, h3 {
  color: var(--primary) !important;
  letter-spacing: 0;
}

h1 { font-size: clamp(22px, 2.4vw, 28px); }
h2 { font-size: clamp(17px, 2vw, 22px); }
h3 { font-size: 15.5px; }

.app-logo {
  display: block;
  width: min(128px, 50vw);
  max-width: 128px;
  height: auto;
  margin: 0 auto 10px;
}

.container,
.login-box,
.grupo,
.dia-escala,
.grupo-escala {
  background: var(--card) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
}

.container,
.login-box {
  width: min(100%, 1100px);
}

.login-box {
  margin: 24px auto;
}

button,
.button,
.link,
.logout-button,
.admin-button,
a.button,
a.link,
.voltar,
.actions a {
  background: var(--primary) !important;
  color: #fff !important;
  border: 0 !important;
  border-radius: 6px !important;
  box-shadow: none !important;
  min-height: 36px;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

button:hover,
.button:hover,
.link:hover,
.logout-button:hover,
.admin-button:hover,
a.button:hover,
a.link:hover,
.voltar:hover,
.actions a:hover {
  background: var(--primary-hover) !important;
  transform: translateY(-1px);
}

.danger,
.link-remove,
a[href*="remover"],
a[href*="eliminar"] {
  background: var(--danger) !important;
  color: #fff !important;
}

.danger:hover,
.link-remove:hover,
a[href*="remover"]:hover,
a[href*="eliminar"]:hover {
  background: var(--danger-hover) !important;
}

input,
select,
textarea {
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  color: var(--text);
  background: #fff;
  min-height: 34px;
  font-size: 13.5px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary) !important;
  outline: 3px solid rgba(23, 59, 99, 0.15);
}

form {
  gap: 12px;
}

table {
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--border);
}

th,
td {
  border: 1px solid var(--border) !important;
  padding: 6px;
}

th {
  background: #f4f7fb !important;
  color: var(--text) !important;
  font-weight: 700;
}

tr:nth-child(even) td {
  background: #fbfdff;
}

.erro,
.alerta {
  border-radius: var(--radius) !important;
}

.erro {
  background: #fde8e7 !important;
  border: 1px solid #f8b4ae !important;
  color: var(--danger) !important;
}

.alerta {
  background: var(--warning-bg) !important;
  border: 1px solid var(--warning-border) !important;
  color: var(--warning-text) !important;
}

.calendar {
  width: 100%;
}


.bloco {
  border-color: #b8c4d2 !important;
}

.nome {
  background: #edf2f7 !important;
  color: var(--text);
  border: 1px solid #d6dee8;
}

.topbar,
.filtros,
.acoes {
  gap: 10px !important;
}

.topbar {
  align-items: flex-start !important;
}

.week-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1 1 100%;
  margin-bottom: 2px;
}

.week-picker input {
  width: auto;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.toolbar-actions button,
.toolbar-actions .button {
  width: auto !important;
  min-width: 104px;
  min-height: 34px;
  padding: 7px 10px !important;
  text-align: center;
  white-space: nowrap;
}

.toolbar-actions .secondary {
  background: #4b6075 !important;
}

.toolbar-actions .secondary:hover {
  background: #39495a !important;
}

.admin-button.users { background: #1f5d8f !important; }
.admin-button.scale { background: #2f7d55 !important; }
.admin-button.value { background: #a87916 !important; }
.admin-button.groups { background: #6d4ba3 !important; }
.admin-button.payments { background: #b65f1b !important; }
.admin-button.availability { background: #3f6673 !important; }
.admin-button.manual { background: #3d6f68 !important; }
.admin-button.settings { background: #4f46a5 !important; }

.admin-button.users:hover { background: #17466d !important; }
.admin-button.scale:hover { background: #246141 !important; }
.admin-button.value:hover { background: #815d11 !important; }
.admin-button.groups:hover { background: #553a7f !important; }
.admin-button.payments:hover { background: #8f4914 !important; }
.admin-button.availability:hover { background: #304d57 !important; }
.admin-button.manual:hover { background: #2f5650 !important; }
.admin-button.settings:hover { background: #3f3784 !important; }

.password-form {
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: none;
  margin: 0;
}

.password-form input {
  width: 130px;
  min-width: 130px;
}

.btn-small {
  min-height: 31px !important;
  padding: 6px 9px !important;
  font-size: 12.5px !important;
  line-height: 1.2;
  white-space: nowrap;
}

.actions {
  min-width: 132px;
}

.actions a {
  display: block !important;
  margin: 4px auto !important;
  width: 118px;
  text-align: center;
}

@media (max-width: 760px) {
  body {
    display: block !important;
    padding: 16px !important;
  }

  .container,
  .login-box {
    padding: 20px !important;
    max-width: none !important;
  }

  .button-grid,
  .calendar,
  .grupo-grid {
    grid-template-columns: 1fr !important;
  }

  .coluna,
  .coluna.escala {
    width: 100% !important;
  }

  body:has(.coluna.escala) {
    display: block !important;
  }

  .filtros,
  .acoes,
  .topbar,
  .resumo {
    align-items: stretch !important;
    flex-direction: column !important;
  }

  .toolbar-actions,
  .week-picker,
  .password-form {
    width: 100%;
  }

  .toolbar-actions button,
  .toolbar-actions .button,
  .password-form input,
  .password-form button {
    width: 100% !important;
  }

  button,
  .button,
  .link,
  .logout-button,
  .admin-button,
  a.button,
  a.link,
  .voltar {
    width: 100%;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

@media print {
  body {
    background: #fff !important;
  }

  .container {
    border: 0;
    box-shadow: none !important;
  }
}
