/* =========================================================
   Vido - sistema visual
   Forma: tarjetas 18px, controles internos 12px, botones en píldora.
   Un solo acento (naranja Vido). Colores de estado solo para estados.
   ========================================================= */

:root {
    --bg: #f4f4f5;
    --surface: #ffffff;
    --surface-2: #fafafa;
    --surface-sunken: #ececee;
    --ink: #18181b;
    --ink-2: #3f3f46;
    --muted: #63636b;
    --faint: #a1a1aa;
    --line: rgba(24, 24, 27, 0.08);
    --line-strong: rgba(24, 24, 27, 0.14);

    --accent: #ec641a;
    --accent-strong: #d4540f;
    --accent-ink: #b9480b;
    --accent-soft: #fdf0e7;
    --on-accent: #ffffff;

    --success: #157347; --success-soft: #e6f4ec;
    --warning: #8a5300; --warning-soft: #fdf3dc;
    --danger: #b42318;  --danger-soft: #fdecea;
    --info: #1f5fbf;    --info-soft: #e8f0fc;
    --neutral: #52525b; --neutral-soft: #ededef;

    --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.04);
    --shadow: 0 1px 2px rgba(24, 24, 27, 0.04), 0 8px 24px -12px rgba(24, 24, 27, 0.12);
    --shadow-lg: 0 24px 60px -20px rgba(24, 24, 27, 0.28), 0 2px 6px rgba(24, 24, 27, 0.06);

    --r-card: 18px;
    --r-ctrl: 12px;
    --r-pill: 999px;

    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

    --font: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono: 'Geist Mono', ui-monospace, monospace;

    --sidebar-w: 256px;
    --topbar-h: 60px;
    --tabbar-h: 64px;
    color-scheme: light;
}

/* Oscuro: automático según el sistema, o elegido con el botón (data-theme) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f0f11;
        --surface: #18181b;
        --surface-2: #1d1d21;
        --surface-sunken: #121214;
        --ink: #f4f4f5;
        --ink-2: #d4d4d8;
        --muted: #a1a1aa;
        --faint: #71717a;
        --line: rgba(255, 255, 255, 0.08);
        --line-strong: rgba(255, 255, 255, 0.14);
    
        --accent: #f0722c;
        --accent-strong: #f5853f;
        --accent-ink: #f8a26a;
        --accent-soft: rgba(240, 114, 44, 0.14);
    
        --success: #5fcf95; --success-soft: rgba(95, 207, 149, 0.12);
        --warning: #f3c063; --warning-soft: rgba(243, 192, 99, 0.12);
        --danger: #f7877b;  --danger-soft: rgba(247, 135, 123, 0.12);
        --info: #85b4f7;    --info-soft: rgba(133, 180, 247, 0.12);
        --neutral: #b4b4bb; --neutral-soft: rgba(255, 255, 255, 0.07);
    
        --shadow-sm: none;
        --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
        --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.06);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0f0f11;
    --surface: #18181b;
    --surface-2: #1d1d21;
    --surface-sunken: #121214;
    --ink: #f4f4f5;
    --ink-2: #d4d4d8;
    --muted: #a1a1aa;
    --faint: #71717a;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.14);

    --accent: #f0722c;
    --accent-strong: #f5853f;
    --accent-ink: #f8a26a;
    --accent-soft: rgba(240, 114, 44, 0.14);

    --success: #5fcf95; --success-soft: rgba(95, 207, 149, 0.12);
    --warning: #f3c063; --warning-soft: rgba(243, 192, 99, 0.12);
    --danger: #f7877b;  --danger-soft: rgba(247, 135, 123, 0.12);
    --info: #85b4f7;    --info-soft: rgba(133, 180, 247, 0.12);
    --neutral: #b4b4bb; --neutral-soft: rgba(255, 255, 255, 0.07);

    --shadow-sm: none;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.06);
    color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    overscroll-behavior: none;
}
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: 'ss01', 'cv11';
}
img, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; font-weight: 600; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, [role="button"], summary, label.chip { touch-action: manipulation; }
button, [role="button"], summary, .btn, .tab, .chip, .nav-link { -webkit-user-select: none; user-select: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -48px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: var(--r-pill); z-index: 100; }
.skip-link:focus { top: 12px; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Estructura ---------- */
.shell { min-height: 100dvh; }
.sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--line);
    display: flex; flex-direction: column; gap: 6px;
    padding: 18px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto; overscroll-behavior: contain;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 8px 14px; }
.sidebar-logo img { height: 26px; width: auto; }
.sidebar .sidebar-close { display: none; }
.main-col { margin-left: var(--sidebar-w); min-width: 0; }
.topbar {
    position: sticky; top: 0; z-index: 30;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 10px;
    padding: 0 28px;
    background: var(--bg);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar .menu-btn, .topbar .topbar-logo { display: none; }
.main { padding: 8px 28px 72px; max-width: 1320px; margin: 0 auto; }
.scrim { display: none; }
.tabbar { display: none; }

@media (max-width: 960px) {
    .sidebar {
        transform: translateX(-104%);
        transition: transform 320ms var(--ease-drawer);
        box-shadow: var(--shadow-lg);
        padding-top: calc(18px + env(safe-area-inset-top, 0px));
    }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar .sidebar-close { display: inline-grid; }
    .scrim { display: block; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 35; background: rgba(9, 9, 11, 0.4); opacity: 0; pointer-events: none; transition: opacity 240ms var(--ease-out); }
    .sidebar.is-open + .scrim { opacity: 1; pointer-events: auto; }
    .main-col { margin-left: 0; }
    .topbar { padding: env(safe-area-inset-top, 0px) 12px 0; height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); }
    .topbar .menu-btn { display: inline-grid; }
    .topbar .topbar-logo { display: block; }
    .topbar-logo img { height: 22px; width: auto; }
    .main { padding: 4px 16px calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom, 0px)); }
    .tabbar {
        display: grid; grid-template-columns: repeat(5, 1fr);
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
        background: var(--surface);
        background: color-mix(in srgb, var(--surface) 88%, transparent);
        -webkit-backdrop-filter: saturate(1.4) blur(16px);
        backdrop-filter: saturate(1.4) blur(16px);
        border-top: 1px solid var(--line);
    }
    .tabbar .nav-link { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 4px; justify-content: center; }
    .tabbar .nav-link i { font-size: 22px; }
    .tabbar .nav-link[aria-current="page"] { background: none; color: var(--accent-ink); }
    .tabbar .nav-link[aria-current="page"] i { color: var(--accent); }
}

/* Navegación lateral */
.nav-group { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; }
.nav-group + .nav-group { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; }
.nav-title { font-size: 12px; color: var(--faint); padding: 0 10px 6px; }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: var(--r-ctrl);
    color: var(--ink-2); font-weight: 500;
    transition: background-color 160ms ease, color 160ms ease;
}
.nav-link i { font-size: 19px; color: var(--muted); transition: color 160ms ease; }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); }
.nav-link[aria-current="page"] i { color: var(--accent); }
.nav-link:active { background: var(--surface-sunken); }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 600; display: inline-grid; place-items: center; }
@media (hover: hover) and (pointer: fine) {
    .nav-link:hover { background: var(--surface-2); color: var(--ink); }
    .nav-link[aria-current="page"]:hover { background: var(--accent-soft); color: var(--accent-ink); }
}

