/* ──────────────────────────────────────────────────────────────────────────────
   Demos del manual — calcos de la app.

   Cada regla replica la de src/index.css de Fyal con sus mismas medidas:
   controles de 30 px sin borde sobre relleno gris, radios de 5/7 px, botón
   «primario» con el texto en el color de marca (no relleno verde), píldoras de
   estado con punto, bolita de presentado de 8 px, tarjetas sin sombra.
   ────────────────────────────────────────────────────────────────────────── */

:root {
  --green-dim: rgba(62, 207, 142, 0.14);
  --yellow-dim: rgba(232, 184, 74, 0.14);
  --red-dim: rgba(240, 106, 106, 0.14);
  --blue-dim: rgba(91, 156, 245, 0.14);
  --kanban-active: #00FFAB;
  --kanban-paused: #e8a500;
  --kanban-completed: #2D63F8;
  --kanban-archived: #686868;
}
[data-theme="light"] {
  --green-dim: rgba(31, 157, 103, 0.1);
  --yellow-dim: rgba(184, 134, 11, 0.12);
  --red-dim: rgba(209, 67, 67, 0.1);
  --blue-dim: rgba(47, 111, 214, 0.1);
}

/* Marco del demo */
.demo {
  margin: 18px 0 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  overflow: hidden;
}
.demo-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 12px 8px 14px;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-caption);
  color: var(--text-muted);
  background: var(--surface);
}
.demo-head .demo-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.demo-head .demo-label::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.demo-body { padding: 20px; }
.demo-body--tight { padding: 12px; }
.demo-note { font-size: var(--fs-caption); color: var(--text-muted); padding: 10px 14px 12px; margin: 0; border-top: 1px solid var(--border); background: var(--surface); }
.demo .fluid-highlight { background: color-mix(in srgb, var(--surface-hover) 55%, transparent); }

/* ── Controles (los de la app) ─────────────────────────────────────────── */
.a-btn, .a-btn-primary, .a-btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--control-fill);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.4;
  padding: 8px 16px;
  white-space: nowrap;
  transition: color var(--spring-fast), background var(--spring-fast), transform var(--spring-fast), opacity var(--spring-fast);
}
.a-btn:hover, .a-btn-ghost:hover { color: var(--text); background: var(--control-fill-hover); }
.a-btn:active, .a-btn-primary:active, .a-btn-ghost:active { transform: scale(0.97); }
.a-btn-primary { color: var(--brand); font-weight: 600; padding: 8px 20px; letter-spacing: 0.005em; }
.a-btn-primary:hover { background: var(--control-fill-hover); }
.a-btn-primary:disabled, .a-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.a-btn-sm { padding: 4px 12px; font-size: 0.72rem; }
.a-btn-ghost--active { background: var(--brand-dim); color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.a-btn-ghost--danger { color: var(--red); }
.a-btn-icon { padding: 5px 9px; color: var(--text-muted); }

.a-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.a-field > label { font-size: 0.75rem; color: var(--text-muted); letter-spacing: 0.01em; font-weight: 500; }
.a-input, .a-select {
  -webkit-appearance: none; appearance: none;
  background: var(--control-fill);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.4;
  padding: 8px 12px;
  outline: none;
  width: 100%;
  font-family: inherit;
  transition: background var(--spring-fast), box-shadow var(--spring-fast);
}
.a-input:hover:not(:focus), .a-select:hover { background: var(--control-fill-hover); }
.a-input:focus, .a-select:focus { box-shadow: 0 0 0 2px var(--brand-dim), 0 0 0 1px var(--brand); }
.a-input::placeholder { color: var(--text-subtle); }
.a-input:disabled { opacity: 0.55; }
.a-select-wrap { position: relative; }
.a-select { padding-right: 28px; cursor: pointer; }
.a-select-wrap::after { content: ""; position: absolute; right: 11px; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.a-preview { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.78rem; color: var(--text-muted); margin-top: 12px; }
.a-preview strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.a-hint { font-size: 0.72rem; color: var(--text-subtle); }
.a-error { font-size: 0.72rem; color: var(--red); }
.a-grid { display: grid; gap: 14px; }
.a-grid--2 { grid-template-columns: 1fr 1fr; }
.a-grid--3 { grid-template-columns: 1fr 1fr 1fr; }
.a-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.a-muted { color: var(--text-muted); }
.a-num { font-variant-numeric: tabular-nums; }
.a-range { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; background: var(--control-fill-hover); border-radius: 2px; outline: none; }
.a-range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--text); cursor: pointer; }

