/* ==========================================================================
   Demon Trail · Plataforma interna
   Sin dependencias. Tokens en :root, modo oscuro automático, móvil primero en componentes críticos.
   ========================================================================== */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #f4f4f6;
  --surface: #ffffff;
  --surface-2: #f1f1f4;
  --surface-3: #e9e9ee;
  --border: #e5e5eb;
  --border-strong: #d2d2da;
  --text: #111116;
  --text-2: #52525c;
  --text-3: #8b8b96;
  --accent: #d9123f;
  --accent-2: #ff3d61;
  --accent-hover: #b60d33;
  --accent-soft: #ffe8ed;
  --on-accent: #ffffff;
  --gold: #c9973b;
  --success: #15803d;
  --success-soft: #dcfce7;
  --warning: #b45309;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #2563eb;
  --info-soft: #dbeafe;

  --st-backlog: #8b8b96;
  --st-todo: #2563eb;
  --st-in_progress: #d97706;
  --st-review: #9333ea;
  --st-done: #16a34a;

  --sidebar-bg: #09090c;
  --sidebar-bg-2: #121218;
  --sidebar-text: #b9b9c4;
  --sidebar-muted: #6c6c78;
  --sidebar-hover: rgba(255, 255, 255, .06);
  --sidebar-w: 256px;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-xs: 0 1px 2px rgba(17, 17, 22, .05);
  --shadow: 0 1px 2px rgba(17, 17, 22, .04), 0 2px 8px rgba(17, 17, 22, .05);
  --shadow-lg: 0 4px 12px rgba(17, 17, 22, .06), 0 16px 40px rgba(17, 17, 22, .10);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  --bottom-nav-h: 0px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0c10;
    --surface: #15151b;
    --surface-2: #1c1c24;
    --surface-3: #25252e;
    --border: #26262f;
    --border-strong: #363641;
    --text: #ededf2;
    --text-2: #a7a7b3;
    --text-3: #72727e;
    --accent: #f0294f;
    --accent-2: #ff5c7a;
    --accent-hover: #ff4f6f;
    --accent-soft: #3a0c17;
    --success: #22c55e;
    --success-soft: #0f2e1b;
    --warning: #f59e0b;
    --warning-soft: #33240a;
    --danger: #f87171;
    --danger-soft: #3a1111;
    --info: #60a5fa;
    --info-soft: #0f1f3d;
    --sidebar-bg: #060608;
    --sidebar-bg-2: #0d0d12;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 2px 8px rgba(0, 0, 0, .25);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body { margin: 0; font: 14px/1.55 var(--font); color: var(--text); background: var(--bg); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a.link, .rich a { color: var(--accent); }