.brand-switch { padding: 0 0 4px; }
.brand-current {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px; border-radius: var(--r-ctrl);
    background: var(--surface-2); border: 1px solid var(--line);
    cursor: pointer; list-style: none; font-weight: 600;
}
.brand-current::-webkit-details-marker { display: none; }
.brand-current.is-static { cursor: default; }
.brand-current-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-current i { color: var(--muted); }
.brand-menu { width: 100%; max-height: 320px; overflow-y: auto; }
.brand-menu a { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; font-weight: 500; }
.brand-menu a[aria-current="true"] { background: var(--surface-2); }
.brand-menu-add { color: var(--muted); border-top: 1px solid var(--line); border-radius: 0 0 10px 10px !important; margin-top: 4px; }
.brand-menu-add i { width: 26px; text-align: center; font-size: 17px; }
@media (hover: hover) and (pointer: fine) { .brand-menu a:hover { background: var(--surface-2); } }

.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--r-ctrl); }
.me[aria-current="page"] { background: var(--surface-2); }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.me-text strong { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { color: var(--muted); font-size: 12px; }
@media (hover: hover) and (pointer: fine) { .me:hover { background: var(--surface-2); } }

/* Avatares */
.avatar {
    width: 32px; height: 32px; flex: none; border-radius: 50%;
    display: inline-grid; place-items: center;
    background: var(--surface-sunken); color: var(--ink-2);
    font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
}
.avatar-agency { background: var(--accent-soft); color: var(--accent-ink); }
.brand-avatar {
    width: 30px; height: 30px; flex: none; border-radius: 9px;
    display: inline-grid; place-items: center; overflow: hidden;
    background: var(--brand); font-size: 12px; font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.brand-avatar img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.brand-avatar-sm { width: 26px; height: 26px; border-radius: 8px; font-size: 11px; }
.brand-avatar-lg { width: 52px; height: 52px; border-radius: 14px; font-size: 18px; }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 0 18px;
    border-radius: var(--r-pill); border: 1px solid transparent;
    font-weight: 600; font-size: 14px; white-space: nowrap;
    cursor: pointer; text-decoration: none;
    transition: transform 140ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.btn i { font-size: 17px; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 2px rgba(185, 72, 11, 0.3); }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); box-shadow: var(--shadow-sm); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: 13px; }