/* Segmentado (tema, idioma, formato) */
.a-segmented {
  position: relative; display: inline-flex; align-items: center; gap: 2px;
  height: 32px; padding: 3px;
  background: var(--control-fill); border-radius: var(--radius);
}
.a-segmented button {
  position: relative; z-index: 1; display: inline-flex; align-items: center; height: 100%; padding: 0 11px;
  background: none; border: none; border-radius: calc(var(--radius) - 1px);
  color: var(--text-muted); font-family: inherit; font-size: 0.78rem; font-weight: 500; cursor: pointer;
  transition: color var(--spring-fast), font-variation-settings var(--spring-moderate);
}
.a-segmented button:hover { color: var(--text); }
.a-segmented button.active { color: var(--text); font-weight: 600; }
.a-segmented button:disabled { color: var(--text-subtle); opacity: 0.45; cursor: not-allowed; }
.a-segmented .seg-pill { position: absolute; top: 3px; bottom: 3px; left: 0; border-radius: calc(var(--radius) - 1px); background: var(--surface-hover); pointer-events: none; z-index: 0; transition: transform var(--spring-moderate), width var(--spring-moderate); }

/* Selector de período (Año | T1 T2 T3 T4) */
.a-period { position: relative; display: inline-flex; align-items: center; gap: 2px; background: var(--control-fill); border-radius: var(--radius); padding: 3px; }
.a-period button { position: relative; z-index: 1; background: none; border: none; border-radius: var(--radius); color: var(--text-muted); cursor: pointer; height: 28px; padding: 0 13px; font-size: 0.78rem; font-weight: 500; font-family: inherit; white-space: nowrap; transition: color var(--spring-fast); }
.a-period button:hover { color: var(--text); }
.a-period button.active { color: var(--brand); font-weight: 600; }
.a-period .divider { width: 1px; height: 16px; margin: 0 3px; background: var(--border-strong); flex-shrink: 0; }
.a-period .seg-pill { position: absolute; top: 3px; bottom: 3px; left: 0; border-radius: var(--radius); background: var(--surface); pointer-events: none; z-index: 0; transition: transform var(--spring-moderate), width var(--spring-moderate); }
.a-year { display: inline-flex; align-items: center; gap: 2px; background: var(--control-fill); border-radius: var(--radius); padding: 3px; }
.a-year span { height: 28px; padding: 0 13px; display: inline-flex; align-items: center; font-size: 0.78rem; font-weight: 600; color: var(--text); background: var(--surface); border-radius: var(--radius); }
.a-year button { background: none; border: none; color: var(--text-muted); width: 28px; height: 28px; cursor: pointer; border-radius: var(--radius); font-family: inherit; }
.a-year button:hover { color: var(--text); }

