/* Flowww · Simulador (Musas) — SOLO dev. Sin CDN, tipografía sistema. */
:root {
  --bg: #f7f7fb;
  --panel: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --danger: #dc2626;
  --agenda-colw: 58px;
  --slot-h: 44px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}
button { font: inherit; color: inherit; }

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 228px; flex-shrink: 0;
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid var(--border); }
.brand-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px;
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.brand-sub { font-size: 11.5px; color: var(--muted); }
.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  text-align: left; padding: 9px 12px; border: 0; background: transparent;
  border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 500;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-on { background: #22c55e; }
.dot-off { background: #d1d5db; }
.dot-err { background: var(--danger); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--panel); border-bottom: 1px solid var(--border);
  padding: 14px 24px; display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 18px; font-weight: 700; }
.badge-sim {
  margin-left: auto; font-size: 11px; font-weight: 700; letter-spacing: .06em;
  color: #92400e; background: #fef3c7; border: 1px solid #fcd34d;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.view { padding: 18px 24px 40px; }

/* ── Componentes ── */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar-wrap { flex-wrap: wrap; }
.btn-group { display: flex; gap: 8px; align-items: center; }
.btn {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 13px; cursor: pointer; font-weight: 500;
}
.btn:hover { border-color: #c7cad1; background: #fafafa; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #4338ca; border-color: #4338ca; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.input {
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 11px;
  font: inherit; background: var(--panel); min-width: 220px;
}
.input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.select { min-width: 160px; }
.week-label { font-weight: 600; color: var(--muted); }
.hint { margin-top: 10px; font-size: 12px; color: var(--muted); }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); background: #fafafc;
}
.table td { padding: 9px 14px; border-bottom: 1px solid #f1f2f5; }
.table tbody tr:hover { background: #fafaff; }
.table tbody tr.clickable { cursor: pointer; }
.table .num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.pager { display: flex; align-items: center; gap: 12px; justify-content: flex-end; padding: 10px 14px; font-size: 13px; color: var(--muted); }
.badge-low { color: var(--danger); font-weight: 700; }
.chip-fam { font-size: 12px; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.stat-card .k { font-size: 26px; font-weight: 700; }
.stat-card .l { font-size: 12px; color: var(--muted); margin-top: 4px; }
.client-detail { margin-top: 14px; padding: 16px; }
.client-detail h3 { font-size: 15px; margin-bottom: 10px; }

/* ── Agenda ── */
.agenda-scroll { overflow: auto; max-height: calc(100vh - 210px); }
.agenda-grid { display: grid; width: max-content; min-width: 100%; }
.ag-corner {
  grid-column: 1; grid-row: 1 / span 2;
  position: sticky; left: 0; top: 0; z-index: 22;
  background: var(--panel); border-bottom: 1px solid var(--border); border-right: 1px solid var(--border);
}
.ag-day {
  grid-row: 1; text-align: center; font-weight: 600; font-size: 12.5px;
  padding: 8px 4px 4px; background: var(--panel);
  border-bottom: 1px solid #f1f2f5; border-left: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.ag-day.today { color: var(--accent); }
.ag-prof {
  grid-row: 2; display: flex; align-items: center; justify-content: center;
  padding: 4px 2px 8px; background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 29px; z-index: 20;
}
.ag-prof + .ag-prof-first, .ag-prof.first { border-left: 1px solid var(--border); }
.ag-prof .chip {
  font-size: 10.5px; font-weight: 700; letter-spacing: .03em; color: #1f2937;
  border-radius: 6px; padding: 3px 6px; min-width: 34px; text-align: center;
}
.ag-timecol {
  grid-column: 1; grid-row: 3;
  position: sticky; left: 0; z-index: 15;
  background: var(--panel); border-right: 1px solid var(--border);
}
.ag-time {
  height: var(--slot-h); font-size: 11px; color: var(--muted);
  text-align: right; padding: 2px 8px 0 0; border-top: 1px solid #f1f2f5;
  font-variant-numeric: tabular-nums;
}
.ag-col { grid-row: 3; position: relative; background: var(--panel); }
.ag-col.day-start { border-left: 1px solid var(--border); }
.ag-cell { height: var(--slot-h); border-top: 1px solid #f1f2f5; border-left: 1px solid #f7f8fa; cursor: pointer; }
.ag-cell:hover { background: var(--accent-soft); }
.ag-col.past .ag-cell { background: #fbfbfd; cursor: default; }
.ag-appt {
  position: absolute; left: 2px; right: 2px; z-index: 5;
  border-radius: 6px; padding: 3px 5px; overflow: hidden; cursor: pointer;
  border-left: 3px solid; font-size: 10.5px; line-height: 1.25;
}
.ag-appt:hover { filter: brightness(.97); }
.ag-appt .t { font-weight: 700; }
.ag-appt .c { color: var(--muted); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: var(--panel); border-radius: 14px; width: 460px; max-width: 100%;
  max-height: 90vh; overflow: auto; padding: 20px 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.modal h3 { font-size: 16px; margin-bottom: 14px; }
.modal .field { margin-bottom: 12px; position: relative; }
.modal label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.modal .input { width: 100%; min-width: 0; }
.modal .row { display: flex; gap: 10px; }
.modal .row .field { flex: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal-err { color: var(--danger); font-size: 12.5px; margin-top: 10px; min-height: 16px; }
.drop {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 10;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  max-height: 210px; overflow: auto; box-shadow: 0 8px 24px rgba(0,0,0,.1);
}
.drop-item { padding: 8px 11px; cursor: pointer; font-size: 13px; }
.drop-item:hover { background: var(--accent-soft); }
.drop-item .sub { color: var(--muted); font-size: 11.5px; }
.drop-item.create { color: var(--accent); font-weight: 600; border-top: 1px solid var(--border); }
.detail-list { list-style: none; }
.detail-list li { display: flex; gap: 10px; padding: 5px 0; }
.detail-list .dt { width: 110px; color: var(--muted); font-size: 12.5px; flex-shrink: 0; }
.status-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.status-booked { background: #dcfce7; color: #166534; }
.status-rescheduled { background: #fef3c7; color: #92400e; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 200;
  background: #111827; color: #fff; padding: 11px 16px; border-radius: 10px;
  font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
