:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-strong: #f0f4ef;
  --ink: #17211c;
  --muted: #637067;
  --line: #dce3db;
  --green: #227a54;
  --green-dark: #155d3f;
  --blue: #276a9f;
  --amber: #b76a16;
  --red: #b0443e;
  --shadow: 0 18px 45px rgba(23, 33, 28, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px 1fr;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.locked {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #17211c;
}

.login-screen.hidden {
  display: none;
}

.login-card {
  width: min(430px, 100%);
  padding: 26px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .28);
}

.login-card h1 {
  margin: 14px 0 6px;
  font-size: 34px;
}

.login-card p {
  color: var(--muted);
}

#login-error {
  min-height: 18px;
  color: var(--red);
  font-weight: 800;
}

.demo-access {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
}

.demo-access strong {
  color: var(--ink);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: #17211c;
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #7ccfa2;
  color: #102019;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.sidebar-card small {
  color: rgba(255, 255, 255, .68);
}

nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, .72);
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, .1);
  color: #fff;
  border-color: rgba(255, 255, 255, .12);
}

.sidebar-card {
  margin-top: auto;
  padding: 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .1);
}

.session-box {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  background: rgba(255, 255, 255, .07);
}

.session-box span {
  color: rgba(255, 255, 255, .68);
  font-size: 12px;
  text-transform: uppercase;
}

.session-box strong {
  color: #fff;
}

.ghost-button {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 7px;
  background: transparent;
  color: #fff;
  font-weight: 800;
}

.sidebar-card span,
.sidebar-card strong {
  display: block;
}

.sidebar-card strong {
  margin: 4px 0 12px;
  font-size: 26px;
}

.meter {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, .16);
}

.meter span {
  display: block;
  height: 100%;
  background: #7ccfa2;
}

main {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.actions {
  display: flex;
  align-items: end;
  gap: 12px;
}

.search {
  position: relative;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 12;
  width: min(520px, 90vw);
  max-height: 360px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 22px 55px rgba(21, 32, 39, .18);
}

.search-suggestions button {
  width: 100%;
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.search-suggestions button:hover,
.search-suggestions button:focus-visible {
  background: #f2fbf7;
  outline: 0;
}

.search-suggestions span {
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.search-suggestions strong {
  font-size: 14px;
}

.search-suggestions small {
  color: var(--muted);
  font-size: 12px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 58px;
  padding-top: 9px;
  resize: vertical;
}

.search input {
  width: min(34vw, 340px);
}

.primary,
.text-button,
.danger-button,
.icon-button {
  min-height: 42px;
  border-radius: 8px;
  border: 0;
}

.primary {
  padding: 0 16px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
}

.primary:hover {
  background: var(--green-dark);
}

.primary.small {
  min-height: 36px;
}

.text-button {
  padding: 0 10px;
  background: transparent;
  color: var(--green);
  font-weight: 800;
}

.danger-button {
  padding: 0 10px;
  background: #fff1f0;
  color: var(--red);
  border: 1px solid #f0c7c4;
  font-weight: 800;
}

.icon-button {
  width: 38px;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.admin-hidden {
  display: none !important;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 360px;
}

.row-actions .primary,
.row-actions .danger-button {
  min-height: 40px;
  white-space: nowrap;
  padding: 0 14px;
  font-size: 13px;
  flex: 1;
}

#contacts-table td:last-child,
#contacts thead th:last-child {
  min-width: 380px;
}

.total-row {
  background: #f0fbf7;
}

.total-row td {
  border-top: 2px solid rgba(0, 167, 127, .28);
  color: #0f513f;
  font-weight: 900;
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.task-actions .primary,
.task-actions .danger-button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.locked-panel {
  display: grid;
  gap: 10px;
  max-width: 440px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafb;
}

.locked-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

.access-form {
  padding: 0;
}

#profit-error {
  min-height: 18px;
  color: var(--red);
  font-weight: 800;
}

.ghost-light-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #fff, #f4f7f8);
  color: var(--ink);
  font-weight: 900;
  box-shadow: var(--shadow-soft);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.ghost-light-button:hover {
  border-color: rgba(16, 163, 127, .45);
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(21, 32, 39, .12);
}

#rvargasProfit .panel-head {
  align-items: end;
}

#rvargasProfit .month-picker select {
  min-width: 210px;
  background: #fff;
  font-weight: 800;
}

#rvargasProfit .monthly-summary .stat:nth-child(2)::before {
  background: var(--blue);
}

#rvargasProfit .monthly-summary .stat:nth-child(3)::before {
  background: var(--green);
}

#profit-content .table-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

#profit-table td:nth-child(4),
#profit-table td:nth-child(5),
#profit-table td:nth-child(6) {
  font-weight: 900;
}

@media (max-width: 900px) {
  .row-actions {
    min-width: 190px;
    flex-direction: column;
    align-items: stretch;
  }

  #contacts-table td:last-child,
  #contacts thead th:last-child {
    min-width: 210px;
  }
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.quick-actions button {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  box-shadow: var(--shadow-soft);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.quick-actions button:hover {
  border-color: rgba(16, 163, 127, .45);
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(21, 32, 39, .12);
}

.month-picker {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.monthly-summary {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.filters-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.import-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
}

.import-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat,
.panel,
.deal-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat {
  padding: 18px;
}

.stat span,
.stat small {
  color: var(--muted);
}

.stat span {
  display: block;
  font-weight: 700;
}

.stat strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 30px;
}

.layout-two,
.task-board {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 18px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-head,
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

td select {
  min-width: 150px;
}

td input[type="checkbox"],
th input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
}

.table-input {
  min-width: 130px;
}

.table-input[type="number"] {
  min-width: 115px;
}

.table-textarea {
  min-width: 230px;
  max-width: 320px;
}

.call-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.call-link span {
  font-weight: 800;
}

.call-link strong {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: #e9fff6;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
}

.call-link:hover strong {
  background: var(--teal);
  color: #fff;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.badge.Nuevo {
  background: var(--blue);
}

.badge.Calificado {
  background: var(--green);
}

.badge.Propuesta {
  background: var(--amber);
}

.badge.Negociacion {
  background: var(--red);
}

.activity-list,
.task-list {
  display: grid;
  gap: 10px;
}

.activity,
.task {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.task input {
  width: auto;
  min-height: auto;
  margin: 0 8px 0 0;
}

.activity strong,
.activity span,
.task strong,
.task span {
  display: block;
}

.activity span,
.task span {
  color: var(--muted);
  font-size: 13px;
}

.task small {
  display: block;
  margin-top: 6px;
  color: var(--teal);
  font-weight: 800;
}

.toolbar {
  margin-bottom: 14px;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stage-filter {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.stage-filter.active {
  background: var(--ink);
  color: #fff;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.stage-column {
  min-height: 520px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
}

.stage-column h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
  text-transform: uppercase;
}

.stage-column h2 span {
  color: var(--ink);
}

.deal-card {
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: none;
}

.deal-card strong,
.deal-card span,
.deal-card small {
  display: block;
}

.deal-card strong {
  margin-bottom: 4px;
}

.deal-card span,
.deal-card small {
  color: var(--muted);
}

.deal-card .value {
  margin-top: 10px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
}

.deal-card .owner {
  margin-top: 6px;
  color: var(--blue);
  font-weight: 800;
}

.deal-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.deal-actions button {
  flex: 1;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--ink);
  font-weight: 800;
}

.deal-delete {
  width: 100%;
  min-height: 34px;
  margin-top: 8px;
}

.accent-panel {
  background: #e9f1ea;
}

.accent-panel p {
  color: var(--muted);
}

.script-box {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 8px;
  background: #fff;
}

dialog {
  width: min(460px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .24);
}

dialog.wide-dialog {
  width: min(820px, calc(100vw - 28px));
}

dialog::backdrop {
  background: rgba(23, 33, 28, .45);
}

form {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.warning-copy {
  margin: 0;
  padding: 14px;
  border: 1px solid #f0c7c4;
  border-radius: 10px;
  background: #fff1f0;
  color: var(--red);
  font-weight: 800;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.inline-form {
  padding: 14px 0 0;
}

.inline-form label {
  color: var(--muted);
}

form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

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

  .nav-item {
    text-align: center;
  }

  .sidebar-card {
    display: none;
  }

  .topbar,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .search input {
    width: 100%;
  }

  .stats-grid,
  .filters-grid,
  .quick-actions,
  .form-grid,
  .layout-two,
  .task-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  main {
    padding: 16px;
  }

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

  .stats-grid {
    gap: 10px;
  }

  .kanban {
    grid-template-columns: repeat(4, 82vw);
  }
}

/* RVargas Supply visual refresh */
:root {
  --bg: #eef2f5;
  --surface-strong: #f6f8fa;
  --ink: #152027;
  --muted: #65737d;
  --line: #d8e0e6;
  --green: #16845b;
  --green-dark: #106745;
  --blue: #246b93;
  --amber: #b06b17;
  --red: #b5443e;
  --nav: #111b22;
  --nav-soft: #1b2a33;
  --teal: #10a37f;
  --shadow: 0 18px 55px rgba(21, 32, 39, .10);
  --shadow-soft: 0 8px 22px rgba(21, 32, 39, .08);
}

body {
  background:
    linear-gradient(135deg, rgba(16, 163, 127, .10), transparent 32%),
    linear-gradient(315deg, rgba(36, 107, 147, .12), transparent 30%),
    var(--bg);
}

.login-screen {
  background:
    linear-gradient(135deg, rgba(16, 163, 127, .18), transparent 34%),
    var(--nav);
}

.login-card,
.topbar,
.panel,
.stat,
.deal-card,
.stage-column {
  border-radius: 14px;
}

.login-card {
  box-shadow: 0 30px 90px rgba(0, 0, 0, .30);
}

.login-card h1 {
  font-size: 32px;
  line-height: 1.08;
}

.sidebar {
  background: linear-gradient(180deg, var(--nav), var(--nav-soft));
  box-shadow: 8px 0 26px rgba(17, 27, 34, .18);
}

.brand-mark {
  border-radius: 10px;
  background: #e8fff5;
  color: var(--green-dark);
  box-shadow: inset 0 0 0 1px rgba(16, 163, 127, .18);
}

.nav-item,
.sidebar-card,
.session-box,
.ghost-button,
input,
select,
textarea,
.primary,
.text-button,
.danger-button,
.icon-button,
.import-button,
.filters-grid,
.activity,
.task,
.segmented,
.script-box {
  border-radius: 10px;
}

.nav-item,
.primary,
.danger-button,
.text-button,
.deal-card,
.stat {
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, .12);
  transform: translateX(2px);
}

.meter span {
  background: linear-gradient(90deg, var(--teal), #9be7c8);
  animation: meterSlide .7s ease-out;
}

main {
  padding: 30px;
}

.topbar {
  padding: 18px;
  border: 1px solid rgba(216, 224, 230, .86);
  background: rgba(255, 255, 255, .80);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.eyebrow,
.text-button {
  color: var(--teal);
}

.app-title {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(16, 163, 127, .70);
  box-shadow: 0 0 0 4px rgba(16, 163, 127, .12);
  outline: 0;
}

.primary {
  background: linear-gradient(135deg, var(--green), var(--teal));
  box-shadow: 0 10px 20px rgba(16, 132, 91, .18);
}

.primary:hover,
.danger-button:hover,
.text-button:hover {
  transform: translateY(-1px);
}

.filters-grid,
th {
  background: #f8fafb;
}

.stat,
.panel {
  border-color: var(--line);
}

.stat {
  position: relative;
  overflow: hidden;
}

.stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--teal);
}

.stat:hover,
.deal-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 48px rgba(21, 32, 39, .13);
}

.stat-link {
  cursor: pointer;
}

.stat-link::after {
  content: "Abrir";
  position: absolute;
  right: 14px;
  top: 14px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .16s ease, transform .16s ease;
}

.stat-link:hover::after,
.stat-link:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.stat-link:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 4px rgba(16, 163, 127, .16), var(--shadow);
}

