/* =====================================================================
   CelularTaller · Panel
   Tokens de color en :root (oscuro por defecto) y [data-theme="light"]
   ===================================================================== */
:root {
  --bg: #0B0C10;
  --bg-2: #0F1015;
  --surface: #14151B;
  --surface-2: #1A1C23;
  --surface-3: #22242D;
  --line: #262833;
  --line-2: #33363F;
  --ink: #EDEDF2;
  --ink-2: #C5C7D2;
  --mut: #8E909E;
  --acc: var(--acc-vivo);
  --acc-ink: #0B0C10;
  --acc-soft: rgba(184, 242, 58, .12);
  --blue: var(--blue-vivo);
  --coral: var(--coral-vivo);
  --cyan: var(--cyan-vivo);
  --violet: #B48CFF;
  --warn: #F5C542;
  --danger: #FF6B6B;
  --ok: #5BE49B;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 20px 40px -24px rgba(0,0,0,.6);
  --shadow-lg: 0 30px 80px -20px rgba(0,0,0,.7);
  --r: 16px;
  --r-sm: 10px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Sora", "Inter", system-ui, sans-serif;
  --side: 264px;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #F4F5F7;
  --bg-2: #ECEDF1;
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;
  --surface-3: #EEF0F4;
  --line: #E4E6EC;
  --line-2: #D6D9E1;
  --ink: #15161C;
  --ink-2: #3A3C47;
  --mut: #6B6E7C;
  --acc: #4F7A00;
  --acc-ink: #FFFFFF;
  --acc-soft: rgba(102, 160, 0, .12);
  --blue: #3C5BD9;
  --coral: #D9541F;
  --cyan: #0B8F8D;
  --violet: #7A4FD6;
  --warn: #A37800;
  --danger: #D33A3A;
  --ok: #138A4B;
  --shadow: 0 1px 2px rgba(20,22,30,.04), 0 12px 32px -18px rgba(20,22,30,.18);
  --shadow-lg: 0 30px 80px -24px rgba(20,22,30,.3);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 14.5px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; letter-spacing: -.02em; line-height: 1.2; }
h1 { font-size: clamp(22px, 2.4vw, 28px); font-weight: 700; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
code, .mono { font-family: ui-monospace, "JetBrains Mono", Consolas, monospace; font-size: .92em; }
::selection { background: var(--acc); color: var(--acc-ink); }
.ico { width: 18px; height: 18px; flex: none; }
.mut { color: var(--mut); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 6px; }

/* ---------- Scrollbar ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid var(--bg); }

/* =====================================================================
   Layout
   ===================================================================== */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--bg-2); border-right: 1px solid var(--line); padding: 18px 14px; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font: 700 17px var(--display); letter-spacing: -.02em; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--acc); color: var(--acc-ink); position: relative; overflow: hidden;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%);
  transform: translateX(-120%); animation: shine 4.5s var(--ease) infinite 1.5s;
}
@keyframes shine { 0%, 70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.brand-mark .ico { width: 18px; height: 18px; stroke-width: 2.2; }
.brand small { display: block; font: 500 11px var(--font); color: var(--mut); letter-spacing: 0; }

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; margin: 0 -6px; padding: 0 6px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--mut); padding: 14px 10px 6px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px;
  color: var(--ink-2); font-weight: 500; transition: background .2s, color .2s, transform .2s var(--ease);
}
.nav a:hover { background: var(--surface-2); color: var(--ink); transform: translateX(2px); }
.nav a.is-active { background: var(--surface-3); color: var(--ink); }
.nav a.is-active::before {
  content: ""; position: absolute; left: -6px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--acc);
  animation: grow-y .4s var(--spring);
}
@keyframes grow-y { from { transform: scaleY(0); } }
.nav a.is-active .ico { color: var(--acc); }
.nav .count { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--acc-soft); color: var(--acc); padding: 1px 7px; border-radius: 20px; }
.side-foot { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 10px; display: flex; align-items: center; gap: 10px; }
.side-foot .who { min-width: 0; flex: 1; }
.side-foot .who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { font-size: 12px; color: var(--mut); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 12px clamp(16px, 3vw, 32px); background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.topbar .search { flex: 1; max-width: 420px; position: relative; }
.topbar .search input { padding-left: 38px; background: var(--surface); }
.topbar .search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--mut); }
.topbar .search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.topbar .spacer { flex: 1; }
.burger { display: none; }
.content { padding: clamp(18px, 3vw, 32px); max-width: 1480px; width: 100%; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 24px; }
.page-head p { color: var(--mut); margin-top: 4px; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--mut); margin-bottom: 6px; }
.crumbs a:hover { color: var(--ink); }

