/* ============================================================
   PIEL del Panel (v3) — diseño «Kinetic Clarity» de Google Stitch
   aplicado sobre el frente v2. SOLO presentación: la estructura
   vive en index.html y la lógica en app.js.
   Tokens: paleta Material de Kinetic Clarity (claro = sistema de
   diseño; oscuro = paleta oficial de las pantallas «Modo Oscuro»
   del mismo proyecto de Stitch). Interruptor con persistencia
   (localStorage panel_theme) y default prefers-color-scheme.
   ============================================================ */
:root, [data-theme="light"] {
  --bg: #f8f9ff;
  --surface: #ffffff;
  --surface-low: #eff4ff;
  --surface-cont: #e5eeff;
  --surface-high: #dce9ff;
  --ink: #0b1c30;
  --ink2: #464555;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --primary: #4f46e5;
  --primary-dark: #3525cd;
  --primary-hover: #4338ca;
  --on-primary: #ffffff;
  --primary-soft: #eef2ff;
  --primary-line: #c7d2fe;
  --secondary: #006591;
  --success: #059669;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --error: #ba1a1a;
  --error-ink: #b91c1c;
  --error-bg: #fef2f2;
  --col-bg: rgba(239, 244, 255, .72);
  --scrim: rgba(15, 23, 42, .45);
  --shadow-1: 0 1px 3px 0 rgba(15,23,42,.04), 0 1px 2px -1px rgba(15,23,42,.02);
  --shadow-2: 0 10px 15px -3px rgba(15,23,42,.08), 0 4px 6px -4px rgba(15,23,42,.04);
  --shadow-3: 0 20px 25px -5px rgba(15,23,42,.1), 0 8px 10px -6px rgba(15,23,42,.04);
  --shadow-4: 0 25px 50px -12px rgba(15,23,42,.22);
  --focus-ring: 0 0 0 3px rgba(79, 70, 229, .15);
  --header-bg: #ffffff;
}
[data-theme="dark"] {
  --bg: #0b0d14;
  --surface: #1c202e;
  --surface-low: #14161f;
  --surface-cont: #262b3d;
  --surface-high: #30364c;
  --ink: #f3f4f6;
  --ink2: #9ca3af;
  --muted: #9ca3af;
  --line: #272c40;
  --line-strong: #3a415a;
  --primary: #6366f1;
  --primary-dark: #a5b4fc;
  --primary-hover: #818cf8;
  --on-primary: #ffffff;
  --primary-soft: rgba(99, 102, 241, .18);
  --primary-line: #4338ca;
  --secondary: #38bdf8;
  --success: #34d399;
  --success-bg: rgba(16, 185, 129, .14);
  --warning: #fbbf24;
  --error: #f87171;
  --error-ink: #fca5a5;
  --error-bg: #450a0a;
  --col-bg: #151824;
  --scrim: rgba(2, 6, 23, .62);
  --shadow-1: 0 1px 3px 0 rgba(0,0,0,.4), 0 1px 2px -1px rgba(0,0,0,.3);
  --shadow-2: 0 10px 15px -3px rgba(0,0,0,.5), 0 4px 6px -4px rgba(0,0,0,.35);
  --shadow-3: 0 20px 25px -5px rgba(0,0,0,.55), 0 8px 10px -6px rgba(0,0,0,.4);
  --shadow-4: 0 25px 50px -12px rgba(0,0,0,.65);
  --focus-ring: 0 0 0 3px rgba(129, 140, 248, .28);
  --header-bg: #12141d;
}
:root {
  --radius-btn: .5rem;    /* ROUND_EIGHT */
  --radius-card: .75rem;
  --radius-panel: 1rem;
  --tap: 44px;            /* objetivo táctil mínimo */
  --font-head: "Plus Jakarta Sans", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; font-family: var(--font-body); }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; background: var(--bg); color: var(--ink); transition: background .25s, color .25s; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, .logo, .titleInput, .card .t, .kpiNum { font-family: var(--font-head); }
