/* QR Analytics · hoja de estilos única
   Tokens claro/oscuro. Orden: tokens, base, shell, componentes, vistas, diálogos, responsive. */

:root {
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #f7f8fb; --surface-3: #eef1f6; --line: #dfe3ec; --line-strong: #c9cfdc;
  --card-line: transparent; --ink: #131a2c; --muted: #566075; --faint: #667085;
  --brand: #12b886; --brand-strong: #0d9f74; --brand-ink: #0a6249; --brand-soft: #dff7ee; --on-brand: #04271c;
  --violet: #6f5de6; --violet-soft: #ece9ff; --violet-ink: #4b3bc4;
  --amber: #f5a524; --amber-soft: #fff1d0; --amber-ink: #7a4a00;
  --rose: #e5484d; --rose-soft: #ffe7e9; --rose-ink: #b02335;
  --chart: #0d9f74; --chart-2: #6f5de6; --grid: #e6e9f0;
  --side: #10172a; --side-ink: #b4bdd0; --side-active: rgba(45, 212, 160, .16);
  --shadow: 0 1px 2px rgba(16, 23, 42, .05), 0 8px 24px rgba(16, 23, 42, .06);
  --shadow-lg: 0 24px 70px rgba(10, 16, 32, .35);
  --r: 14px; --r-sm: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f1e; --surface: #121a2f; --surface-2: #17203a; --surface-3: #1d2745; --line: #263150; --line-strong: #34426a;
    --ink: #eef1f8; --muted: #a8b3cb; --faint: #8e9bb5; --card-line: #263150;
    --brand: #2dd4a0; --brand-strong: #2dd4a0; --brand-ink: #86f2d0; --brand-soft: #0f3a30; --on-brand: #04271c;
    --violet: #a094ff; --violet-soft: #28234f; --violet-ink: #c3baff;
    --amber: #f7b84a; --amber-soft: #3a2d10; --amber-ink: #ffcf7a;
    --rose: #ff7a85; --rose-soft: #40192a; --rose-ink: #ff9aa3;
    --chart: #2dd4a0; --chart-2: #a094ff; --grid: #222c49;
    --side: #080d1a; --side-ink: #aeb9d0; --side-active: rgba(45, 212, 160, .16);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0f1e; --surface: #121a2f; --surface-2: #17203a; --surface-3: #1d2745; --line: #263150; --line-strong: #34426a;
  --ink: #eef1f8; --muted: #a8b3cb; --faint: #8e9bb5; --card-line: #263150;
  --brand: #2dd4a0; --brand-strong: #2dd4a0; --brand-ink: #86f2d0; --brand-soft: #0f3a30; --on-brand: #04271c;
  --violet: #a094ff; --violet-soft: #28234f; --violet-ink: #c3baff;
  --amber: #f7b84a; --amber-soft: #3a2d10; --amber-ink: #ffcf7a;
  --rose: #ff7a85; --rose-soft: #40192a; --rose-ink: #ff9aa3;
  --chart: #2dd4a0; --chart-2: #a094ff; --grid: #222c49;
  --side: #080d1a; --side-ink: #aeb9d0; --side-active: rgba(45, 212, 160, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

/* base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; text-wrap: balance; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow { font: 600 11px/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin: 0 0 8px; }
.muted { color: var(--muted); }
.accent { color: var(--brand-ink); }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* botones */
.btn, .new-button, .period-button, .create-wide, .asset-insights, .inventory-add, .inventory-actions button, .download-row button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; font-size: 14px;
  text-decoration: none; transition: border-color .15s, background .15s, transform .05s;
}
.btn:hover, .period-button:hover, .asset-insights:hover, .inventory-actions button:hover { border-color: var(--brand-strong); }
.btn:active, .new-button:active, .create-wide:active { transform: translateY(1px); }
.new-button, .create-wide, .inventory-add, .download-row button { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.new-button:hover, .create-wide:hover, .inventory-add:hover, .download-row button:hover { filter: brightness(1.06); }
.create-wide { width: 100%; }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--muted); padding: 0; }
.icon-button:hover { color: var(--ink); border-color: var(--brand-strong); }
.seg { display: inline-flex; background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button { min-height: 34px; min-width: 40px; padding: 4px 12px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(16, 23, 42, .18); }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); }
.tag.paused { background: var(--amber-soft); color: var(--amber-ink); }
.tag.archived { background: var(--surface-3); color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 9px; background: var(--surface-3); color: var(--muted); }
.delta.up { background: var(--brand-soft); color: var(--brand-ink); }
.delta.down { background: var(--rose-soft); color: var(--rose-ink); }