kbd { font: 600 11px var(--font); color: var(--mut); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; background: var(--surface-2); }

/* =====================================================================
   Componentes
   ===================================================================== */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 20px; position: relative;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head .mut { font-size: 13px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 18px 20px 0; }
.grid { display: grid; gap: 16px; }
.grid > *, .pos > *, .stack > * { min-width: 0; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.between { justify-content: space-between; }

/* Spotlight: borde que sigue al cursor */
.spot { isolation: isolate; }
.spot::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--acc) 70%, transparent), transparent 60%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .3s;
}
.spot:hover::before { opacity: 1; }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; color: var(--mut); font-size: 13px; font-weight: 500; }
.kpi-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink); }
.kpi-ico.acc { background: var(--acc-soft); color: var(--acc); }
.kpi-ico.blue { background: color-mix(in srgb, var(--blue) 15%, transparent); color: var(--blue); }
.kpi-ico.coral { background: color-mix(in srgb, var(--coral) 15%, transparent); color: var(--coral); }
.kpi-ico.cyan { background: color-mix(in srgb, var(--cyan) 15%, transparent); color: var(--cyan); }
.kpi-val { font: 700 clamp(24px, 2.4vw, 30px)/1 var(--display); letter-spacing: -.03em; }
.kpi-foot { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--mut); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 12px; padding: 2px 7px; border-radius: 20px; }
.delta .ico { width: 13px; height: 13px; }
.delta.up { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.delta.down { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.kpi .spark { position: absolute; right: 0; bottom: 0; width: 55%; height: 46px; opacity: .9; pointer-events: none; }

/* Botones */
.btn {
  --b: var(--surface-2); --c: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 11px; border: 1px solid var(--line-2); background: var(--b); color: var(--c);
  font: 600 14px var(--font); cursor: pointer; white-space: nowrap; user-select: none; position: relative; overflow: hidden;
  transition: transform .25s var(--ease), background .2s, border-color .2s, box-shadow .25s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--mut); }
.btn:active { transform: translateY(0) scale(.97); }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn.is-loading::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.btn-primary { --b: var(--acc); --c: var(--acc-ink); border-color: transparent; box-shadow: 0 8px 24px -10px color-mix(in srgb, var(--acc) 70%, transparent); }
.btn-primary:hover { border-color: transparent; box-shadow: 0 14px 30px -10px color-mix(in srgb, var(--acc) 80%, transparent); }
.btn-ghost { --b: transparent; border-color: transparent; }
.btn-ghost:hover { --b: var(--surface-2); border-color: transparent; }
.btn-danger { --c: var(--danger); }
.btn-danger:hover { --b: color-mix(in srgb, var(--danger) 12%, transparent); border-color: var(--danger); }
.btn-wa { --b: #1FAF5A; --c: #fff; border-color: transparent; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 13px; }
.btn-icon { width: 40px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-block { width: 100%; }
.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .25; transform: scale(0); animation: ripple .6s var(--ease) forwards; pointer-events: none; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--mut); }
.input, input:not([type]), input[type=text], input[type=url], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=date],
input[type=datetime-local], input[type=search], input[type=color], select, textarea {
  width: 100%; height: 42px; padding: 0 13px; border-radius: 11px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--ink); font: 400 14.5px var(--font);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
