:root {
  --terracotta: #9A3324;
  --terracotta-dark: #6E2117;
  --gold: #D9A441;
  --teal: #1F4E5F;
  --teal-light: #E8EEF0;
  --cream: #F7F3EC;
  --darkbg: #2B1810;
  --ink: #2B2420;
  --muted: #6B6058;
  --green: #2E7D4F;
}

* { box-sizing: border-box; }

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

body {
  font-family: -apple-system, "Segoe UI", Calibri, Arial, sans-serif;
  margin: 0;
  background: #FBF9F6;
  color: var(--ink);
}

header.topbar {
  background: var(--darkbg);
  color: white;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header.topbar a.brand {
  color: white;
  text-decoration: none;
  font-family: Georgia, "Cambria", serif;
  font-size: 22px;
  font-weight: bold;
}

header.topbar a.brand span {
  color: var(--gold);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

h1 { font-family: Georgia, Cambria, serif; font-size: 30px; margin: 0 0 4px; }
h2 { font-family: Georgia, Cambria, serif; font-size: 22px; margin: 40px 0 14px; color: var(--terracotta); }
h3 { font-size: 16px; margin: 0 0 6px; }

.muted { color: var(--muted); font-size: 14px; }

.trip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 20px; }

.card {
  background: white;
  border: 1px solid #EAE1D4;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

.card a.title-link { color: var(--ink); text-decoration: none; }
.card a.title-link:hover { color: var(--terracotta); }

.btn {
  display: inline-block;
  background: var(--terracotta);
  color: white;
  border: none;
  padding: 9px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { background: var(--terracotta-dark); }
.btn.secondary { background: var(--teal); }
.btn.secondary:hover { background: #163a47; }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid #DCD3C6; }
.btn.danger { background: #b3261e; }
.btn.small { padding: 5px 10px; font-size: 12px; }

form.inline { display: inline; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.form-grid .full { grid-column: 1 / -1; }

label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #DCD3C6;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
textarea { resize: vertical; min-height: 60px; }

.section-nav { display: flex; gap: 18px; margin: 18px 0 0; flex-wrap: wrap; }
.section-nav a { color: var(--teal); text-decoration: none; font-size: 14px; font-weight: 600; }
.section-nav a:hover { text-decoration: underline; }

/* ---- Collapsible modules (native details/summary) ---- */
details.module {
  margin-top: 24px;
  border: 1px solid #EAE1D4;
  border-radius: 10px;
  background: white;
  padding: 4px 18px 18px;
}
details.module summary.module-summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 0;
  display: flex;
  align-items: center;
}
details.module summary.module-summary::-webkit-details-marker { display: none; }
details.module summary.module-summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 10px;
  color: var(--terracotta);
  font-size: 14px;
  transition: transform 0.15s ease;
}
details.module[open] summary.module-summary::before { transform: rotate(90deg); }
details.module summary.module-summary h2 { margin: 0; display: inline; }
details.module .module-body { padding-top: 6px; }

details.day-activities { margin-top: 8px; border: none; background: transparent; padding: 0; }
details.day-activities summary {
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  color: var(--teal);
  font-weight: 600;
  padding: 4px 0;
}
details.day-activities summary::-webkit-details-marker { display: none; }
details.day-activities summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.15s ease;
}
details.day-activities[open] summary::before { transform: rotate(90deg); }

.day-card { border-left: 4px solid var(--gold); padding-left: 14px; margin-bottom: 18px; }
.day-card .meta { color: var(--muted); font-size: 13px; margin-bottom: 6px; }

/* Each activity is its own collapsible row. Collapsed by default: only the
   summary line (icon, text, time, status badge) shows; expanding reveals
   the Editar/Eliminar actions. */
details.activity-details {
  border-bottom: 1px solid #F0E9DC;
}
details.activity-details:last-child { border-bottom: none; }
summary.activity-row {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 14px;
  flex-wrap: wrap;
}
summary.activity-row::-webkit-details-marker { display: none; }
summary.activity-row::before {
  content: "▸";
  display: inline-block;
  color: var(--muted);
  font-size: 11px;
  transition: transform 0.15s ease;
  margin-right: 2px;
}
details.activity-details[open] summary.activity-row::before { transform: rotate(90deg); }
.activity-row .emoji { width: 20px; text-align: center; }
.activity-actions { display: flex; gap: 8px; padding: 2px 0 10px 20px; }

.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.res-card { background: var(--cream); border-radius: 8px; padding: 14px; }
.res-card.res-done { background: #EAF3EC; }
.res-card h3 { color: var(--terracotta); }
.res-card img { max-width: 100%; border-radius: 6px; margin-top: 8px; }
.res-card .price { font-size: 12.5px; color: var(--muted); font-style: italic; margin-top: 6px; }

/* ---- Reservations as a compact list ---- */
.res-list { display: flex; flex-direction: column; border: 1px solid #EAE1D4; border-radius: 8px; overflow: hidden; }
.res-list-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid #F0E9DC;
  background: white;
}
.res-list-row:last-child { border-bottom: none; }
.res-list-row.res-done { background: #F3FAF5; }
.res-list-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1 1 320px; }
.res-list-meta { font-size: 12.5px; flex: 1 1 260px; }
.res-list-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.badge.cat-badge { background: var(--teal-light); color: var(--teal); margin-left: 0; }

.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; margin-top: 8px; }
.thumb-grid img { width: 100%; height: 70px; object-fit: cover; border-radius: 6px; margin-top: 0; }

.lightbox-img { cursor: zoom-in; }

.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 14, 10, 0.9);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox-overlay.open { display: flex; }
.lightbox-overlay img { max-width: 92%; max-height: 92%; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }

/* ---- Modal dialogs (native <dialog>) ---- */
dialog.modal {
  border: none;
  border-radius: 12px;
  padding: 22px 24px;
  max-width: 640px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
dialog.modal::backdrop { background: rgba(20, 14, 10, 0.55); }
dialog.modal.modal-wide { max-width: 920px; }

/* ---- Expense report (dashboard) ---- */
.expense-total { font-size: 15px; margin-bottom: 12px; }
.expense-tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.mini-table-title { font-size: 13px; font-weight: 700; color: var(--teal); margin-bottom: 6px; }
table.mini-table { width: 100%; border-collapse: collapse; }
table.mini-table th, table.mini-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #EAE1D4; font-size: 13px; }
table.mini-table th { color: var(--muted); font-weight: 600; }
table.mini-table td:nth-child(2), table.mini-table td:nth-child(3),
table.mini-table th:nth-child(2), table.mini-table th:nth-child(3) { text-align: right; }

.checklist-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.checklist-col { border-radius: 8px; padding: 14px; }
.checklist-item { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; font-size: 13.5px; flex-wrap: wrap; }
.checklist-item.done { color: var(--muted); text-decoration: line-through; }

table.budget { width: 100%; border-collapse: collapse; margin-top: 10px; }
table.budget th, table.budget td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #EAE1D4; font-size: 14px; }
table.budget th { background: var(--terracotta); color: white; }

.empty-note { color: var(--muted); font-style: italic; font-size: 13.5px; }

.top-actions { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 6px;
}
.badge.urgente { background: #FBEAE6; color: var(--terracotta); }
.badge.pronto { background: #FCF3E3; color: #B8791E; }
.badge.antes { background: #FBF6E3; color: #9C8324; }
.badge.llegando { background: var(--teal-light); color: var(--teal); }

.checkbox-list { max-width: 600px; margin-top: 10px; }
.checkbox-row { display: block; padding: 6px 0; font-size: 14px; }
.checkbox-row input { width: auto; display: inline; margin-right: 8px; }

/* ---- Dashboard: progress + Gantt roadmap ---- */
.progress-summary { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 16px; }
.progress-stat-num { font-size: 26px; font-weight: 700; color: var(--terracotta); font-family: Georgia, Cambria, serif; }
.progress-stat-label { font-size: 12.5px; color: var(--muted); }

.progress-bar-outer {
  position: relative;
  background: #EFE8DC;
  border-radius: 20px;
  height: 26px;
  overflow: hidden;
}
.progress-bar-inner { background: var(--green); height: 100%; border-radius: 20px 0 0 20px; transition: width 0.2s ease; }
.progress-bar-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; color: var(--ink);
}

.gantt-hours { display: flex; margin: 10px 0 4px; }
.gantt-hours span { font-size: 11px; color: var(--muted); text-align: left; }

.gantt-day { margin-bottom: 18px; }
.gantt-day-label { font-size: 14px; font-weight: 600; margin-bottom: 4px; }

/* Wraps the track so it can scroll horizontally on narrow screens instead
   of squeezing 12 hours of segments into an illegible sliver. */
.gantt-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.gantt-track {
  display: flex;
  width: 100%;
  height: 34px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #EAE1D4;
}
.gantt-seg { height: 100%; display: flex; align-items: center; overflow: hidden; border-right: 1px solid rgba(255,255,255,0.5); }
.gantt-seg:last-child { border-right: none; }
.gantt-seg-label {
  font-size: 10.5px;
  color: white;
  white-space: nowrap;
  padding: 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gantt-seg.done { background: var(--green); }
.gantt-seg.pending { background: var(--gold); }
.gantt-seg.none { background: var(--terracotta); }
.gantt-seg.free {
  background: repeating-linear-gradient(45deg, #F1ECE2, #F1ECE2 6px, #E8E1D3 6px, #E8E1D3 12px);
}
.gantt-seg.free .gantt-seg-label { color: var(--muted); }
.gantt-meta { font-size: 12px; margin-top: 4px; }
.gantt-unscheduled { font-size: 12px; color: var(--muted); margin-top: 2px; font-style: italic; }

.gantt-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 18px; font-size: 12.5px; color: var(--muted); }
.gantt-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.gantt-legend .dot.done { background: var(--green); }
.gantt-legend .dot.pending { background: var(--gold); }
.gantt-legend .dot.none { background: var(--terracotta); }
.gantt-legend .dot.free { background: #E8E1D3; border: 1px solid #cfc4b0; }

/* ---- Credit card catalog ---- */
.card-chip-list { display: flex; flex-direction: column; gap: 8px; max-width: 500px; }
.card-chip {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--cream); border-radius: 8px; padding: 10px 14px;
}

/* =====================================================================
   Mobile: phones and small tablets
   ===================================================================== */
@media (max-width: 640px) {
  .container { padding: 16px 12px 60px; }
  header.topbar { padding: 14px 16px; }
  header.topbar a.brand { font-size: 19px; }

  h1 { font-size: 23px; }
  h2 { font-size: 19px; margin: 28px 0 10px; }
  h3 { font-size: 15px; }

  /* Every two-column form becomes one column, full-width fields. */
  .form-grid { grid-template-columns: 1fr; }

  .trip-grid { grid-template-columns: 1fr; }
  .checklist-cols { grid-template-columns: 1fr; }
  .expense-tables { grid-template-columns: 1fr; }
  .res-grid { grid-template-columns: 1fr; }

  details.module { padding: 2px 12px 14px; margin-top: 16px; }

  .top-actions { gap: 8px; }
  .btn, .btn.small { padding: 10px 14px; font-size: 14px; }
  .btn.small { padding: 8px 12px; }

  /* Reservation rows: stack main info / meta / actions instead of a wide row. */
  .res-list-row { flex-direction: column; align-items: stretch; }
  .res-list-actions { width: 100%; justify-content: flex-start; }
  .res-list-actions form, .res-list-actions button { flex: 0 0 auto; }

  /* Tables can be wider than the screen: let them scroll sideways instead
     of squashing columns unreadably. */
  table.budget, table.mini-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }

  /* The Gantt needs real horizontal room per segment to stay legible, so
     let each day's track scroll rather than shrinking text to nothing. */
  .gantt-track { min-width: 520px; }
  .gantt-hours { min-width: 520px; }

  dialog.modal, dialog.modal.modal-wide {
    width: 94vw;
    max-width: 94vw;
    max-height: 90vh;
    padding: 16px;
  }

  .section-nav { gap: 10px 16px; font-size: 13px; }

  .progress-summary { gap: 18px; }
  .progress-stat-num { font-size: 22px; }

  .card-chip, .res-card { padding: 12px; }
}
