:root {
  --teal: #0d9488;
  --teal-dark: #0f766e;
  --ink: #1f2937;
  --muted: #6b7280;
  --bg: #f4f6f8;
  --card: #fff;
  --line: #e5e7eb;
  --error: #dc2626;
  --ok: #059669;
  --warn: #d97706;
  --radius: 12px;
  --side: 232px;
}

* { box-sizing: border-box; margin: 0; }
body { font-family: "Segoe UI", system-ui, Arial, sans-serif; background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
a { color: var(--teal-dark); }

/* ── Login ── */
.auth {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, #0d9488 0%, #134e4a 100%);
  padding: 20px;
}
.auth-card {
  background: #fff; border-radius: 16px; padding: 36px; width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card p { margin-bottom: 18px; }
.auth-card label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; }
.auth-card input {
  width: 100%; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 9px; font-size: 15px;
}
.auth-card input:focus { outline: none; border-color: var(--teal); }

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--side); background: #0f172a; color: #cbd5e1; padding: 20px 14px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.logo { font-size: 17px; font-weight: 700; color: #fff; display: flex; gap: 8px; align-items: center; margin-bottom: 26px; line-height: 1.15; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar nav a {
  color: #cbd5e1; text-decoration: none; padding: 10px 12px; border-radius: 9px; font-size: 14.5px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.07); }
.sidebar nav a.active { background: var(--teal); color: #fff; font-weight: 600; }
.sidebar-foot { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid #1e293b; padding-top: 12px; }
.sidebar-foot .muted { color: #94a3b8; }

.content { flex: 1; padding: 28px 32px; max-width: 1200px; }
.content h1 { font-size: 22px; margin-bottom: 4px; }
.content .sub { color: var(--muted); margin-bottom: 22px; font-size: 14px; }

/* ── Tarjetas y tablas ── */
.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 2px 10px rgba(15,23,42,.06); padding: 20px; margin-bottom: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: 0 2px 10px rgba(15,23,42,.06); }
.stat .num { font-size: 28px; font-weight: 700; color: var(--teal-dark); }
.stat .lbl { font-size: 13px; color: var(--muted); margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; border-bottom: 1.5px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: #f8fafc; }
.table-wrap { overflow-x: auto; }

/* Chips de estado */
.chip { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.chip.PENDING { background: #f1f5f9; color: #475569; }
.chip.LINK_SENT { background: #e0f2fe; color: #0369a1; }
.chip.IN_PROGRESS { background: #fef9c3; color: #854d0e; }
.chip.COMPLETED { background: #dcfce7; color: #166534; }
.chip.SUBMITTED { background: #ccfbf1; color: #115e59; }
.chip.CANCELLED { background: #fee2e2; color: #991b1b; }
.chip.SENT { background: #dcfce7; color: #166534; }
.chip.SIMULATED { background: #ede9fe; color: #5b21b6; }
.chip.ERROR { background: #fee2e2; color: #991b1b; }

/* ── Botones ── */
.btn { border: none; border-radius: 9px; padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--teal); color: #fff; }
.btn.danger { background: #fee2e2; color: var(--error); }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--muted); }
.btn.small { padding: 6px 11px; font-size: 12.5px; }
.btn.full { width: 100%; margin-top: 16px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.toolbar select, .toolbar input {
  padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 9px; font-size: 13.5px; background: #fff;
}

/* ── Formularios en modal ── */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal-card { background: #fff; border-radius: 14px; width: 100%; max-width: 640px; max-height: 90vh; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-grid label, .modal-body label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.form-grid input, .form-grid select, .form-grid textarea, .modal-body input, .modal-body select, .modal-body textarea {
  width: 100%; padding: 10px 11px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit;
}
.form-grid input:focus, .form-grid select:focus { outline: none; border-color: var(--teal); }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 14px 0; grid-column: 1 / -1; }
legend { font-size: 12px; font-weight: 700; color: var(--teal-dark); padding: 0 6px; text-transform: uppercase; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin: 6px 0; }
.check input { width: auto; }

.error { background: #fef2f2; border: 1px solid #fecaca; color: var(--error); border-radius: 9px; padding: 10px 13px; font-size: 13px; margin: 12px 0; }
.notice { background: #f0fdfa; border: 1px solid #ccfbf1; color: #115e59; border-radius: 9px; padding: 10px 13px; font-size: 13px; margin: 12px 0; }

/* Detalle reserva */
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; font-size: 14px; }
.kv label { color: var(--muted); font-size: 13px; }
pre.payload { background: #0f172a; color: #a5f3fc; border-radius: 10px; padding: 14px; font-size: 12px; overflow-x: auto; max-height: 320px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 12px 22px; border-radius: 10px; font-size: 14px; z-index: 99;
  box-shadow: 0 8px 30px rgba(0,0,0,.3);
}

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; }
  .sidebar nav { flex-direction: row; }
  .logo span { display: none; }
  .sidebar-foot { border: none; padding: 0; flex-direction: row; }
  .content { padding: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
}