/* ── Resumen: héroe + tarjetas ─────────────────────────────────────────── */
.a-hero { background: var(--surface); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.a-hero-value { font-size: 3rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.a-hero.green .a-hero-value { color: var(--green); } .a-hero.red .a-hero-value { color: var(--red); }
.a-kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.a-kpi { background: var(--surface); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.a-kpi-label { font-size: 0.9rem; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.a-kpi-value { font-size: 1.8rem; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--text); }
.a-kpi.green .a-kpi-value { color: var(--green); } .a-kpi.red .a-kpi-value { color: var(--red); } .a-kpi.yellow .a-kpi-value { color: var(--yellow); }
.a-kpi-sub { font-size: 0.72rem; color: var(--text-subtle); }

/* ── Tabla de facturas ─────────────────────────────────────────────────── */
.a-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; -webkit-user-select: none; user-select: none; }
.a-table th { text-align: left; font-size: 0.72rem; font-weight: 600; color: var(--text-subtle); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.a-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.a-table tbody tr:last-child td { border-bottom: 0; }
.a-table tbody tr { transition: background var(--spring-fast); }
.a-table tbody tr:hover td { background: color-mix(in srgb, var(--surface-hover) 40%, transparent); }
.a-table tr.tr-selected td { background: rgba(128, 128, 128, 0.06); }
.a-table tr.tr-selected td:first-child { box-shadow: inset 3px 0 0 var(--border-strong); }
.a-table td.num, .a-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.a-table .cell-copy { cursor: copy; border-radius: 3px; padding: 1px 3px; margin: -1px -3px; transition: background var(--spring-fast); }
.a-table .cell-copy:hover { background: var(--control-fill-hover); }
.a-table .row-menu { opacity: 0; transition: opacity var(--spring-fast); }
.a-table tbody tr:hover .row-menu { opacity: 1; }
.badge { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 3px 11px 3px 8px; min-width: 90px; border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; cursor: pointer; transition: opacity var(--spring-fast); }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge:hover { opacity: 0.75; }
.badge-paid { background: var(--green-dim); color: var(--green); }
.badge-pending { background: var(--yellow-dim); color: var(--yellow); }
.badge-row { display: inline-flex; align-items: center; gap: 6px; }
.days-badge { display: inline-block; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em; }
.days-pending { background: var(--yellow-dim); color: var(--yellow); }
.days-far { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.gap-warning { display: inline-block; font-size: 0.75rem; color: var(--yellow); background: var(--yellow-dim); border-radius: var(--radius-sm); padding: 3px 8px; }
.a-table-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.a-search { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; background: var(--control-fill); border-radius: var(--radius-sm); color: var(--text-subtle); font-size: 0.8rem; min-width: 200px; }
.a-search svg { width: 13px; height: 13px; }

/* Menú contextual */
.ctx-menu {
  position: fixed; z-index: 90; min-width: 180px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 5px;
  transform-origin: top left; transform: scale(0.96); opacity: 0; pointer-events: none;
  transition: transform var(--spring-moderate-exit), opacity var(--spring-moderate-exit);
}
.ctx-menu.open { transform: none; opacity: 1; pointer-events: auto; transition: transform var(--spring-moderate), opacity var(--spring-moderate); }
.ctx-item { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 12px; border: none; background: none; color: var(--text); font-size: 0.82rem; text-align: left; border-radius: var(--radius-sm); cursor: default; font-family: inherit; }
.ctx-item.danger { color: var(--red); }
.ctx-divider { height: 1px; background: var(--border); margin: 4px 2px; }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status-dot--paid { background: var(--green); } .status-dot--pending { background: var(--yellow); }

/* «Copiado» */
.copy-tip { position: fixed; z-index: 95; padding: 4px 8px; font-size: 0.72rem; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity var(--spring-fast), transform var(--spring-fast); }
.copy-tip.show { opacity: 1; transform: none; }

/* Píldora flotante de deshacer */
.float-pill-wrap { min-height: 44px; display: flex; justify-content: center; margin-top: 12px; }
.float-pill { display: inline-flex; align-items: center; gap: 14px; padding: 10px 14px 10px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border-strong); font-size: 0.84rem; color: var(--text); transform: translateY(8px); opacity: 0; transition: transform var(--spring-slow-exit), opacity var(--spring-slow-exit); }
.float-pill.show { transform: none; opacity: 1; transition: transform var(--spring-slow), opacity var(--spring-slow); }
.float-pill-action { flex-shrink: 0; border: none; background: var(--brand-dim); color: var(--brand); font-family: inherit; font-size: 0.8rem; font-weight: 600; padding: 5px 12px; border-radius: 999px; cursor: pointer; transition: background var(--spring-fast), color var(--spring-fast); }
.float-pill-action:hover { background: var(--brand); color: var(--brand-fg); }

/* ── Tarjetas de impuestos (IVA, IRPF, provisión) ──────────────────────── */
.irpf-card { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-lg); padding: 20px; }
.irpf-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 8px; }
.irpf-header h4 { margin: 0; font-size: 0.9rem; font-weight: 600; letter-spacing: -0.01em; }
.irpf-period-badge { font-size: 0.75rem; color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 2px 8px; }
.irpf-rows { display: flex; flex-direction: column; gap: 5px; }
.irpf-row { display: flex; justify-content: space-between; align-items: center; }
.irpf-label { font-size: 0.82rem; color: var(--text-muted); }
.irpf-value { font-size: 0.88rem; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.irpf-separator { border-top: 1px solid var(--border); margin: 4px 0; }
.irpf-result { padding-top: 8px; }
.irpf-big-value { font-size: 1.4rem; font-weight: 500; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1; }
.irpf-result.pay .irpf-big-value { color: var(--yellow); }
.irpf-result.refund .irpf-big-value { color: var(--green); }
.irpf-card.is-paid .irpf-rows { opacity: 0.55; }
.irpf-quarters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.irpf-quarter { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: var(--radius); background: var(--control-fill); font-size: 0.78rem; }
.irpf-quarter-head { display: flex; align-items: center; justify-content: space-between; color: var(--text-muted); }
.irpf-quarter-amount { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 0.92rem; }
.irpf-quarter.current { box-shadow: inset 0 0 0 1px var(--border-strong); }
.irpf-note { font-size: 0.72rem; line-height: 1.45; color: var(--text-subtle); margin: 10px 0 0; }
.irpf-rule { font-size: 0.78rem; color: var(--text-muted); margin: 0 0 12px; line-height: 1.5; }

/* La bolita de presentado / ingresado */
.dot-hit { display: inline-flex; align-items: center; justify-content: center; padding: 8px; margin: -8px; cursor: pointer; }
.vat-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); transition: background var(--spring-moderate), transform var(--spring-slow); }
.dot-hit:hover .vat-dot { background: var(--text-subtle); }
.vat-dot--paid, .dot-hit:hover .vat-dot--paid { background: var(--green); }
.dot-hit:hover .vat-dot--paid { opacity: 0.7; }
.vat-dot.pop { animation: dotpop var(--spring-slow) both; }
@keyframes dotpop { from { transform: scale(0.4); } to { transform: scale(1); } }