.stat strong {
  font-size: 28px;
}

.panel {
  padding: 20px;
}

table {
  font-size: 14px;
}

th,
td {
  border-bottom-color: #edf1f3;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr {
  transition: background .14s ease;
}

tbody tr:hover {
  background: #fbfdfc;
}

.kanban {
  gap: 16px;
}

.stage-column {
  padding: 14px;
  background: rgba(255, 255, 255, .78);
  box-shadow: var(--shadow-soft);
}

.stage-filter.active {
  background: linear-gradient(135deg, var(--nav), #27414d);
}

.deal-card {
  margin-bottom: 12px;
  border-left: 4px solid var(--teal);
}

dialog {
  border-radius: 14px;
}

@keyframes meterSlide {
  from {
    width: 0;
  }
}

/* Premium executive theme */
:root {
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-strong: #f7f9fb;
  --ink: #111827;
  --muted: #687782;
  --line: #dfe6ec;
  --green: #0f8a63;
  --green-dark: #0b684b;
  --blue: #256c9a;
  --amber: #ad6b18;
  --red: #b93f3a;
  --nav: #0b1220;
  --nav-soft: #132236;
  --teal: #00a77f;
  --gold: #d9a441;
  --shadow: 0 24px 70px rgba(15, 23, 42, .10);
  --shadow-soft: 0 12px 34px rgba(15, 23, 42, .08);
}

body {
  background:
    radial-gradient(circle at 18% 0%, rgba(0, 167, 127, .14), transparent 30%),
    radial-gradient(circle at 92% 10%, rgba(217, 164, 65, .12), transparent 26%),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 46%, #edf3f6 100%);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .05), transparent 28%),
    linear-gradient(180deg, var(--nav), var(--nav-soft));
  border-right: 1px solid rgba(255, 255, 255, .08);
}

.brand {
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .10);
}

.brand-mark {
  background: linear-gradient(135deg, #eafff8, #c9f7e8);
  color: #073d31;
  font-size: 15px;
  letter-spacing: 0;
  box-shadow: 0 12px 30px rgba(0, 167, 127, .18), inset 0 0 0 1px rgba(255, 255, 255, .8);
}

.brand strong {
  letter-spacing: .2px;
}

.nav-item {
  min-height: 46px;
  padding: 0 16px;
  color: rgba(255, 255, 255, .74);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .08));
  border-color: rgba(255, 255, 255, .18);
  box-shadow: inset 3px 0 0 var(--teal);
}

.session-box,
.sidebar-card {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .13);
}

main {
  padding: 34px;
}

.topbar {
  border: 1px solid rgba(255, 255, 255, .80);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .94), rgba(255, 255, 255, .76)),
    linear-gradient(135deg, rgba(0, 167, 127, .08), rgba(217, 164, 65, .06));
  box-shadow: 0 20px 60px rgba(15, 23, 42, .09);
}

.eyebrow {
  color: var(--teal);
  letter-spacing: .6px;
}

.app-title {
  color: #334155;
}

h1 {
  color: #0f172a;
  letter-spacing: 0;
}

.actions {
  gap: 10px;
}

input,
select,
textarea {
  border-color: #d9e2ea;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, .02);
}