.srOnly { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- botones ---------- */
.btn { min-height: var(--tap); padding: 10px 16px; border-radius: var(--radius-btn); border: 1px solid transparent; cursor: pointer; font-weight: 600; font-size: 15px; background: var(--surface-cont); color: var(--ink); transition: background .15s, box-shadow .15s, transform .05s; }
.btn.primary { background: var(--primary); color: var(--on-primary); box-shadow: inset 0 1px 0 rgba(255,255,255,.2); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.warn { background: var(--warning); color: #fff; }
[data-theme="dark"] .btn.warn { color: #1c1005; }
.btn.danger { background: var(--error-bg); color: var(--error-ink); }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--ink); min-height: 38px; padding: 6px 14px; }
.btn.ghost:hover { background: var(--surface-low); }
.btn.ghostLight { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: var(--shadow-1); }
.btn.ghostDark { background: var(--surface-cont); color: var(--ink); }
.btn.big { width: 100%; margin-top: 18px; font-size: 16px; font-weight: 700; }
.btn.icon { min-height: 38px; width: 38px; padding: 0; border-radius: 50%; background: var(--surface-cont); }
.btn:active { transform: scale(.98); }
.btn.themeToggle { font-size: 17px; padding: 6px 12px; }

/* ---------- cabecera ---------- */
.appHeader { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: var(--ink); background: var(--header-bg); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.logo { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.sub { color: var(--muted); font-size: 12px; }
.spacer { flex: 1; }
.userBox { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; border: 1px solid var(--primary-line); }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }

/* ---------- login ---------- */
#loginView { display: flex; justify-content: center; padding: 8vh 16px 30px; }
.loginCard { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px 24px; width: 100%; max-width: 380px; box-shadow: var(--shadow-3); }
.loginMark { width: 46px; height: 46px; border-radius: 12px; background: var(--primary); color: #fff; font-family: var(--font-head); font-weight: 800; font-size: 17px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.loginCard h1 { font-size: 22px; letter-spacing: -.01em; }
.loginCard p { color: var(--muted); font-size: 13px; margin: 4px 0 8px; }
.loginCard label { display: block; font-size: 12px; font-weight: 600; color: var(--ink2); margin: 14px 0 5px; }
.loginCard input { width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-btn); font-size: 16px; background: var(--surface); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary) !important; box-shadow: var(--focus-ring); }
.formError { color: var(--error); font-size: 13px; margin-top: 10px; min-height: 16px; }

/* ---------- layout + barra lateral ---------- */
.layout { display: block; }
.content { min-width: 0; }
.sidebar { display: none; }
@media (min-width: 1100px) {
  .layout { display: flex; align-items: stretch; }
  .sidebar { display: flex; flex-direction: column; gap: 18px; width: 66px; flex: none; background: var(--surface); border-right: 1px solid var(--line); padding: 16px 10px; position: sticky; top: 57px; height: calc(100vh - 57px); overflow-y: auto; }
  .content { flex: 1; }
  .sideTxt, .sideTitle, .sideOrg { display: none; }
  .sideItem { justify-content: center; }
}
@media (min-width: 1280px) {
  .sidebar { width: 244px; padding: 18px 14px; }
  .sideTxt, .sideOrg { display: block; }
  .sideTitle { display: flex; }
  .sideItem { justify-content: flex-start; }
}
.sideTitle { align-items: center; justify-content: space-between; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 4px 8px; }
.sideAdd { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.sideAdd:hover { background: var(--surface-low); color: var(--ink); }
.sideList { display: flex; flex-direction: column; gap: 3px; }
.sideItem { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px; border: none; border-radius: var(--radius-btn); background: transparent; color: var(--ink); font-size: 14px; font-weight: 500; cursor: pointer; text-align: left; }
.sideItem:hover { background: var(--surface-low); }
.sideItem.active { background: var(--primary); color: #fff; font-weight: 600; }
.sideItem .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.sideIco { width: 20px; text-align: center; flex: none; font-size: 15px; }
.sideTxt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sideLabels { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 2px; }
.sideFoot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.sideOrg { font-size: 13px; padding: 4px; border-top: 1px solid var(--line); padding-top: 12px; }

/* ---------- barra de proyecto, pestañas y herramientas ---------- */
.projectBar { display: flex; gap: 8px; padding: 14px 16px 4px; align-items: center; }
.projectSelect { flex: 1; min-height: var(--tap); border-radius: var(--radius-btn); border: 1px solid var(--line-strong); padding: 8px 12px; font-size: 16px; font-weight: 700; font-family: var(--font-head); background: var(--surface); color: var(--ink); min-width: 0; }
.viewTabs { display: flex; gap: 4px; padding: 8px 16px 2px; overflow-x: auto; scrollbar-width: none; }
.viewTabs::-webkit-scrollbar { display: none; }
.tab { flex: none; min-height: 38px; padding: 7px 15px; border-radius: 999px; border: 1px solid transparent; background: transparent; color: var(--ink2); font-weight: 600; font-size: 14px; cursor: pointer; }
.tab:hover { background: var(--surface-low); }
.tab.active { background: var(--primary-soft); color: var(--primary-dark); border-color: var(--primary-line); }
.toolbar { display: flex; gap: 8px; margin: 8px 16px 12px; padding: 10px; flex-wrap: wrap; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-panel); box-shadow: var(--shadow-1); }
.toolbar .search { flex: 1 1 170px; min-height: var(--tap); border: 1px solid var(--line-strong); border-radius: var(--radius-btn); padding: 8px 14px; font-size: 15px; background: var(--surface); }
.toolbar .filter { min-height: var(--tap); border: 1px solid var(--line); border-radius: 999px; padding: 8px 10px; font-size: 13.5px; font-weight: 600; color: var(--ink2); max-width: 46vw; background: var(--surface-low); }
.progressStrip { flex: 1 1 100%; display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 2px; }
.progressTxt { font-size: 12.5px; font-weight: 600; color: var(--ink2); white-space: nowrap; }
.progressTrack { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-cont); overflow: hidden; }
.progressTrack > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width .4s; }
/* Interruptor «Ocultar hechas» (fallo de Jorge 2026-10-29 19:24):
   pastilla con switch, mismo lenguaje que los filtros de la cabecera. */
.hideDoneWrap { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-low); cursor: pointer; user-select: none; -webkit-user-select: none; }
.hideDoneWrap input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.hdSwitch { width: 36px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; flex: none; transition: background .18s; }
.hdSwitch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform .18s; }
.hideDoneWrap input:checked + .hdSwitch { background: var(--primary); }
.hideDoneWrap input:checked + .hdSwitch::after { transform: translateX(16px); }
.hideDoneWrap input:focus-visible + .hdSwitch { outline: 2px solid var(--primary); outline-offset: 2px; }
.hdLbl { font-size: 13.5px; font-weight: 600; color: var(--ink2); white-space: nowrap; }

