* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, 'Segoe UI', sans-serif;
  font-size: 13px;
  background: #f0f0f0;
  color: #000;
}

/* ── HEADER ── */
#app-header {
  background: #1f3864;
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#app-header h1 {
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 0.5px;
}

/* ── TOTAIS ── */
#totais-bar {
  background: #2e4d91;
  color: #fff;
  display: flex;
  gap: 0;
  border-bottom: 2px solid #1f3864;
}

.total-item {
  padding: 8px 20px;
  text-align: center;
  border-right: 1px solid #4a6bb5;
  flex: 1;
}

.total-item:last-child {
  border-right: none;
}

.total-item .total-num {
  font-size: 20px;
  font-weight: bold;
  display: block;
}

.total-item .total-label {
  font-size: 11px;
  opacity: 0.85;
  text-transform: uppercase;
}

/* ── TABS ── */
#tab-bar {
  background: #dce6f1;
  display: flex;
  border-bottom: 2px solid #1f3864;
}

.tab-btn {
  padding: 9px 22px;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
  background: none;
  border: none;
  border-right: 1px solid #b8c9e0;
  color: #1f3864;
  letter-spacing: 0.3px;
}

.tab-btn:hover {
  background: #c5d5eb;
}

.tab-btn.active {
  background: #fff;
  border-bottom: 2px solid #fff;
  margin-bottom: -2px;
  color: #1f3864;
}

/* ── MAIN CONTENT ── */
#main-content {
  padding: 12px 14px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ── TOOLBAR ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.toolbar select {
  padding: 5px 8px;
  font-size: 13px;
  border: 1px solid #aaa;
}

.toolbar label {
  font-weight: bold;
  color: #1f3864;
}

/* ── BUTTONS ── */
.btn {
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid #888;
  background: #e8e8e8;
  font-weight: bold;
}

.btn:hover {
  background: #d0d0d0;
}

.btn-primary {
  background: #1f3864;
  color: #fff;
  border-color: #1f3864;
}

.btn-primary:hover {
  background: #2e4d91;
}

.btn-danger {
  background: #c00000;
  color: #fff;
  border-color: #c00000;
  font-size: 11px;
  padding: 3px 8px;
}

.btn-danger:hover {
  background: #a00000;
}

.btn-edit {
  background: #1f3864;
  color: #fff;
  border-color: #1f3864;
  font-size: 11px;
  padding: 3px 8px;
}

.btn-edit:hover {
  background: #2e4d91;
}

.btn-sm {
  font-size: 11px;
  padding: 3px 8px;
}

.btn-reset {
  background: #7f7f7f;
  color: #fff;
  border-color: #7f7f7f;
  font-size: 11px;
  padding: 4px 10px;
}

.btn-reset:hover {
  background: #595959;
}

/* ── TABELAS ── */
.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  background: #fff;
}

th {
  background: #1f3864;
  color: #fff;
  padding: 6px 8px;
  text-align: center;
  font-size: 12px;
  white-space: nowrap;
  border: 1px solid #14284a;
}

td {
  padding: 5px 8px;
  border: 1px solid #c0c0c0;
  vertical-align: middle;
  white-space: nowrap;
}

tr:nth-child(even) td {
  background: #f2f2f2;
}

tr:nth-child(odd) td {
  background: #fff;
}

tr.row-clickable:hover td {
  background: #dce6f1 !important;
  cursor: pointer;
}

td.center {
  text-align: center;
}

td.num {
  text-align: center;
  font-weight: bold;
}

/* ── STATUS BADGES ── */
.status-completo {
  background: #c6efce;
  color: #276221;
  font-weight: bold;
  padding: 2px 8px;
  display: inline-block;
  border: 1px solid #97d099;
  font-size: 11px;
}

.status-vaga {
  background: #ffeb9c;
  color: #9c6500;
  font-weight: bold;
  padding: 2px 8px;
  display: inline-block;
  border: 1px solid #f0c000;
  font-size: 11px;
}

/* ── ALOJAMENTO BLOCK (DETALLADO) ── */
.aloj-block {
  margin-bottom: 18px;
}

.aloj-block-header {
  background: #dce6f1;
  border: 1px solid #b8c9e0;
  border-bottom: none;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.aloj-block-title {
  font-weight: bold;
  color: #1f3864;
  font-size: 13px;
}

.aloj-block-sub {
  font-size: 11px;
  color: #555;
}

.aloj-block-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ── MODAL ── */
#modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  justify-content: center;
  align-items: flex-start;
  padding-top: 60px;
}

#modal-overlay.open {
  display: flex;
}

#modal-box {
  background: #fff;
  border: 2px solid #1f3864;
  width: 480px;
  max-width: 96vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

#modal-header {
  background: #1f3864;
  color: #fff;
  padding: 8px 12px;
  font-weight: bold;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#modal-close {
  cursor: pointer;
  font-size: 16px;
  background: none;
  border: none;
  color: #fff;
  font-weight: bold;
  line-height: 1;
}

#modal-close:hover {
  color: #ffeb9c;
}

#modal-body {
  padding: 14px;
  overflow-y: auto;
  flex: 1;
}

#modal-footer {
  padding: 10px 14px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px solid #ddd;
}

/* ── FORM ── */
.form-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

.form-row label {
  width: 130px;
  font-weight: bold;
  font-size: 12px;
  flex-shrink: 0;
}

.form-row input,
.form-row select {
  flex: 1;
  padding: 4px 7px;
  font-size: 13px;
  border: 1px solid #aaa;
}

.form-section-title {
  font-weight: bold;
  color: #1f3864;
  font-size: 12px;
  margin: 10px 0 6px 0;
  border-bottom: 1px solid #dce6f1;
  padding-bottom: 3px;
  text-transform: uppercase;
}

/* ── OCUPANTES LIST ── */
.ocupante-list {
  margin-bottom: 8px;
}

.ocupante-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.ocupante-row input {
  flex: 1;
  padding: 4px 7px;
  font-size: 13px;
  border: 1px solid #aaa;
}

.ocupante-num {
  width: 18px;
  text-align: right;
  font-size: 12px;
  color: #555;
  flex-shrink: 0;
}

.add-ocupante-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.add-ocupante-row input {
  flex: 1;
  padding: 4px 7px;
  font-size: 13px;
  border: 1px solid #aaa;
}

/* ── LIVRE HIGHLIGHT ── */
td.livre-zero {
  color: #c00000;
  font-weight: bold;
}

td.livre-pos {
  color: #276221;
  font-weight: bold;
}

/* ── SECTION DIVIDERS ── */
.section-label {
  background: #dce6f1;
  color: #1f3864;
  font-weight: bold;
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid #b8c9e0;
  border-bottom: none;
}

/* ── EMPTY STATE ── */
.empty-msg {
  text-align: center;
  color: #888;
  padding: 20px;
  font-style: italic;
}

/* ── CONFIRM DIALOG ── */
#confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

#confirm-overlay.open {
  display: flex;
}

#confirm-box {
  background: #fff;
  border: 2px solid #c00000;
  padding: 20px 24px;
  width: 320px;
  text-align: center;
}

#confirm-box p {
  margin-bottom: 16px;
  font-size: 13px;
}

#confirm-box .confirm-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}