.btn-lg { min-height: 48px; padding: 0 24px; font-size: 15px; }
.btn-block { width: 100%; }
@media (hover: hover) and (pointer: fine) {
    .btn-primary:hover { background: var(--accent-strong); }
    .btn-secondary:hover { background: var(--surface-2); border-color: var(--line-strong); }
    .btn-ghost:hover { background: var(--surface-sunken); }
    .btn-danger-ghost:hover { background: var(--danger-soft); }
    .btn-dark:hover { opacity: 0.9; }
}
.icon-btn {
    width: 40px; height: 40px; flex: none;
    display: inline-grid; place-items: center;
    border: 0; border-radius: 50%; background: transparent; color: var(--ink-2);
    font-size: 20px; cursor: pointer; position: relative;
    transition: background-color 160ms ease, transform 140ms var(--ease-out);
}
.icon-btn:active { transform: scale(0.94); background: var(--surface-sunken); }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: var(--surface-sunken); } }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent-ink); font-weight: 500; font-size: 13px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Encabezado de página ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 0 24px; }
.page-head h1 { font-size: 28px; font-weight: 650; letter-spacing: -0.03em; }
.page-head p { color: var(--muted); margin-top: 4px; max-width: 60ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.crumb:hover { color: var(--ink); }
@media (max-width: 640px) {
    .page-head h1 { font-size: 24px; }
    .page-head { margin-bottom: 18px; }
}

/* ---------- Tarjetas ---------- */
.card {
    background: var(--surface);
    border-radius: var(--r-card);
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
}
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.card-head h2 { font-size: 16px; }
.card-body { padding: 16px 22px 22px; }
@media (max-width: 640px) { .card-pad { padding: 18px; } .card-head { padding: 16px 18px 0; } .card-body { padding: 14px 18px 18px; } }
.section-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-lg { display: flex; flex-direction: column; gap: 28px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid-main { display: grid; gap: 20px; }
@media (min-width: 1080px) { .grid-main { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } }

/* ---------- Alertas ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-ctrl); margin-bottom: 16px; font-size: 14px; }
.alert i { font-size: 18px; margin-top: 1px; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }

/* ---------- Estados ---------- */
.status {
    display: inline-flex; align-items: center; gap: 6px;
    height: 24px; padding: 0 10px; border-radius: var(--r-pill);
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-neutral { background: var(--neutral-soft); color: var(--neutral); }
.status-warning { background: var(--warning-soft); color: var(--warning); }
.status-danger { background: var(--danger-soft); color: var(--danger); }
.status-success { background: var(--success-soft); color: var(--success); }
.status-info { background: var(--info-soft); color: var(--info); }
.status-accent { background: var(--accent-soft); color: var(--accent-ink); }
.status-pending { background: var(--info-soft); color: var(--info); }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: var(--r-pill); background: var(--surface-sunken); color: var(--ink-2); font-size: 12px; font-weight: 500; }
.tag i { font-size: 14px; }
.platforms { display: inline-flex; gap: 4px; color: var(--muted); font-size: 16px; }

/* ---------- Formularios ---------- */
.form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field-label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.field-help { font-size: 13px; color: var(--muted); }
.field-error { font-size: 13px; color: var(--danger); }
.fields-2 { display: grid; gap: 18px; }
@media (min-width: 640px) { .fields-2 { grid-template-columns: 1fr 1fr; } }
.input, .select, .textarea {
    width: 100%; min-height: 44px; padding: 10px 14px;
    border-radius: var(--r-ctrl); border: 1px solid var(--line-strong);
    background: var(--surface); color: var(--ink);
    font-size: 16px; line-height: 1.4;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}
.textarea { min-height: 110px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%2371717a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3.5 5.5 3.5 3.5 3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.input-color { display: flex; gap: 8px; align-items: center; }
.input-color input[type="color"] { width: 44px; height: 44px; padding: 3px; border-radius: var(--r-ctrl); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; flex: none; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }

/* Chips seleccionables (plataformas) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
    display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 14px; border-radius: var(--r-pill);
    border: 1px solid var(--line-strong); background: var(--surface);
    font-size: 14px; font-weight: 500; color: var(--ink-2);
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 140ms var(--ease-out);
}
.chip span i { font-size: 17px; }
.chip:active span { transform: scale(0.97); }
.chip input:checked + span { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent-ink); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Zona para soltar archivos */
.dropzone {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    min-height: 140px; padding: 24px; text-align: center;
    border: 1.5px dashed var(--line-strong); border-radius: var(--r-card);
    background: var(--surface-2); color: var(--muted); cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease;
}
.dropzone i { font-size: 30px; color: var(--accent); }
.dropzone strong { color: var(--ink); font-weight: 600; }
.dropzone input[type="file"] { position: absolute; top: 0; right: 0; bottom: 0; left: 0; opacity: 0; cursor: pointer; }
.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.upload-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.upload-item { position: relative; aspect-ratio: 1; border-radius: var(--r-ctrl); overflow: hidden; background: var(--surface-sunken); display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center; padding: 6px; }
.upload-item img, .upload-item video { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.upload-item i { font-size: 26px; }
.upload-item .remove { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(9, 9, 11, 0.65); color: #fff; display: grid; place-items: center; cursor: pointer; font-size: 14px; }
.upload-item.is-removed { opacity: 0.35; }
.upload-item.is-removed .remove { background: var(--danger); }

/* ---------- Autenticación ---------- */

.auth { min-height: 100svh; display: grid; place-items: center; padding: 32px 16px calc(32px + env(safe-area-inset-bottom, 0px)); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 24px; padding: 36px 32px 32px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.auth-logo { display: block; width: max-content; margin: 0 auto 26px; }
.auth-logo img { width: 104px; height: auto; }
.auth h1 { font-size: 22px; text-align: center; margin-bottom: 6px; }
.auth .lead { text-align: center; color: var(--muted); margin-bottom: 24px; font-size: 14px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.auth-foot a { color: var(--accent-ink); font-weight: 500; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 48px; }
.password-wrap button { position: absolute; right: 4px; top: 2px; }
@media (max-width: 480px) { .auth-card { padding: 30px 22px 24px; border-radius: 22px; } }

/* ---------- Notificaciones ---------- */
.notif { position: relative; }
.notif-count {
    position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent);
    font-size: 11px; font-weight: 700; display: grid; place-items: center;
    box-shadow: 0 0 0 2px var(--bg);
}
.notif-panel {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
    width: min(380px, calc(100vw - 24px));
    background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-lg); border: 1px solid var(--line);
    transform-origin: top right;
    transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}
.notif-panel.is-entering { opacity: 0; transform: scale(0.96) translateY(-4px); }
.notif-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px 10px; }
.notif-list { max-height: min(420px, 60dvh); overflow-y: auto; overscroll-behavior: contain; padding: 0 8px; }
.notif-empty { padding: 28px 12px; text-align: center; color: var(--muted); font-size: 14px; }
.notif-all { display: block; text-align: center; padding: 12px; border-top: 1px solid var(--line); font-size: 14px; font-weight: 500; color: var(--accent-ink); }
.notif-item { display: flex; gap: 12px; padding: 12px 10px; border-radius: var(--r-ctrl); position: relative; }
.notif-item + .notif-item { margin-top: 2px; }
.notif-item .n-icon { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-sunken); color: var(--ink-2); font-size: 17px; }
.notif-item.is-unread .n-icon { background: var(--accent-soft); color: var(--accent); }
.notif-item .n-text { min-width: 0; flex: 1; }
.notif-item .n-title { font-size: 14px; font-weight: 500; line-height: 1.35; }
.notif-item.is-unread .n-title { font-weight: 600; }
.notif-item .n-body { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-item .n-meta { font-size: 12px; color: var(--faint); margin-top: 4px; }
.notif-item.is-unread::after { content: ''; position: absolute; right: 12px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
@media (hover: hover) and (pointer: fine) { .notif-item:hover { background: var(--surface-2); } }
@media (max-width: 960px) {
    .notif-panel { position: fixed; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); right: 12px; }
}
.notif-page .notif-item { padding: 14px 16px; }

/* ---------- Dropdown (details) ---------- */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-panel {
    position: absolute; z-index: 45; top: calc(100% + 6px); left: 0;
    min-width: 200px; padding: 6px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
    transform-origin: top left;
    animation: pop 160ms var(--ease-out);
}
.dropdown-panel.align-right { left: auto; right: 0; transform-origin: top right; }
.menu-item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; border: 0; background: none; text-align: left; cursor: pointer; font-size: 14px; color: var(--ink); }
.menu-item i { font-size: 17px; color: var(--muted); }
.menu-item.danger, .menu-item.danger i { color: var(--danger); }
@media (hover: hover) and (pointer: fine) { .menu-item:hover { background: var(--surface-2); } }
@keyframes pop { from { opacity: 0; transform: scale(0.97); } }

/* ---------- Inicio ---------- */
.hello { margin: 8px 0 26px; }
.hello h1 { font-size: 30px; font-weight: 650; letter-spacing: -0.035em; }
.hello p { color: var(--muted); margin-top: 6px; font-size: 16px; }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 28px; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-delta { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }
.kpi-delta.flat { color: var(--muted); }
.kpi.is-attention { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.kpi.is-attention .kpi-value { color: var(--accent-ink); }

/* Lista de publicaciones (filas) */
.post-rows { display: flex; flex-direction: column; }
.post-row { display: flex; align-items: center; gap: 14px; padding: 12px 22px; transition: background-color 160ms ease; }
.post-row + .post-row { border-top: 1px solid var(--line); }
.post-row:last-child { border-radius: 0 0 var(--r-card) var(--r-card); }
.post-thumb { width: 52px; height: 52px; flex: none; border-radius: 12px; overflow: hidden; background: var(--surface-sunken); display: grid; place-items: center; color: var(--faint); font-size: 22px; }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-row-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.post-row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; color: var(--muted); }
.post-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
@media (hover: hover) and (pointer: fine) { a.post-row:hover { background: var(--surface-2); } }
@media (max-width: 640px) {
    .post-row { padding: 12px 16px; gap: 12px; align-items: flex-start; }
    .post-row-side { display: none; }
    .post-row-meta .status { margin-top: 2px; }
}
.post-row-meta .status-mobile { display: none; }
@media (max-width: 640px) { .post-row-meta .status-mobile { display: inline-flex; } }

/* Tarjetas de marcas */
.brand-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.brand-card { padding: 20px; display: flex; flex-direction: column; gap: 16px; transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out); }
.brand-card-top { display: flex; align-items: center; gap: 12px; }
.brand-card-top h3 { font-size: 17px; }
.brand-card-top p { color: var(--muted); font-size: 13px; }
.brand-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.brand-card-stats div { background: var(--surface-2); border-radius: var(--r-ctrl); padding: 10px 12px; }
.brand-card-stats strong { display: block; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.brand-card-stats span { font-size: 12px; color: var(--muted); }
.brand-card-stats .is-hot strong { color: var(--accent-ink); }
.brand-card.is-inactive { opacity: 0.6; }
@media (hover: hover) and (pointer: fine) { a.brand-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); } }

/* Estado vacío */
.empty { text-align: center; padding: 44px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-icon { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 26px; margin-bottom: 6px; }
.empty h3 { font-size: 17px; }
.empty p { color: var(--muted); max-width: 42ch; font-size: 14px; }
.empty .btn { margin-top: 10px; }

/* ---------- Calendario ---------- */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.cal-month { display: flex; align-items: center; gap: 4px; }
.cal-month h2 { font-size: 20px; min-width: 170px; text-align: center; }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-sunken); border-radius: var(--r-pill); }
.segmented a { padding: 6px 14px; border-radius: var(--r-pill); font-size: 13px; font-weight: 500; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.segmented a[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.cal-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.cal-filters a { height: 32px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; border-radius: var(--r-pill); font-size: 13px; font-weight: 500; color: var(--ink-2); border: 1px solid var(--line-strong); background: var(--surface); }
.cal-filters a[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.cal-filters .count { font-variant-numeric: tabular-nums; opacity: 0.7; }

.calendar { overflow: hidden; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head div { padding: 12px 10px 8px; font-size: 12px; font-weight: 500; color: var(--muted); }
.cal-day { min-height: 128px; padding: 8px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 5px; min-width: 0; position: relative; }
.cal-day:not(:nth-child(7n + 1)) { border-left: 1px solid var(--line); }
.cal-day.is-out { background: var(--surface-2); }
.cal-day.is-out .cal-num { color: var(--faint); }
.cal-num { font-size: 13px; font-weight: 500; color: var(--ink-2); width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-variant-numeric: tabular-nums; }
.cal-day.is-today .cal-num { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.cal-add { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); opacity: 0; transition: opacity 160ms ease; }
.cal-day:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
@media (hover: hover) and (pointer: fine) { .cal-add:hover { background: var(--surface-sunken); color: var(--ink); } }
.cal-post {
    display: flex; align-items: center; gap: 6px; min-width: 0;
    padding: 4px 6px 4px 4px; border-radius: 9px; font-size: 12px; line-height: 1.25;
    background: var(--surface-2); border: 1px solid var(--line);
    transition: border-color 160ms ease, transform 140ms var(--ease-out);
}
.cal-post:active { transform: scale(0.98); }
.cal-post img, .cal-post .ph-ico { width: 24px; height: 24px; flex: none; border-radius: 6px; object-fit: cover; background: var(--surface-sunken); display: grid; place-items: center; color: var(--faint); font-size: 13px; }
.cal-post-text { min-width: 0; display: flex; flex-direction: column; }
.cal-post-text strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-post-text small { color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-post[data-tone="warning"] { box-shadow: inset 3px 0 0 var(--warning); }
.cal-post[data-tone="danger"] { box-shadow: inset 3px 0 0 var(--danger); }
.cal-post[data-tone="success"] { box-shadow: inset 3px 0 0 var(--success); }
.cal-post[data-tone="info"] { box-shadow: inset 3px 0 0 var(--info); }
.cal-post[data-tone="accent"] { box-shadow: inset 3px 0 0 var(--accent); }
.cal-post[data-tone="pending"] { box-shadow: inset 3px 0 0 var(--info); }
.cal-post[data-tone="neutral"] { box-shadow: inset 3px 0 0 var(--faint); opacity: 0.85; }
@media (hover: hover) and (pointer: fine) { .cal-post:hover { border-color: var(--line-strong); } }
.cal-more { font-size: 12px; color: var(--muted); padding-left: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Agenda (lista) */
.agenda-day { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 16px 22px; }
.agenda-day + .agenda-day { border-top: 1px solid var(--line); }
.agenda-date { display: flex; flex-direction: column; align-items: center; padding-top: 2px; }
.agenda-date strong { font-size: 24px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.agenda-date span { font-size: 12px; color: var(--muted); text-transform: capitalize; margin-top: 4px; }
.agenda-day.is-today .agenda-date strong { color: var(--accent); }
.agenda-posts { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.agenda-posts .post-row { padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; }
.agenda-posts .post-row + .post-row { border-top: 1px solid var(--line); }
@media (max-width: 640px) { .agenda-day { grid-template-columns: 44px minmax(0, 1fr); padding: 14px 14px; gap: 10px; } }

/* En pantallas pequeñas el calendario mensual se reemplaza por la agenda */
@media (max-width: 760px) {
    .only-desktop { display: none !important; }
}
@media (min-width: 761px) {
    .only-mobile { display: none !important; }
}

/* ---------- Detalle de publicación ---------- */
.post-layout { display: grid; gap: 20px; }
@media (min-width: 1080px) { .post-layout { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; } .post-aside { position: sticky; top: calc(var(--topbar-h) + 8px); } }
.media-stage { background: var(--surface-sunken); border-radius: var(--r-card); overflow: hidden; position: relative; }
.media-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.media-track::-webkit-scrollbar { display: none; }
.media-slide { flex: 0 0 100%; scroll-snap-align: start; display: grid; place-items: center; max-height: 72vh; aspect-ratio: 4 / 5; }
.media-slide img, .media-slide video { width: 100%; height: 100%; object-fit: contain; }
.media-slide.is-file { aspect-ratio: auto; min-height: 220px; padding: 24px; }
.media-dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.media-dots span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12); transition: background-color 160ms ease, width 200ms var(--ease-out); }
.media-dots span.is-active { background: #fff; width: 16px; border-radius: 3px; }
.media-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.92); color: #18181b; display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15); font-size: 18px; }
.media-nav.prev { left: 12px; }
.media-nav.next { right: 12px; }
@media (hover: none) { .media-nav { display: none; } }
.media-empty { aspect-ratio: 16 / 9; display: grid; place-items: center; color: var(--faint); text-align: center; gap: 4px; }
.media-empty i { font-size: 34px; }
.media-strip { display: flex; gap: 8px; padding: 12px; overflow-x: auto; }
.media-strip a { width: 56px; height: 56px; flex: none; border-radius: 10px; overflow: hidden; background: var(--surface); display: grid; place-items: center; color: var(--muted); font-size: 20px; }
.media-strip img { width: 100%; height: 100%; object-fit: cover; }
.file-tile { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--ink-2); text-align: center; }
.file-tile i { font-size: 44px; color: var(--accent); }

.post-title { font-size: 26px; font-weight: 650; letter-spacing: -0.03em; margin-bottom: 10px; }
.meta-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 16px; font-size: 14px; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.caption { white-space: normal; font-size: 15px; line-height: 1.65; color: var(--ink-2); word-wrap: break-word; }
.caption a { color: var(--accent-ink); text-decoration: underline; }
.decision { padding: 20px; border-radius: var(--r-card); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.decision h2 { font-size: 16px; margin-bottom: 4px; }
.decision p { font-size: 14px; color: var(--ink-2); margin-bottom: 14px; }
.decision-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.decision.is-done { background: var(--success-soft); border-color: transparent; }
.decision.is-done h2 { color: var(--success); display: flex; gap: 8px; align-items: center; }
.changes-form { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }

/* Comentarios */
.thread { display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 10px; }
.msg-bubble { min-width: 0; flex: 1; }
.msg-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 13px; }
.msg-head strong { font-weight: 600; font-size: 14px; }
.msg-head span { color: var(--faint); }
.msg-body { margin-top: 4px; font-size: 14px; line-height: 1.55; color: var(--ink-2); padding: 10px 14px; background: var(--surface-2); border-radius: 4px 14px 14px 14px; border: 1px solid var(--line); word-wrap: break-word; }
.msg-body a { color: var(--accent-ink); text-decoration: underline; }
.msg.is-client .msg-body { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 18%, transparent); }
.msg-event { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); padding-left: 4px; }
.msg-event i { font-size: 16px; }
.msg-event .status { height: 22px; }
.composer { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.composer .textarea { min-height: 76px; }
.composer-actions { display: flex; justify-content: flex-end; }

/* ---------- Brand kit ---------- */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.swatch { border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); position: relative; }
.swatch-color { height: 96px; display: flex; align-items: flex-end; padding: 10px 12px; font-family: var(--mono); font-size: 12px; }
.swatch-info { padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.swatch-info strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swatch-copy { border: 0; background: var(--surface-sunken); border-radius: var(--r-pill); padding: 4px 10px; font-family: var(--mono); font-size: 12px; cursor: pointer; color: var(--ink-2); }
.swatch-copy:active { transform: scale(0.96); }
.swatch form { position: absolute; top: 6px; right: 6px; }
.swatch form button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(9, 9, 11, 0.5); color: #fff; cursor: pointer; display: grid; place-items: center; opacity: 0; transition: opacity 160ms ease; }
.swatch:hover form button, .swatch form button:focus-visible { opacity: 1; }
@media (hover: none) { .swatch form button { opacity: 1; } }
.fonts-list { display: flex; flex-direction: column; }
.font-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; }
.font-row + .font-row { border-top: 1px solid var(--line); }
.font-sample { width: 52px; height: 52px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-size: 22px; font-weight: 600; flex: none; }
.font-row-main { flex: 1; min-width: 0; }
.font-row-main strong { display: block; font-weight: 600; }
.font-row-main span { font-size: 13px; color: var(--muted); }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.file-card { border-radius: 16px; border: 1px solid var(--line); background: var(--surface); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow 200ms var(--ease-out); }
.file-card-preview { aspect-ratio: 4 / 3; background: var(--surface-2) repeating-conic-gradient(var(--surface-sunken) 0% 25%, transparent 0% 50%) 50% / 16px 16px; display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.file-card-preview img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.file-card-preview i { font-size: 36px; }
.file-card-preview.is-doc { background: var(--surface-2); }
.file-card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.file-card-body strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card-body span { font-size: 12px; color: var(--muted); }
.file-card-actions { display: flex; gap: 4px; padding: 0 8px 8px; margin-top: auto; }
.file-card-actions .btn { flex: 1; }
@media (hover: hover) and (pointer: fine) { .file-card:hover { box-shadow: var(--shadow-lg); } }
.kit-section + .kit-section { margin-top: 28px; }
.kit-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.kit-head h2 { font-size: 18px; display: flex; align-items: center; gap: 8px; }
.kit-head h2 i { color: var(--accent); }
.kit-head .count { font-size: 13px; color: var(--muted); font-weight: 500; }

/* Paneles desplegables (formularios secundarios) */
.disclosure > summary { list-style: none; cursor: pointer; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure[open] > summary .ph-caret-down { transform: rotate(180deg); }
.disclosure > summary .ph-caret-down { transition: transform 200ms var(--ease-out); }

/* ---------- Reportes ---------- */
.report-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.chart-card { padding: 20px 22px 14px; }
.chart-card h2 { font-size: 16px; }
.chart-card .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.chart-wrap { position: relative; margin-top: 14px; }
.chart { width: 100%; height: auto; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--accent); opacity: 0.08; }
.chart-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; transition: r 140ms var(--ease-out); }
.chart-hit { fill: transparent; cursor: crosshair; }
.chart-point:hover .chart-dot, .chart-point:focus .chart-dot { r: 6.5; }
.chart-point:focus { outline: none; }
.tooltip {
    position: fixed; z-index: 60; pointer-events: none;
    background: var(--ink); color: var(--bg); border-radius: 10px; padding: 8px 10px;
    font-size: 12px; line-height: 1.35; box-shadow: var(--shadow-lg);
    transform: translate(-50%, calc(-100% - 12px));
}
.tooltip strong { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.num { text-align: right; }
.table .delta { font-size: 12px; margin-left: 6px; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }
.summary-text { font-size: 15px; line-height: 1.7; color: var(--ink-2); }
.metric-inputs { display: grid; gap: 12px; }
.metric-row { display: grid; grid-template-columns: 140px repeat(5, minmax(0, 1fr)); gap: 8px; align-items: center; }
.metric-row .input { min-height: 40px; padding: 8px 10px; text-align: right; font-variant-numeric: tabular-nums; }
.metric-row-head { font-size: 12px; color: var(--muted); }
.metric-row-head span { text-align: right; }
.metric-platform { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; }
@media (max-width: 760px) {
    .metric-row { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
    .metric-row .metric-platform { grid-column: 1 / -1; }
    .metric-row-head { display: none; }
    .metric-row label.sr-only { position: static; width: auto; height: auto; clip: auto; font-size: 12px; color: var(--muted); }
    .metric-cell { display: flex; flex-direction: column; gap: 4px; }
}

/* ---------- Personas ---------- */
.people { display: flex; flex-direction: column; }
.person { display: flex; align-items: center; gap: 12px; padding: 14px 22px; }
.person + .person { border-top: 1px solid var(--line); }
.person-main { flex: 1; min-width: 0; }
.person-main strong { display: block; font-weight: 600; }
.person-main span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.person-brands { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.person.is-inactive { opacity: 0.55; }
@media (hover: hover) and (pointer: fine) { a.person:hover { background: var(--surface-2); } }
@media (max-width: 640px) { .person { padding: 12px 16px; } .person-brands { display: none; } }
.checks-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.check-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-ctrl); border: 1px solid var(--line-strong); cursor: pointer; }
.check-card input { width: 18px; height: 18px; accent-color: var(--accent); }
.check-card:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }

/* Código y pasos (ajustes) */
.steps { counter-reset: step; display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 0; list-style: none; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; font-size: 14px; color: var(--ink-2); }
.steps li::before { content: counter(step); width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; font-size: 13px; display: grid; place-items: center; }
.code { font-family: var(--mono); font-size: 13px; background: var(--surface-sunken); border-radius: 8px; padding: 2px 6px; word-break: break-all; }
.secret-box { display: flex; gap: 8px; align-items: center; }
.secret-box .input { font-family: var(--mono); font-size: 14px; }

/* Página de error */
.error-page { text-align: center; padding: 64px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.error-page .code-big { font-size: 64px; font-weight: 700; letter-spacing: -0.05em; color: var(--accent); line-height: 1; }

/* ---------- Movimiento ---------- */
.reveal { animation: rise 360ms var(--ease-out); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.alert[data-flash] { animation: rise 300ms var(--ease-out); }

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

/* En celular: archivos, luego la decisión, luego el texto y la conversación */
@media (max-width: 1079px) {
    .post-view .post-main { display: contents; }
    .post-view .media-stage { order: 1; }
    .post-view .post-main > .row { order: 2; }
    .post-view .post-aside { order: 3; }
    .post-view .post-main > .card { order: 4; }
}
.table th:first-child, .table td:first-child { padding-left: 22px; }
.table th:last-child, .table td:last-child { padding-right: 22px; }

/* Botón de tema: muestra el ícono del modo al que se cambiará */
.theme-icon-light { display: none; }
:root[data-theme="dark"] .theme-icon-light { display: inline; }
:root[data-theme="dark"] .theme-icon-dark { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-icon-light { display: inline; }
    :root:not([data-theme="light"]) .theme-icon-dark { display: none; }
}
.auth-theme { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; }

/* ---------- Comentarios sobre la imagen (puntos) ---------- */
.media-slide { aspect-ratio: auto; max-height: none; min-height: 260px; }
.media-slide video { max-height: 72vh; height: auto; }
.pin-area { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.pin-area img { display: block; width: auto; height: auto; max-width: 100%; max-height: 72vh; object-fit: contain; -webkit-user-select: none; user-select: none; }
.media-stage.is-pinning .pin-area { cursor: crosshair; }
.media-stage.is-pinning .pin-area::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; box-shadow: inset 0 0 0 3px var(--accent); pointer-events: none; }
.pin {
    position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px;
    border-radius: 50% 50% 50% 4px; background: var(--accent); color: #fff;
    display: grid; place-items: center; font-size: 12px; font-weight: 700; line-height: 1;
    box-shadow: 0 0 0 2px #fff, 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 160ms var(--ease-out);
}
.pin.is-draft { background: var(--ink); color: var(--bg); }
.pin.is-flash { animation: pin-flash 900ms var(--ease-out); }
@keyframes pin-flash { 0%, 100% { transform: scale(1); } 30% { transform: scale(1.35); } }
@media (hover: hover) and (pointer: fine) { .pin:hover { transform: scale(1.12); } }
.pin-hint { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: var(--r-pill); font-size: 13px; line-height: 1.3; display: flex; gap: 6px; align-items: center; box-shadow: var(--shadow-lg); white-space: nowrap; }
.media-toolbar { margin-top: -12px; }
.media-toolbar .toolbar-meta { margin-left: auto; }
.media-toolbar .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.pin-badge { display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 8px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 600; }
.pin-chosen { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--accent-ink); background: var(--accent-soft); padding: 8px 12px; border-radius: var(--r-ctrl); }
.pin-chosen .link-btn { margin-left: auto; }
.msg.is-target .msg-body { box-shadow: 0 0 0 2px var(--accent); }

/* ---------- Comparar versiones ---------- */
.post-view .compare { order: 0; }
.compare-grid { display: grid; gap: 16px; }
@media (min-width: 720px) { .compare-grid { grid-template-columns: 1fr 1fr; } }
.compare-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.compare-label { font-size: 12px; font-weight: 600; }
.compare-label.is-old { color: var(--muted); }
.compare-label.is-new { color: var(--accent-ink); }
.compare-media { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.compare-media img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 10px; background: var(--surface-sunken); }
.compare-file { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 4 / 5; border-radius: 10px; background: var(--surface-sunken); font-size: 11px; text-align: center; padding: 8px; color: var(--muted); }
.compare-file i { font-size: 26px; color: var(--accent); }
.compare-title { font-weight: 600; }

/* ---------- Vista previa en teléfono ---------- */
.preview-dialog { border: 0; padding: 18px; border-radius: 24px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); overflow: auto; }
.preview-dialog::backdrop { background: rgba(9, 9, 11, 0.55); }
.preview-dialog[open] { animation: pop 200ms var(--ease-out); }
.preview-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.preview-head .icon-btn { margin-left: auto; }
.phone { width: 300px; max-width: 100%; margin: 0 auto; padding: 10px; border-radius: 42px; background: #0b0b0c; box-shadow: inset 0 0 0 2px #2a2a2e; }
.phone-screen { border-radius: 32px; overflow: hidden; background: #fff; color: #111; font-size: 13px; line-height: 1.4; min-height: 540px; }
.phone.is-vertical .phone-screen { background: #000; }
.feed-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 14px 8px; font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.feed-top span:last-child { font-size: 20px; display: flex; gap: 10px; }
.feed-user { display: flex; align-items: center; gap: 8px; padding: 8px 12px; }
.feed-user strong { font-size: 13px; }
.feed-user i { margin-left: auto; font-size: 18px; }
.feed-media { position: relative; background: #efefef; }
.feed-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.feed-track::-webkit-scrollbar { display: none; }
.feed-slide { flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: 4 / 5; }
.feed-slide img, .feed-slide video { width: 100%; height: 100%; object-fit: cover; }
.feed-count { position: absolute; top: 10px; right: 10px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 999px; }
.feed-actions { display: flex; gap: 14px; padding: 10px 12px 6px; font-size: 22px; }
.feed-actions i:last-child { margin-left: auto; }
.feed-caption { padding: 0 12px 16px; word-wrap: break-word; }
.story { position: relative; aspect-ratio: 9 / 16; background: #111; }
.story img, .story video { width: 100%; height: 100%; object-fit: cover; }
.story-top { position: absolute; top: 0; left: 0; right: 0; padding: 10px; background: linear-gradient(rgba(0, 0, 0, 0.45), transparent); color: #fff; }
.story-bars { display: flex; gap: 3px; margin-bottom: 8px; }
.story-bars span { flex: 1; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.4); }
.story-bars span.is-on { background: #fff; }
.story-user { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.story-user span { opacity: 0.7; }
.story-caption { position: absolute; left: 12px; right: 12px; bottom: 16px; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }

/* Arrastrar en el calendario */
.cal-post[draggable="true"] { cursor: grab; }
.cal-post.is-dragging { opacity: 0.4; }
.cal-post.is-saving { opacity: 0.6; }
.cal-day.is-drop { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }

/* ---------- Tablero de proyectos ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.board-col { background: var(--surface-sunken); border-radius: var(--r-card); padding: 12px; min-height: 240px; display: flex; flex-direction: column; gap: 10px; scroll-snap-align: start; transition: box-shadow 160ms ease, background-color 160ms ease; }
.board-col.is-drop { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.board-col-head { font-size: 14px; display: flex; align-items: center; gap: 8px; padding: 4px 4px 2px; }
.board-col-head i { color: var(--muted); font-size: 17px; }
.board-col-head .count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 500; }
.board-list { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 60px; }
.board-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); transition: transform 140ms var(--ease-out), box-shadow 160ms ease; }
.board-card[draggable="true"] { cursor: grab; }
.board-card.is-dragging { opacity: 0.4; }
.board-card strong { font-weight: 600; font-size: 14px; }
.board-desc { font-size: 13px; color: var(--muted); }
.board-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.board-meta span { display: inline-flex; align-items: center; gap: 4px; }
.board-avatar { width: 24px; height: 24px; font-size: 10px; margin-left: auto; }
.is-late { color: var(--danger) !important; font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .board-card:hover { box-shadow: var(--shadow-lg); } }
@media (max-width: 760px) { .board { grid-auto-columns: 82%; } }

/* Texto en la imagen / copy */
.texts { display: flex; flex-direction: column; gap: 20px; }
.text-block + .text-block { padding-top: 20px; border-top: 1px solid var(--line); }
.text-block .section-title i, .compare .section-title i { color: var(--accent); }
.image-text { background: var(--accent-soft); border-radius: var(--r-ctrl); padding: 12px 14px; font-weight: 500; color: var(--ink); }
.compare-sub { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: -4px; }

/* ---------- Barra de carga con astronauta ---------- */
.loader-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 90; pointer-events: none; opacity: 0; transition: opacity 200ms ease; }
.loader-bar.is-active { opacity: 1; }
.loader-fill { position: relative; height: 100%; width: 100%; transform: translateX(-100%); background: linear-gradient(90deg, var(--accent), #f8a26a); border-radius: 0 3px 3px 0; box-shadow: 0 0 10px rgba(236, 100, 26, 0.5); }
.loader-bar.is-active .loader-fill { animation: loader-go 8s cubic-bezier(0.1, 0.8, 0.2, 1) forwards; }
@keyframes loader-go { from { transform: translateX(-100%); } 20% { transform: translateX(-55%); } to { transform: translateX(-8%); } }
.loader-astro { position: absolute; right: -15px; top: -4px; width: 30px; height: 30px; animation: astro-float 1.6s ease-in-out infinite; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25)); }
@keyframes astro-float { 0%, 100% { transform: translateY(0) rotate(-8deg); } 50% { transform: translateY(5px) rotate(8deg); } }

.upload-overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 95; display: grid; place-items: center; padding: 16px; background: rgba(9, 9, 11, 0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: rise 240ms var(--ease-out); }
.upload-card { position: relative; overflow: hidden; width: min(440px, 100%); background: #101014; color: #f4f4f5; border-radius: 24px; padding: 34px 28px 26px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); text-align: center; }
.upload-space span { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff; opacity: 0.6; animation: twinkle 2.4s ease-in-out infinite; }
.upload-space span:nth-child(1) { top: 18%; left: 12%; }
.upload-space span:nth-child(2) { top: 30%; left: 82%; animation-delay: 0.4s; }
.upload-space span:nth-child(3) { top: 12%; left: 58%; animation-delay: 0.9s; width: 2px; height: 2px; }
.upload-space span:nth-child(4) { top: 70%; left: 8%; animation-delay: 1.3s; }
.upload-space span:nth-child(5) { top: 62%; left: 90%; animation-delay: 1.7s; width: 2px; height: 2px; }
@keyframes twinkle { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.9; } }
.upload-title { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 34px; }
.upload-track { position: relative; height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); margin: 0 18px; }
.upload-clip { position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 999px; overflow: hidden; }
.upload-fill { height: 100%; width: 100%; transform: translateX(-98%); border-radius: 999px; background: linear-gradient(90deg, var(--accent), #f8a26a); box-shadow: 0 0 14px rgba(236, 100, 26, 0.55); transition: transform 300ms var(--ease-out); }
.upload-runner { position: absolute; top: 0; right: 0; bottom: 0; left: 0; transform: translateX(-98%); transition: transform 300ms var(--ease-out); pointer-events: none; }
.upload-astro { position: absolute; top: 50%; right: -22px; width: 44px; height: 44px; margin-top: -26px; animation: astro-float 1.6s ease-in-out infinite; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45)); }
.upload-detail { margin-top: 24px; font-size: 14px; color: #d4d4d8; font-variant-numeric: tabular-nums; }
.upload-note { margin-top: 6px; font-size: 12px; color: #8b8b94; }
@media (prefers-reduced-motion: reduce) { .loader-astro, .upload-astro, .upload-space span { animation: none; } }

/* ---------- Archivo mensual ---------- */
.archive-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.archive-steps li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); }
.archive-steps li > div { flex: 1; min-width: 220px; }
.archive-steps li.is-current { border-color: var(--accent); background: var(--accent-soft); }
.archive-steps li.is-done { opacity: 0.85; }
.archive-steps strong { display: block; margin-bottom: 2px; }
.archive-month { padding: 10px 10px; border-radius: 10px; gap: 10px; }
.archive-month.is-current { background: var(--accent-soft); }
@media (hover: hover) and (pointer: fine) { a.archive-month:hover { background: var(--surface-2); } }
.archived-note { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--muted); padding: 36px 20px; }
.archived-note i { font-size: 34px; color: var(--accent); }
.request-tag { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 11px; font-weight: 600; }

/* Textos guardados */
.snippets { display: flex; flex-direction: column; }
.snippet { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; }
.snippet + .snippet { border-top: 1px solid var(--line); }
.snippet-main { flex: 1; min-width: 0; }
.snippet-main p { font-size: 13px; color: var(--muted); margin-top: 2px; word-wrap: break-word; }
.snippet-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 2px; }
.snippet-bar span { font-size: 12px; color: var(--muted); }
.snippet-chip { border: 1px dashed var(--line-strong); background: var(--surface); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 500; color: var(--ink-2); cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.snippet-chip:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .snippet-chip:hover { border-color: var(--accent); color: var(--accent-ink); } }

/* =========================================================
   Movimiento: vida y micro-interacciones
   Reglas: solo transform/opacity, ease-out fuerte, <300 ms en la interfaz,
   hover solo con mouse, y versión tranquila con "reducir movimiento".
   ========================================================= */

/* Cambio de página suave (Chrome, Edge y Safari recientes). El menú y la barra superior no parpadean. */
@view-transition { navigation: auto; }
.sidebar { view-transition-name: vido-sidebar; }
.topbar { view-transition-name: vido-topbar; }
.tabbar { view-transition-name: vido-tabbar; }
::view-transition-old(vido-sidebar), ::view-transition-new(vido-sidebar),
::view-transition-old(vido-topbar), ::view-transition-new(vido-topbar),
::view-transition-old(vido-tabbar), ::view-transition-new(vido-tabbar) { animation: none; }
::view-transition-old(root) { animation: vt-out 140ms var(--ease-out) both; }
::view-transition-new(root) { animation: vt-in 240ms var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }

/* Entrada escalonada: el JS pone --i a cada elemento (40 ms entre uno y otro) */
.js-motion .reveal { animation: none; }
.anim-in { animation: rise 320ms var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 40ms); }

/* Imágenes que aparecen suave al cargar, en vez de "saltar" */
img.is-loading { opacity: 0; }
img.img-fade { transition: opacity 320ms var(--ease-out), transform 260ms var(--ease-out); }

/* Tarjetas y filas: se levantan un poco con el mouse */
@media (hover: hover) and (pointer: fine) {
    a.card, .board-card, .file-card, .kpi { transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out), border-color 160ms ease; }
    a.card:hover, .board-card:hover { transform: translateY(-2px); }
    .post-thumb img, .file-card-preview img { transition: transform 260ms var(--ease-out), opacity 320ms var(--ease-out); }
    .post-row:hover .post-thumb img, .file-card:hover .file-card-preview img { transform: scale(1.06); }
    .post-row .post-row-title { transition: color 160ms ease; }
    a.post-row:hover .post-row-title { color: var(--accent-ink); }

    /* Íconos de botones con intención */
    .btn i, .crumb i, .nav-link i, .menu-item i, .row .ph-caret-right { transition: transform 200ms var(--ease-out); }
    .btn:hover .ph-plus { transform: rotate(90deg); }
    .btn:hover .ph-paper-plane-tilt, .btn:hover .ph-paper-plane-right { transform: translate(2px, -2px); }
    .btn:hover .ph-download-simple { transform: translateY(2px); }
    .btn:hover .ph-upload-simple, .btn:hover .ph-cloud-arrow-up { transform: translateY(-2px); }
    .btn:hover .ph-check, .btn:hover .ph-checks { transform: scale(1.15); }
    .btn:hover .ph-file-pdf, .btn:hover .ph-device-mobile, .btn:hover .ph-map-pin { transform: translateY(-1px) rotate(-6deg); }
    .crumb:hover i { transform: translateX(-3px); }
    a.row:hover .ph-caret-right, a.person:hover .ph-caret-right { transform: translateX(3px); }
    .nav-link:hover i { transform: scale(1.1); }
    .icon-btn:hover .ph-bell { transform-origin: 50% 10%; animation: bell-ring 600ms var(--ease-out); }
}
.nav-link:active i, .icon-btn:active i { transform: scale(0.88); }
.tabbar .nav-link i { transition: transform 160ms var(--ease-out); }

/* Campanita: suena cuando llega algo nuevo, y el número "salta" */
.notif-btn.is-ringing .ph-bell { transform-origin: 50% 10%; animation: bell-ring 700ms var(--ease-out); }
@keyframes bell-ring {
    0%, 100% { transform: rotate(0); }
    15% { transform: rotate(14deg); }
    30% { transform: rotate(-12deg); }
    45% { transform: rotate(8deg); }
    60% { transform: rotate(-5deg); }
    75% { transform: rotate(2deg); }
}
.notif-count.is-popping { animation: badge-pop 320ms var(--ease-out); }
@keyframes badge-pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* Estado "esperando aprobación": un pulso suave para que se note que algo está pendiente */
.status-pending::before { animation: pending-pulse 2.2s ease-out infinite; }
@keyframes pending-pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--info) 55%, transparent); }
    70%, 100% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--info) 0%, transparent); }
}

