:root {
  --navy: #14213d;
  --navy-2: #1f2f52;
  --orange: #e4572e;
  --orange-d: #c7451f;
  --teal: #1f7a7a;
  --green: #1e8e5a;
  --green-bg: #e5f5ec;
  --red: #c0392b;
  --red-bg: #fbe9e7;
  --amber: #b7791f;
  --amber-bg: #fdf3e1;
  --bg: #f4f6fa;
  --card: #fff;
  --line: #e3e7ef;
  --muted: #5b6475;
  --text: #14213d;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 4px 16px rgba(20, 33, 61, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 10px 14px; border-radius: 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s;
}
.btn:hover { background: #f1f3f8; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.primary:hover { background: var(--orange-d); }
.btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn.danger { color: var(--red); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; padding: 14px; font-size: 16px; }

/* Formularios */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px; font-family: inherit; color: var(--text); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(228, 87, 46, .25); border-color: var(--orange); }
textarea { min-height: 120px; }
.field { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }

/* Tarjetas */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 26px; font-weight: 800; margin-top: 4px; }
.stat .sub { font-size: 12px; color: var(--muted); }

/* Etiquetas de estado */
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.tag.ok { background: var(--green-bg); color: var(--green); }
.tag.bad { background: var(--red-bg); color: var(--red); }
.tag.warn { background: var(--amber-bg); color: var(--amber); }
.tag.off { background: #eceff4; color: var(--muted); }

/* Tablas / listas */
.list { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.item { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .main { flex: 1; min-width: 0; }
.item .title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { font-size: 13px; color: var(--muted); }
.item .amount { font-weight: 800; text-align: right; white-space: nowrap; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* Panel: estructura */
.topbar {
  background: var(--navy); color: #fff; padding: 12px 18px; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 800; font-size: 17px; letter-spacing: .2px; }
.brand span { color: var(--orange); }
.topbar .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.25); }
.layout { display: flex; min-height: calc(100vh - 54px); }
.side { width: 210px; background: #fff; border-right: 1px solid var(--line); padding: 14px 10px; }
.side a {
  display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-weight: 600; margin-bottom: 2px;
}
.side a.active { background: #fdeee9; color: var(--orange-d); }
.side a .ico { width: 20px; text-align: center; }
.content { flex: 1; padding: 22px; max-width: 1100px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.sandbox-banner { background: var(--amber-bg); color: var(--amber); font-size: 13px; padding: 8px 18px; text-align: center; font-weight: 600; }

@media (max-width: 760px) {
  .layout { display: block; }
  .side {
    position: fixed; bottom: 0; left: 0; right: 0; width: auto; display: flex; justify-content: space-around;
    padding: 6px; border-right: 0; border-top: 1px solid var(--line); z-index: 20;
  }
  .side a { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 4px; margin: 0; }
  .side a .ico { font-size: 18px; }
  .content { padding: 14px 14px 90px; }
}

/* Modal */
.modal-bg {
  position: fixed; inset: 0; background: rgba(20, 33, 61, .45); display: flex;
  align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; padding: 20px; }
.modal h2 { margin-bottom: 14px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

/* Aviso flotante */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff;
  padding: 12px 18px; border-radius: 10px; font-weight: 600; z-index: 100; box-shadow: var(--shadow);
  max-width: 90vw; text-align: center;
}
.toast.err { background: var(--red); }
@media (max-width: 760px) { .toast { bottom: 84px; } }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { border: 1px solid var(--line); background: #fff; padding: 7px 12px; border-radius: 999px; font-weight: 600; cursor: pointer; font-size: 13px; }
.tabs button.on { background: var(--navy); color: #fff; border-color: var(--navy); }

.share { display: grid; gap: 8px; }
.linkbox { display: flex; gap: 6px; }
.linkbox input { font-size: 13px; }
.qr { text-align: center; }
.qr img { width: 220px; height: 220px; }

/* Páginas públicas (login, pago, comprobante) */
.public { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 24px 16px; }
.public .head { width: 100%; max-width: 440px; text-align: center; margin-bottom: 16px; }
.public .box { width: 100%; max-width: 440px; }
.amount-big { font-size: 34px; font-weight: 800; margin: 6px 0 2px; }
.steps { display: flex; justify-content: center; gap: 6px; margin: 4px 0 16px; }
.steps i { width: 28px; height: 4px; border-radius: 4px; background: var(--line); display: block; }
.steps i.on { background: var(--orange); }
.otp-input { font-size: 28px; letter-spacing: 10px; text-align: center; font-weight: 700; }
.success-ico {
  width: 72px; height: 72px; border-radius: 50%; background: var(--green-bg); color: var(--green);
  display: flex; align-items: center; justify-content: center; font-size: 40px; margin: 0 auto 10px;
}
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv b { text-align: right; }
.foot { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }
.secure { display: flex; gap: 8px; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); margin-top: 12px; }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid var(--line); }
}

@media (max-width: 560px) {
  .item { flex-wrap: wrap; }
  .item .main { flex-basis: 100%; }
  .item .amount { margin-right: auto; text-align: left; }
}
