/* ==========================================================================
   Hanna Hub · Marketing Command Center
   Modo oscuro tipo wallboard: legible a distancia, sin dependencias.
   ========================================================================== */

:root {
    --bg:         #0a0f1d;
    --card:       #141c30;
    --card-2:     #182239;
    --border:     #1f2b48;
    --border-hi:  #2c3c63;

    --text:       #e6ecf7;
    --text-dim:   #8f9bb8;
    --text-faint: #5b6787;

    --cyan:   #38bdf8;
    --green:  #10b981;
    --amber:  #f59e0b;
    --red:    #f43f5e;
    --violet: #a78bfa;

    --radius:   16px;
    --radius-s: 10px;
    --gap:      clamp(12px, 1.2vw, 22px);
    --font:     "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    --fs-hero:  clamp(2.6rem, 4.2vw, 5rem);
    --fs-kpi:   clamp(1.9rem, 2.7vw, 3.3rem);
    --fs-label: clamp(.7rem, .72vw, .85rem);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
    min-height: 100vh;
    background:
        radial-gradient(1200px 600px at 85% -10%, rgba(56, 189, 248, .07), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(16, 185, 129, .05), transparent 60%),
        var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-feature-settings: "tnum" 1, "cv11" 1;
    -webkit-font-smoothing: antialiased;
    line-height: 1.35;
}

svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* --------------------------------------------------------------------------
   Header
   ----------------------------------------------------------------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: var(--gap);
    padding: 14px clamp(16px, 2vw, 32px);
    background: rgba(10, 15, 29, .86);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand__mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--cyan), #2563eb);
    color: #04121f;
    font-weight: 800;
    font-size: 1.4rem;
    box-shadow: 0 0 24px rgba(56, 189, 248, .35);
}
.brand__title { margin: 0; font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; }
.brand__subtitle { margin: 0; color: var(--text-dim); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; }

.topbar__status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card);
    font-size: .85rem;
    color: var(--text-dim);
    white-space: nowrap;
}

.topbar__right { display: flex; align-items: center; gap: clamp(14px, 2vw, 28px); }

.clock { display: flex; flex-direction: column; align-items: flex-end; }
.clock__time { font-size: clamp(1.4rem, 1.9vw, 2.1rem); font-weight: 700; letter-spacing: .02em; }
.clock__date { color: var(--text-dim); font-size: .78rem; }

.refresh { display: flex; align-items: center; gap: 10px; }

.countdown { position: relative; width: 46px; height: 46px; }
.countdown svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.countdown circle { stroke-width: 3; fill: none; }
.countdown__track { stroke: var(--border); }
.countdown__bar {
    stroke: var(--cyan);
    stroke-dasharray: 97.4;  /* 2πr con r = 15.5 */
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}
.countdown__value {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: .85rem;
    font-weight: 700;
}

.btn-refresh {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--border-hi);
    border-radius: 10px;
    background: var(--card);
    color: var(--text);
    font: 600 .9rem var(--font);
    cursor: pointer;
    transition: border-color .2s, background .2s, transform .1s;
}
.btn-refresh:hover { border-color: var(--cyan); background: var(--card-2); }
.btn-refresh:active { transform: scale(.97); }
.btn-refresh svg { width: 18px; height: 18px; }
.btn-refresh.is-loading svg { animation: spin .9s linear infinite; }

/* --------------------------------------------------------------------------
   Grid principal
   ----------------------------------------------------------------------- */
.grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: var(--gap);
    padding: var(--gap) clamp(16px, 2vw, 32px) clamp(16px, 2vw, 32px);
    max-width: 2400px;
    margin: 0 auto;
}

.card--tv        { grid-column: 1 / 8;  grid-row: 1 / 3; }
.card--flow      { grid-column: 8 / 13; grid-row: 1; }
.card--sales     { grid-column: 8 / 13; grid-row: 2; }
.card--marketing { grid-column: 1 / 13; grid-row: 3; }

/* --------------------------------------------------------------------------
   Tarjetas
   ----------------------------------------------------------------------- */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    padding: clamp(16px, 1.4vw, 24px);
    background: linear-gradient(180deg, var(--card-2), var(--card) 40%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
    transition: border-color .4s;
}
.card[data-state="stale"]   { border-color: rgba(245, 158, 11, .45); }
.card[data-state="offline"] { border-color: rgba(244, 63, 94, .5); }

.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card__title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: clamp(.95rem, 1vw, 1.15rem);
    font-weight: 700;
}
.card__title svg { width: 20px; height: 20px; color: var(--cyan); flex: none; }
.card__tools { display: flex; align-items: center; gap: 8px; }
.card__foot { margin-top: auto; color: var(--text-faint); font-size: .75rem; }