/* Día de hoy en el calendario */
.cal-day.is-today .cal-num { animation: today-ring 1.6s var(--ease-out) 400ms 2; }
@keyframes today-ring {
    0% { box-shadow: 0 0 0 0 rgba(236, 100, 26, 0.5); }
    100% { box-shadow: 0 0 0 10px rgba(236, 100, 26, 0); }
}

/* Chips de redes: el ícono responde al marcar */
.chip input:checked + span i { animation: chip-pop 260ms var(--ease-out); }
@keyframes chip-pop { 0% { transform: scale(0.7); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* Zona para soltar archivos: el ícono "sube" al arrastrar encima */
.dropzone i { transition: transform 220ms var(--ease-out); }
.dropzone.is-over i { transform: translateY(-5px) scale(1.1); }
.upload-item.is-new { animation: rise 260ms var(--ease-out) backwards; }

/* Estados vacíos: el ícono flota despacio */
.empty-icon { animation: float-soft 3.4s ease-in-out infinite; }
@keyframes float-soft { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* Al soltar una tarjeta arrastrada, se "asienta" */
.just-dropped { animation: settle 280ms var(--ease-out); }
@keyframes settle { 0% { transform: scale(0.94); } 60% { transform: scale(1.02); } 100% { transform: scale(1); } }

/* Gráfico: la línea se dibuja y los puntos aparecen en orden */
.chart.is-drawing .chart-line { animation: chart-draw 900ms var(--ease-out) both; }
.chart.is-drawing .chart-area { animation: chart-fade 600ms var(--ease-out) 300ms both; }
.chart.is-drawing .chart-dot { animation: chart-dot 260ms var(--ease-out) both; animation-delay: calc(400ms + var(--i, 0) * 60ms); transform-box: fill-box; transform-origin: center; }
@keyframes chart-draw { from { stroke-dashoffset: var(--len, 1000); } to { stroke-dashoffset: 0; } }
@keyframes chart-fade { from { opacity: 0; } }
@keyframes chart-dot { from { opacity: 0; transform: scale(0.5); } }

/* Mensajes de éxito: se van solos */
.alert.is-leaving { opacity: 0; transform: translateY(-6px); transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out); }

/* Mensaje nuevo en la conversación */
.msg.is-new .msg-body { animation: msg-in 1.6s var(--ease-out); }
@keyframes msg-in { 0% { box-shadow: 0 0 0 2px var(--accent); } 100% { box-shadow: 0 0 0 2px transparent; } }

/* Confeti al aprobar (momento poco frecuente: aquí sí cabe la celebración) */
.confetti { position: fixed; z-index: 99; width: 8px; height: 12px; border-radius: 2px; pointer-events: none; will-change: transform, opacity; }

/* Cambio de tema suave */
.theme-fade, .theme-fade * { transition: background-color 260ms ease, border-color 260ms ease, color 260ms ease !important; }
[data-theme-toggle] i { transition: transform 300ms var(--ease-out), opacity 200ms ease; }
[data-theme-toggle].is-spinning i { transform: rotate(180deg) scale(0.6); opacity: 0; }

@media (prefers-reduced-motion: reduce) {
    .empty-icon, .status-pending::before, .cal-day.is-today .cal-num, .icon-btn .ph-bell, .notif-btn.is-ringing .ph-bell { animation: none !important; }
    ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 120ms; }
}

/* Pedidos */
.tabbar .nav-link { position: relative; }
.tabbar .nav-badge { position: absolute; top: 2px; left: 54%; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; margin: 0; }
.request-icon { font-size: 22px; }
.request-icon.tone-warning { background: var(--warning-soft); color: var(--warning); }
.request-icon.tone-pending { background: var(--info-soft); color: var(--info); }
.request-icon.tone-success { background: var(--success-soft); color: var(--success); }
.request-icon.tone-info { background: var(--info-soft); color: var(--info); }
.request-icon.tone-neutral { background: var(--neutral-soft); color: var(--neutral); }
.decide { display: flex; flex-direction: column; gap: 10px; }
.decide-option { padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.decide-text { display: flex; flex-direction: column; gap: 2px; }
.decide-text strong { display: flex; align-items: center; gap: 8px; }
.decide-text strong i { color: var(--accent); font-size: 18px; }
.decide-text span { font-size: 13px; color: var(--muted); }
.origin-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--accent-ink); background: var(--accent-soft); padding: 6px 12px; border-radius: 999px; font-weight: 500; }
.requests-banner { display: flex; align-items: center; gap: 14px; border-color: color-mix(in srgb, var(--warning) 35%, transparent); }