/* Provisión y plazos */
.provision-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.provision-total-label { font-weight: 600; color: var(--text); }
.provision-total-value { font-weight: 700; font-size: 1.05rem; color: var(--yellow); }
.provision-hint { margin: 10px 0 0; font-size: 0.72rem; line-height: 1.45; color: var(--text-subtle); }
.provision-deadlines-title { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 6px; }
.provision-deadline-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 0.8rem; }
.provision-deadline-row:last-of-type { border-bottom: none; }
.provision-deadline-label { flex: 1; color: var(--text); font-size: 0.82rem; }
.provision-deadline-date { color: var(--text-muted); font-size: 0.74rem; white-space: nowrap; }

/* ── Tablero ───────────────────────────────────────────────────────────── */
.kanban-board { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); align-items: start; gap: 16px; -webkit-user-select: none; user-select: none; }
.kanban-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kanban-col-header { display: flex; align-items: center; gap: 7px; padding: 0 2px 4px; }
.kanban-col-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.kanban-col-title { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); }
.kanban-col-count { font-size: 0.72rem; color: var(--text-subtle); margin-left: auto; }
.kanban-col-hint { font-size: 0.68rem; color: var(--text-subtle); padding: 0 2px 10px; border-bottom: 1px solid var(--border); }
.kanban-cards { display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 80px; border-radius: var(--radius); transition: background var(--spring-fast); }
.kanban-cards.over { background: var(--brand-dim); }
.kanban-card { background: var(--surface); border-radius: var(--radius); padding: 9px 14px; cursor: grab; transition: transform var(--spring-fast), opacity var(--spring-fast); }
.kanban-card:hover { transform: translateY(-2px); }
.kanban-card.dragging { opacity: 0.35; }
.kanban-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kanban-card-name { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1 1 0; font-size: 0.84rem; font-weight: 600; color: var(--text); letter-spacing: -0.01em; line-height: 1.3; }
.kanban-card-name-text { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-card-emoji { font-size: 0.95rem; line-height: 1; flex-shrink: 0; }
.kanban-card-budget-wrap { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.kanban-card-budget { font-size: 0.78rem; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; opacity: 0.55; }
.kanban-card-invoice-dot { width: 6px; height: 6px; border-radius: 50%; }
.kanban-card-invoice-dot.paid { background: var(--green); } .kanban-card-invoice-dot.pending { background: var(--yellow); }
.kanban-card-tasklist { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.kanban-card-task { display: flex; align-items: center; gap: 6px; cursor: pointer; line-height: 1; }
.task-checkbox { width: 13px; height: 13px; border: 1px solid var(--border-strong); border-radius: 3px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: transparent; color: var(--brand-fg); transition: background var(--spring-fast), border-color var(--spring-fast); }
.task-checkbox.done { background: var(--brand); border-color: var(--brand); }
.task-checkbox svg { width: 9px; height: 9px; }
.kanban-card-task-text { flex: 1 1 0; min-width: 0; font-size: 0.74rem; line-height: 1; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-card-task-text.done { text-decoration: line-through; color: var(--text-subtle); }
.kanban-ghost { position: fixed; pointer-events: none; z-index: 99; opacity: 0.9; transform: scale(1.03); }

/* ── Horas de un proyecto ──────────────────────────────────────────────── */
.time-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.time-head h4 { margin: 0; font-size: 0.9rem; font-weight: 600; }
.time-margin-pill { font-size: 0.7rem; font-weight: 600; border-radius: var(--radius-pill); padding: 2px 9px; white-space: nowrap; }
.time-margin-pill.ok { color: var(--green); background: var(--green-dim); } .time-margin-pill.bad { color: var(--red); background: var(--red-dim); }
.time-stats { display: flex; flex-wrap: wrap; gap: 20px; margin: 10px 0 14px; }
.time-stat { display: flex; flex-direction: column; gap: 2px; }
.time-stat-label { font-size: 0.72rem; color: var(--text-subtle); }
.time-stat-value { font-size: 0.88rem; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.time-stat-value.ok { color: var(--green); } .time-stat-value.bad { color: var(--red); }
.time-progress { margin: 4px 0 14px; }
.time-progress-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; font-size: 0.76rem; }
.time-progress-label { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.time-progress-status { font-weight: 600; }
.time-progress-status.ok { color: var(--green); } .time-progress-status.warn { color: var(--yellow); } .time-progress-status.over { color: var(--red); }
.time-progress-track { height: 8px; border-radius: 6px; background: var(--bg); overflow: hidden; }
.time-progress-fill { height: 100%; border-radius: 6px; transition: width var(--spring-moderate), background var(--spring-fast); }
.time-progress-fill.ok { background: var(--green); } .time-progress-fill.warn { background: var(--yellow); } .time-progress-fill.over { background: var(--red); }
.time-quick { display: flex; gap: 6px; }
.time-quick-btn { background: var(--control-fill); border: none; border-radius: var(--radius-sm); color: var(--text-muted); font-size: 0.72rem; font-weight: 500; padding: 4px 9px; cursor: pointer; font-family: inherit; }
.time-quick-btn:hover { color: var(--text); background: var(--control-fill-hover); }

/* ── Login ─────────────────────────────────────────────────────────────── */
.login-stage { display: flex; justify-content: center; padding: 8px 0; }
.pin-card { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 26px 34px; background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 310px; }
.login-quick-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--brand-dim); color: var(--brand); font-size: 1.4rem; font-weight: 700; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.login-quick-name { font-size: 1.1rem; font-weight: 600; color: var(--text); margin: 0 0 16px; text-align: center; letter-spacing: -0.01em; }
.login-logo-text { font-weight: 700; font-size: 2rem; letter-spacing: -0.03em; color: var(--text); line-height: 1.1; }
.login-lead { font-size: 0.875rem; color: var(--text-subtle); margin: 0 0 8px; }
.login-form { width: 100%; display: flex; flex-direction: column; gap: 16px; }
.login-input { width: 100%; height: 37px; padding: 0 12px; background: var(--control-fill); border: none; border-radius: var(--radius-sm); color: var(--text); font-size: 0.875rem; font-family: inherit; outline: none; transition: background var(--spring-fast), box-shadow var(--spring-fast); }
.login-input:hover:not(:focus) { background: var(--control-fill-hover); }
.login-input:focus { box-shadow: 0 0 0 2px var(--brand-dim), 0 0 0 1px var(--brand); }
.login-input--error { box-shadow: 0 0 0 1px var(--red); }
.login-submit { width: 100%; height: 37px; padding: 0; font-weight: 400; margin-top: 2px; }
.login-switch { background: none; border: none; color: var(--text-subtle); font-size: 0.8rem; font-family: inherit; cursor: pointer; margin-top: 14px; padding: 4px 8px; border-radius: var(--radius-sm); transition: color var(--spring-fast); }
.login-switch:hover { color: var(--text); }
.pin-error { font-size: 0.75rem; color: var(--red); margin: -6px 0 0; text-align: center; min-height: 14px; }
.shake { animation: shake 500ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); } 30%, 50%, 70% { transform: translateX(-4px); } 40%, 60% { transform: translateX(4px); } }

/* ── Importación ───────────────────────────────────────────────────────── */
.bulk-dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 36px 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; cursor: pointer; transition: border-color var(--spring-fast), background var(--spring-fast); }
.bulk-dropzone:hover, .bulk-dropzone--active { border-color: var(--blue); background: var(--blue-dim); }
.bulk-dropzone-icon { font-size: 1.6rem; line-height: 1; color: var(--text-muted); }
.bulk-dropzone--active .bulk-dropzone-icon { color: var(--blue); }
.bulk-dropzone-text { font-size: 0.88rem; font-weight: 500; color: var(--text); }
.bulk-dropzone-hint { font-size: 0.75rem; color: var(--text-muted); }
.bulk-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 4px; }
.bulk-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.bulk-table th { text-align: left; font-size: 0.7rem; font-weight: 600; color: var(--text-subtle); padding: 7px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.bulk-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.bulk-row:last-child td { border-bottom: none; }
.bulk-row--error td:not(:first-child):not(:last-child) { opacity: 0.4; }
.bulk-input { background: var(--surface-hover); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 0.8rem; padding: 5px 8px; width: 100%; min-width: 0; font-family: inherit; outline: none; }
.bulk-input.ai-shimmer { color: transparent; background: linear-gradient(90deg, var(--surface-hover) 0%, var(--control-fill-hover) 50%, var(--surface-hover) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.bulk-badge { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; font-size: 0.7rem; font-weight: 700; }
.bulk-badge--ok { background: var(--green-dim); color: var(--green); }
.bulk-badge--err { background: var(--red-dim); color: var(--red); }
.bulk-spinner { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--border-strong); border-top-color: var(--brand); animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bulk-error-msg { font-size: 0.72rem; color: var(--red); white-space: nowrap; }
.bulk-filename { font-size: 0.78rem; color: var(--text-muted); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.bulk-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.ai-dots { display: inline-flex; gap: 3px; align-items: center; }
.ai-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--text-muted); animation: breathe 1.2s ease-in-out infinite; }
.ai-dots i:nth-child(2) { animation-delay: 0.2s; } .ai-dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes breathe { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* ── Recursos ──────────────────────────────────────────────────────────── */
.res-quickadd { display: flex; align-items: center; gap: 10px; padding: 9px 14px; margin-bottom: 14px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); color: var(--text-subtle); transition: border-color var(--spring-fast); }
.res-quickadd:focus-within { border-color: var(--brand); border-style: solid; }
.res-quickadd svg { width: 14px; height: 14px; flex-shrink: 0; }
.res-quickadd input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 0.84rem; font-family: inherit; min-width: 0; }
.res-quickadd input::placeholder { color: var(--text-subtle); }
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.res-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 13px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 7px; transition: border-color var(--spring-fast), transform var(--spring-fast); animation: rise var(--spring-slow) both; }
.res-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.res-thumb { aspect-ratio: 2 / 1; margin: -13px -14px 3px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: var(--surface-hover); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: center; }
.res-card-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.res-card-name { flex: 1; font-size: 0.86rem; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-favicon { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: var(--radius-sm); background: var(--surface-hover); color: var(--text-muted); font-size: 0.66rem; font-weight: 700; flex-shrink: 0; }
.res-favicon--big { width: 26px; height: 26px; font-size: 0.8rem; opacity: 0.85; }
.res-domain { font-size: 0.72rem; color: var(--text-subtle); }
.res-star-btn { background: none; border: none; padding: 2px; cursor: pointer; color: var(--text-subtle); opacity: 0; transition: opacity var(--spring-fast), color var(--spring-fast); display: inline-flex; }
.res-star-btn svg { width: 13px; height: 13px; }
.res-card:hover .res-star-btn { opacity: 1; }
.res-star-btn:hover { color: var(--yellow); }
.res-star-btn--on { opacity: 1; color: var(--yellow); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Modal de exportar ─────────────────────────────────────────────────── */
.a-modal { background: var(--surface); border-radius: var(--radius-lg); padding: 24px 28px; max-width: 420px; margin: 0 auto; }
.a-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.a-modal-title { margin: 0; font-size: 1.1rem; font-weight: 600; letter-spacing: -0.02em; }
.a-modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; padding: 4px 8px; font-family: inherit; }
.a-modal-fields { display: flex; flex-direction: column; gap: 14px; }
.a-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.a-modal-out { margin-top: 14px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--control-fill); font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }
.a-modal-out b { color: var(--text); font-weight: 600; display: block; }