textarea { height: auto; min-height: 90px; padding: 11px 13px; resize: vertical; line-height: 1.5; }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238E909E' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; background-size: 16px; }
input:hover, select:hover, textarea:hover { border-color: var(--mut); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 4px var(--acc-soft); background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--mut); opacity: .8; }
input[type=color] { padding: 4px; width: 60px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--acc); }
.input-group { display: flex; }
.input-group > :first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > :last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; gap: 2px; }
.seg a, .seg button, .seg label { padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--mut); border: 0; background: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: .2s; }
.seg .is-active, .seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg input { display: none; }
.seg label span { padding: 0; }

/* Badges y chips */
.badge {
  --c: var(--mut);
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 20px; white-space: nowrap;
  font-size: 12px; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent);
}
.badge i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent); }
.badge-info { --c: var(--blue); } .badge-violet { --c: var(--violet); } .badge-warn { --c: var(--warn); }
.badge-orange { --c: var(--coral); } .badge-cyan { --c: var(--cyan); } .badge-ok { --c: var(--ok); }
.badge-danger { --c: var(--danger); } .badge-muted { --c: var(--mut); }
.badge-ok i, .badge-cyan i { animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 7px; border: 1px solid var(--line-2); color: var(--ink-2); white-space: nowrap; }
.chip-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.chip-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.chip-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.chip-acc { color: var(--acc); border-color: color-mix(in srgb, var(--acc) 40%, transparent); }

/* Avatar */
.avatar { --c: var(--acc); width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; font: 700 13px var(--display); color: #0B0C10; background: var(--c); }
.avatar.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 19px; }
.avatars { display: flex; } .avatars .avatar { margin-left: -8px; border: 2px solid var(--surface); } .avatars .avatar:first-child { margin-left: 0; }

/* Tablas */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--mut); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .cell-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.table .cell-main b { display: block; font-weight: 600; }
.table .cell-main span { font-size: 12.5px; color: var(--mut); }
.table tr[data-href] { cursor: pointer; }
.dev-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex: none; }

/* Alertas */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid; font-size: 14px; }
.alert-ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, transparent); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.alert-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, transparent); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert-error { color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-info { color: var(--blue); background: color-mix(in srgb, var(--blue) 8%, transparent); border-color: color-mix(in srgb, var(--blue) 30%, transparent); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; position: relative; }
.tabs a, .tabs button { padding: 10px 14px; font-weight: 600; font-size: 14px; color: var(--mut); background: none; border: 0; cursor: pointer; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; transition: color .2s; }
.tabs .is-active { color: var(--ink); }
.tabs .ink { position: absolute; bottom: -1px; height: 2px; background: var(--acc); border-radius: 2px; transition: left .35s var(--ease), width .35s var(--ease); }
.tab-panel { display: none; } .tab-panel.is-active { display: block; animation: fade-up .45s var(--ease); }

/* Listas */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow b { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .grow span { font-size: 12.5px; color: var(--mut); }
a.list-item { transition: transform .2s var(--ease); } a.list-item:hover { transform: translateX(3px); }

/* Progreso */
.bar { height: 7px; border-radius: 10px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--acc), var(--cyan)); transform-origin: left; animation: bar-in 1.2s var(--ease) both; }
@keyframes bar-in { from { transform: scaleX(0); } }

/* Vacío */
.empty { text-align: center; padding: 48px 20px; color: var(--mut); }
.empty .ico { width: 44px; height: 44px; margin: 0 auto 12px; color: var(--line-2); stroke-width: 1.4; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* Paginación */
.pager { display: flex; gap: 6px; justify-content: center; padding: 18px; flex-wrap: wrap; }
.pager a { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); font-weight: 600; font-size: 13px; transition: .2s; }
.pager a:hover { border-color: var(--mut); }
.pager a.is-active { background: var(--acc); color: var(--acc-ink); border-color: transparent; }
.pager-gap { align-self: center; color: var(--mut); }