a.link:hover, .rich a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.015em; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.025em; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 .5em; }
img { max-width: 100%; }
button, input, select, textarea { font-family: inherit; }
code, .mono { font-family: var(--mono); font-size: .9em; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
pre { background: #0f0f14; color: #e6e6ee; padding: 14px 16px; border-radius: var(--radius-sm); overflow-x: auto; font-size: 13px; line-height: 1.6; }
pre code { background: none; padding: 0; color: inherit; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
mark { background: #fff3a3; color: #111; padding: 0 2px; border-radius: 3px; }
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.upper { text-transform: uppercase; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.mb { margin-bottom: 16px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stack > * + * { margin-top: 16px; }
.eyebrow { display: inline-block; font-size: 11.5px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 100; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }
.inline-icon { display: inline-flex; align-items: center; gap: 8px; }
.inline-links { display: inline-flex; gap: 14px; flex-wrap: wrap; justify-content: flex-end; font-size: 13px; }
.touch-only { display: none; }
.resources-tabs { margin-bottom: 18px; }
@media (hover: none) and (pointer: coarse) { .touch-only { display: inline; } .no-touch { display: none; } }

/* ---------- Layout ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); color: var(--sidebar-text);
  background: linear-gradient(180deg, var(--sidebar-bg-2) 0%, var(--sidebar-bg) 60%);
  border-right: 1px solid rgba(255, 255, 255, .05);
  display: flex; flex-direction: column; z-index: 40; transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand img { height: 40px; width: auto; }
.sidebar-brand .sidebar-close { display: none; color: var(--sidebar-text); }
.nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 1px; scrollbar-width: thin; }
.nav-link { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; font-weight: 500; font-size: 13.5px; transition: background .15s, color .15s; }
.nav-link .icon { opacity: .8; }
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.is-active { background: linear-gradient(90deg, rgba(240, 41, 79, .18), rgba(240, 41, 79, .04)); color: #fff; }
.nav-link.is-active .icon { opacity: 1; color: #ff5c7a; }
.nav-link.is-active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent-2); }
.nav-link .badge { margin-left: auto; }
.nav-section { margin: 16px 10px 6px; font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .12em; color: var(--sidebar-muted); }
.nav-section:first-child { margin-top: 6px; }
.sidebar-user { border-top: 1px solid rgba(255, 255, 255, .06); padding: 12px 14px; }
.sidebar-user-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sidebar-user-info span { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-info strong { color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info small { color: #8a8a95; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .xp-bar { margin: 10px 0 6px; background: rgba(255, 255, 255, .08); }
.sidebar-user-actions { display: flex; justify-content: flex-end; gap: 4px; }
.sidebar-user-actions .icon-btn { color: var(--sidebar-text); }
.sidebar-user-actions .icon-btn:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-backdrop { display: none; }

.shell { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .menu-btn { display: none; }
.topbar-search { flex: 1; max-width: 520px; position: relative; display: flex; align-items: center; }
.topbar-search .icon { position: absolute; left: 12px; color: var(--text-3); pointer-events: none; width: 16px; height: 16px; }
.topbar-search input[type=search] { width: 100%; padding-left: 36px; background: var(--surface); border-color: var(--border); border-radius: 10px; }
.notif-btn { position: relative; margin-left: auto; }
.notif-btn .dot, .bottom-nav .dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }
.main { padding: 28px; width: 100%; max-width: 1440px; margin: 0 auto; flex: 1; }
.bottom-nav { display: none; }
.show-mobile { display: none; }

/* ---------- Componentes base ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px;
  border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text);
  font: 550 13.5px var(--font); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  box-shadow: var(--shadow-xs);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 16px; height: 16px; }
.btn small { font-weight: 500; opacity: .8; }
.btn-primary { background: linear-gradient(180deg, var(--accent-2) -40%, var(--accent) 60%); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgba(217, 18, 63, .25), inset 0 1px 0 rgba(255, 255, 255, .15); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 46px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn:disabled, .btn.is-disabled { opacity: .55; cursor: not-allowed; }
.danger { color: var(--danger) !important; }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 9px;
  border: 0; background: transparent; color: var(--text-2); cursor: pointer; transition: background .15s, color .15s; font: 600 13px var(--font);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input[type=url], select, textarea {
  width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--text); font: 14px/1.45 var(--font); transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 84px; }
.chat-form textarea, .quick-add textarea { min-height: 42px; }
select { padding-right: 30px; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input[type=color] { width: 100%; height: 38px; padding: 3px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); }
input[type=file] { font-size: 13px; max-width: 100%; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.form { display: flex; flex-direction: column; gap: 16px; }
.form-narrow { max-width: 780px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > .field { flex: 1 1 170px; }
.form-row.align-center { align-items: center; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field small { font-size: 12px; }
.inline-field { flex-direction: row; align-items: center; gap: 8px; }
.inline-field select { width: auto; }
.w-120 { flex: 0 0 120px !important; }
.w-160 { flex: 0 0 160px !important; }
.field-error { color: var(--danger); font-size: 12.5px; margin: 0; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.form-actions.wrap { flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check-group { display: flex; flex-wrap: wrap; gap: 8px; }
.check-pill { position: relative; cursor: pointer; }
.check-pill input { position: absolute; opacity: 0; pointer-events: none; }
.check-pill span { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--border-strong); font-size: 13px; font-weight: 500; color: var(--text-2); transition: all .15s; }
.check-pill input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.check-pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface-2); }
.switch-row > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { flex-shrink: 0; position: relative; width: 38px; height: 22px; border-radius: 11px; background: var(--border-strong); transition: background .2s; margin-top: 1px; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(16px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 44px; }
.password-toggle {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%); width: 34px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 7px;
  background: transparent; color: var(--text-3); cursor: pointer;
}
.password-toggle:hover { color: var(--text); background: var(--surface-2); }
.password-toggle .icon { width: 17px; height: 17px; }
input::-ms-reveal, input::-ms-clear { display: none; }

.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 23px; padding: 0 9px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 550; white-space: nowrap; }
.pill .icon { width: 13px; height: 13px; }
.pill-active, .pill-accepted { background: var(--success-soft); color: var(--success); }
.pill-paused, .pill-pending { background: var(--warning-soft); color: var(--warning); }
.pill-completed { background: var(--info-soft); color: var(--info); }
.pill-archived, .pill-revoked, .pill-expired { background: var(--surface-2); color: var(--text-3); }
.pill-evidence { background: color-mix(in srgb, var(--st-review) 14%, transparent); color: var(--st-review); }
.pill-pinned { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); }
.pill-required { background: var(--accent-soft); color: var(--accent); }
.pill-sm { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 550; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); color: var(--text-2); }

.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--surface-2); }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-md { width: 34px; height: 34px; font-size: 12.5px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.avatar-xl { width: 112px; height: 112px; font-size: 36px; }
.avatar-initials { background: linear-gradient(135deg, hsl(var(--h) 60% 52%), hsl(calc(var(--h) + 30) 55% 40%)); color: #fff; font-weight: 700; letter-spacing: .02em; }
.avatar-empty { border: 1.5px dashed var(--border-strong); background: transparent; }
.avatar-system { background: var(--accent-soft); color: var(--accent); }
.avatar-system .icon { width: 60%; height: 60%; }
.avatar-more { background: var(--surface-2); color: var(--text-2); font-weight: 600; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); margin-left: -6px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

.xp-bar, .progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.xp-bar span { display: block; height: 100%; background: linear-gradient(90deg, #f0294f, #f5a524); border-radius: inherit; }
.progress span { display: block; height: 100%; background: var(--project, var(--accent)); border-radius: inherit; }

.flashes { position: relative; display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px 11px 14px; border-radius: 11px; border: 1px solid; font-weight: 550; animation: flash-in .25s ease; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-4px); } }
.flash-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); color: var(--success); }
.flash-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }
.flash-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); color: var(--warning); }
.flash .icon-btn { color: inherit; width: 28px; height: 28px; }
.toast-stack { position: fixed; right: 20px; bottom: calc(20px + var(--bottom-nav-h)); z-index: 90; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast-stack .flash { box-shadow: var(--shadow-lg); background-clip: padding-box; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head-main { min-width: 0; }
.page-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.hero-head h1 { font-size: 30px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumbs { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; flex-wrap: wrap; }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs .icon { width: 13px; height: 13px; }
.project-dot { width: 12px; height: 12px; border-radius: 4px; background: var(--project, var(--accent)); display: inline-block; flex-shrink: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--project, var(--accent)) 18%, transparent); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: -8px 0 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 11px 12px; color: var(--text-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab .icon { width: 16px; height: 16px; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }

.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-3); gap: 2px; flex-wrap: wrap; }
.segmented a { padding: 5px 12px; border-radius: 8px; color: var(--text-2); font-weight: 550; font-size: 13px; }
.segmented a.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.chips { display: flex; gap: 8px; margin-bottom: 18px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: 17px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 550; font-size: 13px; white-space: nowrap; transition: all .15s; }
.chip .icon { width: 15px; height: 15px; }
.chip small { color: var(--text-3); font-weight: 500; }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip.is-active small { color: inherit; opacity: .7; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-xs); }
.panel > h2 { margin-bottom: 12px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.panel-head h2 small { font-weight: 500; }
.panel-foot { display: block; text-align: center; padding: 10px 0 0; color: var(--text-2); font-size: 13px; }
.panel-foot:hover { color: var(--accent); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid-main-side { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.grid-main-side > aside { display: flex; flex-direction: column; gap: 16px; }
.grid-side-main { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters input[type=search] { flex: 1 1 220px; width: auto; }
.filters select { width: auto; flex: 0 1 auto; }

.search-hero { position: relative; display: flex; align-items: center; gap: 8px; margin-bottom: 16px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.search-hero > .icon { margin-left: 10px; color: var(--text-3); }
.search-hero input[type=search] { border: 0; box-shadow: none; min-height: 42px; font-size: 15px; background: transparent; }
.search-hero input:focus { box-shadow: none; }
.search-hero .btn { height: 42px; }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 52px 16px; color: var(--text-2); }
.empty-state > .icon { width: 38px; height: 38px; color: var(--text-3); margin-bottom: 4px; }
.empty-state.small { padding: 28px 16px; }
.empty-state.small > .icon { width: 26px; height: 26px; }
.empty-state .btn { margin-top: 10px; }
.error-page .error-code { font-size: 72px; font-weight: 800; letter-spacing: -.04em; background: linear-gradient(135deg, var(--accent-2), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }

/* Estadísticas */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; transition: border-color .15s, box-shadow .15s; box-shadow: var(--shadow-xs); overflow: hidden; }
a.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.stat-label { font-size: 12.5px; color: var(--text-2); font-weight: 550; }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-value small { font-size: 12.5px; font-weight: 500; letter-spacing: 0; color: var(--text-2); }
.stat-alert .stat-value { color: var(--danger); }
.stat-xp { background: linear-gradient(135deg, #16161d, #0b0b0f); border-color: #1f1f28; color: #fff; }
.stat-xp .stat-label, .stat-xp .stat-value small { color: #a8a8b5; }
.stat-xp .xp-bar { margin-top: 8px; background: rgba(255, 255, 255, .1); }

/* Feeds y listas */
.feed { list-style: none; margin: 0; padding: 0; }
.feed-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.feed-item:first-child { border-top: 0; }
.feed-item > a, .feed-item > div { flex: 1; min-width: 0; }
.feed-item time { display: block; font-size: 12px; color: var(--text-3); margin-top: 1px; }
.feed-item > div a { color: var(--text); font-weight: 550; }
.feed-item > div a:hover { color: var(--accent); }
.feed-item.is-unread > a { font-weight: 550; }
.feed-item.is-unread::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin: 9px -4px 0 -2px; flex-shrink: 0; }
.feed-large .feed-item { padding: 12px 18px; }
.feed-large .feed-item:hover { background: var(--surface-2); }
.link-list { list-style: none; margin: 0; padding: 0; }
.link-list a { display: flex; align-items: center; gap: 8px; padding: 7px 6px; border-radius: 8px; font-size: 13.5px; }
.link-list a .icon { width: 15px; height: 15px; color: var(--text-3); }
.link-list a:hover { background: var(--surface-2); }

.project-mini-list { list-style: none; margin: 0; padding: 0; }
.project-mini-list a { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-radius: 9px; }
.project-mini-list a:hover { background: var(--surface-2); }
.project-mini-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 550; }
.project-mini-list .progress { width: 90px; flex-shrink: 0; }
.people { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.people li { display: flex; align-items: center; gap: 8px; font-size: 13px; }

/* Prioridad y estado */
.prio { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
.prio.prio-1 { background: var(--text-3); }
.prio.prio-2 { background: var(--info); }
.prio.prio-3 { background: var(--warning); }
.prio.prio-4 { background: var(--danger); }
.prio-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.status { display: inline-flex; align-items: center; height: 23px; padding: 0 9px; border-radius: 7px; font-size: 12px; font-weight: 650; white-space: nowrap; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex-shrink: 0; display: inline-block; }
.status-backlog { --c: var(--st-backlog); }
.status-todo { --c: var(--st-todo); }
.status-in_progress { --c: var(--st-in_progress); }
.status-review { --c: var(--st-review); }
.status-done { --c: var(--st-done); }
.due { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.due .icon { width: 13px; height: 13px; }
.due.is-overdue { color: var(--danger); font-weight: 650; }
.due.is-today { color: var(--warning); font-weight: 650; }
.due.is-soon { color: var(--text); }
.type-bug { color: var(--danger); }
.type-feature { color: var(--warning); }
.type-deliverable { color: var(--st-review); }
.type-task { color: var(--info); }

.task-list { display: flex; flex-direction: column; }
.task-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 112px 92px 110px 28px; align-items: center; gap: 12px; padding: 11px 18px; border-top: 1px solid var(--border); }
.task-row:first-child { border-top: 0; }
.task-row:hover { background: var(--surface-2); }
.task-row-ref { display: inline-flex; align-items: center; gap: 5px; font: 600 12px var(--mono); color: var(--text-2); }
.task-row-ref .icon, .task-ref .icon { width: 14px; height: 14px; }
.task-row-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 550; }
.task-row-title small { font-weight: 400; margin-left: 6px; }
.task-list.compact .task-row { grid-template-columns: 96px minmax(0, 1fr) 100px 24px; padding: 10px 4px; }
.task-list.compact .task-row .status, .task-list.compact .task-row .prio-label { display: none; }

/* Proyectos */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; margin-bottom: 16px; }
.project-card { position: relative; padding: 18px; display: flex; flex-direction: column; gap: 8px; overflow: hidden; transition: box-shadow .2s, transform .2s, border-color .2s; }
.project-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--project); }
.project-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--border-strong); }
.project-card-top { display: flex; justify-content: space-between; align-items: center; }
.project-key { font: 700 12px var(--mono); color: var(--project); }
.project-card h2 { font-size: 16.5px; }
.project-card p { min-height: 2.9em; margin: 0; font-size: 13px; }
.project-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.project-head h1 .project-dot { width: 16px; height: 16px; }

/* Tablero */
.board-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.board-jump { display: none; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
.column { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 250px); min-height: 200px; scroll-snap-align: start; }
.column-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.column-head h2 { font-size: 13px; }
.column-head .count { margin-left: auto; font-size: 12px; color: var(--text-2); font-weight: 650; background: var(--surface); border-radius: 10px; padding: 1px 8px; }
.column-body { flex: 1; overflow-y: auto; padding: 4px 8px 8px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.column-body.is-over { background: color-mix(in srgb, var(--accent) 7%, transparent); border-radius: 10px; outline: 2px dashed color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: -4px; }
.column-more { text-align: center; font-size: 12.5px; color: var(--text-2); padding: 6px; }
.column-more:hover { color: var(--accent); }
.task-card { position: relative; box-shadow: var(--shadow); border-radius: 11px; transition: box-shadow .15s, opacity .15s, transform .15s; -webkit-touch-callout: none; }
.task-card::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: transparent; }
.task-card.prio-4::before { background: var(--danger); }
.task-card.prio-3::before { background: var(--warning); }
.task-card[draggable=true] { cursor: grab; }
.task-card:hover { box-shadow: var(--shadow-lg); }
.task-card.is-dragging { opacity: .4; }
.task-card.is-touch-ghost { position: fixed; z-index: 100; pointer-events: none; transform: rotate(2deg) scale(1.03); box-shadow: var(--shadow-lg); opacity: .95; }
.task-card.is-lifting { transform: scale(.98); }
.task-card-link { display: block; padding: 11px 12px 11px 14px; }
.task-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.task-ref { display: inline-flex; align-items: center; gap: 5px; font: 600 11.5px var(--mono); color: var(--text-2); }
.task-ref.big { font-size: 13px; }
.task-card-title { font-size: 13.5px; font-weight: 550; line-height: 1.38; word-break: break-word; }
.task-card-meta { display: flex; align-items: center; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.meta-item { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--text-2); }
.meta-item .icon { width: 13px; height: 13px; }
.quick-add { padding: 0 8px 8px; }
.quick-add summary { list-style: none; display: flex; align-items: center; gap: 6px; padding: 8px; border-radius: 9px; color: var(--text-2); cursor: pointer; font-weight: 550; font-size: 13px; }
.quick-add summary::-webkit-details-marker { display: none; }
.quick-add summary:hover { background: var(--surface); color: var(--text); }
.quick-add[open] summary { display: none; }
.quick-add form { display: flex; flex-direction: column; gap: 6px; }
.quick-add-row { display: flex; gap: 6px; }
.quick-add-row select { min-height: 32px; padding: 4px 8px; font-size: 12.5px; }

/* Detalle de tarea */
.task-main { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 16px; align-items: start; }
.task-main > .panel, .task-main > section { grid-column: 1; min-width: 0; }
.task-side { grid-column: 2; grid-row: 1 / span 3; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 76px; }
.task-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.title-input { font-size: 21px !important; font-weight: 700; letter-spacing: -.02em; border-color: transparent !important; padding-left: 6px !important; margin-left: -6px; background: transparent !important; }
.title-input:hover { border-color: var(--border-strong) !important; }
.title-input:focus { border-color: var(--accent) !important; background: var(--surface) !important; }
.task-title { font-size: 21px; margin-bottom: 12px; }
.preview summary { cursor: pointer; color: var(--text-2); font-size: 13px; }
.preview .rich { margin-top: 8px; padding: 12px; background: var(--surface-2); border-radius: 10px; }
.side-form { gap: 12px; }
.side-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rich { word-wrap: break-word; line-height: 1.65; }
.rich .mention { color: var(--accent); background: var(--accent-soft); padding: 0 3px; border-radius: 4px; font-weight: 550; }

.deliver-panel { margin: 4px 0 16px; padding: 16px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: var(--radius); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 5%, var(--surface)), var(--surface)); display: flex; flex-direction: column; gap: 12px; animation: flash-in .2s ease; }
.deliver-head { display: flex; align-items: center; justify-content: space-between; }
.deliver-head h2 { display: flex; align-items: center; gap: 8px; }
.deliver-panel p { margin: -6px 0 0; }

