/* =========================
   ui-base.css (global)
   Fondo blanco + colores básicos (sin degradados)
   Todos los módulos = azul “bancos”
   Calendario = gris
   Danger/Volver/Regresar en rojo
   ========================= */

:root{
  /* Fondo / superficies */
  --bg:#ffffff;
  --card:#ffffff;
  --line:#e5e7eb;

  /* Texto */
  --text:#111827;
  --muted:#6b7280;

  /* Base */
  --shadow:0 10px 22px rgba(17,24,39,.10);
  --shadow2:0 8px 18px rgba(17,24,39,.08);
  --radius:16px;

  /* Estados */
  --ok:#16a34a;
  --warn:#f59e0b;
  --bad:#ef4444;

  /* Danger (rojo) */
  --danger:#dc2626;
  --dangerBg:#fee2e2;
  --dangerLine:#fca5a5;

  /* Acento por defecto (BANCOS: azul) */
  --m1:#0f4c81;
  --m2:#0284c7;
  --m3:#60a5fa;

  /* Focus */
  --focus:0 0 0 4px rgba(2,132,199,.18);
}

/* =========================
   Paletas por módulo
   Todos (excepto calendario) = BANCOS
   ========================= */
body[data-module="general"],
body[data-module="citas"],
body[data-module="bancos"],
body[data-module="productos"],
body[data-module="ventas"],
body[data-module="reportes"],
body[data-module="mantenimiento"]{
  --m1:#0f4c81;
  --m2:#0284c7;
  --m3:#60a5fa;
  --focus:0 0 0 4px rgba(2,132,199,.18);
}

/* CALENDARIO = gris */
body[data-module="calendario"]{
  --m1:#334155;
  --m2:#64748b;
  --m3:#94a3b8;
  --focus:0 0 0 4px rgba(100,116,139,.22);
}

/* =========================
   Base
   ========================= */
*{box-sizing:border-box}

a{color:inherit;text-decoration:none}
a:hover{text-decoration:none}
a:visited{text-decoration:none}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Arial;
}

.wrap{max-width:1200px;margin:0 auto;padding:18px}
.wrap.narrow{max-width:980px}
.wrap.wide{max-width:1400px}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:14px;
}
.title{font-size:18px;font-weight:950}
.actions{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.right{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.small{font-size:12px;color:var(--muted)}
.muted{color:var(--muted)}
.h3{font-size:16px;font-weight:900;margin:0 0 8px 0}
.num{text-align:right}

/* =========================
   Cards
   ========================= */
.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  overflow:hidden;
}
.card.flat{box-shadow:none}
.card .hd{
  padding:14px 16px;
  border-bottom:1px solid var(--line);
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  background:#ffffff;
}
.card .bd{padding:14px 16px}

/* =========================
   Buttons
   ========================= */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--text);
  padding:11px 14px;
  border-radius:14px;
  font-weight:950;
  cursor:pointer;
  user-select:none;
  text-decoration:none !important;
  box-shadow:0 2px 0 rgba(17,24,39,.04);
  transition:all .15s ease;
}
a.btn, a.btn:hover, a.btn:visited{ text-decoration:none !important; }

.btn:hover{transform:translateY(-1px);box-shadow:0 10px 22px rgba(17,24,39,.12)}
.btn:active{transform:translateY(0)}
.btn:focus-visible{outline:none;box-shadow:var(--focus)}

.btn.primary,
.btn.btn-primary{
  color:#fff;
  border-color:transparent;
  background:var(--m2);
}
.btn.primary:hover,
.btn.btn-primary:hover{
  filter:brightness(1.05);
}

.btn.ghost,
.btn.btn-ghost{
  background:#f8fafc;
  border-color:var(--line);
  color:var(--text);
}

.btn.secondary{background:#fff}

.btn.danger,
.btn.btn-danger{
  background:var(--dangerBg);
  border-color:var(--dangerLine);
  color:var(--danger);
}
.btn.danger:hover,
.btn.btn-danger:hover{
  box-shadow:0 10px 22px rgba(220,38,38,.18);
}

/* =========================
   Forms
   ========================= */
label{
  font-size:12px;
  color:var(--muted);
  font-weight:900;
  display:block;
  margin-bottom:6px;
}
input,select,textarea{
  width:100%;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--text);
  outline:none;
}
textarea{min-height:120px;resize:vertical}

