:root {
    --bg: #f1f5f9;
    --panel: #ffffff;
    --panel-alt: #f8fafc;
    --border: #e2e8f0;
    --text: #1e293b;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --dark: #0f172a;
    --sidebar-bg: #0f172a;
    --sidebar-border: #1e293b;
    --danger: #ef4444;
    --green: #16a34a;
    --green-bg: #dcfce7;
    --row-hover: #f8fafc;
}

/* Tema oscuro: se activa con data-theme="dark" en <html> */
html[data-theme="dark"] {
    --bg: #0b1120;
    --panel: #1e293b;
    --panel-alt: #172033;
    --border: #334155;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --dark: #020617;
    --sidebar-bg: #0b1220;
    --sidebar-border: #1e293b;
    --danger: #f87171;
    --green: #4ade80;
    --green-bg: #14532d;
    --row-hover: #243049;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.85rem; }
.right { text-align: right; }

/* ---------- Login ---------- */
.login-wrapper {
    display: flex; align-items: center; justify-content: center;
    height: 100vh; background: linear-gradient(135deg, #1e293b, #0f172a);
}
.login-card {
    background: var(--panel); border-radius: 16px; padding: 2.5rem;
    width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.brand { display: flex; align-items: center; gap: .6rem; }
.brand-icon {
    width: 1.85rem; height: 1.85rem; object-fit: contain; flex-shrink: 0;
}
.brand .brand-icon { width: 2.75rem; height: 2.75rem; }
.sidebar-brand .brand-icon { width: 2.125rem; height: 2.125rem; }
.brand h1 { font-size: 1.3rem; } .brand h1 span { color: var(--primary); }
.login-subtitle { color: var(--muted); margin: .4rem 0 1.4rem; font-size: .9rem; }
.tabs { display: flex; gap: .5rem; margin-bottom: 1rem; }
.tab {
    flex: 1; padding: .6rem; border: none; background: var(--panel-alt);
    border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted);
}
.tab.active { background: var(--primary); color: #fff; }
.auth-form { display: flex; flex-direction: column; gap: .7rem; }
.auth-form input {
    padding: .7rem .9rem; border: 1px solid var(--border);
    border-radius: 8px; font-size: .95rem;
}
.btn-primary {
    background: var(--primary); color: #fff; border: none; padding: .75rem;
    border-radius: 8px; font-weight: 600; cursor: pointer; font-size: .95rem;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary.small { padding: .55rem .9rem; }
.error-msg { color: var(--danger); font-size: .85rem; margin-top: .8rem; min-height: 1rem; }
.success-msg { color: var(--green); font-size: .8rem; margin: .5rem 0; word-break: break-all; }
.hint { color: var(--muted); font-size: .75rem; margin-top: 1rem; text-align: center; }

/* ---------- App layout ---------- */
.app-layout { display: flex; height: 100vh; }
.sidebar {
    width: 240px; background: var(--sidebar-bg); color: #cbd5e1;
    display: flex; flex-direction: column; flex-shrink: 0;
}
.sidebar-brand {
    display: flex; align-items: center; gap: .6rem; padding: 1.2rem 1.3rem;
    color: #fff; font-weight: 700; font-size: 1.15rem;
    border-bottom: 1px solid var(--sidebar-border);
}
.sidebar-nav { flex: 1; padding: 1rem 0; display: flex; flex-direction: column; }
.nav-item {
    background: none; border: none; color: #cbd5e1; text-align: left;
    padding: .8rem 1.3rem; cursor: pointer; font-size: .95rem;
    border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--sidebar-border); color: #fff; }
.nav-item.active { background: var(--sidebar-border); color: #fff; border-left-color: var(--primary); }
.sidebar-user {
    display: flex; align-items: center; gap: .7rem; padding: 1rem 1.3rem;
    border-top: 1px solid var(--sidebar-border);
}
.avatar {
    width: 38px; height: 38px; border-radius: 50%; background: var(--primary);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem;
}
.user-info { flex: 1; overflow: hidden; }
.user-info p { font-size: .82rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: #64748b !important; font-size: .72rem !important; }
.logout-btn { background: none; border: none; color: #94a3b8; font-size: 1.2rem; cursor: pointer; }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.tab-panel { display: flex; flex-direction: column; height: 100%; overflow: hidden; }

/* Timer bar */
.timer-bar {
    background: var(--panel); border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem; display: flex; align-items: center; gap: 1rem;
}
.task-input { flex: 1; padding: .6rem .9rem; border: 1px solid var(--border); border-radius: 8px; }
.project-select { padding: .6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); }
.task-input, .auth-form input, .inline-form input { background: var(--panel); color: var(--text); }
.timer-display { font-family: monospace; font-size: 1.5rem; font-weight: 600; width: 120px; text-align: center; }
.btn-timer { border: none; color: #fff; padding: .7rem 1.4rem; border-radius: 8px; font-weight: 700; cursor: pointer; }
.btn-timer.start { background: var(--primary); }
.btn-timer.stop { background: var(--danger); }

.content { flex: 1; overflow-y: auto; padding: 1.5rem; max-width: 1100px; width: 100%; margin: 0 auto; }

/* Check-in card */
.checkin-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
    padding: 1.2rem 1.4rem; display: flex; justify-content: space-between;
    align-items: center; margin-bottom: 1.5rem;
}
.checkin-info { display: flex; align-items: center; gap: 1rem; }
.checkin-icon {
    width: 48px; height: 48px; border-radius: 50%; background: var(--panel-alt);
    display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.checkin-icon.done { background: var(--green-bg); }
.btn-dark { background: var(--dark); color: #fff; border: none; padding: .65rem 1.3rem; border-radius: 8px; cursor: pointer; font-weight: 500; }
.btn-dark:disabled { opacity: .6; cursor: default; }

.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: .8rem; }
.section-head h2 { font-size: 1.15rem; }
.sub { font-size: 1rem; margin: 1.2rem 0 .6rem; color: var(--muted); }

/* Tables */
.entries-table { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 1rem; }
.entries-head, .entry-row {
    display: grid; grid-template-columns: 2fr 1.2fr 1fr; gap: 1rem;
    padding: .8rem 1.2rem; align-items: center;
}
.entries-head { background: var(--panel-alt); font-size: .72rem; text-transform: uppercase; color: var(--muted); font-weight: 700; letter-spacing: .04em; }
.entry-row { border-top: 1px solid var(--border); }
.entry-row:hover { background: var(--row-hover); }
.entry-dur { font-family: monospace; font-weight: 600; text-align: right; }
.proj-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .5rem; vertical-align: middle; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

/* Cards grid */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 1rem; }
.project-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
    padding: 1.1rem; border-left: 5px solid var(--primary);
}
.project-card h4 { font-size: 1rem; margin-bottom: .3rem; }

/* Report summary */
.report-summary { display: flex; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.stat-box { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.4rem; flex: 1; min-width: 150px; }
.stat-box .val { font-size: 1.6rem; font-weight: 700; }
.stat-box .lbl { color: var(--muted); font-size: .8rem; }

/* Inline forms & admin */
.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-form input { padding: .55rem .8rem; border: 1px solid var(--border); border-radius: 8px; }
.admin-block { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1.2rem; margin-bottom: 1.2rem; }
.admin-block h3 { margin-bottom: .8rem; font-size: 1rem; }

/* Controles de Administración: mismo tema que el resto de la aplicación. */
#adminTab .admin-block input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="range"]),
#adminTab .admin-block select,
#adminTab .admin-block textarea,
#devportalTab .dev-pane input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="range"]),
#devportalTab .dev-pane select,
#devportalTab .dev-pane textarea {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .48rem .6rem;
    font: inherit;
    font-size: .86rem;
    accent-color: var(--primary);
}
#adminTab .admin-block input:focus,
#adminTab .admin-block select:focus,
#adminTab .admin-block textarea:focus,
#devportalTab .dev-pane input:focus,
#devportalTab .dev-pane select:focus,
#devportalTab .dev-pane textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
#adminTab .admin-block input::placeholder,
#adminTab .admin-block textarea::placeholder,
#devportalTab .dev-pane input::placeholder,
#devportalTab .dev-pane textarea::placeholder { color: var(--muted); }
#adminTab .admin-block input[type="checkbox"],
#adminTab .admin-block input[type="radio"],
#devportalTab .dev-pane input[type="checkbox"],
#devportalTab .dev-pane input[type="radio"] { accent-color: var(--primary); }
html[data-theme="dark"] #adminTab .admin-block input[type="date"],
html[data-theme="dark"] #adminTab .admin-block input[type="time"],
html[data-theme="dark"] #devportalTab .dev-pane input[type="date"],
html[data-theme="dark"] #devportalTab .dev-pane input[type="time"] { color-scheme: dark; }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; font-size: .82rem; }
.btn-link.danger { color: var(--danger); }
.badge { padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; }
.badge.ok { background: var(--green-bg); color: var(--green); }
.badge.off { background: #fee2e2; color: var(--danger); }

/* ---------- Theme toggle ---------- */
.theme-toggle {
    background: none; border: 1px solid var(--sidebar-border); color: #cbd5e1;
    border-radius: 8px; padding: .5rem; cursor: pointer; font-size: 1rem;
    display: flex; align-items: center; justify-content: center; gap: .5rem;
    width: 100%; transition: background .15s;
}
.theme-toggle:hover { background: var(--sidebar-border); color: #fff; }
.theme-toggle-wrap { padding: .4rem 1rem 1rem; }

/* Toggle en la pantalla de login (esquina) */
.login-theme-toggle {
    position: absolute; top: 1rem; right: 1rem;
    background: rgba(255,255,255,.12); color: #fff; border: none;
    border-radius: 999px; width: 40px; height: 40px; cursor: pointer; font-size: 1.1rem;
}

/* ---------- API Docs (Developer) ---------- */
.docs-toolbar { display: flex; gap: .6rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.docs-frame {
    width: 100%; height: calc(100vh - 160px); border: 1px solid var(--border);
    border-radius: 12px; background: var(--panel);
}
.docs-tabs { display: flex; gap: .5rem; }
.docs-tab {
    padding: .5rem .9rem; border: 1px solid var(--border); background: var(--panel);
    color: var(--text); border-radius: 8px; cursor: pointer; font-size: .85rem;
}
.docs-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.role-badge {
    display: inline-block; margin-left: .4rem; padding: .1rem .5rem; border-radius: 999px;
    font-size: .65rem; background: var(--primary); color: #fff; vertical-align: middle;
}

/* Banner de cambio de rol */
.role-banner {
    background: var(--primary); color: #fff; padding: .7rem 1.2rem;
    font-size: .9rem; text-align: center;
}

/* ---------- Botón ghost ---------- */
.btn-ghost {
    background: transparent; border: 1px solid var(--border); color: var(--text);
    border-radius: 8px; padding: .5rem .8rem; cursor: pointer; font-size: .85rem; white-space: nowrap;
}
.btn-ghost:hover { background: var(--panel-alt); }

/* ---------- Switch facturable ---------- */
.switch { position: relative; display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; }
.switch input { display: none; }
.switch .slider {
    width: 38px; height: 20px; background: var(--border); border-radius: 999px; position: relative; transition: background .15s;
}
.switch .slider::before {
    content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: left .15s;
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { left: 20px; }
.switch-lbl { font-weight: 700; color: var(--muted); }

/* ---------- Entradas por semana y día ---------- */
.week-group { margin-bottom: 1.8rem; }
.week-group:last-child { margin-bottom: .2rem; }
.week-header {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: .55rem .2rem .45rem; margin-bottom: .25rem;
    border-bottom: 2px solid color-mix(in srgb, var(--primary) 32%, var(--border));
    text-transform: uppercase; letter-spacing: .045em; font-size: .8rem;
}
.week-label { font-weight: 800; color: var(--text); }
.week-total { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 700; color: var(--text); }
.day-group { margin-bottom: 1rem; }
.day-group:last-child { margin-bottom: 0; }
.day-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: .45rem .2rem; font-weight: 700; color: var(--text); border-bottom: 1px solid var(--border);
    font-size: .84rem;
}
.day-label { letter-spacing: .03em; }
.day-total { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--muted); font-weight: 600; }
.te-row {
    display: grid; grid-template-columns: 24px 2fr 1.4fr 1fr auto; gap: .8rem; align-items: center;
    padding: .7rem .2rem; border-bottom: 1px solid var(--border);
}
.te-row:hover { background: var(--row-hover); }
.te-desc { font-weight: 500; }
.te-meta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .85rem; }
.te-time { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.te-dur { font-family: monospace; font-weight: 600; text-align: right; }
.te-actions { display: flex; gap: .3rem; }
.te-group { border-bottom: 1px solid var(--border); }
.te-group .te-row { border-bottom: 1px solid var(--border); }
.te-group .te-row:last-child { border-bottom: 0; }
.te-group-head { background: var(--panel-alt); }
.te-group-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px; margin-left: .4rem;
    border-radius: 999px; font-size: .68rem; font-weight: 700; background: var(--border); color: var(--muted); vertical-align: middle;
}
.te-child { padding-left: 1.2rem; background: color-mix(in srgb, var(--panel-alt) 55%, transparent); }
.te-child-time { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--muted); font-weight: 500; }
.icon-btn { background: none; border: none; cursor: pointer; font-size: 1rem; color: var(--muted); padding: .2rem; border-radius: 6px; }
.icon-btn:hover { background: var(--panel-alt); color: var(--text); }
.warn-icon { color: #f59e0b; font-size: 1.1rem; cursor: help; }
.proj-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; background: var(--panel-alt); }
.proj-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.tag-chip { padding: .05rem .45rem; border-radius: 999px; font-size: .72rem; color: #fff; }
.billable-chip { color: var(--green); font-weight: 700; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-card { background: var(--panel); color: var(--text); border-radius: 14px; padding: 1.5rem; width: 440px; max-width: 92vw; box-shadow: 0 20px 50px rgba(0,0,0,.4); }
.modal-card h3 { margin-bottom: 1rem; }
.modal-card label { display: block; font-size: .8rem; color: var(--muted); margin: .7rem 0 .25rem; }
.modal-card input[type=text], .modal-card input[type=url], .modal-card input[type=email], .modal-card input[type=datetime-local], .modal-card select {
    width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit;
}
.modal-card input[type=url]:focus, .modal-card input[type=text]:focus, .modal-card input[type=email]:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.modal-row { display: flex; gap: .8rem; }
.modal-row > div { flex: 1; }
.modal-check { display: flex !important; align-items: center; gap: .5rem; margin-top: .9rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.2rem; }

/* Report description groups */
.rep-desc { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; margin-bottom: .8rem; overflow: hidden; }
.rep-desc-head { display: flex; justify-content: space-between; padding: .7rem 1rem; font-weight: 600; background: var(--panel-alt); }
.rep-proj-row { display: flex; justify-content: space-between; padding: .5rem 1.4rem; border-top: 1px solid var(--border); font-size: .88rem; }

/* ======================================================================
   Barra del cronómetro estilo Clockify (modo temporizador / manual)
   ====================================================================== */
.timer-bar { flex-wrap: wrap; row-gap: .6rem; }
.tb-group { display: flex; align-items: center; gap: .5rem; }
.tb-input {
    padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 8px;
    background: var(--panel); color: var(--text); font: inherit; font-size: .88rem;
}
.tb-mini { display: flex; align-items: center; gap: .35rem; font-size: .75rem; color: var(--muted); }
.tb-mini input { padding: .3rem .4rem; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--text); }
.tb-sep { color: var(--muted); }
.timer-display.small { width: auto; min-width: 90px; font-size: 1.15rem; }
.manual-fields { align-items: stretch; }
.manual-time-stack { display: flex; flex-direction: column; gap: .35rem; }
.manual-time-row { display: flex; align-items: center; gap: .4rem; }
.time-duration { width: 98px; min-width: 98px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; text-align: center; }
.modal-time-vertical { display: flex; flex-direction: column; gap: .6rem; }
.modal-time-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.modal-time-row > div { min-width: 0; }
#editModal .time-duration { width: 100%; }

.round-btn {
    width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer;
    color: #fff; font-size: 1.2rem; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.25); transition: transform .12s, background .15s; flex-shrink: 0;
}
.round-btn:hover { transform: scale(1.06); }
.round-btn.start { background: #0ea5e9; }
.round-btn.start:hover { background: #0284c7; }
.round-btn.stop { background: var(--danger); }
.mode-btn {
    background: none; border: none; cursor: pointer; font-size: 1.25rem; color: var(--muted);
    padding: .35rem; border-radius: 8px; flex-shrink: 0;
}
.mode-btn:hover { background: var(--panel-alt); color: var(--text); }

/* Campo de descripción faltante: se sacude y se marca en rojo (sin ventanas de error) */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-9px); } 30% { transform: translateX(8px); }
    45% { transform: translateX(-6px); } 60% { transform: translateX(5px); }
    75% { transform: translateX(-3px); }
}
.task-input.need {
    animation: shake .5s ease; border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .28);
}
.task-input.need::placeholder { color: var(--danger); opacity: 1; }
@media (prefers-reduced-motion: reduce) { .task-input.need { animation: none; } }

/* ---------- Avisos (toast) ---------- */
.toast {
    position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 200;
    padding: .7rem 1.2rem; border-radius: 10px; font-size: .9rem; color: #fff;
    background: #334155; box-shadow: 0 8px 24px rgba(0,0,0,.35); max-width: 90vw;
}
.toast.ok { background: #15803d; }
.toast.warn { background: #b45309; }
.toast.error { background: #b91c1c; }

/* ======================================================================
   Dashboard y Reportes
   ====================================================================== */
.content.wide { max-width: 1400px; }
.filters { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; font-weight: 600; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .45rem; vertical-align: middle; }
.r { text-align: right; }
.mono { font-family: monospace; }

/* Selector de rango */
.range-picker { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.rp-nav { display: flex; align-items: center; gap: .3rem; }
.rp-btn {
    width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--panel); color: var(--text); cursor: pointer; font-size: 1.1rem; line-height: 1;
}
.rp-btn:hover { background: var(--panel-alt); }
.rp-label { min-width: 150px; text-align: center; font-weight: 600; font-size: .9rem; }
.rp-custom { display: flex; gap: .4rem; }

/* Dashboard */
.dash-grid { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(280px, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: 1fr; } }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--border); margin: -1.1rem -1.2rem 1.2rem; }
.stat { padding: 1rem 1.2rem; text-align: center; border-right: 1px solid var(--border); }
.stat:last-child { border-right: none; }
.stat-lbl { font-size: .78rem; color: var(--muted); margin-bottom: .3rem; }
.stat-val { font-size: 1.35rem; font-weight: 700; }
.stat-val small { font-size: .75rem; color: var(--muted); font-weight: 500; }
.top-row { display: flex; justify-content: space-between; gap: .8rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.top-row:last-child { border-bottom: none; }
.top-main { min-width: 0; }
.top-desc { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-proj { font-size: .78rem; color: var(--muted); }
.top-dur { font-family: monospace; font-weight: 600; white-space: nowrap; }

/* Gráfico de barras apiladas */
.bc { display: flex; gap: .6rem; }
.bc-y { position: relative; width: 44px; height: 260px; flex-shrink: 0; }
.bc-y span { position: absolute; right: 0; transform: translateY(50%); font-size: .72rem; color: var(--muted); }
.bc-area { flex: 1; min-width: 0; }
.bc-plot { position: relative; height: 260px; }
.bc-grid { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--border); }
.bc-cols { position: absolute; inset: 0; display: flex; gap: 10px; }
.bc-col { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.bc-total { height: 20px; line-height: 20px; font-size: .72rem; white-space: nowrap; color: var(--text); }
.bc-total.zero { color: var(--muted); }
.bc-bar { width: 72%; max-width: 96px; display: flex; flex-direction: column-reverse; border-radius: 4px 4px 0 0; overflow: hidden; }
.bc-seg { min-height: 0; }
.bc-xs { display: flex; gap: 10px; margin-top: 6px; }
.bc-xl { flex: 1; min-width: 0; text-align: center; font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: 1rem; font-size: .8rem; }
.legend.vertical { flex-direction: column; flex-wrap: nowrap; gap: .45rem; margin-top: 1rem; }
.lg-item { display: inline-flex; align-items: center; gap: .4rem; color: var(--text); }
.lg-item i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* Reportes */
.report-tabs { display: flex; gap: .3rem; margin-bottom: .8rem; border-bottom: 1px solid var(--border); }
.rtab { background: none; border: none; padding: .6rem 1.1rem; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; font: inherit; }
.rtab.active { color: var(--primary); border-bottom-color: var(--primary); }
.filter-bar { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-bar .tb-input { min-width: 200px; }
.rep-totals { display: flex; gap: 2rem; margin-bottom: 1rem; flex-wrap: wrap; }
.rt-stat span { display: block; font-size: .75rem; color: var(--muted); }
.rt-stat b { font-size: 1.3rem; font-family: monospace; }
.rep-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 1000px) { .rep-split { grid-template-columns: 1fr; } }
.rt-head, .rt-group summary, .rt-sub { display: grid; grid-template-columns: minmax(0, 1fr) 110px 70px; gap: .6rem; align-items: center; }
.rt-head { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 0 .4rem .5rem; border-bottom: 1px solid var(--border); }
.rt-group { border-bottom: 1px solid var(--border); }
.rt-group summary { padding: .65rem .4rem; cursor: pointer; font-weight: 600; list-style: none; }
.rt-group summary::-webkit-details-marker { display: none; }
.rt-group summary:hover { background: var(--row-hover); }
.rt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-name small { color: var(--muted); font-weight: 400; }
.rt-sub { padding: .4rem .4rem .4rem 1.6rem; font-size: .88rem; color: var(--text); border-top: 1px solid var(--border); }
.rt-sub .r, .rt-group summary .r { font-family: monospace; }
.donut-panel { display: flex; flex-direction: column; align-items: center; }
.donut { width: 190px; height: 190px; border-radius: 50%; position: relative; display: flex; align-items: center; justify-content: center; }
.donut-hole {
    width: 118px; height: 118px; border-radius: 50%; background: var(--panel);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.donut-hole b { font-family: monospace; font-size: 1rem; }
.donut-hole small { color: var(--muted); font-size: .72rem; }

/* Tabla detallada */
.dt-row { display: grid; grid-template-columns: 90px minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1fr) 24px 110px 90px; gap: .7rem; align-items: center; padding: .55rem .3rem; border-bottom: 1px solid var(--border); font-size: .86rem; }
.dt-row.multi { grid-template-columns: 90px 130px minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1fr) 24px 110px 90px; }
.dt-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-head { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.dt-row:not(.dt-head):hover { background: var(--row-hover); }

/* Menú de exportación */
.export-wrap { position: relative; }
.export-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 190px;
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0,0,0,.3); overflow: hidden; display: flex; flex-direction: column;
}
.export-menu button { background: none; border: none; text-align: left; padding: .65rem 1rem; cursor: pointer; color: var(--text); font: inherit; font-size: .88rem; }
.export-menu button:hover { background: var(--panel-alt); }

/* Botón principal + cambio de modo siempre juntos, a la derecha de la barra */
.tb-actions { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; margin-left: auto; }
.timer-bar .task-input { flex: 1 1 240px; min-width: 180px; }
.timer-bar .project-select { max-width: 170px; }

/* Barra más compacta: en modo manual cabe en una sola fila en pantallas de escritorio */
.timer-bar { gap: .55rem; padding: .8rem 1.2rem; }
.timer-bar .task-input { flex: 1 1 160px; min-width: 160px; }
.timer-bar .project-select { max-width: 140px; }
.timer-bar .tb-input { padding: .45rem .5rem; }

/* Etiqueta con la hora de compilación del servidor */
.build-info { font-size: .68rem; color: var(--muted); text-align: center; }
.sidebar-build { padding: 0 1rem .5rem; color: #64748b; }

/* ======================================================================
   Hora en formato 24 h, botón ocupado y menú de entrada (modal)
   ====================================================================== */
.time24 { font-family: ui-monospace, Consolas, "Courier New", monospace; text-align: center; letter-spacing: .03em; }
.tb-input.time24 { width: 76px; }
.tb-mini input.time24 { width: 66px; padding: .3rem .4rem; }
.time24.invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 2px rgba(239, 68, 68, .22); }
.round-btn.busy { opacity: .65; cursor: progress; transform: none; }
.round-btn:disabled { cursor: progress; }
.mode-btn:disabled { opacity: .4; cursor: default; }

/* El modal nunca se sale de la pantalla: si es alto, se desplaza por dentro */
.modal { padding: 1rem; }
.modal-card { max-height: calc(100vh - 2rem); overflow-y: auto; }
.modal-card.wide { width: 560px; }
.modal-card input[type=date], .modal-card input[type=number] {
    width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit;
}
.modal-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.modal-grid2 > div { min-width: 0; }
.field-with-btn { display: flex; gap: .4rem; align-items: stretch; }
.field-with-btn select { width: auto; flex: 1; min-width: 0; }
.field-with-btn .btn-ghost { padding: .4rem .6rem; }
.modal-time { display: grid; grid-template-columns: 110px 110px minmax(0, 1fr); gap: .8rem; }
.modal-time > div { min-width: 0; }
.modal-hint { font-size: .82rem; color: var(--muted); min-height: 1.1rem; margin-top: .45rem; }
.modal-hint.bad { color: var(--danger); }
.modal-notice { background: rgba(245, 158, 11, .14); border: 1px solid rgba(245, 158, 11, .55); border-radius: 8px; padding: .5rem .7rem; font-size: .8rem; margin-top: .5rem; }
.toggle-row { display: flex !important; justify-content: space-between; align-items: center; margin-top: 1rem !important; cursor: pointer; font-size: .95rem !important; color: var(--text) !important; }
.toggle-text small { color: var(--muted); }
.modal-actions .left { margin-right: auto; }
.small { font-size: .78rem; }

/* ======================================================================
   Calendario
   ====================================================================== */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg-btn { background: var(--panel); color: var(--text); border: none; padding: .45rem .9rem; cursor: pointer; font: inherit; font-size: .85rem; }
.seg-btn.active { background: var(--primary); color: #fff; }
.cal-total { font-family: ui-monospace, Consolas, monospace; font-weight: 600; }
.cal-legend { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; font-size: .8rem; margin-bottom: .6rem; }
.lg-box { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--border); vertical-align: middle; margin-right: .3rem; }
.lg-box.nw { background: repeating-linear-gradient(135deg, rgba(100,116,139,.45) 0 4px, transparent 4px 8px); }
.lg-box.hol { background: repeating-linear-gradient(135deg, rgba(245,158,11,.6) 0 4px, transparent 4px 8px); }

.cal { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; height: calc(100vh - 215px); min-height: 420px; overflow: hidden; }
.cal-head, .cal-scroll { scrollbar-gutter: stable; }
.cal-head { display: flex; overflow: hidden; border-bottom: 1px solid var(--border); background: var(--panel-alt); }
.cal-gutter, .cal-hours { width: 56px; flex-shrink: 0; }
.cal-dh { flex: 1; min-width: 0; text-align: center; padding: .45rem .2rem; border-left: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 1px; }
.cal-dname { font-size: .7rem; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.cal-dnum { font-size: 1.25rem; font-weight: 700; line-height: 1.1; }
.cal-dh.today .cal-dnum { background: var(--primary); color: #fff; border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
.cal-dtotal { font-family: ui-monospace, Consolas, monospace; font-size: .75rem; color: var(--muted); }
.cal-dnote { font-size: .68rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: .05rem .45rem; border-radius: 999px; background: rgba(100,116,139,.22); margin-top: 2px; }
.cal-dnote.hol { background: rgba(245,158,11,.28); }

.cal-scroll { overflow-y: auto; flex: 1; position: relative; }
.cal-body { display: flex; position: relative; }
.cal-hours { position: relative; }
.cal-hl { position: absolute; right: 8px; transform: translateY(-50%); font-size: .68rem; color: var(--muted); }
.cal-hl:first-child { transform: none; top: 2px !important; }
.cal-cols { flex: 1; display: flex; min-width: 0; }
.cal-col {
    flex: 1; min-width: 0; position: relative; border-left: 1px solid var(--border); cursor: cell;
    background-image: linear-gradient(to bottom, var(--border) 1px, transparent 1px); background-size: 100% 48px;
}
.cal-col.today { background-color: rgba(59, 130, 246, .06); }
.cal-col.nw {
    background-image: repeating-linear-gradient(135deg, rgba(100,116,139,.18) 0 8px, transparent 8px 16px), linear-gradient(to bottom, var(--border) 1px, transparent 1px);
    background-size: auto, 100% 48px;
}
.cal-col.nw.hol {
    background-image: repeating-linear-gradient(135deg, rgba(245,158,11,.24) 0 8px, transparent 8px 16px), linear-gradient(to bottom, var(--border) 1px, transparent 1px);
    background-size: auto, 100% 48px;
}
.cal-evt {
    position: absolute; border-radius: 6px; padding: 2px 6px; overflow: hidden; cursor: pointer; font-size: .74rem; line-height: 1.25; color: var(--text);
    background: var(--panel-alt); background: color-mix(in srgb, var(--c) 26%, var(--panel));
    border-left: 4px solid var(--c); box-shadow: 0 1px 2px rgba(0,0,0,.18);
}
.cal-evt:hover, .cal-evt:focus-visible { z-index: 5; box-shadow: 0 0 0 2px var(--c), 0 4px 10px rgba(0,0,0,.25); outline: none; }
.cal-evt.running { background-image: repeating-linear-gradient(45deg, transparent 0 6px, rgba(255,255,255,.14) 6px 12px); }
.cal-evt.cont-prev { border-top-left-radius: 0; border-top-right-radius: 0; }
.cal-evt.cont-next { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.ce-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ce-sub, .ce-time { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: #ef4444; z-index: 4; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; }

/* Días no laborables / festivos en las gráficas */
.bc-col.nw { background: repeating-linear-gradient(135deg, rgba(100,116,139,.18) 0 8px, transparent 8px 16px); border-radius: 4px; }
.bc-col.nw.hol { background: repeating-linear-gradient(135deg, rgba(245,158,11,.24) 0 8px, transparent 8px 16px); }
.bc-xl.nw { color: var(--danger); font-weight: 600; }

/* ======================================================================
   Administración: calendario laboral e importación de festivos
   ====================================================================== */
.badge { background: var(--panel-alt); color: var(--muted); }
.badge.ok { background: var(--green-bg); color: var(--green); }
.badge.hol { background: rgba(245,158,11,.25); color: #b45309; }
.badge.nw { background: rgba(100,116,139,.25); color: var(--muted); }
html[data-theme="dark"] .badge.hol { color: #fbbf24; }
.nw-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin: .6rem 0 1rem; }
.nw-form { border: 1px solid var(--border); border-radius: 10px; padding: 1rem; margin-bottom: 1rem; background: var(--panel-alt); }
.nw-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: .7rem; margin-bottom: .7rem; }
.nw-grid label { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; color: var(--muted); }
.nw-grid input, .nw-grid select, .nw-row input[type=date], .nw-row input[type=number], .nw-row select {
    padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; font-size: .88rem;
}
.nw-row { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem; margin: .55rem 0; }
.nw-lbl { font-size: .8rem; color: var(--muted); min-width: 58px; }
.chk { display: inline-flex; align-items: center; gap: .35rem; font-size: .88rem; cursor: pointer; }
.holiday-search { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; margin: .6rem 0; }
.modal-card .holiday-search label { display: flex; flex-direction: column; gap: .25rem; margin: 0; }
.holiday-search select, .holiday-search input { width: auto; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; }
.holiday-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; margin: .5rem 0; }
.holiday-list:empty { display: none; }
.modal-card .holiday-row {
    display: grid; grid-template-columns: 22px 110px 1fr auto auto; gap: .6rem; align-items: center;
    padding: .5rem .7rem; border-bottom: 1px solid var(--border); cursor: pointer; font-size: .88rem; margin: 0; color: var(--text);
}
.holiday-row:last-child { border-bottom: none; }
.holiday-row.dim { opacity: .55; cursor: default; }
.h-date { color: var(--muted); text-transform: capitalize; }
@media (max-width: 700px) { .modal-time, .modal-time-row { grid-template-columns: 1fr 1fr; } .modal-grid2, .nw-grid { grid-template-columns: 1fr; } }

/* ======================================================================
   Asistencia por día
   ====================================================================== */
.att-note { font-size: .85rem; color: var(--muted); margin-bottom: .8rem; line-height: 1.5; max-width: 900px; }
.att-dup {
    background: rgba(245, 158, 11, .14); border: 1px solid rgba(245, 158, 11, .55); border-radius: 10px;
    padding: .7rem 1rem; margin-bottom: 1rem; font-size: .88rem; display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
}
.att-summary { font-size: .85rem; color: var(--muted); margin-bottom: .6rem; min-height: 1rem; }
.att-day { margin-bottom: 1.2rem; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.att-day-head { display: flex; align-items: center; gap: .8rem; padding: .7rem 1rem; background: var(--panel-alt); border-bottom: 1px solid var(--border); font-weight: 600; flex-wrap: wrap; }
.att-day-head .muted { font-weight: 400; margin-left: auto; }
.att-day-title::first-letter { text-transform: uppercase; }
.att-rec { border-bottom: 1px solid var(--border); }
.att-rec:last-child { border-bottom: none; }
.att-row {
    display: grid; grid-template-columns: minmax(150px, 1.4fr) 190px minmax(0, 2fr) 120px 120px 20px;
    gap: .8rem; align-items: center; padding: .65rem 1rem; cursor: pointer; list-style: none;
}
.att-row.single { grid-template-columns: 190px minmax(0, 2fr) 120px 120px 20px; }
.att-row::-webkit-details-marker { display: none; }
.att-row:hover { background: var(--row-hover); }
.att-who b { display: block; }
.att-who small, .att-in small { color: var(--muted); font-size: .75rem; }
.att-place { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-hours { font-family: ui-monospace, Consolas, monospace; text-align: right; }
.att-hours small { display: block; color: var(--muted); font-size: .7rem; font-family: inherit; }
.att-out-none { color: var(--muted); }
.att-n { color: var(--muted); font-size: .82rem; }
.att-chev { color: var(--muted); transition: transform .15s; text-align: center; }
.att-rec[open] .att-chev { transform: rotate(90deg); }
.att-detail { padding: .5rem 1rem 1rem 2.2rem; background: var(--panel-alt); border-top: 1px solid var(--border); }
.att-timeline { list-style: none; margin: .3rem 0 0; padding: 0; border-left: 2px solid var(--border); }
.att-tl { display: grid; grid-template-columns: 56px 160px minmax(0, 1fr) auto; gap: .7rem; align-items: center; padding: .4rem .7rem; position: relative; font-size: .86rem; }
.att-tl::before { content: ""; position: absolute; left: -7px; top: 50%; transform: translateY(-50%); width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.att-tl.in::before { background: var(--green); }
.att-tl.out::before { background: var(--danger); }
.att-tl-time { font-family: ui-monospace, Consolas, monospace; font-weight: 600; }
.att-tl-kind { color: var(--muted); }
.att-tl-place { overflow: hidden; text-overflow: ellipsis; }
.att-map { font-size: .78rem; white-space: nowrap; }
.att-extra { font-size: .8rem; color: #b45309; margin: .6rem 0 0; }
html[data-theme="dark"] .att-extra { color: #fbbf24; }
@media (max-width: 900px) {
    .att-row, .att-row.single { grid-template-columns: 1fr auto 20px; }
    .att-row .att-place, .att-row .att-n { display: none; }
    .att-tl { grid-template-columns: 52px 1fr; }
    .att-tl-place, .att-map { grid-column: 2; }
}

/* ======================================================================
   Diseño adaptable: la página se ajusta al tamaño de la ventana
   ====================================================================== */
html, body { height: 100%; }
body { height: 100dvh; min-width: 0; }
.login-wrapper { height: 100dvh; min-height: 100vh; padding: 1rem; overflow-y: auto; }
.login-card { width: min(380px, 100%); }

.app-layout { height: 100dvh; min-height: 0; }
.main { min-width: 0; min-height: 0; }
.tab-panel { min-height: 0; min-width: 0; }

/* Barra lateral: ancho proporcional y con scroll propio si la ventana es baja */
.sidebar { width: clamp(180px, 17vw, 240px); min-height: 0; }
.sidebar-nav { overflow-y: auto; min-height: 0; }
.nav-item { white-space: nowrap; }

/* Contenido fluido: usa el ancho disponible, sin recortar ni bloquear clics */
.content, .content.wide {
    max-width: min(1600px, 100%);
    padding: clamp(.75rem, 2vw, 1.5rem);
    min-width: 0; min-height: 0;
    overflow-x: auto;
}
.content > * { min-width: 0; }
img, svg, canvas, video { max-width: 100%; }

/* Barra del cronómetro: todo envuelve en vez de salirse */
.timer-bar { padding: .7rem clamp(.75rem, 2vw, 1.2rem); }
.timer-bar > * { min-width: 0; }
.timer-bar .task-input { min-width: min(160px, 100%); }
.timer-bar .project-select { max-width: min(170px, 100%); }
.filter-bar { flex-wrap: wrap; }
.filter-bar .tb-input { min-width: min(200px, 100%); }

/* Tablas con muchas columnas: scroll horizontal dentro de la tarjeta, no recorte */
.entries-table, .rep-table, .dt-table, .rt-table, .att-day { max-width: 100%; }
.dt-wrap, .rt-wrap { overflow-x: auto; }
.dt-row { min-width: 720px; }
.dt-row.multi { min-width: 860px; }
.cards-grid { grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
.stat-box { min-width: min(150px, 100%); }
.modal-card { width: min(440px, 94vw); }
.modal-card.wide, .modal-card[class*="lg"] { width: min(640px, 94vw); }
.te-row > *, .te-meta { min-width: 0; }
.te-desc { overflow-wrap: anywhere; }

/* Ventanas medianas */
@media (max-width: 1100px) {
    .rep-split, .dash-grid { grid-template-columns: 1fr; }
    .stat-row { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
}

/* Ventanas angostas: la barra lateral pasa arriba como menú horizontal */
@media (max-width: 860px) {
    .app-layout { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; align-items: center; flex-shrink: 0; overflow: hidden; }
    .sidebar-brand { border-bottom: none; padding: .6rem .9rem; white-space: nowrap; }
    .sidebar-nav { flex: 1; flex-direction: row; padding: 0; overflow-x: auto; overflow-y: hidden; }
    .nav-item { padding: .8rem .8rem; border-left: none; border-bottom: 3px solid transparent; }
    .nav-item.active { border-left-color: transparent; border-bottom-color: var(--primary); }
    .sidebar-build, .user-info { display: none; }
    .sidebar-user { border-top: none; padding: .4rem .7rem; flex-shrink: 0; }
    .te-row { display: flex; flex-wrap: wrap; gap: .4rem .8rem; }
    .te-row .te-desc { flex: 1 1 100%; }
    .te-row .te-meta { flex: 1 1 auto; }
    .checkin-card { flex-direction: column; align-items: stretch; gap: .8rem; }
    .tb-actions { margin-left: 0; }
    .cal { height: calc(100dvh - 260px); }
}
@media (max-width: 520px) {
    .modal-row { flex-direction: column; }
    .timer-display { width: auto; font-size: 1.3rem; }
}

/* ======================================================================
   Asistencia: entrada / salida  y  Administración con menú de secciones
   ====================================================================== */
.checkin-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.checkin-card { gap: 1rem; flex-wrap: wrap; }
.checkin-card #checkoutStatus { margin-top: .15rem; }
.btn-dark.out { background: var(--danger); }
.btn-dark:disabled { opacity: .6; cursor: progress; }

.admin-hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 1rem; }
.hub-card {
    display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; text-align: left;
    background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 14px;
    padding: 1.2rem 1.3rem; cursor: pointer; text-decoration: none; font: inherit;
    transition: transform .12s, border-color .12s, box-shadow .12s;
}
.hub-card:hover, .hub-card:focus-visible { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.12); outline: none; }
.hub-icon { font-size: 1.8rem; line-height: 1; }
.hub-title { font-weight: 700; font-size: 1.02rem; }
.hub-desc { color: var(--muted); font-size: .85rem; line-height: 1.4; }
.admin-back { margin-bottom: 1rem; }
.admin-pane.hidden { display: none !important; }
.dev-seg { margin-bottom: 1rem; flex-wrap: wrap; }
.dev-pane.hidden { display: none !important; }

/* Modo angosto: fila 1 = logo + tema + usuario; fila 2 = menú completo con scroll horizontal */
@media (max-width: 860px) {
    .sidebar { flex-wrap: wrap; overflow: visible; }
    .sidebar-brand { order: 1; flex: 1 1 auto; }
    .theme-toggle-wrap { order: 2; padding: .3rem .5rem; }
    .sidebar-user { order: 3; }
    .sidebar-nav { order: 4; flex: 1 1 100%; width: 100%; border-top: 1px solid var(--sidebar-border); scrollbar-width: thin; }
    .nav-item { flex-shrink: 0; }
    #themeToggleLabel { display: none; }
}

/* ======================================================================
   Proyectos: lista, detalle, Gantt y calendario de proyectos
   ====================================================================== */
.bad { color: var(--danger) !important; }
.good { color: var(--green) !important; }
.warn { color: #d97706 !important; }
html[data-theme="dark"] .warn { color: #fbbf24 !important; }
.badge.warnb { background: rgba(245,158,11,.18); color: #b45309; }
html[data-theme="dark"] .badge.warnb { color: #fbbf24; }
.proj-dot.big { width: 14px; height: 14px; margin-right: .5rem; vertical-align: middle; }

/* Lista */
.pj-table { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow-x: auto; }
.pj-row {
    display: grid; grid-template-columns: minmax(200px, 2.2fr) minmax(110px, 1.2fr) minmax(110px, 1fr) minmax(150px, 1.3fr) minmax(130px, 1.2fr) minmax(120px, 1.2fr);
    gap: 1rem; align-items: center; padding: .75rem 1rem; border-bottom: 1px solid var(--border); min-width: 860px; cursor: pointer; font-size: .9rem;
}
.pj-row:last-child { border-bottom: none; }
.pj-row:not(.pj-head-row):hover, .pj-row:not(.pj-head-row):focus-visible { background: var(--row-hover); outline: none; }
.pj-head-row { cursor: default; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; background: var(--panel-alt); }
.pj-row > span { min-width: 0; }
.pj-name { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.pj-name b { overflow: hidden; text-overflow: ellipsis; }
.pj-client, .pj-leads { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-tracked b, .pj-due { display: block; }
.pj-tracked small, .pj-due small { display: block; color: var(--muted); font-size: .75rem; }
.pj-due small.bad, .pj-due small.good { font-weight: 600; }
.pj-pct { display: block; font-size: .85rem; margin-bottom: 2px; }

/* Barra de progreso: verde (efectivo), ámbar (riesgo), rojo (fuera de tiempo) */
.pj-bar { position: relative; height: 5px; background: var(--panel-alt); border-radius: 999px; overflow: visible; border: 1px solid var(--border); }
.pj-bar.big { height: 12px; margin: .6rem 0; }
.pj-bar-fill { height: 100%; border-radius: 999px; background: #84cc16; }
.pj-bar-fill.risk { background: #f59e0b; }
.pj-bar-fill.over { background: #ef4444; }
.pj-bar-tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .7; }

/* Detalle */
.pj-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.pj-head h2 { display: flex; align-items: center; }
.pj-seg { margin-bottom: 1rem; flex-wrap: wrap; }
.pj-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.pj-grid.two { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); }
.pj-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.2rem; margin-bottom: 1rem; min-width: 0; }
.pj-grid > .pj-card { margin-bottom: 0; }
.pj-card h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .7rem; }
.pj-card hr { border: none; border-top: 1px solid var(--border); margin: .6rem 0; }

/* Formulario de Datos y fechas del proyecto */
#pjPaneData { padding-bottom: 6rem; }
#pjPaneData form { display: flex; flex-direction: column; gap: .15rem; }
#pjPaneData label { display: block; font-size: .8rem; color: var(--muted); margin: .65rem 0 .25rem; }
#pjPaneData input[type=text],
#pjPaneData input[type=number],
#pjPaneData input[type=date],
#pjPaneData select {
    width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 8px;
    background: var(--panel); color: var(--text); font: inherit; font-size: .9rem;
}
#pjPaneData input[type=color] {
    width: 56px; height: 38px; padding: 2px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--panel); cursor: pointer;
}
#pjPaneData .modal-grid2 { gap: .35rem 1.2rem; align-items: start; }
#pjPaneData .modal-hint { margin: .1rem 0 .4rem; }
#pjPaneData .modal-actions { margin-top: .9rem; }
.pj-archive-check {
    display: flex !important; align-items: center; gap: .5rem; cursor: pointer;
    font-size: .86rem !important; color: var(--text) !important; margin: 1rem 0 .35rem !important;
}
.pj-archive-check input { width: auto; margin: 0; }
@media (max-width: 700px) { #pjPaneData .modal-grid2 { grid-template-columns: 1fr; } }
.pj-kv { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; font-size: .9rem; }
.pj-kv span { color: var(--muted); }
.pj-kv b { font-weight: 600; text-align: right; }
.pj-kv b.strong { font-size: 1rem; }
.pj-banner { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 600; font-size: .92rem; border: 1px solid; }
.pj-banner.ok { background: rgba(132,204,22,.12); border-color: rgba(132,204,22,.5); color: var(--text); }
.pj-banner.risk { background: rgba(245,158,11,.14); border-color: rgba(245,158,11,.6); color: var(--text); }
.pj-banner.over { background: rgba(239,68,68,.14); border-color: rgba(239,68,68,.65); color: var(--text); }
.pj-banner.none { background: var(--panel-alt); border-color: var(--border); color: var(--muted); font-weight: 500; }
.pj-progress-card { text-align: center; }
.pj-donut {
    --c: #84cc16; width: 150px; height: 150px; border-radius: 50%; margin: 0 auto .4rem; display: grid; place-items: center;
    background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--panel-alt) 0);
}
.pj-donut.risk { --c: #f59e0b; } .pj-donut.over { --c: #ef4444; } .pj-donut.none { --c: var(--border); }
.pj-donut span { width: 112px; height: 112px; border-radius: 50%; background: var(--panel); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pj-donut b { font-size: 1.25rem; } .pj-donut small { color: var(--muted); font-size: .75rem; }
.pj-legend { display: flex; gap: .5rem; align-items: center; justify-content: center; flex-wrap: wrap; font-size: .75rem; }
.pj-legend .lg { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: #84cc16; }
.pj-legend .lg.risk { background: #f59e0b; } .pj-legend .lg.over { background: #ef4444; }
.pj-steps { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; padding: 0; }
.pj-steps li { border-left: 3px solid var(--border); padding-left: .7rem; }
.pj-steps li.done { border-left-color: var(--primary); }
.pj-steps span { display: block; font-size: .75rem; color: var(--muted); }
.pj-note { font-size: .85rem; margin: .5rem 0; font-weight: 600; }
.pj-add { margin-bottom: .8rem; flex-wrap: wrap; align-items: center; }
.pj-table2-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.pj-table2 { width: 100%; border-collapse: collapse; font-size: .88rem; }
.pj-table2 th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .5rem .6rem; border-bottom: 1px solid var(--border); }
.pj-table2 td { padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.pj-table2 tr:last-child td { border-bottom: none; }
.pj-table2 .right, .pj-table2 th.right { text-align: right; }
.pj-table2 tr.done .t-name { text-decoration: line-through; color: var(--muted); }
.pj-info { margin-bottom: .5rem; }
.pj-info .pj-kv b { max-width: 60%; }

/* Gantt */
.gantt-wrap { overflow: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; max-height: 70vh; }
.gantt { border-collapse: separate; border-spacing: 0; font-size: .82rem; min-width: 100%; }
.gantt th, .gantt td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: .4rem .5rem; white-space: nowrap; }
.gantt thead th { position: sticky; top: 0; background: var(--panel-alt); z-index: 2; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); text-align: left; }
.gantt .g-task { position: sticky; left: 0; background: var(--panel); z-index: 1; min-width: 190px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.gantt thead .g-task { z-index: 3; background: var(--panel-alt); }
.gantt .g-who, .gantt .g-dates { color: var(--muted); }
.gantt .g-h { text-align: right; }
.gantt .g-week, .gantt .g-cell { min-width: 62px; width: 62px; text-align: center; padding: .3rem .2rem; }
.gantt .g-week.today, .gantt .g-cell.today { box-shadow: inset 0 0 0 9999px rgba(37,99,235,.07); }
.gantt .g-week.due, .gantt .g-cell.due { background: rgba(239,68,68,.1); border-left: 2px solid #ef4444; }
.gantt .g-bar { display: block; border-radius: 5px; padding: .2rem .1rem; color: #fff; font-size: .72rem; font-weight: 600; min-height: 1.3rem; text-shadow: 0 0 2px rgba(0,0,0,.35); }
.gantt .g-bar.done { opacity: .45; }
.gantt tr.done .g-link { text-decoration: line-through; color: var(--muted); }
.gantt .g-link { background: none; border: none; color: var(--text); font: inherit; cursor: pointer; text-align: left; padding: 0; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.gantt .g-link:disabled { cursor: default; }
.gantt .g-link:not(:disabled):hover { color: var(--primary); text-decoration: underline; }
.gantt tfoot td { background: var(--panel-alt); font-weight: 600; }
.gantt tfoot .g-task { background: var(--panel-alt); }

/* Calendario: interruptor y calendario de proyectos */
.cal-mode { margin-bottom: 1rem; flex-wrap: wrap; }
.pcal-head, .pcal-body { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.pcal-head { background: var(--panel-alt); border: 1px solid var(--border); border-bottom: none; border-radius: 12px 12px 0 0; }
.pcal-head span { padding: .45rem; text-align: center; font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.pcal-body { border: 1px solid var(--border); border-radius: 0 0 12px 12px; overflow: hidden; background: var(--panel); }
.pcal-day { min-height: 108px; padding: .3rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pcal-day:nth-child(7n) { border-right: none; }
.pcal-day.out { background: var(--panel-alt); opacity: .65; }
.pcal-day.nw { background: repeating-linear-gradient(45deg, rgba(100,116,139,.1), rgba(100,116,139,.1) 6px, transparent 6px, transparent 12px); }
.pcal-day.hol { background: rgba(245,158,11,.12); }
.pcal-num { font-size: .78rem; color: var(--muted); font-weight: 600; align-self: flex-end; width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 50%; }
.pcal-day.today .pcal-num { background: var(--primary); color: #fff; }
.pcal-chip, .pcal-mark {
    display: block; width: 100%; text-align: left; border: none; cursor: pointer; font: inherit; font-size: .72rem; line-height: 1.25;
    padding: .15rem .35rem; border-radius: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 1.15rem;
}
.pcal-chip { background: color-mix(in srgb, var(--c) 28%, var(--panel)); color: var(--text); border-left: 3px solid var(--c); }
.pcal-chip.cont { border-radius: 0; margin-left: -.3rem; width: calc(100% + .6rem); }
.pcal-chip.done { opacity: .55; text-decoration: line-through; }
.pcal-chip:hover, .pcal-mark:hover { filter: brightness(1.15); }
.pcal-mark { background: transparent; color: var(--text); border: 1px dashed var(--c); font-weight: 600; }
.pcal-mark.due { background: color-mix(in srgb, var(--c) 18%, var(--panel)); }
.pcal-more { font-size: .7rem; color: var(--muted); padding-left: .35rem; }
.pcal-agenda-title { margin: 1.4rem 0 .6rem; font-size: 1rem; }
.pcal-agenda { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.pcal-ag-row {
    display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 2fr) minmax(0, 2fr); gap: .8rem; align-items: center; width: 100%;
    padding: .6rem 1rem; border: none; border-bottom: 1px solid var(--border); background: none; color: var(--text); font: inherit; font-size: .86rem; text-align: left;
}
button.pcal-ag-row { cursor: pointer; }
button.pcal-ag-row:hover { background: var(--row-hover); }
.pcal-ag-row:last-child { border-bottom: none; }
.pcal-ag-row.done .ag-main { text-decoration: line-through; color: var(--muted); }
.pcal-ag-row.ms { background: var(--panel-alt); }
.pcal-ag-row small, .ag-meta { color: var(--muted); }
.ag-date { font-weight: 600; }

@media (max-width: 860px) {
    .pcal-day { min-height: 76px; }
    .pcal-chip, .pcal-mark { font-size: .66rem; }
    .pcal-ag-row { grid-template-columns: 1fr; gap: .15rem; }
}
.pcal-chip.done.cont { text-decoration: none; }

/* ======================================================================
   Gantt como mapa de semanas (arrastrar para programar)
   ====================================================================== */
.g-toolbar { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: .8rem; }
.g-tools { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.g-tools .chk { font-size: .82rem; color: var(--muted); display: inline-flex; gap: .3rem; align-items: center; }
.gantt-map { border-collapse: separate; border-spacing: 0; font-size: .8rem; min-width: 100%; user-select: none; -webkit-user-select: none; }
.gantt-map th, .gantt-map td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: center; padding: 0; }
.gantt-map thead th { height: 29px; box-sizing: border-box; background: var(--panel-alt); color: var(--text); font-weight: 700; padding: .35rem .3rem; position: sticky; z-index: 2; }
.gantt-map thead tr:nth-child(1) th { top: 0; background: #2fa8c9; color: #fff; letter-spacing: .06em; }
.gantt-map thead tr:nth-child(2) th { top: 29px; background: #a9d9e6; color: #0f3d4d; text-transform: capitalize; }
.gantt-map thead tr:nth-child(3) th { top: 58px; font-size: .75rem; min-width: 46px; width: 46px; }
html[data-theme="dark"] .gantt-map thead tr:nth-child(2) th { background: #2b5a69; color: #e6f6fb; }
.gantt-map .g-corner { background: #2fa8c9 !important; color: #fff; letter-spacing: .06em; left: 0; z-index: 4; top: 0; min-width: 240px; vertical-align: middle; }
.gantt-map .g-week i { display: block; font-style: normal; font-size: .7rem; line-height: 1; }
.gantt-map .g-task { position: sticky; left: 0; z-index: 1; background: var(--panel); text-align: left; padding: .35rem .5rem; min-width: 240px; max-width: 300px; border-right: 2px solid var(--border); }
.gantt-map tbody .g-task { display: table-cell; }
.gantt-map .g-task { white-space: normal; }
.gantt-map tbody td.g-task > * { vertical-align: middle; }
.g-lbl { display: inline-flex; flex-direction: column; max-width: 150px; min-width: 0; margin: 0 .3rem; }
.g-lbl small { color: var(--muted); font-size: .7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-map .g-link { background: none; border: none; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-align: left; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.gantt-map .g-link:disabled { cursor: default; }
.gantt-map .g-link:not(:disabled):hover { color: var(--primary); text-decoration: underline; }
.gantt-map tr.done .g-link { text-decoration: line-through; color: var(--muted); }
.g-color { width: 20px; height: 20px; padding: 0; border: 2px solid var(--c, var(--border)); border-radius: 50%; background: none; cursor: pointer; vertical-align: middle; }
.g-color::-webkit-color-swatch-wrapper { padding: 0; } .g-color::-webkit-color-swatch { border: none; border-radius: 50%; }
.g-sw { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--c); vertical-align: middle; }
.g-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: .8rem; padding: .1rem .3rem; border-radius: 4px; opacity: 0; float: right; margin-top: .25rem; }
.gantt-map tr:hover .g-x, .g-x:focus-visible { opacity: 1; }
.g-x:hover { color: var(--danger); background: var(--panel-alt); }
.gantt-map tbody tr { height: 44px; }
.gantt-map td.g-cell { min-width: 46px; width: 46px; height: 44px; background: var(--panel); font-size: .7rem; font-weight: 700; color: #fff; position: relative; }
.gantt-map.edit td.g-cell:not(.tot) { cursor: cell; touch-action: pan-y; }
.gantt-map.edit td.g-cell:not(.tot):not(.g-on):hover { background: color-mix(in srgb, var(--primary) 12%, var(--panel)); }
.gantt-map td.g-on { background: var(--c); text-shadow: 0 0 2px rgba(0,0,0,.4); border-right-color: color-mix(in srgb, var(--c) 70%, #000); }
.gantt-map.edit td.g-on { cursor: grab; }
.gantt-map td.g-on.done { opacity: .5; }
.gantt-map td.g-on.g-prev { opacity: .8; outline: 2px dashed rgba(255,255,255,.65); outline-offset: -3px; }
.gantt-map.edit td.g-first::before, .gantt-map.edit td.g-last::after { content: ""; position: absolute; top: 6px; bottom: 6px; width: 5px; background: rgba(255,255,255,.55); border-radius: 3px; cursor: ew-resize; }
.gantt-map.edit td.g-first::before { left: 2px; } .gantt-map.edit td.g-last::after { right: 2px; }
.gantt-map td.g-cell.today:not(.g-on), .gantt-map th.g-week.today { box-shadow: inset 0 0 0 9999px rgba(37,99,235,.09); }
.gantt-map td.g-cell.due, .gantt-map th.g-week.due { border-left: 2px solid #ef4444; }
.gantt-map tfoot td { background: var(--panel-alt); font-weight: 700; color: var(--text); height: 34px; }
.gantt-map tfoot .g-task { text-align: left; }
.g-dragging, .g-dragging * { cursor: grabbing !important; }
.gantt-map thead tr:nth-child(2) th { text-transform: none; }
.gantt-map thead tr:nth-child(2) th::first-letter { text-transform: uppercase; }

/* ======================================================================
   Estatus de proyectos, filtros, post-its, disponibilidad y Equipo
   ====================================================================== */
.badge[class*="st-"] { font-size: .72rem; padding: .1rem .5rem; border-radius: 999px; font-weight: 700; white-space: nowrap; }
.badge.st-Active { background: rgba(34,197,94,.18); color: #15803d; }
.badge.st-Planned { background: rgba(59,130,246,.18); color: #1d4ed8; }
.badge.st-OnHold { background: rgba(245,158,11,.2); color: #b45309; }
.badge.st-Completed { background: rgba(100,116,139,.25); color: #475569; }
.badge.st-Cancelled { background: rgba(239,68,68,.18); color: #b91c1c; }
html[data-theme="dark"] .badge.st-Active { color: #4ade80; }
html[data-theme="dark"] .badge.st-Planned { color: #93c5fd; }
html[data-theme="dark"] .badge.st-OnHold { color: #fbbf24; }
html[data-theme="dark"] .badge.st-Completed { color: #cbd5e1; }
html[data-theme="dark"] .badge.st-Cancelled { color: #fca5a5; }

.pj-filters { flex-wrap: wrap; gap: .5rem; align-items: center; }
.pj-filters #pjFilterText { flex: 1 1 280px; min-width: 200px; }
.pj-daterange { display: inline-flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.pj-daterange .tb-input { width: 138px; }
.pj-row { grid-template-columns: minmax(220px, 2fr) minmax(100px, 1fr) minmax(170px, 1.4fr) minmax(100px, .9fr) minmax(140px, 1.2fr) minmax(110px, 1fr); min-width: 960px; }
.pj-row.closed:not(.pj-head-row) { opacity: .72; }
.pj-name .btn-link { font-size: .78rem; }
.pj-dates { display: flex; flex-direction: column; gap: 1px; align-items: flex-start; font-size: .82rem; }
.pj-d small { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; margin-right: .25rem; }
.pj-dates > small { font-size: .75rem; font-weight: 600; }
.pj-dates > small.bad, .pj-dates > small.good { display: block; }
.pj-head-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

/* Post-its */
.pn-composer { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: .8rem; margin-bottom: 1.2rem; }
.pn-composer textarea, .postit textarea { width: 100%; resize: vertical; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-alt); color: var(--text); font: inherit; }
.pn-row { display: flex; align-items: center; gap: .8rem; justify-content: flex-end; flex-wrap: wrap; margin-top: .6rem; }
.pn-swatches { display: flex; gap: .35rem; margin-right: auto; }
.pn-sw { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(0,0,0,.2); cursor: pointer; }
.pn-sw.on { outline: 2px solid var(--primary); outline-offset: 2px; }
.postit-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 1.1rem; padding: .3rem; }
.postit {
    position: relative; min-height: 150px; padding: 1rem 1rem .6rem; color: #1f2937; border-radius: 3px 3px 12px 3px;
    box-shadow: 0 6px 14px rgba(0,0,0,.22), inset 0 -18px 24px -18px rgba(0,0,0,.12); transform: rotate(var(--rot, 0deg));
    display: flex; flex-direction: column; transition: transform .15s;
}
.postit:hover { transform: rotate(0) scale(1.02); z-index: 1; }
.postit.editing { transform: none; }
.postit textarea { background: rgba(255,255,255,.55); color: #1f2937; border-color: rgba(0,0,0,.2); }
.pn-text { flex: 1; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .92rem; line-height: 1.4; }
.pn-foot { display: flex; justify-content: space-between; align-items: center; gap: .4rem; margin-top: .6rem; color: rgba(31,41,55,.75); }
.pn-actions button { background: none; border: none; cursor: pointer; padding: .1rem .25rem; border-radius: 4px; font-size: .9rem; color: #1f2937; }
.pn-actions button:hover { background: rgba(0,0,0,.12); }
.pn-pin { position: absolute; top: -10px; right: 12px; font-size: 1.3rem; filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); }
.postit .btn-link { color: #1f2937; }

/* Botón de disponibilidad (barra lateral) */
.presence-wrap { position: relative; padding: .5rem 1rem; }
.presence-btn {
    width: 100%; display: flex; align-items: center; gap: .55rem; padding: .55rem .8rem; border-radius: 10px; cursor: pointer; font: inherit; font-size: .88rem;
    color: #fff; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.18); text-align: left;
}
.presence-btn:hover, .presence-btn:focus-visible { background: rgba(255,255,255,.12); outline: none; }
.p-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-caret { opacity: .7; }
.p-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; display: inline-block; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.25); }
.presence-btn.away .p-dot, .p-dot.away { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.28); }
.presence-btn.offline .p-dot, .p-dot.offline { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.28); }
.p-dot.available { background: #22c55e; }
.presence-menu {
    position: absolute; left: 1rem; right: 1rem; bottom: calc(100% - .2rem); z-index: 60; background: var(--panel); color: var(--text);
    border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.4); padding: .5rem; min-width: 240px;
}
.pm-item { width: 100%; display: flex; align-items: center; gap: .6rem; background: none; border: none; color: inherit; font: inherit; font-size: .88rem; padding: .5rem .6rem; border-radius: 8px; cursor: pointer; text-align: left; }
.pm-item:hover { background: var(--panel-alt); }
.pm-sep { height: 1px; background: var(--border); margin: .4rem 0; }
.pm-title { display: flex; align-items: center; gap: .6rem; font-size: .8rem; color: var(--muted); padding: .2rem .6rem; font-weight: 600; }
.pm-chips { display: flex; flex-wrap: wrap; gap: .35rem; padding: .3rem .4rem; }
.pm-chip { background: var(--panel-alt); border: 1px solid var(--border); color: inherit; font: inherit; font-size: .8rem; padding: .3rem .6rem; border-radius: 999px; cursor: pointer; }
.pm-chip:hover { border-color: #f59e0b; background: rgba(245,158,11,.14); }
.pm-custom { display: flex; gap: .4rem; padding: .3rem .4rem .1rem; }
.pm-custom input { flex: 1; min-width: 0; padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-alt); color: var(--text); font: inherit; font-size: .85rem; }

/* Equipo */
.tm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 1rem; }
.tm-card { display: flex; gap: .9rem; background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: 12px; padding: .9rem 1rem; }
.tm-msg-btn {
    margin-left: auto; align-self: flex-start; width: 30px; height: 30px; flex-shrink: 0;
    border: 1px solid var(--border); border-radius: 50%; background: var(--panel-alt); color: var(--primary);
    cursor: pointer; font-size: .9rem; line-height: 1; padding: 0;
}
.tm-msg-btn:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--panel-alt)); }
.tm-card.available { border-left-color: #22c55e; }
.tm-card.away { border-left-color: #f59e0b; }
.tm-card.offline { border-left-color: #ef4444; opacity: .85; }
.tm-card.me { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 45%, transparent); }
.tm-avatar { position: relative; flex-shrink: 0; width: 46px; height: 46px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .9rem; }
.tm-dot { position: absolute; right: -2px; bottom: -2px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--panel); background: #22c55e; }
.tm-dot.away { background: #f59e0b; } .tm-dot.offline { background: #ef4444; }
.tm-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.tm-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-tagline {
    font-size: .78rem; font-style: italic; color: var(--muted); line-height: 1.25;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tm-status { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin: .2rem 0; }
.tm-badge { font-size: .72rem; font-weight: 700; padding: .12rem .55rem; border-radius: 999px; }
.tm-badge.available { background: rgba(34,197,94,.18); color: #15803d; }
.tm-badge.away { background: rgba(245,158,11,.22); color: #b45309; }
.tm-badge.offline { background: rgba(239,68,68,.18); color: #b91c1c; }
html[data-theme="dark"] .tm-badge.available { color: #4ade80; } html[data-theme="dark"] .tm-badge.away { color: #fbbf24; } html[data-theme="dark"] .tm-badge.offline { color: #fca5a5; }
.tm-track { font-size: .72rem; color: var(--muted); }
.tm-note { font-size: .88rem; font-style: italic; padding: .25rem .5rem; background: rgba(245,158,11,.12); border-radius: 6px; overflow-wrap: anywhere; }
.tm-note.off { background: var(--panel-alt); }
.tm-count.available { color: #22c55e; font-weight: 700; } .tm-count.away { color: #f59e0b; font-weight: 700; } .tm-count.offline { color: #ef4444; font-weight: 700; }

@media (max-width: 860px) {
    .presence-wrap { order: 2; padding: .3rem .4rem; flex: 0 1 auto; max-width: 46%; }
    .presence-btn { padding: .4rem .55rem; font-size: .8rem; }
    .presence-menu { position: fixed; left: .6rem; right: .6rem; top: 3.6rem; bottom: auto; }
    .theme-toggle-wrap { order: 3; } .sidebar-user { order: 4; } .sidebar-nav { order: 5 !important; }
}
.btn-primary.danger-btn { background: var(--danger); }
#confirmModal { z-index: 120; }
#confirmMsg { margin: .2rem 0 .4rem; line-height: 1.5; }

.pn-foot { flex-wrap: nowrap; }
.pn-foot small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pn-actions { display: inline-flex; flex-shrink: 0; }

/* Filtros de proyectos en cuadrícula */
.filter-bar.pj-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: .5rem; align-items: center; }
.pj-filters #pjFilterText { grid-column: 1 / -1; flex: none; width: 100%; }
.pj-filters select, .pj-filters .tb-input { width: 100%; min-width: 0; }
.pj-filters .pj-daterange { display: grid; grid-template-columns: minmax(90px, .8fr) 1fr 1fr; gap: .3rem; grid-column: span 2; }
.pj-filters .pj-daterange .tb-input { width: 100%; }
.pj-filters > .btn-ghost { justify-self: start; }
@media (max-width: 600px) { .pj-filters .pj-daterange { grid-column: 1 / -1; } }

/* ======================================================================
   Pila de cápsulas flotantes (asistencia, recordatorios, cronómetro)
   Por defecto quedan en su posición fija original. El modo arrastrable
   se activa desde Ajustes generales.
   ====================================================================== */
.float-caps { display: contents; }
.float-caps.drag-enabled {
    position: fixed; right: 20px; bottom: 20px; z-index: 90;
    display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
    max-width: calc(100vw - 40px); touch-action: none; user-select: none;
}
.float-caps.drag-enabled > .mini-timer,
.float-caps.drag-enabled > .rm-ticker,
.float-caps.drag-enabled > .att-cap {
    position: static !important; right: auto !important; bottom: auto !important;
    z-index: auto;
}
.float-caps.drag-enabled.dragging > * { cursor: grabbing !important; }
@media (max-width: 860px) {
    .float-caps.drag-enabled { right: 12px; bottom: 12px; gap: 8px; }
}
@media print { .float-caps { display: none !important; } }

/* Espacio extra de scroll cuando las cápsulas NO se pueden mover. */
body.caps-static-pad { --caps-extra-scroll: 190px; }
body.caps-static-pad .content {
    padding-bottom: calc(1.5rem + var(--caps-extra-scroll)) !important;
}
/* El Tablero no necesita ese espacio: sus controles están arriba y cada lista ya tiene scroll interno. */
body.caps-static-pad #boardsTab.board-open .content {
    padding-bottom: 0 !important;
}
body.caps-static-pad .cal-scroll {
    padding-bottom: var(--caps-extra-scroll);
}

/* ======================================================================
   Cronómetro flotante (visible fuera del Contador de tiempo)
   ====================================================================== */
.mini-timer {
    position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; align-items: center; gap: .6rem;
    padding: .5rem .9rem .5rem .55rem; border-radius: 999px; cursor: pointer; border: 1px solid var(--border);
    background: var(--panel); color: var(--text); box-shadow: 0 10px 30px rgba(0,0,0,.35); font: inherit; max-width: min(340px, calc(100vw - 40px));
    animation: mini-in .18s ease; transition: transform .12s, box-shadow .12s;
}
.mini-timer:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(0,0,0,.42); }
@keyframes mini-in { from { transform: translateY(14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.mini-play {
    flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; background: var(--danger); color: #fff;
    display: grid; place-items: center; font-size: 1rem; line-height: 1; box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.mini-play::after { content: ""; }
.mini-timer.busy .mini-play { opacity: .6; cursor: progress; }
.mini-timer.busy { cursor: progress; }
.mini-body { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.mini-time { font-family: ui-monospace, Consolas, monospace; font-weight: 700; font-size: 1.15rem; }
.mini-time::before { content: "●"; color: var(--danger); font-size: .6rem; vertical-align: middle; margin-right: .35rem; animation: mini-pulse 1.6s infinite; }
@keyframes mini-pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.mini-desc { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 210px; }
.mini-desc:empty { display: none; }
.mini-grow { color: var(--muted); font-size: 1rem; flex-shrink: 0; margin-left: .1rem; }
@media (max-width: 860px) {
    .mini-timer { right: 12px; bottom: 12px; padding: .45rem .75rem .45rem .5rem; }
    .mini-desc { max-width: 130px; }
    .mini-grow { display: none; }
}
@media print { .mini-timer { display: none !important; } }

/* El flotante sin cronómetro: botón de iniciar en azul y sin el punto rojo */
.mini-timer.idle .mini-play { background: var(--primary); }
.mini-timer.idle .mini-time::before { display: none; }
.mini-timer.idle .mini-time { color: var(--muted); }

/* Panel del cronómetro flotante */
.mini-panel {
    position: fixed; right: 20px; bottom: 76px; z-index: 95; width: min(380px, calc(100vw - 32px));
    background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 16px;
    box-shadow: 0 18px 48px rgba(0,0,0,.45); padding: 1rem 1.1rem 1.1rem; animation: mini-in .16s ease;
}
.mini-panel.hidden { display: none; }
.mini-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.mini-panel-head h3 { font-size: 1rem; }
.mini-panel-x { background: none; border: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: .2rem .4rem; border-radius: 6px; }
.mini-panel-x:hover { background: var(--panel-alt); color: var(--text); }
.mini-panel-timer { display: flex; align-items: center; justify-content: space-between; gap: .8rem; background: var(--panel-alt); border: 1px solid var(--border); border-radius: 12px; padding: .5rem .8rem; margin-bottom: .8rem; }
.mini-panel-time { font-family: ui-monospace, Consolas, monospace; font-size: 1.6rem; font-weight: 700; }
.mini-panel label { display: block; font-size: .8rem; color: var(--muted); margin: .6rem 0 .25rem; }
.mini-panel input[type=text], .mini-panel select {
    width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit;
}
.mini-panel .toggle-row { display: flex; align-items: center; justify-content: space-between; margin-top: .8rem; }
.mini-panel .toggle-row label, .mini-panel label.toggle-row { margin: 0; }
.mini-panel-foot { display: flex; justify-content: flex-end; margin-top: .6rem; }
@media (max-width: 860px) {
    .mini-panel { right: 10px; left: 10px; width: auto; bottom: 68px; }
}

/* ======================================================================
   Autocompletado de descripción (sugiere entradas previas)
   ====================================================================== */
.ac-anchor { position: relative; display: block; }
.timer-bar .task-input.ac-anchor { flex: 1 1 240px; min-width: 180px; padding: 0; border: none; background: none; }
.ac-input {
    width: 100%; padding: .6rem .9rem; border: 1px solid var(--border); border-radius: 8px;
    background: var(--panel); color: var(--text); font: inherit;
}
.ac-box {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 70; max-height: 300px; overflow-y: auto;
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 14px 34px rgba(0,0,0,.4); padding: .25rem;
}
.ac-box.hidden { display: none; }
.ac-item {
    width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto;
    column-gap: .6rem; row-gap: .1rem; align-items: center;
    background: none; border: none; cursor: pointer; text-align: left; font: inherit; color: var(--text); padding: .45rem .55rem; border-radius: 8px;
}
.ac-item:hover, .ac-item.active { background: var(--panel-alt); }
.ac-desc { grid-column: 1; grid-row: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-meta { grid-column: 1; grid-row: 2; font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; min-width: 0; }
.ac-meta .ac-proj { display: inline-flex; align-items: center; gap: .3rem; }
.ac-meta .proj-dot { width: 9px; height: 9px; }
.ac-use { grid-column: 2; grid-row: 1 / span 2; align-self: center; justify-self: end; font-size: .72rem; color: var(--primary); border: 1px solid var(--border); border-radius: 999px; padding: .1rem .55rem; white-space: nowrap; }
.ac-item:hover .ac-use, .ac-item.active .ac-use { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, transparent); }

/* ======================================================================
   Avatar e imagen de perfil + panel de perfil
   ====================================================================== */
.avatar.has-img, .tm-avatar.has-img { padding: 0; }
.avatar img, .tm-avatar img, .pf-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar .av-emoji, .tm-avatar .av-emoji, .pf-avatar .av-emoji { font-size: 1.15em; line-height: 1; }
.avatar-btn { border: none; cursor: pointer; padding: 0; font: inherit; overflow: hidden; }
.avatar-btn:hover { box-shadow: 0 0 0 2px var(--primary); }
.tm-avatar { overflow: visible; }
.tm-avatar img { position: absolute; inset: 0; }

.pf-preview { display: flex; align-items: center; gap: .9rem; margin-bottom: 1rem; }
.pf-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 1.4rem; overflow: hidden; flex-shrink: 0; }
.pf-prevname { font-weight: 700; font-size: 1.05rem; }
.pf-tagline-preview { font-size: .82rem; font-style: italic; color: var(--muted); margin-top: 1px; overflow-wrap: anywhere; }
#profileModal label { display: block; font-size: .8rem; color: var(--muted); margin: .7rem 0 .3rem; }
#profileModal input[type=text] { width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; }
.pf-tabs { display: flex; gap: .4rem; margin: .6rem 0 .5rem; }
.pf-tab { flex: 1; padding: .45rem; border: 1px solid var(--border); background: var(--panel-alt); color: var(--muted); border-radius: 8px; cursor: pointer; font: inherit; font-weight: 600; }
.pf-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pf-sublabel { margin-top: .6rem; }
.pf-emojis { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: .4rem; max-height: 160px; overflow-y: auto; }
.pf-emoji { aspect-ratio: 1; border: 1px solid var(--border); background: var(--panel-alt); border-radius: 10px; cursor: pointer; font-size: 1.3rem; display: grid; place-items: center; }
.pf-emoji.none { font-size: .85rem; font-weight: 700; color: var(--muted); }
.pf-emoji:hover { border-color: var(--primary); }
.pf-emoji.on { outline: 2px solid var(--primary); outline-offset: 1px; }
.pf-colors { display: flex; flex-wrap: wrap; gap: .45rem; }
.pf-color { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(0,0,0,.15); cursor: pointer; padding: 0; position: relative; }
.pf-color.on { outline: 2px solid var(--text); outline-offset: 2px; }
.pf-color.custom { display: grid; place-items: center; overflow: hidden; }
.pf-color.custom::after { content: "✎"; color: #fff; font-size: .8rem; text-shadow: 0 0 2px rgba(0,0,0,.6); }
.pf-color.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pf-image-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.pf-hint { margin-top: .5rem; font-size: .78rem; }

/* ======================================================================
   Recordatorios: módulo y cápsula flotante
   ====================================================================== */
.rm-list { display: flex; flex-direction: column; gap: .6rem; }
.rm-card {
    display: flex; gap: .8rem; align-items: flex-start; background: var(--panel); border: 1px solid var(--border);
    border-left: 5px solid var(--c, var(--primary)); border-radius: 12px; padding: .8rem 1rem;
}
.rm-card.done { opacity: .6; }
.rm-card.done .rm-title { text-decoration: line-through; }
.rm-card.notToday { background: var(--panel-alt); }
.rm-check { padding-top: .15rem; }
.rm-check input { width: 20px; height: 20px; cursor: pointer; accent-color: var(--c, var(--primary)); }
.rm-check input:disabled { cursor: not-allowed; opacity: .4; }
.rm-main { flex: 1; min-width: 0; }
.rm-title-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.rm-title { font-size: 1rem; overflow-wrap: anywhere; }
.rm-collab { font-size: .74rem; background: color-mix(in srgb, var(--c, var(--primary)) 18%, transparent); padding: .1rem .5rem; border-radius: 999px; }
.rm-notes { font-size: .88rem; color: var(--muted); margin-top: .15rem; overflow-wrap: anywhere; }
.rm-meta { font-size: .8rem; color: var(--muted); margin-top: .3rem; display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.rm-sched { font-weight: 600; color: var(--text); }
.rm-time { font-family: ui-monospace, Consolas, monospace; background: var(--panel-alt); padding: 0 .35rem; border-radius: 4px; margin-right: .35rem; font-weight: 700; }
.rm-actions { display: flex; gap: .1rem; flex-shrink: 0; }
.rm-seg { margin-bottom: .6rem; flex-wrap: wrap; }
.rm-dows { display: flex; gap: .7rem; flex-wrap: wrap; margin: .3rem 0 .6rem; }
.rm-dows .chk { margin: 0; display: inline-flex; align-items: center; gap: .3rem; font-size: .85rem; color: var(--text); }
.rm-share { margin-top: .3rem; }
.rm-share-chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .5rem; }
.rm-chip { display: inline-flex; align-items: center; gap: .35rem; background: var(--panel-alt); border: 1px solid var(--border); border-radius: 999px; padding: .15rem .3rem .15rem .65rem; font-size: .82rem; }
.rm-chip button { background: none; border: none; cursor: pointer; color: var(--muted); border-radius: 50%; width: 20px; height: 20px; }
.rm-chip button:hover { background: var(--border); color: var(--text); }

/* Cápsula flotante: debajo del cronómetro */
.rm-ticker {
    position: fixed; right: 20px; bottom: 20px; z-index: 89; display: flex; align-items: center; gap: .6rem; cursor: pointer;
    max-width: min(340px, calc(100vw - 40px)); padding: .5rem .9rem .5rem .6rem; border-radius: 999px; font: inherit; color: var(--text);
    background: var(--panel); border: 1px solid var(--border); border-left: 5px solid var(--c, var(--primary)); box-shadow: 0 10px 28px rgba(0,0,0,.35);
}
.rm-ticker.hidden { display: none; }
.rm-ticker:hover { transform: translateY(-2px); }
.rt-bell { font-size: 1.15rem; line-height: 1; }
.rt-body { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; text-align: left; }
.rt-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.rt-title { font-weight: 600; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.rt-count { font-size: .75rem; font-weight: 700; color: #fff; background: var(--c, var(--primary)); border-radius: 999px; padding: .05rem .45rem; flex-shrink: 0; }
.rt-count:empty { display: none; }
.rm-ticker.rt-pop { animation: rt-pop .7s ease; }
@keyframes rt-pop {
    0% { transform: translateY(18px) scale(.9); opacity: 0; }
    45% { transform: translateY(-6px) scale(1.04); opacity: 1; }
    60% { transform: rotate(-2.5deg); } 72% { transform: rotate(2deg); } 84% { transform: rotate(-1deg); }
    100% { transform: none; }
}
.rm-ticker .rt-bell { animation: rt-ring 4.5s ease-in-out infinite; transform-origin: 50% 100%; display: inline-block; }
@keyframes rt-ring { 0%, 86%, 100% { transform: rotate(0); } 89% { transform: rotate(16deg); } 92% { transform: rotate(-14deg); } 95% { transform: rotate(8deg); } 98% { transform: rotate(-4deg); } }
@media (prefers-reduced-motion: reduce) { .rm-ticker.rt-pop, .rm-ticker .rt-bell { animation: none; } }

/* Con la cápsula visible, el cronómetro flotante y su panel suben para quedar encima */
body.has-rm-ticker .mini-timer { bottom: 76px; }
body.has-rm-ticker .mini-panel { bottom: 132px; }
@media (max-width: 860px) {
    .rm-ticker { right: 12px; bottom: 12px; }
    body.has-rm-ticker .mini-timer { bottom: 66px; }
    body.has-rm-ticker .mini-panel { bottom: 122px; }
    .rt-title { max-width: 150px; }
}
@media print { .rm-ticker { display: none !important; } }

/* Campos del formulario de recordatorios con el mismo estilo que el resto */
#reminderModal input[type=text], #reminderModal input[type=date], #reminderModal input[type=time], #reminderModal select {
    width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit;
}
#reminderModal label { display: block; font-size: .8rem; color: var(--muted); margin: .7rem 0 .25rem; }
#reminderModal .rm-dows label.chk { display: inline-flex; margin: 0; color: var(--text); }
#reminderModal input[type=color] { width: 56px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); cursor: pointer; }
html[data-theme="dark"] #reminderModal input[type=time], html[data-theme="dark"] #reminderModal input[type=date] { color-scheme: dark; }

/* ======================================================================
   Notificaciones (campana) y mensajes (chat)
   ====================================================================== */
.sidebar-brand .brand-name { white-space: nowrap; }
.inbox-icons { margin-left: auto; display: inline-flex; gap: .2rem; }
.inbox-btn {
    position: relative; background: none; border: none; cursor: pointer; color: #fff;
    width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem;
}
.inbox-btn:hover, .inbox-btn[aria-expanded="true"] { background: rgba(255,255,255,.14); }
.inbox-btn:focus-visible { outline: 2px solid #93c5fd; outline-offset: 1px; }
.inbox-ico { line-height: 1; }
.inbox-badge {
    position: absolute; top: 1px; right: 0; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px;
    background: #ef4444; color: #fff; font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center;
    box-shadow: 0 0 0 2px var(--sidebar-bg);
}

.inbox-panel {
    position: fixed; z-index: 90; top: 12px; left: 252px; width: 400px; max-width: calc(100vw - 24px);
    height: min(640px, calc(100dvh - 24px)); display: flex; flex-direction: column;
    background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 18px 48px rgba(0,0,0,.35); overflow: hidden; animation: mini-in .16s ease;
}
.inbox-panel.hidden { display: none; }
.chat-view { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.chat-view.hidden { display: none; }
.ip-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .7rem .9rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ip-head h3 { font-size: 1rem; margin: 0; }
.ip-actions { display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.ip-tabs { display: flex; gap: .3rem; padding: .5rem .9rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ip-tab { background: none; border: 1px solid transparent; border-radius: 999px; padding: .25rem .7rem; font: inherit; font-size: .8rem; color: var(--muted); cursor: pointer; }
.ip-tab:hover { background: var(--panel-alt); }
.ip-tab.active { background: var(--primary); color: #fff; }
.ip-tabcount { display: inline-block; min-width: 16px; padding: 0 4px; border-radius: 999px; background: #ef4444; color: #fff; font-size: .68rem; text-align: center; margin-left: .15rem; }
.ip-list { flex: 1; overflow-y: auto; min-height: 0; }
.ip-list .empty { padding: 2rem 1rem; }
.empty.small { padding: 1rem; font-size: .85rem; }
.ip-sec { display: flex; justify-content: space-between; align-items: center; padding: .45rem .9rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--panel-alt); }

/* Notificaciones */
.nf-item { display: flex; gap: .7rem; padding: .75rem .9rem; border-bottom: 1px solid var(--border); cursor: pointer; }
.nf-item:hover, .nf-item:focus-visible { background: var(--row-hover); outline: none; }
.nf-item.unread { background: rgba(37, 99, 235, .07); }
.nf-ico { font-size: 1.25rem; line-height: 1.3; flex-shrink: 0; }
.nf-main { flex: 1; min-width: 0; }
.nf-title { font-weight: 600; font-size: .9rem; overflow-wrap: anywhere; }
.nf-item:not(.unread) .nf-title { font-weight: 500; }
.nf-body { color: var(--muted); font-size: .82rem; margin-top: .1rem; overflow-wrap: anywhere; }
.nf-meta { color: var(--muted); font-size: .74rem; margin-top: .2rem; }
.nf-actions { display: flex; gap: .5rem; margin-top: .5rem; }
.nf-actions .btn-ghost.danger { color: var(--danger); }
.nf-side { display: flex; flex-direction: column; align-items: center; gap: .25rem; flex-shrink: 0; }
.nf-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); display: block; margin-bottom: .1rem; }
.nf-btn { background: none; border: none; color: var(--muted); cursor: pointer; width: 26px; height: 26px; border-radius: 6px; font-size: .9rem; }
.nf-btn:hover { background: var(--panel-alt); color: var(--text); }
.badge.off { background: rgba(239,68,68,.15); color: var(--danger); }
.approval-toggle { display: flex; align-items: center; gap: .5rem; }

/* Lista de chats */
.chat-search { padding: .5rem .9rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.chat-search input { width: 100%; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; font-size: .88rem; }
.chat-item { display: flex; align-items: center; gap: .65rem; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--border); padding: .6rem .9rem; cursor: pointer; color: inherit; font: inherit; }
.chat-item:hover, .chat-item:focus-visible { background: var(--row-hover); outline: none; }
.chat-item.unread strong { color: var(--text); }
.chat-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.chat-item-top, .chat-item-bot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.chat-item-top strong { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-top small { color: var(--muted); font-size: .72rem; flex-shrink: 0; }
.chat-prev { color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chat-item.unread .chat-prev { color: var(--text); font-weight: 600; }
.chat-prev.muted { font-style: italic; }
.chat-unread { background: var(--primary); color: #fff; border-radius: 999px; font-size: .68rem; font-weight: 700; min-width: 18px; height: 18px; line-height: 18px; text-align: center; padding: 0 5px; flex-shrink: 0; }
.chat-hit mark, .chat-bubble mark { background: #fde047; color: #1f2937; border-radius: 2px; padding: 0 1px; }

/* Avatar en chats */
.chat-av { width: 38px; height: 38px; font-size: .85rem; flex-shrink: 0; position: relative; }
.chat-av.sm { width: 30px; height: 30px; font-size: .72rem; }
.chat-av.lg { width: 56px; height: 56px; font-size: 1.1rem; }
.chat-av-group { background: var(--primary-dark); font-size: 1.1rem; }
.chat-av-gap { width: 30px; flex-shrink: 0; }
.chat-av-wrap { position: relative; display: inline-flex; flex-shrink: 0; cursor: pointer; }
.chat-presence-dot {
    position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%;
    border: 2px solid var(--panel); background: #94a3b8;
}
.chat-presence-dot.available { background: #22c55e; }
.chat-presence-dot.away { background: #f59e0b; }
.chat-presence-dot.vacation { background: #3b82f6; }
.chat-presence-dot.offline { background: #ef4444; }
.chat-presence-dot.inline { position: static; width: 9px; height: 9px; border: 0; flex-shrink: 0; }

/* Conversación */
.chat-conv-head { gap: .4rem; }
.chat-conv-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: .55rem; }
.chat-conv-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.chat-conv-name strong { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-conv-name small { color: var(--muted); font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-messages { flex: 1; overflow-y: auto; min-height: 0; padding: .7rem .7rem .4rem; background: var(--panel-alt); display: flex; flex-direction: column; gap: 2px; }
.chat-day { text-align: center; margin: .6rem 0 .4rem; }
.chat-day span { background: var(--border); color: var(--muted); font-size: .72rem; padding: .15rem .7rem; border-radius: 999px; text-transform: capitalize; }
.chat-more { align-self: center; background: none; border: 1px solid var(--border); border-radius: 999px; color: var(--primary); cursor: pointer; font: inherit; font-size: .78rem; padding: .25rem .8rem; margin-bottom: .4rem; }
.chat-row { display: flex; align-items: flex-end; gap: .4rem; max-width: 100%; }
.chat-row.first { margin-top: .5rem; }
.chat-row.mine { justify-content: flex-end; }
.chat-bubble {
    max-width: min(78%, 300px); padding: .4rem .65rem .25rem; border-radius: 14px; font-size: .88rem; line-height: 1.35;
    background: var(--panel); border: 1px solid var(--border); overflow-wrap: anywhere; position: relative;
}
.chat-row.mine .chat-bubble { background: var(--primary); color: #fff; border-color: var(--primary); border-bottom-right-radius: 4px; }
.chat-row.theirs .chat-bubble { border-bottom-left-radius: 4px; }
.chat-bubble.deleted { opacity: .65; }
.chat-bubble.flash { animation: chat-flash 2.4s ease; }
@keyframes chat-flash { 0%, 60% { box-shadow: 0 0 0 3px #facc15; } 100% { box-shadow: 0 0 0 0 transparent; } }
.chat-who { font-size: .72rem; font-weight: 700; color: var(--primary); margin-bottom: .1rem; }
.chat-text { white-space: pre-wrap; }
.chat-bubble a { color: inherit; text-decoration: underline; }
.chat-meta { display: flex; justify-content: flex-end; align-items: center; gap: .3rem; font-size: .66rem; opacity: .75; margin-top: .1rem; }
.chat-seen { font-size: .62rem; white-space: nowrap; }
.chat-msg-actions { display: inline-flex; align-items: center; gap: .15rem; }
.chat-del, .chat-reply-btn { background: none; border: none; cursor: pointer; font-size: .72rem; padding: 0 .1rem; color: inherit; opacity: 0; }
.chat-row:hover .chat-del, .chat-del:focus-visible, .chat-row:hover .chat-reply-btn, .chat-reply-btn:focus-visible { opacity: 1; }
@media (hover: none) { .chat-del, .chat-reply-btn { opacity: .8; } }
.chat-quote {
    display: flex; flex-direction: column; gap: .1rem; width: 100%; text-align: left;
    background: rgba(0, 0, 0, .07); color: inherit; border: 0; border-left: 3px solid currentColor;
    border-radius: 0 8px 8px 0; padding: .25rem .45rem; margin-bottom: .3rem; cursor: pointer; font: inherit;
}
.chat-quote:hover { background: rgba(0, 0, 0, .12); }
.chat-row.mine .chat-quote { background: rgba(255, 255, 255, .18); }
.chat-row.mine .chat-quote:hover { background: rgba(255, 255, 255, .26); }
.chat-quote strong { font-size: .7rem; font-weight: 700; }
.chat-quote span { font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .9; }
.chat-imgs { display: grid; gap: 3px; margin-bottom: .3rem; grid-template-columns: 1fr; }
.chat-imgs.n2, .chat-imgs.n3, .chat-imgs.n4 { grid-template-columns: 1fr 1fr; }
.chat-img { padding: 0; border: none; background: rgba(0,0,0,.12); border-radius: 10px; overflow: hidden; cursor: zoom-in; min-height: 60px; }
.chat-img img { display: block; width: 100%; max-height: 220px; object-fit: cover; }
.chat-img-err { font-size: .75rem; opacity: .7; padding: .5rem; }
.chat-file { display: flex; align-items: center; gap: .55rem; width: 100%; text-align: left; background: rgba(0,0,0,.08); color: inherit; border: none; border-radius: 10px; padding: .45rem .6rem; margin-bottom: .3rem; cursor: pointer; font: inherit; }
.chat-row.mine .chat-file { background: rgba(255,255,255,.18); }
.chat-file-ico { font-size: 1.4rem; }
.chat-file-info { display: flex; flex-direction: column; min-width: 0; }
.chat-file-info strong { font-size: .82rem; overflow-wrap: anywhere; }
.chat-file-info small { opacity: .75; font-size: .7rem; }

/* Redactar */
.chat-pending { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; padding: .4rem .7rem; border-top: 1px solid var(--border); flex-shrink: 0; max-height: 96px; overflow-y: auto; }
.chat-pending.hidden, .chat-upload.hidden { display: none; }
.chat-chip { display: inline-flex; align-items: center; gap: .3rem; background: var(--panel-alt); border: 1px solid var(--border); border-radius: 999px; padding: .15rem .3rem .15rem .6rem; font-size: .76rem; max-width: 100%; }
.chat-chip-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-chip small, .chat-total { color: var(--muted); font-size: .7rem; }
.chat-chip button { background: none; border: none; cursor: pointer; color: var(--muted); border-radius: 50%; width: 20px; height: 20px; }
.chat-chip button:hover { background: var(--border); color: var(--text); }
.chat-upload { display: flex; align-items: center; gap: .6rem; padding: .3rem .7rem; font-size: .75rem; color: var(--muted); flex-shrink: 0; }
.chat-upload-bar { flex: 1; height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; }
.chat-upload-bar i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .15s; }
.chat-reply-preview { padding: .35rem .7rem; border-top: 1px solid var(--border); background: var(--panel); flex-shrink: 0; }
.chat-reply-preview.hidden { display: none; }
.chat-reply-inner { display: flex; align-items: center; gap: .5rem; background: var(--panel-alt); border: 1px solid var(--border); border-radius: 10px; padding: .35rem .5rem; }
.chat-reply-bar { width: 3px; align-self: stretch; background: var(--primary); border-radius: 99px; flex-shrink: 0; }
.chat-reply-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .05rem; }
.chat-reply-copy strong { font-size: .74rem; color: var(--primary); }
.chat-reply-copy span { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-reply-cancel { background: none; border: none; color: var(--muted); cursor: pointer; font-size: .8rem; padding: .1rem .2rem; border-radius: 6px; flex-shrink: 0; }
.chat-reply-cancel:hover { background: var(--border); color: var(--text); }
.chat-composer { display: flex; align-items: flex-end; gap: .4rem; padding: .55rem .6rem; border-top: 1px solid var(--border); background: var(--panel); flex-shrink: 0; }
.chat-composer textarea { flex: 1; resize: none; max-height: 120px; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 18px; background: var(--panel-alt); color: var(--text); font: inherit; font-size: .9rem; line-height: 1.3; }
.chat-attach, .chat-send { border: none; cursor: pointer; width: 36px; height: 36px; border-radius: 50%; font-size: 1rem; flex-shrink: 0; }
.chat-attach { background: var(--panel-alt); color: var(--text); }
.chat-attach:hover { background: var(--border); }
.chat-send { background: var(--primary); color: #fff; }
.chat-send:disabled { opacity: .5; cursor: progress; }

/* Ficha rápida del contacto */
.chat-contact-card {
    position: fixed; z-index: 125; width: 270px; max-width: calc(100vw - 20px);
    background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 16px 42px rgba(0, 0, 0, .35); padding: .85rem;
}
.chat-contact-card.hidden { display: none; }
.chat-contact-close { position: absolute; top: .25rem; right: .25rem; width: 24px; height: 24px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; font: inherit; font-size: .8rem; }
.chat-contact-close:hover { background: var(--panel-alt); color: var(--text); }
.chat-contact-head { display: flex; align-items: center; gap: .7rem; padding-right: 1.2rem; }
.chat-contact-id { min-width: 0; }
.chat-contact-id strong { display: block; font-size: .95rem; overflow-wrap: anywhere; }
.chat-contact-tagline { margin: .1rem 0 0; font-size: .78rem; font-style: italic; color: var(--muted); overflow-wrap: anywhere; }
.chat-contact-status { display: flex; align-items: center; gap: .4rem; margin-top: .65rem; font-size: .8rem; }
.chat-contact-note { margin: .45rem 0 0; font-size: .8rem; font-style: italic; color: var(--muted); background: var(--panel-alt); padding: .35rem .5rem; border-radius: 8px; overflow-wrap: anywhere; }

/* Grupos */
.cg-filter { width: 100%; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; margin-bottom: .4rem; }
.cg-people, .cg-members { max-height: 190px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.cg-person, .cg-member { display: flex !important; align-items: center; gap: .55rem; margin: 0 !important; padding: .4rem .6rem; border-bottom: 1px solid var(--border); font-size: .88rem; color: var(--text) !important; cursor: pointer; }
.cg-member { cursor: default; }
.cg-person:last-child, .cg-member:last-child { border-bottom: none; }
.cg-person small { display: block; color: var(--muted); font-size: .72rem; }
.cg-member-name { flex: 1; min-width: 0; }
.cg-admin { background: var(--panel-alt); border: 1px solid var(--border); border-radius: 999px; padding: 0 .4rem; }
.modal-card .cg-filter { width: 100%; }

/* Visor de imágenes */
.lightbox { background: rgba(0,0,0,.88); z-index: 120; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 90vh; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.lightbox-x { position: absolute; top: 14px; right: 18px; background: rgba(255,255,255,.15); color: #fff; border: none; width: 38px; height: 38px; border-radius: 50%; font-size: 1.1rem; cursor: pointer; }

/* Pantallas angostas: los paneles ocupan todo el ancho */
@media (max-width: 860px) {
    .inbox-panel { top: 8px; left: 8px; right: 8px; width: auto; max-width: none; height: calc(100dvh - 16px); }
}

/* Que campana y mensajes quepan en la barra lateral de 240 px */
@media (min-width: 861px) {
    .sidebar-brand { padding: 1.2rem .7rem 1.2rem .9rem; gap: .4rem; font-size: 1rem; }
    .sidebar-brand .brand-icon { width: 1.25rem; height: 1.25rem; }
    .inbox-icons { gap: 0; }
    .inbox-btn { width: 32px; height: 32px; }
}

/* ======================================================================
   Notas (post-it al estilo Keep)
   ====================================================================== */
.nt-filters { align-items: center; }
.nt-filters .nt-search { flex: 1 1 260px; }
.nt-date { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--muted); }
.nt-date .tb-input { min-width: 0; }
.nt-quick {
    display: block; width: min(600px, 100%); margin: 0 auto 1rem; text-align: left; cursor: text;
    background: var(--panel); color: var(--muted); border: 1px solid var(--border); border-radius: 10px;
    padding: .85rem 1rem; font: inherit; box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.nt-quick:hover, .nt-quick:focus-visible { box-shadow: 0 3px 12px rgba(0,0,0,.16); outline: none; }
.nt-grid { columns: 240px; column-gap: 1rem; }
.nt-grid .empty { column-span: all; }
.nt-card {
    break-inside: avoid; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .4rem;
    color: #1f2937; border: 1px solid rgba(0,0,0,.08); border-radius: 10px; padding: .8rem .9rem .55rem;
    cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.08); transition: box-shadow .12s, transform .12s; overflow: hidden;
}
.nt-card:hover, .nt-card:focus-visible { box-shadow: 0 6px 18px rgba(0,0,0,.18); outline: none; }
.nt-card:focus-visible { box-shadow: 0 0 0 2px var(--primary); }
.nt-card-imgs { display: grid; gap: 3px; margin: -.8rem -.9rem .2rem; position: relative; grid-template-columns: 1fr; }
.nt-card-imgs.n2, .nt-card-imgs.n3, .nt-card-imgs.n4 { grid-template-columns: 1fr 1fr; }
.nt-card-imgs.n3 img:first-child { grid-column: 1 / -1; }
.nt-card-imgs img { width: 100%; max-height: 220px; object-fit: cover; display: block; background: rgba(0,0,0,.06); min-height: 50px; }
.nt-more { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.6); color: #fff; border-radius: 999px; padding: 0 .5rem; font-size: .75rem; }
.nt-card-title { font-size: .98rem; font-weight: 700; overflow-wrap: anywhere; margin: 0; }
.nt-card-body { font-size: .88rem; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 16em; overflow: hidden; }
.nt-card-body.muted { color: #6b7280; font-style: italic; }
.nt-card mark { background: #facc15; color: inherit; border-radius: 2px; }
.nt-card-foot { display: flex; align-items: center; gap: .4rem; margin-top: .2rem; min-height: 28px; }
.nt-card-foot small { color: #4b5563; font-size: .72rem; }
.nt-badge { font-size: .72rem; background: rgba(0,0,0,.08); border-radius: 999px; padding: .05rem .5rem; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-card-actions { margin-left: auto; display: inline-flex; gap: .1rem; opacity: 0; transition: opacity .12s; }
.nt-card:hover .nt-card-actions, .nt-card:focus-within .nt-card-actions { opacity: 1; }
@media (hover: none) { .nt-card-actions { opacity: 1; } }
.nt-act { background: none; border: none; cursor: pointer; width: 28px; height: 28px; border-radius: 50%; font-size: .9rem; }
.nt-act:hover, .nt-act:focus-visible { background: rgba(0,0,0,.1); }
.nt-img-err { font-size: .75rem; color: #6b7280; padding: .5rem; }

/* Editor */
.modal-card.nt-editor {
    --nt-bg: #fef08a; background: var(--nt-bg); color: #1f2937; width: min(620px, 94vw);
    padding: 1rem 1.1rem .8rem; display: flex; flex-direction: column; gap: .4rem;
}
.nt-owner { font-size: .8rem; color: #374151; background: rgba(0,0,0,.07); border-radius: 8px; padding: .3rem .6rem; align-self: flex-start; }
.nt-title-input, .nt-body-input { width: 100%; background: transparent; border: none; color: #1f2937; font: inherit; padding: .3rem 0; }
.nt-title-input { font-size: 1.1rem; font-weight: 700; }
.nt-body-input { resize: none; min-height: 120px; line-height: 1.45; font-size: .95rem; }
.nt-title-input:focus, .nt-body-input:focus { outline: none; }
.nt-title-input::placeholder, .nt-body-input::placeholder { color: #6b7280; }
.nt-images { display: grid; gap: 4px; grid-template-columns: 1fr; }
.nt-images.n2 { grid-template-columns: 1fr 1fr; }
.nt-images.n3 { grid-template-columns: 1fr 1fr 1fr; }
.nt-images:empty { display: none; }
.nt-img { position: relative; border-radius: 8px; overflow: hidden; background: rgba(0,0,0,.06); }
.nt-img img { width: 100%; max-height: 260px; object-fit: cover; display: block; cursor: zoom-in; min-height: 50px; }
.nt-img.pending img { opacity: .85; cursor: default; }
.nt-img-x { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }
.nt-share { border-top: 1px solid rgba(0,0,0,.1); padding-top: .5rem; }
.nt-share-row { display: flex; gap: .5rem; }
.nt-share-row select { flex: 1; min-width: 0; }
.nt-share .muted { color: #4b5563; font-size: .82rem; }
.nt-editor .rm-chip { background: rgba(255,255,255,.55); border-color: rgba(0,0,0,.15); color: #1f2937; }
.nt-editor .error-msg { margin-top: 0; min-height: 0; }
.nt-toolbar { position: relative; display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; border-top: 1px solid rgba(0,0,0,.1); padding-top: .55rem; }
.nt-colors { display: inline-flex; gap: .2rem; flex-wrap: wrap; margin-right: .2rem; }
.nt-color { width: 21px; height: 21px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); cursor: pointer; padding: 0; }
.nt-color.active { box-shadow: 0 0 0 2px #1f2937; }
.nt-tool { background: none; border: none; cursor: pointer; width: 30px; height: 30px; border-radius: 50%; font-size: .95rem; }
.nt-tool:hover, .nt-tool:focus-visible { background: rgba(0,0,0,.1); }
.nt-spacer { flex: 1; }
.nt-toolbar small { color: #4b5563; font-size: .74rem; }
.nt-editor .btn-ghost { background: rgba(255,255,255,.6); color: #1f2937; border-color: rgba(0,0,0,.15); }
.nt-tool.active { background: rgba(0,0,0,.14); }

/* Notas: pin, personas con acceso y formato */
.nt-card { position: relative; }
.nt-card-foot { flex-wrap: wrap; row-gap: .15rem; }
.nt-card.pinned { box-shadow: inset 0 0 0 2px rgba(37,99,235,.38), 0 1px 3px rgba(0,0,0,.08); }
.nt-card-head { display: flex; align-items: flex-start; gap: .35rem; }
.nt-pin-flag { margin-left: auto; font-size: .8rem; line-height: 1; flex-shrink: 0; }
.nt-people { display: inline-flex; align-items: center; padding-left: 4px; }
.nt-people .nt-av-wrap { margin-left: -6px; }
.nt-people .nt-av-wrap:first-child { margin-left: 0; }
.nt-av-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.nt-av { width: 24px; height: 24px; font-size: .6rem; border: 2px solid rgba(255,255,255,.85); }
.nt-av-wrap .chat-presence-dot { width: 8px; height: 8px; border-width: 1px; border-color: rgba(255,255,255,.9); }
.nt-people-more {
    width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,.18); color: #1f2937;
    font-size: .62rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
    margin-left: -6px; border: 2px solid rgba(255,255,255,.85);
}
.nt-formatted { white-space: normal; }
.nt-formatted .nt-line { min-height: 1.15em; }
.nt-formatted a { color: #1d4ed8; text-decoration: underline; }
ul.blog-checklist { list-style: none; padding-left: 0; }
ul.blog-checklist li.done { opacity: .65; text-decoration: line-through; }
ul.blog-checklist .bl-check { margin-right: .35em; }

/* Menú pequeño de formato, oculto hasta pulsar "A" */
.nt-format-pop {
    position: absolute; left: .4rem; bottom: calc(100% + 6px); z-index: 30;
    display: flex; align-items: center; gap: .15rem; padding: .3rem;
    background: rgba(255,255,255,.97); border: 1px solid rgba(0,0,0,.15); border-radius: 9px;
    box-shadow: 0 10px 24px rgba(0,0,0,.2);
}
.nt-format-pop.hidden { display: none; }
.nt-fmt-wrap, .nt-more-wrap { position: relative; display: inline-flex; flex-shrink: 0; }
.nt-fmt-wrap .nt-format-pop { left: 0; right: auto; }
.nt-format-pop button {
    border: 1px solid transparent; background: none; color: #1f2937; cursor: pointer;
    border-radius: 5px; font: inherit; font-size: .82rem; padding: .25rem .42rem;
}
.nt-format-pop button:hover { background: rgba(0,0,0,.09); }
.nt-more-pop {
    position: absolute; left: .4rem; bottom: calc(100% + 6px); z-index: 30; min-width: 160px;
    display: flex; flex-direction: column; gap: .1rem; padding: .3rem;
    background: rgba(255,255,255,.97); border: 1px solid rgba(0,0,0,.15); border-radius: 9px;
    box-shadow: 0 10px 24px rgba(0,0,0,.2);
}
.nt-more-pop.hidden { display: none; }
.nt-more-wrap .nt-more-pop { left: 0; right: auto; }
.nt-more-pop button {
    border: none; background: none; text-align: left; cursor: pointer; color: #1f2937;
    border-radius: 6px; font: inherit; font-size: .82rem; padding: .4rem .5rem;
}
.nt-more-pop button:hover { background: rgba(0,0,0,.08); }
.nt-more-pop button.danger { color: #b91c1c; }

/* El modal de notas tiene fondo pastel: los controles deben integrarse con él. */
.modal-card.nt-editor .nt-title-input {
    width: 100%; padding: .3rem 0; border: none; border-radius: 0;
    background: transparent; color: #1f2937; font-size: 1.1rem; font-weight: 700;
}

.nt-share-modal { width: min(500px, 94vw); }
.nt-share-modal h3 { margin: 0 0 .2rem; }
.nt-share-modal #ntfShareSearch {
    width: 100%; padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 7px;
    background: var(--panel); color: var(--text); font: inherit; font-size: .82rem; margin-top: .4rem;
}
.nt-share-quick { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; margin-top: .5rem; }
.nt-share-picker {
    max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px;
    background: var(--panel-alt); padding: .25rem; margin-top: .5rem; display: flex; flex-direction: column; gap: .1rem;
}
.nt-share-group { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: .25rem .3rem .1rem; }
.nt-share-person { display: flex; align-items: center; gap: .45rem; padding: .22rem .35rem; border-radius: 6px; cursor: pointer; font-size: .82rem; }
.nt-share-person:hover { background: var(--row-hover); }
.nt-share-person input { flex-shrink: 0; }
.nt-share-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-share-name small { color: var(--muted); font-size: .72rem; }
.nt-team-ico {
    width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: .75rem; flex-shrink: 0;
}
.nt-share-chip { display: inline-flex; align-items: center; gap: .25rem; }
.nt-chip-av { width: 18px !important; height: 18px !important; font-size: .5rem !important; border: 1px solid rgba(0,0,0,.15); }

html[data-theme="dark"] .nt-card { border-color: rgba(255,255,255,.08); }
@media (max-width: 520px) {
    .nt-grid { columns: 1; }
    .nt-date { flex: 1 1 45%; }
    .nt-toolbar small { flex-basis: 100%; order: 10; }
}

/* ======================================================================
   Cápsula de asistencia (verde = entrada, roja = salida)
   Orden desde abajo: asistencia, recordatorios, cronómetro flotante.
   ====================================================================== */
.att-cap {
    position: fixed; right: 20px; bottom: 20px; z-index: 89; display: flex; align-items: center; gap: .6rem; cursor: pointer;
    max-width: min(340px, calc(100vw - 40px)); padding: .5rem 1rem .5rem .6rem; border-radius: 999px; font: inherit; color: #fff;
    border: none; box-shadow: 0 10px 28px rgba(0,0,0,.35); transition: transform .12s;
}
.att-cap.hidden { display: none; }
.att-cap:hover { transform: translateY(-2px); }
.att-cap:focus-visible { outline: 3px solid #fde047; outline-offset: 2px; }
.att-cap.att-in { background: #15803d; }
.att-cap.att-out { background: #b91c1c; }
.att-cap .rt-label { color: rgba(255,255,255,.85); }
.att-cap .rt-title { max-width: 260px; }
.att-cap-ico { font-size: 1.15rem; line-height: 1; }
.att-cap.att-out .att-cap-ico { animation: att-pulse 2s ease-in-out infinite; display: inline-block; }
@keyframes att-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.2); } }
.att-cap.rt-pop { animation: rt-pop .7s ease; }
@media (prefers-reduced-motion: reduce) { .att-cap.rt-pop, .att-cap.att-out .att-cap-ico { animation: none; } }
@media print { .att-cap { display: none !important; } }

body.has-att-cap .rm-ticker { bottom: 76px; }
body.has-att-cap .mini-timer { bottom: 76px; }
body.has-att-cap .mini-panel { bottom: 132px; }
body.has-att-cap.has-rm-ticker .mini-timer { bottom: 132px; }
body.has-att-cap.has-rm-ticker .mini-panel { bottom: 188px; }
@media (max-width: 860px) {
    .att-cap { right: 12px; bottom: 12px; }
    .att-cap .rt-title { max-width: 190px; }
    body.has-att-cap .rm-ticker { bottom: 66px; }
    body.has-att-cap .mini-timer { bottom: 66px; }
    body.has-att-cap .mini-panel { bottom: 122px; }
    body.has-att-cap.has-rm-ticker .mini-timer { bottom: 120px; }
    body.has-att-cap.has-rm-ticker .mini-panel { bottom: 176px; }
}

/* Administración: recordatorio de salida */
.co-row { flex-wrap: wrap; align-items: center; gap: .5rem; }
.co-row label { font-size: .82rem; color: var(--muted); }
.co-row .time24 { width: 76px; }
.co-row #coNote { flex: 1 1 180px; min-width: 0; }
.co-sub { font-size: .9rem; margin: 1.2rem 0 .5rem; }

.prefs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 1rem; margin: .7rem 0 1rem; }
.prefs-grid label { display: block; margin-bottom: .25rem; }
.prefs-sortable { display: flex; flex-direction: column; gap: .35rem; margin: .6rem 0 1rem; max-width: 680px; }
.prefs-item { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-alt); padding: .4rem .6rem; cursor: grab; }
.prefs-item.dragging { opacity: .45; }
.prefs-grip { color: var(--muted); cursor: grab; letter-spacing: -.1em; }
.prefs-icon { width: 1.4rem; text-align: center; }
.prefs-label { flex: 1; min-width: 0; font-size: .88rem; }
.prefs-move { display: inline-flex; gap: .15rem; }
.prefs-move button { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; color: var(--text); cursor: pointer; font: inherit; font-size: .78rem; padding: .1rem .4rem; }
.prefs-move button:hover { border-color: var(--primary); }
.prefs-move button:disabled { opacity: .35; cursor: not-allowed; }
.prefs-actions { align-items: center; }
.prefs-toggle { margin: .8rem 0 .2rem !important; }
.co-list { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-top: .6rem; }
.co-list:has(> p) { border: none; }
.co-head, .co-item { display: grid; grid-template-columns: minmax(0, 2fr) 70px minmax(0, 1.4fr) auto; gap: .6rem; align-items: center; padding: .5rem .8rem; font-size: .86rem; }
.co-head { background: var(--panel-alt); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.co-item { border-top: 1px solid var(--border); }
.co-item.now { background: rgba(34, 197, 94, .08); }
@media (max-width: 600px) {
    .co-head { display: none; }
    .co-item { grid-template-columns: 1fr auto; }
    .co-item > :nth-child(3) { grid-column: 1 / -1; }
}

/* ======================================================================
   Cuentas: pantalla de acceso, invitaciones y correo SMTP
   ====================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.auth-title { font-size: 1.05rem; margin: 0 0 .2rem; }
.auth-text { font-size: .86rem; color: var(--muted); line-height: 1.45; margin: 0 0 .3rem; }
.auth-link { align-self: center; font-size: .84rem; margin-top: .1rem; }
.auth-info { word-break: normal; font-size: .85rem; line-height: 1.4; }
.auth-info:empty { display: none; }
#authTabs.hidden { display: none; }

.inv-label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .3rem; }
.inv-label code { font-size: .78rem; }
.inv-text { width: 100%; resize: vertical; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; font-size: .9rem; }
.inv-row { flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .6rem; }
.inv-row label { font-size: .82rem; color: var(--muted); }
.inv-row #invJob { flex: 1 1 160px; min-width: 0; }
.inv-results:empty { display: none; }
.inv-sum { font-size: .88rem; font-weight: 600; margin: .4rem 0; }
.inv-res { font-size: .84rem; padding: .3rem .6rem; border-radius: 6px; margin-bottom: .25rem; }
.inv-res.bad { background: rgba(239,68,68,.1); }
.inv-res.warn { background: rgba(245,158,11,.12); }
.inv-list-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin: 1.2rem 0 .5rem; }
.inv-list-head h4 { font-size: .92rem; margin: 0; }
.inv-list { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.inv-list:has(> p) { border: none; }
.inv-head, .inv-item { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.2fr) minmax(0, 1.6fr) auto; gap: .7rem; align-items: center; padding: .55rem .8rem; font-size: .86rem; }
.inv-head { background: var(--panel-alt); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.inv-item { border-top: 1px solid var(--border); }
.inv-item small { font-size: .74rem; }
.inv-actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 700px) {
    .inv-head { display: none; }
    .inv-item { grid-template-columns: 1fr; gap: .25rem; }
    .inv-actions { justify-content: flex-start; }
}

.smtp-grid { display: grid; grid-template-columns: 190px minmax(0, 420px); gap: .55rem .8rem; align-items: center; margin: .6rem 0; }
.smtp-grid label { font-size: .84rem; color: var(--muted); }
.smtp-grid .chk { color: var(--text); }
.smtp-grid .tb-input { width: 100%; min-width: 0; }
@media (max-width: 600px) { .smtp-grid { grid-template-columns: 1fr; gap: .3rem; } .smtp-grid > span:empty { display: none; } }

/* ======================================================================
   Herramientas
   ====================================================================== */
.tool-pane code { font-size: .82em; }
.tool-row { display: flex; gap: .55rem; align-items: center; flex-wrap: wrap; margin: .7rem 0; }
.tool-row > label { font-size: .84rem; color: var(--muted); }
.tool-textarea {
    width: 100%; resize: vertical; padding: .7rem .8rem; border: 1px solid var(--border);
    border-radius: 10px; background: var(--panel); color: var(--text); font: inherit;
    font-size: .9rem; line-height: 1.45; tab-size: 4;
}
.tool-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.tool-textarea[readonly] { background: var(--panel-alt); }
.tool-output-text { min-height: 120px; }
.tool-status { font-size: .86rem; font-weight: 600; color: var(--muted); min-height: 1.2rem; }
.tool-status.ok { color: var(--green); }
.tool-status.err { color: var(--danger); }
.tool-output-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin: 1rem 0 .4rem; flex-wrap: wrap; }
.tool-output-head h4 { font-size: .9rem; }
.tool-code {
    margin: 0; padding: .8rem .9rem; border: 1px solid var(--border); border-radius: 10px;
    background: var(--panel-alt); color: var(--text); font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: .84rem; line-height: 1.5; min-height: 150px; max-height: 70vh; overflow: auto;
    resize: vertical; white-space: pre; tab-size: 2;
}
.tool-code:empty { display: none; }
.tool-pane-wrap { position: relative; }
.tool-pane-wrap.tool-fullscreen {
    position: fixed; inset: 0; z-index: 400; background: var(--bg); padding: 1rem 1.25rem;
    display: flex; flex-direction: column; gap: .5rem; overflow: hidden;
}
.tool-pane-wrap.tool-fullscreen .tool-textarea,
.tool-pane-wrap.tool-fullscreen .tool-code {
    flex: 1 1 auto; height: auto; min-height: 0; max-height: none; resize: none;
}
body.tool-fullscreen-open { overflow: hidden; }
.tool-code-lines { min-width: max-content; }
.tool-line { display: flex; align-items: flex-start; line-height: 1.5; }
.tool-gutter {
    display: inline-flex; align-items: center; gap: .2rem; min-width: 4.2em;
    padding-right: .55em; flex-shrink: 0; user-select: none; color: var(--muted);
}
.tool-ln { min-width: 2em; text-align: right; font-size: .78em; opacity: .72; }
.tool-fold {
    width: 16px; height: 16px; padding: 0; border: none; background: none;
    color: var(--muted); cursor: pointer; font-size: .72rem; line-height: 1; border-radius: 3px;
}
.tool-fold:hover { background: var(--row-hover); color: var(--text); }
.tool-fold-spacer { width: 16px; height: 16px; display: inline-block; flex-shrink: 0; }
.tool-line-code { flex: 1 1 auto; white-space: pre; }
.tool-line.folded .tool-line-code::after { content: ' …'; color: var(--muted); }
.tool-search { display: flex; align-items: center; gap: .35rem; margin: .55rem 0 .4rem; flex-wrap: wrap; }
.tool-search-input {
    flex: 1 1 200px; max-width: 380px; min-width: 140px; padding: .38rem .55rem;
    border: 1px solid var(--border); border-radius: 7px; background: var(--panel); color: var(--text);
    font: inherit; font-size: .82rem;
}
.tool-search-input:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.tool-search-count { font-size: .75rem; color: var(--muted); min-width: 40px; text-align: right; }
.tool-icon-btn {
    width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 6px;
    background: var(--panel); color: var(--text); cursor: pointer; font-size: .85rem; line-height: 1;
}
.tool-icon-btn:hover { border-color: var(--primary); background: var(--row-hover); }

/* Colores de sintaxis en la salida */
.tj-key, .tx-name { color: #1d4ed8; }
.tj-str, .tx-val { color: #047857; }
.tj-num, .tx-attr { color: #b45309; }
.tj-bool, .tx-cdata { color: #7c3aed; }
.tj-punct, .tx-comment, .tx-pi, .tx-doctype { color: #64748b; }
.tj-brace { color: #dc2626; font-weight: 700; cursor: pointer; border-radius: 3px; padding: 0 1px; }
.tx-comment { font-style: italic; }
.xml-tag { cursor: pointer; border-radius: 3px; }
.pair-hl { background: #fde047 !important; box-shadow: 0 0 0 1px #f59e0b; border-radius: 3px; }
.pair-hl, .pair-hl * { color: #111827 !important; }
.tool-code mark.tool-hit { background: #fde047; color: #111827; border-radius: 2px; padding: 0 1px; }
.tool-code mark.tool-hit.current { background: #fb923c; box-shadow: 0 0 0 1px #f97316; }
html[data-theme="dark"] .tj-key, html[data-theme="dark"] .tx-name { color: #7dd3fc; }
html[data-theme="dark"] .tj-str, html[data-theme="dark"] .tx-val { color: #86efac; }
html[data-theme="dark"] .tj-num, html[data-theme="dark"] .tx-attr { color: #fbbf24; }
html[data-theme="dark"] .tj-bool, html[data-theme="dark"] .tx-cdata { color: #c4b5fd; }
html[data-theme="dark"] .tj-punct, html[data-theme="dark"] .tx-comment,
html[data-theme="dark"] .tx-pi, html[data-theme="dark"] .tx-doctype { color: #94a3b8; }
.tool-invalid-char {
    background: var(--danger); color: #fff; border-radius: 3px; padding: 0 1px;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--danger) 40%, transparent);
}

/* --- Calculadora --- */
.calc-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: 1rem; align-items: start; }
.calc-box { min-width: 0; }
.calc-display {
    width: 100%; padding: .75rem .9rem; border: 1px solid var(--border); border-radius: 10px;
    background: var(--panel-alt); color: var(--text); font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 1.55rem; text-align: right; letter-spacing: .01em;
}
.calc-display:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.calc-preview { min-height: 1.35rem; text-align: right; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9rem; color: var(--muted); padding: .25rem .2rem; overflow-wrap: anywhere; }
.calc-preview.err { color: var(--danger); font-size: .8rem; }
.calc-keys { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .4rem; margin-top: .35rem; }
.calc-key {
    padding: .7rem .25rem; border: 1px solid var(--border); border-radius: 9px;
    background: var(--panel-alt); color: var(--text); cursor: pointer; font: inherit; font-weight: 600;
    font-size: .95rem; line-height: 1.1; transition: border-color .12s, background .12s, transform .05s;
}
.calc-key:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--panel-alt)); }
.calc-key:active { transform: scale(.97); }
.calc-key.fn { font-size: .8rem; color: var(--primary); }
.calc-key.op { color: var(--primary); }
.calc-key.danger { color: var(--danger); }
.calc-key.eq { background: var(--primary); border-color: var(--primary); color: #fff; }
.calc-key.eq:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.calc-eq-tall { grid-row: span 2; }
.calc-zero { grid-column: span 2; }
.calc-history-wrap { min-width: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-alt); padding: .7rem; }
.calc-history-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.calc-history-head h4 { font-size: .9rem; }
.calc-history { max-height: 360px; overflow: auto; display: flex; flex-direction: column; gap: .35rem; }
.calc-hist-item {
    display: flex; flex-direction: column; gap: .15rem; width: 100%; text-align: right;
    background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
    padding: .45rem .55rem; cursor: pointer; font: inherit;
}
.calc-hist-item:hover { border-color: var(--primary); }
.calc-hist-expr { font-size: .78rem; color: var(--muted); overflow-wrap: anywhere; }
.calc-hist-res { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9rem; font-weight: 700; }

/* --- Calculadora flotante --- */
:root { --calc-fab-bottom: 20px; --calc-fab-right: 20px; }
body:has(#miniTimer:not(.hidden)) { --calc-fab-bottom: 88px; }
body.has-rm-ticker:has(#miniTimer:not(.hidden)) { --calc-fab-bottom: 144px; }
body.has-att-cap:has(#miniTimer:not(.hidden)) { --calc-fab-bottom: 144px; }
body.has-att-cap.has-rm-ticker:has(#miniTimer:not(.hidden)) { --calc-fab-bottom: 200px; }

.calc-fab {
    position: fixed; right: var(--calc-fab-right); bottom: var(--calc-fab-bottom); z-index: 96;
    width: 54px; height: 54px; border-radius: 50%; border: 1px solid var(--border);
    background: var(--panel); color: var(--text); font-size: 1.4rem; cursor: pointer;
    display: grid; place-items: center; box-shadow: 0 10px 30px rgba(0,0,0,.35);
    transition: transform .12s, border-color .12s, box-shadow .12s;
}
.calc-fab:hover { transform: translateY(-2px); border-color: var(--primary); box-shadow: 0 14px 36px rgba(0,0,0,.42); }
.calc-float-panel {
    position: fixed; right: var(--calc-fab-right); bottom: calc(var(--calc-fab-bottom) + 66px); z-index: 97;
    width: min(320px, calc(100vw - 32px)); max-height: calc(100dvh - var(--calc-fab-bottom) - 80px); overflow-y: auto;
    background: var(--panel); color: var(--text);
    border: 1px solid var(--border); border-radius: 16px; padding: .7rem .8rem .8rem;
    box-shadow: 0 18px 48px rgba(0,0,0,.45); animation: mini-in .16s ease;
}
.calc-float-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .45rem; }
.calc-float-title { font-weight: 700; font-size: .9rem; }
.calc-float-actions { display: inline-flex; gap: .1rem; }
.calc-float-btn {
    background: none; border: none; color: var(--muted); font-size: 1rem; cursor: pointer;
    padding: .15rem .35rem; border-radius: 6px; line-height: 1;
}
.calc-float-btn:hover { background: var(--panel-alt); color: var(--text); }
.calc-float-display { font-size: 1.2rem; padding: .55rem .65rem; }
.calc-float-panel .calc-preview { font-size: .82rem; min-height: 1.1rem; padding: .2rem .15rem; }
.calc-float-keys { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .35rem; margin-top: .25rem; }
.calc-float-keys .calc-key { padding: .55rem .2rem; font-size: .92rem; border-radius: 8px; }
.calc-float-keys .calc-key.fn { font-size: .8rem; }

@media (max-width: 860px) {
    :root { --calc-fab-bottom: 12px; --calc-fab-right: 12px; }
    body:has(#miniTimer:not(.hidden)) { --calc-fab-bottom: 80px; }
    body.has-rm-ticker:has(#miniTimer:not(.hidden)) { --calc-fab-bottom: 136px; }
    body.has-att-cap:has(#miniTimer:not(.hidden)) { --calc-fab-bottom: 136px; }
    body.has-att-cap.has-rm-ticker:has(#miniTimer:not(.hidden)) { --calc-fab-bottom: 192px; }
    .calc-float-panel { width: min(320px, calc(100vw - 20px)); }
}

/* --- Ruleta --- */
.wheel-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(270px, .85fr); gap: 1.1rem; align-items: start; }
.wheel-stage { display: flex; flex-direction: column; align-items: center; gap: .7rem; min-width: 0; }
.wheel-canvas-wrap {
    position: relative; width: min(100%, 460px); aspect-ratio: 1 / 1;
    display: grid; place-items: center; padding-top: 10px;
}
.wheel-wrap { width: 100%; height: 100%; will-change: transform; }
.wheel-wrap canvas { width: 100%; height: 100%; display: block; filter: drop-shadow(0 12px 24px rgba(15, 23, 42, .18)); }
.wheel-pointer {
    position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 3;
    width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent;
    border-top: 30px solid var(--danger);
    filter: drop-shadow(0 2px 3px rgba(15, 23, 42, .35));
}
.wheel-pointer::after {
    content: ""; position: absolute; left: -5px; top: -33px; width: 10px; height: 10px;
    border-radius: 50%; background: var(--danger);
}
.wheel-result {
    display: flex; flex-direction: column; align-items: center; gap: .15rem;
    min-height: 48px; padding: .45rem 1rem; border: 1px dashed var(--border); border-radius: 12px;
    background: var(--panel-alt); text-align: center; max-width: 100%;
}
.wheel-result.has-result { border-style: solid; border-color: var(--wheel-win, var(--primary)); background: color-mix(in srgb, var(--wheel-win, var(--primary)) 10%, var(--panel-alt)); }
.wheel-result-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.wheel-result strong { font-size: 1.15rem; overflow-wrap: anywhere; }
.wheel-spin-btn { min-width: 190px; padding: .65rem 1.2rem; font-size: .95rem; font-weight: 700; }
.wheel-spin-btn:disabled { opacity: .55; cursor: not-allowed; }
.wheel-panel {
    border: 1px solid var(--border); border-radius: 12px; background: var(--panel-alt);
    padding: .8rem; display: flex; flex-direction: column; gap: .55rem; min-width: 0;
}
.wheel-add-row { display: flex; gap: .4rem; }
.wheel-add-row input {
    flex: 1; min-width: 0; padding: .55rem .65rem; border: 1px solid var(--border); border-radius: 9px;
    background: var(--panel); color: var(--text); font: inherit; font-size: .88rem;
}
.wheel-add-row input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.wheel-options { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.wheel-quick-add { margin: -.15rem 0 .15rem; }
.wheel-quick-add .btn-ghost { width: 100%; justify-content: center; font-size: .82rem; padding: .4rem .5rem; }
.wheel-options .chk { font-size: .8rem; }
.wheel-entries-head h4, .wheel-history-head h4 { font-size: .85rem; }
.wheel-entries-head, .wheel-history-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.wheel-entries { display: flex; flex-direction: column; gap: .3rem; max-height: 260px; overflow: auto; }
.wheel-entry {
    display: flex; align-items: center; gap: .5rem; padding: .32rem .45rem;
    border: 1px solid var(--border); border-radius: 9px; background: var(--panel); min-width: 0;
}
.wheel-entry-color {
    width: 24px; height: 24px; padding: 0; border: 1px solid var(--border); border-radius: 50%;
    background: none; cursor: pointer; flex-shrink: 0;
}
.wheel-entry-color::-webkit-color-swatch-wrapper { padding: 1px; }
.wheel-entry-color::-webkit-color-swatch { border: 0; border-radius: 50%; }
.wheel-entry-color::-moz-color-swatch { border: 0; border-radius: 50%; }
.wheel-entry-name { flex: 1; min-width: 0; font-size: .87rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wheel-entry-del {
    border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit; font-size: .8rem;
    padding: .1rem .25rem; border-radius: 6px; flex-shrink: 0;
}
.wheel-entry-del:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.wheel-history { display: flex; flex-wrap: wrap; gap: .3rem; }
.wheel-history-item {
    font-size: .78rem; padding: .16rem .5rem; border-radius: 999px;
    background: var(--panel); border: 1px solid var(--border); overflow-wrap: anywhere;
}
@media (max-width: 900px) {
    .wheel-layout { grid-template-columns: 1fr; }
    .wheel-canvas-wrap { max-width: 380px; }
    .wheel-panel { order: 2; }
}

/* Selector rápido de participantes del equipo */
.wheel-team-modal { width: min(540px, 94vw) !important; max-height: 88vh; display: flex; flex-direction: column; }
.wheel-team-toolbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: .55rem 0; }
.wheel-team-toolbar select {
    flex: 1 1 180px; min-width: 0; padding: .45rem .55rem; border: 1px solid var(--border);
    border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; font-size: .85rem;
}
.wheel-team-toolbar .btn-link { font-size: .78rem; }
.wheel-team-list {
    flex: 1; min-height: 180px; max-height: 48vh; overflow-y: auto;
    border: 1px solid var(--border); border-radius: 10px; background: var(--panel-alt); padding: .35rem;
}
.wheel-team-group + .wheel-team-group { margin-top: .45rem; }
.wheel-team-head {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    padding: .2rem .4rem; font-size: .72rem; color: var(--muted);
    text-transform: uppercase; letter-spacing: .035em;
}
.wheel-team-head .btn-link { font-size: .7rem; }
.wheel-team-person {
    display: flex; align-items: center; gap: .55rem; padding: .38rem .45rem;
    border-radius: 8px; cursor: pointer; font-size: .88rem;
}
.wheel-team-person:hover { background: var(--panel); }
.wheel-team-person.disabled { opacity: .62; cursor: default; }
.wheel-team-person input { flex-shrink: 0; }
.wheel-team-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wheel-team-person small { color: var(--muted); font-size: .68rem; font-style: italic; flex-shrink: 0; }
.wheel-team-modal .error-msg { min-height: 1.1rem; }

/* --- Analizador de texto --- */
.ta-legend { display: flex; flex-wrap: wrap; gap: .45rem .9rem; margin: .5rem 0; font-size: .78rem; color: var(--muted); }
.ta-legend.hidden { display: none; }
.ta-legend-item { display: inline-flex; align-items: center; gap: .3rem; }
.ta-swatch { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--border); display: inline-block; }
.ta-swatch-normal { background: var(--panel-alt); }
.ta-swatch-space { background: rgba(59,130,246,.35); }
.ta-swatch-tab { background: rgba(16,185,129,.35); }
.ta-swatch-newline { background: rgba(245,158,11,.4); }
.ta-swatch-cr { background: rgba(239,68,68,.35); }
.ta-swatch-zero { background: rgba(168,85,247,.4); }
.ta-swatch-control { background: rgba(100,116,139,.45); }
.ta-output {
    margin: 0; padding: .8rem .9rem; border: 1px solid var(--border); border-radius: 10px;
    background: var(--panel-alt); color: var(--text); min-height: 90px; max-height: 460px; overflow: auto;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .88rem; line-height: 1.7;
    white-space: pre-wrap; overflow-wrap: anywhere;
}
.ta-output:empty { display: none; }
.ta-char { border-radius: 3px; padding: 0 1px; }
.ta-char.space { background: rgba(59,130,246,.22); color: #2563eb; }
.ta-char.tab { background: rgba(16,185,129,.22); color: #059669; }
.ta-char.newline { background: rgba(245,158,11,.25); color: #b45309; }
.ta-char.cr { background: rgba(239,68,68,.2); color: #dc2626; }
.ta-char.zero { background: rgba(168,85,247,.25); color: #9333ea; }
.ta-char.space-special { background: rgba(14,165,233,.22); color: #0284c7; }
.ta-char.control { background: rgba(100,116,139,.28); color: var(--text); }
html[data-theme="dark"] .ta-char.space { color: #93c5fd; }
html[data-theme="dark"] .ta-char.tab { color: #6ee7b7; }
html[data-theme="dark"] .ta-char.newline { color: #fcd34d; }
html[data-theme="dark"] .ta-char.cr { color: #fca5a5; }
html[data-theme="dark"] .ta-char.zero { color: #d8b4fe; }
html[data-theme="dark"] .ta-char.space-special { color: #7dd3fc; }
html[data-theme="dark"] .ta-legend, html[data-theme="dark"] .ta-output { color: var(--text); }

/* --- Contador de texto --- */
.count-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; margin-top: .8rem; }
.count-card { background: var(--panel-alt); border: 1px solid var(--border); border-radius: 10px; padding: .8rem .9rem; min-width: 0; }
.count-card .num { font-size: 1.55rem; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.count-card .lbl { color: var(--muted); font-size: .78rem; margin-top: .15rem; }
#textCountHint { margin-top: .65rem; }

@media (max-width: 900px) {
    .calc-wrap { grid-template-columns: 1fr; }
    .calc-history { max-height: 220px; }
    .calc-keys { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
    .calc-key { padding: .6rem .15rem; font-size: .85rem; }
    .calc-key.fn { font-size: .72rem; }
    .calc-display { font-size: 1.25rem; }
    .count-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ======================================================================
   Enlaces
   ====================================================================== */
.ln-search { flex: 1 1 300px; }
.ln-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 1rem; }
.ln-grid .empty { grid-column: 1 / -1; }
.ln-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 1rem 1.05rem;
    display: flex; flex-direction: column; gap: .65rem; min-width: 0;
    transition: border-color .12s, box-shadow .12s;
}
.ln-card:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); box-shadow: 0 6px 18px rgba(0,0,0,.1); }
.ln-card.ln-highlight { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.ln-head { display: flex; gap: .7rem; align-items: flex-start; }
.ln-ico { width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; background: var(--panel-alt); display: grid; place-items: center; font-size: 1.05rem; }
.ln-main { flex: 1; min-width: 0; }
.ln-title { font-size: 1rem; line-height: 1.25; margin: 0 0 .3rem; overflow-wrap: anywhere; }
.ln-title a { color: var(--text); text-decoration: none; }
.ln-title a:hover { color: var(--primary); text-decoration: underline; }
.ln-desc { font-size: .87rem; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 .3rem; }
.ln-url { font-size: .72rem; color: var(--muted); overflow-wrap: anywhere; margin: 0; }
.ln-actions { display: inline-flex; gap: .1rem; flex-shrink: 0; }
.ln-act { background: none; border: none; cursor: pointer; width: 30px; height: 30px; border-radius: 50%; font-size: .9rem; }
.ln-act:hover, .ln-act:focus-visible { background: var(--panel-alt); outline: none; }
.ln-act.danger:hover { background: rgba(239,68,68,.14); }
.ln-act:disabled { opacity: .35; cursor: not-allowed; }
.ln-foot {
    display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; border-top: 1px solid var(--border);
    padding-top: .55rem; margin-top: auto; font-size: .75rem; color: var(--muted);
}
.ln-owner { display: inline-flex; align-items: center; gap: .35rem; min-width: 0; max-width: 100%; }
.ln-owner > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ln-av { width: 24px; height: 24px; font-size: .65rem; flex-shrink: 0; }
.ln-badge {
    background: var(--panel-alt); border: 1px solid var(--border); border-radius: 999px; padding: .05rem .45rem;
    font-size: .72rem; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ln-own { color: var(--primary); }
.ln-pending { color: #b45309; background: rgba(245,158,11,.13); border-color: rgba(245,158,11,.45); white-space: normal; }
html[data-theme="dark"] .ln-pending { color: #fbbf24; }
.ln-pending-wrap { display: inline-flex; align-items: center; gap: .3rem; flex-wrap: wrap; max-width: 100%; }
.ln-pending-actions { display: inline-flex; gap: .15rem; }
.ln-pending-actions .btn-link { font-size: .72rem; }
.ln-date { margin-left: auto; white-space: nowrap; }
.ln-shares { margin-top: .8rem; }
.ln-share-cols { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: .4rem; }
.ln-share-cols h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .35rem; }
.ln-share-list {
    max-height: 180px; overflow: auto; border: 1px solid var(--border); border-radius: 8px;
    padding: .45rem .55rem; background: var(--panel-alt); display: flex; flex-direction: column; gap: .3rem;
}
.ln-share-list .chk { font-size: .84rem; }
.ln-head-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.ln-view-seg { flex-shrink: 0; }
.ln-view-seg .seg-btn { padding: .32rem .7rem; font-size: .78rem; }
.ln-grouped { display: flex; flex-direction: column; gap: 1.2rem; }
.ln-group-section { border-left: 3px solid var(--ln-group, var(--primary)); padding-left: .8rem; }
.ln-group-title { display: flex; align-items: center; gap: .45rem; font-size: 1rem; margin: 0 0 .6rem; }
.ln-group-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ln-group, var(--primary)); flex-shrink: 0; }
.ln-group-count { font-size: .72rem; font-weight: 500; color: var(--muted); background: var(--panel-alt); border: 1px solid var(--border); border-radius: 999px; padding: .02rem .42rem; }
.ln-group-badge {
    color: var(--ln-group, var(--primary));
    border-color: color-mix(in srgb, var(--ln-group, var(--primary)) 45%, var(--border));
    background: color-mix(in srgb, var(--ln-group, var(--primary)) 13%, transparent);
    font-weight: 600;
}
.ln-tags { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .35rem; }
.ln-tag {
    border: 1px solid var(--border); border-radius: 999px; background: var(--panel-alt); color: var(--muted);
    font: inherit; font-size: .7rem; padding: .05rem .45rem; cursor: pointer;
}
.ln-tag:hover { border-color: var(--primary); color: var(--primary); }
.ln-bookmark { color: var(--muted); }
.ln-bookmark.on { color: #eab308; }
.ln-bookmark:hover { color: #eab308; }
.ln-group-pick { display: flex; align-items: center; gap: .35rem; }
.ln-group-pick select { flex: 1; min-width: 0; }
.ln-group-create { border: 1px dashed var(--border); border-radius: 10px; padding: .65rem .7rem; margin: .5rem 0 .8rem; background: var(--panel-alt); }
.ln-group-create-actions { display: flex; justify-content: flex-end; gap: .4rem; }
.ln-group-create .error-msg { margin: .2rem 0 .4rem; }
#linkModal textarea {
    width: 100%; resize: vertical; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 8px;
    background: var(--panel); color: var(--text); font: inherit; font-size: .9rem;
}
@media (max-width: 700px) {
    .ln-share-cols { grid-template-columns: 1fr; }
    .ln-date { margin-left: 0; }
}

/* ======================================================================
   Tablero estilo Trello
   ====================================================================== */
.board-head-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.boards-search { flex: 1 1 280px; }
.boards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 1rem; }
.boards-grid .empty { grid-column: 1 / -1; }
.board-grouped { display: flex; flex-direction: column; gap: 1.2rem; }
.board-group-section { border-left: 3px solid var(--bd-group, var(--primary)); padding-left: .8rem; }
.board-group-title { display: flex; align-items: center; gap: .45rem; font-size: 1rem; margin: 0 0 .6rem; }
.board-group-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bd-group, var(--primary)); flex-shrink: 0; }
.board-group-count {
    font-size: .72rem; font-weight: 500; color: var(--muted); background: var(--panel-alt);
    border: 1px solid var(--border); border-radius: 999px; padding: .02rem .42rem;
}
.board-group-badge {
    display: inline-flex; align-items: center; align-self: flex-start; margin-top: .25rem;
    font-size: .68rem; font-weight: 700; color: var(--bd-group, var(--primary));
    background: color-mix(in srgb, var(--bd-group, var(--primary)) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--bd-group, var(--primary)) 35%, transparent);
    border-radius: 999px; padding: .05rem .45rem;
}
.board-view-seg .seg-btn { padding: .35rem .55rem; font-size: .76rem; }
.board-tile {
    position: relative; display: flex; flex-direction: column; min-height: 150px; overflow: hidden;
    background: var(--panel); border: 1px solid var(--border); border-radius: 14px; cursor: pointer;
    transition: transform .12s, border-color .12s, box-shadow .12s;
}
.board-tile:hover, .board-tile:focus-visible {
    transform: translateY(-2px); border-color: color-mix(in srgb, var(--bc) 55%, var(--border));
    box-shadow: 0 8px 22px rgba(0,0,0,.12); outline: none;
}
.board-tile-accent { height: 5px; background: var(--bc); }
.board-tile-body { flex: 1; padding: 1rem 1.1rem .8rem; min-width: 0; }
.board-tile h3 { font-size: 1.05rem; margin-bottom: .35rem; overflow-wrap: anywhere; }
.board-tile-desc {
    color: var(--muted); font-size: .85rem; line-height: 1.4; margin-bottom: .55rem;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.board-tile-meta { display: flex; gap: .7rem; flex-wrap: wrap; font-size: .74rem; color: var(--muted); }
.board-tile-foot {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    border-top: 1px solid var(--border); padding: .5rem 1.1rem; font-size: .72rem; color: var(--muted);
}
.board-tile-owner { display: inline-flex; align-items: center; gap: .45rem; min-width: 0; }
.board-tile-owner-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-tile-owner-name small { font-size: .66rem; color: var(--muted); font-weight: 400; }
.board-tile-members { display: inline-flex; align-items: center; flex-shrink: 0; }
.board-tile-members .board-av-wrap { margin-left: -7px; }
.board-tile-members .board-av-wrap:first-child { margin-left: 0; }
.board-tile-members .board-av { border: 2px solid var(--panel); }
.board-tile-av { width: 24px; height: 24px; font-size: .62rem; }
.board-tile-av .chat-presence-dot { width: 8px; height: 8px; border-width: 1px; }

.board-av-wrap { position: relative; display: inline-flex; flex-shrink: 0; cursor: pointer; }
.board-owner-badge {
    position: absolute; left: -4px; bottom: -4px; top: auto; right: auto;
    display: inline-flex; align-items: center; justify-content: center;
    width: auto; height: auto; background: none; border: 0; box-shadow: none;
    font-size: .8rem; line-height: 1; z-index: 2;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.55));
}
.board-tile-members .board-owner-badge { display: none; }

.board-banner {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    background: color-mix(in srgb, var(--board-color) 12%, var(--panel));
    border: 1px solid color-mix(in srgb, var(--board-color) 42%, var(--border));
    border-radius: 16px; padding: 1rem 1.2rem; margin-bottom: 1rem;
}
.board-banner-main { min-width: 0; }
.board-banner h3 { font-size: 1.3rem; overflow-wrap: anywhere; }
.board-view-desc { color: var(--muted); font-size: .9rem; line-height: 1.45; margin-top: .25rem; white-space: pre-wrap; }
.board-view-meta { display: flex; gap: .8rem; flex-wrap: wrap; font-size: .78rem; color: var(--muted); margin-top: .55rem; }
.board-banner-side { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.board-banner .btn-ghost.danger { color: var(--danger); }

.board-member-stack { display: flex; align-items: center; padding-left: 6px; }
.board-member-stack .board-av-wrap { margin-left: -6px; }
.board-member-stack .board-av-wrap:first-child { margin-left: 0; }
.board-member-stack .board-av { border: 2px solid var(--panel); }
.board-av { width: 30px; height: 30px; font-size: .7rem; }
.board-av.lg { width: 56px; height: 56px; font-size: 1.1rem; }
.board-av-more {
    margin-left: .3rem; font-size: .72rem; color: var(--muted);
    background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: .1rem .35rem;
}

.board-lists { display: flex; gap: .9rem; align-items: flex-start; overflow-x: auto; padding: 0 .1rem 1rem; min-height: 220px; }
.board-list {
    width: 300px; min-width: 270px; max-width: 320px; flex-shrink: 0;
    display: flex; flex-direction: column; gap: .5rem;
    background: var(--panel-alt); border: 1px solid var(--border); border-radius: 14px; padding: .6rem;
}
.board-list.dragging { opacity: .45; }
.board-list-placeholder {
    flex-shrink: 0; border: 2px dashed color-mix(in srgb, var(--primary) 65%, var(--border));
    border-radius: 14px; background: color-mix(in srgb, var(--primary) 10%, transparent);
}
.board-list-ghost {
    position: fixed; left: -9999px; top: -9999px; pointer-events: none; z-index: 999;
    opacity: .95; box-shadow: 0 20px 44px rgba(0,0,0,.4); transform: rotate(1.2deg); border-radius: 14px;
}
.board-list.drop-over { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent); }
.board-list-head { display: flex; align-items: center; gap: .35rem; padding: .15rem .2rem; min-width: 0; cursor: grab; }
.board-list-head:active { cursor: grabbing; }
.board-list-head .bl-title,
.board-list-head button,
.board-list-head input { cursor: pointer; }
.bl-grip { cursor: grab; color: var(--muted); font-size: 1.05rem; line-height: 1; user-select: none; }
.bl-grip:active { cursor: grabbing; }
.bl-title { flex: 1; min-width: 0; font-weight: 700; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-count { font-size: .72rem; background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: .05rem .4rem; color: var(--muted); }
.bl-actions { display: inline-flex; gap: 0; }
.bl-actions button {
    background: none; border: none; color: var(--muted); cursor: pointer; padding: .22rem .28rem;
    border-radius: 6px; font-size: .8rem; line-height: 1;
}
.bl-actions button:hover, .bl-actions button:focus-visible { background: var(--panel); color: var(--text); outline: none; }
.bl-actions button.danger:hover { color: var(--danger); }
.board-cards { display: flex; flex-direction: column; gap: .45rem; min-height: 48px; }
.bl-empty { color: var(--muted); font-size: .8rem; text-align: center; padding: .65rem 0; }
.board-card {
    position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
    padding: .55rem .6rem .5rem; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.05);
    transition: border-color .12s, box-shadow .12s;
}
.board-card:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); box-shadow: 0 2px 7px rgba(0,0,0,.1); }
.board-card:active { cursor: grabbing; }
.board-card.dragging { opacity: .45; }
.board-card-placeholder {
    flex-shrink: 0; border: 2px dashed color-mix(in srgb, var(--primary) 65%, var(--border));
    border-radius: 10px; background: color-mix(in srgb, var(--primary) 10%, transparent);
}
.board-drag-ghost {
    position: fixed; left: -9999px; top: -9999px; pointer-events: none; z-index: 999;
    opacity: .96; box-shadow: 0 18px 40px rgba(0,0,0,.4); transform: rotate(1.5deg); border-radius: 10px;
}
.board-card.done .bc-title { text-decoration: line-through; color: var(--muted); }
.bc-label { display: block; height: 4px; border-radius: 999px; margin: -.2rem -.1rem .4rem; }
.bc-head { display: flex; align-items: flex-start; gap: .4rem; }
.bc-check {
    flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border);
    background: var(--panel); color: transparent; cursor: pointer; font-size: .65rem; line-height: 1;
    display: grid; place-items: center; margin-top: .05rem;
}
.bc-check:hover { border-color: var(--green); }
.bc-check.on { background: var(--green); border-color: var(--green); color: #fff; }
.bc-title { font-size: .88rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.bc-meta { display: flex; align-items: center; gap: .35rem; margin-top: .4rem; font-size: .72rem; color: var(--muted); min-height: 19px; }
.bc-due { background: var(--panel-alt); border-radius: 999px; padding: .05rem .4rem; white-space: nowrap; }
.bc-due.overdue { color: var(--danger); background: rgba(239,68,68,.1); }
.bc-spacer { flex: 1; }
.board-card-av { width: 22px; height: 22px; font-size: .6rem; }
.bc-meta .chat-presence-dot { width: 8px; height: 8px; border-width: 1px; }
.board-add-card {
    background: none; border: none; color: var(--muted); text-align: left; padding: .45rem .5rem;
    border-radius: 8px; cursor: pointer; font: inherit; font-size: .82rem;
}
.board-add-card:hover { background: var(--panel); color: var(--text); }
.board-add-list {
    width: 280px; min-width: 260px; height: 48px; flex-shrink: 0;
    border: 1px dashed var(--border); border-radius: 14px; background: transparent; color: var(--muted);
    cursor: pointer; font: inherit;
}
.board-add-list:hover { border-color: var(--primary); color: var(--primary); background: var(--panel); }

.board-member-picker {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: .35rem .8rem;
    max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: 10px;
    padding: .6rem; background: var(--panel-alt); margin: .4rem 0;
}
.board-member-picker .chk { font-size: .84rem; }
.board-members-current { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .8rem; }
.board-member-row {
    display: flex; align-items: center; gap: .5rem; padding: .4rem .5rem;
    border-bottom: 1px solid var(--border); font-size: .86rem;
}
.board-member-row:last-child { border-bottom: none; }
.board-member-name { font-weight: 600; }
.board-member-row .btn-link { margin-left: auto; }

.board-label-picker { display: flex; gap: .4rem; flex-wrap: wrap; margin: .4rem 0 .7rem; }
.board-label {
    width: 30px; height: 24px; border-radius: 7px; border: 2px solid transparent; cursor: pointer;
    font-size: .8rem; color: var(--muted); background: var(--panel-alt);
}
.board-label.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--text); }
.board-label.none { background: var(--panel-alt); border: 1px dashed var(--border); }
#boardModal textarea, #boardCardModal textarea {
    width: 100%; resize: vertical; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 8px;
    background: var(--panel); color: var(--text); font: inherit; font-size: .9rem;
}
#boardsTab.board-open .section-head { display: none; }
#boardsTab.board-open .content { display: flex; flex-direction: column; height: 100%; overflow: hidden; padding-bottom: 0; max-width: none; }
#boardsTab.board-open #boardView { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#boardsTab.board-open .board-banner { flex-shrink: 0; position: relative; z-index: 20; }
#boardsTab.board-open .board-lists {
    flex: 1; min-height: 0; align-items: flex-start; overflow-x: auto; overflow-y: hidden;
    scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent;
}
#boardsTab.board-open .board-list { max-height: 100%; }
#boardsTab.board-open .board-cards {
    flex: 1; min-height: 48px; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent;
}
#boardsTab.board-open .board-lists::-webkit-scrollbar,
#boardsTab.board-open .board-cards::-webkit-scrollbar { width: 8px; height: 8px; }
#boardsTab.board-open .board-lists::-webkit-scrollbar-track,
#boardsTab.board-open .board-cards::-webkit-scrollbar-track { background: transparent; }
#boardsTab.board-open .board-lists::-webkit-scrollbar-thumb,
#boardsTab.board-open .board-cards::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
#boardsTab.board-open .board-add-list { align-self: flex-start; }

#boardCardModal .modal-card { max-height: 90vh; overflow-y: auto; }
.card-detail-sections { margin-top: 1rem; }
.card-detail-block { border-top: 1px solid var(--border); padding-top: .8rem; margin-top: .8rem; }
.card-detail-block h4 { font-size: .9rem; margin-bottom: .5rem; }
.card-comments { max-height: 220px; overflow: auto; display: flex; flex-direction: column; gap: .5rem; margin-bottom: .5rem; }
.card-comment { display: flex; align-items: flex-start; gap: .5rem; }
.card-comment > .board-av-wrap { align-self: flex-start; }
.board-comment-av { width: 28px; height: 28px; font-size: .65rem; flex-shrink: 0; }
.card-comment-body { flex: 1; min-width: 0; background: var(--panel-alt); border: 1px solid var(--border); border-radius: 10px; padding: .4rem .55rem; }
.card-comment-head { display: flex; gap: .4rem; align-items: baseline; flex-wrap: wrap; font-size: .75rem; color: var(--muted); }
.card-comment-head strong { color: var(--text); font-size: .8rem; }
.card-comment-head .card-comment-actions { margin-left: auto; display: inline-flex; align-items: baseline; gap: .45rem; }
.card-comment-head .btn-link { font-size: .72rem; }
.comment-edited {
    font-size: .66rem; font-style: italic; color: var(--muted);
    background: color-mix(in srgb, var(--border) 45%, transparent);
    border-radius: 999px; padding: 0 .38rem; line-height: 1.5;
}
.card-comment-text { font-size: .85rem; white-space: normal; overflow-wrap: anywhere; margin-top: .15rem; }
.card-comment-text a, .card-desc-links a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.card-comment-text a:hover, .card-desc-links a:hover { color: var(--primary-strong, var(--primary)); }
.card-comment-edit { margin-top: .3rem; display: flex; flex-direction: column; gap: .35rem; }
.card-comment-edit textarea {
    width: 100%; min-height: 64px; resize: vertical; padding: .45rem .55rem; border: 1px solid var(--primary);
    border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; font-size: .84rem;
}
.card-comment-edit-actions { display: flex; justify-content: flex-end; gap: .4rem; }
.card-desc-links {
    display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem;
    margin: .35rem 0 .2rem; padding: .4rem .55rem; border: 1px dashed var(--border); border-radius: 8px;
    background: var(--panel-alt); font-size: .8rem;
}
.card-desc-links-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.card-desc-link { min-width: 0; overflow-wrap: anywhere; }
.card-comment-compose { display: flex; gap: .4rem; align-items: flex-end; }
.card-comment-compose textarea {
    flex: 1; resize: vertical; min-height: 38px; padding: .45rem .6rem; border: 1px solid var(--border);
    border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; font-size: .85rem;
}
.card-checklists { display: flex; flex-direction: column; gap: .8rem; }
.card-checklist { border: 1px solid var(--border); border-radius: 10px; padding: .55rem .6rem; background: var(--panel-alt); }
.checklist-head { display: flex; align-items: center; gap: .5rem; }
.checklist-head strong { font-size: .86rem; flex: 1; overflow-wrap: anywhere; }
.checklist-head .btn-link { font-size: .72rem; }
.checklist-progress { height: 5px; border-radius: 999px; background: var(--border); margin: .45rem 0; overflow: hidden; }
.checklist-progress i { display: block; height: 100%; background: var(--green); transition: width .15s; }
.checklist-items { display: flex; flex-direction: column; gap: .2rem; }
.checklist-item { display: flex; align-items: center; gap: .3rem; font-size: .84rem; }
.checklist-item .chk { flex: 1; min-width: 0; }
.checklist-item .chk span { overflow-wrap: anywhere; }
.checklist-item .check-done { text-decoration: line-through; color: var(--muted); }
.card-detail-add { margin-top: .35rem; }
.card-detail-add input { flex: 1; min-width: 0; }
.card-attachments, .card-links { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .4rem; }
.card-attachment { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding: .3rem 0; font-size: .82rem; }
.card-attachment-name { background: none; border: none; color: var(--primary); cursor: pointer; font: inherit; font-size: .84rem; padding: 0; text-align: left; overflow-wrap: anywhere; }
.card-attachment-name:hover { text-decoration: underline; }
.card-attachment .btn-link { margin-left: auto; }
.card-link { display: flex; align-items: flex-start; gap: .5rem; border-bottom: 1px solid var(--border); padding: .35rem 0; }
.card-link > div { min-width: 0; flex: 1; }
.card-link a { color: var(--primary); text-decoration: none; font-size: .86rem; overflow-wrap: anywhere; }
.card-link a:hover { text-decoration: underline; }
.card-link small { display: block; color: var(--muted); font-size: .72rem; overflow-wrap: anywhere; }
.card-link .btn-link { font-size: .72rem; }
.card-link-form { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.4fr) auto; gap: .4rem; align-items: center; }
.card-link-form input {
    min-width: 0; padding: .45rem .55rem; border: 1px solid var(--border); border-radius: 8px;
    background: var(--panel); color: var(--text); font: inherit; font-size: .84rem;
}
.bc-note { white-space: nowrap; }

@media (max-width: 700px) {
    .board-lists { margin-left: -.5rem; margin-right: -.5rem; padding-left: .5rem; padding-right: .5rem; }
    .board-list { width: 265px; min-width: 265px; }
    .board-banner { padding: .8rem .9rem; }
    .card-link-form { grid-template-columns: 1fr; }
}

/* ======================================================================
   Menú lateral comprimible
   ====================================================================== */
.nav-ic { margin-right: .45rem; }
.nav-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Barra de navegación: estados más suaves y legibles */
.sidebar { position: relative; z-index: 10; border-right: 1px solid rgba(148, 163, 184, .08); }
.sidebar-nav { padding: .65rem .55rem; gap: .12rem; scrollbar-width: thin; }
.sidebar-nav .nav-item {
    border-left: 0; border-radius: 9px; padding: .68rem .78rem;
    color: #94a3b8; display: flex; align-items: center; min-width: 0;
    transition: background .15s, color .15s;
}
.sidebar-nav .nav-item:hover { background: rgba(148, 163, 184, .10); color: #f8fafc; }
.sidebar-nav .nav-item.active {
    background: rgba(59, 130, 246, .16); color: #fff;
    box-shadow: inset 2px 0 0 var(--primary);
}
html[data-theme="dark"] .sidebar-nav .nav-item { color: #94a3b8; }
html[data-theme="dark"] .sidebar-nav .nav-item:hover { background: rgba(148, 163, 184, .09); color: #f8fafc; }
html[data-theme="dark"] .sidebar-nav .nav-item.active { background: rgba(59, 130, 246, .18); color: #fff; }

/* Botón discreto de compresión, a la derecha del logo */
.sidebar-brand { padding: 1rem 1rem .9rem; gap: .55rem; }
.sidebar-brand .brand-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sidebar-collapse-btn {
    margin-left: auto; flex-shrink: 0;
    width: 22px; height: 22px; padding: 0; border-radius: 50%;
    display: grid; place-items: center; cursor: pointer;
    background: rgba(255, 255, 255, .055); border: 1px solid rgba(148, 163, 184, .18);
    color: #94a3b8; font-size: 14px; line-height: 1;
    opacity: .72; transition: opacity .15s, background .15s, color .15s, border-color .15s;
}
.sidebar-brand:hover .sidebar-collapse-btn { opacity: 1; }
.sidebar-collapse-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(148, 163, 184, .35); }

/* Notificaciones y mensajes debajo del logo */
.sidebar-inbox {
    display: flex; align-items: center; justify-content: center; gap: .55rem;
    height: 44px; padding: 0; flex-shrink: 0;
}
.sidebar-inbox .inbox-btn {
    flex: 0 0 38px; width: 38px; height: 38px; padding: 0;
    border-radius: 10px; justify-content: center;
    background: transparent; color: #cbd5e1;
}
.sidebar-inbox .inbox-btn:hover,
.sidebar-inbox .inbox-btn[aria-expanded="true"] { background: rgba(255, 255, 255, .12); }
.sidebar-inbox .inbox-ico { font-size: 1.2rem; line-height: 1; }
.sidebar-inbox .inbox-badge { top: 1px; right: 3px; }

/* Hora de compilación: discreta y pegada al perfil */
.sidebar-build {
    padding: .15rem 1rem .35rem; color: #64748b; font-size: .62rem; line-height: 1.2; text-align: center;
}

.app-layout.sidebar-collapsed .sidebar { width: 72px; }
.app-layout.sidebar-collapsed .sidebar-brand {
    flex-direction: row; align-items: center; justify-content: space-between; gap: .2rem; padding: .75rem .55rem;
}
.app-layout.sidebar-collapsed .brand-name { display: none; }
.app-layout.sidebar-collapsed .sidebar-collapse-btn { margin-left: 0; width: 20px; height: 20px; font-size: 12px; }
.app-layout.sidebar-collapsed .sidebar-inbox { flex-direction: row; height: 40px; padding: 0; gap: .18rem; }
.app-layout.sidebar-collapsed .sidebar-inbox .inbox-btn {
    flex: 0 0 28px; width: 28px; height: 28px; padding: 0; justify-content: center; border-radius: 8px;
}
.app-layout.sidebar-collapsed .nav-item {
    display: flex; align-items: center; justify-content: center;
    padding: .8rem .3rem; border-left: 0;
}
.app-layout.sidebar-collapsed .nav-ic { font-size: 1.15rem; margin-right: 0; }
.app-layout.sidebar-collapsed .nav-lbl { display: none; }
.app-layout.sidebar-collapsed .presence-wrap { padding: .3rem .4rem .4rem; }
.app-layout.sidebar-collapsed .presence-btn { justify-content: center; padding: .45rem .2rem; }
.app-layout.sidebar-collapsed .p-label,
.app-layout.sidebar-collapsed .p-caret { display: none; }
.app-layout.sidebar-collapsed .sidebar-build { display: none; }
.app-layout.sidebar-collapsed .theme-toggle-wrap { padding: .4rem .35rem .6rem; }
.app-layout.sidebar-collapsed .theme-toggle { padding: .55rem .2rem; }
.app-layout.sidebar-collapsed #themeToggleLabel { display: none; }
.app-layout.sidebar-collapsed .sidebar-user {
    flex-direction: column; align-items: center; gap: .4rem; padding: .7rem .3rem;
}
.app-layout.sidebar-collapsed .user-info,
.app-layout.sidebar-collapsed .logout-btn { display: none; }

/* ======================================================================
   Tablero: cabecera compacta, listas angostas, modal en dos columnas y fondos
   ====================================================================== */
.board-banner {
    padding: .55rem .75rem; margin-bottom: .55rem; border-radius: 12px; align-items: center; gap: .6rem;
    background: color-mix(in srgb, var(--panel) 82%, transparent);
    backdrop-filter: blur(7px);
}
html[data-theme="dark"] .board-banner { background: rgba(30, 41, 59, .72); }
.board-banner-main { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; min-width: 0; }
.board-banner h3 { font-size: 1.02rem; line-height: 1.2; margin: 0; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-view-desc {
    margin: 0; font-size: .78rem; max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.board-view-meta { margin: 0; display: inline-flex; gap: .55rem; font-size: .72rem; }
.board-banner-side { gap: .4rem; }
.board-search-wrap { display: inline-flex; align-items: center; gap: .35rem; }
.board-search { width: 190px; padding: .38rem .55rem; font-size: .8rem; }
.board-search-info { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.board-search-empty { grid-column: 1 / -1; min-height: 32vh; display: grid; place-items: center; }

.board-lists { gap: .65rem; }
.board-list { width: 250px; min-width: 228px; max-width: 270px; padding: .5rem; gap: .4rem; }
.board-list .board-cards { gap: .4rem; }
.board-add-list { width: 230px; min-width: 220px; }
.board-card { padding: .45rem .5rem .4rem; }

.bl-title { cursor: text; }
.bl-title:hover { color: var(--primary); }
.bl-title-input {
    flex: 1; min-width: 0; padding: .22rem .35rem; border: 1px solid var(--primary); border-radius: 6px;
    background: var(--panel); color: var(--text); font: inherit; font-size: .88rem; font-weight: 700;
}

.board-card-modal {
    width: min(1080px, 96vw) !important; max-width: 96vw !important; max-height: 92vh; display: flex; flex-direction: column;
    padding: 0; overflow: hidden;
}
.bcm-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 1.1rem; border-bottom: 1px solid var(--border); }
.bcm-head h3 { margin: 0; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.bcm-body { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .85fr); min-height: 0; flex: 1; overflow: hidden; }
.bcm-main { padding: 1.1rem 1.25rem 1.2rem; overflow-y: auto; min-width: 0; }
.modal-card input.bcm-title {
    width: 100%; padding: .1rem 0 .35rem; border: none; border-radius: 0;
    background: transparent; color: var(--text); font-size: 1.5rem; font-weight: 700; line-height: 1.2;
    box-shadow: none;
}
.modal-card input.bcm-title:focus { outline: none; border: none; box-shadow: 0 1px 0 var(--primary); }
.bcm-done-toggle {
    position: relative; display: inline-flex; align-items: center; gap: .45rem; margin: .35rem 0 .9rem;
    font-size: .8rem; font-weight: 600; color: var(--muted); cursor: pointer; width: fit-content;
}
.bcm-done-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.bcm-done-box {
    width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border);
    background: var(--panel); display: inline-grid; place-items: center; color: transparent;
    transition: background .12s, border-color .12s;
}
.bcm-done-toggle input:checked + .bcm-done-box { background: var(--green); border-color: var(--green); color: #fff; }
.bcm-done-toggle input:checked + .bcm-done-box::after { content: '✓'; font-size: .7rem; line-height: 1; }
.bcm-done-toggle input:focus-visible + .bcm-done-box { box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 30%, transparent); }
.bcm-done-toggle:hover .bcm-done-box { border-color: var(--green); }
.bcm-actions { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-bottom: .8rem; }
.bcm-action {
    display: inline-flex; align-items: center; gap: .3rem; padding: .42rem .65rem;
    border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text);
    cursor: pointer; font: inherit; font-size: .78rem; font-weight: 600; line-height: 1;
    transition: border-color .12s, background .12s, color .12s;
}
.bcm-action:hover { border-color: var(--primary); background: var(--row-hover); }
.bcm-action.active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--panel)); color: var(--primary); }
.bcm-panel {
    border: 1px solid var(--border); border-radius: 10px; background: var(--panel-alt);
    padding: .75rem .85rem .85rem; margin-bottom: .9rem;
}
.bcm-panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.bcm-panel label { margin: .1rem 0 .25rem; }
.bcm-panel select, .bcm-panel input[type=date] { width: 100%; }
.bcm-section-title {
    display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); font-weight: 700; margin: .4rem 0 .35rem !important;
}
#cardDescInput {
    width: 100%; min-height: 90px; resize: vertical; padding: .65rem .75rem;
    border: 1px solid var(--border); border-radius: 9px; background: var(--panel); color: var(--text);
    font: inherit; font-size: .9rem; line-height: 1.5;
}
#cardDescInput:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
.bcm-side {
    border-left: 1px solid var(--border); background: var(--panel-alt); padding: 1rem;
    display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.bcm-side h4 { font-size: .92rem; margin-bottom: .6rem; }
.bcm-side .card-comment-compose { flex-shrink: 0; display: flex; flex-direction: column; align-items: stretch; gap: .4rem; }
.bcm-side .card-comment-compose textarea { flex: none; width: 100%; min-height: 72px; }
.bcm-side .card-comments { flex: 1; max-height: none; overflow-y: auto; margin-top: .7rem; }
.bcm-mention-row { display: flex; gap: .35rem; align-items: center; margin-top: .4rem; flex-wrap: wrap; }
.bcm-mention-row select {
    flex: 1 1 130px; min-width: 0; padding: .4rem .5rem; border: 1px solid var(--border); border-radius: 8px;
    background: var(--panel); color: var(--text); font: inherit; font-size: .82rem;
}
.board-card-modal.single .bcm-body { grid-template-columns: 1fr; }
.board-card-modal.single .bcm-side { display: none; }
.card-template-banner {
    display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
    padding: .65rem 1.1rem; background: linear-gradient(90deg, #1d4ed8, #2563eb); color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.2);
}
.card-template-banner-text { display: inline-flex; align-items: center; gap: .45rem; font-size: .9rem; font-weight: 700; }
.card-template-ico { font-size: 1.05rem; }
.card-template-banner .btn-primary { margin-left: auto; background: #3b82f6; border-color: rgba(255,255,255,.35); color: #fff; }
.card-template-banner .btn-primary:hover { background: #60a5fa; }
@media (max-width: 700px) {
    .card-template-banner .btn-primary { margin-left: 0; }
}

/* Menú del tablero */
.board-view-menu-wrap { position: relative; display: inline-flex; }
.board-view-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 90; min-width: 190px;
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 16px 34px rgba(0,0,0,.35); padding: .3rem;
}
.board-view-menu.hidden { display: none; }
.board-view-menu button {
    display: block; width: 100%; text-align: left; border: none; background: none; color: var(--text);
    border-radius: 7px; padding: .5rem .55rem; cursor: pointer; font: inherit; font-size: .82rem;
}
.board-view-menu button:hover { background: var(--row-hover); }

/* Alta rápida de tarjetas */
.board-add-wrap { display: flex; align-items: center; gap: .2rem; }
.board-add-wrap.composing { display: block; }
.board-add-wrap.composing .board-add-form { width: 100%; }
.board-add-wrap .board-add-card { flex: 1; min-width: 0; }
.board-template-form { display: flex; flex-direction: column; gap: .3rem; }
.board-template-edit-link {
    width: 100%; margin-top: .25rem; padding: .45rem .5rem; border: 1px solid var(--border);
    border-radius: 7px; background: transparent; color: var(--text); cursor: pointer; font: inherit; font-size: .8rem;
}
.board-template-edit-link:hover { background: var(--row-hover); }
.board-add-template {
    flex-shrink: 0; width: 30px; height: 30px; border: none; border-radius: 7px; background: none;
    color: var(--muted); cursor: pointer; font-size: 1rem;
}
.board-add-template:hover { background: var(--panel); color: var(--text); }
.board-add-form {
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: .4rem;
    box-shadow: 0 6px 18px rgba(0,0,0,.16);
}
.board-add-input {
    width: 100%; min-height: 54px; resize: vertical; border: none; background: transparent;
    color: var(--text); font: inherit; font-size: .86rem; line-height: 1.4;
}
.board-add-input:focus { outline: none; }
.board-add-actions { display: flex; align-items: center; gap: .25rem; margin-top: .3rem; }
.board-add-close { margin-left: auto; border: none; background: none; color: var(--muted); cursor: pointer; padding: .3rem; border-radius: 6px; }
.board-add-close:hover { background: var(--row-hover); color: var(--text); }

/* Selector de plantillas */
.board-template-picker {
    position: fixed; z-index: 600; width: 270px; max-height: 340px; overflow-y: auto;
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 16px 34px rgba(0,0,0,.38); padding: .3rem;
}
.board-template-picker.hidden { display: none; }
.board-template-option {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem; width: 100%;
    border: none; background: none; color: var(--text); text-align: left; padding: .5rem .55rem;
    border-radius: 7px; cursor: pointer; font: inherit; font-size: .82rem;
}
.board-template-option:hover { background: var(--row-hover); }
.board-template-option small { color: var(--primary); font-size: .68rem; font-weight: 700; }
.board-template-sep { height: 1px; background: var(--border); margin: .25rem .2rem; }
.board-template-empty { padding: .5rem; font-size: .8rem; }

/* Administrador de plantillas */
.board-templates-modal {
    width: min(680px, 96vw) !important; max-height: 90vh; display: flex; flex-direction: column;
    padding: 0; overflow: hidden;
}
.board-templates-main { overflow-y: auto; padding: 1rem 1.1rem; }
.board-templates-list { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .7rem; }
.board-template-item {
    display: flex; align-items: center; gap: .6rem; padding: .55rem .65rem;
    border: 1px solid var(--border); border-radius: 9px; background: var(--panel-alt);
    cursor: pointer;
}
.board-template-item:hover { border-color: var(--primary); }
.board-template-item-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.board-template-item-main strong { font-size: .86rem; }
.board-template-item-main small { color: var(--muted); font-size: .75rem; width: 100%; }
.template-editor { border-top: 1px solid var(--border); margin-top: .8rem; padding-top: .8rem; }
.template-editor-banner {
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .65rem .8rem;
    background: color-mix(in srgb, var(--primary) 12%, var(--panel-alt));
    border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
    border-radius: 9px; margin-bottom: .9rem;
}
.template-editor-ico { font-size: 1.15rem; }
.template-editor-banner-text { font-size: .92rem; font-weight: 700; }
.template-editor-banner-actions { margin-left: auto; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.template-target-list {
    max-width: 160px; padding: .3rem .4rem; border: 1px solid var(--border); border-radius: 6px;
    background: var(--panel); color: var(--text); font: inherit; font-size: .78rem;
}
.modal-card input.template-title-input { font-size: 1.3rem; font-weight: 700; }

/* Formato de textos de tarjeta */
.bcm-topline { margin-bottom: .35rem; }
.bcm-list-select {
    max-width: 220px; padding: .3rem .55rem; border: 1px solid var(--border); border-radius: 7px;
    background: var(--panel-alt); color: var(--text); font: inherit; font-size: .78rem; font-weight: 600;
}
.bcm-action-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-left: .15rem; border: 1px solid rgba(255,255,255,.25); }
.bcm-format {
    display: flex; align-items: center; gap: .12rem; flex-wrap: wrap; padding: .25rem .3rem;
    border: 1px solid var(--border); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--panel-alt);
}
.bcm-format button {
    border: none; background: none; color: var(--text); cursor: pointer; border-radius: 5px;
    font: inherit; font-size: .8rem; padding: .2rem .35rem;
}
.bcm-format button:hover { background: var(--row-hover); }
.bcm-format + textarea, .bcm-format + #cardDescInput { border-top-left-radius: 0; border-top-right-radius: 0; border-top: 0; }
.bcm-desc-preview {
    margin-top: .4rem; border-left: 2px solid var(--border); padding: .15rem .6rem;
    font-size: .86rem; line-height: 1.45; color: var(--text);
}
.bcm-desc-preview::before {
    content: 'Vista previa'; display: block; font-size: .64rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .2rem;
}
.bcm-rich p { margin: 0 0 .45em; }
.bcm-rich p:last-child { margin-bottom: 0; }
.bcm-rich ul, .bcm-rich ol { margin: .2em 0 .5em; padding-left: 1.2em; }
.bcm-rich li { margin: .1em 0; }
.bcm-rich a { color: var(--primary); text-decoration: underline; }
.bcm-rich blockquote { margin: .3em 0; padding-left: .6em; border-left: 3px solid var(--border); color: var(--muted); }
.bcm-rich code { background: var(--panel-alt); padding: 0 .25em; border-radius: 3px; }
.card-comment-text p { margin: 0 0 .35em; }
.card-comment-text p:last-child { margin-bottom: 0; }
.card-comment-text ul, .card-comment-text ol { margin: .2em 0 .4em; padding-left: 1.2em; }
.card-comment-text a { color: var(--primary); text-decoration: underline; }
.bcm-activity .card-comment-body { background: transparent; border: none; padding: .1rem 0; }
.bcm-activity .card-comment-text { color: var(--muted); font-size: .76rem; }

/* Adjuntos con vista de imagen */
.card-attachment {
    display: flex; align-items: center; gap: .55rem; flex-wrap: nowrap;
    border: 1px solid var(--border); border-radius: 9px; padding: .4rem; background: var(--panel-alt);
}
.card-attachment.has-img { align-items: flex-start; }
.card-attachment-thumb {
    width: 64px; height: 64px; padding: 0; border: 1px solid var(--border); border-radius: 8px;
    overflow: hidden; background: var(--panel); cursor: pointer; flex-shrink: 0;
}
.card-attachment-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-attachment-icon {
    width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px;
    background: var(--panel); flex-shrink: 0; font-size: 1rem;
}
.card-attachment-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.card-attachment-name { color: var(--text); font-size: .82rem; }
.card-attachment-info .muted { font-size: .72rem; }
.card-attachment .btn-link { margin-left: auto; }
@media (max-width: 700px) {
    .card-attachment { flex-wrap: wrap; }
    .card-attachment .btn-link { margin-left: 0; }
}

.board-bg-picker { display: flex; gap: .4rem; flex-wrap: wrap; margin: .4rem 0 .8rem; }
.board-bg-choice {
    width: 68px; height: 42px; border-radius: 9px; border: 2px solid transparent; cursor: pointer;
    position: relative; overflow: hidden; background: var(--panel-alt); padding: 0;
}
.board-bg-choice span {
    position: absolute; inset: auto 0 0 0; background: rgba(0, 0, 0, .48); color: #fff;
    font-size: .6rem; line-height: 1.3; padding: .1rem .15rem; text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.board-bg-choice.on { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 28%, transparent); }
.board-bg-choice.none { background: repeating-linear-gradient(45deg, var(--panel-alt), var(--panel-alt) 6px, var(--panel) 6px, var(--panel) 12px); }
.board-bg-upload { margin: .4rem 0 .8rem; }
.board-bg-upload input[type=file] { margin: .35rem 0; color: var(--muted); font-size: .82rem; }

.board-archived-modal { width: min(820px, 96vw) !important; max-width: 96vw !important; max-height: 90vh; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.board-archived-body { padding: 1rem 1.1rem 1.2rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1.2rem; }
.board-archived-section h4 { font-size: .9rem; margin-bottom: .5rem; }
.board-archived-list { display: flex; flex-direction: column; gap: .4rem; }
.board-archived-item {
    display: flex; align-items: center; gap: .6rem; padding: .55rem .65rem;
    border: 1px solid var(--border); border-radius: 10px; background: var(--panel-alt);
}
.board-archived-icon {
    width: 30px; height: 30px; display: grid; place-items: center; flex-shrink: 0;
    border-radius: 8px; background: var(--panel); font-size: .95rem;
}
.board-archived-color { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; margin: 0 .55rem; }
.board-archived-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.board-archived-info strong { font-size: .88rem; overflow-wrap: anywhere; }
.board-archived-info small { font-size: .74rem; color: var(--muted); }
.board-archived-actions { display: flex; align-items: center; justify-content: flex-end; gap: .35rem; flex-wrap: wrap; }
.board-archived-actions .btn-ghost { padding: .25rem .55rem; font-size: .78rem; }
.board-archived-actions button:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 620px) {
    .board-archived-item { flex-wrap: wrap; }
    .board-archived-actions { width: 100%; justify-content: flex-start; padding-left: 2.4rem; }
}

@media (max-width: 900px) {
    .board-search { width: 150px; }
    .board-view-desc { max-width: 220px; }
    .board-card-modal { width: 96vw !important; max-height: 94vh; }
    .bcm-body { display: block; overflow-y: auto; }
    .bcm-main { overflow: visible; }
    .bcm-side { border-left: 0; border-top: 1px solid var(--border); max-height: none; }
    .bcm-side .card-comments { max-height: 300px; }
    .bcm-panel-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    .sidebar { border-right: 0; border-bottom: 1px solid var(--sidebar-border); }
    .sidebar-nav { padding: .2rem .35rem; gap: .1rem; }
    .sidebar-nav .nav-item { border-bottom: 0; border-radius: 8px; padding: .65rem .7rem; }
    .sidebar-nav .nav-item.active { box-shadow: none; }
    .sidebar-collapse-btn { display: none; }
    .sidebar-inbox { order: 2; flex-direction: row; height: auto; padding: .25rem .4rem; gap: .35rem; }
    .sidebar-inbox .inbox-btn { width: 34px; height: 34px; flex: none; padding: 0; justify-content: center; }
    .presence-wrap { order: 3; }
    .theme-toggle-wrap { order: 4; }
    .sidebar-user { order: 5; }
    .sidebar-nav { order: 6 !important; }
    .app-layout.sidebar-collapsed .sidebar { width: 100%; }
    .app-layout.sidebar-collapsed .sidebar-brand {
        flex-direction: row; align-items: center; gap: .6rem; padding: .6rem .9rem;
    }
    .app-layout.sidebar-collapsed .brand-name { display: inline; }
    .app-layout.sidebar-collapsed .nav-item { padding: .8rem .8rem; }
    .app-layout.sidebar-collapsed .nav-lbl { display: inline; }
    .app-layout.sidebar-collapsed .nav-ic { font-size: 1rem; margin-right: .45rem; }
    .app-layout.sidebar-collapsed .sidebar-user { flex-direction: row; padding: .4rem .7rem; }
    .app-layout.sidebar-collapsed .theme-toggle-wrap { padding: .3rem .5rem; }
}

/* ======================================================================
   Blogs
   ====================================================================== */
/* El scroll vive en la pestaña (ancho completo) para que la barra quede pegada
   al borde derecho de la ventana, aunque el contenido esté centrado con max-width. */
#blogsTab { overflow-y: auto; overflow-x: hidden; }
#blogsTab > .content { flex: 0 0 auto; overflow: visible; }
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 1rem; }
.blog-card {
    border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--panel);
    cursor: pointer; transition: transform .12s, border-color .12s, box-shadow .12s; text-align: left;
}
.blog-card:hover, .blog-card:focus-visible { transform: translateY(-2px); border-color: var(--primary); box-shadow: 0 10px 26px rgba(15,23,42,.16); outline: none; }
.blog-card-cover { height: 92px; display: grid; place-items: center; color: #fff; font-size: 1.6rem; font-weight: 800; letter-spacing: .04em; }
.blog-card-cover span { opacity: .92; background: rgba(0,0,0,.18); border-radius: 12px; padding: .15rem .55rem; }
.blog-card-body { padding: .75rem .85rem .8rem; }
.blog-card-body h3 { font-size: 1.02rem; margin-bottom: .25rem; overflow-wrap: anywhere; }
.blog-card-body p { font-size: .82rem; color: var(--muted); line-height: 1.35; margin: 0 0 .55rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.blog-card-meta { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; font-size: .76rem; color: var(--muted); }
.blog-card-meta .blog-av { width: 22px; height: 22px; font-size: .58rem; }
.blog-mini { font-size: .76rem; color: var(--muted); }
.blog-av { flex-shrink: 0; }
.blog-av.sm { width: 28px; height: 28px; font-size: .66rem; }
.blog-av.lg { width: 46px; height: 46px; font-size: .9rem; }

.blog-banner {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    padding: 1rem 1.1rem; border-radius: 14px; margin-bottom: 1rem; color: #fff;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}
.blog-banner-main { min-width: 0; flex: 1 1 320px; }
.blog-banner-main .btn-ghost { color: #fff; border-color: rgba(255,255,255,.35); margin-bottom: .45rem; }
.blog-banner h3 { color: #fff; font-size: 1.35rem; margin: 0 0 .2rem; overflow-wrap: anywhere; }
.blog-view-desc { margin: 0 0 .45rem; font-size: .86rem; opacity: .9; max-width: 720px; }
.blog-view-meta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .78rem; opacity: .95; }
.blog-view-meta .blog-av { width: 24px; height: 24px; font-size: .62rem; }
.blog-view-meta .badge { background: rgba(255,255,255,.18); color: #fff; }
.blog-banner-side { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.blog-banner-side .btn-ghost { color: #fff; border-color: rgba(255,255,255,.35); }
.blog-banner-side .btn-ghost.danger { color: #fecaca; }
.blog-follow-inline.on, #blogFollowBtn.on { background: rgba(255,255,255,.22); border-color: #fff; }

.blog-posts { display: flex; flex-direction: column; gap: .55rem; }
.blog-post-row {
    display: flex; align-items: center; gap: .8rem; padding: .75rem .85rem; border: 1px solid var(--border);
    border-radius: 11px; background: var(--panel); cursor: pointer; text-align: left;
}
.blog-post-row:hover, .blog-post-row:focus-visible { border-color: var(--primary); background: var(--row-hover); outline: none; }
.blog-post-row-main { flex: 1; min-width: 0; }
.blog-post-row h4 { font-size: .96rem; margin: 0 0 .2rem; overflow-wrap: anywhere; }
.blog-post-row p { font-size: .82rem; color: var(--muted); margin: 0 0 .35rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.blog-post-row-meta { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; color: var(--muted); font-size: .76rem; }
.blog-post-row-meta .blog-av { width: 20px; height: 20px; font-size: .55rem; }
.blog-score { min-width: 44px; text-align: center; font-weight: 800; font-family: ui-monospace, Consolas, monospace; color: var(--muted); }
.blog-score.up { color: var(--green); } .blog-score.down { color: var(--danger); }

.blog-post-back { margin-bottom: .7rem; }
.blog-article { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 1.2rem 1.35rem 1rem; }
.blog-article-head { border-bottom: 1px solid var(--border); padding-bottom: .9rem; margin-bottom: 1rem; }
.blog-article-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.blog-article-title-row h1 { font-size: 1.55rem; line-height: 1.2; margin: 0; overflow-wrap: anywhere; }
.blog-article-actions { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.blog-article-summary { color: var(--muted); font-size: .92rem; margin: .45rem 0 0; }
.blog-article-meta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; color: var(--muted); font-size: .8rem; margin-top: .7rem; }
.blog-markdown { font-size: .94rem; line-height: 1.65; overflow-wrap: anywhere; }
.blog-style-serif { font-family: Georgia, 'Times New Roman', Cambria, serif; }
.blog-style-mono { font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace; }
.blog-style-compact { font-size: .88rem; line-height: 1.5; }
.bf-sans { font-family: inherit; }
.bf-serif { font-family: Georgia, 'Times New Roman', Cambria, serif; }
.bf-mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.bf-rounded { font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif; letter-spacing: .01em; }
.bf-sm { font-size: .82em; }
.bf-lg { font-size: 1.18em; }
.bf-xl { font-size: 1.42em; }
.blog-markdown mark { background: color-mix(in srgb, #facc15 38%, transparent); color: inherit; border-radius: 3px; padding: 0 .1em; }
.blog-markdown u { text-underline-offset: 2px; }
.blog-align-left { text-align: left; }
.blog-align-center { text-align: center; }
.blog-align-right { text-align: right; }
.blog-align-justify { text-align: justify; }
.blog-align-center img { margin-left: auto; margin-right: auto; }
.blog-align-right img { margin-left: auto; margin-right: 0; }
.blog-align-left img { margin-left: 0; margin-right: auto; }
.blog-markdown h2, .blog-markdown h3, .blog-markdown h4 { margin: 1.2rem 0 .4rem; }
.blog-markdown p { margin: .55rem 0; }
.blog-markdown ul, .blog-markdown ol { padding-left: 1.5rem; margin: .5rem 0; }
.blog-markdown blockquote { border-left: 4px solid var(--primary); margin: .7rem 0; padding: .35rem .8rem; background: var(--panel-alt); border-radius: 0 8px 8px 0; color: var(--muted); }
.blog-markdown code { background: var(--panel-alt); border: 1px solid var(--border); border-radius: 5px; padding: .05rem .28rem; font-size: .86em; }
.blog-markdown pre { background: var(--panel-alt); border: 1px solid var(--border); border-radius: 10px; padding: .75rem; overflow: auto; }
.blog-markdown pre code { background: none; border: 0; padding: 0; }
.blog-markdown img { max-width: 100%; height: auto; border-radius: 10px; margin: .5rem 0; display: block; }
.blog-markdown .blog-align-center img { margin-left: auto; margin-right: auto; }
.blog-markdown .blog-align-right img { margin-left: auto; margin-right: 0; }
.blog-markdown .blog-align-left img { margin-left: 0; margin-right: auto; }
.blog-markdown a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.blog-img-err { display: inline-block; padding: .35rem .5rem; border: 1px dashed var(--border); border-radius: 8px; }
.blog-post-footer { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-top: 1.2rem; padding-top: .8rem; border-top: 1px solid var(--border); }
.blog-post-footer-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.blog-vote-buttons { display: inline-flex; align-items: center; gap: .3rem; }
.blog-vote-buttons strong { min-width: 2.2rem; text-align: center; font-family: ui-monospace, Consolas, monospace; }
.blog-vote-buttons strong.up, .blog-comment-score strong.up { color: var(--green); }
.blog-vote-buttons strong.down, .blog-comment-score strong.down { color: var(--danger); }
.blog-vote-btn { background: var(--panel-alt); border: 1px solid var(--border); color: var(--muted); border-radius: 6px; cursor: pointer; font: inherit; font-size: .78rem; padding: .2rem .45rem; }
.blog-vote-btn:hover { border-color: var(--primary); color: var(--text); }
.blog-vote-btn.on.up { color: var(--green); border-color: var(--green); }
.blog-vote-btn.on.down { color: var(--danger); border-color: var(--danger); }
.blog-author-credit { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem; margin-top: 1rem; padding: .8rem; background: var(--panel-alt); border-radius: 12px; }
.blog-author-credit > div:not(.blog-edited-by) { display: flex; flex-direction: column; gap: .1rem; }
.blog-author-credit strong { font-size: .92rem; }
.blog-edited-by { margin-left: .2rem; display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; position: relative; padding-left: .9rem; }
.blog-edited-by::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 1px; height: 34px; background: var(--border); }
.blog-edited-by-label { font-size: .74rem; color: var(--muted); white-space: nowrap; }
.blog-edited-by-list { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.blog-editor { display: inline-flex; align-items: center; gap: .38rem; font-size: .85rem; }
.blog-editor > span:last-child { color: var(--text); font-weight: 600; }
.blog-editor .blog-av { width: 30px; height: 30px; font-size: .72rem; }

.blog-comments-section { margin-top: 1.3rem; }
.blog-comments-section h3 { font-size: 1.05rem; margin-bottom: .65rem; }
.blog-comment-composer { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: .7rem; margin-bottom: 1rem; }
.blog-comment-composer textarea { width: 100%; resize: vertical; min-height: 64px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-alt); color: var(--text); font: inherit; font-size: .9rem; padding: .55rem .65rem; }
.blog-comment-actions { display: flex; justify-content: flex-end; gap: .4rem; margin-top: .45rem; }
.blog-reply-banner { font-size: .8rem; color: var(--primary); margin-bottom: .4rem; }
.blog-comments { display: flex; flex-direction: column; gap: .65rem; }
.blog-comment { display: flex; align-items: flex-start; gap: .55rem; margin-left: calc(min(var(--depth, 0), 6) * 1.2rem); }
.blog-comment-body { flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: .55rem .65rem; }
.blog-comment-head { display: flex; align-items: baseline; gap: .45rem; flex-wrap: wrap; font-size: .76rem; color: var(--muted); }
.blog-comment-head strong { color: var(--text); font-size: .82rem; }
.blog-comment-text { font-size: .88rem; line-height: 1.45; margin-top: .25rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.blog-comment-text a { color: var(--primary); text-decoration: underline; }
.blog-comment-actions { display: flex; align-items: center; justify-content: center; gap: .55rem; flex-wrap: wrap; margin-top: .45rem; font-size: .74rem; }
.blog-comment-score { display: inline-flex; align-items: center; gap: .2rem; }
.blog-comment-score strong { min-width: 1.7rem; text-align: center; font-family: ui-monospace, Consolas, monospace; }
.blog-comment-edit { width: 100%; min-height: 74px; resize: vertical; margin-top: .3rem; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-alt); color: var(--text); font: inherit; font-size: .88rem; line-height: 1.45; }
.blog-comment-edit-actions { display: flex; justify-content: flex-end; gap: .4rem; margin-top: .4rem; }
.blog-edited-legend { font-size: .68rem; font-style: italic; color: var(--muted); background: var(--panel-alt); border: 1px solid var(--border); border-radius: 999px; padding: .02rem .4rem; }
.blog-quote-ref { display: flex; flex-direction: column; gap: .08rem; border-left: 3px solid var(--primary); background: var(--panel-alt); border-radius: 0 7px 7px 0; padding: .25rem .45rem; margin: .3rem 0; font-size: .78rem; color: var(--muted); }
.blog-quote-ref strong { color: var(--text); }
.blog-quote-ref span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.blog-form-modal { width: min(860px, 96vw) !important; max-height: 92vh; overflow-y: auto; }
.blog-access-filter { width: 100%; padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; font-size: .84rem; margin-bottom: .35rem; }
.blog-access-list { max-height: 230px; overflow-y: auto; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-alt); padding: .25rem; }
.blog-access-row { display: flex; align-items: center; gap: .8rem; padding: .35rem .45rem; border-radius: 7px; font-size: .84rem; }
.blog-access-row:hover { background: var(--panel); }
.blog-access-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.blog-access-name small { color: var(--muted); font-size: .7rem; }
.blog-access-row .chk { flex-shrink: 0; font-size: .76rem; }

.blog-editor-modal { width: min(1120px, 97vw) !important; max-width: 97vw !important; max-height: 94vh; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.blog-editor-body { padding: .9rem 1.1rem; overflow-y: auto; min-height: 0; }
.blog-toolbar { position: relative; display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; padding: .35rem; border: 1px solid var(--border); border-bottom: 0; border-radius: 9px 9px 0 0; background: var(--panel-alt); }
.blog-toolbar button { border: 1px solid transparent; background: none; color: var(--text); cursor: pointer; border-radius: 6px; font: inherit; font-size: .78rem; padding: .25rem .45rem; }
.blog-toolbar button:hover { background: var(--panel); border-color: var(--border); }
.blog-toolbar select { max-width: 220px; padding: .25rem .4rem; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--text); font: inherit; font-size: .76rem; }
.blog-toolbar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 .15rem; flex-shrink: 0; }
.blog-toolbar-color { display: inline-flex; align-items: center; gap: .25rem; font-size: .74rem; color: var(--muted); white-space: nowrap; }
.blog-toolbar-color input[type=color] { width: 30px; height: 24px; padding: 1px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); cursor: pointer; }
.blog-color-trigger { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.blog-color-trigger .blog-color-dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(148,163,184,.55); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); flex-shrink: 0; }
.blog-color-pop {
    position: absolute; top: calc(100% + 6px); left: .35rem; z-index: 60;
    width: 228px; padding: .55rem .6rem .6rem;
    background: var(--panel); border: 1px solid var(--border); border-radius: 11px;
    box-shadow: 0 14px 34px rgba(0,0,0,.32);
}
.blog-color-pop.hidden { display: none; }
.blog-color-pop-title { font-size: .72rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); margin-bottom: .4rem; }
.blog-color-swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: .3rem; }
.blog-color-swatch {
    width: 100%; aspect-ratio: 1; min-height: 24px; padding: 0 !important; border: 1px solid rgba(148,163,184,.45) !important;
    border-radius: 7px !important; cursor: pointer; transition: transform .08s ease, box-shadow .08s ease;
}
.blog-color-swatch:hover { transform: translateY(-1px); box-shadow: 0 3px 9px rgba(0,0,0,.25); border-color: var(--text) !important; }
.blog-color-custom { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .55rem; font-size: .74rem; color: var(--muted); cursor: pointer; }
.blog-color-custom input[type=color] { width: 34px; height: 26px; padding: 1px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); cursor: pointer; }
.blog-emoji-picker {
    position: relative; z-index: 35; width: min(360px, 100%);
    display: grid; grid-template-columns: repeat(8, 1fr); gap: .2rem; padding: .45rem; margin: .2rem 0 .4rem;
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 20px rgba(0,0,0,.18);
}
.blog-emoji-picker.hidden { display: none; }
.blog-emoji { border: 1px solid transparent !important; background: none; cursor: pointer; border-radius: 6px; font-size: 1.05rem; padding: .15rem; }
.blog-emoji:hover { background: var(--panel-alt) !important; border-color: var(--border) !important; }
.blog-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; align-items: stretch; }
.blog-editor-grid textarea { width: 100%; min-height: 340px; resize: vertical; padding: .7rem .8rem; border: 1px solid var(--border); border-radius: 0 0 9px 9px; background: var(--panel); color: var(--text); font: inherit; font-size: .88rem; line-height: 1.45; }
.blog-preview-pane { border: 1px solid var(--border); border-radius: 10px; background: var(--panel-alt); padding: .7rem .8rem; min-height: 340px; max-height: 55vh; overflow-y: auto; }
.blog-editor-modal .modal-actions { padding: .8rem 1.1rem; border-top: 1px solid var(--border); margin: 0; }
.blog-editor-modal .error-msg { margin: 0 1.1rem; }

@media (max-width: 900px) {
    .blog-editor-grid { grid-template-columns: 1fr; }
    .blog-editor-grid textarea { min-height: 240px; }
    .blog-preview-pane { min-height: 180px; max-height: 320px; }
    .blog-banner { flex-direction: column; }
    .blog-banner-side { justify-content: flex-start; }
}
@media (max-width: 600px) {
    .blog-article { padding: .9rem; }
    .blog-article-title-row { flex-direction: column; }
    .blog-comment { margin-left: calc(min(var(--depth, 0), 3) * .65rem); }
    .blog-access-row { align-items: flex-start; flex-wrap: wrap; }
    .blog-edited-by { margin-left: 0; width: 100%; padding-left: 0; }
    .blog-edited-by::before { display: none; }
}

/* Buscadores de Blogs */
.blog-search-wrap { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; flex-wrap: wrap; }
.blog-search { flex: 1 1 420px; width: auto; max-width: none; padding: .45rem .65rem; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); color: var(--text); font: inherit; font-size: .85rem; }
.blog-search:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.blog-search-info { font-size: .74rem; color: var(--muted); white-space: nowrap; }
.blog-post-search-wrap { margin-top: .2rem; }
.blog-card-updated { margin-top: .4rem; font-size: .72rem; color: var(--muted); }

/* Avatares con presencia y ficha rápida en Blogs */
.blog-av-wrap { position: relative; display: inline-flex; flex-shrink: 0; align-self: flex-start; cursor: pointer; }
.blog-av-wrap:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 50%; }
.blog-av-wrap .blog-av { display: inline-flex; align-items: center; justify-content: center; }
.blog-contact-msg { width: 100%; margin-top: .7rem; }
.blog-collaborators { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-top: .45rem; font-size: .76rem; }
.blog-collab-label { opacity: .82; }
.blog-collab { display: inline-flex; align-items: center; gap: .28rem; background: rgba(255,255,255,.14); border-radius: 999px; padding: .1rem .45rem .1rem .15rem; }
.blog-collab .blog-av { width: 20px; height: 20px; font-size: .52rem; }
.blog-collab .chat-presence-dot { width: 8px; height: 8px; border-width: 1px; }

/* Portada de cada entrada en el listado */
.blog-post-cover { width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: .9rem; color: #fff; }
.blog-post-cover.has-img { background: var(--panel-alt); border: 1px solid var(--border); }

/* Fondo propio de la entrada */
.blog-article-head.has-bg {
    margin: -.2rem -.2rem 1rem; padding: 1rem 1.1rem; border-radius: 12px; color: #fff;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}
.blog-article-head.has-bg h1,
.blog-article-head.has-bg .blog-article-summary,
.blog-article-head.has-bg .blog-article-meta { color: #fff; }
.blog-article-head.has-bg .blog-article-summary { opacity: .92; }
.blog-article-head.has-bg .blog-article-meta { opacity: .92; }
.blog-article-head.has-bg .btn-ghost { color: #fff; border-color: rgba(255,255,255,.4); }
.blog-article-head.has-bg .btn-link.danger { color: #fecaca; }

/* Votos propios bloqueados */
.blog-vote-btn:disabled { opacity: .45; cursor: not-allowed; }
.blog-vote-btn:disabled:hover { border-color: var(--border); color: var(--muted); }

/* Vista de favoritos y estrellas de entrada */
.blog-home-seg { margin-bottom: .8rem; }
.blog-post-side { display: flex; flex-direction: column; align-items: center; gap: .25rem; flex-shrink: 0; }
.blog-fav-btn { background: none; border: 0; color: var(--muted); font-size: 1.2rem; line-height: 1; cursor: pointer; padding: .1rem .3rem; border-radius: 6px; }
.blog-fav-btn:hover { color: #eab308; background: var(--panel-alt); }
.blog-fav-btn.on { color: #eab308; }
.blog-fav-action.on { color: #eab308; border-color: color-mix(in srgb, #eab308 55%, var(--border)); background: color-mix(in srgb, #eab308 12%, transparent); }
.blog-fav-indicator { display: inline-flex; align-items: center; justify-content: center; color: #eab308; font-size: 1.25rem; line-height: 1; padding: .1rem .3rem; }


/* ===== Propiedad de elementos, transferencias y baja de usuarios ===== */
.btn-link.warning { color: #b45309; }
html[data-theme="dark"] .btn-link.warning { color: #fbbf24; }
.badge.warning { background: rgba(245,158,11,.18); color: #b45309; }
html[data-theme="dark"] .badge.warning { color: #fbbf24; }
.badge.danger { background: rgba(239,68,68,.15); color: var(--danger); }

.ip-foot { border-top: 1px solid var(--border); padding: .55rem .9rem; display: flex; justify-content: flex-end; }

.ownership-transfers-list { display: flex; flex-direction: column; gap: 1rem; max-height: min(64vh, 560px); overflow-y: auto; padding-right: .2rem; }
.ownership-section { display: flex; flex-direction: column; gap: .4rem; }
.ownership-section h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0; }
.ownership-row { display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-alt); }
.ownership-ico { font-size: 1.15rem; line-height: 1; flex-shrink: 0; }
.ownership-row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ownership-row-main strong { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ownership-row-main small { color: var(--muted); font-size: .76rem; }
.ownership-actions { display: inline-flex; gap: .35rem; flex-shrink: 0; }
.ownership-history { margin-top: .35rem; }
.ownership-history summary { cursor: pointer; color: var(--muted); font-size: .8rem; }
.ownership-history-row { display: flex; justify-content: space-between; gap: .6rem; padding: .3rem .2rem; font-size: .8rem; border-top: 1px dashed var(--border); }
.ownership-history-row small { color: var(--muted); }

.offboard-modal { max-height: 90vh; display: flex; flex-direction: column; }
.offboard-elements { display: flex; flex-direction: column; gap: .5rem; overflow-y: auto; max-height: 52vh; margin: .8rem 0; padding-right: .2rem; }
.offboard-item { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-alt); flex-wrap: wrap; }
.offboard-item-main { display: flex; align-items: center; gap: .55rem; min-width: 0; flex: 1; }
.offboard-item-main strong { display: block; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.offboard-item-main small { color: var(--muted); font-size: .76rem; }
.offboard-item label { display: flex; align-items: center; gap: .4rem; font-size: .78rem; color: var(--muted); }
.offboard-item select { min-width: 170px; max-width: 240px; }
#inactiveUserSearch { max-width: 340px; margin: .3rem 0 .7rem; }

/* ===== Vacaciones y permisos ===== */
.vac-page { display: flex; flex-direction: column; gap: .8rem; }
.vac-balance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .65rem; }
.vac-bal-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: .75rem .85rem; }
.vac-bal-card.primary { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); background: color-mix(in srgb, var(--primary) 7%, var(--panel)); }
.vac-bal-lbl { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; }
.vac-bal-num { font-size: 1.55rem; font-weight: 800; line-height: 1.15; margin: .15rem 0; }
.vac-bal-sub { color: var(--muted); font-size: .76rem; }
.vac-bal-card.warn .vac-bal-num { color: #b45309; }
.vac-tabs { align-self: flex-start; }
.vac-tab-badge { display: inline-block; min-width: 18px; padding: 0 .35rem; border-radius: 999px; background: #f59e0b; color: #1f2937; font-size: .7rem; font-weight: 800; text-align: center; }
.vac-tab-badge.hidden { display: none; }
.vac-requests { display: flex; flex-direction: column; gap: .7rem; }
.vac-request-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: .85rem .95rem; display: flex; flex-direction: column; gap: .55rem; }
.vac-request-card.pending { border-left: 4px solid #f59e0b; }
.vac-request-card.approved { border-left: 4px solid #22c55e; }
.vac-request-card.rejected { border-left: 4px solid #ef4444; }
.vac-request-card.needschanges { border-left: 4px solid #3b82f6; }
.vac-req-head { display: flex; align-items: flex-start; gap: .6rem; flex-wrap: wrap; }
.vac-req-title { font-size: 1rem; font-weight: 700; flex: 1; min-width: 180px; }
.vac-req-meta { color: var(--muted); font-size: .8rem; display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.vac-req-reason { font-size: .9rem; white-space: pre-wrap; }
.vac-pill { display: inline-flex; align-items: center; gap: .25rem; border-radius: 999px; padding: .12rem .55rem; font-size: .72rem; font-weight: 700; background: var(--panel-alt); color: var(--muted); }
.vac-pill.vacation { background: rgba(59,130,246,.16); color: #1d4ed8; }
.vac-pill.absence { background: rgba(245,158,11,.18); color: #b45309; }
.vac-pill.sickleave { background: rgba(239,68,68,.15); color: #b91c1c; }
.vac-pill.halfday { background: rgba(20,184,166,.16); color: #0f766e; }
.vac-pill.other { background: rgba(100,116,139,.18); color: #475569; }
.vac-pill.status-pending { background: rgba(245,158,11,.2); color: #b45309; }
.vac-pill.status-approved { background: rgba(34,197,94,.18); color: #15803d; }
.vac-pill.status-rejected { background: rgba(239,68,68,.16); color: #b91c1c; }
.vac-pill.status-needschanges { background: rgba(59,130,246,.16); color: #1d4ed8; }
.vac-pill.status-cancelled { background: rgba(100,116,139,.2); color: #475569; }
html[data-theme="dark"] .vac-pill.vacation, html[data-theme="dark"] .vac-pill.status-needschanges { color: #93c5fd; }
html[data-theme="dark"] .vac-pill.absence, html[data-theme="dark"] .vac-pill.status-pending { color: #fbbf24; }
html[data-theme="dark"] .vac-pill.sickleave, html[data-theme="dark"] .vac-pill.status-rejected { color: #fca5a5; }
html[data-theme="dark"] .vac-pill.status-approved { color: #4ade80; }
.vac-approvals { display: flex; flex-direction: column; gap: .25rem; border-top: 1px dashed var(--border); padding-top: .45rem; }
.vac-approval { display: flex; align-items: center; gap: .45rem; font-size: .84rem; }
.vac-approval .vac-ap-ico { width: 1.15rem; text-align: center; }
.vac-approval .vac-ap-name { flex: 1; }
.vac-approval.current .vac-ap-name { font-weight: 700; }
.vac-approval small { color: var(--muted); }
.vac-attachments { display: flex; flex-direction: column; gap: .45rem; }
.vac-attach-item { display: flex; flex-direction: column; gap: .1rem; }
.vac-attach { display: inline-flex; align-items: center; align-self: flex-start; gap: .3rem; border: 1px solid var(--border); border-radius: 8px; padding: .18rem .5rem; background: var(--panel-alt); color: var(--text); font-size: .78rem; cursor: pointer; }
.vac-attach:hover { border-color: var(--primary); }
.vac-attach-meta { padding-left: .2rem; font-size: .7rem; color: var(--muted); }
.vac-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.vac-mini-balance { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; padding: .55rem .65rem; background: var(--panel-alt); border: 1px solid var(--border); border-radius: 10px; font-size: .8rem; margin-bottom: .5rem; }
.vac-mini-balance b { font-size: 1.05rem; display: block; }

.vac-request-modal { width: min(920px, 96vw) !important; max-height: 92vh; overflow-x: hidden; }
.vac-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); gap: 1.25rem; overflow: visible; }
.vac-form-cal, .vac-form-side { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.vac-form-side textarea {
    width: 100%; min-height: 132px; resize: vertical;
    padding: .65rem .75rem; border: 1px solid var(--border); border-radius: 10px;
    background: var(--panel-alt); color: var(--text); font: inherit; font-size: .9rem; line-height: 1.45;
}
.vac-form-side textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
#vacFiles { width: 100%; color: var(--muted); font: inherit; font-size: .82rem; }
#vacFiles::file-selector-button {
    margin-right: .6rem; padding: .4rem .7rem; border: 1px solid var(--border); border-radius: 8px;
    background: var(--panel-alt); color: var(--text); font: inherit; cursor: pointer;
}
#vacFiles::file-selector-button:hover { border-color: var(--primary); }
.vac-cal-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .35rem; }
.vac-calendar { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--panel); }
.vac-cal-dow, .vac-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.vac-cal-dow span { padding: .35rem 0; text-align: center; font-size: .7rem; color: var(--muted); background: var(--panel-alt); }
.vac-cal-day { min-height: 38px; display: flex; align-items: center; justify-content: center; font-size: .82rem; cursor: pointer; border-top: 1px solid var(--border); user-select: none; }
.vac-cal-day.out { color: var(--muted); opacity: .45; }
.vac-cal-day:hover { background: var(--row-hover); }
.vac-cal-day.today { font-weight: 800; color: var(--primary); }
.vac-cal-day.sel { background: rgba(59,130,246,.18); }
.vac-cal-day.start { border-radius: 8px 0 0 8px; background: var(--primary); color: #fff; }
.vac-cal-day.end { border-radius: 0 8px 8px 0; background: var(--primary); color: #fff; }
.vac-cal-day.start.end { border-radius: 8px; }
.vac-cal-day.nw { color: #b45309; }
.vac-selected { font-size: .84rem; color: var(--muted); min-height: 1.2rem; }
.vac-selected b { color: var(--text); }
#vacDecisionModal .modal-card { width: min(560px, 94vw); }
#vacDecisionModal textarea {
    width: 100%; min-height: 118px; resize: vertical;
    padding: .7rem .8rem; border: 1px solid var(--border); border-radius: 10px;
    background: var(--panel-alt); color: var(--text); font: inherit;
    font-size: .9rem; line-height: 1.45;
}
#vacDecisionModal textarea::placeholder { color: var(--muted); }
#vacDecisionModal textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.vac-decision-actions { flex-wrap: wrap; }

.vac-team-calendar { display: flex; flex-direction: column; gap: .5rem; }
.vac-month { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--panel); }
.vac-month-head, .vac-month-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.vac-month-head span { padding: .45rem 0; text-align: center; font-size: .75rem; color: var(--muted); background: var(--panel-alt); }
.vac-day-cell { min-height: 92px; border-top: 1px solid var(--border); border-right: 1px solid var(--border); padding: .3rem; display: flex; flex-direction: column; gap: .2rem; }
.vac-day-cell:nth-child(7n) { border-right: none; }
.vac-day-cell.out { opacity: .45; background: var(--panel-alt); }
.vac-day-cell.today { outline: 2px solid var(--primary); outline-offset: -2px; }
.vac-day-num { font-size: .76rem; color: var(--muted); font-weight: 700; }
.vac-av-stack { display: flex; flex-wrap: wrap; gap: .18rem; }
.vac-av { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .68rem; font-weight: 700; color: #fff; overflow: hidden; border: 2px solid var(--panel); }
.vac-av img { width: 100%; height: 100%; object-fit: cover; }
.vac-day-names { font-size: .68rem; color: var(--muted); line-height: 1.2; overflow: hidden; }

.vac-cap { background: #ca8a04 !important; bottom: 76px !important; }
.vac-cap .rt-label { color: rgba(255,255,255,.9); }
.vac-cap .rt-title { max-width: 250px; }
.vac-cap.rt-pop { animation: rt-pop .7s ease; }
@media (max-width: 640px) { .vac-cap { bottom: 66px !important; } .vac-cap .rt-title { max-width: 190px; } }
@media (max-width: 760px) { .vac-form-grid { grid-template-columns: 1fr; } .vac-day-cell { min-height: 70px; } }

.vac-admin-policy { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; margin-bottom: .7rem; }
.vac-admin-policy label { display: inline-flex; align-items: center; gap: .35rem; font-size: .86rem; }
.vac-tier-row, .vac-admin-user-row { display: grid; gap: .35rem; align-items: center; padding: .5rem .2rem; border-top: 1px solid var(--border); }
.vac-tier-row { grid-template-columns: 1fr 1fr 1fr auto; }
.vac-tier-row input { width: 100%; }
.vac-admin-user-row { grid-template-columns: minmax(160px, 1.4fr) repeat(3, minmax(100px, .8fr)) minmax(120px, 1fr) auto; font-size: .82rem; }
.vac-admin-user-row .vac-admin-bal { display: flex; flex-direction: column; gap: .2rem; }
.vac-admin-user-row .vac-admin-bal b { font-size: .95rem; }
.vac-admin-user-row input[type="date"], .vac-admin-user-row input[type="number"] { width: 100%; }
.vac-admin-check { display: flex; gap: .6rem; flex-wrap: wrap; font-size: .76rem; }

/* Presencia: de vacaciones (azul) */
.presence-btn.vacation .p-dot, .p-dot.vacation, .tm-dot.vacation { background: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.28); }
.tm-badge.vacation { background: rgba(59,130,246,.16); color: #1d4ed8; }
.tm-card.vacation { border-color: rgba(59,130,246,.35); }
.tm-count.vacation { color: #1d4ed8; }
html[data-theme="dark"] .tm-badge.vacation, html[data-theme="dark"] .tm-count.vacation { color: #93c5fd; }

/* Calendario: días de vacaciones */
.lg-box.vac { background: rgba(59,130,246,.3); border: 1px solid #3b82f6; }
.cal-dh.vac { box-shadow: inset 0 -3px 0 #3b82f6; }
.cal-dvac { font-size: .68rem; color: #1d4ed8; font-weight: 700; padding: 0 .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[data-theme="dark"] .cal-dvac { color: #93c5fd; }
.pcal-day.vac { background: rgba(59,130,246,.08); }
.pcal-vac { font-size: .62rem; color: #1d4ed8; font-weight: 700; }
html[data-theme="dark"] .pcal-vac { color: #93c5fd; }

.dash-vac-panel { grid-column: 1 / -1; }
.dash-vacations { display: flex; flex-direction: column; gap: .35rem; font-size: .86rem; }
.dash-vac-row { display: flex; align-items: center; gap: .45rem; padding: .3rem 0; border-top: 1px dashed var(--border); }
.vac-page > * { flex-shrink: 0; }
.vac-tabs { flex-shrink: 0; }
.bc-col.vac { background: rgba(59,130,246,.07); }
.bc-xl.vac { color: #1d4ed8; font-weight: 700; }
html[data-theme="dark"] .bc-xl.vac { color: #93c5fd; }
.auth-pass { position: relative; display: flex; width: 100%; }
.auth-pass input { width: 100%; padding-right: 2.4rem; }
.auth-pass-btn { position: absolute; right: .25rem; top: 50%; transform: translateY(-50%); border: none; background: transparent; color: var(--muted); cursor: pointer; line-height: 1; padding: .3rem; border-radius: 6px; user-select: none; display: inline-flex; align-items: center; justify-content: center; }
.auth-pass-btn svg { width: 18px; height: 18px; display: block; }
.auth-pass-btn:hover, .auth-pass-btn:focus-visible, .auth-pass-btn.pressed { color: var(--primary); background: transparent; outline: none; }
.cred-form { display: flex; flex-direction: column; gap: .55rem; max-width: 440px; margin-top: .6rem; }
.cred-form input { padding: .65rem .8rem; border: 1px solid var(--border); border-radius: 8px; font-size: .92rem; background: var(--panel); color: var(--text); }
.cred-form .auth-pass input { padding-right: 2.4rem; }
.card-reply-banner { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .35rem .55rem; margin-bottom: .4rem; border-left: 3px solid var(--primary); background: var(--panel-alt); border-radius: 6px; font-size: .78rem; color: var(--muted); }
.card-reply-banner b { color: var(--text); }
.card-comment-quote { font-size: .78rem; color: var(--muted); border-left: 2px solid var(--border); padding-left: .45rem; margin-bottom: .3rem; }

/* Proyectos: autoasignación como responsable y tarea terminada */
.pj-selfassign { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.pj-selfassign h4 { margin: 0 0 .2rem; }
.pj-selfassign p { margin: 0; }
#pjTaskModal .pj-task-done { display: inline-flex; align-items: center; justify-content: flex-start; gap: .55rem; margin: .7rem 0 0; font-size: .92rem; color: var(--text); cursor: pointer; }
#pjTaskModal .pj-task-done input { width: 17px; height: 17px; margin: 0; flex: 0 0 auto; accent-color: var(--primary); cursor: pointer; }
#pjTaskModal .pj-task-done span { line-height: 1.2; }

/* ===== Blogs: etiquetas y formulario ===== */
.blog-tags { display: flex; flex-wrap: wrap; gap: .25rem; margin: .35rem 0 .1rem; }
.blog-tag { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; padding: .05rem .45rem; background: var(--panel-alt); color: var(--muted); font-size: .68rem; line-height: 1.5; }
.blog-card-body .blog-tags, .blog-post-row-main .blog-tags { margin-top: .3rem; }
.blog-form-modal textarea {
    width: 100%; resize: vertical; min-height: 92px; padding: .6rem .7rem;
    border: 1px solid var(--border); border-radius: 8px; background: var(--panel-alt);
    color: var(--text); font: inherit; font-size: .9rem; line-height: 1.45;
}
.blog-form-modal textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

/* Administración: equipos editables en línea */
.entries-head.team-grid, .entry-row.team-grid { grid-template-columns: minmax(0, 2fr) 56px minmax(0, 1.6fr) 80px 80px; }
.team-grid .team-name { width: 100%; min-width: 0; }
.team-grid select { width: 100%; min-width: 0; }
.team-grid input[type=color] { width: 40px; height: 32px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: none; cursor: pointer; }
@media (max-width: 700px) {
    .entries-head.team-grid { display: none; }
    .entry-row.team-grid { grid-template-columns: minmax(0, 1fr) 48px; gap: .5rem; }
    .entry-row.team-grid > :nth-child(3) { grid-column: 1 / -1; }
    .entry-row.team-grid > :nth-child(4)::before { content: "Miembros: "; color: var(--muted); }
    .entry-row.team-grid > :nth-child(4), .entry-row.team-grid > :nth-child(5) { text-align: left; }
}

/* Recordatorios del contador de tiempo: aviso azul abajo al centro */
.toast.timer-nudge {
    background: #1d4ed8; border: none; font: inherit; font-size: .92rem; cursor: pointer; text-align: center;
    z-index: 201; max-width: min(560px, 92vw); line-height: 1.35; padding: .75rem 1.3rem;
}
.toast.timer-nudge:hover { background: #1e40af; }
.toast.timer-nudge:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.toast.timer-nudge.tn-in { animation: tn-in .35s ease; }
@keyframes tn-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .toast.timer-nudge.tn-in { animation: none; } }
/* Si coincide con otro aviso, el otro sube para no encimarse */
body.has-timer-nudge .toast:not(.timer-nudge) { bottom: 5.2rem; }
.tr-min { width: 90px; }
.tr-example { margin: .2rem 0 .8rem; font-style: italic; }

/* Tableros: menú ⋯ de la lista (deja más espacio al nombre) */
.board-list-head .bl-menu-btn { font-size: 1.15rem; font-weight: 700; letter-spacing: .05em; padding: .05rem .4rem .2rem; line-height: 1; }
.bl-menu {
    position: fixed; z-index: 150; min-width: 190px; display: flex; flex-direction: column; padding: .3rem;
    background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0,0,0,.3); animation: mini-in .12s ease;
}
.bl-menu button {
    background: none; border: none; color: inherit; font: inherit; font-size: .88rem; text-align: left;
    padding: .5rem .7rem; border-radius: 7px; cursor: pointer;
}
.bl-menu button:hover, .bl-menu button:focus-visible { background: var(--panel-alt); outline: none; }
.bl-menu button.danger { color: var(--danger); }
#copyListModal .modal-card select { width: 100%; margin-top: .3rem; }
#copyListModal .modal-card input[type=text] { margin-top: .3rem; }
#copyListModal .modal-check { margin-top: .9rem; }

/* Foto al registrar la asistencia */
.modal-card.ap-card { width: min(520px, 94vw); }
.ap-stage { position: relative; background: #0f172a; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; display: grid; place-items: center; }
.ap-stage video, .ap-stage img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ap-status { position: absolute; color: #cbd5e1; font-size: .9rem; }
.att-photo { padding: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; width: 44px; height: 44px; background: var(--panel-alt); cursor: zoom-in; flex-shrink: 0; margin-left: .4rem; }
.att-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ======================================================================
   Aviso de versión nueva y enlace discreto a la app de escritorio
   ====================================================================== */
.version-notice {
    display: flex; align-items: center; gap: .8rem; justify-content: center; flex-wrap: wrap;
    padding: .4rem .9rem; font-size: .84rem; background: color-mix(in srgb, var(--primary) 12%, var(--panel));
    border-bottom: 1px solid var(--border); color: var(--text);
}
.version-notice.hidden { display: none; }
.version-notice .btn-link { font-size: .84rem; font-weight: 600; }
.version-notice .btn-link.muted { color: var(--muted); font-weight: 400; }
.desk-download { display: inline-flex; align-items: center; gap: .35rem; font-size: .76rem; color: var(--muted); }
.section-head .desk-download { margin-left: auto; }          /* junto al total de la semana, a la derecha */
.section-head .desk-download + #weekTotal { margin-left: .4rem; }
.desk-download a { color: var(--muted); text-decoration: none; }
.desk-download a:hover { color: var(--primary); text-decoration: underline; }
.desk-download-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: .7rem; padding: .1rem .25rem; border-radius: 4px; opacity: .6; }
.desk-download-x:hover { opacity: 1; background: var(--panel-alt); }
