/* PropWin CRM — ver docs/design-system.md */
:root {
  --navy-50: #EEF2F8; --navy-100: #D7E0EF; --navy-200: #AEC0DD; --navy-300: #7E97C2;
  --navy-400: #4D6699; --navy-500: #27406F; --navy-600: #15294B; --navy-700: #0F2143;
  --navy-800: #0B1E3D; --navy-900: #081428; --navy-950: #050D1B;
  --accent: #1D6FF2; --accent-light: #3B8DF7; --accent-dark: #155FD0;
  --red: #DC2626;

  --bg: #F4F7FB;
  --canvas: #F4F7FB;
  --sheet: #FFFFFF;
  --sheet-2: #F7F9FC;
  --side: #FBFCFE;
  --line: #E3E9F3;
  --line-strong: #D7E0EF;
  --t1: #0B1E3D;
  --t2: #3B5079;
  --t3: #6A80A8;
  --hover: rgba(11, 30, 61, .045);
  --sel: rgba(29, 111, 242, .09);
  --accent-text: #155FD0;
  --red-text: #C81E1E;
  --red-soft: rgba(220, 38, 38, .08);
  --glass: rgba(255, 255, 255, .72);
  --glass-strong: rgba(255, 255, 255, .9);

  --sh-1: 0 1px 2px rgba(11, 30, 61, .05), 0 1px 1px rgba(11, 30, 61, .03);
  --sh-2: 0 1px 2px rgba(11, 30, 61, .04), 0 18px 40px -16px rgba(11, 30, 61, .14);
  --sh-3: 0 24px 80px -20px rgba(11, 30, 61, .35), 0 2px 6px rgba(11, 30, 61, .06);
  --sh-glow: 0 10px 30px -10px rgba(29, 111, 242, .55);

  --font: "Inter", system-ui, -apple-system, sans-serif;
  --display: "Sora", "Inter", system-ui, sans-serif;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-drawer: cubic-bezier(.32, .72, 0, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #050D1B; --canvas: #050D1B; --sheet: #0A1629; --sheet-2: #0D1B31; --side: #07111F;
    --line: rgba(174, 192, 221, .10); --line-strong: rgba(174, 192, 221, .16);
    --t1: #EEF2F8; --t2: #AEC0DD; --t3: #7E97C2;
    --hover: rgba(174, 192, 221, .06); --sel: rgba(59, 141, 247, .14);
    --accent-text: #6AA8FA; --red-text: #F87171; --red-soft: rgba(239, 68, 68, .12);
    --glass: rgba(10, 22, 41, .72); --glass-strong: rgba(10, 22, 41, .9);
    --sh-1: 0 1px 0 rgba(255, 255, 255, .03) inset; --sh-2: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 18px 40px -18px rgba(0, 0, 0, .6);
    --sh-3: 0 30px 90px -20px rgba(0, 0, 0, .75); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #050D1B; --canvas: #050D1B; --sheet: #0A1629; --sheet-2: #0D1B31; --side: #07111F;
  --line: rgba(174, 192, 221, .10); --line-strong: rgba(174, 192, 221, .16);
  --t1: #EEF2F8; --t2: #AEC0DD; --t3: #7E97C2;
  --hover: rgba(174, 192, 221, .06); --sel: rgba(59, 141, 247, .14);
  --accent-text: #6AA8FA; --red-text: #F87171; --red-soft: rgba(239, 68, 68, .12);
  --glass: rgba(10, 22, 41, .72); --glass-strong: rgba(10, 22, 41, .9);
  --sh-1: 0 1px 0 rgba(255, 255, 255, .03) inset; --sh-2: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 18px 40px -18px rgba(0, 0, 0, .6);
  --sh-3: 0 30px 90px -20px rgba(0, 0, 0, .75); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--t1); font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
svg { flex-shrink: 0; }
.num, td.num, .kpi-val { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; height: 100vh; height: 100dvh; }
.side {
  background: var(--side); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 14px 10px; gap: 6px; min-height: 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 14px; }
.brand-mark { border-radius: 8px; }
.brand-name { font: 700 15px/1 var(--display); letter-spacing: -.01em; }
.brand-name span { color: var(--accent-text); font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 1px; overflow: auto; }
.nav-group { font: 600 11px/1 var(--font); text-transform: uppercase; letter-spacing: .12em; color: var(--t3); padding: 16px 10px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 10px;
  color: var(--t2); font-weight: 500; border: 0; background: none; width: 100%; text-align: left; cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.nav-item svg { width: 17px; height: 17px; opacity: .85; }
.nav-item:hover { background: var(--hover); color: var(--t1); }
.nav-item[aria-current="page"] { background: var(--sheet); color: var(--t1); box-shadow: var(--sh-1), 0 0 0 1px var(--line); }
.nav-item[aria-current="page"] svg { color: var(--accent); opacity: 1; }
.nav-count { margin-left: auto; font-size: 12px; color: var(--t3); font-variant-numeric: tabular-nums; }
.nav-count.alert { color: var(--red-text); font-weight: 600; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 1px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top {
  display: flex; align-items: center; gap: 12px; padding: 12px 28px; height: 60px;
  border-bottom: 1px solid var(--line); background: var(--glass);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  position: relative; z-index: 5;
}
.search {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 8px 0 12px; width: min(440px, 100%);
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--sheet); color: var(--t3); cursor: pointer;
  transition: border-color .15s ease;
}
.search:hover { border-color: var(--navy-300); }
.search-text { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search svg { width: 16px; height: 16px; }
kbd {
  font: 500 11px/1 var(--font); padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--sheet-2); color: var(--t3);
}
.top-actions { margin-left: auto; display: flex; gap: 8px; }
.view { flex: 1; overflow: auto; padding: 26px 28px 60px; outline: none; }
.only-mobile, .icon-btn.only-mobile { display: none; }

/* ---------- primitives ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--sheet); color: var(--t1);
  font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, transform .12s var(--ease-out), box-shadow .15s ease;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .btn:hover { background: var(--hover); border-color: var(--navy-300); } }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: var(--sh-glow); }
@media (hover: hover) and (pointer: fine) { .btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); } }
.btn-ghost { border-color: transparent; background: transparent; color: var(--t2); }
.btn-danger { color: var(--red-text); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; border: 0;
  background: transparent; color: var(--t2); cursor: pointer; transition: background-color .15s ease;
}
.icon-btn:hover { background: var(--hover); color: var(--t1); }
.icon-btn svg { width: 17px; height: 17px; }

.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font: 700 23px/1.15 var(--display); letter-spacing: -.02em; margin: 0; }
.page-sub { color: var(--t3); margin: 4px 0 0; font-size: 13px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.sheet { background: var(--sheet); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sh-2); }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font: 600 14px/1.2 var(--font); margin: 0; }
.sheet-head .meta { color: var(--t3); font-size: 12.5px; }
.sheet-head .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.sheet-body { padding: 16px 18px; }
.empty { padding: 34px 18px; text-align: center; color: var(--t3); }
.empty strong { display: block; color: var(--t1); font-weight: 600; margin-bottom: 4px; }

/* chips & badges */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--sheet-2); color: var(--t2); border: 1px solid var(--line); white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.s-lead { color: var(--navy-300); }
.chip.s-diagnostico { color: var(--navy-400); }
.chip.s-propuesta { color: var(--navy-500); }
.chip.s-negociacion { color: var(--accent-light); }
.chip.s-activo, .chip.s-ganado, .chip.s-cobrada, .chip.s-produccion { color: var(--accent-text); background: var(--sel); border-color: transparent; }
.chip.s-aplazado, .chip.s-pausa, .chip.s-borrador { color: var(--t3); }
.chip.s-perdido { color: var(--t3); text-decoration: line-through; }
.chip.s-vencida, .chip.alert { color: var(--red-text); background: var(--red-soft); border-color: transparent; }
:root[data-theme="dark"] .chip.s-diagnostico, :root[data-theme="dark"] .chip.s-propuesta { color: var(--navy-200); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.s-diagnostico, :root:not([data-theme="light"]) .chip.s-propuesta { color: var(--navy-200); } }
.chip span:not(.dot) { color: var(--t2); }
.tag { display: inline-flex; height: 22px; align-items: center; padding: 0 8px; border-radius: 6px; font-size: 12px; background: var(--sheet-2); border: 1px solid var(--line); color: var(--t2); margin: 0 4px 4px 0; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--sheet-2); border: 1px solid var(--line); gap: 2px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; height: 28px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  color: var(--t2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background-color .15s ease, color .15s ease;
}
.seg button .c { color: var(--t3); font-weight: 500; font-variant-numeric: tabular-nums; }
.seg button[aria-pressed="true"] { background: var(--sheet); color: var(--t1); box-shadow: var(--sh-1), 0 0 0 1px var(--line); }
.input, select.input, textarea.input {
  height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--sheet);
  min-width: 0; transition: border-color .15s ease, box-shadow .15s ease;
}
textarea.input { height: auto; min-height: 84px; padding: 9px 12px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29, 111, 242, .18); }
.input-search { padding-left: 34px; background-repeat: no-repeat; background-position: 11px 50%; width: 260px; }
.search-field { position: relative; }
.search-field svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--t3); pointer-events: none; }