/* Filtros */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.filters .input-search { position: relative; flex: 1; min-width: 200px; }
.filters .input-search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--mut); }
.filters .input-search input { padding-left: 38px; }
.filters select { width: auto; min-width: 150px; }

/* =====================================================================
   Modal, drawer, toasts, dropdown
   ===================================================================== */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.is-open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5, 6, 9, .62); backdrop-filter: blur(6px); animation: fade .3s var(--ease); }
.modal-box {
  position: relative; width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg);
  animation: pop .45s var(--spring);
}
.modal-box.lg { width: min(820px, 100%); }
.modal-box.sm { width: min(420px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
.modal.is-closing .modal-box { animation: pop-out .22s var(--ease) forwards; }
.modal.is-closing .modal-backdrop { animation: fade .22s reverse forwards; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(24px) scale(.94); } }
@keyframes pop-out { to { opacity: 0; transform: translateY(12px) scale(.97); } }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; min-width: 280px; max-width: 380px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: toast-in .5s var(--spring); position: relative; overflow: hidden;
}
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--c, var(--acc)); transform-origin: left; animation: toast-timer 5s linear forwards; }
.toast .t-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; color: var(--c, var(--acc)); background: color-mix(in srgb, var(--c, var(--acc)) 14%, transparent); }
.toast.ok { --c: var(--ok); } .toast.error { --c: var(--danger); } .toast.warn { --c: var(--warn); } .toast.info { --c: var(--blue); }
.toast.is-leaving { animation: toast-out .35s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px) scale(.9); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px); } }
@keyframes toast-timer { to { transform: scaleX(0); } }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: 6px; z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-6px) scale(.97); transform-origin: top right; pointer-events: none; transition: .2s var(--ease);
}
.dropdown.is-open .dropdown-menu { opacity: 1; transform: none; pointer-events: auto; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 9px; font-size: 14px; color: var(--ink-2); background: none; border: 0; cursor: pointer; text-align: left; font-family: inherit; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); color: var(--ink); }
.dropdown-menu .is-active { color: var(--acc); }

/* =====================================================================
   Kanban
   ===================================================================== */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x proximity; }
.k-col { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; min-height: 300px; scroll-snap-align: start; transition: border-color .2s, background .2s; }
.k-col.is-over { border-color: var(--acc); background: color-mix(in srgb, var(--acc) 5%, var(--bg-2)); }
.k-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px; font-weight: 600; font-size: 13.5px; }
.k-head .n { margin-left: auto; font-size: 12px; color: var(--mut); background: var(--surface-2); padding: 1px 8px; border-radius: 20px; }
.k-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.k-list { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 4px 10px 12px; min-height: 60px; }
.k-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 12px; cursor: grab;
  transition: transform .25s var(--ease), box-shadow .25s, opacity .2s; user-select: none;
}
.k-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.k-card.is-dragging { opacity: .4; transform: rotate(2deg) scale(.98); }
.k-card .top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--mut); margin-bottom: 6px; }
.k-card b { font-size: 14px; display: block; }
.k-card .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 12px; color: var(--mut); }

/* =====================================================================
   Timeline y stepper
   ===================================================================== */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 20px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: -28px; top: 1px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 2px solid var(--c, var(--line-2)); display: grid; place-items: center; }
.tl-dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--line-2)); }
.tl-item b { font-size: 14px; } .tl-item p { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; } .tl-item small { color: var(--mut); font-size: 12px; }
.tl-item .private { font-size: 11px; color: var(--warn); margin-left: 6px; }