.timeline { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.timeline-comment { display: flex; gap: 10px; }
.comment { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 12px; padding: 10px 13px; }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-head time { font-size: 12px; color: var(--text-3); }
.comment-delete { margin-left: auto; opacity: 0; transition: opacity .12s; }
.timeline-comment:hover .comment-delete, .comment-delete:focus-within { opacity: 1; }
.comment-delete .icon-btn { width: 26px; height: 26px; }
.comment-delete .icon { width: 14px; height: 14px; }
.comment-files { margin-top: 8px; }
.timeline-event { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--text-2); padding-left: 13px; }
.timeline-event strong { color: var(--text); font-weight: 600; }
.timeline-event time { color: var(--text-3); }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); flex-shrink: 0; }
.timeline-comment:target .comment { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.comment-form { display: flex; gap: 10px; align-items: flex-start; }
.comment-actions { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-top: 8px; }
.comment-actions .uploader { flex: 1; min-width: 0; }

.dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 12px; margin: 12px 0 0; font-size: 13px; }
.dl dt { color: var(--text-2); }
.dl dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.dl-left dd { text-align: left; }

/* Subida de archivos */
.uploader-drop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  padding: 20px 16px; border: 1.5px dashed var(--border-strong); border-radius: 12px; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s;
}
.uploader-drop:hover, .uploader.is-over .uploader-drop { border-color: var(--accent); background: var(--accent-soft); }
.uploader-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.uploader-drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.uploader-icon { display: inline-flex; width: 40px; height: 40px; border-radius: 12px; align-items: center; justify-content: center; background: var(--surface); color: var(--accent); box-shadow: var(--shadow); margin-bottom: 4px; }
.uploader-text { font-size: 13.5px; }
.uploader-compact .uploader-drop { flex-direction: row; display: inline-flex; padding: 0 12px; height: 36px; border-style: solid; border-width: 1px; border-radius: 10px; background: var(--surface); color: var(--text-2); font-weight: 550; font-size: 13px; gap: 6px; }
.uploader-compact .uploader-drop .icon { width: 16px; height: 16px; }
.uploader-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.uploader-list:not(:empty) { margin-top: 10px; }
.upload-item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.upload-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; font: 700 10px var(--mono); color: var(--text-2); overflow: hidden; }
.upload-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.upload-name { font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-bar { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.upload-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.upload-item.is-done .upload-bar span { background: var(--success); }
.upload-item.is-error { border-color: var(--danger); }
.upload-item.is-error .upload-meta { color: var(--danger); }
.upload-meta { font-size: 11.5px; color: var(--text-3); }
.upload-actions { display: flex; gap: 2px; }
.upload-actions .icon-btn { width: 30px; height: 30px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 14px; }
.gallery-small { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 0; }
.gallery-item { margin: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface-2); display: flex; flex-direction: column; }
.gallery-item.is-evidence { border-color: color-mix(in srgb, var(--st-review) 45%, var(--border)); }
.gallery-item > a, .gallery-item > video { display: block; aspect-ratio: 16 / 10; background: #0b0b0f; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.gallery-item a:hover img { transform: scale(1.03); }
.gallery-item video { width: 100%; height: auto; object-fit: contain; }
.gallery-small .gallery-item > a, .gallery-small .gallery-item > video { aspect-ratio: 4 / 3; }
.gallery-item figcaption { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name actions" "meta actions"; gap: 2px 6px; padding: 8px 6px 8px 10px; background: var(--surface); }
.gallery-name { grid-area: name; font-size: 12.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gallery-meta { grid-area: meta; display: flex; align-items: center; gap: 6px; min-width: 0; }
.gallery-meta small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gallery-meta .pill { height: 19px; font-size: 11px; padding: 0 6px; }
.gallery-actions { grid-area: actions; display: flex; align-items: center; }
.gallery-actions .icon-btn { width: 30px; height: 30px; }
.gallery-actions .icon { width: 16px; height: 16px; }
.file-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-list.compact { margin: 12px 0 0; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.file-icon { flex-shrink: 0; width: 40px; height: 40px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font: 700 9.5px var(--mono); letter-spacing: .02em; color: #fff; background: #71717a; overflow: hidden; }
.file-pdf { background: #dc2626; }
.file-document { background: #2563eb; }
.file-archive { background: #a16207; }
.file-model { background: #7c3aed; }
.file-audio { background: #0d9488; }
.file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-info a, .file-info > span:first-child { font-weight: 550; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-info audio { margin-top: 6px; width: 100%; height: 34px; }
.attach-form { margin-top: 4px; gap: 10px; }

.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(5, 5, 8, .92); display: flex; align-items: center; justify-content: center; padding: 40px 64px; animation: flash-in .15s ease; }
.lightbox figure { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; border-radius: 6px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.lightbox figcaption { color: #cfcfd8; font-size: 13px; }
.lightbox .icon-btn { color: #fff; background: rgba(255, 255, 255, .08); width: 44px; height: 44px; border-radius: 50%; }
.lightbox .icon-btn:hover { background: rgba(255, 255, 255, .18); }
.lightbox-close { position: absolute; top: 16px; right: 16px; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lightbox-nav.prev { left: 14px; }
.lightbox-nav.prev .icon { transform: rotate(180deg); }
.lightbox-nav.next { right: 14px; }

/* Discusión */
.chat { display: flex; flex-direction: column; padding: 0; height: calc(100vh - 240px); min-height: 420px; }
.chat-older { display: block; text-align: center; padding: 8px; font-size: 12.5px; color: var(--text-2); border-bottom: 1px solid var(--border); }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.message { display: flex; gap: 10px; max-width: 760px; }
.message-body { min-width: 0; }
.message-head { display: flex; align-items: baseline; gap: 8px; }
.message-head time { font-size: 11.5px; color: var(--text-3); }
.message .rich { background: var(--surface-2); padding: 8px 12px; border-radius: 4px 14px 14px 14px; margin-top: 3px; }
.message.is-mine .rich { background: var(--accent-soft); }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-form textarea { max-height: 180px; }
.chat-form .btn { height: 40px; width: 44px; padding: 0; }

/* Tablas */
.table-wrap { overflow-x: auto; }
.table, .md-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .md-table th { text-align: left; font-size: 12px; font-weight: 650; color: var(--text-2); padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td, .md-table td { padding: 10px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
.table tr:first-child td { border-top: 0; }
.table select { min-width: 130px; min-height: 34px; padding: 4px 8px; font-size: 13px; }
.table tr.is-muted td { opacity: .6; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell span { display: flex; flex-direction: column; }
.user-cell small { font-size: 12px; }

/* Equipo y perfil */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.person-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 14px; text-align: center; transition: box-shadow .2s, transform .2s; }
.person-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.person-card .avatar { margin-bottom: 6px; }
.person-card .pill { margin: 4px 0; }
.profile-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.profile-card h1 { font-size: 20px; margin-top: 6px; }
.profile-card p { margin: 0; }
.profile-card .dl { width: 100%; text-align: left; }
.profile-avatar { position: relative; }
.profile-avatar.is-online::after { content: ""; position: absolute; right: 8px; bottom: 8px; width: 16px; height: 16px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--surface); }
.level { width: 100%; margin-top: 10px; text-align: left; }
.level-head { display: flex; justify-content: space-between; margin-bottom: 6px; }
.level p { display: flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--gold); font-weight: 650; }
.level .icon { width: 15px; height: 15px; }
.avatar-edit { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.invite-link { margin-bottom: 16px; border-color: var(--accent); }
.invite-link h2 { display: flex; align-items: center; gap: 6px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-family: var(--mono); font-size: 13px; }

.danger-zone { margin-top: 16px; border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.danger-zone h2 { display: flex; align-items: center; gap: 6px; color: var(--danger); }
.danger-row { padding: 12px 0; border-top: 1px solid var(--border); }
.danger-row:first-of-type { border-top: 0; padding-top: 0; }
.danger-row p { margin: 2px 0 8px; }

/* Documentos */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 16px; }
.doc-card { padding: 18px; display: flex; flex-direction: column; gap: 8px; transition: box-shadow .2s, transform .2s, border-color .2s; }
.doc-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--border-strong); }
.doc-card-top { display: flex; align-items: center; gap: 8px; }
.doc-card-top .pill { margin-left: auto; }
.doc-icon { display: inline-flex; width: 34px; height: 34px; border-radius: 10px; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.doc-icon .icon { width: 17px; height: 17px; }
.doc-card h2 { font-size: 16px; }
.doc-card p { margin: 0; min-height: 2.9em; font-size: 13px; }
.doc-card-foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.doc-grid-mini { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin: 0; }
.doc-mini { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 11px; border: 1px solid var(--border); min-width: 0; }
.doc-mini:hover { background: var(--surface-2); }
.doc-mini .grow { display: flex; flex-direction: column; min-width: 0; }
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
.doc-article { padding: 40px 48px; }
.doc-header { padding-bottom: 20px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.doc-header h1 { font-size: 34px; letter-spacing: -.03em; line-height: 1.15; }
.doc-summary { font-size: 17px; color: var(--text-2); margin: 10px 0 0; }
.doc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; font-size: 13px; color: var(--text-2); }
.doc-aside { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 76px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc li a { display: block; padding: 5px 0 5px 12px; margin-left: -1px; border-left: 2px solid transparent; font-size: 13px; color: var(--text-2); }
.toc li a:hover, .toc li a.is-active { color: var(--text); border-left-color: var(--accent); }
.toc .toc-l3 a { padding-left: 24px; font-size: 12.5px; }
.doc-body { font-size: 15.5px; line-height: 1.75; }
.doc-body h2 { font-size: 23px; margin: 34px 0 10px; letter-spacing: -.02em; }
.doc-body h3 { font-size: 18px; margin: 26px 0 8px; }
.doc-body h4, .doc-body h5 { font-size: 15.5px; margin: 20px 0 6px; }
.doc-body > :first-child { margin-top: 0; }
.doc-body p, .doc-body ul, .doc-body ol, .doc-body pre, .doc-body blockquote, .doc-body figure, .doc-body .table-wrap, .doc-body .callout { margin: 0 0 16px; }
.doc-body ul, .doc-body ol { padding-left: 24px; }
.doc-body li { margin: 4px 0; }
.doc-body li.task-item { list-style: none; margin-left: -22px; display: flex; gap: 10px; align-items: baseline; }
.check-box { flex-shrink: 0; width: 16px; height: 16px; border: 1.5px solid var(--border-strong); border-radius: 4px; transform: translateY(3px); }
.check-box.is-checked { background: var(--success); border-color: var(--success); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); background-size: 12px; background-position: center; background-repeat: no-repeat; }
.doc-body blockquote { border-left: 3px solid var(--border-strong); padding: 2px 0 2px 16px; color: var(--text-2); }
.doc-body blockquote > :last-child, .callout > :last-child { margin-bottom: 0; }
.callout { position: relative; padding: 14px 16px 14px 46px; border-radius: 12px; border: 1px solid; }
.callout::before { position: absolute; left: 16px; top: 13px; font-weight: 700; }
.callout-note { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.callout-note::before { content: "ℹ"; color: var(--info); }
.callout-tip { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.callout-tip::before { content: "✦"; color: var(--success); }
.callout-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.callout-warning::before { content: "!"; color: var(--warning); }
.doc-body figure { text-align: center; }
.doc-body figure img, .doc-body video, .rich video { max-width: 100%; border-radius: 12px; border: 1px solid var(--border); background: #000; }
.doc-body figcaption { font-size: 13px; color: var(--text-3); margin-top: 6px; }
.md-table { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.doc-files { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); }
.doc-files h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.doc-editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.doc-editor-main { display: flex; flex-direction: column; gap: 10px; }
.doc-editor-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 76px; }
.doc-editor-side .btn-block + .btn-block { margin-top: 6px; }
.doc-editor-side .field { margin-bottom: 12px; }
.summary-input { border-color: transparent !important; background: transparent !important; font-size: 15px !important; color: var(--text-2) !important; padding-left: 6px !important; margin-left: -6px; }
.summary-input:focus { border-color: var(--accent) !important; background: var(--surface) !important; }
.md-editor { border: 1px solid var(--border-strong); border-radius: 12px; overflow: hidden; }
.md-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.md-tools { display: flex; flex-wrap: wrap; gap: 1px; }
.md-tools .icon-btn { width: 32px; height: 32px; }
.md-tools .icon { width: 16px; height: 16px; }
.md-editor textarea { border: 0; border-radius: 0; min-height: 420px; font: 14px/1.7 var(--mono); padding: 16px; }
.md-editor textarea:focus { box-shadow: none; }
.md-preview { padding: 20px 24px; min-height: 420px; }

/* Software */
.software-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.software-card { padding: 18px; display: flex; flex-direction: column; gap: 10px; transition: box-shadow .2s, border-color .2s; }
.software-card:hover { box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.software-top { display: flex; align-items: center; gap: 12px; }
.software-top .pill { margin-left: auto; align-self: flex-start; }
.software-icon { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; flex-shrink: 0; box-shadow: var(--shadow); background: var(--surface-2); }
.software-icon-initials { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 750; font-size: 19px; letter-spacing: -.02em; background: linear-gradient(135deg, hsl(var(--h) 55% 50%), hsl(calc(var(--h) + 40) 60% 36%)); }
.software-title { min-width: 0; }
.software-title h2 { font-size: 16px; }
.software-desc { margin: 0; font-size: 13.5px; flex: 1; }
.platforms { display: flex; flex-wrap: wrap; gap: 5px; }
.license, .link-warning { display: flex; align-items: flex-start; gap: 6px; margin: 0; font-size: 12.5px; color: var(--text-2); }
.license .icon, .link-warning .icon { width: 14px; height: 14px; margin-top: 2px; }
.link-warning { color: var(--warning); }
.software-actions { display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.software-actions small { display: inline-flex; align-items: center; gap: 3px; }
.software-actions small .icon { width: 13px; height: 13px; }

/* Slides (admin) */
.slides-admin { display: flex; flex-direction: column; gap: 12px; }
.slide-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.slide-row img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 10px; }
.slide-row.is-muted img { opacity: .45; filter: grayscale(1); }
.slide-fields { display: flex; flex-direction: column; gap: 10px; }

.pagination { display: flex; justify-content: center; gap: 4px; margin: 18px 0; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 36px; height: 36px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; font-size: 13px; color: var(--text-2); }
.pagination a:hover { background: var(--surface); color: var(--text); }
.pagination .is-current { background: var(--text); color: var(--bg); font-weight: 650; }

/* ---------- Autenticación ---------- */
body.auth { min-height: 100vh; background: var(--bg); }
.auth-wrap { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(460px, 1fr); min-height: 100vh; min-height: 100dvh; }

.auth-hero { position: relative; overflow: hidden; background: #08080b; color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 40px 52px 44px; isolation: isolate; }
.auth-slides { position: absolute; inset: 0; z-index: -2; }
.auth-slide { position: absolute; inset: -2%; background-size: cover; background-position: center; opacity: 0; transform: scale(1.08); transition: opacity 1.6s ease, transform 10s linear; }
.auth-slide.is-active { opacity: 1; transform: scale(1); }
.auth-hero-shade { position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(120% 70% at 0% 100%, rgba(8, 8, 11, .96) 0%, rgba(8, 8, 11, .6) 45%, transparent 75%),
    linear-gradient(180deg, rgba(8, 8, 11, .72) 0%, rgba(8, 8, 11, .08) 30%, rgba(8, 8, 11, .25) 60%, rgba(8, 8, 11, .9) 100%),
    linear-gradient(115deg, rgba(160, 10, 40, .38), transparent 55%); }
.auth-hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.auth-hero-logo { display: inline-block; filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .55)); transition: transform .3s ease; }
.auth-hero-logo:hover { transform: translateY(-2px); }
.auth-hero-logo img { display: block; height: clamp(170px, 24vh, 240px); width: auto; }
.auth-hero-inner { max-width: 600px; }
.auth-hero h2 { font-size: clamp(34px, 3.8vw, 56px); line-height: 1.04; letter-spacing: -.04em; font-weight: 800; margin-bottom: 14px; transition: opacity .5s, transform .5s; text-wrap: balance; }
.auth-hero p { color: #d7d7df; font-size: 17.5px; line-height: 1.5; transition: opacity .5s, transform .5s; max-width: 480px; margin: 0; }
.auth-hero .is-fading { opacity: 0; transform: translateY(6px); }
.auth-dots { display: flex; gap: 8px; margin-top: 30px; }
.auth-dots button { width: 36px; height: 18px; padding: 0; border: 0; background: transparent; cursor: pointer; display: flex; align-items: center; }
.auth-dots span { display: block; width: 100%; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .28); overflow: hidden; position: relative; }
.auth-dots .is-active span::after { content: ""; position: absolute; inset: 0; background: #fff; transform-origin: left; animation: slide-progress var(--slide-ms, 6000ms) linear forwards; }
@keyframes slide-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.auth-panel { position: relative; display: flex; flex-direction: column; align-items: center; padding: 40px 40px 22px; background: var(--surface); overflow: hidden; isolation: isolate; }
.auth-panel-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(520px 380px at 100% 0%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 70%),
    radial-gradient(420px 320px at 0% 100%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%); }
.auth-panel-bg::after { content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 44px 44px; -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 40%, #000 20%, transparent 75%); mask-image: radial-gradient(ellipse 60% 50% at 50% 40%, #000 20%, transparent 75%); }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 22px; margin: auto 0; padding: 12px 0; animation: auth-in .5s cubic-bezier(.2, .8, .2, 1); }
@keyframes auth-in { from { opacity: 0; transform: translateY(10px); } }
.auth-head h1 { font-size: 32px; letter-spacing: -.035em; line-height: 1.1; margin-bottom: 8px; }
.auth-head p { font-size: 15px; margin: 0; }
.auth-head .eyebrow { margin-bottom: 8px; }
.auth-status-icon { display: inline-flex; width: 48px; height: 48px; border-radius: 14px; align-items: center; justify-content: center; margin-bottom: 14px; background: var(--accent-soft); color: var(--accent); }
.auth-status-icon .icon { width: 22px; height: 22px; }
.auth-status-icon.is-error { background: var(--danger-soft); color: var(--danger); }
.auth-form { gap: 16px; }
.auth-form .field > span:first-child { font-size: 13px; color: var(--text); }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-label-row .link { font-weight: 550; }
.input-icon { position: relative; display: block; }
.input-icon > .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-3); pointer-events: none; z-index: 1; transition: color .15s; }
.input-icon input { padding-left: 44px !important; }
.input-icon:focus-within > .icon { color: var(--accent); }
.auth-card input[type=text], .auth-card input[type=email], .auth-card input[type=password] { min-height: 50px; border-radius: 12px; font-size: 15px; background: var(--surface); }
.auth-card .password-toggle { right: 7px; }
.caps-hint { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--warning); margin-top: 2px; }
.remember { font-size: 13.5px; color: var(--text-2); }
.btn-auth { height: 52px; font-size: 15.5px; font-weight: 650; border-radius: 13px; gap: 10px; margin-top: 4px; }
.btn-auth .icon { width: 18px; height: 18px; transition: transform .2s; }
.btn-auth:hover .icon { transform: translateX(3px); }
.btn.is-loading { pointer-events: none; color: transparent !important; position: relative; }
.btn.is-loading::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn:not(.btn-primary).is-loading::after { border-color: var(--border-strong); border-top-color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12.5px; font-weight: 550; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-note { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.auth-note p { margin: 0; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.auth-note-icon { flex-shrink: 0; display: inline-flex; width: 34px; height: 34px; border-radius: 10px; align-items: center; justify-content: center; background: var(--surface); color: var(--accent); box-shadow: var(--shadow-xs); }
.auth-note-icon .icon { width: 17px; height: 17px; }
.auth-back { display: inline-flex; align-items: center; gap: 6px; align-self: center; font-size: 13.5px; font-weight: 550; color: var(--text-2); }
.auth-back .icon { width: 15px; height: 15px; transform: rotate(180deg); }
.auth-back:hover { color: var(--text); }
.auth-card .flash { margin: 0; }
.auth-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; font-size: 12px; color: var(--text-3); padding-top: 24px; }
.auth-footer a:hover { color: var(--text); }

.invite-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 6%, var(--surface)), var(--surface)); box-shadow: var(--shadow-xs); }
.invite-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.invite-card-body strong { font-size: 15px; }
.invite-email { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invite-email .icon { width: 13px; height: 13px; flex-shrink: 0; }

.strength { display: flex; align-items: center; gap: 10px; margin-top: -8px; }
.strength-bars { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.strength-bars span { height: 4px; border-radius: 2px; background: var(--surface-3); transition: background .25s; }
.strength-label { font-size: 12px; font-weight: 600; color: var(--text-3); min-width: 88px; text-align: right; }
.strength[data-level="1"] .strength-bars span:nth-child(-n+1) { background: var(--danger); }
.strength[data-level="2"] .strength-bars span:nth-child(-n+2) { background: var(--warning); }
.strength[data-level="3"] .strength-bars span:nth-child(-n+3) { background: #65a30d; }
.strength[data-level="4"] .strength-bars span { background: var(--success); }
.strength[data-level="1"] .strength-label { color: var(--danger); }
.strength[data-level="2"] .strength-label { color: var(--warning); }
.strength[data-level="3"] .strength-label, .strength[data-level="4"] .strength-label { color: var(--success); }
.pw-rules { list-style: none; margin: -6px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.pw-rules li { position: relative; padding-left: 20px; font-size: 12.5px; color: var(--text-3); transition: color .2s; }
.pw-rules li::before { content: ""; position: absolute; left: 0; top: 3px; width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--border-strong); transition: all .2s; }
.pw-rules li.is-ok { color: var(--text); }
.pw-rules li.is-ok::before { border-color: var(--success); background: var(--success) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 9px no-repeat; }
.match-hint { font-size: 12px; min-height: 16px; }
.match-hint.is-ok { color: var(--success); }
.match-hint.is-bad { color: var(--danger); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .task-main { grid-template-columns: minmax(0, 1fr); }
  .task-side { grid-column: 1; grid-row: auto; position: static; }
  .task-row { grid-template-columns: 96px minmax(0, 1fr) 100px 100px 28px; }
  .task-row .prio-label { display: none; }
  .doc-layout, .doc-editor { grid-template-columns: minmax(0, 1fr); }
  .doc-aside, .doc-editor-side { position: static; }
  .grid-main-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .auth-wrap { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-hero { min-height: 40vh; min-height: 40svh; padding: calc(18px + env(safe-area-inset-top)) 22px 34px; }
  .auth-hero-logo img { height: 120px; }
  .auth-hero h2 { font-size: 27px; margin-bottom: 6px; }
  .auth-hero p { font-size: 14.5px; }
  .auth-dots { margin-top: 14px; }
  .auth-panel { border-radius: 26px 26px 0 0; margin-top: -26px; padding: 30px 22px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -14px 40px rgba(0, 0, 0, .22); }
  .auth-card { gap: 18px; }
  .auth-head h1 { font-size: 27px; }
  .pw-rules { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  :root { --bottom-nav-h: 64px; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); width: min(300px, 86vw); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 35; backdrop-filter: blur(2px); }
  body.sidebar-open { overflow: hidden; }
  .sidebar-brand .sidebar-close { display: inline-flex; }
  .shell { margin-left: 0; padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); }
  .topbar { padding: 0 12px; height: 56px; }
  .topbar .menu-btn { display: none; }
  .main { padding: 16px; }
  .grid-2, .grid-3, .grid-side-main { grid-template-columns: minmax(0, 1fr); }
  .hide-mobile { display: none; }
  .show-mobile { display: inline; }
  .page-head { align-items: stretch; margin-bottom: 16px; }
  .page-actions { width: 100%; }
  .page-actions > .btn, .page-actions > form { flex: 1; }
  .page-actions > form .btn { width: 100%; }
  .hero-head h1 { font-size: 25px; }
  h1 { font-size: 21px; }
  .panel { padding: 16px; }
  .doc-article { padding: 22px 18px; }
  .doc-header h1 { font-size: 26px; }
  .doc-body { font-size: 15px; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--border);
  }
  .bottom-nav a, .bottom-nav button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none; color: var(--text-3); font: 600 10.5px var(--font); cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .bottom-nav .icon { width: 22px; height: 22px; }
  .bottom-nav .is-active { color: var(--accent); }
  .bottom-nav .dot { top: 10px; right: calc(50% - 16px); }
  /* Inputs a 16px para evitar el zoom automático de iOS */
  input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input[type=url], select, textarea { font-size: 16px; min-height: 42px; }
  .btn { height: 42px; }
  .btn-sm { height: 36px; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; }
  .filters input[type=search] { grid-column: 1 / -1; width: 100%; }
  .filters select, .filters .btn { width: 100%; }
  .board-jump { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 10px; padding: 0 16px; }
  .board-jump::-webkit-scrollbar { display: none; }
  .board-jump button { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: 17px; background: var(--surface); color: var(--text-2); font: 600 12.5px var(--font); }
  .board-jump button.is-active { border-color: var(--text); color: var(--text); }
  .board-jump .count { font-weight: 500; color: var(--text-3); }
  .board { grid-auto-columns: 86vw; margin: 0 -16px; padding: 0 16px 12px; scroll-snap-type: x mandatory; scroll-padding: 0 16px; }
  .column { max-height: none; }
  .column-body { overflow: visible; }
  .task-card-link { padding: 13px 14px 13px 16px; }
  .toast-stack { right: 16px; left: 16px; max-width: none; }
  .comment-form > .avatar { display: none; }
  .timeline-comment > .avatar { width: 28px; height: 28px; font-size: 11px; }
  .comment-delete { opacity: 1; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .slide-row { grid-template-columns: 1fr; }
  .chat { height: calc(100vh - 56px - var(--bottom-nav-h) - 190px); min-height: 360px; }
  .chat-messages { padding: 12px; }
  .lightbox { padding: 12px; }
  .lightbox-nav { top: auto; bottom: 20px; transform: none; }
  .table th, .table td { padding: 10px 12px; }
  .software-grid, .doc-grid, .project-grid { grid-template-columns: minmax(0, 1fr); }
  .search-hero .btn { display: none; }
}
@media (max-width: 560px) {
  .task-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title title" "ref due"; row-gap: 4px; padding: 12px 14px; }
  .task-row-title { grid-area: title; white-space: normal; }
  .task-row-ref { grid-area: ref; }
  .task-row .due { grid-area: due; justify-self: end; }
  .task-row .status, .task-row-assignee { display: none; }
  .task-list.compact .task-row { grid-template-columns: minmax(0, 1fr) auto; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 24px; }
  .stat-xp, .stats > .stat:first-child { grid-column: 1 / -1; }
  .copy-row { flex-direction: column; }
  .side-grid { grid-template-columns: 1fr 1fr; }
  .form-row > .field { flex-basis: 100%; }
  .w-120, .w-160 { flex: 1 1 100% !important; }
  .comment-actions { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .auth-slide { transform: none !important; }
}
.row-actions { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.pref-list { display: flex; flex-direction: column; gap: 8px; }
.panel-head h2 .icon, .mail-settings h2 .icon, aside.panel > h2 .icon { width: 17px; height: 17px; vertical-align: -3px; margin-right: 4px; color: var(--accent); }
.mail-settings { margin-top: 16px; }
.mail-settings .grid-main-side { margin-top: 12px; }
.mail-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mail-stats > div { display: flex; flex-direction: column; align-items: center; padding: 12px 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.mail-stats strong { font-size: 22px; letter-spacing: -.02em; }
.mail-stats small { font-size: 11.5px; color: var(--text-2); }
.mail-stats .is-bad strong { color: var(--danger); }
.mail-errors { padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border)); border-radius: 10px; }
.mail-errors p { margin: 6px 0 0; overflow-wrap: anywhere; }
.help-list { padding-left: 18px; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }

/* Portal de usuarios: ficha, antigüedad y caja de ahorro */
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.user-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.user-form-grid > .panel { margin: 0; }
.user-form-grid h2 { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 0 0 14px; }
.savings-total { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.savings-total div { display: flex; flex-direction: column; gap: 2px; }
.savings-total strong { font-size: 26px; letter-spacing: -0.02em; }
.savings-total p { margin: 0; max-width: 46ch; }
.kv { list-style: none; margin: 0 0 16px; padding: 0; }
.kv li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.kv li:last-child { border-bottom: 0; }
.kv li > span { color: var(--text-2); }
.kv-total strong { font-size: 17px; }
.savings-form { border-top: 1px solid var(--border); padding-top: 16px; }
.savings-form > * + * { margin-top: 12px; }
.savings-panel .table { margin-top: 16px; }
.table-compact th, .table-compact td { padding: 8px 10px; font-size: 13.5px; }
.is-positive { color: var(--success); }
.is-negative { color: var(--danger); }
@media (max-width: 860px) {
  .field-row, .user-form-grid { grid-template-columns: minmax(0, 1fr); }
}
.nav-link .nav-ext { width: 13px; height: 13px; margin-left: auto; opacity: .5; }
.nowrap { white-space: nowrap; }

/* Operación: inventario, pagos y gastos */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { display: flex; flex-direction: column; gap: 2px; padding: 16px; }
.stat-card strong { font-size: 24px; letter-spacing: -0.02em; }
.asset-thumb { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; background: var(--surface-2); flex: none; }
.asset-thumb-empty { display: grid; place-items: center; color: var(--text-2); border: 1px solid var(--border); }
.asset-thumb-empty .icon { width: 18px; height: 18px; }
.asset-photo { width: 100%; border-radius: var(--radius); margin-bottom: 12px; }
.asset-list { list-style: none; margin: 0; padding: 0; }
.asset-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.asset-list li:last-child { border-bottom: 0; }
.asset-list span { display: flex; flex-direction: column; gap: 2px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; }
.inline-form .field { flex: 1 1 160px; }
.task-picker { display: grid; gap: 6px; max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.task-picker .check { align-items: flex-start; }
.danger-zone { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 14px 16px; border: 1px dashed var(--border); border-radius: var(--radius); }
.inline-icon { width: 12px; height: 12px; vertical-align: -1px; opacity: .6; }
.pill-in_use { background: var(--accent-soft); color: var(--accent); }
.pill-available { background: var(--success-soft); color: var(--success); }
.pill-repair, .pill-soon { background: var(--warning-soft); color: var(--warning); }
.pill-retired { background: var(--surface-2); color: var(--text-2); }
.pill-late { background: var(--danger-soft); color: var(--danger); }
.panel h2 .icon { width: 16px; height: 16px; margin-right: 8px; vertical-align: -3px; opacity: .7; }
.avatar-field { display: flex; align-items: center; gap: 12px; }
.avatar-field > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.photo-field { display: flex; align-items: center; gap: 12px; }
.photo-field > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.photo-field .asset-thumb { width: 56px; height: 56px; }
.is-removing img, .is-removing .avatar { opacity: .35; filter: grayscale(1); }
.rate-refresh { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.rate-banxico { gap: 6px; }
input[readonly] { background: var(--surface-2); color: var(--text-2); }
.input-amount { width: 84px; text-align: right; }
.table-compact input[type=date], .table-compact input[type=text] { padding: 5px 8px; font-size: 13px; width: 100%; }
.table-compact input.input-amount { width: 84px; }
.table-compact td .row-actions { flex-wrap: nowrap; }

/* Paneles y grupos del menú que se pliegan */
.collapse-toggle { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.collapse-toggle::before { content: ''; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); opacity: .5; transition: transform .15s ease; flex: none; margin-bottom: 2px; }
.is-collapsed > .panel-head .collapse-toggle::before, .is-collapsed > h2 .collapse-toggle::before { transform: rotate(-45deg); margin-bottom: 0; }
.panel.is-collapsed > *:not(.panel-head):not(h2) { display: none; }
.panel.is-collapsed > .panel-head { margin-bottom: 0; }
.nav-section-toggle { display: flex; align-items: center; gap: 7px; width: 100%; background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.nav-section-toggle::after { content: ''; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); opacity: .45; transition: transform .15s ease; margin-left: auto; margin-bottom: 2px; }
.nav-group.is-collapsed .nav-section-toggle::after { transform: rotate(-45deg); margin-bottom: 0; }
.nav-group.is-collapsed .nav-link { display: none; }
.nav-section-toggle:hover::after, .collapse-toggle:hover::before { opacity: 1; }
.pay-cell { width: 100%; }
.pay-cell input { display: block; margin-bottom: 5px; }
.pay-cell small { display: block; }
