:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #182230;
  --muted: #667085;
  --line: #d9e0ea;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --shadow: 0 18px 50px rgba(16, 24, 40, .08);
  --radius: 16px;
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 28px;
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.brand { font-weight: 800; font-size: 18px; color: var(--text); }
.nav { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.nav a {
  color: var(--muted);
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 999px;
}
.nav a:hover { background: #eef6f5; color: var(--brand-dark); text-decoration: none; }
.container { width: min(1760px, calc(100% - 16px)); margin: 16px auto; }
.hero, .section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.hero {
  align-items: center;
  padding: 28px;
  background: linear-gradient(135deg, #ffffff, #effaf8);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(28px, 3vw, 42px); margin-bottom: 8px; }
h2 { font-size: 20px; }
.eyebrow { color: var(--brand); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; margin-bottom: 6px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { text-decoration: none; border-color: #b8c5d6; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn.small { min-height: 32px; padding: 6px 9px; font-size: 12px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin: 18px 0; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat span { display: block; color: var(--muted); font-size: 13px; }
.stat strong { font-size: 34px; }
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; border: 1px solid var(--line); background: #effaf5; }
.alert-error, .danger-card { background: var(--danger-bg); border-color: #fecdca; color: #7a271a; }
.filters { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
label { display: grid; gap: 6px; color: #344054; font-size: 13px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  font: inherit;
  color: var(--text);
  background: #fff;
}
textarea { min-height: 92px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: #475467; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: #f8fafc; }
tr:hover td { background: #fbfcfe; }
.badge, .status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  background: #eef2f6;
  color: #344054;
}
.status-reservado { background: #e0f2fe; color: #075985; }
.status-confirmado { background: #dcfce7; color: #166534; }
.status-in { background: #ede9fe; color: #5b21b6; }
.status-no-disponible { background: #fee2e2; color: #991b1b; }
.status-out { background: #fef3c7; color: #92400e; }
.status-cancelado { background: #f2f4f7; color: #667085; }
.status-info { background: #fef3c7; color: #92400e; margin-left: 6px; font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
fieldset { border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 12px; }
legend { padding: 0 8px; font-weight: 900; }
.wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px,1fr)); gap: 8px; }
.check-pill { display: flex; align-items: center; gap: 8px; background: #f8fafc; padding: 10px; border: 1px solid var(--line); border-radius: 12px; font-weight: 800; }
.check-pill input { width: auto; min-height: auto; }
.check-pill small { color: var(--muted); font-weight: 500; }
.details-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
dl { display: grid; grid-template-columns: 150px 1fr; gap: 10px; margin: 0; }
dt { color: var(--muted); font-weight: 700; }
dd { margin: 0; }
.inline-actions, .inline-edit { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-edit input { min-width: 260px; }
.preline { white-space: pre-wrap; }
hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.link-danger { border: 0; background: transparent; color: var(--danger); cursor: pointer; font-weight: 800; }
.danger-zone { border-color: #fecdca; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.late-dot { font-size: 12px; color: var(--muted); font-weight: 800; }
.status-free { background: #dcfce7; color: #166534; }
.calendar-section-head { margin-bottom: 10px; }
.calendar-filters { padding: 12px 14px; margin-bottom: 10px; }
.calendar-card { padding: 0; overflow: hidden; }
.calendar-card--large { min-height: calc(100vh - 190px); }
.calendar-table-wrap { overflow-y: auto; overflow-x: hidden; max-height: calc(100vh - 180px); }
.calendar-table-wrap--fit { max-height: calc(100vh - 180px); }
.calendar-table-wrap--large { min-height: calc(100vh - 190px); }
.calendar-table { font-size: 12px; border-collapse: separate; border-spacing: 0; }
.calendar-table--fit { width: 100%; table-layout: fixed; min-width: 0; }
.calendar-table th, .calendar-table td { padding: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: top; }
.calendar-table thead th { position: sticky; top: 0; z-index: 4; background: #f8fafc; }
.calendar-table .sticky-col { position: sticky; left: 0; z-index: 5; background: #fff; box-shadow: 1px 0 0 var(--line); }
.calendar-table thead .sticky-col { background: #f8fafc; z-index: 6; }
.calendar-table--fit .sticky-date { width: 138px; min-width: 138px; }
.calendar-table--fit .dept-head { width: calc((100% - 138px) / var(--dept-count)); min-width: 0; padding: 10px 4px; text-align: center; font-size: 13px; line-height: 1.1; word-break: break-word; }
.month-row th {
  position: sticky;
  top: 34px;
  z-index: 3;
  height: 38px;
  padding: 0 12px;
  text-align: left;
  background: linear-gradient(90deg, #0f766e, #13a18f);
  color: #ffffff;
  border-bottom: 0;
  box-shadow: inset 0 -1px 0 rgba(255,255,255,.25);
}
.month-row span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: capitalize;
}
.calendar-table--fit .date-head { padding: 9px 8px; text-align: left; }
.calendar-table--fit .date-main { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.calendar-table--fit .month-start { background: #f7fbfa; }
.month-chip { display: inline-flex; align-items: center; padding: 3px 7px; border-radius: 999px; background: #dff2ff; color: #075985; font-style: normal; font-size: 10px; font-weight: 900; text-transform: capitalize; }
.calendar-table--fit .date-head small { display: block; margin-top: 4px; color: var(--muted); font-weight: 800; }
.calendar-table .slot { height: 60px; min-width: 0; position: relative; }
.calendar-table .slot-link { display: flex; height: 100%; min-height: 60px; padding: 5px 2px; flex-direction: column; justify-content: center; align-items: center; gap: 2px; text-align: center; color: inherit; text-decoration: none; position: relative; }
.calendar-table .slot-link:hover { text-decoration: none; filter: brightness(.98); }
.calendar-table .slot-link[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 7px);
  transform: translateX(-50%);
  z-index: 30;
  max-width: 180px;
  padding: 7px 9px;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(16, 24, 40, .22);
  pointer-events: none;
}
.calendar-table .slot-link[data-tooltip]:hover::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 2px);
  transform: translateX(-50%);
  z-index: 31;
  border: 5px solid transparent;
  border-top-color: #111827;
  pointer-events: none;
}
.calendar-table .slot-id { font-size: 12px; font-weight: 900; line-height: 1; }
.calendar-table .slot-link small { font-size: 10px; line-height: 1.05; color: #344054; max-width: 100%; overflow: hidden; }
.calendar-table .free { background: #dcfce7; }
.calendar-table .free .slot-link { color: #166534; }
.slot-free-mark { font-size: 17px; line-height: 1; font-weight: 900; }
.calendar-table .occupied { color: #111827; }
.calendar-table .reservado { background: #dff2ff; }
.calendar-table .confirmado { background: #dcfce7; }
.calendar-table .in { background: #ede9fe; }
.calendar-table .no-disponible { background: #fee2e2; }
.calendar-table .out { background: #fef3c7; }
.late { display: inline-grid; place-items: center; width: 15px; height: 15px; margin-top: 2px; border-radius: 999px; background: #111827; color: #fff; font-size: 10px; }
.actions-cell { white-space: nowrap; }
@media (max-width: 900px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar form { margin-left: 0 !important; }
  .calendar-table--fit .sticky-date { width: 104px; min-width: 104px; }
  .calendar-table .slot-link small { display: none; }
  .calendar-table--fit .dept-head { font-size: 10px; padding: 7px 2px; }
  .month-row th { top: 30px; }
  .calendar-table--fit .sticky-date { width: 96px; min-width: 96px; }
  .calendar-table .slot-link small { display: none; }
  .calendar-table--fit .dept-head { font-size: 10px; padding: 6px 2px; }
  .hero, .section-head { align-items: flex-start; flex-direction: column; }
  .stats-grid, .form-grid, .details-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  dl { grid-template-columns: 1fr; gap: 4px; }
}

/* Celulares chicos */
@media (max-width: 560px) {
  .container { width: calc(100% - 12px); margin: 10px auto; }
  .topbar { padding: 10px 14px; gap: 10px; }
  .brand { font-size: 16px; }
  .nav { gap: 2px; }
  .nav a { padding: 7px 8px; font-size: 13px; }
  .topbar form { display: flex; align-items: center; gap: 8px; }

  .card { padding: 14px; border-radius: 12px; }
  h1 { font-size: clamp(22px, 6vw, 28px); }
  h2 { font-size: 17px; }

  .hero { padding: 18px; }
  .section-head, .hero { gap: 10px; }
  .actions { width: 100%; }
  .actions .btn, .section-head .actions .btn { flex: 1 1 auto; }

  .filters { flex-direction: column; align-items: stretch; }
  .filters label { width: 100%; }
  .filters .btn { width: 100%; }

  .form-grid { gap: 12px; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }

  .checkbox-grid { grid-template-columns: repeat(auto-fill, minmax(105px,1fr)); }

  table { font-size: 12.5px; }
  th, td { padding: 8px 8px; }

  .room-grid { grid-template-columns: 1fr; }

  .calendar-table--fit .sticky-date { width: 78px; min-width: 78px; font-size: 11px; }
  .calendar-table--fit .dept-head { font-size: 9px; padding: 5px 2px; }
  .calendar-table .slot { height: 46px; }
  .calendar-table .slot-link { min-height: 46px; }
}


.contacts-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 560px;
}
.contact-client {
  background: #e0f2fe;
  color: #075985;
}
.contact-requester {
  background: #fef3c7;
  color: #92400e;
}


.holiday-legend {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
  background: #fef3c7;
  color: #92400e;
}
.holiday-row .date-head,
.calendar-table--fit .holiday-date {
  background: #fff8e6;
}
.holiday-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 6px;
}
.holiday-tag {
  display: inline-flex;
  max-width: 100%;
  padding: 2px 5px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 9px;
  font-weight: 900;
  line-height: 1.1;
  white-space: normal;
}
.calendar-table .free-holiday {
  background: #ecfccb;
}
.calendar-table .free-holiday .slot-link {
  color: #3f6212;
}


/* Fix calendario: evita que la fila del mes se superponga al scrollear */
.month-row th {
  position: static !important;
  top: auto !important;
  z-index: 1 !important;
}

.month-row span {
  min-height: 34px;
}

.calendar-table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
}

.calendar-table thead .sticky-col {
  z-index: 30;
}

.calendar-table .sticky-col {
  z-index: 10;
}

.calendar-table-wrap,
.calendar-table-wrap--fit,
.calendar-table-wrap--large {
  overflow-y: auto;
  overflow-x: hidden;
}

.calendar-table {
  border-collapse: separate;
  border-spacing: 0;
}


/* Fix16: colores de estados solicitados */
.status-confirmado,
.calendar-table .confirmado {
  background: #dff2ff !important;
  color: #075985 !important;
}

.status-reservado,
.calendar-table .reservado {
  background: #fef3c7 !important;
  color: #92400e !important;
}

.status-out,
.calendar-table .out {
  background: #ede9fe !important;
  color: #5b21b6 !important;
}

.status-in,
.calendar-table .in {
  background: #ffedd5 !important;
  color: #9a3412 !important;
}


/* Fix17: las festividades no alteran la tonalidad de las celdas internas */
.calendar-table .free.free-holiday,
.calendar-table .holiday-row .free.free-holiday {
  background: #dcfce7 !important;
}

.calendar-table .free.free-holiday .slot-link,
.calendar-table .holiday-row .free.free-holiday .slot-link {
  color: #166534 !important;
}

.calendar-table .holiday-row .slot.occupied.reservado {
  background: #fef3c7 !important;
  color: #92400e !important;
}

.calendar-table .holiday-row .slot.occupied.confirmado {
  background: #dff2ff !important;
  color: #075985 !important;
}

.calendar-table .holiday-row .slot.occupied.out {
  background: #ede9fe !important;
  color: #5b21b6 !important;
}

.calendar-table .holiday-row .slot.occupied.in {
  background: #ffedd5 !important;
  color: #9a3412 !important;
}


/* Fix18: Estado de habitaciones */
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.room-card {
  border-left: 8px solid #d0d5dd;
  margin-bottom: 0;
}

.room-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.room-card h2 {
  margin-bottom: 2px;
}

.room-detail {
  display: grid;
  gap: 3px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.room-detail strong {
  color: #344054;
}

.room-detail small {
  color: var(--muted);
}

.room-detail.empty {
  color: var(--muted);
}

.room-free {
  background: #dcfce7 !important;
  color: #166534 !important;
  border-left-color: #22c55e;
}

.room-occupied {
  background: #dff2ff !important;
  color: #075985 !important;
  border-left-color: #38bdf8;
}

.room-arrival {
  background: #fef3c7 !important;
  color: #92400e !important;
  border-left-color: #f59e0b;
}

.room-departure {
  background: #ede9fe !important;
  color: #5b21b6 !important;
  border-left-color: #8b5cf6;
}

.room-turnover {
  background: #ffedd5 !important;
  color: #9a3412 !important;
  border-left-color: #f97316;
}


/* Fix21: paleta San Luis Suites */
:root {
  --bg: #F7F3EA;
  --card: #FFFFFF;
  --text: #2F3F55;
  --muted: #6F7280;
  --line: #E4D8C4;

  --brand: #2F3F55;
  --brand-dark: #243246;
  --gold: #C6A35A;
  --gold-dark: #A98435;
  --gold-soft: #F3E7C9;
  --cream: #FAF7EF;
  --wood: #9C6737;
  --black-soft: #1F2328;

  --danger: #B42318;
  --danger-bg: #FFF4F0;
  --shadow: 0 18px 50px rgba(47, 63, 85, .10);
}

body {
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--brand);
}

a:hover {
  color: var(--gold-dark);
}

.topbar {
  background: rgba(255, 255, 255, .94);
  border-bottom-color: var(--line);
  box-shadow: 0 8px 28px rgba(47, 63, 85, .06);
}

.brand {
  color: var(--brand);
}

.nav a {
  color: var(--muted);
}

.nav a:hover {
  background: var(--gold-soft);
  color: var(--gold-dark);
}

.container {
  color: var(--text);
}

.hero {
  background: linear-gradient(135deg, #FFFFFF, var(--cream));
  border-color: var(--line);
}

.card,
.stat {
  background: var(--card);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

h1,
h2,
h3,
legend,
dt,
label {
  color: var(--text);
}

.eyebrow {
  color: var(--gold-dark);
}

.muted,
.stat span,
.check-pill small,
dt,
.room-detail small,
.late-dot {
  color: var(--muted);
}

.btn,
button.btn {
  background: #FFFFFF;
  color: var(--text);
  border-color: var(--line);
}

.btn:hover,
button.btn:hover {
  border-color: var(--gold);
  background: var(--cream);
  color: var(--brand);
}

.btn.primary,
button.btn.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #FFFFFF;
}

.btn.primary:hover,
button.btn.primary:hover {
  background: var(--gold-dark);
  border-color: var(--gold-dark);
  color: #FFFFFF;
}

input,
select,
textarea {
  background: #FFFFFF;
  color: var(--text);
  border-color: var(--line);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--gold-soft);
  border-color: var(--gold);
}

fieldset {
  border-color: var(--line);
  background: rgba(250, 247, 239, .45);
}

.check-pill {
  background: var(--cream);
  border-color: var(--line);
}

.alert {
  border-color: var(--line);
  background: var(--cream);
}

.alert-error,
.danger-card {
  background: var(--danger-bg);
  border-color: #F7C9BE;
}

th {
  background: var(--cream);
  color: var(--brand);
}

tr:hover td {
  background: #FFFCF4;
}

.badge,
.status {
  background: #F0E7D8;
  color: var(--brand);
}

.table-wrap {
  background: var(--card);
}

.calendar-card {
  background: var(--card);
}

.calendar-table thead th {
  background: var(--cream);
  color: var(--brand);
  border-color: var(--line);
}

.calendar-table thead .sticky-col {
  background: var(--cream);
}

.calendar-table .sticky-col {
  background: #FFFFFF;
}

.calendar-table--fit .month-start {
  background: #FFFCF4;
}

.month-row th {
  background: linear-gradient(90deg, var(--brand), var(--gold-dark)) !important;
  color: #FFFFFF;
}

.month-row span {
  color: #FFFFFF;
}

.calendar-table .slot-link[data-tooltip]:hover::after {
  background: var(--black-soft);
  color: #FFFFFF;
}

.calendar-table .slot-link[data-tooltip]:hover::before {
  border-top-color: var(--black-soft);
}

.late {
  background: var(--black-soft);
}

.holiday-row .date-head,
.calendar-table--fit .holiday-date {
  background: #FFF8E6;
}

.holiday-tag,
.holiday-legend {
  background: var(--gold-soft);
  color: var(--gold-dark);
}

.contacts-stats .stat,
.room-card {
  background: #FFFFFF;
}

/* Mantener colores funcionales del calendario */
.status-confirmado,
.calendar-table .confirmado {
  background: #dff2ff !important;
  color: #075985 !important;
}

.status-reservado,
.calendar-table .reservado {
  background: #fef3c7 !important;
  color: #92400e !important;
}

.status-out,
.calendar-table .out {
  background: #ede9fe !important;
  color: #5b21b6 !important;
}

.status-in,
.calendar-table .in {
  background: #ffedd5 !important;
  color: #9a3412 !important;
}

.status-free,
.calendar-table .free,
.calendar-table .free.free-holiday,
.calendar-table .holiday-row .free.free-holiday {
  background: #dcfce7 !important;
  color: #166534 !important;
}

.calendar-table .free .slot-link,
.calendar-table .free.free-holiday .slot-link,
.calendar-table .holiday-row .free.free-holiday .slot-link {
  color: #166534 !important;
}

.status-no-disponible,
.calendar-table .no-disponible {
  background: #fee2e2 !important;
  color: #991b1b !important;
}

.status-cancelado {
  background: #f2f4f7 !important;
  color: #667085 !important;
}

/* Estado de habitaciones: se mantienen colores operativos */
.room-free {
  background: #dcfce7 !important;
  color: #166534 !important;
  border-left-color: #22c55e;
}

.room-occupied {
  background: #dff2ff !important;
  color: #075985 !important;
  border-left-color: #38bdf8;
}

.room-arrival {
  background: #fef3c7 !important;
  color: #92400e !important;
  border-left-color: #f59e0b;
}

.room-departure {
  background: #ede9fe !important;
  color: #5b21b6 !important;
  border-left-color: #8b5cf6;
}

.room-turnover {
  background: #ffedd5 !important;
  color: #9a3412 !important;
  border-left-color: #f97316;
}


/* Fix22: barras de mes del calendario en negro */
.month-row th {
  background: #000000 !important;
  color: #FFFFFF !important;
}

.month-row span {
  color: #FFFFFF !important;
}

/* Fix23: logo + responsive general */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-logo {
  height: 36px;
  width: auto;
  display: block;
}
.login-card {
  max-width: 380px;
  margin: 48px auto;
}
.login-logo {
  display: block;
  height: 96px;
  width: auto;
  margin: 0 auto 4px;
}
.logout-form {
  margin-left: auto;
  display: flex;
  align-items: center;
}

/* Evitar zoom automático en iOS al enfocar inputs */
input, select, textarea {
  font-size: 16px;
}

/* Botones con área de toque cómoda en touch */
@media (pointer: coarse) {
  .btn, button.btn {
    min-height: 44px;
  }
  .nav a {
    padding: 10px 12px;
  }
}

@media (max-width: 900px) {
  .brand-logo { height: 30px; }
}

@media (max-width: 560px) {
  html { -webkit-text-size-adjust: 100%; }
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  .topbar {
    flex-wrap: wrap;
  }
  .brand { font-size: 15px; }
  .brand-logo { height: 26px; }
  .nav {
    order: 3;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    padding-bottom: 2px;
    justify-content: flex-start;
  }
  .nav a { flex: 0 0 auto; white-space: nowrap; }
  .logout-form { order: 2; margin-left: auto; }

  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .stat { padding: 12px; }
  .stat strong { font-size: 24px; }
  .stat span { font-size: 12px; }

  .login-card { margin: 24px auto; max-width: calc(100% - 16px); }
  .login-logo { height: 72px; }

  .details-grid { grid-template-columns: 1fr; }
}