/* ---------- table ---------- */
.table-wrap { overflow: auto; border-radius: 16px; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.t th {
  position: sticky; top: 0; z-index: 1; background: var(--sheet-2); text-align: left; font-weight: 600; font-size: 12px;
  color: var(--t3); padding: 0 14px; height: 36px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none;
}
.t th[data-sort] { cursor: pointer; }
.t th[data-sort]:hover { color: var(--t1); }
.t th .arrow { opacity: .9; margin-left: 4px; color: var(--accent-text); }
.t td { padding: 0 14px; height: 44px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { cursor: pointer; transition: background-color .12s ease; }
.t tbody tr:hover { background: var(--hover); }
.t .num { text-align: right; }
.t .muted { color: var(--t3); }
.t td.wrap { white-space: normal; }
.cell-main { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.cell-main small { display: block; font-weight: 400; color: var(--t3); font-size: 12px; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--t3); font-size: 12.5px; }

/* avatar con aura */
.av {
  --h: 220; width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0;
  font: 700 11.5px/1 var(--display); color: #fff; letter-spacing: .02em;
  background: radial-gradient(120% 120% at 30% 20%, hsl(var(--h) 85% 62%), hsl(var(--h) 70% 34%));
  box-shadow: 0 0 0 2px var(--sheet), 0 6px 14px -6px hsl(var(--h) 80% 45% / .7);
}
.av.lg { width: 52px; height: 52px; font-size: 17px; border-radius: 16px; }

/* ---------- Hoy ---------- */
.hello { margin-bottom: 18px; }
.hello h1 { font: 700 26px/1.15 var(--display); letter-spacing: -.02em; margin: 0; }
.hello p { margin: 6px 0 0; color: var(--t3); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--sheet); border-radius: 16px; box-shadow: var(--sh-2); margin-bottom: 18px; overflow: hidden; }
.kpi { padding: 16px 18px; border-left: 1px solid var(--line); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi-label { font-size: 12px; color: var(--t3); font-weight: 500; display: flex; gap: 6px; align-items: center; }
.kpi-val { font: 700 26px/1.1 var(--display); letter-spacing: -.02em; margin-top: 6px; }
.kpi-val small { font: 500 13px var(--font); color: var(--t3); letter-spacing: 0; margin-left: 2px; }
.kpi-foot { font-size: 12px; color: var(--t3); margin-top: 6px; }
.kpi-val.alert { color: var(--red-text); }
.bar { height: 6px; border-radius: 999px; background: var(--sheet-2); border: 1px solid var(--line); overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-light)); border-radius: 999px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }

.steps { list-style: none; margin: 0; padding: 6px 0; }
.step { display: grid; grid-template-columns: 74px 1fr auto; gap: 14px; align-items: center; padding: 10px 18px; cursor: pointer; transition: background-color .12s ease; }
.step:hover { background: var(--hover); }
.step-date { font-size: 12.5px; font-weight: 600; color: var(--t2); font-variant-numeric: tabular-nums; }
.step-date small { display: block; font-weight: 500; color: var(--t3); font-size: 11.5px; }
.step.overdue .step-date { color: var(--red-text); }
.step.overdue .step-date small { color: var(--red-text); opacity: .8; }
.step-body { min-width: 0; }
.step-body b { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.step-body p { margin: 2px 0 0; color: var(--t2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tasks { list-style: none; margin: 0; padding: 4px 0; }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 9px 18px; }
.task:hover { background: var(--hover); }
.check {
  appearance: none; width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--navy-300); margin: 1px 0 0;
  display: grid; place-items: center; cursor: pointer; flex-shrink: 0; transition: background-color .15s ease, border-color .15s ease;
}
.check:checked { background: var(--accent); border-color: var(--accent); }
.check:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.task-body { flex: 1; min-width: 0; }
.task-body .tt { font-weight: 500; }
.task.done .tt { color: var(--t3); text-decoration: line-through; }
.task-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--t3); margin-top: 2px; flex-wrap: wrap; }
.task-meta .late { color: var(--red-text); font-weight: 600; }
.task-meta a:hover { color: var(--accent-text); }
.prio { width: 6px; height: 6px; border-radius: 50%; display: inline-block; background: var(--navy-200); }
.prio.alta { background: var(--accent); }