/* ---------- kanban ---------- */
#kanbanView { display: flex; gap: 16px; padding: 2px 16px 28px; overflow-x: auto; align-items: flex-start; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.col { background: var(--col-bg); border-radius: var(--radius-panel); width: 86vw; min-width: 86vw; max-width: 340px; padding: 12px; scroll-snap-align: start; }
.col.dragOver { outline: 2px dashed #818cf8; outline-offset: -4px; background: var(--primary-soft); }
.colHead { display: flex; align-items: center; gap: 7px; margin: 0 0 10px; padding: 0 2px; }
.colDot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.colHead h2 { flex: 1; font-size: 13.5px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count { background: var(--surface-high); color: var(--ink2); border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 700; }
.colMenuBtn, .colAddBtn { background: transparent; border: none; font-size: 18px; line-height: 1; width: 32px; height: 32px; cursor: pointer; color: var(--muted); border-radius: .375rem; display: inline-flex; align-items: center; justify-content: center; }
.colMenuBtn:hover, .colAddBtn:hover { background: var(--surface-high); color: var(--ink); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 13px 14px; margin-bottom: 8px; box-shadow: var(--shadow-1); cursor: pointer; min-height: 52px; transition: box-shadow .15s, transform .15s, border-color .15s; }
@media (hover: hover) { .card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); border-color: var(--line-strong); } }
.card.done { opacity: .6; }
.card.done .t { text-decoration: line-through; }
.cardTop { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; min-height: 22px; }
.cardId { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--muted); }
.prioMark { font-size: 12px; font-weight: 800; }
.prioMark.p3 { color: var(--warning); } .prioMark.p4 { color: #ea580c; } .prioMark.p5 { color: var(--error); }
[data-theme="dark"] .prioMark.p4 { color: #fdba74; }
.card .t { font-size: 15px; font-weight: 700; line-height: 1.35; letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cardDesc { font-size: 13px; color: var(--ink2); line-height: 1.45; margin-top: 5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.card .meta .avatar.sm { margin-left: -7px; border: 2px solid var(--surface); }
.card .meta .avatar.sm:first-of-type { margin-left: 0; }
.progress { height: 6px; background: var(--surface-cont); border-radius: 99px; margin-top: 10px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); }
.progress.sub > i { background: var(--success); }
.chip { font-size: 11px; padding: 3px 9px; min-height: 22px; display: inline-flex; align-items: center; border-radius: 999px; font-weight: 700; background: var(--surface-cont); color: var(--ink2); }
.chip.etq { background: color-mix(in srgb, var(--lc, #64748b) 14%, var(--surface)); color: var(--lc, #64748b); border: 1px solid color-mix(in srgb, var(--lc, #64748b) 32%, transparent); }
.chip.grey { background: var(--surface-cont); color: var(--ink2); }
.chip.dueSoon { background: var(--error-bg); color: var(--error-ink); }
.chip.prio3 { background: #fef3c7; color: #b45309; } .chip.prio4 { background: #ffedd5; color: #c2410c; } .chip.prio5 { background: var(--error-bg); color: var(--error-ink); }
[data-theme="dark"] .chip.prio3 { background: rgba(217,119,6,.22); color: #fcd34d; }
[data-theme="dark"] .chip.prio4 { background: rgba(234,88,12,.24); color: #fdba74; }
.addRow { display: flex; gap: 6px; margin-top: 6px; }
.addRow input { flex: 1; min-height: var(--tap); border: 1.5px dashed var(--line-strong); background: transparent; border-radius: var(--radius-btn); padding: 8px 10px; font-size: 14px; min-width: 0; color: var(--ink); }
.addRow button { min-width: var(--tap); background: var(--primary); color: #fff; border: none; border-radius: var(--radius-btn); font-size: 18px; font-weight: 800; cursor: pointer; }

/* ---------- paneles (lista / tabla / gantt / calendario / analítica / compartido) ---------- */
.viewPane .panelCard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-panel); margin: 2px 16px 24px; padding: 14px; box-shadow: var(--shadow-1); }
.taskRow { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 10px 12px; margin-bottom: 8px; cursor: pointer; min-height: 52px; }
.taskRow:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.taskRow .t { flex: 1; font-weight: 600; font-size: 15px; }
.taskRow input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
.groupTitle { color: var(--ink2); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin: 16px 2px 8px; }
.groupTitle:first-child { margin-top: 2px; }
.tableWrap { overflow-x: auto; }
table.grid { border-collapse: collapse; width: 100%; font-size: 13.5px; background: var(--surface); }
table.grid th, table.grid td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.grid th { background: var(--surface-low); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink2); }
table.grid tr[data-task] { cursor: pointer; }
table.grid tr[data-task]:hover td { background: var(--surface-low); }
.gantt { position: relative; font-size: 12px; }
.ganttRow { display: grid; grid-template-columns: 118px 1fr; gap: 8px; align-items: center; margin-bottom: 7px; }
.ganttRow .gName { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ganttTrack { position: relative; height: 22px; background: var(--surface-cont); border-radius: 8px; }
.ganttBar { position: absolute; top: 3px; height: 16px; border-radius: 8px; background: var(--primary); min-width: 10px; }
.ganttHead { display: grid; grid-template-columns: 118px 1fr; gap: 8px; color: var(--ink2); font-weight: 700; margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 13px; }
.shareRow { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 9px 12px; margin-bottom: 8px; }
.shareRow .who { flex: 1; font-weight: 600; }
.shareRow .btn { min-height: 36px; padding: 5px 12px; }

/* calendario */
.calHead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.calHead h3 { font-family: var(--font-head); font-size: 17px; flex: 1; }
.calNav { min-height: 38px; width: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 16px; color: var(--ink); }
.calWrap { overflow-x: auto; }
.calGrid { display: grid; grid-template-columns: repeat(7, 1fr); min-width: 660px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.calDow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink2); background: var(--surface-low); padding: 7px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.calCell { min-height: 92px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.calCell.other { background: var(--surface-low); opacity: .55; }
.calDay { font-size: 12px; font-weight: 700; color: var(--ink2); width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.calCell.today .calDay { background: var(--primary); color: #fff; }
.calTask { display: block; width: 100%; text-align: left; border: none; cursor: pointer; background: var(--primary-soft); color: var(--primary-dark); font-size: 11.5px; font-weight: 600; border-radius: 6px; padding: 3px 6px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calTask.done { opacity: .55; text-decoration: line-through; }

/* analítica */
.kpiGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; margin-bottom: 6px; }
.kpiCard { background: var(--surface-low); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 13px 14px; }
.kpiNum { font-size: 27px; font-weight: 800; letter-spacing: -.02em; }
.kpiLbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink2); margin-top: 2px; }
.barRow { display: grid; grid-template-columns: 128px 1fr 36px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.barName { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barTrack { height: 10px; border-radius: 99px; background: var(--surface-cont); overflow: hidden; }
.barFill { height: 100%; background: var(--primary); border-radius: 99px; }
.barNum { font-weight: 700; color: var(--ink2); text-align: right; }

/* ---------- hoja / modal de tarjeta ---------- */
.sheetWrap { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; align-items: flex-end; justify-content: center; z-index: 60; }
.sheet { background: var(--surface); color: var(--ink); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 8px 0 0; -webkit-overflow-scrolling: touch; box-shadow: var(--shadow-4); }
.sheet.small { max-width: 420px; padding: 20px 18px 22px; }
.sheetHandle { width: 44px; height: 5px; border-radius: 99px; background: var(--line-strong); margin: 4px auto 6px; }
.sheetMain { padding: 4px 18px 28px; }
.sheetSide { padding: 4px 18px 28px; border-top: 1px solid var(--line); }
.sheetCrumb { font-size: 12.5px; color: var(--muted); font-weight: 600; margin: 4px 0 8px; }
.sheetCrumb b { color: var(--primary-dark); }
.sheetHead { display: flex; gap: 8px; align-items: flex-start; }
.titleInput { flex: 1; font-size: 20px; font-weight: 800; letter-spacing: -.01em; border: none; border-bottom: 2px solid var(--line); padding: 6px 2px; min-width: 0; background: transparent; color: var(--ink); }
.sheetActions { display: flex; gap: 8px; margin: 12px 0 4px; flex-wrap: wrap; }
.sheetActions .btn { flex: 1; }
.sheet h3 { font-family: var(--font-head); font-size: 18px; margin-bottom: 12px; }
.sheet h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink2); margin: 20px 0 8px; font-weight: 700; }
.sheet textarea, .sheet input[type="text"], .sheet input:not([type]), .sheet select { width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-btn); font-size: 15px; background: var(--surface); color: var(--ink); }
.sheet textarea { min-height: auto; }
#dialogInput { width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-btn); font-size: 15px; background: var(--surface); color: var(--ink); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 label { font-size: 12px; font-weight: 600; color: var(--ink2); display: block; }
.grid2 input, .grid2 select { width: 100%; min-width: 0; margin-top: 4px; min-height: var(--tap); padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-btn); font-size: 14px; background: var(--surface); color: var(--ink); }
.sheet input.titleInput { border: none; border-bottom: 2px solid var(--line); border-radius: 0; padding: 6px 2px; min-height: auto; }
.sheet input.titleInput:focus { box-shadow: none; border-bottom-color: var(--primary); }
.grid2 input[type="range"] { padding: 0; border: none; accent-color: var(--primary); box-shadow: none; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.labelChip { border: 1.5px solid color-mix(in srgb, var(--lc, #64748b) 40%, transparent); background: color-mix(in srgb, var(--lc, #64748b) 13%, var(--surface)); color: var(--lc, #64748b); opacity: .55; min-height: 36px; padding: 6px 12px; font-size: 13px; border-radius: 999px; font-weight: 700; cursor: pointer; }
.labelChip.on { opacity: 1; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px color-mix(in srgb, var(--lc, #64748b) 65%, transparent); }
.inlineForm { display: flex; gap: 7px; margin-top: 9px; align-items: center; }
.inlineForm input { flex: 1; min-width: 0; }
.inlineForm input[type="color"] { flex: none; width: 48px; padding: 4px; min-height: var(--tap); border: 1px solid var(--line-strong); border-radius: var(--radius-btn); background: var(--surface); }
.inlineForm input[type="file"] { font-size: 13px; border: none; padding: 6px 0; box-shadow: none; }
.inlineForm select { flex: 1; }
.subtaskList .taskRow { box-shadow: none; }
.attachList .shareRow a { color: var(--primary-dark); font-weight: 700; text-decoration: none; }
.comment { background: var(--surface-low); border-radius: 11px; padding: 9px 11px; font-size: 14px; margin-bottom: 7px; }
.comment b { color: var(--primary-dark); }
.comment .when { color: var(--muted); font-size: 11px; }

/* ---------- videos en tarjetas (2026-10-29: pedido de Jorge) ----------
   La cara muestra una franja-miniatura 16:9 (YouTube hqdefault /
   thumbnail de Drive) con ▶ centrado y «+N» si hay más videos; la
   hoja trae la sección «Video» con vista previa grande. */
.cardVideo { position: relative; border-radius: 9px; overflow: hidden; margin-top: 9px; aspect-ratio: 16/9; background: #0b1c30; }
.cardVideo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cardVideo .cvFilm { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 26px; opacity: .45; }
.cvPlay { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; background: rgba(11, 28, 48, .72); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; padding-left: 2px; pointer-events: none; }
.cvPlay.big { width: 56px; height: 56px; font-size: 19px; }
.cvCount { position: absolute; right: 7px; bottom: 7px; background: rgba(11, 28, 48, .8); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; }
.videoList { display: flex; flex-direction: column; gap: 12px; }
.videoCard { border: 1px solid var(--line); border-radius: var(--radius-card); overflow: hidden; background: var(--surface); }
.videoThumb { position: relative; aspect-ratio: 16/9; background: #0b1c30; cursor: pointer; }
.videoThumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.videoThumb.noimg img { display: none; }
.videoThumb.noimg::after { content: "🎬"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 34px; opacity: .5; }
.videoFrame { aspect-ratio: 16/9; background: #000; }
.videoFrame iframe { width: 100%; height: 100%; border: 0; display: block; }
.videoBtns { display: flex; gap: 7px; padding: 8px; }
.videoBtns .btn { flex: 1; min-height: 38px; font-size: 13.5px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.videoLinkCard { padding: 13px 14px; font-weight: 600; display: flex; gap: 8px; align-items: center; background: var(--surface-low); color: var(--ink); }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; z-index: 99; box-shadow: var(--shadow-3); max-width: 92vw; text-align: center; }

/* ---------- animaciones (capa v3, pedida por Jorge) ----------
   Solo CSS: transiciones y transforms, sin librerías. Duraciones
   150–300 ms con curvas suaves; nada bloquea ni retrasa acciones.
   Al final del archivo, prefers-reduced-motion apaga lo decorativo. */
@keyframes kcFadeSlide { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes kcCardSettle { from { opacity: .25; transform: translateY(5px) scale(.995); } to { opacity: 1; transform: none; } }
@keyframes kcSheetUp { from { opacity: .4; transform: translateY(46px); } to { opacity: 1; transform: none; } }
@keyframes kcSheetPop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes kcScrimIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes kcToastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* cambio de vista: fundido corto con subida leve */
.viewPane, #kanbanView { animation: kcFadeSlide .22s ease both; }
/* columnas y tarjetas se asientan al crear / mover / filtrar */
.col { animation: kcCardSettle .24s ease both; }
.col:nth-child(2) { animation-delay: .03s; } .col:nth-child(3) { animation-delay: .06s; }
.col:nth-child(4) { animation-delay: .09s; } .col:nth-child(5) { animation-delay: .12s; }
.col:nth-child(n+6) { animation-delay: .15s; }
.card { animation: kcCardSettle .2s ease both; }
.card.dragging { opacity: .45; transform: rotate(1.6deg) scale(.98); box-shadow: var(--shadow-3); }
/* apertura de la hoja de tarjeta y de los diálogos */
.sheetWrap { animation: kcScrimIn .2s ease both; }
.sheet { animation: kcSheetUp .28s cubic-bezier(.32, .72, .24, 1) both; }
.toast { animation: kcToastIn .25s ease both; }
/* respuesta táctil sutil en controles */
.tab, .sideItem, .chip, .labelChip, .taskRow, .calTask, .calNav, .shareRow { transition: background-color .15s ease, color .15s ease, box-shadow .15s ease, border-color .15s ease, transform .1s ease; }
.taskRow:active, .calTask:active, .tab:active { transform: scale(.985); }
/* cambio de tema: fundido de superficies */
.appHeader, .sidebar, .toolbar, .col, .card, .panelCard, .taskRow, .sheet, .loginCard, .kpiCard, .calCell, .projectSelect, table.grid th { transition: background-color .25s ease, border-color .25s ease; }
/* barras de avance con movimiento */
.progress > i, .barFill { transition: width .45s ease; }
/* desplazamiento suave del tablero en escritorio */
#kanbanView { scroll-behavior: smooth; }
#calToday { width: auto; border-radius: 999px; padding: 0 14px; font-size: 13px; font-weight: 600; }
@media (min-width: 900px) {
  .sheet { animation-name: kcSheetPop; animation-duration: .24s; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- escritorio ---------- */
@media (min-width: 900px) {
  .col { width: 308px; min-width: 308px; }
  #kanbanView { padding: 2px 24px 30px; scroll-snap-type: none; }
  .projectBar, .viewTabs { padding-left: 24px; padding-right: 24px; }
  .toolbar { margin-left: 24px; margin-right: 24px; }
  .viewPane .panelCard { margin-left: 24px; margin-right: 24px; }
  .sheetWrap { align-items: center; padding: 18px; }
  .sheet { border-radius: var(--radius-panel); max-height: 90vh; max-width: 940px; }
  .sheetGrid { display: grid; grid-template-columns: minmax(0, 1fr) 302px; }
  .sheetMain { padding: 6px 22px 30px; }
  .sheetSide { border-top: none; border-left: 1px solid var(--line); background: var(--surface-low); padding: 6px 18px 30px; }
  .sheetSide .grid2 { grid-template-columns: 1fr; }
  .sheetHandle { display: none; }
  .ganttRow, .ganttHead { grid-template-columns: 220px 1fr; }
  .toolbar .filter { max-width: 220px; }
}

/* ============================================================
   FIDELIDAD v3.1 — logotipo + pasada visual contra las pantallas
   de Stitch de Jorge (corrección suya, 2026-10-29 18:22: «tampoco
   tiene el logotipo» y «no se ve igual»). Solo piel: ninguna
   regla de esta sección cambia estructura funcional ni lógica.
   Referencias: stitch_diseno/capturas/19 (tablero claro),
   01 (tablero oscuro) y 02 (modal), y el HTML descargado de las
   mismas pantallas (clases Tailwind = medidas exactas).
   ============================================================ */

/* --- logotipo: cabecera, barra lateral, pie y acceso --- */
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brandLogo { height: 34px; width: auto; display: block; }
.brandTxt { min-width: 0; }
.brandTxt .logo { font-size: 16px; white-space: nowrap; }
.sideOrg { display: flex; align-items: center; gap: 10px; }
.orgLogo { height: 30px; width: auto; display: block; flex: none; }
#loginView { flex-direction: column; align-items: center; }
.loginBrand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.loginLogo { height: 54px; width: auto; display: block; }
/* El logotipo vive SOLO en la cabecera principal (fallo de Jorge,
   2026-10-29 18:43): visible siempre, colapse o no la barra lateral. */
@media (max-width: 640px) {
  .brandLogo { height: 29px; }
  .brandTxt .logo { font-size: 15px; }
  .brandTxt .sub { display: none; }
  .appHeader { gap: 6px; padding: 8px 12px; }
}
@media (max-width: 560px) {
  /* El propio logotipo ya trae el nombre «Happy toes»: en pantallas
     angostas el texto junto a él sobra y empujaba los controles. */
  .brandTxt { display: none; }
  .brandLogo { height: 32px; }
}

/* --- la barra lateral nace arriba (la cabecera vive en el contenido) --- */
@media (min-width: 1100px) {
  .sidebar { top: 0; height: 100vh; }
}
.appHeader { min-height: 60px; }
@media (min-width: 900px) { .appHeader { padding-left: 24px; padding-right: 24px; } }

/* --- iconos Material Symbols (los de las pantallas de Stitch) --- */
.tabIco, .sideIco { font-family: "Material Symbols Outlined"; font-weight: normal; font-style: normal; letter-spacing: normal; text-transform: none; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24; }
.tabIco { font-size: 17px; line-height: 1; }
.sideIco { font-size: 19px; line-height: 1; }
.themeIco { font-family: inherit; font-variation-settings: normal; }

/* --- vistas como control segmentado (contenedor tintado, activa blanca) --- */
.viewTabs { background: var(--surface-low); border-radius: 12px; padding: 4px; gap: 2px; width: max-content; max-width: calc(100% - 32px); margin: 10px 16px 0; }
.tab { display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; min-height: 34px; padding: 6px 12px; }
.tab.active { background: var(--surface); color: var(--primary-dark); border-color: transparent; box-shadow: var(--shadow-1); }
@media (min-width: 900px) { .viewTabs { margin-left: 24px; margin-right: 24px; max-width: calc(100% - 48px); } }

/* --- selector de proyecto como pastilla-interruptor de la tarjeta --- */
.projectSelect { background: var(--surface-low); border-color: transparent; border-radius: 10px; font-size: 17px; }
.projectSelect:focus { border-color: var(--primary) !important; }

/* --- franja de avance: tarjeta tintada propia, barra gruesa a la derecha --- */
.progressStrip { background: var(--surface-low); border-top: none; border-radius: 12px; padding: 10px 14px; margin-top: 4px; }
.progressTxt { font-size: 13px; }
.progressTrack { flex: 0 1 240px; margin-left: auto; height: 9px; background: var(--surface-high); }
[data-theme="dark"] .progressTrack > i, [data-theme="dark"] .progress > i, [data-theme="dark"] .barFill { background: linear-gradient(90deg, #6366f1, #2dd4bf); }
[data-theme="dark"] .sidebar { background: #10121b; }
[data-theme="dark"] .appHeader { background: rgba(16, 18, 27, .94); }

/* --- columnas y tarjetas con las medidas del HTML de Stitch --- */
.colHead h2 { font-family: var(--font-body); font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.colDot { width: 10px; height: 10px; }
.count { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.card { padding: 14px; border-radius: 12px; }
.card .t { font-family: var(--font-body); font-weight: 600; line-height: 1.4; }
.progress.sub { background: var(--surface-low); height: auto; padding: 7px 9px; border-radius: 8px; }
.progress.sub > i { height: 6px; border-radius: 99px; }
@media (min-width: 900px) { .col { width: 320px; min-width: 320px; } }

/* --- hoja de tarjeta más cercana a su modal --- */
.sheetCrumb b { background: var(--primary-soft); border-radius: 999px; padding: 1px 8px; }
.sheetActions .btn { min-height: 40px; font-size: 14px; }
.btn.warn { background: var(--success-bg); color: var(--success); }
[data-theme="dark"] .btn.warn { color: var(--success); }
.sheetMain #fDesc { background: var(--surface-low); border-color: transparent; border-radius: 12px; }
.titleInput { font-size: 23px; }
@media (min-width: 900px) {
  .sheet { max-width: 1080px; }
  .titleInput { font-size: 25px; }
}