/* ── Panel lateral ─────────────────────────────────────────────────────── */
.panel-stage { position: relative; height: 300px; border-radius: var(--radius); background: var(--bg); overflow: hidden; border: 1px solid var(--border); }
.panel-stage .pg { position: absolute; inset: 0; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.panel-stage .pg .mk { height: 28px; border-radius: var(--radius); background: var(--surface); }
.panel-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity var(--spring-moderate-exit); pointer-events: none; }
.panel-scrim.open { opacity: 1; transition: opacity var(--spring-moderate); pointer-events: auto; }
.panel { position: absolute; top: 0; right: 0; bottom: 0; width: 66%; background: var(--surface); border-left: 1px solid var(--border); padding: 20px; transform: translateX(100%); transition: transform var(--spring-slow-exit); display: flex; flex-direction: column; gap: 12px; }
.panel.open { transform: none; transition: transform var(--spring-slow); }
.panel h4 { margin: 0 0 4px; font-size: 1.1rem; font-weight: 600; letter-spacing: -0.02em; display: flex; justify-content: space-between; align-items: center; }
.panel .mk { height: 30px; border-radius: var(--radius-sm); background: var(--control-fill); }
.panel .mk-label { height: 10px; width: 40%; border-radius: 3px; background: var(--control-fill); margin-bottom: 4px; }
.panel .foot { margin-top: auto; display: flex; justify-content: flex-end; gap: 8px; }