.primary {
  background: linear-gradient(135deg, #087a5b, #00a77f);
  box-shadow: 0 14px 26px rgba(0, 167, 127, .20);
}

.primary:hover {
  background: linear-gradient(135deg, #07684e, #07936f);
}

.danger-button {
  background: linear-gradient(180deg, #fff6f5, #ffeceb);
}

.import-button,
.ghost-light-button {
  background: linear-gradient(180deg, #ffffff, #f6f9fb);
}

.stats-grid {
  gap: 16px;
}

.stat,
.panel,
.deal-card {
  border-color: rgba(223, 230, 236, .92);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(255, 255, 255, .94));
  box-shadow: var(--shadow-soft);
}

.stat {
  min-height: 128px;
  padding: 20px;
}

.stat::before {
  width: 5px;
  background: linear-gradient(180deg, var(--teal), #78e4c5);
}

.stat span {
  color: #5b6b76;
  font-size: 13px;
}

.stat strong {
  color: #111827;
  font-size: 30px;
  letter-spacing: 0;
}

.stat small {
  font-weight: 600;
}

.panel {
  padding: 22px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .08);
}

.panel-head {
  padding-bottom: 12px;
  border-bottom: 1px solid #edf2f5;
}

.filters-grid {
  background: linear-gradient(180deg, #fbfdfe, #f5f8fa);
}

th {
  color: #53636f;
  background: #f8fafc;
  font-size: 11px;
  letter-spacing: .4px;
}

td {
  color: #1f2937;
}

tbody tr:hover {
  background: #f6fffb;
}

.stage-column {
  background: linear-gradient(180deg, rgba(255, 255, 255, .90), rgba(248, 250, 252, .86));
}

.stage-column h2 {
  color: #64748b;
}

.deal-card {
  border-left-color: var(--teal);
}

.deal-card .value,
#profit-table td:nth-child(4),
#profit-table td:nth-child(5),
#profit-table td:nth-child(6) {
  color: #0f513f;
}

.badge.Nuevo {
  background: linear-gradient(135deg, #256c9a, #3b82b6);
}

.badge.Calificado {
  background: linear-gradient(135deg, #0f8a63, #00a77f);
}

.badge.Propuesta {
  background: linear-gradient(135deg, #ad6b18, #d9a441);
}

.badge.Negociacion {
  background: linear-gradient(135deg, #a63d38, #d35c56);
}

.search-suggestions {
  border-color: rgba(0, 167, 127, .18);
  box-shadow: 0 28px 70px rgba(15, 23, 42, .18);
}

dialog {
  border: 1px solid rgba(255, 255, 255, .72);
  box-shadow: 0 35px 110px rgba(15, 23, 42, .28);
}

dialog::backdrop {
  background: rgba(11, 18, 32, .54);
  backdrop-filter: blur(4px);
}

.locked-panel {
  background:
    linear-gradient(180deg, #fbfdfe, #f4f8fa);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .65);
}

.print-report-area {
  display: none;
}

.print-report-area.ready {
  display: block;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.print-report {
  color: #111827;
  font-family: Arial, sans-serif;
}

.print-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.print-report h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

.print-report p {
  margin: 0 0 18px;
  color: #4b5563;
}

.print-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.print-summary div {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px;
}

.print-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.print-report table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.print-report th,
.print-report td {
  border-bottom: 1px solid #e5e7eb;
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.print-report th {
  background: #f3f4f6;
}

.print-report .total {
  background: #ecfdf5;
  font-weight: 700;
}

@media print {
  body > *:not(.print-report-area) {
    display: none !important;
  }

  body {
    display: block;
    background: #fff;
  }

  .print-report-area {
    display: block;
    padding: 0;
  }

  .no-print {
    display: none !important;
  }

  .print-report {
    color: #111827;
    font-family: Arial, sans-serif;
    padding: 0;
  }

  .print-report h1 {
    margin: 0 0 4px;
    font-size: 24px;
  }

  .print-report p {
    margin: 0 0 18px;
    color: #4b5563;
  }

  .print-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 18px;
  }

  .print-summary div {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px;
  }

  .print-summary strong {
    display: block;
    margin-top: 4px;
    font-size: 20px;
  }

  .print-report table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
  }

  .print-report th,
  .print-report td {
    border-bottom: 1px solid #e5e7eb;
    padding: 8px;
    text-align: left;
    vertical-align: top;
  }

  .print-report th {
    background: #f3f4f6;
  }

  .print-report .total {
    background: #ecfdf5;
    font-weight: 700;
  }
}

@media (max-width: 980px) {
  .sidebar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    gap: 14px;
  }

  .sidebar nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .sidebar nav .nav-item {
    flex: 0 0 auto;
    min-width: 132px;
    text-align: center;
    white-space: nowrap;
  }

  .brand {
    width: fit-content;
    padding-right: 18px;
  }

  .sidebar nav {
    gap: 6px;
  }

  .session-box {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    padding: 10px 12px;
  }

  .session-box span {
    font-size: 11px;
  }

  .topbar {
    align-items: stretch;
  }

  .actions {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(130px, auto));
    align-items: end;
  }

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

.calendar-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.calendar-event {
  align-items: stretch;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(246, 249, 255, 0.95));
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(140px, 180px) 1fr auto;
  padding: 14px;
}

.calendar-date {
  background: #0f172a;
  border-radius: 8px;
  color: #fff;
  display: grid;
  gap: 6px;
  padding: 14px;
}

.calendar-date strong {
  font-size: 0.98rem;
}

.calendar-date span {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.86rem;
}

.calendar-body {
  display: grid;
  gap: 6px;
}

.calendar-body h3 {
  color: #111827;
  font-size: 1.05rem;
  margin: 0;
}

.calendar-body p {
  color: #475569;
  margin: 0;
}

.calendar-body small {
  color: #64748b;
}

.calendar-actions {
  align-content: start;
  display: grid;
  gap: 8px;
  justify-items: end;
}

.calendar-type {
  background: #e8f3ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  color: #075985;
  display: inline-flex;
  font-size: 0.76rem;
  font-weight: 800;
  justify-self: start;
  padding: 5px 9px;
  text-transform: uppercase;
}

.calendar-event.sale-gain {
  background: linear-gradient(135deg, rgba(240, 253, 244, 0.98), rgba(236, 253, 245, 0.94));
  border-color: rgba(22, 163, 74, 0.18);
}

.calendar-event.sale-gain .calendar-date {
  background: #14532d;
}

.calendar-event.sale-gain .calendar-type {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.calendar-event.payment-day {
  background: linear-gradient(135deg, rgba(255, 251, 235, 0.98), rgba(254, 243, 199, 0.92));
  border-color: rgba(217, 119, 6, 0.22);
}

.calendar-event.payment-day .calendar-date {
  background: #92400e;
}

.calendar-event.payment-day .calendar-type {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.gain-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gain-chips span {
  background: #fff;
  border: 1px solid rgba(22, 163, 74, 0.16);
  border-radius: 999px;
  color: #14532d;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 7px 10px;
}

.empty-calendar {
  grid-template-columns: 1fr;
}

.panel-subsection {
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  margin-top: 22px;
  padding-top: 18px;
}

.compact-head {
  margin-bottom: 12px;
}

@media (max-width: 760px) {
  .sidebar,
  .session-box,
  .actions,
  .stats-grid,
  .filters-grid,
  .quick-actions {
    grid-template-columns: 1fr;
  }

  .sidebar nav .nav-item {
    min-width: 148px;
  }

  .calendar-event {
    grid-template-columns: 1fr;
  }

  .calendar-actions {
    justify-items: stretch;
  }
}



/* =========================================================
   RVARGAS SUPPLY - ENTERPRISE CRM VISUAL REDESIGN
   Aplicado para ADMIN y VENDEDOR.
   Solo cambia presentación visual. No cambia lógica, Supabase,
   usuarios, tablas ni funciones del CRM.
   ========================================================= */

body.theme-enterprise-crm {
  --rv-bg: #f5f7fb;
  --rv-panel: #ffffff;
  --rv-panel-2: #f8fafc;
  --rv-text: #101827;
  --rv-muted: #667085;
  --rv-line: #e4e9f0;
  --rv-primary: #118847;
  --rv-primary-2: #21a457;
  --rv-primary-soft: #e8f8ee;
  --rv-blue: #0b4da2;
  --rv-blue-2: #063b7a;
  --rv-navy: #071a33;
  --rv-navy-2: #05244a;
  --rv-danger: #d14343;
  --rv-warning: #d98a16;
  --rv-shadow: 0 18px 45px rgba(16, 24, 40, .08);
  --rv-shadow-soft: 0 8px 22px rgba(16, 24, 40, .06);

  grid-template-columns: 274px minmax(0, 1fr) !important;
  background:
    radial-gradient(circle at 18% -10%, rgba(17, 136, 71, .11), transparent 26%),
    radial-gradient(circle at 100% 0%, rgba(11, 77, 162, .10), transparent 28%),
    var(--rv-bg) !important;
  color: var(--rv-text) !important;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

/* ---------- Login ---------- */
body.theme-enterprise-crm .login-screen {
  background:
    radial-gradient(circle at 10% 10%, rgba(33, 164, 87, .18), transparent 28%),
    radial-gradient(circle at 90% 0%, rgba(11, 77, 162, .25), transparent 24%),
    linear-gradient(135deg, #071a33 0%, #04101f 100%) !important;
}

body.theme-enterprise-crm .login-card {
  width: min(460px, 100%) !important;
  border: 1px solid rgba(255,255,255,.18) !important;
  border-radius: 24px !important;
  padding: 30px !important;
  background: rgba(255,255,255,.97) !important;
  box-shadow: 0 35px 95px rgba(0,0,0,.32) !important;
}

body.theme-enterprise-crm .login-card h1 {
  color: #071a33 !important;
  font-size: 30px !important;
  letter-spacing: -.04em !important;
}

/* ---------- Sidebar like mockup ---------- */
body.theme-enterprise-crm .sidebar {
  position: sticky !important;
  top: 0 !important;
  height: 100vh !important;
  padding: 24px 18px !important;
  gap: 22px !important;
  background:
    linear-gradient(180deg, rgba(255,255,255,.08), transparent 18%),
    linear-gradient(180deg, var(--rv-navy) 0%, var(--rv-navy-2) 56%, #06152b 100%) !important;
  border-right: 1px solid rgba(255,255,255,.08) !important;
  box-shadow: 10px 0 35px rgba(7, 26, 51, .18) !important;
  color: #fff !important;
}

body.theme-enterprise-crm .brand {
  min-height: 72px !important;
  padding: 0 4px 18px !important;
  border-bottom: 1px solid rgba(255,255,255,.11) !important;
}

body.theme-enterprise-crm .brand-mark {
  width: 50px !important;
  height: 50px !important;
  border-radius: 16px !important;
  background: linear-gradient(135deg, #ffffff, #e9fff0) !important;
  color: var(--rv-primary) !important;
  font-weight: 950 !important;
  font-size: 17px !important;
  box-shadow: 0 18px 32px rgba(17, 136, 71, .28), inset 0 0 0 1px rgba(255,255,255,.80) !important;
}

body.theme-enterprise-crm .brand strong {
  font-size: 20px !important;
  line-height: 1.05 !important;
  letter-spacing: -.03em !important;
}

body.theme-enterprise-crm .brand small {
  color: #54e587 !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  letter-spacing: .18em !important;
}

body.theme-enterprise-crm nav {
  gap: 8px !important;
}

body.theme-enterprise-crm .nav-item {
  position: relative !important;
  min-height: 48px !important;
  padding: 0 15px 0 46px !important;
  border-radius: 14px !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: rgba(255,255,255,.82) !important;
  font-weight: 850 !important;
  letter-spacing: -.01em !important;
  text-align: left !important;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease !important;
}

body.theme-enterprise-crm .nav-item::before {
  position: absolute !important;
  left: 15px !important;
  top: 50% !important;
  width: 22px !important;
  transform: translateY(-50%) !important;
  opacity: .94 !important;
  font-size: 16px !important;
}

body.theme-enterprise-crm .nav-item[data-view="dashboard"]::before { content: "⌂"; }
body.theme-enterprise-crm .nav-item[data-view="pipeline"]::before { content: "◎"; }
body.theme-enterprise-crm .nav-item[data-view="contacts"]::before { content: "👥"; font-size: 14px !important; }
body.theme-enterprise-crm .nav-item[data-view="completedSales"]::before { content: "▣"; }
body.theme-enterprise-crm .nav-item[data-view="rejectedSales"]::before { content: "⊗"; }
body.theme-enterprise-crm .nav-item[data-view="monthlySales"]::before { content: "▥"; }
body.theme-enterprise-crm .nav-item[data-view="calendar"]::before { content: "◷"; }
body.theme-enterprise-crm .nav-item[data-view="rvargasProfit"]::before { content: "$"; }
body.theme-enterprise-crm .nav-item[data-view="pdfReports"]::before { content: "▤"; }
body.theme-enterprise-crm .nav-item[data-view="tasks"]::before { content: "☑"; }
body.theme-enterprise-crm .nav-item[data-view="users"]::before { content: "⚙"; }

body.theme-enterprise-crm .nav-item:hover,
body.theme-enterprise-crm .nav-item:focus-visible {
  transform: translateX(3px) !important;
  background: rgba(255,255,255,.09) !important;
  border-color: rgba(255,255,255,.11) !important;
  color: #fff !important;
  outline: 0 !important;
}

body.theme-enterprise-crm .nav-item.active {
  background: linear-gradient(135deg, #0b4da2 0%, #118847 100%) !important;
  border-color: rgba(255,255,255,.16) !important;
  color: #fff !important;
  box-shadow: 0 16px 32px rgba(11,77,162,.32) !important;
}

body.theme-enterprise-crm .session-box {
  order: 90 !important;
  grid-template-columns: 46px 1fr auto !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 14px !important;
  border-radius: 18px !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  background: rgba(255,255,255,.08) !important;
}

body.theme-enterprise-crm .session-box::before {
  content: "RV" !important;
  display: grid !important;
  place-items: center !important;
  width: 42px !important;
  height: 42px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, var(--rv-primary), #54e587) !important;
  color: #fff !important;
  font-weight: 950 !important;
  grid-row: 1 / span 2 !important;
}

body.theme-enterprise-crm .session-box span {
  grid-column: 2 !important;
  color: #a9b7c8 !important;
  font-size: 11px !important;
}

body.theme-enterprise-crm .session-box strong {
  grid-column: 2 !important;
  color: #fff !important;
  font-size: 15px !important;
}

body.theme-enterprise-crm .ghost-button {
  grid-column: 3 !important;
  grid-row: 1 / span 2 !important;
  min-height: 36px !important;
  border-radius: 12px !important;
  border: 1px solid rgba(255,255,255,.16) !important;
  background: rgba(255,255,255,.08) !important;
  color: #fff !important;
  padding: 0 12px !important;
}

body.theme-enterprise-crm .sidebar-card {
  order: 80 !important;
  border-radius: 18px !important;
  padding: 16px !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  background:
    linear-gradient(135deg, rgba(17,136,71,.22), rgba(11,77,162,.12)),
    rgba(255,255,255,.06) !important;
}

body.theme-enterprise-crm .sidebar-card strong {
  font-size: 24px !important;
}

/* ---------- Main header like image ---------- */
body.theme-enterprise-crm main {
  padding: 26px 28px 34px !important;
}

body.theme-enterprise-crm .topbar {
  position: sticky !important;
  top: 16px !important;
  z-index: 12 !important;
  display: grid !important;
  grid-template-columns: minmax(240px, 1fr) minmax(420px, auto) !important;
  align-items: center !important;
  gap: 18px !important;
  margin-bottom: 26px !important;
  padding: 18px 20px !important;
  border: 1px solid rgba(255,255,255,.78) !important;
  border-radius: 24px !important;
  background: rgba(255,255,255,.86) !important;
  box-shadow: 0 18px 55px rgba(16,24,40,.10) !important;
  backdrop-filter: blur(16px) !important;
}

body.theme-enterprise-crm .topbar > div:first-child {
  min-width: 0 !important;
}

body.theme-enterprise-crm .eyebrow {
  color: var(--rv-primary) !important;
  font-size: 12px !important;
  font-weight: 950 !important;
  letter-spacing: .12em !important;
}

body.theme-enterprise-crm .app-title {
  display: block !important;
  margin-bottom: 5px !important;
  color: #475467 !important;
  font-size: 13px !important;
  font-weight: 900 !important;
}

body.theme-enterprise-crm h1 {
  color: var(--rv-text) !important;
  font-size: clamp(30px, 3.3vw, 42px) !important;
  font-weight: 950 !important;
  letter-spacing: -.045em !important;
}

body.theme-enterprise-crm .actions {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: flex-end !important;
  align-items: end !important;
  gap: 10px !important;
}

body.theme-enterprise-crm .search {
  min-width: min(34vw, 390px) !important;
}

body.theme-enterprise-crm .search input {
  width: 100% !important;
  min-height: 46px !important;
  border-radius: 15px !important;
  padding-left: 44px !important;
  box-shadow: 0 8px 20px rgba(16,24,40,.04) !important;
}

body.theme-enterprise-crm .search::before {
  content: "⌕" !important;
  position: absolute !important;
  left: 16px !important;
  bottom: 10px !important;
  color: #98a2b3 !important;
  font-size: 20px !important;
  z-index: 1 !important;
}

/* ---------- Controls ---------- */
body.theme-enterprise-crm input,
body.theme-enterprise-crm select,
body.theme-enterprise-crm textarea {
  border-color: var(--rv-line) !important;
  border-radius: 14px !important;
  background: #fff !important;
  color: var(--rv-text) !important;
}

body.theme-enterprise-crm input:focus,
body.theme-enterprise-crm select:focus,
body.theme-enterprise-crm textarea:focus {
  border-color: rgba(17,136,71,.65) !important;
  box-shadow: 0 0 0 4px rgba(17,136,71,.13) !important;
  outline: 0 !important;
}

body.theme-enterprise-crm .primary,
body.theme-enterprise-crm .import-button,
body.theme-enterprise-crm .danger-button,
body.theme-enterprise-crm .text-button,
body.theme-enterprise-crm .ghost-light-button,
body.theme-enterprise-crm .icon-button {
  border-radius: 14px !important;
  font-weight: 900 !important;
}

body.theme-enterprise-crm .primary {
  min-height: 46px !important;
  background: linear-gradient(135deg, var(--rv-primary), var(--rv-primary-2)) !important;
  box-shadow: 0 16px 28px rgba(17,136,71,.22) !important;
}

body.theme-enterprise-crm .primary:hover {
  background: linear-gradient(135deg, var(--rv-green-dark, #0b6b4d), var(--rv-primary)) !important;
  transform: translateY(-1px) !important;
}

body.theme-enterprise-crm .import-button,
body.theme-enterprise-crm .ghost-light-button {
  min-height: 46px !important;
  border-color: var(--rv-line) !important;
  background: linear-gradient(180deg, #fff, #f8fafc) !important;
  box-shadow: var(--rv-shadow-soft) !important;
}

body.theme-enterprise-crm .danger-button {
  min-height: 46px !important;
  background: #fff2f0 !important;
  border: 1px solid #ffd0ca !important;
}

/* ---------- Dashboard cards/table like mockup ---------- */
body.theme-enterprise-crm .stats-grid {
  grid-template-columns: repeat(6, minmax(170px, 1fr)) !important;
  gap: 16px !important;
  margin-bottom: 18px !important;
}

body.theme-enterprise-crm .stat,
body.theme-enterprise-crm .panel,
body.theme-enterprise-crm .deal-card,
body.theme-enterprise-crm .stage-column,
body.theme-enterprise-crm .activity,
body.theme-enterprise-crm .task,
body.theme-enterprise-crm .calendar-event,
body.theme-enterprise-crm .locked-panel {
  border-radius: 22px !important;
  border: 1px solid rgba(228,233,240,.95) !important;
  background: linear-gradient(180deg, rgba(255,255,255,.99), rgba(255,255,255,.94)) !important;
  box-shadow: var(--rv-shadow-soft) !important;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease !important;
}

body.theme-enterprise-crm .stat {
  position: relative !important;
  min-height: 138px !important;
  padding: 22px 20px 20px 20px !important;
  overflow: hidden !important;
}

body.theme-enterprise-crm .stat::before {
  content: "" !important;
  position: absolute !important;
  left: 20px !important;
  top: 20px !important;
  width: 46px !important;
  height: 46px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #e9f9ef, #d3f4df) !important;
}

body.theme-enterprise-crm .stat::after {
  content: "" !important;
  position: absolute !important;
  right: -18px !important;
  bottom: -18px !important;
  width: 92px !important;
  height: 92px !important;
  border-radius: 50% !important;
  background: radial-gradient(circle, rgba(17,136,71,.15), transparent 70%) !important;
}

body.theme-enterprise-crm .stat span,
body.theme-enterprise-crm .stat strong,
body.theme-enterprise-crm .stat small {
  position: relative !important;
  z-index: 1 !important;
}

body.theme-enterprise-crm .stat span {
  display: block !important;
  padding-left: 60px !important;
  min-height: 26px !important;
  color: #566676 !important;
  font-size: 13px !important;
  font-weight: 850 !important;
}

body.theme-enterprise-crm .stat strong {
  margin: 12px 0 4px !important;
  color: #0f172a !important;
  font-size: 30px !important;
  letter-spacing: -.04em !important;
}

body.theme-enterprise-crm .stat small {
  color: var(--rv-primary) !important;
  font-weight: 800 !important;
}

body.theme-enterprise-crm .stat:hover,
body.theme-enterprise-crm .panel:hover,
body.theme-enterprise-crm .deal-card:hover,
body.theme-enterprise-crm .activity:hover,
body.theme-enterprise-crm .task:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 22px 56px rgba(16,24,40,.12) !important;
}

body.theme-enterprise-crm .layout-two,
body.theme-enterprise-crm .task-board {
  gap: 18px !important;
}

body.theme-enterprise-crm .panel {
  padding: 22px !important;
}

body.theme-enterprise-crm .panel-head {
  margin-bottom: 16px !important;
  padding-bottom: 14px !important;
  border-bottom: 1px solid #edf2f7 !important;
}

body.theme-enterprise-crm .panel-head h2 {
  color: #111827 !important;
  font-size: 19px !important;
  font-weight: 950 !important;
}

body.theme-enterprise-crm .table-wrap {
  border: 1px solid #edf2f7 !important;
  border-radius: 18px !important;
  background: #fff !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8) !important;
}

body.theme-enterprise-crm table {
  font-size: 14px !important;
}

body.theme-enterprise-crm th {
  position: sticky !important;
  top: 0 !important;
  z-index: 1 !important;
  background: #f8fafc !important;
  color: #667085 !important;
  font-size: 11px !important;
  letter-spacing: .04em !important;
  font-weight: 950 !important;
}

body.theme-enterprise-crm td {
  color: #1f2937 !important;
}

body.theme-enterprise-crm th,
body.theme-enterprise-crm td {
  padding: 14px 12px !important;
  border-bottom-color: #eef2f6 !important;
}

body.theme-enterprise-crm tbody tr:hover {
  background: #f6fff9 !important;
}

body.theme-enterprise-crm .badge {
  min-height: 30px !important;
  padding: 0 12px !important;
  border-radius: 999px !important;
  font-size: 11px !important;
  font-weight: 950 !important;
}

body.theme-enterprise-crm .badge.Nuevo { background: linear-gradient(135deg, #0b4da2, #2b73d2) !important; }
body.theme-enterprise-crm .badge.Calificado { background: linear-gradient(135deg, #118847, #21a457) !important; }
body.theme-enterprise-crm .badge.Propuesta { background: linear-gradient(135deg, #b7791f, #e0a341) !important; }
body.theme-enterprise-crm .badge.Negociacion { background: linear-gradient(135deg, #c2473d, #e06256) !important; }

body.theme-enterprise-crm .filters-grid,
body.theme-enterprise-crm .quick-actions button,
body.theme-enterprise-crm .segmented {
  border-radius: 18px !important;
  border-color: var(--rv-line) !important;
  background: linear-gradient(180deg, #ffffff, #f8fafc) !important;
  box-shadow: var(--rv-shadow-soft) !important;
}

body.theme-enterprise-crm .stage-filter.active {
  background: linear-gradient(135deg, var(--rv-navy), var(--rv-blue)) !important;
}

body.theme-enterprise-crm .stage-column {
  background: rgba(255,255,255,.88) !important;
}

body.theme-enterprise-crm .deal-card {
  border-left: 5px solid var(--rv-primary) !important;
}

body.theme-enterprise-crm dialog {
  border-radius: 24px !important;
  border: 1px solid rgba(255,255,255,.8) !important;
  box-shadow: 0 34px 100px rgba(16,24,40,.26) !important;
}

body.theme-enterprise-crm dialog::backdrop {
  background: rgba(7,26,51,.55) !important;
  backdrop-filter: blur(5px) !important;
}

body.theme-enterprise-crm .search-suggestions {
  border-radius: 18px !important;
  border-color: rgba(17,136,71,.22) !important;
  box-shadow: 0 26px 70px rgba(16,24,40,.18) !important;
}

/* ---------- Mobile / seller friendly ---------- */
@media (max-width: 980px) {
  body.theme-enterprise-crm {
    display: block !important;
  }

  body.theme-enterprise-crm .sidebar {
    position: static !important;
    height: auto !important;
    padding: 16px !important;
  }

  body.theme-enterprise-crm .brand {
    border-bottom: 0 !important;
    padding-bottom: 6px !important;
  }

  body.theme-enterprise-crm .sidebar nav {
    display: flex !important;
    overflow-x: auto !important;
    gap: 8px !important;
    padding-bottom: 6px !important;
  }

  body.theme-enterprise-crm .nav-item {
    flex: 0 0 auto !important;
    min-width: 150px !important;
    text-align: left !important;
  }

  body.theme-enterprise-crm main {
    padding: 18px !important;
  }

  body.theme-enterprise-crm .topbar {
    position: static !important;
    grid-template-columns: 1fr !important;
    border-radius: 18px !important;
  }

  body.theme-enterprise-crm .actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    justify-content: stretch !important;
  }

  body.theme-enterprise-crm .search {
    min-width: 100% !important;
    grid-column: 1 / -1 !important;
  }

  body.theme-enterprise-crm .stats-grid,
  body.theme-enterprise-crm .filters-grid,
  body.theme-enterprise-crm .quick-actions,
  body.theme-enterprise-crm .layout-two,
  body.theme-enterprise-crm .task-board {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 640px) {
  body.theme-enterprise-crm .actions,
  body.theme-enterprise-crm .stats-grid,
  body.theme-enterprise-crm .filters-grid,
  body.theme-enterprise-crm .quick-actions,
  body.theme-enterprise-crm .layout-two,
  body.theme-enterprise-crm .task-board {
    grid-template-columns: 1fr !important;
  }

  body.theme-enterprise-crm h1 {
    font-size: 28px !important;
  }

  body.theme-enterprise-crm .stat {
    min-height: 112px !important;
  }

  body.theme-enterprise-crm .session-box {
    grid-template-columns: 42px 1fr auto !important;
  }
}



/* =========================================================
   FIX 2026-06: layout reportes/PDF + responsive móvil
   Corrige:
   - contenido que se mete debajo del sidebar
   - tablas/reportes pegados al menú lateral
   - vista PDF móvil que encoge la app y rompe fuentes
   - overflow horizontal fuera del área principal
   ========================================================= */

/* Estructura base segura en escritorio */
body.theme-enterprise-crm {
  min-width: 0 !important;
  overflow-x: hidden !important;
}

body.theme-enterprise-crm .sidebar {
  z-index: 40 !important;
  width: 274px !important;
  min-width: 274px !important;
}

body.theme-enterprise-crm main {
  min-width: 0 !important;
  width: 100% !important;
  max-width: calc(100vw - 274px) !important;
  overflow-x: hidden !important;
}

/* Evita que paneles/tablas se salgan debajo del sidebar */
body.theme-enterprise-crm .view,
body.theme-enterprise-crm .panel,
body.theme-enterprise-crm .table-wrap,
body.theme-enterprise-crm .print-report-area,
body.theme-enterprise-crm .print-report,
body.theme-enterprise-crm .layout-two,
body.theme-enterprise-crm .task-board {
  min-width: 0 !important;
  max-width: 100% !important;
}

/* En reportes PDF, el panel debe iniciar dentro del main y no sobresalir */
body.theme-enterprise-crm #pdfReports,
body.theme-enterprise-crm #pdfReports .panel,
body.theme-enterprise-crm .print-report-area.ready {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
}

/* Tablas normales y reportes: scroll interno, no empujar todo el layout */
body.theme-enterprise-crm .table-wrap {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

body.theme-enterprise-crm table {
  width: 100% !important;
}

/* Las tablas muy anchas se desplazan dentro de su caja, no debajo del menú */
body.theme-enterprise-crm #completed-sales-table,
body.theme-enterprise-crm #rejected-sales-table,
body.theme-enterprise-crm #contacts-table,
body.theme-enterprise-crm #monthly-sales-table,
body.theme-enterprise-crm #profit-table {
  min-width: 860px !important;
}

/* Reporte PDF en pantalla: mantener tamaño legible y contenido con scroll */
body.theme-enterprise-crm .print-report-area.ready {
  display: block !important;
  margin-top: 18px !important;
  padding: 18px !important;
  border: 1px solid var(--rv-line, #dbe4ea) !important;
  border-radius: 20px !important;
  background: #fff !important;
  box-shadow: var(--rv-shadow-soft, 0 8px 22px rgba(16,24,40,.06)) !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

body.theme-enterprise-crm .print-report {
  min-width: 860px !important;
  width: 100% !important;
  max-width: none !important;
  color: #111827 !important;
  font-family: Arial, sans-serif !important;
  font-size: 13px !important;
  line-height: 1.35 !important;
}

body.theme-enterprise-crm .print-report table {
  min-width: 860px !important;
  width: 100% !important;
  border-collapse: collapse !important;
}

body.theme-enterprise-crm .print-report th,
body.theme-enterprise-crm .print-report td {
  white-space: nowrap !important;
  padding: 9px 10px !important;
  font-size: 12px !important;
}

/* Observaciones puede partir línea para no destruir el ancho */
body.theme-enterprise-crm .print-report td:last-child {
  white-space: normal !important;
  min-width: 260px !important;
  max-width: 420px !important;
}

/* El encabezado de tablas sticky no debe quedar flotando raro en PDF/reportes */
body.theme-enterprise-crm .print-report th,
body.theme-enterprise-crm #pdfReports th {
  position: static !important;
}

/* Reducir el gran vacío superior cuando se baja en reportes */
body.theme-enterprise-crm .topbar {
  top: 10px !important;
}

/* Mejor scroll general dentro de tablas de reportes */
body.theme-enterprise-crm #pdfReports .table-wrap,
body.theme-enterprise-crm #completedSales .table-wrap,
body.theme-enterprise-crm #rejectedSales .table-wrap,
body.theme-enterprise-crm #monthlySales .table-wrap,
body.theme-enterprise-crm #rvargasProfit .table-wrap {
  overflow-x: auto !important;
  max-width: 100% !important;
}

/* Móvil/tablet: sidebar arriba y contenido ancho completo */
@media (max-width: 980px) {
  body.theme-enterprise-crm {
    display: block !important;
    width: 100% !important;
    overflow-x: hidden !important;
  }

  body.theme-enterprise-crm .sidebar {
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    position: relative !important;
    z-index: 20 !important;
  }

  body.theme-enterprise-crm main {
    width: 100% !important;
    max-width: 100% !important;
    padding: 16px !important;
    overflow-x: hidden !important;
  }

  body.theme-enterprise-crm .topbar {
    position: relative !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  body.theme-enterprise-crm .panel,
  body.theme-enterprise-crm .print-report-area.ready {
    width: 100% !important;
    max-width: 100% !important;
  }

  body.theme-enterprise-crm .print-report-area.ready {
    padding: 12px !important;
  }

  /* En móvil no encoger la app: se permite scroll horizontal solo dentro del reporte */
  body.theme-enterprise-crm .print-report,
  body.theme-enterprise-crm .print-report table {
    min-width: 760px !important;
    font-size: 12px !important;
  }

  body.theme-enterprise-crm .print-report th,
  body.theme-enterprise-crm .print-report td {
    font-size: 11px !important;
    padding: 8px !important;
  }
}

@media (max-width: 640px) {
  body.theme-enterprise-crm main {
    padding: 12px !important;
  }

  body.theme-enterprise-crm .topbar {
    padding: 14px !important;
  }

  body.theme-enterprise-crm .panel {
    padding: 14px !important;
  }

  body.theme-enterprise-crm .print-report-area.ready {
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: 14px !important;
  }

  body.theme-enterprise-crm .print-report,
  body.theme-enterprise-crm .print-report table {
    min-width: 720px !important;
  }

  body.theme-enterprise-crm .print-summary {
    grid-template-columns: repeat(2, minmax(130px, 1fr)) !important;
  }
}

/* Impresión/PDF real: aquí sí se limpia todo para no afectar el PDF generado */
@media print {
  body.theme-enterprise-crm {
    display: block !important;
    background: #fff !important;
    overflow: visible !important;
  }

  body.theme-enterprise-crm main,
  body.theme-enterprise-crm .print-report-area,
  body.theme-enterprise-crm .print-report {
    max-width: none !important;
    width: 100% !important;
    overflow: visible !important;
    box-shadow: none !important;
  }

  body.theme-enterprise-crm .print-report,
  body.theme-enterprise-crm .print-report table {
    min-width: 0 !important;
  }

  body.theme-enterprise-crm .print-report th,
  body.theme-enterprise-crm .print-report td {
    white-space: normal !important;
  }
}



/* =========================================================
   Campana de notificaciones vendedores/admin
   ========================================================= */
.notification-wrap {
  position: relative;
  align-self: end;
  z-index: 30;
}

.notification-bell {
  position: relative;
  width: 46px;
  min-height: 46px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--rv-line, #dbe4ea);
  border-radius: 15px;
  background: linear-gradient(180deg, #ffffff, #f7fafc);
  color: var(--rv-text, #0f172a);
  box-shadow: var(--rv-shadow-soft, 0 8px 22px rgba(16,24,40,.06));
  font-size: 18px;
}

.notification-bell.has-notifications {
  border-color: rgba(17, 136, 71, .34);
  box-shadow: 0 12px 30px rgba(17, 136, 71, .16);
}

.notification-count {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #e11d48;
  color: #fff;
  font-size: 11px;
  font-weight: 950;
}

.notification-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(420px, calc(100vw - 32px));
  max-height: 520px;
  overflow: hidden;
  border: 1px solid var(--rv-line, #dbe4ea);
  border-radius: 18px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 30px 90px rgba(15,23,42,.22);
}

.notification-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #edf2f7;
}

.notification-head strong {
  color: #0f172a;
  font-size: 16px;
  font-weight: 950;
}

.notification-list {
  max-height: 440px;
  overflow-y: auto;
  padding: 10px;
}

.notification-item,
.notification-empty {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 13px;
  border: 1px solid #edf2f7;
  border-radius: 14px;
  background: #fff;
  margin-bottom: 9px;
}

.notification-item.is-unread {
  border-color: rgba(17, 136, 71, .28);
  background: linear-gradient(180deg, #f0fff7, #ffffff);
}

.notification-item strong,
.notification-empty strong {
  display: block;
  color: #111827;
  font-size: 14px;
  font-weight: 950;
}

.notification-item span,
.notification-empty span {
  display: block;
  margin-top: 3px;
  color: #475467;
  font-size: 13px;
  line-height: 1.35;
}

.notification-item small {
  display: block;
  margin-top: 6px;
  color: #667085;
  font-size: 11px;
  font-weight: 800;
}

.notification-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}

.notification-actions .text-button,
.notification-actions .ghost-light-button {
  min-height: 32px;
  padding: 0 10px;
  white-space: nowrap;
  font-size: 12px;
}

.notification-empty {
  grid-template-columns: 1fr;
  margin-bottom: 0;
  background: #f8fafc;
}

.modal-head .icon-button[data-close-dialog] {
  font-size: 24px;
  font-weight: 900;
}

@media (max-width: 980px) {
  .notification-wrap {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .notification-panel {
    right: 0;
    width: min(420px, calc(100vw - 28px));
  }
}

@media (max-width: 640px) {
  .notification-wrap {
    justify-self: stretch;
  }

  .notification-bell {
    width: 100%;
  }

  .notification-panel {
    left: 0;
    right: auto;
    width: 100%;
  }

  .notification-item {
    grid-template-columns: 1fr;
  }

  .notification-actions {
    flex-direction: row;
  }
}


/* =========================================================
   FIX: pantalla de bloqueo limpia + login único
   ========================================================= */
body.locked.theme-enterprise-crm {
  display: block !important;
  overflow: hidden !important;
  background:
    radial-gradient(circle at 12% 8%, rgba(33, 164, 87, .18), transparent 28%),
    radial-gradient(circle at 92% 0%, rgba(11, 77, 162, .24), transparent 26%),
    linear-gradient(135deg, #071a33 0%, #04101f 100%) !important;
}

body.locked.theme-enterprise-crm > .sidebar,
body.locked.theme-enterprise-crm > main,
body.locked.theme-enterprise-crm > dialog,
body.locked.theme-enterprise-crm > .print-report-area {
  display: none !important;
}

body.theme-enterprise-crm .login-screen {
  background:
    radial-gradient(circle at 12% 8%, rgba(33, 164, 87, .18), transparent 28%),
    radial-gradient(circle at 92% 0%, rgba(11, 77, 162, .24), transparent 26%),
    linear-gradient(135deg, #071a33 0%, #04101f 100%) !important;
}

body.theme-enterprise-crm .login-card {
  position: relative;
  overflow: hidden;
}

body.theme-enterprise-crm .login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg, #0b4da2, #118847, #21a457);
}

body.theme-enterprise-crm .login-card p {
  color: #667085 !important;
  font-size: 14px !important;
}

body.theme-enterprise-crm .login-card label {
  color: #344054 !important;
}

body.theme-enterprise-crm .login-card .primary {
  width: 100% !important;
  margin-top: 4px !important;
}

/* Importación: deja claro que se puede asignar a admin o vendedor */
body.theme-enterprise-crm .import-owner select {
  min-width: 170px !important;
}

/* =========================================================
   Administración avanzada: borrado, orden paga y pagos
   ========================================================= */
.admin-tools-layout {
  align-items: start;
}

.admin-danger-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}

.danger-zone {
  border-color: #ffd4cf !important;
  background: linear-gradient(180deg, #fffafa, #fff4f2) !important;
}

.danger-zone h3 {
  margin: 0;
  color: #991b1b;
  font-size: 16px;
}

.danger-zone p {
  color: #7f1d1d;
}

.admin-delete-search {
  min-width: min(360px, 100%);
}

.paid-badge,
.pending-pay-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

.paid-badge {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.pending-pay-badge {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}

body.theme-enterprise-crm .nav-item[data-view="adminTools"]::before {
  content: "🛡";
  font-size: 14px !important;
}

@media (max-width: 760px) {
  .admin-danger-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Pestaña Ventas: órdenes pagadas y pendientes
   ========================================================= */
.sales-order-summary {
  grid-template-columns: repeat(2, minmax(220px, 1fr)) !important;
}

.paid-summary-card::before {
  background: linear-gradient(180deg, #16a34a, #86efac) !important;
}

.pending-summary-card::before {
  background: linear-gradient(180deg, #dc2626, #fca5a5) !important;
}

.pending-summary-card small,
.pending-summary-card strong {
  color: #991b1b !important;
}

.paid-summary-card small {
  color: #166534 !important;
}

#sellerSales .paid-badge,
#completedSales .paid-badge {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

#sellerSales .pending-pay-badge,
#completedSales .pending-pay-badge {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

body.theme-enterprise-crm .nav-item[data-view="sellerSales"]::before {
  content: "$";
}

/* =========================================================
   Compartir clientes/prospectos seleccionados
   ========================================================= */
.bulk-share-control {
  min-width: 220px;
}

#share-selected:disabled {
  opacity: .48;
  cursor: not-allowed;
}

@media (max-width: 760px) {
  .bulk-share-control {
    min-width: 100%;
  }
}

/* Solicitud de compartir clientes: aceptar */
.notification-item .primary.small[data-accept-clients] {
  min-height: 34px;
  padding: 0 12px;
  white-space: nowrap;
}

.notification-item.is-unread:has([data-accept-clients]) {
  border-color: rgba(17, 136, 71, .42);
  background: linear-gradient(180deg, #ecfdf5, #ffffff);
}

/* Fix aceptación y borrado vendedor */
.notification-item .primary.small[data-accept-clients] {
  background: linear-gradient(135deg, #0f8b65, #22c55e) !important;
}

/* =========================================================
   Borrado específico por vendedor
   ========================================================= */
.specific-delete-panel {
  border-color: rgba(220, 38, 38, .18) !important;
}

.specific-delete-preview {
  padding: 12px 14px;
  border: 1px solid #fed7aa;
  border-radius: 14px;
  background: #fff7ed;
  color: #9a3412;
  font-weight: 800;
  line-height: 1.45;
}

.specific-delete-preview strong {
  color: #7c2d12;
}


/* =========================================================
   CORRECCIÓN LOGIN FINAL: solo cuadro de ingreso
   ========================================================= */
body.locked,
body.locked.theme-enterprise-crm {
  display: block !important;
  min-height: 100vh !important;
  overflow: hidden !important;
  background:
    radial-gradient(circle at 12% 8%, rgba(33, 164, 87, .18), transparent 28%),
    radial-gradient(circle at 92% 0%, rgba(11, 77, 162, .24), transparent 26%),
    linear-gradient(135deg, #071a33 0%, #04101f 100%) !important;
}

body.locked > .sidebar,
body.locked > main,
body.locked > dialog,
body.locked > .print-report-area,
body.locked.theme-enterprise-crm > .sidebar,
body.locked.theme-enterprise-crm > main,
body.locked.theme-enterprise-crm > dialog,
body.locked.theme-enterprise-crm > .print-report-area {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.locked .login-screen,
body.locked.theme-enterprise-crm .login-screen {
  display: grid !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.login-screen.hidden {
  display: none !important;
}

/* Separación base admin vs vendedor */
.admin-base-delete-panel {
  border-color: rgba(37, 99, 235, .18) !important;
}

.admin-base-delete-panel .specific-delete-preview {
  background: #eff6ff;
  color: #1e3a8a;
  border-color: #bfdbfe;
}

/* Bases independientes reales */
.base-note {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

/* =========================================================
   Flujo de aprobación de ventas / instalación
   ========================================================= */
.pending-approval-total {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
  font-weight: 950;
}

.approval-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
  background: #e2e8f0;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.approval-badge.pending_approval {
  background: #fff7ed;
  color: #9a3412;
  border-color: #fed7aa;
}

.approval-badge.in_review {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.approval-badge.installation_pending {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.approval-badge.installed {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.approval-badge.approved {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.approval-badge.rejected {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

body.theme-enterprise-crm .nav-item[data-view="pendingSales"]::before {
  content: "⏳";
  font-size: 14px !important;
}

/* Tiempo real y ventas pendientes para vendedor */
.seller-pending-approval-box {
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid #fed7aa;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff7ed, #ffffff);
}

.compact-head {
  margin-bottom: 10px !important;
  padding-bottom: 8px !important;
}

.compact-head h3 {
  margin: 0;
  color: #9a3412;
  font-size: 16px;
}

/* Vendedores: sin selector de vendedor en la pestaña Ventas */
body:not(.admin-mode) #seller-sales-seller {
  pointer-events: none;
}

/* Corrección visual final: mantener fondo uniforme en todo el panel */
html,
body,
body.theme-enterprise-crm {
  min-height: 100%;
  background-color: #f5f7fb !important;
}

body.theme-enterprise-crm main {
  min-height: 100vh !important;
  background: transparent !important;
}

body.theme-enterprise-crm .view {
  background: transparent !important;
}

body.theme-enterprise-crm .panel,
body.theme-enterprise-crm .table-wrap {
  background-color: #ffffff !important;
}

/* Vendedor: los filtros de vendedor en ventas/reporte quedan ocultos */
body:not(.is-admin) .admin-only {
  display: none !important;
}


/* === FIX VISUAL FINAL: no toca lógica === */
body.theme-enterprise-crm {
  background: #f5f7fb !important;
}

body.theme-enterprise-crm .sidebar {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  align-items: stretch !important;
  overflow: hidden !important;
}

body.theme-enterprise-crm .sidebar nav,
body.theme-enterprise-crm nav[aria-label="Principal"] {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  padding-right: 4px !important;
}

body.theme-enterprise-crm .session-box {
  order: 90 !important;
  margin-top: 12px !important;
  flex-shrink: 0 !important;
}

body.theme-enterprise-crm .sidebar-card {
  order: 95 !important;
  margin-top: 12px !important;
  flex-shrink: 0 !important;
}

body.theme-enterprise-crm main {
  min-height: 100vh !important;
  background: #f5f7fb !important;
}

body.theme-enterprise-crm .view {
  background: transparent !important;
}

body.theme-enterprise-crm .topbar,
body.theme-enterprise-crm .panel,
body.theme-enterprise-crm .table-wrap,
body.theme-enterprise-crm .stats-grid,
body.theme-enterprise-crm .list-grid,
body.theme-enterprise-crm .form-grid,
body.theme-enterprise-crm .calendar-grid,
body.theme-enterprise-crm .card-grid {
  position: relative !important;
  z-index: 1 !important;
}

body.theme-enterprise-crm .topbar {
  background: transparent !important;
}

body.theme-enterprise-crm .view.active {
  min-height: calc(100vh - 120px) !important;
}

body.theme-enterprise-crm .sidebar::after {
  content: "" !important;
  position: absolute !important;
  inset: 0 !important;
  pointer-events: none !important;
  border-right: 1px solid rgba(255,255,255,.06) !important;
}




/* =========================================================
   FIX VISUAL CAMPANA / NOTIFICACIONES
   Corrige que el panel de notificaciones se abra por encima
   del contenido y no quede detrás/superpuesto.
   No toca lógica ni datos.
   ========================================================= */

body.theme-enterprise-crm main {
  position: relative !important;
  overflow: visible !important;
}

body.theme-enterprise-crm .topbar {
  position: sticky !important;
  top: 16px !important;
  z-index: 300 !important;
  overflow: visible !important;
  isolation: isolate !important;
}

body.theme-enterprise-crm .actions {
  position: relative !important;
  z-index: 320 !important;
  overflow: visible !important;
}

body.theme-enterprise-crm .notification-wrap {
  position: relative !important;
  z-index: 500 !important;
  overflow: visible !important;
}

body.theme-enterprise-crm .notification-bell {
  position: relative !important;
  z-index: 510 !important;
}

body.theme-enterprise-crm .notification-panel {
  position: absolute !important;
  top: calc(100% + 12px) !important;
  right: 0 !important;
  left: auto !important;
  z-index: 9999 !important;
  display: block !important;
  overflow: hidden !important;
}

body.theme-enterprise-crm .notification-panel[hidden] {
  display: none !important;
}

body.theme-enterprise-crm .view,
body.theme-enterprise-crm .panel,
body.theme-enterprise-crm .table-wrap,
body.theme-enterprise-crm .filters-grid,
body.theme-enterprise-crm .stats-grid {
  position: relative !important;
  z-index: 1 !important;
}

@media (max-width: 640px) {
  body.theme-enterprise-crm .notification-panel {
    left: 0 !important;
    right: auto !important;
    width: min(420px, calc(100vw - 32px)) !important;
    max-width: calc(100vw - 32px) !important;
  }
}



/* =========================================================
   AJUSTE FINAL: LOGO RD + PANEL DE NOTIFICACIONES LIMPIO
   - Cambia las iniciales RV por RD en la sesión.
   - Convierte las notificaciones en un panel flotante real
     con fondo sólido y backdrop para evitar superposición visual.
   ========================================================= */
body.theme-enterprise-crm .session-box::before {
  content: "RD" !important;
}

body.theme-enterprise-crm.notifications-open::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(7, 26, 51, 0.18);
  backdrop-filter: blur(2px);
  z-index: 440;
}

body.theme-enterprise-crm .notification-wrap {
  position: relative !important;
  z-index: 560 !important;
}

body.theme-enterprise-crm .notification-panel {
  position: fixed !important;
  top: 110px !important;
  right: 32px !important;
  left: auto !important;
  width: min(430px, calc(100vw - 32px)) !important;
  max-width: calc(100vw - 32px) !important;
  max-height: min(68vh, 560px) !important;
  overflow: hidden !important;
  background: #ffffff !important;
  border: 1px solid rgba(228, 233, 240, 0.96) !important;
  border-radius: 22px !important;
  box-shadow: 0 28px 72px rgba(15, 23, 42, 0.20) !important;
  z-index: 600 !important;
}

body.theme-enterprise-crm .notification-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #ffffff;
}

body.theme-enterprise-crm .notification-list {
  max-height: calc(min(68vh, 560px) - 74px);
  overflow: auto;
  background: #ffffff;
}

body.theme-enterprise-crm .notification-item,
body.theme-enterprise-crm .notification-empty {
  background: #ffffff !important;
}

body.theme-enterprise-crm .notification-item.is-unread {
  background: linear-gradient(180deg, #f8fffb 0%, #ffffff 100%) !important;
}

@media (max-width: 900px) {
  body.theme-enterprise-crm .notification-panel {
    top: 94px !important;
    right: 16px !important;
    width: min(410px, calc(100vw - 24px)) !important;
    max-width: calc(100vw - 24px) !important;
    max-height: min(72vh, 520px) !important;
  }

  body.theme-enterprise-crm .notification-list {
    max-height: calc(min(72vh, 520px) - 74px);
  }
}


/* =========================================================
   RECUPERACION VISUAL LIMPIA
   - Corrige el exceso visual de la versión premium anterior.
   - Mantiene estética elegante, con tamaños normales.
   - Corrige notificaciones en admin y vendedor sin tocar lógica.
   ========================================================= */
body.theme-enterprise-crm .brand-mark {
  display: grid !important;
  place-items: center !important;
  font-size: 22px !important;
  font-weight: 950 !important;
  letter-spacing: -0.05em !important;
  color: #118847 !important;
}

body.theme-enterprise-crm .session-box::before {
  content: "RD" !important;
}

body.theme-enterprise-crm.notifications-open::before,
body.theme-enterprise-crm.notifications-open::after {
  display: none !important;
}

body.theme-enterprise-crm main,
body.theme-enterprise-crm .topbar,
body.theme-enterprise-crm .actions,
body.theme-enterprise-crm .view {
  overflow: visible !important;
}

body.theme-enterprise-crm .notification-wrap {
  position: relative !important;
  overflow: visible !important;
  isolation: isolate !important;
  z-index: 900 !important;
}

body.theme-enterprise-crm .notification-bell {
  position: relative !important;
  z-index: 901 !important;
}

body.theme-enterprise-crm .notification-panel {
  position: absolute !important;
  top: calc(100% + 10px) !important;
  right: 0 !important;
  left: auto !important;
  width: min(380px, calc(100vw - 34px)) !important;
  max-width: calc(100vw - 34px) !important;
  max-height: 430px !important;
  display: block !important;
  overflow: hidden !important;
  border-radius: 18px !important;
  border: 1px solid rgba(228, 233, 240, 0.96) !important;
  background: #ffffff !important;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.16) !important;
  backdrop-filter: none !important;
  z-index: 950 !important;
}

body.theme-enterprise-crm .notification-panel[hidden] {
  display: none !important;
}

body.theme-enterprise-crm .notification-head {
  position: sticky !important;
  top: 0 !important;
  z-index: 2 !important;
  padding: 18px 20px !important;
  background: #ffffff !important;
  border-bottom: 1px solid rgba(228,233,240,.85) !important;
}

body.theme-enterprise-crm .notification-head strong {
  font-size: 17px !important;
  line-height: 1.2 !important;
  color: #111827 !important;
}

body.theme-enterprise-crm .notification-list {
  max-height: 355px !important;
  overflow: auto !important;
  background: #ffffff !important;
}

body.theme-enterprise-crm .notification-item,
body.theme-enterprise-crm .notification-empty {
  background: #ffffff !important;
}

body.theme-enterprise-crm .notification-item {
  padding: 14px 18px !important;
  border-bottom: 1px solid rgba(228,233,240,.8) !important;
}

body.theme-enterprise-crm .notification-item:last-child {
  border-bottom: 0 !important;
}

body.theme-enterprise-crm .notification-item.is-unread {
  background: #f8fffb !important;
}

body.theme-enterprise-crm .notification-item strong,
body.theme-enterprise-crm .notification-item p,
body.theme-enterprise-crm .notification-item small {
  filter: none !important;
}

body.theme-enterprise-crm .panel,
body.theme-enterprise-crm .stat,
body.theme-enterprise-crm .task-board {
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06) !important;
}

@media (max-width: 760px) {
  body.theme-enterprise-crm .notification-panel {
    width: min(360px, calc(100vw - 24px)) !important;
    max-width: calc(100vw - 24px) !important;
    right: 0 !important;
    top: calc(100% + 8px) !important;
    max-height: 72vh !important;
  }

  body.theme-enterprise-crm .notification-list {
    max-height: calc(72vh - 64px) !important;
  }
}


/* =========================================================
   FIX FINAL: PAGO DE ÓRDENES + NOTIFICACIONES FIJAS
   Solo corrige visual de notificaciones y conserva tamaños normales.
   ========================================================= */
body.theme-enterprise-crm.notifications-open::before,
body.theme-enterprise-crm.notifications-open::after {
  display: none !important;
}

body.theme-enterprise-crm .notification-wrap {
  position: relative !important;
  z-index: 900 !important;
}

body.theme-enterprise-crm .notification-panel {
  position: fixed !important;
  top: 104px !important;
  right: 28px !important;
  left: auto !important;
  width: min(380px, calc(100vw - 32px)) !important;
  max-width: calc(100vw - 32px) !important;
  max-height: min(430px, 70vh) !important;
  overflow: hidden !important;
  background: #ffffff !important;
  border: 1px solid rgba(228, 233, 240, .98) !important;
  border-radius: 18px !important;
  box-shadow: 0 24px 56px rgba(15, 23, 42, .18) !important;
  backdrop-filter: none !important;
  z-index: 9999 !important;
}

body.theme-enterprise-crm .notification-panel[hidden] {
  display: none !important;
}

body.theme-enterprise-crm .notification-head {
  background: #ffffff !important;
}

body.theme-enterprise-crm .notification-head strong {
  font-size: 17px !important;
  line-height: 1.2 !important;
}

body.theme-enterprise-crm .notification-list {
  max-height: calc(min(430px, 70vh) - 64px) !important;
  overflow-y: auto !important;
  background: #ffffff !important;
}

body.theme-enterprise-crm .notification-item,
body.theme-enterprise-crm .notification-empty {
  background: #ffffff !important;
}

body.theme-enterprise-crm .notification-item.is-unread {
  background: #f8fffb !important;
}

@media (max-width: 760px) {
  body.theme-enterprise-crm .notification-panel {
    top: 84px !important;
    right: 12px !important;
    width: calc(100vw - 24px) !important;
    max-height: 72vh !important;
  }

  body.theme-enterprise-crm .notification-list {
    max-height: calc(72vh - 64px) !important;
  }
}


/* =========================================================
   FIX FINAL NOTIFICACIONES EN SCROLL
   - El panel no queda fijo encima de la pantalla.
   - Al hacer scroll o cambiar tamaño se cierra por JS.
   - No toca lógica de ventas/pagos/Supabase.
   ========================================================= */

body.theme-enterprise-crm .notification-wrap {
  position: relative !important;
  z-index: 900 !important;
  overflow: visible !important;
}

body.theme-enterprise-crm .notification-panel {
  position: absolute !important;
  top: calc(100% + 10px) !important;
  right: 0 !important;
  left: auto !important;
  width: min(380px, calc(100vw - 32px)) !important;
  max-width: calc(100vw - 32px) !important;
  max-height: min(430px, 68vh) !important;
  overflow: hidden !important;
  background: #ffffff !important;
  border: 1px solid rgba(228, 233, 240, .98) !important;
  border-radius: 18px !important;
  box-shadow: 0 22px 48px rgba(15, 23, 42, .16) !important;
  backdrop-filter: none !important;
  z-index: 950 !important;
}

body.theme-enterprise-crm .notification-panel[hidden] {
  display: none !important;
}

body.theme-enterprise-crm.notifications-open::before,
body.theme-enterprise-crm.notifications-open::after {
  display: none !important;
}

body.theme-enterprise-crm .notification-list {
  max-height: calc(min(430px, 68vh) - 64px) !important;
  overflow-y: auto !important;
}

@media (max-width: 760px) {
  body.theme-enterprise-crm .notification-wrap {
    width: 100% !important;
  }

  body.theme-enterprise-crm .notification-panel {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    right: 0 !important;
    left: auto !important;
    width: min(360px, calc(100vw - 24px)) !important;
    max-width: calc(100vw - 24px) !important;
    max-height: 70vh !important;
  }

  body.theme-enterprise-crm .notification-list {
    max-height: calc(70vh - 64px) !important;
  }
}


/* =========================================================
   FIX FINAL HEADER NORMAL
   - El encabezado superior deja de ser sticky/fijo.
   - Al bajar la página se mueve normal con el contenido.
   - No toca lógica funcional.
   ========================================================= */

body.theme-enterprise-crm .topbar {
  position: relative !important;
  top: auto !important;
  z-index: 20 !important;
}

body.theme-enterprise-crm .actions {
  z-index: 30 !important;
}

body.theme-enterprise-crm .notification-wrap {
  z-index: 40 !important;
}

body.theme-enterprise-crm .notification-panel {
  position: absolute !important;
  top: calc(100% + 10px) !important;
  right: 0 !important;
  left: auto !important;
  z-index: 50 !important;
}

/* Evita que el encabezado se quede pegado en móvil también */
@media (max-width: 760px) {
  body.theme-enterprise-crm .topbar {
    position: relative !important;
    top: auto !important;
  }
}