.stepper { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding: 4px 0 2px; }
.step { flex: 1; min-width: 92px; text-align: center; position: relative; font-size: 12px; color: var(--mut); }
.step::before { content: ""; position: absolute; top: 15px; left: -50%; right: 50%; height: 2px; background: var(--line); }
.step:first-child::before { display: none; }
.step.done::before, .step.current::before { background: var(--acc); animation: line-in .6s var(--ease) both; animation-delay: calc(var(--i) * .12s); transform-origin: left; }
@keyframes line-in { from { transform: scaleX(0); } }
.step .sd { position: relative; z-index: 1; width: 32px; height: 32px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 2px solid var(--line); color: var(--mut); transition: .3s; }
.step .sd .ico { width: 15px; height: 15px; }
.step.done .sd { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); animation: pop .5s var(--spring) both; animation-delay: calc(var(--i) * .12s); }
.step.current .sd { border-color: var(--acc); color: var(--acc); box-shadow: 0 0 0 6px var(--acc-soft); animation: ring 2s infinite; }
.step.current, .step.done { color: var(--ink); font-weight: 600; }
@keyframes ring { 50% { box-shadow: 0 0 0 10px transparent; } }

/* Fotos */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.gallery a { aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); position: relative; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.gallery a:hover img { transform: scale(1.08); }
.dropzone { border: 1.5px dashed var(--line-2); border-radius: 14px; padding: 20px; text-align: center; color: var(--mut); cursor: pointer; transition: .2s; display: block; }
.dropzone:hover, .dropzone.is-over { border-color: var(--acc); background: var(--acc-soft); color: var(--ink); }
.dropzone input { display: none; }
.previews { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.previews img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; animation: pop .4s var(--spring); }
.lightbox { position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.88); display: grid; place-items: center; padding: 30px; animation: fade .25s; cursor: zoom-out; }
.lightbox img { max-height: 90vh; border-radius: 12px; animation: pop .4s var(--spring); }

/* =====================================================================
   POS
   ===================================================================== */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.pos-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.p-card {
  text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; font: inherit; color: inherit;
  display: flex; flex-direction: column; gap: 8px; transition: transform .25s var(--ease), border-color .2s, box-shadow .25s; position: relative; overflow: hidden;
}
.p-card:hover { transform: translateY(-3px); border-color: var(--acc); box-shadow: var(--shadow-lg); }
.p-card:active { transform: scale(.97); }
.p-card .p-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); }
.p-card b { font-size: 13.5px; line-height: 1.3; }
.p-card .price { font: 700 16px var(--display); color: var(--acc); margin-top: auto; }
.p-card .stk { font-size: 11.5px; color: var(--mut); }
.p-card.is-out { opacity: .5; }
.cart { position: sticky; top: 84px; display: flex; flex-direction: column; max-height: calc(100vh - 110px); }
.cart-items { flex: 1; overflow-y: auto; margin: 0 -20px; padding: 0 20px; min-height: 120px; }
.c-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); animation: slide-in .35s var(--ease); }
.c-item b { font-size: 13.5px; }
.c-item .qty { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line-2); border-radius: 9px; padding: 2px; }
.c-item .qty button { width: 26px; height: 26px; border-radius: 7px; border: 0; background: var(--surface-2); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.c-item .qty span { min-width: 24px; text-align: center; font-weight: 600; font-size: 13px; }
.totals { border-top: 1px dashed var(--line-2); padding-top: 14px; margin-top: 10px; display: grid; gap: 6px; font-size: 14px; }
.totals .row { justify-content: space-between; }
.totals .grand { font: 700 24px var(--display); }
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pay-methods label { border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 4px; text-align: center; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: .2s; }
.pay-methods input { display: none; }
.pay-methods input:checked + span { color: var(--acc); }
.pay-methods label:has(input:checked) { border-color: var(--acc); background: var(--acc-soft); }
@keyframes slide-in { from { opacity: 0; transform: translateX(16px); } }
.fly { position: fixed; z-index: 500; width: 34px; height: 34px; border-radius: 50%; background: var(--acc); pointer-events: none; transition: transform .7s cubic-bezier(.5, -0.3, .7, .2), opacity .7s; box-shadow: 0 0 30px var(--acc); }
.cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; }
.cats button { white-space: nowrap; }
.cats .is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* =====================================================================
   Gráficos SVG
   ===================================================================== */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-dasharray: 3 4; }