input:focus,select:focus,textarea:focus{
  border-color:rgba(2,132,199,.40);
  box-shadow:0 0 0 4px rgba(2,132,199,.12);
}
body[data-module="calendario"] input:focus,
body[data-module="calendario"] select:focus,
body[data-module="calendario"] textarea:focus{
  border-color:rgba(100,116,139,.45);
  box-shadow:0 0 0 4px rgba(100,116,139,.14);
}

/* =========================
   Layout helpers
   ========================= */
.grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}
@media (max-width:900px){
  .grid{grid-template-columns:1fr}
}

.grid2{
  display:grid;
  grid-template-columns:1.2fr .8fr;
  gap:14px;
}
@media (max-width:980px){
  .grid2{grid-template-columns:1fr}
}

.filters{
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:10px;
}
@media (max-width:980px){
  .filters{grid-template-columns:repeat(2,minmax(0,1fr))}
}

/* =========================
   Tables
   ========================= */
.tablewrap{overflow:auto}
table{width:100%;border-collapse:separate;border-spacing:0}
th,td{
  border-bottom:1px solid var(--line);
  padding:10px 10px;
  vertical-align:top;
}
th{
  font-size:12px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.6px;
  background:#f8fafc;
}
tr:hover td{background:#f9fafb}
tbody tr:last-child td{border-bottom:none}

/* =========================
   Pills / Dots / Notices
   ========================= */
.pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  border:1px solid var(--line);
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  color:var(--muted);
  background:#f8fafc;
}
.dot{width:8px;height:8px;border-radius:50%}
.d-ok{background:var(--ok)}
.d-warn{background:var(--warn)}
.d-bad{background:var(--bad)}

.note{
  padding:10px 12px;
  border:1px dashed rgba(2,132,199,.35);
  border-radius:14px;
  background:#f8fafc;
}
body[data-module="calendario"] .note{
  border-color:rgba(100,116,139,.40);
}

.msg{
  margin:0 0 12px 0;
  padding:10px 12px;
  border:1px solid rgba(2,132,199,.25);
  background:#f8fafc;
  border-radius:14px;
}
body[data-module="calendario"] .msg{
  border-color:rgba(100,116,139,.30);
}

/* =========================
   Segmented control
   ========================= */
.seg{
  display:inline-flex;
  border:1px solid var(--line);
  border-radius:14px;
  overflow:hidden;
  background:#fff;
}
.seg a{
  padding:9px 12px;
  text-decoration:none !important;
  color:var(--text);
  font-weight:950;
  background:transparent;
  border-right:1px solid var(--line);
}
.seg a:last-child{border-right:none}
.seg a.on{
  background:#e0f2fe;
  color:#0f4c81;
}
body[data-module="calendario"] .seg a.on{
  background:#e2e8f0;
  color:#334155;
}
.seg a:not(.on):hover{background:#f9fafb}

/* =========================
   Footerbar
   ========================= */
.footerbar{position:sticky;bottom:0;margin-top:14px}
.footerbar .inner{
  display:flex;
  gap:10px;
  justify-content:space-between;
  align-items:center;
  padding:12px 14px;
  border-radius:16px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.96);
  backdrop-filter: blur(12px);
  box-shadow:var(--shadow2);
}

/* =========================
   Calendar legacy blocks
   ========================= */
