@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&family=Quicksand:wght@500;600;700&display=swap');

:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --border: #e8edf3;
  --text: #2b3445;
  --muted: #97a1b2;
  --brand: #A4123C;
  --primary: #A4123C;
  --primary-dark: #820e30;
  --primary-soft: #fbeaef;
  --green: #20a87a;
  --red: #e25563;
  --amber: #e8973b;
  --shadow-sm: 0 1px 2px rgba(20,30,50,.05);
  --shadow: 0 2px 10px rgba(20,30,50,.06);
  --shadow-lg: 0 10px 40px rgba(20,30,50,.14);
  --radius: 14px;
  --font: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Quicksand', 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--panel); color: var(--text);
  padding: 12px 24px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo-mark { width: 34px; height: 30px; color: var(--brand); flex: none; }
.brand .brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand .brand-text strong { font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--text); letter-spacing: -.2px; }
.brand .brand-text small { font-size: 11px; font-weight: 600; color: var(--muted); }
.comunidad-selector { display: flex; align-items: center; gap: 10px; }
.comunidad-selector label { color: var(--muted); font-weight: 600; font-size: 13px; }
.comunidad-selector select {
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--border);
  min-width: 230px; font-size: 14px; font-family: var(--font); color: var(--text);
  background: var(--panel); cursor: pointer;
}
.comunidad-selector select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: calc(100vh - 58px); }
.sidebar {
  width: 234px; background: var(--panel); border-right: 1px solid var(--border);
  padding: 14px 12px; display: flex; flex-direction: column; gap: 2px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  text-align: left; background: none; border: none; padding: 10px 14px;
  border-radius: 11px; cursor: pointer; font-size: 14px; font-weight: 600;
  color: var(--text); font-family: var(--font); transition: background .12s, color .12s;
}
.nav-link:hover { background: #f0f3f7; }
.nav-ico { flex: none; width: 20px; text-align: center; }
.nav-lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-link.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; }
.nav-section {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); padding: 16px 14px 6px; margin-top: 4px;
}

.content { flex: 1; padding: 28px 32px; overflow: auto; }