.chart .axis { fill: var(--mut); font-size: 11px; font-family: var(--font); }
.chart .tip { position: absolute; pointer-events: none; background: var(--surface-3); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px; font-size: 12px; white-space: nowrap; box-shadow: var(--shadow-lg); opacity: 0; transform: translate(-50%, -110%); transition: opacity .15s; z-index: 5; }
.chart .tip b { display: block; font-size: 14px; font-family: var(--display); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.donut-wrap { display: grid; grid-template-columns: 170px 1fr; gap: 20px; align-items: center; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.donut-center b { display: block; font: 700 24px var(--display); }
.donut-center span { font-size: 12px; color: var(--mut); }

/* =====================================================================
   Animaciones de entrada (stagger)
   ===================================================================== */
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } }
.reveal { animation: fade-up .6s var(--ease) both; animation-delay: calc(var(--d, 0) * 60ms); }
.content > * { animation: fade-up .55s var(--ease) both; }
.content > *:nth-child(2) { animation-delay: .05s; } .content > *:nth-child(3) { animation-delay: .1s; }
.content > *:nth-child(4) { animation-delay: .15s; } .content > *:nth-child(5) { animation-delay: .2s; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }
.page-loader { position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 999; background: linear-gradient(90deg, var(--acc), var(--cyan), var(--blue)); transform-origin: left; transform: scaleX(0); pointer-events: none; }
.page-loader.is-run { animation: loader 1.6s var(--ease) forwards; }
@keyframes loader { 0% { transform: scaleX(0); } 60% { transform: scaleX(.7); } 100% { transform: scaleX(.92); } }

