/* =========================================================================
 * panel.css — Estética premium, minimalista. Marca Dra. Julia Ardaya.
 * ========================================================================= */
:root {
  --acento: #C0A062;
  --acento-2: #A9873F;
  --bg: #f7f5f1;
  --panel: #ffffff;
  --texto: #1f2430;
  --texto-2: #6b7280;
  --linea: #ececec;
  --sombra: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
  --radio: 14px;
  --ok: #16a34a; --warn: #f59e0b; --err: #ef4444;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg);
  color: var(--texto);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
h1,h2,h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #fbf7ee, var(--bg)); }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border-radius: 20px;
  box-shadow: var(--sombra); padding: 34px 30px; text-align: center; border: 1px solid var(--linea); }
.login-logo { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 14px;
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 26px;
  background: linear-gradient(135deg, var(--acento), var(--acento-2)); }
.login-card h1 { font-size: 19px; }
.login-card .sub { color: var(--texto-2); margin: 4px 0 22px; font-size: 13px; }
.roles { display: grid; gap: 10px; }
.role-btn { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--linea);
  background: #fff; border-radius: 12px; text-align: left; transition: .15s; }
.role-btn:hover { border-color: var(--acento); box-shadow: 0 0 0 3px rgba(192,160,98,.12); }
.role-btn .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: #f4efe4; color: var(--acento-2); font-size: 18px; }
.role-btn b { display: block; }
.role-btn small { color: var(--texto-2); }
.pin-row { display: flex; gap: 8px; margin-top: 16px; }
.pin-row input { flex: 1; }
.hint { color: var(--texto-2); font-size: 12px; margin-top: 14px; }

/* ---------- Layout app ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: #fffdf9; border-right: 1px solid var(--linea); padding: 18px 14px;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.brand .b-logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  color: #fff; font-weight: 800; background: linear-gradient(135deg, var(--acento), var(--acento-2)); }
.brand b { font-size: 14px; line-height: 1.1; }
.brand small { color: var(--texto-2); font-size: 11px; }
.nav { display: grid; gap: 2px; margin-top: 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--texto-2); text-decoration: none; font-weight: 600; font-size: 13.5px; }
.nav a .ic { width: 20px; text-align: center; }
.nav a:hover { background: #f4efe4; color: var(--texto); }
.nav a.active { background: linear-gradient(135deg, rgba(192,160,98,.16), rgba(169,135,63,.1));
  color: var(--acento-2); }
.side .foot { margin-top: auto; border-top: 1px solid var(--linea); padding-top: 12px; }
.side .foot .who { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.side .foot .who .av { width: 32px; height: 32px; border-radius: 50%; background: #f4efe4;
  display: grid; place-items: center; color: var(--acento-2); font-weight: 700; }
.side .foot .who b { font-size: 13px; }
.side .foot .who small { color: var(--texto-2); font-size: 11px; text-transform: capitalize; }
.btn-logout { width: 100%; margin-top: 8px; padding: 9px; border: 1px solid var(--linea);
  background: #fff; border-radius: 10px; color: var(--texto-2); font-weight: 600; }
.btn-logout:hover { color: var(--err); border-color: #f3c6c6; }

.main { padding: 22px 26px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.topbar h2 { font-size: 20px; }
.topbar .search { flex: 1; max-width: 420px; position: relative; }
.topbar .search input { width: 100%; padding-left: 34px; }
.topbar .search .mag { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--texto-2); }

/* ---------- Controles ---------- */
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--linea); border-radius: 10px;
  background: #fff; color: var(--texto); font-size: 13.5px; outline: none; transition: .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--acento); box-shadow: 0 0 0 3px rgba(192,160,98,.14); }