/* shell */
.app-shell { min-height: 100vh; display: flex; }
.sidebar { position: sticky; top: 0; height: 100vh; width: 244px; flex: none; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; gap: 4px; padding: 18px 14px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; font-size: 17px; letter-spacing: -.03em; padding: 4px 8px 16px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, #2dd4a0, #12b886); color: #04271c; font: 800 14px var(--mono); flex: none; }
.ws-wrap { position: relative; margin-bottom: 12px; }
.workspace { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); color: #fff; border-radius: 12px; padding: 9px 10px; min-height: 48px; }
.workspace:hover { background: rgba(255, 255, 255, .1); }
.ws-avatar { width: 30px; height: 30px; border-radius: 9px; background: #6f5de6; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff; flex: none; }
.ws-text { min-width: 0; flex: 1; display: grid; }
.ws-text strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-text small { color: var(--side-ink); font-size: 12px; }
.menu { position: absolute; z-index: 40; left: 0; right: 0; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: grid; gap: 2px; }
.ws-wrap .menu { top: calc(100% + 6px); }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; min-height: 42px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; font-weight: 600; font-size: 14px; }
.menu button:hover { background: var(--surface-3); }
.menu button[aria-checked="true"] { color: var(--brand-ink); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.sidebar nav { display: grid; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 10px; color: var(--side-ink); text-decoration: none; font-weight: 600; font-size: 14px; border: 0; background: none; width: 100%; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 #2dd4a0; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 10px; position: relative; }
.profile { width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: 0; color: #fff; text-align: left; padding: 8px; border-radius: 10px; min-height: 48px; }
.profile:hover { background: rgba(255, 255, 255, .07); }
.profile > .avatar { width: 32px; height: 32px; border-radius: 50%; background: #f59e6c; color: #4a2412; display: grid; place-items: center; font-weight: 800; font-size: 11px; flex: none; }
.profile .who { min-width: 0; display: grid; flex: 1; }
.profile .who strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile .who small { color: var(--side-ink); font-size: 12px; }
.sidebar-bottom .menu { bottom: calc(100% + 6px); }
main { flex: 1; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 32px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top-brand { display: none; }
.crumb { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; min-width: 0; }
.crumb strong { color: var(--ink); }
.crumb b { color: var(--faint); font-weight: 400; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.theme-switch .i { width: 16px; height: 16px; }

/* vistas */
.view { display: none; }
.view.active { display: block; }
.dashboard, .codes-view, .data-view { max-width: 1320px; margin: 0 auto; padding: 28px 32px 56px; }
.welcome-row, .codes-header, .data-view-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.welcome-row h1, .codes-header h1, .data-view-header h1 { font-size: clamp(24px, 4vw, 32px); margin-bottom: 4px; }
.welcome-row h1 span { color: var(--amber); }
.welcome-row p, .codes-header p, .data-view-header p { color: var(--muted); font-size: 14px; max-width: 62ch; }
.codes-header > div:last-child { display: flex; gap: 8px; flex-wrap: wrap; }
.panel, .metric, .data-card, .campaign-card, .asset-panel, .folder-panel, .inventory-tree, .inventory-detail, .onboarding-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.panel { padding: 20px; min-width: 0; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.panel-heading h2, .data-card h2 { font-size: 16px; margin-bottom: 2px; }
.panel-heading p { color: var(--muted); font-size: 13px; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.metric { padding: 16px 18px; min-width: 0; }
.metric-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; font-weight: 600; }
.metric-top i { font-style: normal; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; }
.metric-top .mint { background: var(--brand-soft); color: var(--brand-ink); }
.metric-top .violet { background: var(--violet-soft); color: var(--violet-ink); }
.metric-top .orange { background: var(--amber-soft); color: var(--amber-ink); }
.metric-top .pink { background: var(--rose-soft); color: var(--rose-ink); }
.metric > strong { display: block; font-size: 30px; letter-spacing: -.03em; margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.metric p { color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.main-grid, .bottom-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }
.empty-dashboard, .empty-inline, .asset-empty, .inventory-empty { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 28px 16px; color: var(--muted); }
.empty-dashboard > span, .empty-inline > span, .asset-empty > div, .inventory-empty > span { width: 48px; height: 48px; border-radius: 14px; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-size: 22px; }
.empty-dashboard strong, .asset-empty h3, .inventory-empty strong { color: var(--ink); font-size: 16px; }
.empty-inline { padding: 18px 8px; }
.empty-inline p { max-width: 36ch; font-size: 14px; }
.asset-empty { display: none; }

/* gráficos */
.line-chart-wrap { width: 100%; }
.line-chart svg { width: 100%; height: 220px; display: block; overflow: visible; }
.chart-grid-line { stroke: var(--grid); stroke-width: 1; }
.chart-area { fill: color-mix(in srgb, var(--chart) 18%, transparent); }
.chart-line { fill: none; stroke: var(--chart); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart-prev { fill: none; stroke: var(--faint); stroke-width: 2; stroke-dasharray: 5 5; vector-effect: non-scaling-stroke; }
.chart-point { fill: var(--surface); stroke: var(--chart); stroke-width: 3; }
.chart-labels { display: flex; justify-content: space-between; color: var(--faint); font-size: 12px; padding-top: 6px; }
.chart-key { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-top: 8px; }
.chart-key i { display: inline-block; width: 14px; border-top: 3px solid var(--chart); margin-right: 6px; vertical-align: middle; }
.chart-key i.prev { border-top: 2px dashed var(--faint); }
.column-chart { display: flex; align-items: flex-end; gap: 4px; height: 190px; overflow-x: auto; padding-bottom: 2px; }
.column-item { flex: 1 0 16px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.column-item i { width: 100%; max-width: 28px; background: var(--chart); border-radius: 6px 6px 2px 2px; min-height: 6px; }
.column-item b { font-size: 11px; color: var(--muted); }
.column-item small { font-size: 11px; color: var(--faint); }
.heatmap { display: grid; grid-template-columns: 30px repeat(24, minmax(0, 1fr)); gap: 3px; align-items: center; font-size: 11px; color: var(--faint); }
.heatmap span { text-align: right; padding-right: 4px; }
.heatmap i { aspect-ratio: 1; border-radius: 4px; background: var(--chart); min-width: 0; }
.heatmap .hour { text-align: center; padding: 0; font-size: 10px; }
.heat-legend { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--faint); margin-top: 10px; }
.heat-legend i { width: 16px; height: 10px; border-radius: 3px; background: var(--chart); }

/* listas */
.code-list, .live-list, .geo-list, .location-bars, .analytics-devices { display: grid; gap: 2px; }
.code-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 6px; border-top: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.code-row:first-child { border-top: 0; }
.code-row:hover { background: var(--surface-2); }
.code-visual { width: 40px; height: 40px; border-radius: 10px; background: var(--violet-soft); color: var(--violet-ink); display: grid; place-items: center; font-size: 18px; }
.code-row strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-row small { color: var(--faint); font-size: 12px; }
.code-row > b { text-align: right; font-size: 15px; font-variant-numeric: tabular-nums; }
.code-row > b small { display: block; font-weight: 500; }
.location-bars > div, .geo-row, .analytics-device { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: 14px; font-weight: 600; padding: 6px 0; }
.location-bars b, .geo-row b, .analytics-device b { font-variant-numeric: tabular-nums; }
.location-bars i, .geo-row i, .analytics-device i { grid-column: 1 / -1; height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; display: block; }
.geo-row, .analytics-device { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto; align-items: center; }
.geo-row i, .analytics-device i { grid-column: auto; }
.location-bars em, .geo-row em, .analytics-device em { display: block; height: 100%; background: var(--chart-2); border-radius: 99px; }
.privacy-note { color: var(--faint); font-size: 12px; margin-top: 12px; }
.live-event { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.live-event:first-child { border-top: 0; }
.live-event span { min-width: 0; overflow-wrap: anywhere; }
.live-event small { color: var(--faint); font-size: 12px; text-align: right; flex: none; }

/* onboarding */
.onboarding-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 20px; padding: 20px; margin-bottom: 12px; }
.onboarding-panel.is-complete { display: none; }
.onboarding-badge { display: inline-block; font: 700 11px var(--mono); letter-spacing: .1em; color: var(--brand-ink); background: var(--brand-soft); padding: 3px 10px; border-radius: 99px; margin-bottom: 10px; }
.onboarding-intro h2 { font-size: 20px; margin-bottom: 4px; }
.onboarding-intro p { color: var(--muted); font-size: 14px; }
.onboarding-progress { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin: 14px 0 6px; }
.onboarding-progress i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 99px; transition: width .3s; }
.onboarding-intro small { color: var(--muted); font-size: 12px; }
.onboarding-steps { display: grid; gap: 8px; }
.onboarding-step { display: flex; align-items: center; gap: 12px; text-align: left; min-height: 56px; padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.onboarding-step:hover:not(.disabled) { border-color: var(--brand-strong); }
.onboarding-step b { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: 13px; flex: none; }
.onboarding-step.done b { background: var(--brand); color: var(--on-brand); }
.onboarding-step span { display: grid; flex: 1; min-width: 0; }
.onboarding-step small { color: var(--muted); font-size: 13px; }
.onboarding-step em { font-style: normal; color: var(--faint); }
.onboarding-step.disabled { opacity: .6; cursor: not-allowed; }

/* códigos */
.asset-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 12px; align-items: start; }
.folder-panel { padding: 12px; display: grid; gap: 2px; }
.folder-panel h2 { font-size: 12px; font: 700 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 6px 8px; }
.folder-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 6px 10px; border: 0; border-radius: 10px; background: none; text-align: left; font-weight: 600; font-size: 14px; color: var(--muted); }
.folder-item:hover { background: var(--surface-3); color: var(--ink); }
.folder-item.active { background: var(--brand-soft); color: var(--brand-ink); }
.folder-item b { margin-left: auto; font-size: 12px; background: var(--surface-3); color: var(--muted); padding: 1px 8px; border-radius: 99px; }
.folder-item.active b { background: var(--surface); }
.asset-panel { padding: 18px; min-width: 0; }
.asset-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.asset-toolbar h2 { font-size: 18px; }
.asset-toolbar p { color: var(--muted); font-size: 13px; }
.search { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--faint); min-width: min(100%, 240px); }
.search input { border: 0; background: none; outline: none; width: 100%; color: var(--ink); min-width: 0; }
.search:focus-within { border-color: var(--brand-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent); }
.qr-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.asset-card { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); cursor: pointer; min-width: 0; align-content: start; }
.asset-card:hover { border-color: var(--brand-strong); }
.asset-card img { width: 100%; max-width: 190px; aspect-ratio: 1; margin: 0 auto; background: #fff; border-radius: 12px; padding: 6px; border: 1px solid var(--line); }
.asset-card h3 { font-size: 15px; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.asset-card h3 span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-card > p { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); }
.asset-card-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.asset-insights { width: 100%; font-size: 13px; }
.download-row { display: grid; grid-template-columns: 84px 1fr; gap: 8px; }
.download-row select { min-height: 40px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); padding: 0 8px; }
.link-row { display: flex; gap: 6px; }
.no-results { padding: 24px 8px; text-align: center; }
.campaign-card:focus-visible, .code-row:focus-visible { outline-offset: 2px; }
label .hint { font-weight: 500; }
.link-row .btn { flex: 1; min-height: 36px; font-size: 13px; padding: 4px 8px; }

/* analítica / campañas */
.analytics-grid, .campaign-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.data-card { padding: 18px; min-width: 0; }
.data-card.wide { grid-column: span 2; }
.data-card > strong { display: block; font-size: 30px; letter-spacing: -.03em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.data-card > p { color: var(--muted); font-size: 13px; }
.data-card h2 { margin-bottom: 8px; }
.analytics-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.campaign-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.campaign-card { padding: 18px; cursor: pointer; text-align: left; }
.campaign-card:hover { border-color: var(--brand-strong); }
.campaign-card h2 { font-size: 16px; margin-bottom: 4px; }
.campaign-card p { color: var(--muted); font-size: 14px; }

/* inventario */
.inventory-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 12px; align-items: start; }
.inventory-tree { padding: 12px; display: grid; gap: 2px; }
.inventory-tree-title { display: grid; padding: 6px 8px 10px; }
.inventory-tree-title span { font-weight: 700; }
.inventory-tree-title small { color: var(--faint); font-size: 12px; }
.inventory-node { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; border: 0; background: none; border-radius: 10px; text-align: left; padding-right: 8px; color: var(--muted); font-weight: 600; font-size: 14px; }
.inventory-node:hover { background: var(--surface-3); color: var(--ink); }
.inventory-node.active { background: var(--brand-soft); color: var(--brand-ink); }
.inventory-node i { font-style: normal; width: 20px; text-align: center; }
.inventory-node span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inventory-node small { color: var(--faint); }
.inventory-detail { padding: 20px; min-height: 360px; min-width: 0; }
.inventory-detail-header { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.inventory-detail-header h2 { font-size: 22px; }
.inventory-detail-header p:not(.eyebrow) { color: var(--muted); font-size: 14px; }
.inventory-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.inventory-children { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.inventory-child { min-height: 40px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface-2); font-weight: 600; font-size: 14px; }
.inventory-child:hover { border-color: var(--brand-strong); }
.inventory-items-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.inventory-items-title h3 { font-size: 16px; }
.inventory-items { display: grid; gap: 8px; }
.inventory-item { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.inventory-item img, .inventory-item-photo { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--surface-3); display: grid; place-items: center; color: var(--faint); }
.inventory-item p { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.inventory-item b { font-variant-numeric: tabular-nums; }
.inventory-form { display: grid; gap: 12px; margin-top: 16px; padding: 16px; border: 1px dashed var(--line-strong); border-radius: var(--r); }
.inventory-form p { color: var(--muted); font-size: 13px; }
.inventory-fields { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
.inventory-photo-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.inventory-photo-preview { display: none; width: 72px; height: 72px; object-fit: cover; border-radius: 10px; }
.inventory-photo-note { color: var(--muted); font-size: 13px; }

/* formularios y diálogos */
label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
input:not([type="checkbox"]):not([type="color"]):not([type="file"]), select, textarea { width: 100%; min-height: 44px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink); padding: 8px 12px; font-weight: 500; }
input:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand-strong); }
::placeholder { color: var(--faint); opacity: 1; }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--brand-strong); }
.utm-option, .check-row { display: flex; align-items: center; gap: 10px; font-weight: 600; }
dialog { border: 0; padding: 0; background: transparent; color: var(--ink); width: min(480px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: visible; }
dialog::backdrop { background: rgba(8, 13, 26, .6); backdrop-filter: blur(3px); }
.modal-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 26px; box-shadow: var(--shadow-lg); display: grid; gap: 14px; max-height: calc(100dvh - 24px); overflow-y: auto; }
.modal-card h2 { font-size: 24px; }
.modal-copy { color: var(--muted); font-size: 14px; }
.close { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border: 0; border-radius: 10px; background: none; color: var(--muted); font-size: 26px; line-height: 1; }
.close:hover { background: var(--surface-3); color: var(--ink); }
.colour-label { display: flex; align-items: center; gap: 10px; }
.colour-label span { font: 12px var(--mono); color: var(--muted); }
.colour-label input[type="color"] { margin-left: auto; width: 48px; height: 36px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }
.modal-preview { display: flex; align-items: center; gap: 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.modal-preview svg { width: 96px; height: 96px; background: #fff; border-radius: 10px; padding: 6px; flex: none; }
.modal-preview p { font-size: 13px; color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.modal-preview strong { color: var(--ink); font-family: var(--mono); font-size: 12px; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.modal-actions .create-wide { width: auto; flex: 1; }
.form-error { color: var(--rose-ink); font-size: 13px; min-height: 18px; }
.analytics-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.analytics-summary div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 2px; }
.analytics-summary span { font: 600 11px var(--mono); letter-spacing: .08em; color: var(--faint); }
.analytics-summary strong { font-size: 20px; }
.analytics-section h3 { font-size: 14px; margin-bottom: 8px; }
.analytics-bars { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
.analytics-bar { flex: 1; background: var(--chart); border-radius: 4px 4px 1px 1px; min-width: 3px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 140%); max-width: min(92vw, 460px); background: var(--ink); color: var(--bg); border-radius: 12px; padding: 12px 16px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; transition: transform .25s, opacity .25s; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* tab bar móvil */
.tabbar { display: none; }

/* login / setup */
.auth-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px var(--gutter); background: radial-gradient(900px 500px at 15% -10%, color-mix(in srgb, var(--brand) 18%, transparent), transparent), var(--bg); }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: var(--shadow-lg); display: grid; gap: 14px; }
.auth-card .brand { color: var(--ink); padding: 0 0 6px; }
.auth-card h1 { font-size: 28px; }
.auth-card p { color: var(--muted); font-size: 14px; }
.auth-theme { position: fixed; top: 12px; right: max(12px, env(safe-area-inset-right, 0px)); }

/* responsive */
@media (max-width: 1100px) {
  .metrics-grid, .analytics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-grid, .bottom-grid, .onboarding-panel { grid-template-columns: 1fr; }
  .sidebar { width: 76px; padding: 14px 10px; align-items: center; }
  .sidebar .brand span:last-child, .nav-item .label, .ws-text, .profile .who, .workspace > svg { display: none; }
  .brand { padding: 4px 0 14px; }
  .nav-item { justify-content: center; padding: 0; width: 46px; }
  .workspace, .profile { justify-content: center; padding: 8px; width: 48px; }
  .ws-wrap .menu, .sidebar-bottom .menu { left: 0; right: auto; min-width: 220px; }
  .dashboard, .codes-view, .data-view { padding: 24px 24px 48px; }
  .topbar { padding: 10px 24px; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .tabbar { display: flex; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); justify-content: space-around; }
  .tabbar .nav-item { flex-direction: column; gap: 2px; min-height: 52px; width: auto; flex: 1; padding: 6px 4px; border-radius: 12px; font-size: 11px; color: var(--faint); box-shadow: none; }
  .tabbar .nav-item:hover { background: var(--surface-3); color: var(--ink); }
  .tabbar .nav-item.active { background: var(--brand-soft); color: var(--brand-ink); box-shadow: none; }
  .tabbar .nav-item .label { display: inline; }
  main { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding: 8px var(--gutter); min-height: 56px; gap: 8px; padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .top-brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 800; }
  .crumb { display: none; }
  .top-actions .new-button span { display: none; }
  .dashboard, .codes-view, .data-view { padding: 18px max(16px, env(safe-area-inset-right, 0px)) 32px var(--gutter); }
  .welcome-row, .codes-header, .data-view-header { align-items: flex-start; }
  .metrics-grid { gap: 8px; }
  .metric { padding: 14px; }
  .metric > strong { font-size: 24px; }
  .asset-layout, .inventory-layout { grid-template-columns: 1fr; }
  .folder-panel { display: flex; overflow-x: auto; gap: 6px; padding: 8px; }
  .folder-panel h2 { display: none; }
  .folder-item { width: auto; flex: none; white-space: nowrap; }
  .folder-panel #folder-list { display: contents; }
  .inventory-tree { max-height: 240px; overflow-y: auto; }
  .analytics-grid { grid-template-columns: 1fr; }
  .data-card.wide { grid-column: auto; }
  .inventory-fields { grid-template-columns: 1fr 1fr; }
  .inventory-fields label:first-child { grid-column: 1 / -1; }
  .heatmap { gap: 2px; font-size: 9px; grid-template-columns: 22px repeat(24, minmax(0, 1fr)); }
  .heatmap .hour:nth-child(even) { visibility: hidden; }
  dialog { width: 100%; max-width: 100%; margin: auto 0 0; max-height: 92dvh; }
  .modal-card { border-radius: 20px 20px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom, 0px)); max-height: 92dvh; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 420px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .metric-top span { font-size: 12px; }
  .qr-card-grid { grid-template-columns: 1fr; }
  .code-row { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 8px; }
  .analytics-summary { grid-template-columns: 1fr; }
  .geo-row, .analytics-device { grid-template-columns: minmax(0, 1fr) auto; }
  .geo-row i, .analytics-device i { grid-column: 1 / -1; }
  .theme-switch button { min-width: 34px; padding: 4px 8px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media print { .sidebar, .tabbar, .topbar { display: none; } }

/* ===== v11: estilo más "app", avatar, ajustes y menú lateral móvil ===== */
.panel, .metric, .data-card, .campaign-card, .asset-panel, .folder-panel, .inventory-tree, .inventory-detail, .onboarding-panel, .asset-card, .member, .inventory-item { border-color: var(--card-line); }
.panel, .metric, .data-card, .campaign-card, .asset-panel, .folder-panel, .inventory-tree, .inventory-detail, .onboarding-panel { box-shadow: var(--shadow); }
.asset-card { background: var(--surface-2); }
.hint { color: var(--muted); font-size: 13px; font-weight: 500; }
.grow { flex: 1; min-width: 0; }
.hello { font-weight: 700; color: var(--brand-ink); font-size: 14px; margin-bottom: 2px; }
.no-scroll { overflow: hidden; }

/* avatar */
.avatar-img { border-radius: 50%; object-fit: cover; display: block; background: var(--surface-3); }
.avatar-initials { border-radius: 50%; display: grid; place-items: center; background: #f59e6c; color: #4a2412; font-weight: 800; flex: none; }
.profile > .avatar { background: none; width: 32px; height: 32px; overflow: hidden; display: block; flex: none; }
.hamburger { display: none; width: 44px; height: 44px; flex: none; align-items: center; justify-content: center; border: 0; border-radius: 12px; background: var(--surface-3); color: var(--ink); padding: 0; }
.hamburger:hover { background: var(--line); }
.hamburger .i { width: 22px; height: 22px; }
.top-avatar-unused { display: none; padding: 0; border: 2px solid var(--line); background: none; border-radius: 50%; width: 42px; height: 42px; align-items: center; justify-content: center; }
.top-avatar .avatar { display: grid; place-items: center; }
.top-title { display: none; }
.ws-avatar.sm { width: 28px; height: 28px; font-size: 11px; border-radius: 8px; }
.ws-avatar.plus { background: var(--surface-3); color: var(--ink); font-size: 16px; }

/* ajustes */
.settings-tabs { display: flex; width: max-content; max-width: 100%; overflow-x: auto; margin-bottom: 14px; }
.settings-tabs button { white-space: nowrap; }
.settings-body { display: grid; gap: 12px; max-width: 760px; }
.settings-card { display: grid; gap: 14px; }
.settings-card .panel-heading { margin-bottom: 0; }
.settings-form { display: grid; gap: 14px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.settings-grid > label:last-child:nth-child(odd) { grid-column: 1 / -1; }
.avatar-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.avatar-big { width: 84px; height: 84px; border-radius: 50%; overflow: hidden; flex: none; }
.avatar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.avatar-actions .hint { flex-basis: 100%; }
.btn[disabled], button[disabled] { opacity: .55; cursor: not-allowed; }
.btn.danger-text { color: var(--rose-ink); }
.member-list { display: grid; gap: 8px; }
.member { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--card-line); border-radius: 12px; flex-wrap: wrap; }
.member > div.grow { display: grid; min-width: 0; }
.member strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.member small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.member select { width: auto; min-height: 40px; }
.link-box { display: flex; gap: 8px; }
.link-box input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px; }
.invite-result { display: grid; gap: 8px; padding: 12px; background: var(--brand-soft); border-radius: 12px; }
.auth-switch { color: var(--muted); font-size: 14px; text-align: center; }
.auth-switch a { color: var(--brand-ink); font-weight: 700; }
.auth-card .hint { margin-top: 2px; }

/* menú lateral móvil (off-canvas) */
.drawer-overlay { position: fixed; z-index: 60; inset: 0; background: rgba(8, 13, 26, .55); opacity: 0; transition: opacity .25s; }
.drawer-overlay.open { opacity: 1; }
.drawer { position: fixed; z-index: 70; top: 0; left: 0; bottom: 0; width: min(88vw, 360px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); transform: translateX(-105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; gap: 18px; padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); overflow-y: auto; overscroll-behavior: contain; visibility: hidden; }
.drawer.open { transform: none; visibility: visible; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding-right: 36px; position: relative; }
.drawer-head .close { top: 0; right: -6px; }
.drawer-head .avatar.big { width: 52px; height: 52px; display: block; overflow: hidden; border-radius: 50%; flex: none; }
.drawer-head .who { display: grid; min-width: 0; }
.drawer-head .who strong { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-head .who small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.drawer-section h2 { font: 700 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.drawer-list { display: grid; gap: 2px; }
.drawer-list button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 10px; border: 0; background: none; border-radius: 12px; text-align: left; font-weight: 600; font-size: 15px; }
.drawer-list button:hover { background: var(--surface-3); }
.drawer-list button[aria-checked="true"] { background: var(--brand-soft); color: var(--brand-ink); }
.drawer-list .check { color: var(--brand-ink); font-weight: 800; }
.theme-switch.wide { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
.theme-switch.wide button { min-height: 44px; }
.drawer-logout { margin-top: auto; color: var(--rose-ink); min-height: 48px; }

@media (max-width: 760px) {
  body { background: var(--bg); }
  .topbar { min-height: 60px; background: var(--bg); border-bottom: 0; backdrop-filter: none; padding-block: 8px; }
  .top-title { display: block; font-size: 22px; letter-spacing: -.03em; }
  .top-actions .theme-switch, .top-actions #help-button { display: none; }
  .top-actions .new-button { width: 42px; height: 42px; padding: 0; border-radius: 50%; }
  .hamburger { display: inline-flex; }
  .eyebrow, .welcome-row > div > p:not(.hello), .data-view-header p:not(.eyebrow), .codes-header p:not(.eyebrow), .data-view-header h1, .codes-header h1 { display: none; }
  .welcome-row h1 { font-size: 24px; }
  .welcome-row, .codes-header, .data-view-header { margin-bottom: 14px; gap: 10px; }
  .welcome-row .seg { width: 100%; } .welcome-row .seg button { flex: 1; }
  .data-view-header .seg { width: 100%; } .data-view-header .seg button { flex: 1; }
  .panel, .metric, .data-card, .campaign-card, .asset-panel, .inventory-detail, .onboarding-panel { border-radius: 20px; box-shadow: none; }
  .asset-panel, .folder-panel, .inventory-tree { padding: 12px; }
  .quick-create { display: none; }
  .main-grid { margin-bottom: 12px; }
  .panel { padding: 16px; }
  .line-chart svg { height: 170px; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-tabs { width: 100%; }
  .settings-body { max-width: none; }
  .link-box { flex-direction: column; }
  .member select { flex: 1; }
  .onboarding-panel { padding: 16px; gap: 12px; }
  .onboarding-intro p { display: none; }
}
@media (min-width: 761px) { .drawer, .drawer-overlay { display: none; } }

@media (max-width: 760px) { .top-brand { display: none; } }