/* ── Selector de cliente ───────────────────────────────────────────────── */
.client-dd { margin-top: 4px; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); position: relative; }
.client-opt { position: relative; z-index: 1; height: 30px; display: flex; align-items: center; padding: 0 10px; border-radius: var(--radius-sm); font-size: 0.82rem; cursor: default; }
.client-opt.create { color: var(--brand); }
.client-empty { padding: 8px 10px; font-size: 0.75rem; color: var(--text-subtle); }
.client-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--radius-sm); background: var(--brand-dim); color: var(--brand); font-size: 0.8rem; font-weight: 500; }
.client-chip button { background: none; border: none; color: inherit; opacity: 0.6; cursor: pointer; font-family: inherit; padding: 0; }

/* ── Tipo de gasto ─────────────────────────────────────────────────────── */
.type-row { display: flex; gap: 6px; }

/* ── Apariencia ────────────────────────────────────────────────────────── */
.accent-swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.accent-swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: transform var(--spring-fast), border-color var(--spring-fast); padding: 0; }
.accent-swatch:hover { transform: scale(1.1); }
.accent-swatch.on { border-color: var(--text); }

/* ── Ventana de Mac (metáfora, no calco) ───────────────────────────────── */
.mac-stage { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.mac-window { width: 100%; max-width: 440px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--bg); overflow: hidden; transform-origin: 50% 100%; transition: transform var(--spring-slow), opacity var(--spring-slow); }
.mac-window.hidden-win { transform: scale(0.6) translateY(80px); opacity: 0; transition: transform var(--spring-slow-exit), opacity var(--spring-slow-exit); }
.mac-bar { height: 28px; display: flex; align-items: center; gap: 6px; padding: 0 10px; cursor: grab; }
.mac-bar i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.mac-bar i.r { background: #ff5f57; cursor: pointer; } .mac-bar i.y { background: #febc2e; } .mac-bar i.g { background: #28c840; }
.mac-bar i.r:hover { filter: brightness(0.9); }
.mac-content { display: grid; grid-template-columns: 96px 1fr; height: 190px; }
.mac-side { padding: 4px 8px; display: flex; flex-direction: column; gap: 3px; }
.mac-side b { font-size: 13px; letter-spacing: -0.03em; padding: 0 6px; margin: 2px 0 8px; }
.mac-side span { height: 17px; border-radius: 4px; font-size: 8px; padding: 0 6px; display: flex; align-items: center; color: var(--text-muted); }
.mac-side span.on { background: var(--control-fill-hover); color: var(--text); font-weight: 600; }
.mac-main { padding: 18px 14px 10px; display: flex; flex-direction: column; gap: 8px; }
.mac-main .mk { height: 36px; border-radius: 5px; background: var(--surface); }
.mac-main .mrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mac-offline { display: flex; flex-direction: column; align-items: center; justify-content: center; grid-column: 1 / -1; gap: 6px; font-size: var(--fs-caption); color: var(--text-muted); }
.mac-offline b { color: var(--text); font-size: var(--text-ui); }
.mac-offline .mark { width: 12px; height: 12px; background: var(--brand); transform: rotate(45deg); border-radius: 2px; margin-bottom: 10px; }
.mac-dock { display: flex; align-items: flex-end; gap: 8px; padding: 6px 10px; border-radius: 14px; background: var(--control-fill); border: 1px solid var(--border); }
.mac-dock .dk { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-hover); transition: transform var(--spring-fast); }
.mac-dock .dk.fyal { background: #000; display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; }
.mac-dock .dk.fyal::after { content: ""; width: 14px; height: 14px; background: #00FFAB; transform: rotate(45deg); border-radius: 1px; }
.mac-dock .dk.fyal.running::before { content: ""; position: absolute; bottom: -6px; left: 50%; width: 4px; height: 4px; border-radius: 50%; background: var(--text-muted); transform: translateX(-50%); }
.mac-dock .dk.fyal:hover { transform: translateY(-4px) scale(1.06); }
.mac-dock .dk.bounce { animation: dockbounce 500ms var(--spring-slow) 2; }
@keyframes dockbounce { 0%, 100% { transform: none; } 50% { transform: translateY(-14px); } }
.a-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.8rem; -webkit-user-select: none; user-select: none; }
.a-toggle .track { width: 34px; height: 20px; border-radius: 10px; background: var(--control-fill-hover); position: relative; transition: background var(--spring-fast); }
.a-toggle .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform var(--spring-moderate); }
.a-toggle.on .track { background: var(--brand); }
.a-toggle.on .track::after { transform: translateX(14px); }