.icon-btn {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-hi); }
.icon-btn svg { width: 16px; height: 16px; }

.label {
    color: var(--text-dim);
    font-size: var(--fs-label);
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Badges de estado y pulsos
   ----------------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .03em;
    white-space: nowrap;
    border: 1px solid transparent;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--live    { color: var(--green); background: rgba(16, 185, 129, .12); border-color: rgba(16, 185, 129, .3); }
.badge--live::before { animation: pulse-online 2s infinite; }
.badge--stale   { color: var(--amber); background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .35); }
.badge--mock    { color: var(--violet); background: rgba(167, 139, 250, .12); border-color: rgba(167, 139, 250, .3); }
.badge--offline { color: var(--red); background: rgba(244, 63, 94, .12); border-color: rgba(244, 63, 94, .35); }
.badge--pending { color: var(--text-dim); background: rgba(143, 155, 184, .1); }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot--live     { background: var(--green); animation: pulse-online 2s infinite; }
.dot--degraded { background: var(--amber); animation: pulse-warn 1.6s infinite; }
.dot--offline  { background: var(--red); animation: pulse-alert 1.2s infinite; }
.dot--pending  { background: var(--text-faint); }

@keyframes pulse-online {
    0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, .65); }
    70%  { box-shadow: 0 0 0 9px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
@keyframes pulse-warn {
    0%   { box-shadow: 0 0 0 0 rgba(245, 158, 11, .6); }
    70%  { box-shadow: 0 0 0 9px rgba(245, 158, 11, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}
@keyframes pulse-alert {
    0%   { box-shadow: 0 0 0 0 rgba(244, 63, 94, .7); }
    70%  { box-shadow: 0 0 0 10px rgba(244, 63, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   KPIs
   ----------------------------------------------------------------------- */
.kpis { display: grid; gap: 12px; }
.kpis--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.kpi {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 14px 16px;
    background: rgba(10, 15, 29, .45);
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
}
.kpi__value {
    font-size: var(--fs-kpi);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .4s;
}
.kpi__value--sm { font-size: calc(var(--fs-kpi) * .72); }
.kpi__value--accent { color: var(--cyan); }
.kpi__value.is-warn  { color: var(--amber); }
.kpi__value.is-alert { color: var(--red); }
.kpi__sub { color: var(--text-dim); font-size: .8rem; }

.hero-kpi { display: flex; flex-direction: column; gap: 4px; }
.hero-kpi__value {
    font-size: var(--fs-hero);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.03em;
    background: linear-gradient(90deg, #fff, var(--cyan));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Destello breve cuando un número cambia */
.flash-up   { animation: flash-up 1.2s ease-out; }
.flash-down { animation: flash-down 1.2s ease-out; }
@keyframes flash-up   { 0% { text-shadow: 0 0 18px rgba(16, 185, 129, .9); } 100% { text-shadow: none; } }
@keyframes flash-down { 0% { text-shadow: 0 0 18px rgba(244, 63, 94, .8); } 100% { text-shadow: none; } }

.src { color: var(--text-faint); font-weight: 600; letter-spacing: 0; text-transform: none; }
.src--stale   { color: var(--amber); }
.src--mock    { color: var(--violet); }
.src--offline { color: var(--red); }

/* --------------------------------------------------------------------------
   Módulo A · Hanna TV
   ----------------------------------------------------------------------- */
.tv-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #000;
}
.tv-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tv-frame__live {
    position: absolute;
    top: 12px;
    left: 12px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(0, 0, 0, .6);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .12em;
    pointer-events: none;
}
.tv-frame__live .dot { width: 8px; height: 8px; background: var(--red); animation: pulse-alert 1.6s infinite; }
.tv-frame:fullscreen { border: 0; border-radius: 0; }

.tv-info { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; }
.tv-info__block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 12px 16px;
    background: rgba(10, 15, 29, .45);
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
}
.tv-info__campaign, .tv-info__slide {
    font-size: clamp(1rem, 1.25vw, 1.4rem);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tv-info__campaign { color: var(--cyan); }
.tv-info__screens { font-size: clamp(1.6rem, 2vw, 2.4rem); font-weight: 800; line-height: 1; }
.tv-info__screens small { color: var(--text-dim); font-size: .6em; }

.progress { height: 4px; border-radius: 4px; background: var(--border); overflow: hidden; }
.progress__bar { height: 100%; width: 0; background: var(--cyan); transition: width 1s linear; }

.screens { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.screens li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: .8rem;
    color: var(--text-dim);
}
.screens .dot { width: 8px; height: 8px; }

/* --------------------------------------------------------------------------
   Módulo B · Hanna Flow
   ----------------------------------------------------------------------- */
.sync {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: rgba(10, 15, 29, .45);
}
.sync__text { font-size: clamp(1rem, 1.2vw, 1.3rem); font-weight: 700; }
.sync__latency { margin-left: auto; color: var(--text-dim); font-size: clamp(.9rem, 1vw, 1.1rem); font-weight: 600; }
.sync__latency span { color: var(--text); font-weight: 800; font-size: 1.25em; }
.sync[data-status="online"]   .sync__text { color: var(--green); }
.sync[data-status="degraded"] .sync__text { color: var(--amber); }
.sync[data-status="offline"]  .sync__text { color: var(--red); }

/* --------------------------------------------------------------------------
   Módulo C · Ranking de productos
   ----------------------------------------------------------------------- */
.ranking { display: flex; flex-direction: column; gap: 10px; }
.ranking__list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: rank; }
.ranking__list li {
    position: relative;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    overflow: hidden;
    counter-increment: rank;
    font-size: clamp(.82rem, .85vw, .98rem);
}
.ranking__list li::before { content: counter(rank); color: var(--text-faint); font-weight: 800; }
.ranking__list li:first-child::before { color: var(--amber); }
.ranking__bar {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 0;
    background: linear-gradient(90deg, rgba(56, 189, 248, .16), rgba(56, 189, 248, .04));
    transition: width .9s cubic-bezier(.2, .8, .2, 1);
}
.ranking__name { position: relative; z-index: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranking__qty  { position: relative; z-index: 1; font-weight: 800; }

/* --------------------------------------------------------------------------
   Módulo D · Redes por plataforma
   ----------------------------------------------------------------------- */
.networks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.networks li {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    font-size: .85rem;
}
.networks__head { display: flex; justify-content: space-between; gap: 8px; }
.networks__name { font-weight: 700; }
.networks__value { color: var(--text-dim); }
.networks__track { height: 6px; border-radius: 6px; background: var(--border); overflow: hidden; }
.networks__fill { height: 100%; width: 0; border-radius: 6px; background: var(--cyan); transition: width .9s cubic-bezier(.2, .8, .2, 1); }

.empty { color: var(--text-faint); font-size: .85rem; padding: 6px 0; }

/* --------------------------------------------------------------------------
   Responsive
   ----------------------------------------------------------------------- */
@media (max-width: 1280px) {
    .card--tv        { grid-column: 1 / 13; grid-row: auto; }
    .card--flow      { grid-column: 1 / 7;  grid-row: auto; }
    .card--sales     { grid-column: 7 / 13; grid-row: auto; }
    .card--marketing { grid-column: 1 / 13; grid-row: auto; }
    .kpis--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    .topbar { flex-wrap: wrap; }
    .topbar__status { order: 3; margin-left: 0; width: 100%; justify-content: center; }
    .topbar__right { margin-left: auto; }
    .clock__date { display: none; }
    .btn-refresh span { display: none; }
    .card--flow, .card--sales { grid-column: 1 / 13; }
    .tv-info { grid-template-columns: 1fr 1fr; }
    .tv-info__block--grow { grid-column: 1 / -1; order: -1; }
    .kpis--3, .kpis--5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
    .brand__subtitle { display: none; }
    .kpis--3, .kpis--5 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

[hidden] { display: none !important; }

/* ==========================================================================
   v2 · Tablero por widgets (diseño definido en el panel de control)
   ========================================================================== */
.board {
    --rows: 12;
    --gap: 14px;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
    gap: var(--gap);
    height: calc(100vh - 74px);
    padding: var(--gap) clamp(12px, 1.4vw, 28px) clamp(12px, 1.4vw, 28px);
    max-width: 2560px;
    margin: 0 auto;
}
body.no-header .topbar { display: none; }
body.no-header .board { height: 100vh; }
.board__error { grid-column: 1 / -1; text-align: center; align-self: center; }

.widget {
    --accent: var(--cyan);
    position: relative;
    gap: 10px;
    min-height: 0;
    overflow: hidden;
    padding: clamp(12px, 1vw, 18px);
    container-type: inline-size;
}
.widget .card__title svg { color: var(--accent); }
.widget__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: none; }
.widget__head .card__title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.widget__body { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; overflow: hidden; }
.badge--float { position: absolute; top: 10px; right: 10px; z-index: 2; backdrop-filter: blur(6px); }
.widget[data-state="stale"]   { border-color: rgba(245, 158, 11, .45); }
.widget[data-state="offline"] { border-color: rgba(244, 63, 94, .5); }

/* KPIs que se adaptan al tamaño del widget */
.kpis--auto { grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 10px; flex: 1; min-height: 0; }
.kpis--auto .kpi { justify-content: center; gap: 2px; padding: 6px 12px; container-type: size; min-height: 0; overflow: hidden; }
.kpis--auto .kpi .label { font-size: clamp(.6rem, min(7cqi, 18cqh), .8rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpis--auto .kpi__value { font-size: clamp(.9rem, min(18cqi, 45cqh), 4.2rem); }
.kpis--auto .kpi--hero { grid-column: 1 / -1; background: transparent; border: 0; padding: 0 2px; }
.kpis--auto .kpi--hero .kpi__value {
    font-size: clamp(1.1rem, min(10cqi, 62cqh), 5rem);
    background: linear-gradient(90deg, #fff, var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.kpi__value--accent { color: var(--accent); }

/* TV como franja */
.widget--tv { padding: 8px; }
.widget--tv .tv-frame { flex: 1; aspect-ratio: auto; min-height: 0; }
.tv-frame__full { position: absolute; right: 10px; bottom: 10px; z-index: 2; background: rgba(10, 15, 29, .7); }
.tv-strip-info { flex: none; color: var(--text-dim); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.widget--embed .tv-frame { flex: 1; aspect-ratio: auto; }

/* Pendientes por persona */
.team { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 12px; flex: 1; min-height: 0; }
.person {
    display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0;
    padding: 12px; background: rgba(10, 15, 29, .45); border: 1px solid var(--border); border-radius: var(--radius-s);
}
.person__head { display: flex; flex-direction: column; gap: 8px; }
.person__who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person__avatar {
    display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); font-weight: 800; font-size: .85rem;
}
.person__name { font-size: clamp(1rem, 1.1vw, 1.3rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; background: rgba(143, 155, 184, .14); color: var(--text-dim); }
.chip--alert { background: rgba(244, 63, 94, .15); color: var(--red); }
.chip--warn { background: rgba(245, 158, 11, .15); color: var(--amber); }
.person__more { margin: 0; color: var(--text-faint); font-size: .78rem; }

.tasks { display: flex; flex-direction: column; gap: 7px; margin: 0; padding: 0; list-style: none; min-height: 0; overflow: hidden; }
.task {
    display: flex; flex-direction: column; gap: 4px; padding: 8px 10px 8px 12px; border-radius: 8px;
    background: rgba(255, 255, 255, .025); border-left: 3px solid var(--text-faint);
}
.task--urgent { border-left-color: var(--red); }
.task--high   { border-left-color: var(--amber); }
.task--medium { border-left-color: var(--cyan); }
.task__title {
    font-size: clamp(.85rem, .9vw, 1.05rem); font-weight: 600; line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.task__meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .74rem; color: var(--text-dim); }
.task__project { display: inline-flex; align-items: center; gap: 5px; }
.task__project::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--text-faint)); }
.task__due.is-overdue { color: var(--red); font-weight: 700; }
.task__due.is-today { color: var(--amber); font-weight: 700; }
.task__flag { color: var(--violet); font-weight: 600; }
.task__flag--progress { color: var(--green); }
.empty--ok { color: var(--green); }

/* Reloj, texto e imagen */
.clock-widget { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%; text-align: center; }
.clock-widget__time { font-size: clamp(2rem, 20cqi, 7rem); font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.clock-widget__date { color: var(--text-dim); font-size: clamp(.8rem, 5cqi, 1.4rem); margin-top: 6px; }
.text-widget { overflow: auto; line-height: 1.45; }
.text-widget p { margin: 0 0 .6em; }
.text-widget--s { font-size: .95rem; }
.text-widget--m { font-size: clamp(1rem, 1.3vw, 1.4rem); }
.text-widget--l { font-size: clamp(1.4rem, 2vw, 2.2rem); font-weight: 600; }
.text-widget--xl { font-size: clamp(2rem, 3.2vw, 3.6rem); font-weight: 800; line-height: 1.1; }
.text-widget--center { text-align: center; margin: auto 0; }
.image-widget { width: 100%; height: 100%; border-radius: 10px; }
.image-widget--cover { object-fit: cover; }
.image-widget--contain { object-fit: contain; }
.widget--image { padding: 8px; }

/* Ventas e-commerce: variación, meta, gráfico y listas */
.kpis--auto.kpis--hero { grid-template-rows: minmax(0, 1.7fr); }
.kpis--auto .kpi--hero { justify-content: center; gap: 4px; container-type: size; }
.kpis--auto .kpi--hero .kpi__value { font-size: clamp(1.2rem, min(10cqi, 40cqh), 5rem); }
.kpi__change { font-size: clamp(.62rem, min(5cqi, 14cqh), .85rem); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi__change.is-up { color: var(--green); }
.kpi__change.is-down { color: var(--red); }
.goal { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; min-width: 0; }
.goal__track { position: relative; height: clamp(6px, 6cqh, 12px); border-radius: 99px; background: var(--border); overflow: visible; }
.goal__fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--green), #34d399); transition: width 1s cubic-bezier(.2, .8, .2, 1); }
.goal--behind .goal__fill { background: linear-gradient(90deg, var(--amber), #fbbf24); }
.goal__marker { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text); opacity: .55; border-radius: 2px; }
.goal__text { color: var(--text-dim); font-size: clamp(.62rem, min(4.5cqi, 12cqh), .82rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal--empty .goal__text { color: var(--text-faint); white-space: normal; }

.goal-widget { display: flex; flex-direction: column; justify-content: center; gap: 8px; height: 100%; }
.goal-widget__pct { font-size: clamp(2.2rem, 18cqi, 6rem); font-weight: 800; line-height: 1; letter-spacing: -.03em; color: var(--accent); }
.goal-widget__pct.is-done { color: var(--green); }
.goal-widget__amounts { font-size: clamp(.9rem, 5cqi, 1.4rem); font-weight: 700; }
.goal-widget .goal__track { height: 12px; }
.goal-widget .goal__text { font-size: .8rem; }
.goal-widget__facts { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; color: var(--text-dim); font-size: clamp(.78rem, 3.4cqi, .95rem); }

.bars { flex: 1; min-height: 0; display: flex; align-items: flex-end; gap: 3px; padding-top: 6px; }
.bars__bar { flex: 1; min-width: 2px; border-radius: 3px 3px 0 0; background: color-mix(in srgb, var(--accent) 45%, transparent); transition: height .9s cubic-bezier(.2, .8, .2, 1); }
.bars__bar.is-best { background: color-mix(in srgb, var(--accent) 80%, transparent); }
.bars__bar.is-current { background: var(--green); }
.bars__axis { display: flex; justify-content: space-between; gap: 8px; color: var(--text-faint); font-size: .74rem; flex: none; }
.bars__best { color: var(--text-dim); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ranking__list--sub li { padding: 6px 12px; }
.ranking__sub { display: block; color: var(--text-faint); font-size: .74em; font-weight: 500; }
.ranking__list li.empty, .cat-list li.empty { display: block; padding: 6px 0; }
.ranking__list li.empty::before { content: none; }

.cat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; min-height: 0; overflow: hidden; }
.cat-item { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 7px 10px; border-radius: 8px; background: rgba(255, 255, 255, .025); font-size: clamp(.8rem, .85vw, .95rem); }
.cat-item__name { flex: 1 1 150px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-item__price { white-space: nowrap; font-weight: 700; }
.cat-item__price s { color: var(--text-faint); font-weight: 500; font-size: .85em; }
.review { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 8px; background: rgba(255, 255, 255, .025); }
.review__stars { color: var(--amber); letter-spacing: 2px; font-size: .95rem; }
.review__text { margin: 0; font-size: clamp(.85rem, .95vw, 1.05rem); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.review__meta { color: var(--text-faint); font-size: .75rem; }

@container (max-width: 330px) { .kpis--auto.kpis--stack { grid-template-columns: 1fr; } }
.order { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.order__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.order__total { font-size: clamp(1.6rem, 12cqi, 3.2rem); font-weight: 800; letter-spacing: -.02em; color: var(--accent); }
.order__when { color: var(--green); font-weight: 700; font-size: .85rem; white-space: nowrap; }
.order__where { color: var(--text-dim); font-size: .9rem; }
.order__items { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: .85rem; overflow: hidden; }
.order__items li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Pantallas angostas: una columna, cada widget con alto proporcional */
@media (max-width: 900px) {
    .board { display: flex; flex-direction: column; height: auto; }
    .board > .widget { min-height: calc(var(--h, 3) * 64px); }
    .team { grid-template-columns: 1fr; }
    .kpis--auto { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: auto; }
    .kpis--auto .kpi { container-type: inline-size; min-height: 84px; }
    .kpis--auto .kpi__value { font-size: clamp(1.3rem, 16cqi, 2.4rem); }
    .kpis--auto .kpi--hero .kpi__value { font-size: clamp(1.8rem, 12cqi, 3rem); }
}
