:root {
  --ink: #122033;
  --muted: #647386;
  --line: #d9e4ee;
  --surface: #ffffff;
  --band: #f5f8fb;
  --nav: #063b66;
  --nav-2: #09558f;
  --accent: #f39a23;
  --accent-2: #0067b1;
  --accent-soft: #fff3df;
  --blue-soft: #eaf4ff;
  --danger: #b91c1c;
  --ok: #15803d;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--band);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.locked .sidebar,
body.locked .app-shell {
  display: none;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px;
  overflow: auto;
  background:
    radial-gradient(circle at 14% 18%, rgba(243, 154, 35, 0.26), transparent 28%),
    radial-gradient(circle at 82% 78%, rgba(0, 103, 177, 0.36), transparent 32%),
    linear-gradient(135deg, #052f52 0%, #074c7f 46%, #0a3354 100%);
}

body.locked .login-screen {
  display: flex;
}

.login-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 38px;
  background: white;
  border-radius: 0 14px 14px 0;
  border: 1px solid rgba(217, 228, 238, 0.9);
  box-shadow: 0 24px 70px rgba(4, 23, 39, 0.24);
}

.login-card h1 {
  color: var(--ink);
  font-size: 32px;
  letter-spacing: 0;
}

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

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

.login-error {
  min-height: 20px;
  color: var(--danger) !important;
  font-weight: 700;
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(380px, 480px);
  width: min(1120px, 100%);
  min-height: 650px;
}

.login-cover {
  position: relative;
  display: grid;
  align-content: space-between;
  gap: 28px;
  overflow: hidden;
  padding: 42px;
  color: white;
  border-radius: 14px 0 0 14px;
  background:
    linear-gradient(135deg, rgba(0, 103, 177, 0.94), rgba(5, 48, 82, 0.96)),
    url("/static/assets/telecenter-logo.jpg") center 22% / 54% auto no-repeat;
  box-shadow: 0 24px 70px rgba(4, 23, 39, 0.24);
}

.login-cover::before,
.login-cover::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.login-cover::before {
  inset: 0;
  background:
    radial-gradient(circle at 24% 28%, rgba(243, 154, 35, 0.34) 0 9px, transparent 10px),
    radial-gradient(circle at 72% 18%, rgba(255, 255, 255, 0.24) 0 7px, transparent 8px),
    radial-gradient(circle at 84% 72%, rgba(243, 154, 35, 0.28) 0 12px, transparent 13px),
    linear-gradient(120deg, transparent 0 38%, rgba(255, 255, 255, 0.1) 38% 39%, transparent 39% 100%);
}

.login-cover::after {
  width: 280px;
  height: 280px;
  right: -92px;
  bottom: -82px;
  border: 34px solid rgba(243, 154, 35, 0.2);
  border-radius: 999px;
}

.login-cover-logo {
  position: relative;
  z-index: 1;
  width: min(250px, 62%);
  padding: 14px 18px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(2, 22, 38, 0.24);
}

.login-cover-copy,
.login-cover-metrics {
  position: relative;
  z-index: 1;
}

.login-cover-copy {
  display: grid;
  gap: 12px;
  max-width: 520px;
}

.login-cover-copy span {
  width: max-content;
  padding: 7px 11px;
  color: #5a3707;
  background: #ffc766;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-cover-copy h2 {
  max-width: 520px;
  color: white;
  font-size: 42px;
  line-height: 1.05;
}

.login-cover-copy p {
  max-width: 460px;
  color: #d9ecfb;
  font-size: 16px;
  line-height: 1.55;
}

.login-cover-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.login-cover-metrics article {
  display: grid;
  gap: 4px;
  min-height: 86px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  backdrop-filter: blur(10px);
}

.login-cover-metrics strong {
  font-size: 22px;
}

.login-cover-metrics span {
  color: #d9ecfb;
  font-size: 12px;
  font-weight: 800;
}

.login-card-heading {
  display: grid;
  gap: 8px;
  margin-bottom: 6px;
}

.login-card-heading img {
  width: 178px;
  max-width: 70%;
  object-fit: contain;
}

.login-card-heading span {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 230px;
  padding: 20px 14px;
  color: white;
  background:
    linear-gradient(180deg, rgba(0, 103, 177, 0.18), transparent 220px),
    var(--nav);
}

.brand {
  display: grid;
  gap: 5px;
  padding: 8px 10px 22px;
}

.brand img {
  width: 138px;
  max-width: 100%;
  margin-bottom: 6px;
  padding: 8px;
  object-fit: contain;
  background: white;
  border-radius: 8px;
}

.brand strong {
  font-size: 24px;
}

.brand span {
  color: #c5d8dd;
  font-size: 13px;
}

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

.nav-item {
  justify-content: flex-start;
  width: 100%;
  color: #dbe8eb;
  background: transparent;
  border-color: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: linear-gradient(90deg, var(--nav-2), #0a6ead);
  border-color: rgba(255, 255, 255, 0.12);
}

.app-shell {
  margin-left: 230px;
  min-height: 100vh;
}

body.compact-nav .sidebar {
  width: 150px;
  padding: 16px 8px;
}

body.compact-nav .brand {
  padding: 6px 8px 18px;
}

body.compact-nav .brand strong {
  font-size: 18px;
}

body.compact-nav .brand span {
  display: none;
}

body.compact-nav .nav-item {
  min-height: 34px;
  padding: 7px 8px;
  font-size: 13px;
  line-height: 1.15;
}

body.compact-nav .app-shell {
  margin-left: 150px;
}

body.compact-nav .filters,
body.compact-nav .view {
  width: min(1600px, calc(100vw - 180px));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px;
  color: white;
  background:
    linear-gradient(90deg, #053657 0%, #0067b1 58%, #f39a23 140%);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  font-weight: 750;
}

h2 {
  font-size: 16px;
}

.topbar p {
  margin-top: 4px;
  color: #c8d8dd;
}

.userbox,
.filters label,
.form-grid label,
.inline-control {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.userbox {
  color: #d8e5e9;
  grid-template-columns: 1fr auto;
  align-items: end;
}

.userbox label,
.userbox input {
  grid-column: 1;
}

.userbox button {
  grid-column: 2;
  grid-row: 2;
  background: #074b79;
  border-color: rgba(255, 255, 255, 0.36);
}

input,
select,
textarea,
button {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  color: var(--ink);
  background: white;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(0, 103, 177, 0.16);
  border-color: var(--accent-2);
}

textarea {
  min-width: 180px;
  resize: vertical;
}

button {
  min-height: 36px;
  padding: 8px 12px;
  color: white;
  cursor: pointer;
  background: var(--accent-2);
}

button.secondary-action {
  color: var(--accent-2);
  background: white;
  border-color: var(--accent-2);
}

button.mini-action {
  min-height: 30px;
  padding: 6px 10px;
  color: var(--accent-2);
  background: white;
  border-color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
}

button:hover {
  filter: brightness(0.96);
}

.login-card button[type="submit"] {
  min-height: 44px;
  margin-top: 4px;
  background: linear-gradient(90deg, var(--accent-2), #0b7fc8 62%, var(--accent));
  border: 0;
  border-radius: 8px;
  font-weight: 900;
}

.filters,
.view {
  width: min(1500px, calc(100vw - 262px));
  margin: 16px auto 0;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.filters .search-label {
  grid-column: span 2;
  min-width: min(100%, 260px);
}

.payments-extra-filters,
.progress-extra-filters {
  width: 100%;
  margin: 0 0 14px;
}

.progress-extra-filters {
  grid-template-columns: repeat(2, minmax(180px, 240px));
  justify-content: start;
}

.view {
  display: none;
  padding-bottom: 40px;
}

.view.active {
  display: block;
}

.advisor-only {
  display: none;
}

body.advisor-mode .advisor-only {
  display: grid;
}

body.advisor-mode .manager-dashboard,
body.advisor-mode .manager-only {
  display: none !important;
}

.advisor-dashboard {
  gap: 14px;
}

.compact-kpis {
  margin: 0;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.kpis.small {
  grid-template-columns: repeat(5, minmax(110px, 1fr));
}

.kpis article,
.panel,
.workbench {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(8, 42, 68, 0.03);
}

.kpis article {
  padding: 16px;
}

.kpis span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.kpis strong {
  display: block;
  margin-top: 7px;
  font-size: 25px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.dashboard-grid.single {
  grid-template-columns: 0.8fr 1.2fr;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 14px;
  margin: 14px 0;
}

.panel,
.workbench {
  padding: 16px;
}

.panel.inset {
  background: #fbfdfe;
}

.panel.wide {
  grid-column: 1 / -1;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.actions {
  display: flex;
  gap: 8px;
}

.row-actions {
  display: grid;
  gap: 6px;
  min-width: 84px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}

.import-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  gap: 12px;
  align-items: end;
}

.import-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.import-status.ok {
  color: var(--ok);
}

.import-status.error {
  color: var(--danger);
}

.bars {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(130px, 220px) 1fr 82px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.compact .bar-row {
  grid-template-columns: minmax(100px, 140px) 1fr 110px;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  background: #e8eef1;
  border-radius: 999px;
}

.bar-fill {
  height: 100%;
  background: var(--accent-2);
}

.bar-row:nth-child(2n) .bar-fill {
  background: var(--accent);
}

.payment-stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 0.55fr);
  gap: 18px;
  align-items: stretch;
}

.payment-stats section {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.payment-stats h3 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.weekday-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(70px, 1fr));
  align-items: end;
  min-height: 250px;
  gap: 12px;
}

.weekday-column {
  display: grid;
  grid-template-rows: auto minmax(118px, 1fr) auto;
  gap: 8px;
  min-width: 0;
}

.weekday-column-value {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-height: 50px;
  text-align: center;
}

.weekday-column-value strong {
  font-size: 24px;
  line-height: 1;
}

.weekday-column-value small,
.rank-card small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.weekday-column-track {
  position: relative;
  display: grid;
  align-items: end;
  overflow: hidden;
  border-radius: 8px;
  background: #e8eef1;
}

.weekday-column-track span {
  display: block;
  min-height: 10px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
}

.weekday-column p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.rank-grid {
  display: grid;
  gap: 10px;
}

.rank-card {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.rank-number {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  color: white;
  background: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.rank-card div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.rank-card strong,
.rank-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-card div span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.workbench {
  margin-top: 14px;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 330px);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-wrap.short {
  max-height: 360px;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: white;
}

#llamadasView table {
  min-width: 1480px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #33444d;
  background: #eef4f5;
  font-size: 12px;
}

.client-name {
  display: block;
  max-width: 260px;
  font-weight: 750;
}

.client-meta {
  display: block;
  max-width: 260px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.phone-cell strong {
  display: block;
}

.discount-input {
  min-width: 92px;
}

.paid-row {
  background: #f0fdf4;
}

.paid-row td {
  border-bottom-color: #bbf7d0;
}

.paid-status {
  color: #166534;
  border-color: #86efac;
  background: #dcfce7;
  font-weight: 750;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-width: 72px;
  justify-content: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
}

.status-pill.active {
  color: #0f766e;
  background: #ccfbf1;
}

.status-pill.closed {
  color: #475569;
  background: #e8eef1;
}

.progress {
  display: inline-flex;
  min-width: 56px;
  justify-content: flex-end;
  font-weight: 750;
}

.muted {
  color: var(--muted);
}

.saved {
  background: var(--ok);
}

@media (max-width: 1080px) {
  .login-screen {
    align-items: flex-start;
    padding: 18px;
  }

  .login-panel {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .login-cover {
    min-height: 360px;
    border-radius: 14px 14px 0 0;
  }

  .login-cover-copy h2 {
    font-size: 32px;
  }

  .login-card {
    border-radius: 0 0 14px 14px;
  }

  .sidebar {
    position: static;
    width: auto;
  }

  .brand {
    grid-template-columns: auto 1fr;
    align-items: center;
  }

  .brand img {
    width: 92px;
    margin: 0;
  }

  .brand span {
    grid-column: 2;
  }

  .app-shell {
    margin-left: 0;
  }

  .filters,
  .view {
    width: min(100vw - 20px, 1500px);
  }

  .filters,
  .dashboard-grid,
  .dashboard-grid.single,
  .split,
  .import-form,
  .kpis,
  .kpis.small {
    grid-template-columns: 1fr;
  }

  .payment-stats {
    grid-template-columns: 1fr;
  }

  .weekday-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: 220px;
  }

  .topbar {
    display: grid;
  }
}