/* =====================================================================
   Autenticación
   ===================================================================== */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { position: relative; overflow: hidden; background: #0B0C10; color: #EDEDF2; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art .blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; animation: float 14s ease-in-out infinite; }
.auth-art .b1 { width: 420px; height: 420px; background: var(--acc-vivo); left: -120px; top: -100px; opacity: .25; }
.auth-art .b2 { width: 380px; height: 380px; background: var(--blue-vivo); right: -100px; bottom: -60px; animation-delay: -5s; opacity: .35; }
.auth-art .b3 { width: 240px; height: 240px; background: var(--coral-vivo); left: 40%; top: 45%; animation-delay: -9s; opacity: .22; }
@keyframes float { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(40px, -30px) scale(1.08); } 66% { transform: translate(-30px, 30px) scale(.95); } }
.auth-art .gridbg { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%); }
.auth-art > * { position: relative; }
.auth-art h2 { font-size: clamp(28px, 3.2vw, 44px); line-height: 1.08; font-weight: 700; max-width: 520px; }
.auth-art h2 em { font-style: normal; color: var(--acc-vivo); }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-box { width: min(420px, 100%); }
.auth-box h1 { font-size: 28px; margin-bottom: 6px; }
.auth-box > p { color: var(--mut); margin-bottom: 26px; }
.auth-box form { display: grid; gap: 16px; }
.pass-wrap { position: relative; }
.pass-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.float-card { background: rgba(20, 21, 27, .75); border: 1px solid #2A2C36; backdrop-filter: blur(10px); border-radius: 16px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; max-width: 320px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.6); animation: bob 6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-10px); } }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1200px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pos { grid-template-columns: minmax(0, 1fr) 340px; }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .4s var(--ease); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; animation: fade .3s; }
  .burger { display: inline-flex; }
  .g-main, .g-3 { grid-template-columns: 1fr; }
  .pos { grid-template-columns: 1fr; }
  .cart { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 50; max-height: 82vh; border-radius: 22px 22px 0 0; transform: translateY(calc(100% - 76px)); transition: transform .45s var(--ease); }
  .cart.is-open { transform: none; }
  .cart .cart-handle { display: flex !important; }
  .pos-products { padding-bottom: 100px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (max-width: 720px) {
  .g-2, .g-4, .form-grid { grid-template-columns: 1fr; }
  .g-4.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .g-4.kpis .card { padding: 14px; }
  .g-4.kpis .kpi .spark { display: none; }
  .topbar .search { display: none; }
  .page-head { align-items: flex-start; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .card { padding: 16px; }
  /* Tablas como tarjetas */
  table.table.responsive thead { display: none; }
  table.table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .table.responsive td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table.responsive td::before { content: attr(data-label); color: var(--mut); font-size: 12px; font-weight: 600; text-align: left; }
  .table.responsive td.td-main { display: block; text-align: left; padding-bottom: 8px; }
  .table.responsive td.td-main::before { display: none; }
  .modal { padding: 0; align-items: flex-end; }
  .modal-box { border-radius: 22px 22px 0 0; max-height: 92vh; animation: sheet .45s var(--ease); }
  @keyframes sheet { from { transform: translateY(100%); } }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; }
  .stepper .step { min-width: 76px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* =====================================================================
   Impresión
   ===================================================================== */
@media print {
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  .app { display: block; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ddd; }
}

/* ---------- Logos personalizados ---------- */
.brand-logo { height: 36px; width: auto; max-width: 170px; object-fit: contain; flex: none; }
.brand-logo.logo-light { display: none; }
[data-theme="light"] .brand-logo.logo-dark:has(+ .logo-light) { display: none; }
[data-theme="light"] .brand-logo.logo-light { display: block; }
.intro .brand-logo { height: 56px; max-width: 260px; }
.brand-mark { border-radius: calc(var(--r-sm) + 0px); }

/* ---------- Personalizador ---------- */
.swatch-row { display: flex; align-items: center; gap: 10px; }
.swatch-row input[type=color] { width: 46px; height: 42px; padding: 3px; flex: none; cursor: pointer; }
.swatch-row input[type=text] { font-family: ui-monospace, Consolas, monospace; }
.img-field { display: flex; align-items: center; gap: 12px; }
.img-field .prev { width: 84px; height: 56px; border-radius: 12px; border: 1px dashed var(--line-2); display: grid; place-items: center; overflow: hidden; background: repeating-conic-gradient(var(--surface-3) 0 25%, var(--surface-2) 0 50%) 0 0 / 14px 14px; flex: none; }
.img-field .prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { width: 44px; height: 26px; border-radius: 20px; background: var(--surface-3); border: 1px solid var(--line-2); position: relative; transition: background .25s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); transition: transform .35s var(--spring); }
.switch input:checked + i { background: var(--acc); border-color: transparent; }
.switch input:checked + i::after { transform: translateX(18px); background: var(--acc-ink); }
.switch input:focus-visible + i { outline: 2px solid var(--acc); outline-offset: 2px; }
.preview-mini { border-radius: var(--r); border: 1px solid var(--line); overflow: hidden; background: var(--bg); }
.preview-mini .pm-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.preview-mini .pm-body { padding: 16px; display: grid; gap: 12px; }
.demo-box { border: 1px dashed color-mix(in srgb, var(--acc) 45%, var(--line)); background: var(--acc-soft); border-radius: var(--r); padding: 14px; margin-bottom: 18px; }
.demo-box .demo-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.wa-float { position: fixed; right: 20px; bottom: 20px; z-index: 70; width: 58px; height: 58px; border-radius: 50%; background: #1FAF5A; color: #fff; display: grid; place-items: center; box-shadow: 0 14px 30px -8px rgba(31,175,90,.6); animation: pop .6s var(--spring) 2s both; }
.wa-float .ico { width: 28px; height: 28px; }
.wa-float::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid #1FAF5A; animation: wave 2.4s var(--ease) infinite; }
@keyframes wave { from { transform: scale(1); opacity: .8; } to { transform: scale(1.6); opacity: 0; } }