/* =========================================================
   Fondo del ingreso: Astrobrand (espacio) + Vido (capa por capa)
   ========================================================= */
.auth-body { background: var(--bg); overflow-x: hidden; }
.space-bg {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 0; overflow: hidden; pointer-events: none;
    background:
        radial-gradient(ellipse 80% 60% at 50% 120%, rgba(236, 100, 26, 0.16), transparent 70%),
        linear-gradient(180deg, var(--bg), var(--surface-sunken));
}
:root[data-theme="dark"] .space-bg { background: radial-gradient(ellipse 80% 60% at 50% 120%, rgba(240, 114, 44, 0.22), transparent 70%), linear-gradient(180deg, #07070c 0%, #0f0d16 60%, #160f12 100%); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .space-bg { background: radial-gradient(ellipse 80% 60% at 50% 120%, rgba(240, 114, 44, 0.22), transparent 70%), linear-gradient(180deg, #07070c 0%, #0f0d16 60%, #160f12 100%); }
}
.auth { position: relative; z-index: 1; }
.auth-theme { z-index: 2; }
.auth-card {
    background: color-mix(in srgb, var(--surface) 84%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    backdrop-filter: blur(18px) saturate(1.3);
    animation: card-in 600ms var(--ease-out) backwards;
}
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.auth-logo img { animation: logo-float 6s ease-in-out infinite; }
@keyframes logo-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

.space-stars { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* Nebulosas: naranja Vido y turquesa Astrobrand */
.space-glow { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.5; will-change: transform; }
.glow-1 { width: 520px; height: 520px; left: -140px; top: -160px; background: radial-gradient(circle, rgba(236, 100, 26, 0.45), transparent 65%); animation: glow-drift 22s ease-in-out infinite alternate; }
.glow-2 { width: 460px; height: 460px; right: -120px; bottom: -140px; background: radial-gradient(circle, rgba(34, 229, 216, 0.28), transparent 65%); animation: glow-drift 26s ease-in-out infinite alternate-reverse; }
@keyframes glow-drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(60px, 40px) scale(1.12); } }

/* Estrellas fugaces */
.shooting-star { position: absolute; width: 140px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, rgba(255, 255, 255, 0.95), transparent); opacity: 0; transform: rotate(-28deg); }
.shooting-star.s1 { top: 14%; left: 58%; animation: shoot 9s ease-out 2s infinite; }
.shooting-star.s2 { top: 34%; left: 18%; animation: shoot 13s ease-out 7s infinite; }
.shooting-star.s3 { top: 62%; left: 88%; animation: shoot 17s ease-out 12s infinite; }
@keyframes shoot {
    0% { opacity: 0; transform: rotate(-28deg) translateX(0); }
    2% { opacity: 1; }
    9% { opacity: 0; transform: rotate(-28deg) translateX(-360px); }
    100% { opacity: 0; transform: rotate(-28deg) translateX(-360px); }
}
:root[data-theme="light"] .shooting-star { background: linear-gradient(90deg, rgba(236, 100, 26, 0.8), transparent); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .shooting-star { background: linear-gradient(90deg, rgba(236, 100, 26, 0.8), transparent); } }

@media (prefers-reduced-motion: reduce) {
    .space-bg *, .auth-logo img, .auth-card { animation: none !important; }

}

/* Logo del ingreso: en oscuro el lema "capa por capa" va en claro */
.logo-for-dark { display: none; }
.logo-for-dark img { width: 104px; height: auto; }
:root[data-theme="dark"] .logo-for-light { display: none; }
:root[data-theme="dark"] .logo-for-dark { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .logo-for-light { display: none; }
    :root:not([data-theme="light"]) .logo-for-dark { display: block; }
}
.auth-logo .logo-for-dark { animation: logo-float 6s ease-in-out infinite; }
.auth-logo .logo-for-dark img { animation: none; }