/* ---------- Móvil: sidebar solo con iconos ---------- */
@media (max-width: 768px) {
  .sidebar { width: 60px; padding: 10px 6px; }
  .sidebar .nav-lbl { display: none; }
  .nav-link { justify-content: center; padding: 10px 0; gap: 0; position: relative; }
  .nav-link[data-badge]::after {
    content: attr(data-badge);
    position: absolute; top: 2px; right: 4px;
    background: var(--red); color: #fff; font-size: 9px; font-weight: 800;
    min-width: 14px; height: 14px; line-height: 14px; border-radius: 7px;
    text-align: center; padding: 0 3px;
  }
  .nav-section { font-size: 0; padding: 6px 0 0; margin: 8px 6px 4px; border-top: 1px solid var(--border); }
  .content { padding: 16px 12px; }
  .topbar { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .brand .brand-text small { display: none; }
  .comunidad-selector { flex: 1; min-width: 0; }
  .comunidad-selector label { display: none; }
  .comunidad-selector select { min-width: 0; flex: 1; width: 100%; }
}
h2.view-title { margin: 0 0 4px; font-family: var(--font-display); font-weight: 700; font-size: 24px; letter-spacing: -.3px; }
h3 { font-family: var(--font-display); font-weight: 700; color: var(--text); }
.view-sub { color: var(--muted); margin: 0 0 20px; font-weight: 500; }

/* ---------- Buttons ---------- */
.btn {
  background: var(--primary); color: #fff; border: none; padding: 10px 18px;
  border-radius: 11px; cursor: pointer; font-size: 14px; font-weight: 700; font-family: var(--font);
  transition: background .12s, transform .05s, box-shadow .12s; box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-small { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn-secondary { background: #eef2f6; color: var(--text); box-shadow: none; }
.btn-secondary:hover { background: #e3e9f0; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #cf4250; }
.btn-link { background: none; border: none; color: var(--primary-dark); cursor: pointer; padding: 3px 6px; font-weight: 700; font-family: var(--font); font-size: 13px; border-radius: 7px; }
.btn-link:hover { background: var(--primary-soft); }
.btn-link.danger { color: var(--red); }
.btn-link.danger:hover { background: #fdeef0; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f8fafc; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fbfcfe; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Vista compacta de Gastos e ingresos: filas a una línea para ver más movimientos */
table.tabla-compacta th, table.tabla-compacta td { padding: 4px 8px; font-size: 12.5px; }
table.tabla-compacta tbody td { border-bottom: 1px solid #f1f3f7; }
table.tabla-compacta .cpt-concepto { display: inline-block; max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
table.tabla-compacta .cpt-trunc { display: inline-block; max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
table.tabla-compacta .cpt-ico { font-size: 12px; white-space: nowrap; opacity: .9; }
table.tabla-compacta .cpt-ico a { cursor: pointer; }
table.tabla-compacta .btn-link { padding: 1px 4px; font-size: 13px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 26px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card .label { color: var(--muted); font-size: 13px; font-weight: 600; }
.card .value { font-family: var(--font-display); font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; }
.value.green { color: var(--green); }
.value.red { color: var(--red); }
.value.amber { color: var(--amber); }

/* ---------- Badges ---------- */
.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; display: inline-block; }
.badge.ok { background: #e3f6ee; color: var(--green); }
.badge.pending { background: #fcf0e0; color: var(--amber); }
.badge.info { background: #e8eefc; color: #3b6fe8; }
.badge.danger { background: #fde7ea; color: var(--red); }

.empty-state { text-align: center; color: var(--muted); padding: 70px 20px; }
.empty-state .btn { margin: 14px 6px 0; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(30,40,60,.4); display: flex; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(2px); }
.modal-overlay[hidden] { display: none; }
.modal { background: var(--panel); border-radius: 18px; width: 90%; max-width: 560px; max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lg); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; font-family: var(--font-display); font-size: 18px; }
.btn-close { background: none; border: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); border-radius: 8px; width: 34px; height: 34px; }
.btn-close:hover { background: #f0f3f7; }
.modal-body { padding: 22px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-size: 13px; margin-bottom: 6px; color: var(--muted); font-weight: 700; }
.form-group input:not([type="checkbox"]):not([type="radio"]), .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; font-family: var(--font); color: var(--text); background: var(--panel);
}
.form-group input[type="checkbox"], .form-group input[type="radio"] { width: auto; flex: 0 0 auto; margin: 0; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ---------- Asientos ---------- */
.apunte-row { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.apunte-row select, .apunte-row input { padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; font-family: var(--font); font-size: 14px; }
.asiento-totals { display: flex; gap: 22px; margin: 12px 0; font-weight: 700; }
.cuadra-ok { color: var(--green); }
.cuadra-no { color: var(--red); }

details.asiento { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
details.asiento summary { padding: 13px 16px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
details.asiento summary::-webkit-details-marker { display: none; }
details.asiento[open] summary { border-bottom: 1px solid var(--border); }
details.asiento .apuntes-list { padding: 4px 16px 14px; }
details.asiento .apuntes-list table { box-shadow: none; border: 1px solid var(--border); }

/* Recibos / cobros */
.recibos-filtros { align-items: flex-end; gap: 14px; }
.recibos-filtros .form-group { min-width: 170px; }
.recibo-grupo { margin-bottom: 22px; }
.recibo-grupo-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.recibo-grupo-head strong { color: var(--primary-dark); }
.recibo-grupo-head .view-sub { margin: 0; }
.recibo-grupo table { box-shadow: var(--shadow-sm); }
tr.recibo-cobrado td { background: #f3faf6; }
.acciones-recibo { white-space: nowrap; }
.saldo-cuenta { color: var(--green); font-weight: 700; }
.entregas-sub { margin-top: 8px; }
.entregas-sub-head { font-size: 12px; font-weight: 700; color: var(--muted); margin: 6px 2px; }
.tabla-entregas { box-shadow: none; border: 1px dashed var(--border); }
.tabla-entregas th { background: #fbfdff; }

/* ---------- Gestión · Juntas / editor de actas ---------- */
.junta-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 14px; }
.junta-meta .form-group { flex: 1; min-width: 150px; margin-bottom: 0; }

.editor-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--border); border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0; padding: 8px 12px; }
.editor-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.editor-tools button { background: none; border: 1px solid transparent; border-radius: 8px; padding: 5px 9px;
  cursor: pointer; font-size: 13px; font-family: var(--font); color: var(--text); min-width: 30px; }
.editor-tools button:hover { background: #f0f3f7; border-color: var(--border); }
.editor-tools .sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.editor-merge { display: flex; align-items: center; gap: 8px; }
.editor-merge label { font-size: 12px; font-weight: 700; color: var(--muted); }
.editor-merge select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 9px; font-family: var(--font); font-size: 13px; background: var(--panel); }

.acta-editor { background: var(--panel); border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius);
  padding: 26px 32px; min-height: 380px; max-height: 60vh; overflow: auto; line-height: 1.55; font-size: 14px;
  box-shadow: var(--shadow); outline: none; }
.acta-editor:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.acta-editor h2 { font-family: var(--font); font-size: 18px; margin: 0 0 8px; }
.acta-editor h3 { font-size: 15px; color: var(--primary-dark); margin: 14px 0 6px; }
.acta-editor p { margin: 0 0 10px; }
.acta-editor ol, .acta-editor ul { margin: 0 0 10px; padding-left: 26px; }
.acta-editor table { border-collapse: collapse; width: 100%; max-width: 100%; table-layout: auto; margin: 8px 0; }
.acta-editor table td, .acta-editor table th { border: 1px solid #999; padding: 3px 6px; vertical-align: top; line-height: 1.3; word-wrap: break-word; overflow-wrap: anywhere; }
.acta-editor img { max-width: 100%; height: auto; }

.junta-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; }
.junta-plantillas { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.junta-plantillas select { padding: 8px 11px; border: 1px solid var(--border); border-radius: 9px; font-family: var(--font); font-size: 13px; background: var(--panel); }
.junta-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

.preview-acta { border: 1px solid var(--border); border-radius: 10px; padding: 22px 26px; max-height: 56vh; overflow: auto; background: #fff; line-height: 1.55; }
.preview-acta h2 { font-size: 17px; } .preview-acta h3 { font-size: 14px; color: var(--primary-dark); }

.dest-list { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.dest-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; }
.dest-row:last-child { border-bottom: none; }
.dest-row:hover { background: #fbfcfe; }
.dest-email { color: var(--muted); font-size: 12px; }

/* ---------- Juntas: pestañas, asistencia y votaciones ---------- */
.junta-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin: 18px 0 18px; }
.junta-tab { background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px;
  padding: 10px 18px; cursor: pointer; font-family: var(--font); font-size: 14px; font-weight: 700; color: var(--muted); border-radius: 8px 8px 0 0; }
.junta-tab:hover { background: #f0f3f7; color: var(--text); }
.junta-tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); }

.asis-resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 6px; }
.asis-resumen .card { padding: 14px 18px; }
.asis-resumen .value { font-size: 22px; }
.asis-estado, .asis-rep { padding: 6px 9px; border: 1px solid var(--border); border-radius: 8px; font-family: var(--font); font-size: 13px; background: var(--panel); }
.asis-rep:disabled { background: #f5f7fa; color: var(--muted); }

.votacion { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.votacion summary { padding: 14px 18px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 15px; }
.votacion summary::-webkit-details-marker { display: none; }
.votacion[open] summary { border-bottom: 1px solid var(--border); }
.votacion .vot-mayoria { font-size: 12px; font-weight: 700; color: var(--muted); }
.votacion-body { padding: 14px 18px; }
.vot-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.vot-controls select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font-family: var(--font); font-size: 13px; background: var(--panel); }

.escrutinio { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 10px; }
.e-opt { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.e-opt span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.e-opt b { font-size: 15px; }
.e-opt.favor { background: #f3faf6; border-color: #bfe8d4; }
.e-opt.contra { background: #fdeef0; border-color: #f3c6cd; }
.e-opt.abst { background: #f8fafc; }
.e-opt.base { background: #fbfcfe; }
.e-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.e-nota { width: 100%; font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.4; }

.tabla-votos { box-shadow: none; border: 1px solid var(--border); margin-top: 6px; }
.tabla-votos th { background: #fbfdff; }
.voto-cell { display: flex; gap: 14px; flex-wrap: wrap; }
.voto-cell label { font-size: 13px; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; }
.voto-cell label.dis { color: var(--muted); cursor: not-allowed; }

.acta-datos { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 10px 16px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.acta-datos summary { cursor: pointer; font-weight: 700; color: var(--text); font-size: 13px; }
.acta-datos summary::-webkit-details-marker { display: none; }
.acta-datos[open] summary { margin-bottom: 6px; }

.editor-insertar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ins-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.btn-ins { background: var(--primary-soft); color: var(--primary-dark); border: 1px solid #f0d4dc; border-radius: 8px; padding: 6px 10px; cursor: pointer; font-family: var(--font); font-size: 12.5px; font-weight: 700; }
.btn-ins:hover { background: #f7dbe3; }
.editor-insertar select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 9px; font-family: var(--font); font-size: 13px; background: var(--panel); }

.ia-estado { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.ia-estado.ok { background: #f3faf6; border-color: #bfe8d4; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ia-estado select { padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; font-family: var(--font); }
.notas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 8px; }
.nota-item { border: 1px solid var(--border); border-radius: 10px; padding: 8px; text-align: center; font-size: 12px; }
.nota-item img { width: 100%; height: 80px; object-fit: cover; border-radius: 6px; }
.nota-pdf { height: 80px; display: flex; align-items: center; justify-content: center; background: #f8fafc; border-radius: 6px; font-weight: 700; color: var(--muted); }
.nota-nombre { margin: 6px 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cargo-sel { padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; font-family: var(--font); font-size: 12.5px; background: var(--panel); }
.cargo-sel.cargo-presidente, .cargo-sel.cargo-vicepresidente { background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; border-color: #f0d4dc; }
.cargo-sel.cargo-vocal { background: #eef3ff; color: #2a4ba8; font-weight: 600; border-color: #cdd9f5; }

/* ===== Formulario en rejilla y acciones de modal (reutilizable) ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: flex; flex-direction: column; font-size: 12.5px; font-weight: 700; color: var(--muted); gap: 5px; }
.form-grid input, .form-grid select, .form-grid textarea {
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; font-family: var(--font);
  font-size: 14px; color: var(--text); background: var(--panel); font-weight: 500;
}
.form-grid textarea { resize: vertical; }
.form-grid fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px 12px; }
.form-grid fieldset legend { font-size: 12px; font-weight: 700; color: var(--muted); padding: 0 6px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; align-items: center; }

/* ===== Calendario ===== */
.cal-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .cal-wrap { grid-template-columns: 1fr; } }
.cal-main { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-mes { margin-left: auto; font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--text); }
.cal-select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; font-family: var(--font); font-size: 13px; background: var(--panel); color: var(--text); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cabecera { margin-bottom: 6px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 4px 0; }
.cal-dia { min-height: 96px; border: 1px solid var(--border); border-radius: 10px; padding: 5px 6px; background: var(--panel); cursor: pointer; transition: background .12s, border-color .12s; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.cal-dia:hover { border-color: var(--primary); background: #fdf7f9; }
.cal-dia.fuera { background: #fafbfc; opacity: .55; }
.cal-dia.hoy { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.cal-num { font-size: 12.5px; font-weight: 700; color: var(--muted); align-self: flex-end; }
.cal-dia.hoy .cal-num { color: var(--primary); }
.cal-items { display: flex; flex-direction: column; gap: 3px; }
.cal-chip { font-size: 11.5px; font-weight: 600; color: #fff; background: var(--c); border-radius: 6px; padding: 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border-left: 3px solid rgba(0,0,0,.18); }
.cal-chip:hover { filter: brightness(1.06); }
.cal-chip.done { background: #d6dbe2; color: #6b7280; text-decoration: line-through; }
.cal-chip .cal-hora { font-weight: 800; opacity: .9; }
.cal-panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.cal-panel h3 { font-size: 14px; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.cal-panel h3:not(:first-child) { margin-top: 18px; }
.cal-prox { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cal-prox li { display: flex; align-items: baseline; gap: 8px; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.cal-prox li:hover { background: #f5f7fa; }
.cal-prox li.vacio { color: var(--muted); cursor: default; font-style: italic; }
.cal-prox li.vacio:hover { background: none; }
.cal-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; align-self: center; }
.cal-prox-fecha { font-weight: 700; color: var(--muted); font-size: 12px; white-space: nowrap; }
.cal-prox-fecha.venc { color: var(--red); }
.cal-prox-tit { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.cal-prox-tit small { color: var(--muted); font-weight: 500; }
.cal-nota { background: #fdf7f9; border: 1px solid #f0d4dc; border-radius: 8px; padding: 8px 10px; margin: 0 0 14px; }
.cal-aviso { margin-top: 2px; }
.cal-plantilla { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 14px; }
.cal-plantilla select { padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; font-family: var(--font); font-size: 14px; background: #fdf7f9; color: var(--text); font-weight: 600; }

/* ============================ Agenda · Tareas diarias ============================ */
.ag-resumen { background: var(--primary-soft); border: 1px solid #f0d4dc; border-radius: 10px; padding: 11px 14px; margin: 0 0 14px; font-weight: 600; color: var(--text); }
.ag-aviso { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 10px; padding: 9px 12px; margin: 0 0 14px; font-size: 13px; }
.ag-aviso a { color: var(--brand); font-weight: 700; }
.ag-progreso { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.ag-barra { flex: 1; height: 9px; background: var(--border); border-radius: 99px; overflow: hidden; }
.ag-barra-fill { height: 100%; background: var(--brand); border-radius: 99px; transition: width .3s ease; }
.ag-lista { display: flex; flex-direction: column; gap: 9px; }
.ag-tarea { display: flex; align-items: flex-start; gap: 12px; background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--prio, var(--border)); border-radius: 12px; padding: 12px 14px; }
.ag-tarea.ag-done { opacity: .55; }
.ag-tarea.ag-done .ag-tarea-tit { text-decoration: line-through; }
.ag-check { flex: none; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--prio, var(--border)); background: #fff; color: #fff; cursor: pointer; font-weight: 800; font-size: 15px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.ag-tarea.ag-done .ag-check { background: var(--prio, var(--brand)); }
.ag-tarea-cuerpo { flex: 1; min-width: 0; }
.ag-tarea-tit { font-weight: 700; color: var(--text); font-size: 14.5px; }
.ag-tarea-det { color: var(--muted); font-size: 13px; margin-top: 2px; }
.ag-tarea-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 7px; }
.ag-tarea-meta .ag-com { font-size: 12px; font-weight: 700; color: var(--brand); background: var(--primary-soft); padding: 2px 8px; border-radius: 99px; }
.ag-tarea-acc { flex: none; display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.ag-modo { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 2px; }
.ag-modo-btn { border: none; background: transparent; padding: 6px 12px; border-radius: 8px; font-family: var(--font); font-weight: 700; font-size: 13px; color: var(--muted); cursor: pointer; }
.ag-modo-btn.on { background: var(--panel); color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.ag-filtros { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 14px; }
.ag-filtros #ag-buscar { flex: 1; min-width: 220px; padding: 9px 13px; border: 1px solid var(--border); border-radius: 10px; font-family: var(--font); font-size: 14px; background: var(--panel); color: var(--text); }
.ag-check-pend { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; cursor: pointer; }
.ag-grupo { margin-bottom: 18px; }
.ag-grupo-cab { display: flex; align-items: center; gap: 12px; padding: 4px 2px 8px; border-bottom: 1px solid var(--border); margin-bottom: 9px; }
.ag-grupo-fecha { font-weight: 800; color: var(--text); font-size: 14px; }
.ag-grupo-fecha.hoy { color: var(--brand); }
.ag-grupo-cab .btn-link { margin-left: auto; }
.bp-barra { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 16px; }
.bp-barra #bp-input { flex: 1; min-width: 260px; max-width: 520px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; font-family: var(--font); font-size: 15px; background: var(--panel); color: var(--text); }

/* ======================= Aviso de llamada entrante (tarjeta emergente) ======================= */
.llam-ring {
  background: var(--panel, #fff);
  border: 1px solid #d7e3d9;
  border-left: 4px solid #1b7a43;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(16, 40, 24, .18);
  padding: 12px 12px 12px 14px;
  animation: llamRingIn .18s ease-out, llamRingPulse 1.2s ease-in-out infinite alternate .18s;
}
@keyframes llamRingIn {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes llamRingPulse {
  from { box-shadow: 0 8px 24px rgba(16, 40, 24, .18); }
  to   { box-shadow: 0 8px 30px rgba(27, 122, 67, .42); }
}
