/* El Pilar del Comerciante — módulo de finanzas, administración y publicidad */

.pl-root {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pl-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(135deg, #1e3a8a, #2563eb 60%, #3b82f6);
  color: #fff;
  border-radius: var(--pos-radius);
  padding: 1.1rem 1.4rem;
  box-shadow: var(--pos-shadow);
}

.pl-header h2 {
  margin: 0;
  font-size: 1.35rem;
  color: #fff;
}

.pl-header p {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  opacity: 0.9;
}

.pl-header .btn-outline {
  border-color: rgba(255, 255, 255, 0.6);
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  white-space: nowrap;
}

.pl-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pl-tab {
  border: 1px solid var(--pos-border);
  background: var(--pos-card);
  color: var(--pos-text);
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}

.pl-tab:hover {
  border-color: var(--pos-primary);
}

.pl-tab.active {
  background: var(--pos-primary);
  border-color: var(--pos-primary);
  color: #fff;
}

.pl-view {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Semáforo ── */
.pl-light {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

.pl-light i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.6);
}

.pl-light--green { background: #dcfce7; color: #166534; }
.pl-light--green i { background: #16a34a; }
.pl-light--yellow { background: #fef3c7; color: #92400e; }
.pl-light--yellow i { background: #f59e0b; }
.pl-light--red { background: #fee2e2; color: #991b1b; }
.pl-light--red i { background: #dc2626; }
.pl-light--gray { background: #f1f5f9; color: #475569; }
.pl-light--gray i { background: #94a3b8; }

.pl-green { color: #15803d; }
.pl-yellow { color: #b45309; }
.pl-red { color: #b91c1c; }
.pl-gray { color: var(--pos-muted); }

.pl-trend {
  font-size: 0.72rem;
  font-weight: 600;
}

.pl-trend--up { color: #15803d; }
.pl-trend--down { color: #b91c1c; }
.pl-trend--flat { color: var(--pos-muted); }

/* ── Dashboard ── */
.pl-sections {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.pl-section {
  position: relative;
  text-align: left;
  background: var(--pos-card);
  border: 1px solid var(--pos-border);
  border-radius: var(--pos-radius);
  padding: 1.1rem 1.2rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  box-shadow: var(--pos-shadow);
  transition: transform 0.15s, border-color 0.15s;
}

.pl-section:hover {
  transform: translateY(-2px);
  border-color: var(--pos-primary);
}

.pl-section-icon { font-size: 1.6rem; }
.pl-section h3 { margin: 0; font-size: 1rem; }
.pl-section p { margin: 0; color: var(--pos-muted); font-size: 0.8rem; }
.pl-section strong { font-size: 1.6rem; letter-spacing: -0.02em; }
.pl-section-more {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--pos-primary);
}

.pl-summary,
.pl-tip {
  background: var(--pos-card);
  border: 1px solid var(--pos-border);
  border-radius: var(--pos-radius);
  padding: 1.1rem 1.3rem;
  box-shadow: var(--pos-shadow);
}

.pl-summary h3,
.pl-tip h3 {
  margin: 0 0 0.8rem;
  font-size: 1rem;
}

.pl-summary h3 small {
  color: var(--pos-muted);
  font-weight: 500;
  font-size: 0.8rem;
  margin-left: 0.4rem;
}

.pl-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.pl-summary-grid > div {
  background: #f8fafc;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.pl-summary-grid span { font-size: 0.72rem; color: var(--pos-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.pl-summary-grid strong { font-size: 1.15rem; }
.pl-summary-grid small { color: var(--pos-muted); font-size: 0.75rem; }
.pl-summary-grid .pl-light { align-self: flex-start; }

.pl-tip {
  border-left: 4px solid #f59e0b;
  background: #fffbeb;
}

.pl-tip p {
  margin: 0 0 0.8rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ── Tarjetas ── */
.pl-card {
  background: var(--pos-card);
  border: 1px solid var(--pos-border);
  border-radius: var(--pos-radius);
  padding: 1.1rem 1.3rem;
  box-shadow: var(--pos-shadow);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.pl-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.pl-card-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pl-card-title h3 {
  margin: 0;
  font-size: 1.02rem;
}

.pl-card-icon { font-size: 1.3rem; }

.pl-card-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pl-toggle {
  border: none;
  background: transparent;
  color: var(--pos-primary);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}

.pl-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7rem;
}

.pl-kpi {
  background: #f8fafc;
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.pl-kpi-label { font-size: 0.7rem; color: var(--pos-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.pl-kpi-value { font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-kpi-sub { font-size: 0.72rem; color: var(--pos-muted); }

.pl-formula {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  flex-wrap: wrap;
}

.pl-formula span {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--pos-muted);
}

.pl-formula code {
  background: #eff6ff;
  color: #1e40af;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.pl-card-body {
  display: none;
  flex-direction: column;
  gap: 0.8rem;
  border-top: 1px dashed var(--pos-border);
  padding-top: 0.8rem;
}

.pl-card.expanded .pl-card-body { display: flex; }

.pl-card-body h4 {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--pos-text);
}

.pl-advice {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
}

.pl-advice-icon { font-size: 1.05rem; }
.pl-advice p { margin: 0; font-size: 0.88rem; line-height: 1.45; }

.pl-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Tablas y listas ── */
.pl-table-wrap {
  overflow: auto;
  max-height: 420px;
  border: 1px solid var(--pos-border);
  border-radius: 10px;
}

.pl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.pl-table th,
.pl-table td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--pos-border);
  text-align: left;
  vertical-align: middle;
}

.pl-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pos-muted);
}

.pl-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pl-table td small { display: block; color: var(--pos-muted); font-size: 0.7rem; }
.pl-table tr.pl-row--red td { background: #fef2f2; }
.pl-table tr.pl-row--yellow td { background: #fffbeb; }
.pl-table tr.pl-row--green td { background: #f0fdf4; }

.pl-empty {
  margin: 0;
  color: var(--pos-muted);
  font-size: 0.85rem;
  font-style: italic;
}

.pl-help {
  margin: 0;
  color: var(--pos-muted);
  font-size: 0.8rem;
}

.pl-list {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.85rem;
  line-height: 1.6;
}

.pl-list small { color: var(--pos-muted); }

.pl-link {
  border: none;
  background: none;
  color: var(--pos-primary);
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0.15rem 0.3rem;
}

.pl-link.danger { color: var(--pos-danger); }

/* ── Formularios ── */
.pl-inline-form,
.pl-expense-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.7rem;
  align-items: end;
}

.pl-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pl-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.pl-inline-form .pl-help { grid-column: 1 / -1; }

.pl-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--pos-muted);
}

.pl-input {
  width: 100%;
  border: 1px solid var(--pos-border);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font: inherit;
  font-size: 0.88rem;
  color: var(--pos-text);
  background: #fff;
}

.pl-input:focus {
  outline: 2px solid var(--pos-accent-soft, rgba(37, 99, 235, 0.2));
  border-color: var(--pos-primary);
}

.pl-range { width: 100%; accent-color: var(--pos-primary); }

.pl-progress {
  position: relative;
  height: 22px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.pl-progress-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s;
}

.pl-progress--green { background: #16a34a; }
.pl-progress--yellow { background: #f59e0b; }
.pl-progress--red { background: #dc2626; }
.pl-progress--gray { background: #94a3b8; }

.pl-progress span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #0f172a;
}

/* ── Calculadora ── */
.pl-calc {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1rem;
}

.pl-calc-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.pl-calc-result {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: flex-start;
  justify-content: center;
}

.pl-calc-result span { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; color: #1e40af; }
.pl-calc-result strong { font-size: 2rem; color: #1e3a8a; letter-spacing: -0.02em; }
.pl-calc-result small { color: var(--pos-muted); font-size: 0.78rem; margin-bottom: 0.5rem; }

/* ── Checklists y procesos ── */
.pl-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.pl-checklist label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #f8fafc;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.pl-checklist input { width: 18px; height: 18px; accent-color: var(--pos-primary); }
.pl-checklist input:checked + span { text-decoration: line-through; color: var(--pos-muted); }

.pl-rankings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.pl-ranking {
  background: #f8fafc;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
}

.pl-ranking h4 { margin: 0 0 0.4rem; font-size: 0.8rem; }
.pl-ranking ol { margin: 0; padding-left: 1.2rem; font-size: 0.82rem; }
.pl-ranking li { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.15rem 0; }
.pl-ranking li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pl-procesos { display: flex; flex-direction: column; gap: 0.6rem; }

.pl-proceso {
  background: #f8fafc;
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pl-proceso-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
}

.pl-proceso-head strong { flex: 1; min-width: 140px; }
.pl-proceso-head label { display: flex; align-items: center; gap: 0.35rem; cursor: pointer; }
.pl-proceso-text.hidden { display: none; }

.pl-post-preview {
  background: #f0f9ff;
  border: 1px dashed #7dd3fc;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ── Toast y consejo del día ── */
.pl-toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 20px);
  background: #0f172a;
  color: #fff;
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  opacity: 0;
  transition: all 0.25s;
  z-index: 3000;
  max-width: 90vw;
}

.pl-toast.show { opacity: 1; transform: translate(-50%, 0); }
.pl-toast--error { background: #b91c1c; }

.pl-daily-tip {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 360px;
  max-width: calc(100vw - 2.5rem);
  background: #fff;
  border-radius: 14px;
  border-left: 5px solid #f59e0b;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
  padding: 0.9rem 1rem 1rem;
  z-index: 2900;
  opacity: 0;
  transform: translateY(16px);
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.pl-daily-tip.show { opacity: 1; transform: translateY(0); }
.pl-daily-tip--red { border-left-color: #dc2626; }
.pl-daily-tip--green { border-left-color: #16a34a; }

.pl-daily-tip-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pos-muted);
}

.pl-daily-close {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--pos-muted);
  font-size: 0.9rem;
}

.pl-daily-tip p { margin: 0; font-size: 0.9rem; line-height: 1.45; }

/* ── Guía de consejos ── */
.pl-guide-banner {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  text-align: left;
  background: linear-gradient(135deg, #eff6ff, #fff);
  border: 1px solid rgba(37, 99, 235, 0.35);
  border-radius: var(--pos-radius);
  padding: 1rem 1.2rem;
  cursor: pointer;
  color: inherit;
}

.pl-guide-banner div { flex: 1; }
.pl-guide-banner strong { display: block; font-size: 1rem; }
.pl-guide-banner p { margin: 0.15rem 0 0; color: var(--pos-muted); font-size: 0.85rem; }

.pl-guide-intro,
.pl-guide-block,
.pl-guide {
  background: var(--pos-card);
  border: 1px solid var(--pos-border);
  border-radius: var(--pos-radius);
  padding: 1rem 1.2rem;
  box-shadow: var(--pos-shadow);
}

.pl-guide-intro h3,
.pl-guide-block h3 { margin: 0 0 0.4rem; font-size: 1rem; }
.pl-guide-intro p { margin: 0; line-height: 1.5; }
.pl-guide-block h3 small { color: var(--pos-muted); font-weight: 600; margin-left: 0.35rem; }

.pl-guide { padding: 0; }
.pl-guide summary {
  list-style: none;
  cursor: pointer;
  padding: 0.9rem 1.2rem;
  font-weight: 700;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.pl-guide summary::-webkit-details-marker { display: none; }
.pl-guide summary::after { content: '▾'; margin-left: auto; color: var(--pos-muted); font-weight: 500; }
.pl-guide[open] summary::after { content: '▴'; }
.pl-guide-lead { margin: 0 1.2rem 0.6rem; color: var(--pos-muted); }
.pl-guide h4 { margin: 0.8rem 1.2rem 0.3rem; font-size: 0.92rem; }

.pl-guide-list { list-style: none; margin: 0; padding: 0 1.2rem 1rem; display: flex; flex-direction: column; gap: 0.7rem; }
.pl-guide-list li {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--pos-border);
}
.pl-guide-list li:last-child { border-bottom: none; padding-bottom: 0; }
.pl-guide-list p { margin: 0; line-height: 1.45; flex: 1; }
.pl-guide-list .btn { flex: none; white-space: nowrap; }
.pl-guide-list--plain li { border-bottom: none; padding-bottom: 0; }

.pl-plan { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
.pl-plan-week h4 { margin: 0 0 0.35rem; font-size: 0.85rem; }
.pl-check { display: flex; gap: 0.45rem; align-items: flex-start; margin: 0.25rem 0; font-size: 0.9rem; line-height: 1.35; }
.pl-check input { margin-top: 0.2rem; }

.pl-indicators { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; }
.pl-indicator {
  text-align: left;
  background: #f8fafc;
  border: 1px solid var(--pos-border);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  color: inherit;
}
.pl-indicator span { font-size: 0.72rem; color: var(--pos-muted); text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600; }
.pl-indicator strong { font-size: 1.05rem; }
.pl-indicator small { color: var(--pos-muted); }
.pl-indicator:hover { border-color: var(--pos-primary); }

/* ── Responsive ── */
@media (max-width: 900px) {
  .pl-sections,
  .pl-summary-grid,
  .pl-rankings,
  .pl-checklist,
  .pl-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pl-calc { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .pl-sections,
  .pl-summary-grid,
  .pl-rankings,
  .pl-checklist,
  .pl-grid-2,
  .pl-grid-4,
  .pl-plan,
  .pl-indicators { grid-template-columns: 1fr; }
  .pl-guide-list li { flex-direction: column; }
  .pl-guide-banner { flex-direction: column; align-items: flex-start; }
  .pl-header { flex-direction: column; }
  .pl-card { padding: 0.9rem; }
}