/* ── Atajos en vivo ────────────────────────────────────────────────────── */
.shortcut.is-live { background: var(--brand-dim); }

/* ── Fluid hover (comparación) ─────────────────────────────────────────── */
.hover-list { display: flex; flex-direction: column; gap: 2px; padding: 4px; border-radius: var(--radius); background: var(--surface); position: relative; }
.hover-item { position: relative; z-index: 1; height: 32px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: var(--radius-sm); font-size: 0.83rem; color: var(--text-muted); transition: background var(--spring-fast), color var(--spring-fast); }
.hover-item.active { color: var(--text); font-weight: 600; background: var(--control-fill-hover); }
.hover-item.classic:hover { background: var(--surface-hover); color: var(--text); }
.hover-item svg { width: 14px; height: 14px; opacity: 0.6; }

/* Cuadro de amortización */
.amort-summary { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface); font-size: 0.8rem; color: var(--text-muted); margin: 14px 0 10px; }
.amort-summary b { color: var(--text); font-size: 1rem; font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .a-grid--2, .a-grid--3 { grid-template-columns: 1fr; }
  .a-kpi-grid { grid-template-columns: 1fr; }
  .kanban-board { grid-template-columns: 1fr 1fr; }
  .irpf-quarters { grid-template-columns: 1fr 1fr; }
  .provision-grid { grid-template-columns: 1fr; }
  .mac-content { grid-template-columns: 76px 1fr; }
}
@media (max-width: 480px) {
  .kanban-board { grid-template-columns: 1fr; }
}
