:root {
  --navy: #27264f;
  --navy-soft: #34336a;
  --gold: #c2a368;
  --gold-dark: #a8884a;
  --cream: #f6f3ed;
  --card: #ffffff;
  --text: #2b2b3a;
  --muted: #8a8676;
  --green: #2e7d32;
  --red: #c0392b;
  --blue: #2a6f97;
  --line: #ece6dd;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--cream);
  color: var(--text);
  padding-bottom: 32px;
}

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 14px; position: sticky; top: 0; z-index: 5;
  background: var(--navy); color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.brand-title {
  display: block; font-family: "Playfair Display", Georgia, serif;
  font-size: 20px; font-weight: 700; line-height: 1;
}
.brand-sub { display: block; font-size: 12px; color: var(--gold); letter-spacing: .5px; margin-top: 3px; }

main { padding: 14px 12px 0; display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--muted); text-align: center; padding: 28px 16px; }
#list, #past-list { display: flex; flex-direction: column; gap: 12px; }

.past-toggle {
  margin: 6px 2px; background: transparent; border: 1px dashed var(--gold-dark);
  color: var(--navy); border-radius: 10px; padding: 12px; font-size: 14px;
  font-weight: 700; cursor: pointer; width: 100%;
}
.past-toggle:active { background: #efe9dd; }
.hidden { display: none !important; }

.card {
  background: var(--card); border-radius: 14px; padding: 16px;
  box-shadow: 0 1px 6px rgba(39,38,79,.08); border: 1px solid var(--line);
}
.card h2 {
  margin: 0 0 4px; font-size: 17px; font-family: "Playfair Display", Georgia, serif;
  color: var(--navy);
}
.card .dates { color: var(--gold-dark); font-weight: 700; font-size: 14px; }
.card .row { font-size: 14px; margin: 5px 0; }
.card .total { font-weight: 800; color: var(--navy); }
.card .note {
  background: #fbf7ee; border-left: 3px solid var(--gold); padding: 8px 10px;
  border-radius: 6px; font-size: 13px; margin: 10px 0 0;
}
.contact { display: flex; gap: 14px; margin-top: 8px; font-size: 13px; flex-wrap: wrap; }
.contact a { color: var(--navy); text-decoration: none; font-weight: 600; }

.actions { display: flex; gap: 8px; margin-top: 14px; }
.actions button {
  flex: 1; border: none; border-radius: 10px; padding: 11px 6px;
  font-size: 14px; font-weight: 700; color: #fff; cursor: pointer;
}
.btn-confirm { background: var(--green); }
.btn-reject { background: var(--red); }
.btn-info { background: var(--blue); }
.actions button:disabled { opacity: .5; }

.ghost {
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.4); color: #fff;
  border-radius: 8px; width: 38px; height: 38px; font-size: 18px; cursor: pointer;
}

/* Modal */
.overlay {
  position: fixed; inset: 0; background: rgba(20,19,40,.55);
  display: flex; align-items: flex-end; justify-content: center; z-index: 20;
}
.overlay.hidden { display: none; }
.sheet {
  background: var(--card); width: 100%; max-width: 560px;
  border-radius: 16px 16px 0 0; padding: 20px 18px 22px;
  animation: slideup .2s ease;
}
@keyframes slideup { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet h3 { margin: 0 0 4px; font-family: "Playfair Display", Georgia, serif; color: var(--navy); font-size: 19px; }
.sheet-desc { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.sheet textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  font-size: 15px; font-family: inherit; resize: vertical; background: #fcfbf8; color: var(--text);
}
.sheet textarea:focus { outline: none; border-color: var(--gold); }
.sheet-actions { display: flex; gap: 10px; margin-top: 14px; }
.btn {
  flex: 1; border: none; border-radius: 10px; padding: 13px; font-size: 15px;
  font-weight: 700; cursor: pointer; background: var(--navy); color: #fff;
}
.btn-ghost { background: #efece5; color: var(--text); }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.blue { background: var(--blue); }

.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 22px;
  font-size: 14px; opacity: 0; transition: opacity .25s; pointer-events: none;
  max-width: 90%; z-index: 30; box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.toast.show { opacity: 1; }

/* Pestañas */
.tabs {
  display: flex; gap: 6px; padding: 8px 10px; overflow-x: auto;
  position: sticky; top: 64px; background: var(--cream); z-index: 4;
  border-bottom: 1px solid var(--line);
}
.tab {
  flex: 0 0 auto; border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 20px; padding: 7px 14px; font-size: 13px; font-weight: 700; cursor: pointer;
  white-space: nowrap;
}
.tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.tab .count { opacity: .7; font-weight: 600; }

/* Estado en tarjetas de histórico */
.status-badge {
  display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .3px;
  padding: 3px 9px; border-radius: 12px; margin-bottom: 6px; color: #fff;
}
.st-confirmed { background: var(--green); }
.st-cancelled { background: var(--red); }
.st-abandoned { background: #8a8676; }

/* Fila secundaria de acciones (editar / eliminar) */
.actions-secondary { display: flex; gap: 8px; margin-top: 8px; }
.actions-secondary button {
  flex: 1; border-radius: 9px; padding: 9px; font-size: 13px; font-weight: 700; cursor: pointer;
  background: #fff; border: 1px solid var(--line); color: var(--text);
}
.btn-edit { color: var(--navy); }
.btn-delete { color: var(--red); border-color: #f0c9c4 !important; }

/* Formulario de edición */
.field { display: block; font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.field input, .field textarea {
  display: block; width: 100%; margin-top: 4px; border: 1px solid var(--line);
  border-radius: 9px; padding: 10px; font-size: 15px; font-family: inherit;
  background: #fcfbf8; color: var(--text); font-weight: 400;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--gold); }