.month{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:8px}
.dow{
  font-size:12px;
  color:var(--muted);
  font-weight:950;
  text-transform:uppercase;
  letter-spacing:.6px;
  padding:6px 2px;
}
.day{
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
  min-height:90px;
  padding:10px;
  box-shadow:0 6px 14px rgba(17,24,39,.08);
}
.day a{color:inherit;text-decoration:none;display:block}
.day .n{font-weight:950}
.day.muted{opacity:.45}
.day.sel{
  outline:2px solid rgba(100,116,139,.25);
  background:#f1f5f9;
}
.day.state-ok{border-color:rgba(22,163,74,.35);background:#f0fdf4}
.day.state-warn{border-color:rgba(245,158,11,.35);background:#fffbeb}
.day.state-bad{border-color:rgba(239,68,68,.35);background:#fef2f2}
.badges{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}
.badge{
  font-size:12px;
  font-weight:950;
  border-radius:999px;
  padding:4px 8px;
  border:1px solid var(--line);
  background:#f9fafb;
}
.rowactions{display:flex;gap:8px;flex-wrap:wrap}

/* =========================
   Lists + separación
   ========================= */
.list{display:grid;gap:16px}

.item{
  border:1px solid var(--line);
  border-radius:14px;
  padding:14px;
  background:#fff;
  position:relative;
}
.item::after{
  content:"";
  position:absolute;
  left:14px;
  right:14px;
  bottom:-8px;
  height:1px;
  background:#e5e7eb;
}
.item:last-child::after{display:none}

/* =========================
   CITAS
   ========================= */
body[data-module="citas"] .slot{
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px 12px;
  background:#fff;
  margin:12px 0;
  position:relative;
}
body[data-module="citas"] .slot::after{
  content:"";
  position:absolute;
  left:12px;
  right:12px;
  bottom:-6px;
  height:1px;
  background:#e5e7eb;
}
body[data-module="citas"] .slot:last-child::after{display:none}

body[data-module="citas"] .time{
  font-weight:950;
  color:var(--m2);
  margin-top:6px;
}
body[data-module="citas"] .dayhead{
  font-weight:950;
  color:var(--danger);
}

/* =========================
   MENÚ
   ========================= */
.menu, .menu-grid{display:grid;gap:12px}
@media (min-width:720px){
  .menu-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}

.menu a,
.menu-grid a,
.menu .item a,
.menu-grid .item a{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:10px;
  padding:14px 14px;
  border-radius:16px;
  border:1px solid var(--line);
  background:#fff;
  font-weight:950;
  text-decoration:none !important;
  box-shadow:0 2px 0 rgba(17,24,39,.04);
  transition:all .15s ease;
}
.menu a:hover,
.menu-grid a:hover,
.menu .item a:hover,
.menu-grid .item a:hover{
  transform:translateY(-1px);
  box-shadow:0 10px 22px rgba(17,24,39,.12);
  background:#f8fafc;
}

/* =========================
   Canvas (charts)
   ========================= */
canvas{
  background:#fff;
  border:1px solid var(--line);
  border-radius:14px;
  padding:8px;
}

/* =========================
   CALENDARIO NUEVO
   ========================= */
.calendar-shell{
  display:grid;
  grid-template-columns:260px minmax(0,1fr) 420px;
  gap:14px;
  align-items:start;
}
.calendar-sidebar,
.calendar-main,
.calendar-daylist{
  min-height:100%;
}
@media (max-width:1300px){
  .calendar-shell{
    grid-template-columns:240px minmax(0,1fr);
  }
  .calendar-daylist{
    grid-column:1 / -1;
  }
}
@media (max-width:980px){
  .calendar-shell{
    grid-template-columns:1fr;
  }
}

.calendar-side-date{
  font-size:22px;
  font-weight:900;
  color:var(--m1);
  margin-bottom:12px;
}
.calendar-side-block{
  padding:12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
  margin-bottom:12px;
}
.calendar-side-stat{
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding:8px 0;
  border-bottom:1px solid var(--line);
}
.calendar-side-stat:last-child{border-bottom:none}
.calendar-side-selected{
  font-size:16px;
  font-weight:800;
}
.calendar-side-actions{
  display:grid;
  gap:10px;
}

.month-grid-head{
  display:grid;
  grid-template-columns:repeat(7,minmax(0,1fr));
  gap:8px;
  margin-bottom:8px;
}
.month-grid-dow{
  padding:10px 8px;
  text-align:center;
  font-size:13px;
  font-weight:900;
  color:var(--muted);
  border-radius:12px;
  background:#f8fafc;
  border:1px solid var(--line);
}

.month-grid{
  display:grid;
  grid-template-columns:repeat(7,minmax(0,1fr));
  gap:8px;
}
@media (max-width:820px){
  .month-grid,
  .month-grid-head{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}
.month-cell{
  display:block;
  min-height:140px;
  padding:10px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
  box-shadow:0 4px 10px rgba(17,24,39,.06);
  text-decoration:none !important;
}
.month-cell:hover{
  transform:translateY(-1px);
  box-shadow:0 10px 18px rgba(17,24,39,.10);
}
.month-cell.muted{opacity:.45}
.month-cell.selected{
  border-color:#94a3b8;
  background:#f8fafc;
}
.month-cell-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-bottom:8px;
}
.month-num{
  font-size:18px;
  font-weight:900;
  color:#334155;
}
.month-count{
  min-width:24px;
  height:24px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  background:#e2e8f0;
  color:#334155;
  font-size:12px;
  font-weight:900;
}
.month-statuses{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-bottom:8px;
}
.month-status{
  min-width:22px;
  height:22px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  font-size:11px;
  font-weight:900;
  color:#fff;
}
.month-status.ok{background:#16a34a}
.month-status.warn{background:#f59e0b}
.month-status.bad{background:#ef4444}

.month-events{
  display:grid;
  gap:6px;
}
.month-event{
  padding:6px 8px;
  border-radius:10px;
  border-left:4px solid #cbd5e1;
  background:#f8fafc;
}
.month-event.confirmed{
  border-left-color:#16a34a;
  background:#f0fdf4;
}
.month-event.pending{
  border-left-color:#f59e0b;
  background:#fffbeb;
}
.month-event.cancelled{
  border-left-color:#ef4444;
  background:#fef2f2;
}
.month-event-title{
  font-size:12px;
  font-weight:800;
  line-height:1.2;
  color:var(--text);
}
.month-event-meta{
  font-size:11px;
  color:var(--muted);
  margin-top:2px;
}
.month-more{
  font-size:12px;
  font-weight:800;
  color:var(--m1);
  padding-top:2px;
}

.week-board{
  display:grid;
  grid-template-columns:repeat(7,minmax(0,1fr));
  gap:10px;
}
@media (max-width:980px){
  .week-board{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}
.week-col{
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
  overflow:hidden;
}
.week-col.selected{
  border-color:#94a3b8;
  background:#f8fafc;
}
.week-col-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:10px 12px;
  background:#f8fafc;
  border-bottom:1px solid var(--line);
  font-size:13px;
}
.week-col-body{
  padding:10px;
}
.week-empty{
  font-size:12px;
  color:var(--muted);
}
.week-event{
  display:block;
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
  margin-bottom:8px;
}
.week-event-title{
  font-size:13px;
  font-weight:800;
}
.week-event-meta{
  font-size:11px;
  color:var(--muted);
  margin-top:2px;
}

.day-stack{
  display:grid;
  gap:10px;
}
.day-stack-item{
  display:block;
  padding:12px;
  border-radius:14px;
  border-left:4px solid #cbd5e1;
  background:#f8fafc;
}
.day-stack-item.confirmed{
  border-left-color:#16a34a;
  background:#f0fdf4;
}
.day-stack-item.pending{
  border-left-color:#f59e0b;
  background:#fffbeb;
}
.day-stack-item.cancelled{
  border-left-color:#ef4444;
  background:#fef2f2;
}
.day-stack-title{
  font-size:15px;
  font-weight:900;
}
.day-stack-meta{
  font-size:12px;
  color:var(--muted);
  margin-top:4px;
}

/* =========================
   Productos
   ========================= */
.semaforo{
  width:14px;
  height:14px;
  border-radius:50%;
  display:inline-block;
}
.verde{background:#22c55e}
.amarillo{background:#eab308}
.rojo{background:#ef4444}

.sel{
  appearance:none;
  -webkit-appearance:none;
  width:20px;
  height:20px;
  border-radius:50%;
  border:2px solid #94a3b8;
  background:#fff;
  cursor:pointer;
}
.sel:checked{
  background:#0284c7;
  border-color:#0284c7;
}