.feed { list-style: none; margin: 0; padding: 6px 18px 12px; }
.feed li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 8px 0; position: relative; }
.feed li::before { content: ""; position: absolute; left: 10px; top: 30px; bottom: -8px; width: 1px; background: var(--line-strong); }
.feed li:last-child::before { display: none; }
.feed .fi { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: var(--sheet-2); border: 1px solid var(--line); color: var(--t2); }
.feed .fi svg { width: 12px; height: 12px; }
.feed .fi.hito { color: var(--accent-text); background: var(--sel); border-color: transparent; }
.feed p { margin: 0; font-size: 13px; color: var(--t1); }
.feed small { color: var(--t3); font-size: 12px; }

.funnel { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 100px 1fr 76px; gap: 12px; align-items: center; font-size: 13px; }
.funnel-row .lbl { color: var(--t2); }
.funnel-row .track { height: 8px; background: var(--sheet-2); border-radius: 999px; overflow: hidden; }
.funnel-row .track i { display: block; height: 100%; border-radius: 999px; background: var(--navy-300); }
.funnel-row.won .track i { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.funnel-row .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--t2); }

/* ---------- Pipeline ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(212px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; min-height: 60vh; align-items: start; }
.col { background: var(--sheet-2); border: 1px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; min-height: 200px; transition: border-color .15s ease, background-color .15s ease; }
.col.drop { border-color: var(--accent); background: var(--sel); }
.col-head { padding: 12px 14px 10px; display: flex; flex-direction: column; gap: 3px; }
.col-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.col-title .n { color: var(--t3); font-weight: 500; }
.col-sum { font-size: 12px; color: var(--t3); font-variant-numeric: tabular-nums; }
.col-empty { border: 1.5px dashed var(--line-strong); border-radius: 12px; padding: 18px 10px; text-align: center; color: var(--t3); font-size: 12px; }
.col-body { padding: 0 8px 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.deal {
  background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: grab; box-shadow: var(--sh-1);
  transition: box-shadow .18s ease, border-color .18s ease, transform .18s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { .deal:hover { border-color: rgba(29, 111, 242, .35); box-shadow: var(--sh-2); } }
.deal.dragging { opacity: .45; transform: scale(.98); }
.deal-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--t3); }
.deal h3 { font-size: 13.5px; font-weight: 600; margin: 6px 0 8px; line-height: 1.35; }
.deal-money { display: flex; gap: 10px; align-items: baseline; font-variant-numeric: tabular-nums; font-size: 13px; }
.deal-money b { font: 700 15px var(--display); letter-spacing: -.01em; }
.deal-money span { color: var(--t3); font-size: 12px; }
.deal-foot { display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; margin-top: 10px; font-size: 12px; color: var(--t3); }
.prob { display: inline-flex; align-items: center; gap: 6px; }
.prob i { width: 34px; height: 4px; border-radius: 999px; background: var(--line-strong); position: relative; overflow: hidden; }
.prob i::after { content: ""; position: absolute; inset: 0; width: var(--p); background: var(--accent); border-radius: 999px; }

/* ---------- Client detail ---------- */
.crumbs { font-size: 12.5px; color: var(--t3); margin-bottom: 14px; display: flex; gap: 6px; align-items: center; }
.crumbs a:hover { color: var(--t1); }
.client-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.client-head h1 { font: 700 24px/1.15 var(--display); letter-spacing: -.02em; margin: 0; }
.client-head .sub { color: var(--t3); font-size: 13px; margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.client-head .sub a:hover { color: var(--accent-text); }
.client-head .actions { margin-left: auto; display: flex; gap: 8px; }
.next-banner {
  display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-radius: 16px; margin-bottom: 18px;
  background: linear-gradient(90deg, var(--sel), transparent 70%), var(--sheet); border: 1px solid var(--line); box-shadow: var(--sh-2);
}
.next-banner.overdue { background: linear-gradient(90deg, var(--red-soft), transparent 70%), var(--sheet); }
.next-banner .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent); color: #fff; }
.next-banner.overdue .ico { background: var(--red); }
.next-banner .lbl { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--t3); }
.next-banner .txt { font-weight: 600; margin-top: 2px; }
.next-banner .when { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.next-banner.overdue .when { color: var(--red-text); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button {
  border: 0; background: none; padding: 10px 12px; font-weight: 600; font-size: 13px; color: var(--t3); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center;
}
.tabs button .c { font-weight: 500; font-variant-numeric: tabular-nums; }
.tabs button:hover { color: var(--t1); }
.tabs button[aria-selected="true"] { color: var(--t1); border-bottom-color: var(--accent); }

.facts { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: 13.5px; margin: 0; }
.facts dt { color: var(--t3); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.prose { color: var(--t2); font-size: 13.5px; line-height: 1.65; margin: 0; white-space: pre-wrap; }
.prose + h3, .sheet-body h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--t3); margin: 18px 0 6px; font-weight: 600; }
.sheet-body h3:first-child { margin-top: 0; }
.money-row { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.money-row > div { padding: 16px 18px; }
.money-row > div + div { border-left: 1px solid var(--line); }
.money-row .kpi-val { font-size: 22px; }

.composer { display: flex; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.composer .input { flex: 1; min-width: 200px; }

/* ---------- Drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(5, 13, 27, .32); z-index: 40; opacity: 0; transition: opacity .2s ease; }
.scrim.on { opacity: 1; }
.drawer {
  position: fixed; top: 10px; right: 10px; bottom: 10px; width: min(480px, calc(100vw - 20px)); z-index: 41;
  background: var(--sheet); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--sh-3);
  display: flex; flex-direction: column; transform: translateX(calc(100% + 20px)); transition: transform .26s var(--ease-drawer);
}
.drawer.on { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font: 700 17px/1.2 var(--display); letter-spacing: -.01em; margin: 0; }
.drawer-head .icon-btn { margin-left: auto; }
.drawer-body { flex: 1; overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.drawer-foot { display: flex; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); align-items: center; }
.drawer-foot .spacer { flex: 1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--t2); }
.field .hint { font-size: 12px; color: var(--t3); }
.field .err { font-size: 12px; color: var(--red-text); }
.field.invalid .input { border-color: var(--red); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); font-size: 12.5px; font-weight: 500; cursor: pointer; color: var(--t2); }
.checks input { display: none; }
.checks label:has(input:checked) { background: var(--sel); border-color: var(--accent); color: var(--accent-text); }

/* ---------- cmdk ---------- */
.cmdk-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(5, 13, 27, .35); display: grid; justify-items: center; align-content: start; padding-top: 12vh; animation: fade .12s ease-out; }
.cmdk {
  width: min(620px, calc(100vw - 24px)); border-radius: 18px; overflow: hidden; border: 1px solid var(--line-strong);
  background: var(--glass-strong); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px); box-shadow: var(--sh-3);
}
.cmdk input { width: 100%; height: 54px; border: 0; border-bottom: 1px solid var(--line); padding: 0 20px; background: transparent; font-size: 16px; outline: none; }
.cmdk ul { list-style: none; margin: 0; padding: 6px; max-height: 52vh; overflow: auto; }
.cmdk li { display: flex; align-items: center; gap: 12px; padding: 0 12px; height: 42px; border-radius: 10px; cursor: pointer; }
.cmdk li svg { width: 16px; height: 16px; color: var(--t3); }
.cmdk li .k { margin-left: auto; font-size: 12px; color: var(--t3); }
.cmdk li[aria-selected="true"] { background: var(--sel); }
.cmdk li[aria-selected="true"] svg { color: var(--accent); }
.cmdk .grp { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; color: var(--t3); padding: 10px 12px 4px; height: auto; cursor: default; }
.cmdk-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--t3); }
.cmdk-foot kbd { margin-right: 3px; }
@keyframes fade { from { opacity: 0; } }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; gap: 12px; align-items: center; padding: 10px 12px 10px 16px; border-radius: 999px; background: var(--navy-900); color: #fff;
  box-shadow: var(--sh-3); font-size: 13px; font-weight: 500; transition: opacity .2s ease, transform .2s var(--ease-out);
}
.toast.out { opacity: 0; transform: translateY(8px); }
.toast button { border: 0; background: rgba(255, 255, 255, .12); color: #fff; border-radius: 999px; height: 26px; padding: 0 10px; font-weight: 600; font-size: 12px; cursor: pointer; }

/* ---------- invoice preview ---------- */
.invoice { background: #fff; color: #0B1E3D; border-radius: 16px; padding: 36px; border: 1px solid var(--line); box-shadow: var(--sh-2); max-width: 760px; }
.invoice .inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 30px; }
.invoice h2 { font: 800 28px var(--display); margin: 0; letter-spacing: -.02em; }
.invoice table { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: 13.5px; }
.invoice th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; color: #4D6699; border-bottom: 1px solid #D7E0EF; padding: 8px 0; }
.invoice td { padding: 12px 0; border-bottom: 1px solid #EEF2F8; }
.invoice .tot { margin-left: auto; width: 260px; margin-top: 18px; font-variant-numeric: tabular-nums; }
.invoice .tot div { display: flex; justify-content: space-between; padding: 6px 0; }
.invoice .tot .big { font: 700 18px var(--display); border-top: 1px solid #D7E0EF; padding-top: 10px; }
.invoice small { color: #4D6699; }

@media print {
  .side, .top, .no-print { display: none !important; }
  .shell { display: block; } .view { padding: 0; overflow: visible; }
  .invoice { border: 0; box-shadow: none; padding: 0; }
  body { background: #fff; }
}

/* ---------- responsive ---------- */
@media (max-width: 1180px) { .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .26s var(--ease-drawer); box-shadow: var(--sh-3); padding-top: calc(14px + env(safe-area-inset-top)); }
  .side.open { transform: none; }
  .only-mobile, .icon-btn.only-mobile { display: inline-grid; }
  .top { padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); height: auto; }
  .search kbd, .search-text { display: none; }
  .search { width: 40px; padding: 0; justify-content: center; }
  .view { padding: 18px 14px 80px; }
  .input, select.input, textarea.input, .cmdk input { font-size: 16px; }
  .input-search { width: 100%; }
  .search-field { flex: 1; }
  .field-row { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; gap: 2px 0; }
  .facts dd { margin-bottom: 10px; }
  .step { grid-template-columns: 62px 1fr; }
  .step > :last-child { display: none; }
  .drawer { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; transform: translateY(100%); padding-bottom: env(safe-area-inset-bottom); }
  .client-head .actions { margin-left: 0; width: 100%; }
  .btn { height: 40px; }
  .t td { height: 48px; }
  .next-banner { flex-wrap: wrap; }
  .next-banner .when { margin-left: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .drawer, .side, .scrim { transition: opacity .15s ease !important; }
}

#entForm { display: flex; flex-direction: column; gap: 16px; }

:root[data-theme="dark"] .brand-mark { content: url("assets/propwin-mark-white.png"); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-mark { content: url("assets/propwin-mark-white.png"); } }

.sync-note { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px; margin-bottom: 16px; background: var(--sel); color: var(--t2); font-size: 13px; }
.sync-note.alert { background: var(--red-soft); color: var(--red-text); }
html, body { height: 100%; }
.shell { height: 100%; }

.grid-2.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-2.even { grid-template-columns: 1fr; } }

/* ---------- Hoy: rejilla de 4 columnas, filas de igual altura ---------- */
.kpis-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; border: 0; background: none; box-shadow: none; overflow: visible; border-radius: 0; }
.kpis-grid .kpi { border: 1px solid var(--line); border-radius: 16px; background: var(--sheet); box-shadow: var(--sh-2); display: flex; flex-direction: column; min-height: 128px; }
.kpis-grid .kpi .kpi-foot { margin-top: auto; padding-top: 6px; }
.kpis-grid .kpi .bar + .kpi-foot { margin-top: 6px; padding-top: 0; }
.hoy-alert { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 18px; border-radius: 14px; background: var(--red-soft); color: var(--red-text); font-size: 13px; transition: filter .15s ease; }
.hoy-alert span { flex: 1; min-width: 0; color: var(--t2); }
.hoy-alert b { color: var(--red-text); font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .hoy-alert:hover { filter: brightness(.97); } }
.hoy-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: 420px 300px; gap: 18px; }
.hoy-grid > .sheet { grid-column: span 2; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.sheet-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.hoy-grid .sheet-head { flex-shrink: 0; }
.hoy-grid .funnel { padding-top: 18px; gap: 14px; }
@media (max-width: 1100px) {
  .kpis-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis-grid .kpi:nth-child(n) { border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
  .hoy-grid { grid-template-columns: 1fr; grid-template-rows: none; }
  .hoy-grid > .sheet { grid-column: auto; }
  .hoy-grid > .hoy-a { max-height: 460px; }
  .hoy-grid > .hoy-b { max-height: 360px; }
}
.kpis-grid .kpi .bar { margin-top: auto; }
.kpis-grid .kpi .bar + .kpi-foot { margin-top: 8px; }

/* ---------- login (modo servidor) ---------- */
body.locked .shell { visibility: hidden; }
#login {
  --sheet: #0A1629; --line: rgba(174, 192, 221, .14); --line-strong: rgba(174, 192, 221, .2);
  --t1: #EEF2F8; --t2: #AEC0DD; --t3: #7E97C2; --red-text: #F87171; --hover: rgba(174, 192, 221, .06);
  color-scheme: dark;
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px;
  padding-top: max(24px, env(safe-area-inset-top)); overflow-y: auto;
  background:
    radial-gradient(900px 520px at 50% -10%, rgba(29, 111, 242, .28), transparent 60%),
    linear-gradient(180deg, #0B1E3D 0%, #050D1B 100%);
}
.login-card {
  width: min(380px, 100%); display: flex; flex-direction: column; gap: 16px;
  padding: 36px 32px 32px; border-radius: 28px;
  background: rgba(10, 22, 41, .72); border: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 40px 100px -30px rgba(0, 0, 0, .8);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  animation: loginIn .42s var(--ease-out) both;
}
.login-mark { height: 26px; width: auto; align-self: flex-start; margin-bottom: 10px; }
.login-card h1 { font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; color: var(--t1); margin: 0; }
.login-sub { margin: -8px 0 6px; color: var(--t3); font-size: 14px; line-height: 1.5; }
.login-card .input { height: 44px; font-size: 16px; background: rgba(5, 13, 27, .6); color: var(--t1); border-color: var(--line-strong); }
.login-err { min-height: 18px; margin: -4px 0 -6px; font-size: 13px; color: var(--red-text); }
.login-err:empty { visibility: hidden; }
.login-btn { height: 46px; justify-content: center; font-size: 15px; border-radius: 999px; margin-top: 4px; }
.login-btn:disabled { opacity: .7; cursor: progress; }
@keyframes loginIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .login-card { animation: none; } }

.user-foot { display: flex; align-items: center; gap: 10px; padding: 10px 10px 2px; margin-top: 6px; border-top: 1px solid var(--line); }
.user-foot .av { width: 26px; height: 26px; font-size: 10.5px; }
.user-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--t2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: inherit; text-decoration: none; border-radius: 8px; }
@media (hover: hover) and (pointer: fine) { .user-link:hover .user-name { color: var(--t1); } }
.pw-form { display: flex; flex-direction: column; gap: 14px; }
.pw-msg { margin: 0; min-height: 18px; font-size: 13px; color: var(--accent-text); }
.pw-msg.bad { color: var(--red-text); }
.pw-msg:empty { display: none; }
@media (max-width: 640px) { .pw-form .field-row { grid-template-columns: 1fr; } }
