/* ==========================================================
   VISION · PORTAL DE CLIENTES (SaaS)
   Login, panel de administración y vista de cliente.
   ========================================================== */

:root{
  --bg:#f5f3ee;
  --surface:#ffffff;
  --surface-2:#faf9f6;
  --surface-3:#f0ede6;
  --ink:#16140f;
  --ink-2:#4a463c;
  --ink-3:#736d60;
  --line:#e7e2d7;
  --line-2:#d9d2c3;

  --brand:#bb7c3f;
  --brand-600:#a56a32;
  --brand-700:#8c5826;
  --brand-50:#f8efe4;
  --brand-100:#f1dfc8;

  --navy:#1b3a5c;
  --navy-50:#e8eef5;

  --side:#121110;
  --side-2:#1c1a17;
  --side-ink:#ece8df;
  --side-ink-2:#9c968a;
  --side-line:#2a2723;

  --ok:#2f855a;    --ok-50:#e6f4ec;
  --warn:#b7791f;  --warn-50:#fbf1dd;
  --danger:#c0392b;--danger-50:#fbe9e7;
  --info:#2b6cb0;  --info-50:#e7f0fa;
  --muted-50:#efede8;

  --font-display:"Poppins","Helvetica Neue",Arial,sans-serif;
  --font-body:"Lato","Helvetica Neue",Arial,sans-serif;

  --r-sm:8px; --r:12px; --r-lg:16px; --r-xl:22px;
  --sh-1:0 1px 2px rgba(22,20,15,.05);
  --sh-2:0 1px 2px rgba(22,20,15,.04),0 6px 20px -8px rgba(22,20,15,.14);
  --sh-3:0 24px 60px -20px rgba(22,20,15,.35);
  --ease:cubic-bezier(.22,.61,.36,1);
  --side-w:252px;
}

