:root {
  /* Paleta de Event Planner Assistant: negro, dorado, naranja y crema.
     --brand se reemplaza por el color de cada empresa (Ajustes → Tu marca). */
  --brand: #C8912F;
  --brand-ink: #FFFFFF;
  --brand-soft: #F8EEDC;
  --gold: #D9A84E; --gold-light: #F5D28D; --gold-dark: #9C6B22;
  --orange: #EE7D22; --orange-soft: #FDEBDA;
  --cream: #FFF8EC;
  --black: #0B0B0A;
  --bg: #F7F4EE;
  --card: #FFFFFF;
  --ink: #161412;
  --muted: #76706A;
  --line: #EAE4D9;
  --ok: #0EA394;  --ok-soft: #DDF6F2;
  --warn: #B86E00; --warn-soft: #FFF1DA;
  --bad: #D93A3A; --bad-soft: #FDE4E4;
  --info: #2F6FDB; --info-soft: #E2ECFD;
  --radius: 16px;
  --side: 248px;
  --shadow: 0 1px 2px rgba(22,18,10,.05), 0 4px 16px rgba(22,18,10,.06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: Poppins, system-ui, -apple-system, sans-serif; font-size: 15px; line-height: 1.45;
  background: var(--bg); color: var(--ink); min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
svg.i { width: 20px; height: 20px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Estructura ---------- */
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 12px; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand .logo, .logo-box {
  width: 42px; height: 42px; border-radius: 12px; object-fit: contain; flex-shrink: 0; background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 16px;
}
img.logo, img.logo-box { background: #fff; border: 1px solid var(--line); }
.brand .name { font-weight: 600; font-size: 15px; line-height: 1.2; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--muted); font-weight: 500;
}
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.on { background: var(--brand-soft); color: var(--ink); }
.nav a.on svg { color: var(--brand); }
.nav .count { margin-left: auto; background: var(--brand); color: var(--brand-ink); font-size: 11px; font-weight: 600; border-radius: 99px; padding: 1px 7px; }
.side-foot { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.side-foot .who { font-size: 12px; color: var(--muted); padding: 0 8px; word-break: break-all; }

.main { margin-left: var(--side); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 10; background: rgba(247,244,238,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; gap: 10px; padding: 16px 28px 12px; padding-top: calc(16px + env(safe-area-inset-top));
}
.topbar h1 { font-size: 22px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .m-logo { display: none; }
.content { padding: 4px 28px 40px; max-width: 1180px; }

.bottom { display: none; }
.demo-bar {
  background: var(--ink); color: #fff; font-size: 13px; padding: 8px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-left: var(--side);
}
.demo-bar select { font: inherit; font-size: 13px; border-radius: 8px; border: 0; padding: 4px 8px; }
.demo-bar { background: var(--black); }
.demo-bar b { color: var(--gold-light); }
.demo-bar .btn { color: var(--ink); min-height: 28px; }
@media (max-width: 899px) { .demo-bar { padding: 6px 12px; gap: 8px; } .demo-bar .demo-note { display: none; } .demo-bar select { max-width: 170px; } }

@media (max-width: 899px) {
  .side { display: none; }
  .main, .demo-bar { margin-left: 0; }
  .topbar { padding: 12px 16px 10px; padding-top: calc(12px + env(safe-area-inset-top)); }
  .topbar h1 { font-size: 19px; }
  .topbar .m-logo { display: grid; width: 34px; height: 34px; border-radius: 10px; font-size: 13px; }
  .content { padding: 4px 16px calc(96px + env(safe-area-inset-bottom)); }
  .bottom {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom a, .bottom button {
    display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 4px 0;
    background: none; border: 0; cursor: pointer; font-weight: 500;
  }
  .bottom a.on { color: var(--brand); }
  .bottom svg.i { width: 22px; height: 22px; }
}

/* ---------- Componentes ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card, .stack > * + * { margin-top: 14px; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-h h2 { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; align-items: start; }
.grid2 > .card + .card, .grid3 > * + * { margin-top: 0; }
.grid2 > *, .grid3 > *, .stack > * { min-width: 0; }
@media (max-width: 899px) { .grid2, .grid3 { grid-template-columns: 1fr; } .grid2 > .card + .card, .grid3 > * + * { margin-top: 0; } }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.kpi .lbl { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi .val { font-size: 22px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); }
@media (max-width: 899px) { .kpis { grid-template-columns: 1fr 1fr; gap: 10px; } .kpi .val { font-size: 18px; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--card);
  border-radius: 12px; padding: 9px 14px; font-weight: 500; cursor: pointer; white-space: nowrap; min-height: 40px;
}
.btn:hover { border-color: #C9CEDA; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(.95); }
.btn.dark { background: var(--ink); color: #fff; border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg.i { width: 18px; height: 18px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; border-radius: 99px; padding: 2px 9px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--ink); }

.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); min-width: 0; }
.list > .row:first-child { border-top: 0; padding-top: 2px; }
a.row:hover .title, .row[data-a]:hover .title { color: var(--brand); }
.row[data-a] { cursor: pointer; }
.row .title { font-weight: 500; }
.row .meta { font-size: 13px; color: var(--muted); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 14px; flex-shrink: 0; }
.datebox { width: 48px; flex-shrink: 0; text-align: center; border-radius: 12px; background: var(--brand-soft); padding: 5px 0; line-height: 1.1; }
.datebox .d { font-size: 18px; font-weight: 600; }
.datebox .m { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; font-size: 14px; }
.empty .btn { margin-top: 12px; }

.check { width: 24px; height: 24px; border-radius: 8px; border: 2px solid #C9CEDA; display: grid; place-items: center; flex-shrink: 0; cursor: pointer; background: var(--card); }
.check.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.check svg.i { width: 15px; height: 15px; stroke-width: 3; }
.done .title { text-decoration: line-through; color: var(--muted); }

.tabs { display: flex; gap: 4px; background: #EEE8DC; border-radius: 12px; padding: 4px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { flex: 1; text-align: center; padding: 7px 12px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; border: 0; background: none; cursor: pointer; }
.tabs .on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search { flex: 1; min-width: 160px; }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t .num, table.t th.num { text-align: right; }
table.t tfoot td { font-weight: 600; border-top: 2px solid var(--line); border-bottom: 0; }
.scroll-x { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.sumline { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; }
.sumline.big { font-size: 17px; font-weight: 600; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }

.bar { height: 8px; border-radius: 99px; background: var(--bg); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.chart { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.chart .bars { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.chart .bars i { width: 40%; max-width: 22px; border-radius: 6px 6px 2px 2px; min-height: 2px; }
.chart .lb { font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 10px; flex-wrap: wrap; }
.legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; background: var(--c); vertical-align: -1px; }

.banner { border-radius: 14px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; margin-bottom: 14px; font-size: 14px; }
.banner.warn { background: var(--warn-soft); color: #6E4300; }
.banner.info { background: var(--info-soft); color: #1C468F; }
.banner.brand { background: var(--brand-soft); }

/* Reloj */
.clock-card { background: radial-gradient(120% 140% at 100% 0%, #2A2116 0%, var(--black) 60%); color: #fff; border: 1px solid rgba(217,168,78,.35); border-radius: var(--radius); padding: 18px; }
.clock-card .big { font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; }
.clock-card .btn.primary { min-height: 48px; font-size: 16px; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--orange); display: inline-block; box-shadow: 0 0 0 4px rgba(238,125,34,.3); }

/* Calendario */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-head h2 { flex: 1; text-transform: capitalize; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.cal .wd { background: var(--bg); font-size: 12px; color: var(--muted); text-align: center; padding: 6px 0; font-weight: 500; }
.cal .day { background: var(--card); min-height: 104px; padding: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal .day.out { background: #FAFBFC; color: #B5BBCB; }
.cal .day.sel { box-shadow: inset 0 0 0 2px var(--brand); }
.cal .n { font-size: 13px; font-weight: 500; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal .today .n { background: var(--brand); color: var(--brand-ink); }
.cal .ev { font-size: 11px; border-radius: 6px; padding: 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; background: var(--brand); }
.cal .ev.tk { background: var(--bg); color: var(--muted); }
.cal .ev.cotizacion { background: var(--warn-soft); color: var(--warn); }
.cal .ev.cancelado { background: var(--bg); color: var(--muted); text-decoration: line-through; }
.cal .dots { display: none; gap: 3px; justify-content: center; }
.cal .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.cal .dots i.tk { background: #B5BBCB; }
@media (max-width: 899px) {
  .cal .day { min-height: 52px; align-items: center; padding: 4px 2px; }
  .cal .ev { display: none; }
  .cal .dots { display: flex; }
}

/* Formularios */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(11,11,10,.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.sheet-card { background: var(--card); border-radius: 20px; width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(11,11,10,.35); }
.sheet-card.wide { max-width: 820px; }
.sheet-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 10px; }
.sheet-h h2 { flex: 1; font-size: 18px; }
.sheet-b { padding: 4px 18px 8px; overflow-y: auto; }
.sheet-f { padding: 12px 18px 16px; display: flex; gap: 8px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.sheet-f .sp { flex: 1; }
@media (max-width: 899px) {
  .sheet { align-items: flex-end; padding: 0; }
  .sheet-card { border-radius: 20px 20px 0 0; max-height: 92vh; }
  .sheet-f { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; grid-column: span 2; min-width: 0; }
.field.half { grid-column: span 1; }
.field > span { font-size: 13px; font-weight: 500; color: var(--muted); }
.field .hint { font-size: 12px; color: var(--muted); }
.fields h3 { grid-column: span 2; margin-top: 8px; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
input[type=color] { padding: 4px; height: 44px; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--brand); }
textarea { min-height: 80px; resize: vertical; }
label.inline { display: flex; align-items: center; gap: 10px; font-size: 14px; grid-column: span 2; }
@media (max-width: 520px) { .field.half { grid-column: span 2; } .field.half.keep { grid-column: span 1; } }

#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; font-size: 14px; z-index: 80; transition: .2s; max-width: 90vw;
}
#toast.on { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--bad); }
@media (max-width: 899px) { #toast { bottom: calc(86px + env(safe-area-inset-bottom)); } }

/* Acceso */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(90% 60% at 80% 0%, rgba(238,125,34,.22), transparent 60%), radial-gradient(80% 60% at 0% 100%, rgba(217,168,78,.25), transparent 60%), var(--black); }
.auth .credit { color: rgba(255,255,255,.55); }
.auth .credit b { color: var(--gold-light); }
.auth .card { width: 100%; max-width: 420px; padding: 26px; }
.auth .logo-box { width: 56px; height: 56px; border-radius: 16px; font-size: 20px; margin-bottom: 14px; }
.auth h1 { font-size: 22px; margin-bottom: 4px; }
.auth form { display: grid; gap: 12px; margin-top: 18px; }
.auth form > * { grid-column: 1 / -1; }
.auth .links { display: flex; justify-content: space-between; font-size: 13px; margin-top: 14px; }
.auth .links a { color: var(--brand); font-weight: 500; cursor: pointer; }
.loading { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }

/* Impresión (cotización, factura, recibo de pago) */
.doc { font-size: 14px; color: #16233F; }
.doc .doc-h { display: flex; gap: 16px; align-items: flex-start; border-bottom: 3px solid var(--brand); padding-bottom: 14px; margin-bottom: 16px; }
.doc .doc-h img, .doc .doc-h .logo-box { width: 64px; height: 64px; border-radius: 14px; object-fit: contain; }
.doc .doc-h .co { flex: 1; }
.doc .doc-h .co b { font-size: 18px; display: block; }
.doc .doc-title { text-align: right; }
.doc .doc-title b { font-size: 20px; color: var(--brand); display: block; text-transform: uppercase; letter-spacing: .5px; }
.doc .two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.doc .lbl { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 600; letter-spacing: .4px; }
.doc .totals { margin-left: auto; max-width: 300px; margin-top: 10px; }
.doc .terms { margin-top: 18px; font-size: 12px; color: var(--muted); white-space: pre-wrap; }
#print { display: none; }
@media print {
  body { background: #fff; }
  body > *:not(#print) { display: none !important; }
  #print { display: block; padding: 0; }
  @page { margin: 16mm; }
}

/* Contraseña con ojito */
.pw { position: relative; }
.pw input { padding-right: 48px; }
.pw .eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; border-radius: 10px; }
.pw .eye:hover { color: var(--ink); }

/* Créditos */
.credit { display: block; text-align: center; font-size: 12px; color: var(--muted); padding: 14px 8px; }
.credit b { font-weight: 600; color: var(--ink); }
.credit:hover b { color: var(--brand); }
.app-foot { padding: 0 28px 24px; max-width: 1180px; }
.auth { grid-template-rows: 1fr auto; align-items: center; }
.auth > .card { align-self: center; }
@media (max-width: 899px) { .app-foot { padding: 0 16px calc(84px + env(safe-area-inset-bottom)); } .content { padding-bottom: 8px; } }

/* Hojas/formularios: el contenido se desplaza y los botones quedan siempre visibles */
.sheet-card { overflow: hidden; max-height: calc(100dvh - 40px); }
.sheet-card > form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sheet-b { flex: 1; min-height: 0; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet-f { flex-shrink: 0; background: var(--card); }
@media (max-width: 899px) { .sheet-card { max-height: 92dvh; } }

/* Servicios puntuales (no eventos) */
.datebox.servicio { background: var(--orange-soft); }
.kind-dot { display: inline-flex; vertical-align: -3px; margin-right: 5px; color: var(--orange); }
.kind-dot svg.i { width: 16px; height: 16px; }
.badge svg.i { width: 13px; height: 13px; }
.cal .ev.servicio { background: var(--orange); }
.cal .ev.servicio.cotizacion { background: var(--orange-soft); color: #A9520E; }
.cal .dots i.servicio { background: var(--orange); }

/* Marca de la plataforma (el logo de cada empresa va arriba, este abajo) */
.platform { display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-size: 12px; color: var(--muted); }
.platform img { width: 26px; height: 26px; border-radius: 7px; }
.platform b { color: var(--ink); font-weight: 600; display: block; font-size: 12px; line-height: 1.2; }
.auth .app-logo { width: 64px; height: 64px; border-radius: 16px; margin-bottom: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.badge.svc { background: var(--orange-soft); color: #A9520E; }
.btn.primary { box-shadow: 0 1px 0 rgba(255,255,255,.25) inset; }

/* Caja temporal para crear el PDF (fuera de la pantalla) */
.pdf-box { position: absolute; left: 0; top: 0; z-index: -1; width: 760px; background: #fff; padding: 8px; pointer-events: none; }