label.fld { display: block; margin-bottom: 12px; }
label.fld > span { display: block; font-size: 12px; color: var(--texto-2); margin-bottom: 5px; font-weight: 600; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 10px;
  border: 1px solid var(--linea); background: #fff; font-weight: 600; font-size: 13.5px; }
.btn:hover { border-color: var(--acento); }
.btn--primary { background: linear-gradient(135deg, var(--acento), var(--acento-2)); color: #fff; border: none; }
.btn--primary:hover { filter: brightness(1.05); }
.btn--ghost { background: transparent; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn--sm { padding: 6px 10px; font-size: 12.5px; }

/* ---------- Chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; color: var(--chip, #64748b);
  background: color-mix(in srgb, var(--chip, #64748b) 12%, #fff); white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--chip, #64748b); }
.chip--muted { --chip: #94a3b8; }

/* ---------- Cards / KPIs ---------- */
.card { background: var(--panel); border: 1px solid var(--linea); border-radius: var(--radio);
  box-shadow: var(--sombra); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { padding: 16px; background: var(--panel); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra); }
.kpi .k-label { color: var(--texto-2); font-size: 12px; font-weight: 600; }
.kpi .k-val { font-size: 26px; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; }
.kpi .k-val.money { color: var(--acento-2); }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.sec-title { font-size: 15px; margin-bottom: 12px; }

/* ---------- Tabla ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radio); border: 1px solid var(--linea); background: #fff; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 720px; }
table.tbl th, table.tbl td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--linea); font-size: 13px; }
table.tbl th { color: var(--texto-2); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; background: #fcfbf8; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: #fdfcf9; }
.row-actions { display: flex; gap: 6px; }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--linea); background: #fff;
  display: grid; place-items: center; font-size: 14px; color: var(--texto-2); }
.icon-btn:hover { border-color: var(--acento); color: var(--acento-2); }

/* ---------- Filtros ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.filter-pill { padding: 7px 13px; border: 1px solid var(--linea); background: #fff; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: var(--texto-2); }
.filter-pill.active { background: var(--acento); color: #fff; border-color: var(--acento); }

/* ---------- Modal / Drawer ---------- */
.overlay { position: fixed; inset: 0; background: rgba(17,20,26,.42); backdrop-filter: blur(2px);
  display: none; z-index: 50; }
.overlay.open { display: block; }
.modal { position: fixed; z-index: 51; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: min(560px, calc(100vw - 32px)); max-height: 88vh; overflow: auto; background: #fff;
  border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.25); padding: 22px; display: none; }
.modal.open { display: block; }
.modal--wide { width: min(860px, calc(100vw - 32px)); }
.drawer { position: fixed; z-index: 51; top: 0; right: 0; height: 100vh; width: min(560px, 100vw);
  background: #fff; box-shadow: -20px 0 60px rgba(0,0,0,.18); transform: translateX(100%);
  transition: transform .22s ease; overflow: auto; }
.drawer.open { transform: translateX(0); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { font-size: 17px; }
.x { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--linea); background: #fff; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ---------- Ficha 360 (tabs) ---------- */
.ficha-head { padding: 22px; border-bottom: 1px solid var(--linea); }
.ficha-head .name { font-size: 20px; font-weight: 800; }
.ficha-head .meta { color: var(--texto-2); font-size: 13px; margin-top: 4px; }
.pay-box { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-top: 14px; }
.pay-box .b { background: #faf8f3; border: 1px solid var(--linea); border-radius: 12px; padding: 10px 12px; }
.pay-box .b small { color: var(--texto-2); font-size: 11px; }
.pay-box .b b { display: block; font-size: 16px; margin-top: 2px; }
.tabs { display: flex; gap: 4px; padding: 0 14px; border-bottom: 1px solid var(--linea); overflow-x: auto; }
.tabs button { padding: 12px 12px; border: none; background: none; color: var(--texto-2); font-weight: 600;
  border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--acento-2); border-bottom-color: var(--acento); }
.tab-body { padding: 18px 22px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 20px; border-left: 2px solid var(--linea); }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--acento); }
.timeline li b { display: block; font-size: 13px; }
.timeline li small { color: var(--texto-2); font-size: 11.5px; }
.mini-list { display: grid; gap: 8px; }
.mini-item { border: 1px solid var(--linea); border-radius: 12px; padding: 12px; display: flex;
  justify-content: space-between; gap: 10px; align-items: flex-start; }
.empty { text-align: center; color: var(--texto-2); padding: 30px 10px; }
.empty .em-ic { font-size: 30px; opacity: .5; }

/* ---------- Toast ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: grid; gap: 8px; }
.toast { background: #111827; color: #fff; padding: 11px 15px; border-radius: 11px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 340px; display: flex; gap: 9px; align-items: flex-start; }
.toast.ok { background: #14532d; } .toast.err { background: #7f1d1d; } .toast.warn { background: #78350f; }

.badge-modo { font-size: 11px; color: var(--texto-2); background: #f4efe4; padding: 3px 8px; border-radius: 999px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; transform: translateX(-100%); transition: transform .2s; width: 232px; }
  .side.open { transform: translateX(0); }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .hamb { display: inline-grid !important; }
}
.hamb { display: none; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--linea);
  background: #fff; place-items: center; font-size: 18px; }