*,*::before,*::after{ box-sizing:border-box; }
html,body{ margin:0; }
body.pt{
  background:var(--bg); color:var(--ink);
  font-family:var(--font-body); font-size:15px; line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
.pt img{ max-width:100%; display:block; }
:where(.pt) a{ color:inherit; }
.pt button{ font:inherit; color:inherit; }
.pt [hidden]{ display:none !important; }
.pt h1,.pt h2,.pt h3,.pt h4{ font-family:var(--font-display); margin:0; letter-spacing:-.01em; line-height:1.2; }
:where(.pt) p{ margin:0; }
.pt svg.i{ width:18px; height:18px; flex:none; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.sr-only{ position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
:focus-visible{ outline:2px solid var(--brand); outline-offset:2px; }

/* ---------- botones ---------- */
.b{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  height:38px; padding:0 14px; border-radius:10px; border:1px solid transparent;
  font-family:var(--font-display); font-weight:500; font-size:13.5px; white-space:nowrap;
  cursor:pointer; text-decoration:none; transition:background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.b:active{ transform:translateY(1px); }
.b:disabled{ opacity:.55; cursor:not-allowed; }
.b svg.i{ width:16px; height:16px; }
.b--primary{ background:var(--brand); color:#fff; box-shadow:0 1px 0 rgba(255,255,255,.2) inset, 0 1px 2px rgba(140,88,38,.35); }
.b--primary:hover{ background:var(--brand-600); }
.b--dark{ background:var(--ink); color:#fff; }
.b--dark:hover{ background:#2b2822; }
.b--ghost{ background:var(--surface); border-color:var(--line-2); color:var(--ink); }
.b--ghost:hover{ background:var(--surface-3); }
.b--quiet{ background:transparent; color:var(--ink-2); }
.b--quiet:hover{ background:var(--surface-3); color:var(--ink); }
.b--danger{ background:var(--surface); border-color:#efc9c4; color:var(--danger); }
.b--danger:hover{ background:var(--danger-50); }
.b--sm{ height:32px; padding:0 10px; font-size:12.5px; border-radius:8px; }
.b--icon{ width:38px; padding:0; }
.b--sm.b--icon{ width:32px; }
.b--block{ width:100%; }

/* ---------- formularios ---------- */
.f{ display:flex; flex-direction:column; gap:6px; min-width:0; }
.f > label, .f > .f__label{ font-size:12.5px; font-weight:700; color:var(--ink-2); letter-spacing:.01em; }
.f__hint{ font-size:12px; color:var(--ink-3); }
.in, .sel, .ta{
  width:100%; height:40px; padding:0 12px; border-radius:10px;
  border:1px solid var(--line-2); background:var(--surface); color:var(--ink);
  font:inherit; font-size:14.5px; transition:border-color .15s, box-shadow .15s;
}
.ta{ height:auto; min-height:110px; padding:10px 12px; resize:vertical; line-height:1.55; }
.sel{ appearance:none; padding-right:34px; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8475' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 10px center; background-size:16px; }
.in:hover,.sel:hover,.ta:hover{ border-color:#c9c0ad; }
.in:focus,.sel:focus,.ta:focus{ outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-50); }
.in-group{ position:relative; display:flex; }
.in-group .in{ padding-right:84px; }
.in-group__btn{ position:absolute; right:4px; top:4px; bottom:4px; }
.in-group__btn .b{ height:100%; }
.grid-form{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.grid-form .span-2{ grid-column:1 / -1; }
.check{ display:flex; align-items:center; gap:10px; cursor:pointer; font-size:14px; user-select:none; }
.switch{ position:relative; width:38px; height:22px; flex:none; }
.switch input{ position:absolute; opacity:0; inset:0; margin:0; cursor:pointer; }
.switch span{ position:absolute; inset:0; border-radius:99px; background:var(--line-2); transition:background .15s; pointer-events:none; }
.switch span::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,.2); transition:transform .18s var(--ease); }
.switch input:checked + span{ background:var(--brand); }
.switch input:checked + span::after{ transform:translateX(16px); }
.switch input:focus-visible + span{ outline:2px solid var(--brand); outline-offset:2px; }
.range{ width:100%; accent-color:var(--brand); }

/* ---------- utilidades ---------- */
.row{ display:flex; align-items:center; gap:10px; }
.row--wrap{ flex-wrap:wrap; }
.row--between{ justify-content:space-between; }
.grow{ flex:1; min-width:0; }
.muted{ color:var(--ink-3); }
.small{ font-size:13px; }
.mono{ font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:13px; }
.ellipsis{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.stack > * + *{ margin-top:16px; }
.stack-sm > * + *{ margin-top:8px; }

/* ---------- badges ---------- */
.badge{ display:inline-flex; align-items:center; gap:6px; height:24px; padding:0 9px; border-radius:99px; font-size:12px; font-weight:700; white-space:nowrap; background:var(--muted-50); color:var(--ink-2); }
.badge::before{ content:""; width:6px; height:6px; border-radius:50%; background:currentColor; opacity:.85; }
.badge--plain::before{ display:none; }
.badge--planificacion{ background:var(--info-50); color:var(--info); }
.badge--en_curso{ background:var(--brand-50); color:var(--brand-700); }
.badge--pausado{ background:var(--warn-50); color:var(--warn); }
.badge--finalizado,.badge--completada{ background:var(--ok-50); color:var(--ok); }
.badge--pendiente{ background:var(--muted-50); color:var(--ink-3); }
.badge--off{ background:var(--danger-50); color:var(--danger); }

/* ---------- progreso ---------- */
.prog{ height:6px; border-radius:99px; background:var(--surface-3); overflow:hidden; }
.prog > span{ display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,var(--brand),#d39a5f); transition:width .5s var(--ease); }
.ring{ --p:0; --size:76px; width:var(--size); height:var(--size); border-radius:50%; display:grid; place-items:center;
  background:conic-gradient(var(--brand) calc(var(--p)*1%), var(--surface-3) 0); position:relative; flex:none; }
.ring::before{ content:""; position:absolute; inset:7px; border-radius:50%; background:var(--surface); }
.ring b{ position:relative; font-family:var(--font-display); font-size:18px; font-weight:600; }

/* ==========================================================
   LOGIN
   ========================================================== */
.auth{ min-height:100vh; display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.05fr); background:var(--surface); }
.auth__main{ display:flex; flex-direction:column; padding:28px clamp(20px,5vw,64px); }
.auth__top{ display:flex; align-items:center; justify-content:space-between; gap:16px; }
.auth__logo img{ height:40px; width:auto; }
.auth__back{ font-size:13.5px; color:var(--ink-2); text-decoration:none; display:inline-flex; gap:6px; align-items:center; }
.auth__back:hover{ color:var(--ink); }
.auth__form-wrap{ flex:1; display:flex; align-items:center; justify-content:center; padding:40px 0; }
.auth__form{ width:100%; max-width:380px; }
.auth__eyebrow{ font-size:12px; font-weight:900; letter-spacing:.16em; text-transform:uppercase; color:var(--brand-700); margin-bottom:12px; }
.auth__title{ font-size:30px; font-weight:600; margin-bottom:8px; }
.auth__sub{ color:var(--ink-2); margin-bottom:28px; }
.auth__form .f + .f{ margin-top:16px; }
.auth__submit{ margin-top:24px; height:46px; font-size:15px; }
.auth__err{ display:none; margin-bottom:16px; padding:10px 12px; border-radius:10px; background:var(--danger-50); color:var(--danger); font-size:14px; border:1px solid #f1cdc8; }
.auth__err.is-on{ display:block; }
.auth__foot{ font-size:12.5px; color:var(--ink-3); display:flex; gap:16px; flex-wrap:wrap; }
.auth__foot a{ color:var(--ink-3); }
.auth__help{ margin-top:22px; font-size:13.5px; color:var(--ink-3); }
.auth__help a{ color:var(--brand-700); font-weight:700; }

.auth__aside{ position:relative; overflow:hidden; background:#0f0e0c; color:#f3f1ec; margin:12px; border-radius:24px; display:flex; flex-direction:column; justify-content:flex-end; padding:44px; min-height:560px; }
.auth__aside img.bg{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; opacity:.55; }
.auth__aside::after{ content:""; position:absolute; inset:0; background:linear-gradient(180deg,rgba(15,14,12,.15) 0%,rgba(15,14,12,.35) 40%,rgba(15,14,12,.92) 100%); }
.auth__aside > *{ position:relative; z-index:1; }
.auth__quote{ font-family:var(--font-display); font-size:clamp(22px,2.3vw,30px); font-weight:500; line-height:1.25; max-width:520px; }
.auth__feats{ display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-top:28px; }
.auth__feat{ padding:14px; border-radius:14px; background:rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.12); backdrop-filter:blur(8px); font-size:13px; color:#d9d4c8; }
.auth__feat svg.i{ color:#e2b07a; margin-bottom:8px; }
.auth__feat strong{ display:block; color:#fff; font-family:var(--font-display); font-weight:500; font-size:14px; margin-bottom:2px; }

/* ==========================================================
   APP SHELL
   ========================================================== */
.app{ display:grid; grid-template-columns:var(--side-w) minmax(0,1fr); min-height:100vh; }
.side{ position:sticky; top:0; height:100vh; background:var(--side); color:var(--side-ink); display:flex; flex-direction:column; padding:18px 14px; gap:6px; z-index:40; }
.side__brand{ display:flex; align-items:center; gap:10px; padding:6px 8px 18px; }
.side__brand img{ height:34px; width:auto; }
.side__tag{ font-size:10.5px; font-weight:900; letter-spacing:.14em; text-transform:uppercase; color:var(--brand); border:1px solid rgba(187,124,63,.45); padding:2px 7px; border-radius:6px; }
.side__label{ font-size:11px; font-weight:900; letter-spacing:.14em; text-transform:uppercase; color:#6d685e; padding:14px 10px 6px; }
.side__nav{ display:flex; flex-direction:column; gap:2px; }
.side__link{ display:flex; align-items:center; gap:11px; padding:9px 10px; border-radius:10px; color:var(--side-ink-2); text-decoration:none; font-size:14px; font-weight:700; transition:background .15s, color .15s; }
.side__link:hover{ background:var(--side-2); color:var(--side-ink); }
.side__link.is-on{ background:#24211d; color:#fff; box-shadow:inset 2px 0 0 var(--brand); }
.side__link.is-on svg.i{ color:var(--brand); }
.side__count{ margin-left:auto; font-size:11.5px; color:#7d776b; background:#211f1b; padding:1px 7px; border-radius:99px; }
.side__projects{ display:flex; flex-direction:column; gap:1px; overflow:auto; min-height:0; }
.side__proj{ display:flex; align-items:center; gap:10px; padding:7px 10px; border-radius:9px; text-decoration:none; color:var(--side-ink-2); font-size:13.5px; }
.side__proj:hover{ background:var(--side-2); color:var(--side-ink); }
.side__proj.is-on{ background:#24211d; color:#fff; }
.side__dot{ width:8px; height:8px; border-radius:3px; flex:none; background:#5a554c; }
.side__dot--en_curso{ background:var(--brand); }
.side__dot--finalizado{ background:#48a272; }
.side__dot--planificacion{ background:#5c8fc9; }
.side__dot--pausado{ background:#d6a243; }
.side__foot{ margin-top:auto; padding-top:12px; border-top:1px solid var(--side-line); display:flex; flex-direction:column; gap:6px; }
.side__user{ display:flex; align-items:center; gap:10px; padding:8px; border-radius:10px; }
.avatar{ width:34px; height:34px; border-radius:10px; display:grid; place-items:center; font-family:var(--font-display); font-weight:600; font-size:13px; background:var(--brand); color:#fff; flex:none; text-transform:uppercase; }
.avatar--lg{ width:52px; height:52px; border-radius:14px; font-size:18px; }
.avatar--soft{ background:var(--brand-50); color:var(--brand-700); }
.side__user b{ display:block; font-size:13.5px; color:#fff; font-weight:700; }
.side__user span{ font-size:12px; color:var(--side-ink-2); }
.side__out{ margin-left:auto; color:var(--side-ink-2); background:none; border:0; cursor:pointer; padding:6px; border-radius:8px; }
.side__out:hover{ background:var(--side-2); color:#fff; }

.main{ min-width:0; display:flex; flex-direction:column; }
.top{ position:sticky; top:0; z-index:30; height:64px; display:flex; align-items:center; gap:12px; padding:0 28px; background:rgba(245,243,238,.85); backdrop-filter:blur(10px); border-bottom:1px solid var(--line); }
.top__menu{ display:none; }
.crumbs{ display:flex; align-items:center; gap:8px; font-size:14px; color:var(--ink-3); min-width:0; }
.crumbs a{ color:var(--ink-3); text-decoration:none; }
.crumbs a:hover{ color:var(--ink); }
.crumbs b{ color:var(--ink); font-weight:700; }
.crumbs svg.i{ width:14px; height:14px; }
.top__actions{ margin-left:auto; display:flex; gap:8px; align-items:center; }
.search{ position:relative; width:260px; }
.search svg.i{ position:absolute; left:11px; top:50%; transform:translateY(-50%); color:var(--ink-3); width:16px; height:16px; pointer-events:none; }
.search .in{ height:36px; padding-left:34px; background:var(--surface); font-size:14px; }

.view{ padding:28px; max-width:1320px; width:100%; margin:0 auto; }
.view--wide{ max-width:none; }
.page-head{ display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:22px; flex-wrap:wrap; }
.page-head h1{ font-size:26px; font-weight:600; }
.page-head p{ color:var(--ink-2); margin-top:4px; }

/* ---------- tarjetas ---------- */
.card{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-lg); box-shadow:var(--sh-1); }
.card__head{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 20px; border-bottom:1px solid var(--line); }
.card__head h3{ font-size:15.5px; font-weight:600; }
.card__head p{ font-size:13px; color:var(--ink-3); margin-top:2px; }
.card__body{ padding:20px; }
.card__body--flush{ padding:0; }
.card + .card{ margin-top:18px; }
.kpis > .card, .pgrid > .card, .cstats > .card, .posts > .card, .mgrid > .card{ margin-top:0; }

.kpis{ display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; margin-bottom:22px; }
.kpi{ padding:18px; display:flex; gap:14px; align-items:flex-start; }
.kpi__icon{ width:40px; height:40px; border-radius:11px; display:grid; place-items:center; background:var(--brand-50); color:var(--brand-700); flex:none; }
.kpi__icon--navy{ background:var(--navy-50); color:var(--navy); }
.kpi__icon--ok{ background:var(--ok-50); color:var(--ok); }
.kpi__icon--muted{ background:var(--muted-50); color:var(--ink-2); }
.kpi__label{ font-size:12.5px; color:var(--ink-3); font-weight:700; }
.kpi__value{ font-family:var(--font-display); font-size:26px; font-weight:600; line-height:1.15; margin-top:2px; }
.kpi__sub{ font-size:12.5px; color:var(--ink-3); margin-top:2px; }

.dash{ display:grid; grid-template-columns:minmax(0,1.7fr) minmax(0,1fr); gap:18px; align-items:start; }

/* ---------- tarjetas de proyecto ---------- */
.pgrid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(270px,1fr)); gap:16px; }
.pcard{ display:flex; flex-direction:column; overflow:hidden; text-decoration:none; transition:transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s; }
.pcard:hover{ transform:translateY(-2px); box-shadow:var(--sh-2); border-color:var(--line-2); }
.pcard__cover{ aspect-ratio:16/9; background:var(--surface-3); position:relative; overflow:hidden; }
.pcard__cover img{ position:relative; z-index:1; width:100%; height:100%; object-fit:cover; }
.pcard__cover .badge{ z-index:2; position:absolute; top:12px; left:12px; box-shadow:0 1px 2px rgba(0,0,0,.08); }
.pcard__ph{ position:absolute; inset:0; display:grid; place-items:center; color:var(--ink-3); background:repeating-linear-gradient(135deg,var(--surface-3) 0 12px,var(--surface-2) 12px 24px); }
.pcard__ph svg.i{ width:30px; height:30px; opacity:.6; }
.pcard__body{ padding:14px 16px 16px; display:flex; flex-direction:column; gap:10px; flex:1; }
.pcard__title{ font-family:var(--font-display); font-weight:600; font-size:15.5px; }
.pcard__meta{ font-size:13px; color:var(--ink-3); display:flex; gap:12px; flex-wrap:wrap; }
.pcard__meta span{ display:inline-flex; align-items:center; gap:5px; }
.pcard__meta svg.i{ width:14px; height:14px; }
.pcard__foot{ margin-top:auto; display:flex; align-items:center; gap:10px; font-size:12.5px; color:var(--ink-2); }
.pcard__foot .prog{ flex:1; }
.pcard--new{ align-items:center; justify-content:center; min-height:250px; border-style:dashed; border-width:1.5px; color:var(--ink-2); gap:10px; cursor:pointer; background:var(--surface-2); }
.pcard--new:hover{ color:var(--brand-700); border-color:var(--brand); background:var(--brand-50); }
.pcard--new .kpi__icon{ width:46px; height:46px; }

/* ---------- tablas ---------- */
.table-wrap{ overflow-x:auto; }
.table{ width:100%; border-collapse:collapse; font-size:14px; }
.table th{ text-align:left; font-size:12px; font-weight:700; color:var(--ink-3); text-transform:uppercase; letter-spacing:.06em; padding:10px 16px; background:var(--surface-2); border-bottom:1px solid var(--line); white-space:nowrap; }
.table td{ padding:12px 16px; border-bottom:1px solid var(--line); vertical-align:middle; }
.table tr:last-child td{ border-bottom:0; }
.table tbody tr{ transition:background .12s; }
.table tbody tr.is-link{ cursor:pointer; }
.table tbody tr.is-link:hover{ background:var(--surface-2); }
.cell-user{ display:flex; align-items:center; gap:10px; min-width:0; }
.cell-user b{ display:block; font-weight:700; }
.cell-user span{ font-size:12.5px; color:var(--ink-3); }
.thumb-sm{ width:46px; height:34px; border-radius:7px; object-fit:cover; background:var(--surface-3); flex:none; }

/* ---------- actividad ---------- */
.feed{ list-style:none; margin:0; padding:0; }
.feed li{ display:flex; gap:12px; padding:12px 20px; border-bottom:1px solid var(--line); align-items:center; }
.feed li:last-child{ border-bottom:0; }
.feed__ic{ width:34px; height:34px; border-radius:9px; display:grid; place-items:center; background:var(--surface-3); color:var(--ink-2); flex:none; overflow:hidden; }
.feed__ic img{ width:100%; height:100%; object-fit:cover; }
.feed b{ font-weight:700; }
.feed small{ display:block; color:var(--ink-3); font-size:12.5px; }

/* ---------- vacío ---------- */
.empty{ text-align:center; padding:44px 20px; color:var(--ink-2); }
.empty__ic{ width:56px; height:56px; border-radius:16px; display:grid; place-items:center; margin:0 auto 14px; background:var(--brand-50); color:var(--brand-700); }
.empty__ic svg.i{ width:24px; height:24px; }
.empty h3{ font-size:17px; margin-bottom:6px; }
.empty p{ max-width:420px; margin:0 auto 18px; color:var(--ink-3); font-size:14px; }

/* ---------- cabecera de proyecto ---------- */
.phead{ display:flex; gap:20px; align-items:center; padding:20px; margin-bottom:18px; }
.phead__cover{ width:132px; height:92px; border-radius:12px; overflow:hidden; background:var(--surface-3); flex:none; position:relative; }
.phead__cover img{ width:100%; height:100%; object-fit:cover; }
.phead__info{ flex:1; min-width:0; }
.phead__title{ font-size:22px; font-weight:600; display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.phead__meta{ display:flex; gap:16px; flex-wrap:wrap; margin-top:8px; font-size:13.5px; color:var(--ink-2); }
.phead__meta span{ display:inline-flex; align-items:center; gap:6px; }
.phead__meta svg.i{ width:15px; height:15px; color:var(--ink-3); }
.phead__actions{ display:flex; gap:8px; flex-wrap:wrap; }

.tabs{ display:flex; gap:2px; border-bottom:1px solid var(--line); margin-bottom:22px; overflow-x:auto; scrollbar-width:none; }
.tabs::-webkit-scrollbar{ display:none; }
.tab{ display:inline-flex; align-items:center; gap:8px; padding:10px 14px; font-size:14px; font-weight:700; color:var(--ink-3); text-decoration:none; border-bottom:2px solid transparent; margin-bottom:-1px; white-space:nowrap; }
.tab:hover{ color:var(--ink); }
.tab.is-on{ color:var(--ink); border-bottom-color:var(--brand); }
.tab .side__count{ background:var(--surface-3); color:var(--ink-3); }

.split{ display:grid; grid-template-columns:minmax(0,1.6fr) minmax(0,1fr); gap:18px; align-items:start; }
.form-foot{ display:flex; justify-content:flex-end; gap:8px; padding:14px 20px; border-top:1px solid var(--line); background:var(--surface-2); border-radius:0 0 var(--r-lg) var(--r-lg); position:sticky; bottom:0; }

/* ---------- fases ---------- */
.phases{ list-style:none; margin:0; padding:0; }
.phase{ display:grid; grid-template-columns:28px minmax(0,1fr) auto; gap:14px; padding:14px 20px; border-bottom:1px solid var(--line); align-items:start; }
.phase:last-child{ border-bottom:0; }
.phase__dot{ width:28px; height:28px; border-radius:50%; display:grid; place-items:center; border:2px solid var(--line-2); background:var(--surface); color:var(--ink-3); font-size:12px; font-weight:700; font-family:var(--font-display); }
.phase--en_curso .phase__dot{ border-color:var(--brand); color:var(--brand-700); background:var(--brand-50); }
.phase--completada .phase__dot{ border-color:var(--ok); background:var(--ok); color:#fff; }
.phase__dot svg.i{ width:14px; height:14px; stroke-width:2.6; }
.phase__name{ font-weight:700; font-size:14.5px; }
.phase__dates{ font-size:12.5px; color:var(--ink-3); margin-top:2px; }
.phase__desc{ font-size:13.5px; color:var(--ink-2); margin-top:6px; white-space:pre-line; }
.phase__actions{ display:flex; gap:4px; align-items:center; }

/* línea de tiempo (cliente) */
.timeline{ list-style:none; margin:0; padding:4px 0; position:relative; }
.timeline li{ position:relative; padding:0 0 22px 40px; }
.timeline li::before{ content:""; position:absolute; left:13px; top:28px; bottom:0; width:2px; background:var(--line); }
.timeline li:last-child::before{ display:none; }
.timeline li.is-done::before{ background:var(--ok); }
.timeline .phase__dot{ position:absolute; left:0; top:0; }

/* ---------- galería ---------- */
.toolbar{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:16px; }
.chips{ display:flex; gap:6px; flex-wrap:wrap; }
.chip{ display:inline-flex; align-items:center; gap:7px; height:32px; padding:0 12px; border-radius:99px; border:1px solid var(--line-2); background:var(--surface); font-size:13px; font-weight:700; color:var(--ink-2); cursor:pointer; }
.chip:hover{ border-color:#c9c0ad; color:var(--ink); }
.chip.is-on{ background:var(--ink); border-color:var(--ink); color:#fff; }
.chip.is-on .chip__n{ color:#bdb7aa; }
.chip__n{ font-size:11.5px; color:var(--ink-3); font-weight:700; }
.chip--add{ border-style:dashed; color:var(--ink-3); }

.drop{ border:1.5px dashed var(--line-2); border-radius:var(--r-lg); background:var(--surface-2); padding:22px; display:flex; align-items:center; gap:16px; transition:background .15s, border-color .15s; margin-bottom:18px; }
.drop.is-over{ border-color:var(--brand); background:var(--brand-50); }
.drop__ic{ width:46px; height:46px; border-radius:13px; background:var(--surface); border:1px solid var(--line); display:grid; place-items:center; color:var(--brand-700); flex:none; }
.drop b{ font-family:var(--font-display); font-weight:600; }
.drop p{ font-size:13px; color:var(--ink-3); margin-top:2px; }
.drop .b{ margin-left:auto; }

.mgrid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:12px; }
.mitem{ position:relative; border-radius:12px; overflow:hidden; background:var(--surface-3); aspect-ratio:4/3; cursor:pointer; border:1px solid var(--line); isolation:isolate; }
.mitem img{ width:100%; height:100%; object-fit:cover; transition:transform .4s var(--ease); }
.mitem:hover img{ transform:scale(1.04); }
.mitem__ph{ position:absolute; inset:0; display:grid; place-items:center; color:var(--ink-3); }
.mitem__ph svg.i{ width:28px; height:28px; }
.mitem__play{ position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); width:46px; height:46px; border-radius:50%; background:rgba(15,14,12,.6); backdrop-filter:blur(6px); display:grid; place-items:center; color:#fff; pointer-events:none; }
.mitem__play svg.i{ width:18px; height:18px; fill:#fff; stroke:none; margin-left:2px; }
.mitem__cap{ position:absolute; left:0; right:0; bottom:0; padding:22px 10px 8px; background:linear-gradient(180deg,transparent,rgba(15,14,12,.75)); color:#fff; font-size:12.5px; font-weight:700; opacity:0; transition:opacity .2s; pointer-events:none; }
.mitem:hover .mitem__cap, .mitem:focus-visible .mitem__cap{ opacity:1; }
.mitem__flags{ position:absolute; top:8px; right:8px; display:flex; gap:4px; z-index:2; }
.flag{ height:22px; padding:0 7px; border-radius:6px; font-size:11px; font-weight:900; display:inline-flex; align-items:center; gap:4px; background:rgba(15,14,12,.65); color:#fff; backdrop-filter:blur(4px); }
.flag svg.i{ width:12px; height:12px; }
.flag--brand{ background:var(--brand); }
.mitem__sel{ position:absolute; top:8px; left:8px; z-index:2; width:24px; height:24px; border-radius:7px; border:2px solid #fff; background:rgba(15,14,12,.25); display:grid; place-items:center; opacity:0; transition:opacity .15s; }
.mitem__sel svg.i{ width:14px; height:14px; color:#fff; stroke-width:3; opacity:0; }
.mitem:hover .mitem__sel, .is-selecting .mitem__sel{ opacity:1; }
.mitem.is-sel{ outline:3px solid var(--brand); outline-offset:-3px; }
.mitem.is-sel .mitem__sel{ background:var(--brand); border-color:var(--brand); opacity:1; }
.mitem.is-sel .mitem__sel svg.i{ opacity:1; }
.mitem.is-hidden img{ opacity:.45; filter:grayscale(.6); }

.mgroup + .mgroup{ margin-top:28px; }
.mgroup__head{ display:flex; align-items:baseline; gap:10px; margin-bottom:12px; }
.mgroup__head h3{ font-size:16px; font-weight:600; }

.bulk{ position:sticky; bottom:18px; z-index:20; margin:18px auto 0; width:max-content; max-width:100%; display:flex; gap:8px; align-items:center; padding:8px 8px 8px 16px; border-radius:14px; background:var(--ink); color:#fff; box-shadow:var(--sh-3); font-size:14px; flex-wrap:wrap; }
.bulk .b--ghost{ background:#2a2722; border-color:#3a3630; color:#fff; }
.bulk .b--ghost:hover{ background:#36322c; }
.bulk .sel{ height:32px; width:auto; background-color:#2a2722; border-color:#3a3630; color:#fff; font-size:13px; }

/* ---------- documentos ---------- */
.docs{ list-style:none; margin:0; padding:0; }
.doc{ display:flex; align-items:center; gap:14px; padding:12px 20px; border-bottom:1px solid var(--line); }
.doc:last-child{ border-bottom:0; }
.doc:hover{ background:var(--surface-2); }
.doc__ic{ width:40px; height:46px; border-radius:8px; display:grid; place-items:center; font-size:10.5px; font-weight:900; letter-spacing:.04em; color:#fff; background:#8a8475; flex:none; text-transform:uppercase; position:relative; }
.doc__ic::after{ content:""; position:absolute; top:0; right:0; border-style:solid; border-width:0 10px 10px 0; border-color:transparent var(--surface) rgba(255,255,255,.35) transparent; }
.doc__ic--pdf{ background:#c84b3d; }
.doc__ic--doc,.doc__ic--docx,.doc__ic--odt,.doc__ic--rtf,.doc__ic--pages{ background:#2f6db3; }
.doc__ic--xls,.doc__ic--xlsx,.doc__ic--csv,.doc__ic--ods,.doc__ic--numbers{ background:#2f855a; }
.doc__ic--ppt,.doc__ic--pptx,.doc__ic--key{ background:#d0702c; }
.doc__ic--dwg,.doc__ic--dxf,.doc__ic--skp{ background:var(--navy); }
.doc__ic--zip,.doc__ic--rar,.doc__ic--7z{ background:#6b5b45; }
.doc__name{ font-weight:700; font-size:14.5px; }
.doc__meta{ font-size:12.5px; color:var(--ink-3); margin-top:2px; display:flex; gap:10px; flex-wrap:wrap; }
.doc__actions{ margin-left:auto; display:flex; gap:4px; align-items:center; }

/* ---------- novedades ---------- */
.posts{ display:flex; flex-direction:column; gap:14px; }
.post{ padding:18px 20px; }
.post__head{ display:flex; align-items:center; gap:12px; margin-bottom:10px; }
.post__head b{ display:block; font-size:14px; }
.post__head small{ color:var(--ink-3); font-size:12.5px; }
.post h3{ font-size:16.5px; font-weight:600; margin-bottom:6px; }
.post__body{ color:var(--ink-2); white-space:pre-line; }
.post__media{ display:grid; grid-template-columns:repeat(auto-fill,minmax(120px,1fr)); gap:8px; margin-top:14px; }
.post__media .mitem{ aspect-ratio:1; }
.pick{ display:grid; grid-template-columns:repeat(auto-fill,minmax(92px,1fr)); gap:8px; max-height:260px; overflow:auto; padding:2px; }
.pick .mitem{ aspect-ratio:1; }

/* ---------- acceso ---------- */
.access{ display:flex; gap:16px; align-items:center; padding:18px 20px; }
.cred{ display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:8px 14px; align-items:center; padding:14px 16px; border-radius:12px; background:var(--surface-2); border:1px solid var(--line); font-size:14px; }
.cred dt{ color:var(--ink-3); font-size:12.5px; font-weight:700; }
.cred dd{ margin:0; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:13.5px; overflow:hidden; text-overflow:ellipsis; }
.note{ display:flex; gap:10px; padding:12px 14px; border-radius:12px; background:var(--info-50); color:#24507f; font-size:13.5px; }
.note svg.i{ margin-top:1px; }
.note--brand{ background:var(--brand-50); color:var(--brand-700); }

/* ==========================================================
   VISTA CLIENTE
   ========================================================== */
.preview-bar{ position:sticky; top:0; z-index:35; display:flex; align-items:center; gap:12px; padding:10px 28px; background:var(--navy); color:#fff; font-size:14px; }
.preview-bar .b{ margin-left:auto; background:rgba(255,255,255,.12); color:#fff; border-color:rgba(255,255,255,.2); }
.preview-bar .b:hover{ background:rgba(255,255,255,.2); }

.chero{ position:relative; border-radius:var(--r-xl); overflow:hidden; background:#16140f; color:#fff; min-height:300px; display:flex; align-items:flex-end; margin-bottom:18px; }
.chero > img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; opacity:.7; }
.chero::after{ content:""; position:absolute; inset:0; background:linear-gradient(180deg,rgba(18,17,16,.1) 0%,rgba(18,17,16,.35) 45%,rgba(18,17,16,.9) 100%); }
.chero__in{ position:relative; z-index:1; padding:28px; width:100%; display:flex; align-items:flex-end; gap:24px; flex-wrap:wrap; }
.chero__txt{ flex:1; min-width:240px; }
.chero__eyebrow{ font-size:12px; font-weight:900; letter-spacing:.16em; text-transform:uppercase; color:#e2b07a; margin-bottom:8px; }
.chero h1{ font-size:clamp(26px,3.2vw,38px); font-weight:600; }
.chero__meta{ display:flex; gap:16px; flex-wrap:wrap; margin-top:10px; font-size:14px; color:#ddd7cb; }
.chero__meta span{ display:inline-flex; align-items:center; gap:6px; }
.chero__meta svg.i{ width:15px; height:15px; }
.chero .ring{ --size:92px; background:conic-gradient(#e2b07a calc(var(--p)*1%), rgba(255,255,255,.18) 0); }
.chero .ring::before{ background:rgba(18,17,16,.75); backdrop-filter:blur(6px); }
.chero .ring b{ color:#fff; font-size:21px; }
.chero__ring{ display:flex; align-items:center; gap:14px; }
.chero__ring small{ display:block; color:#cfc8ba; font-size:12.5px; }
.chero__ring strong{ font-family:var(--font-display); font-weight:500; font-size:15px; }
.chero .badge{ background:rgba(255,255,255,.14); color:#fff; backdrop-filter:blur(4px); }

.cstats{ display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin-bottom:22px; }
.cstat{ padding:16px 18px; }
.cstat small{ display:block; font-size:12.5px; color:var(--ink-3); font-weight:700; }
.cstat b{ display:block; font-family:var(--font-display); font-weight:600; font-size:17px; margin-top:4px; }

.pm{ display:flex; gap:14px; align-items:center; }
.pm b{ display:block; font-size:15px; }
.pm span{ font-size:13px; color:var(--ink-3); }
.pm-actions{ display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:14px; }
.prose{ color:var(--ink-2); white-space:pre-line; }

/* ---------- elección de proyecto (cliente) ---------- */
.welcome{ margin-bottom:22px; }
.welcome h1{ font-size:28px; font-weight:600; }
.welcome p{ color:var(--ink-2); margin-top:6px; max-width:640px; }

/* ==========================================================
   MODAL · LIGHTBOX · TOASTS · SUBIDAS
   ========================================================== */
.modal{ position:fixed; inset:0; z-index:100; display:flex; align-items:center; justify-content:center; padding:20px; }
.modal__bg{ position:absolute; inset:0; background:rgba(18,17,16,.5); backdrop-filter:blur(3px); animation:fade .18s var(--ease); }
.modal__box{ position:relative; width:100%; max-width:560px; max-height:calc(100vh - 40px); display:flex; flex-direction:column; background:var(--surface); border-radius:var(--r-xl); box-shadow:var(--sh-3); animation:pop .22s var(--ease); }
.modal__box--lg{ max-width:760px; }
.modal__head{ display:flex; align-items:flex-start; gap:12px; padding:20px 22px 0; }
.modal__head h2{ font-size:19px; font-weight:600; }
.modal__head p{ color:var(--ink-3); font-size:13.5px; margin-top:4px; }
.modal__x{ margin-left:auto; }
.modal__body{ padding:20px 22px; overflow:auto; }
.modal__foot{ display:flex; justify-content:flex-end; gap:8px; padding:14px 22px; border-top:1px solid var(--line); background:var(--surface-2); border-radius:0 0 var(--r-xl) var(--r-xl); }
.modal__foot .left{ margin-right:auto; }
.modal__err{ margin-bottom:14px; padding:10px 12px; border-radius:10px; background:var(--danger-50); color:var(--danger); font-size:13.5px; }
@keyframes fade{ from{ opacity:0; } }
@keyframes pop{ from{ opacity:0; transform:translateY(8px) scale(.98); } }

.lb{ position:fixed; inset:0; z-index:110; background:rgba(10,9,8,.94); display:grid; grid-template-columns:minmax(0,1fr) 340px; animation:fade .2s; }
.lb--client{ grid-template-columns:minmax(0,1fr); }
.lb__stage{ position:relative; display:flex; align-items:center; justify-content:center; padding:60px 70px 70px; min-width:0; min-height:0; }
.lb__stage img,.lb__stage video{ max-width:100%; max-height:calc(100vh - 140px); border-radius:8px; box-shadow:0 20px 60px rgba(0,0,0,.5); background:#000; }
.lb__btn{ position:absolute; width:44px; height:44px; border-radius:50%; border:0; background:rgba(255,255,255,.1); color:#fff; display:grid; place-items:center; cursor:pointer; transition:background .15s; }
.lb__btn:hover{ background:rgba(255,255,255,.2); }
.lb__prev{ left:16px; top:50%; transform:translateY(-50%); }
.lb__next{ right:16px; top:50%; transform:translateY(-50%); }
.lb__close{ top:14px; right:16px; }
.lb__count{ position:absolute; top:24px; left:24px; color:#bdb7aa; font-size:13px; font-weight:700; }
.lb__cap{ position:absolute; left:70px; right:70px; bottom:22px; text-align:center; color:#ece8df; font-size:14px; }
.lb__cap b{ display:block; font-family:var(--font-display); font-weight:500; font-size:15px; color:#fff; }
.lb__side{ background:var(--surface); padding:22px; overflow:auto; display:flex; flex-direction:column; gap:14px; }
.lb__side h3{ font-size:16px; }

.toasts{ position:fixed; left:50%; bottom:22px; transform:translateX(-50%); z-index:130; display:flex; flex-direction:column; gap:8px; align-items:center; pointer-events:none; }
.toast{ pointer-events:auto; display:flex; align-items:center; gap:10px; padding:10px 16px; border-radius:12px; background:var(--ink); color:#fff; font-size:14px; box-shadow:var(--sh-3); animation:pop .2s var(--ease); }
.toast svg.i{ color:#7fd1a3; }
.toast--err svg.i{ color:#f19a8f; }

.uploads{ position:fixed; right:20px; bottom:20px; z-index:120; width:340px; max-width:calc(100vw - 40px); background:var(--surface); border:1px solid var(--line); border-radius:var(--r-lg); box-shadow:var(--sh-3); overflow:hidden; }
.uploads__head{ display:flex; align-items:center; gap:10px; padding:12px 14px; background:var(--ink); color:#fff; font-size:14px; font-weight:700; }
.uploads__head .b{ margin-left:auto; color:#fff; }
.uploads__head .b:hover{ background:#2a2722; color:#fff; }
.uploads ul{ list-style:none; margin:0; padding:6px 0; max-height:280px; overflow:auto; }
.uploads li{ padding:8px 14px; font-size:13px; }
.uploads li .row{ margin-bottom:6px; }
.uploads li .prog{ height:4px; }
.uploads li.is-done .prog > span{ background:var(--ok); }
.uploads li.is-err .prog > span{ background:var(--danger); }

.spinner{ width:22px; height:22px; border-radius:50%; border:2.5px solid var(--line-2); border-top-color:var(--brand); animation:spin .8s linear infinite; }
@keyframes spin{ to{ transform:rotate(360deg); } }
.loading{ display:grid; place-items:center; padding:80px 0; }
.skeleton{ background:linear-gradient(90deg,var(--surface-3),var(--surface-2),var(--surface-3)); background-size:200% 100%; animation:sk 1.2s infinite; border-radius:10px; }
@keyframes sk{ to{ background-position:-200% 0; } }

.side-scrim{ display:none; }

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width:1180px){
  .kpis{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .dash, .split{ grid-template-columns:minmax(0,1fr); }
  .cstats{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .lb{ grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr) auto; }
  .lb__side{ max-height:42vh; }
}
@media (max-width:960px){
  .auth{ grid-template-columns:minmax(0,1fr); }
  .auth__aside{ display:none; }
  .app{ grid-template-columns:minmax(0,1fr); }
  .side{ position:fixed; left:0; top:0; bottom:0; width:280px; transform:translateX(-100%); transition:transform .25s var(--ease); }
  .app.is-menu .side{ transform:none; box-shadow:var(--sh-3); }
  .app.is-menu .side-scrim{ display:block; position:fixed; inset:0; z-index:39; background:rgba(18,17,16,.45); }
  .top{ padding:0 16px; }
  .top__menu{ display:inline-flex; }
  .search{ display:none; }
  .view{ padding:20px 16px; }
  .preview-bar{ padding:10px 16px; }
}
@media (max-width:640px){
  .kpis{ grid-template-columns:minmax(0,1fr); gap:10px; }
  .grid-form{ grid-template-columns:minmax(0,1fr); }
  .phead{ flex-direction:column; align-items:flex-start; padding:16px; }
  .phead__cover{ width:100%; height:150px; }
  .mgrid{ grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .drop{ flex-direction:column; align-items:flex-start; }
  .drop .b{ margin-left:0; }
  .page-head h1{ font-size:22px; }
  .chero{ min-height:260px; border-radius:var(--r-lg); }
  .chero__in{ padding:20px; }
  .cstats{ gap:10px; }
  .lb__stage{ padding:56px 12px 80px; }
  .lb__prev{ left:6px; } .lb__next{ right:6px; }
  .lb__cap{ left:16px; right:16px; }
  .doc{ padding:12px 16px; flex-wrap:wrap; }
  .doc__actions{ width:100%; margin-left:54px; }
  .table th, .table td{ padding:10px 12px; }
  .hide-sm{ display:none !important; }
  .top__actions .b-label{ display:none; }
  .crumbs{ font-size:13px; }
  .auth__title{ font-size:26px; }
}
@media (prefers-reduced-motion:reduce){
  *{ animation-duration:.01ms !important; transition-duration:.01ms !important; }
}
.auth__aside .auth__eyebrow{ color:#e2b07a; }

.obra-frame{ overflow:hidden; }
.obra-frame iframe{ display:block; width:100%; height:calc(100vh - 96px); min-height:600px; border:0; background:var(--surface); border-radius:var(--r-lg); }

.fin-frame iframe{ height:calc(100vh - 112px); background:#fff; }
