:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #172235;
  --muted: #4f5f78;
  --brand: #1e5bd8;
  --brand-dark: #194bae;
  --ok: #0f9d58;
  --danger: #c0392b;
  --border: #d8e0eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Segoe UI, Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 0% 0%, #d7e4ff 0, transparent 40%),
    radial-gradient(circle at 100% 100%, #d8fff1 0, transparent 40%),
    var(--bg);
  min-height: 100vh;
}

.login-page {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(100%, 420px);
}

.login-card {
  display: grid;
  gap: 16px;
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 14px 34px rgba(15, 47, 107, 0.14);
}

.login-logo {
  display: block;
  width: min(240px, 100%);
  max-height: 110px;
  margin: 0 auto 4px;
  object-fit: contain;
}

.login-card h1 {
  margin: 0;
  text-align: center;
  font-size: 1.55rem;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: #27446f;
  font-size: 0.9rem;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfdbef;
  border-radius: 7px;
  color: var(--text);
  font: inherit;
}

.login-form .btn {
  width: 100%;
  justify-content: center;
  margin-top: 2px;
}

.menu-landing {
  max-width: 620px;
  padding: 30px 24px;
  margin: 64px auto;
  text-align: center;
  color: #27446f;
}

.menu-landing h1 {
  margin: 0 0 8px;
  font-size: 1.65rem;
}

.menu-landing p {
  margin: 0;
  color: var(--muted);
}

.whatsapp-support-page {
  display: grid;
  gap: 16px;
}

.whatsapp-support-toolbar {
  margin-bottom: 0;
}

.whatsapp-support-table {
  table-layout: fixed;
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #cbd6e5;
}

.whatsapp-support-table .task-filters-row th {
  background: #fbfdff;
  padding: 6px 8px;
}

.whatsapp-support-table .task-filter {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid #cfdbef;
  border-radius: 8px;
  color: #27446f;
  background: #fff;
  font-size: 0.8rem;
}

.whatsapp-support-table .task-filter::placeholder {
  color: #8193b3;
}

.whatsapp-support-table th:nth-child(1),
.whatsapp-support-table td:nth-child(1) { width: 4%; }
.whatsapp-support-table th:nth-child(2),
.whatsapp-support-table td:nth-child(2) { width: 11%; }
.whatsapp-support-table th:nth-child(3),
.whatsapp-support-table td:nth-child(3) { width: 9%; }
.whatsapp-support-table th:nth-child(4),
.whatsapp-support-table td:nth-child(4) { width: 11%; }
.whatsapp-support-table th:nth-child(5),
.whatsapp-support-table td:nth-child(5) { width: 10%; }
.whatsapp-support-table th:nth-child(6),
.whatsapp-support-table td:nth-child(6) { width: 12%; }
.whatsapp-support-table th:nth-child(7),
.whatsapp-support-table td:nth-child(7) { width: 16%; }
.whatsapp-support-table th:nth-child(8),
.whatsapp-support-table td:nth-child(8) { width: 9%; }
.whatsapp-support-table th:nth-child(9),
.whatsapp-support-table td:nth-child(9) { width: 18%; }

.whatsapp-support-table th,
.whatsapp-support-table td {
  box-sizing: border-box;
  vertical-align: middle;
  overflow: hidden;
  padding: 5px 4px;
  border: 1px solid #cbd6e5;
  font-size: 0.7rem;
}

.whatsapp-support-table th {
  background: #eef3f9;
  color: #173b68;
  line-height: 1.2;
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
}

.whatsapp-support-table td:nth-child(1) {
  white-space: nowrap;
  font-weight: 700;
  color: #173b68;
}

.whatsapp-support-table tbody tr:nth-child(even),
.whatsapp-assigned-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.whatsapp-support-table tbody tr:hover,
.whatsapp-assigned-table tbody tr:hover {
  background: #eaf2ff;
}

.whatsapp-support-table td:nth-child(8) {
  font-size: 0.68rem;
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: anywhere;
}

.whatsapp-support-table td:nth-child(4) {
  overflow-wrap: anywhere;
}

.whatsapp-support-table td:nth-child(5) {
  overflow-wrap: anywhere;
}

.whatsapp-support-empty {
  margin: 8px 0;
}

.whatsapp-support-page .clients-table-wrap {
  overflow: hidden;
}

.whatsapp-assigned-tasks {
  margin-top: 18px;
}

.whatsapp-assigned-table {
  table-layout: fixed;
  width: 100%;
}

.whatsapp-assigned-table th,
.whatsapp-assigned-table td {
  padding: 5px 4px;
  border: 1px solid #cbd6e5;
  font-size: 0.68rem;
  overflow-wrap: anywhere;
  vertical-align: middle;
}

.whatsapp-assigned-table th:nth-child(1),
.whatsapp-assigned-table td:nth-child(1) { width: 7%; }
.whatsapp-assigned-table th:nth-child(2),
.whatsapp-assigned-table td:nth-child(2) { width: 9%; }
.whatsapp-assigned-table th:nth-child(3),
.whatsapp-assigned-table td:nth-child(3) { width: 9%; }
.whatsapp-assigned-table th:nth-child(4),
.whatsapp-assigned-table td:nth-child(4) { width: 13%; }
.whatsapp-assigned-table th:nth-child(5),
.whatsapp-assigned-table td:nth-child(5) { width: 14%; }
.whatsapp-assigned-table th:nth-child(6),
.whatsapp-assigned-table td:nth-child(6) { width: 11%; }
.whatsapp-assigned-table th:nth-child(7),
.whatsapp-assigned-table td:nth-child(7) { width: 9%; }
.whatsapp-assigned-table th:nth-child(8),
.whatsapp-assigned-table td:nth-child(8) { width: 13%; }
.whatsapp-assigned-table th:nth-child(9),
.whatsapp-assigned-table td:nth-child(9) { width: 14%; }
.whatsapp-assigned-table th:nth-child(10),
.whatsapp-assigned-table td:nth-child(10) { width: 8%; }

.whatsapp-assigned-table th {
  background: #eef3f9;
  color: #173b68;
  font-weight: 700;
  text-align: center;
}

.whatsapp-assigned-table .installation-status {
  display: inline-block;
  padding: 3px 6px;
  border-radius: 8px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: nowrap;
}

.whatsapp-assigned-table .status-pendiente {
  background: #fff2c6;
  color: #8a6200;
}

.whatsapp-assigned-table .status-finalizada,
.whatsapp-assigned-table .status-instalado {
  background: #d9f5df;
  color: #117338;
}

.whatsapp-assigned-table .status-cancelada,
.whatsapp-assigned-table .status-cancelado {
  background: #ffe0e0;
  color: #a22b2b;
}

.request-number {
  white-space: nowrap;
  font-weight: 700;
  color: #173b68;
}

.whatsapp-support-description {
  min-width: 0;
  white-space: normal;
  vertical-align: middle;
}

.whatsapp-support-description {
  overflow-wrap: anywhere;
}

.whatsapp-support-description span {
  min-width: 0;
  white-space: normal;
  font-size: 0.78rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.whatsapp-support-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 3px;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: visible;
  min-width: 78px;
}

.support-action-icon {
  width: 23px;
  height: 23px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid #cbd9ec;
  border-radius: 6px;
  background: #fff;
  color: #2166c1;
  cursor: pointer;
}

.whatsapp-support-table td:last-child {
  overflow: visible;
}

.support-action-icon:hover {
  background: #eaf2ff;
  border-color: #2166c1;
}

.support-observation-btn { color: #1b7f4b; border-color: #b9dfc8; background: #f0fff5; }
.support-status-btn { color: #a36a00; border-color: #efd49a; background: #fffaf0; }
.support-assign-btn { color: #2166c1; border-color: #bfd5f4; background: #f2f7ff; }
.support-view-btn { color: #7040a8; border-color: #d8c4ed; background: #faf5ff; }

.support-status {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: normal;
  text-align: center;
  max-width: 100%;
  box-sizing: border-box;
}

.support-status-en_espera { background: #fff1c7; color: #946200; }
.support-status-resuelto { background: #d9f5e4; color: #176b3a; }
.support-status-cancelado { background: #ffe0e0; color: #a52727; }
.support-status-asignado_tecnicos { background: #dcecff; color: #17569c; }

.support-modal-card label {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: #27446f;
  font-weight: 600;
}

.support-modal-card textarea,
.support-modal-card select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  border: 1px solid #cfdbef;
  border-radius: 8px;
  font: inherit;
}

.support-history {
  max-height: 180px;
  overflow: auto;
  margin: 8px 0 12px;
}

.support-history-item {
  padding: 8px;
  margin-bottom: 6px;
  border-left: 3px solid #2f7be8;
  background: #f4f8ff;
  font-size: 0.82rem;
  white-space: pre-wrap;
}

.whatsapp-payment-form {
  display: contents;
}

.whatsapp-payment-form input {
  display: block;
  width: 150px;
  margin: 4px 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100dvh;
  height: auto;
  overflow: visible;
}

.topbar {
  grid-column: 1 / -1;
  grid-row: 1;
}

.sidebar {
  grid-column: 1;
  grid-row: 2;
  background: linear-gradient(180deg, #2a2e35, #20242a);
  color: #fff;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  min-height: 100dvh;
  height: auto;
  border-right: 1px solid #3a3f47;
  overflow: visible;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 1.7rem;
  padding: 2px 12px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 12px;
  border-bottom: 1px solid #3a3f47;
}

.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #f5f8ff;
  background: linear-gradient(180deg, #60a6ff, #2d76dc);
  position: relative;
  flex: 0 0 44px;
}

.profile-avatar::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 24%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transform: translateX(-50%);
}

.profile-avatar::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 14%;
  width: 18px;
  height: 10px;
  border-radius: 10px 10px 2px 2px;
  background: #fff;
  transform: translateX(-50%);
}

.profile-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #f4f7ff;
}

.profile-role {
  margin: 1px 0 0;
  color: #c8d0dc;
  font-size: 0.95rem;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.menu-group {
  margin: 0;
}

.menu-summary {
  list-style: none;
}

.menu-summary::-webkit-details-marker {
  display: none;
}

.menu-group[open] > .menu-summary {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
}

.menu-group[open] > .menu-summary .menu-caret {
  transform: rotate(90deg);
}

.submenu {
  display: grid;
  gap: 0;
  background: rgba(0, 0, 0, 0.16);
}

.submenu-link {
  color: #d6dce7;
  text-decoration: none;
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  column-gap: 7px;
  padding: 6px 10px 6px 28px;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.submenu-link:hover {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.02));
  color: #fff;
}

.menu-link {
  color: #d6dce7;
  text-decoration: none;
  font-weight: 500;
  border: none;
  padding: 7px 12px;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  column-gap: 7px;
  white-space: nowrap;
}

.menu-link:hover {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.02));
  box-shadow: inset 4px 0 0 #6ccf75;
  color: #ffffff;
}

.menu-link.is-active,
.submenu-link.is-active,
.menu-group[open] > .menu-summary.is-active {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.04));
  box-shadow: inset 4px 0 0 #6ccf75;
  color: #fff;
}

.menu-link.is-active .menu-icon,
.submenu-link.is-active .menu-icon,
.menu-group[open] > .menu-summary.is-active .menu-icon {
  color: #c6f2cf;
}

.menu-link-button {
  width: 100%;
  background: transparent;
  border-left: none;
  border-right: none;
  cursor: pointer;
  font: inherit;
}

.menu-icon {
  font-size: 1.05rem;
  color: #8ea1b8;
  display: inline-flex;
  justify-content: center;
}

.menu-link:hover .menu-icon {
  color: #c6f2cf;
}

.menu-caret {
  color: #8fa1ba;
  font-size: 1.1rem;
  transition: transform 0.2s ease;
}

.menu-logout-form {
  margin: 0;
}

.menu-link-disabled {
  opacity: 0.8;
}

.container {
  grid-column: 2;
  grid-row: 2;
  max-width: 1200px;
  width: 100%;
  margin: 24px auto;
  padding: 0 20px 24px;
  overflow: visible;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.topbar-spacer {
  min-height: 1px;
}

.payment-point-summary-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 245px;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid #b9d7f2;
  border-radius: 10px;
  background: #fafdff;
  color: #174577;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 47, 107, 0.08);
}

.invoice-filter-actions {
  display: grid;
  gap: 6px;
  min-width: 245px;
}

.invoice-filter-button-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.payment-point-summary-trigger:hover {
  border-color: #2d7fff;
  background: #f1f8ff;
}

.payment-point-summary-trigger > span:nth-child(2) {
  display: grid;
  gap: 1px;
  flex: 1;
}

.payment-point-summary-trigger small {
  font-size: 0.68rem;
  font-weight: 700;
}

.payment-point-summary-trigger strong {
  color: #0f9d58;
  font-size: 1rem;
  line-height: 1.1;
}

.payment-point-summary-trigger em {
  color: #71829b;
  font-size: 0.62rem;
  font-style: normal;
}

.payment-point-summary-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: #e1f4e9;
  color: #0f9d58;
}

.payment-point-summary-modal {
  width: min(560px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(15, 47, 107, 0.25);
}

.payment-point-summary-modal::backdrop {
  background: rgba(15, 34, 62, 0.45);
}

.payment-point-summary-dialog {
  overflow: hidden;
  background: #fff;
}

.payment-point-summary-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  color: #fff;
  background: linear-gradient(135deg, #166534, #16a34a);
}

.payment-point-summary-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.payment-point-summary-header p {
  margin: 4px 0 0;
  font-size: 0.76rem;
  opacity: 0.9;
}

.payment-point-summary-close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.payment-point-summary-table-wrap {
  padding: 14px 18px 18px;
}

.payment-point-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.payment-point-summary-table th,
.payment-point-summary-table td {
  padding: 7px 8px;
  border: 1px solid #d8e0eb;
  text-align: left;
}

.payment-point-summary-table th {
  color: #27446f;
  background: #eef3f9;
  font-size: 0.72rem;
}

.payment-point-summary-table td:nth-child(2),
.payment-point-summary-table th:nth-child(2),
.payment-point-summary-table td:last-child,
.payment-point-summary-table th:last-child {
  text-align: right;
}

.payment-point-summary-table tr.is-today td {
  background: #effbf3;
  font-weight: 600;
}

.payment-point-today {
  display: inline-block;
  margin-left: 5px;
  padding: 2px 5px;
  border-radius: 4px;
  color: #166534;
  background: #dcfce7;
  font-size: 0.62rem;
}

@media (max-width: 700px) {
  .invoice-filter-actions {
    grid-column: 1 / -1;
  }

  .payment-point-summary-trigger {
    min-width: 0;
  }

  .payment-point-summary-trigger small {
    max-width: 130px;
  }
}

.user-menu {
  position: relative;
}

.user-menu summary {
  list-style: none;
}

.user-menu summary::-webkit-details-marker {
  display: none;
}

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(15, 47, 107, 0.08);
}

.user-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(180deg, #2d7fff, #1e5bd8);
  display: inline-block;
  position: relative;
}

.user-icon::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 28%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  transform: translateX(-50%);
}

.user-icon::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 15%;
  width: 13px;
  height: 7px;
  border-radius: 8px 8px 2px 2px;
  background: #fff;
  transform: translateX(-50%);
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 210px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(15, 47, 107, 0.12);
  padding: 8px;
  display: grid;
  gap: 6px;
  z-index: 20;
}

.menu-action-link,
.menu-action-btn {
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.menu-action-link:hover,
.menu-action-btn:hover {
  background: #eef3ff;
  border-color: #d2dffb;
}

.menu-action-form {
  margin: 0;
}

.dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.view-switch {
  display: inline-flex;
  border: 1px solid #cfd9ec;
  border-radius: 10px;
  overflow: hidden;
}

.view-switch a {
  text-decoration: none;
  color: #2f4e84;
  font-weight: 600;
  padding: 7px 10px;
  background: #f6f9ff;
}

.view-switch a.active {
  background: #2d66d6;
  color: #fff;
}

.compact-table-wrap {
  overflow-x: auto;
}

.compact-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.compact-stats-table thead th {
  background: #f2f6ff;
  color: #27446f;
  font-weight: 700;
  border-bottom: 1px solid #d7e1f2;
  white-space: nowrap;
}

.compact-stats-table td,
.compact-stats-table th {
  padding: 8px 9px;
  border-bottom: 1px solid #e4ebf8;
  text-align: left;
  vertical-align: middle;
}

.compact-sub {
  font-size: 0.78rem;
  color: #5a6f92;
}

.compact-cards-grid {
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 12px;
}

.compact-card {
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(25, 53, 110, 0.08);
}

.compact-head {
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.card-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.compact-head h4 {
  font-size: 0.95rem;
}

.compact-head p {
  font-size: 0.8rem;
  margin-top: 3px;
}

.compact-head .status-pill {
  font-size: 0.72rem;
  padding: 3px 8px;
  white-space: nowrap;
}

.compact-error {
  margin: 6px 12px 0;
}

.compact-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px 12px;
}

.mini-stat {
  border: 1px solid #e4ebf8;
  border-radius: 9px;
  background: #fff;
  padding: 6px 8px;
  min-width: 0;
}

.mini-stat span {
  display: block;
  font-size: 0.68rem;
  color: #5a6f92;
  margin-bottom: 2px;
}

.mini-stat strong {
  display: block;
  font-size: 0.84rem;
  color: #1e2e4f;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.mini-stat.positive span,
.mini-stat.positive strong {
  color: #12763b;
}

.mini-stat.negative span,
.mini-stat.negative strong {
  color: #a02727;
}

.mini-stat.neutral span,
.mini-stat.neutral strong {
  color: #2a4c8a;
}

.mini-stat-trend {
  display: grid;
  gap: 4px;
}

.mini-trend {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 26px;
  padding: 0;
  margin-top: 1px;
}

.trend-bar {
  flex: 1;
  min-width: 2px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, #2db770, #12763b);
  opacity: 0.95;
  position: relative;
}

.mini-stat.negative .trend-bar {
  background: linear-gradient(180deg, #e06e6e, #a02727);
}

.mini-stat.neutral .trend-bar {
  background: linear-gradient(180deg, #5a81d4, #2a4c8a);
}

.trend-bar.future {
  background: #cfd8ea;
  opacity: 0.7;
}

.trend-bar:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: #1f2d48;
  color: #fff;
  font-size: 0.62rem;
  line-height: 1.1;
  padding: 3px 5px;
  border-radius: 5px;
  white-space: nowrap;
  z-index: 5;
}

.mini-trend-label {
  display: block;
  font-size: 0.64rem;
  color: #5f7396;
  line-height: 1.1;
}

.icon-action {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid #d7e1f2;
  background: #fff;
  color: #2d66d6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.icon-action:hover {
  background: #edf3ff;
  border-color: #bdd0f5;
  color: #1f4ea9;
}

.icon-action:disabled,
.icon-action.disabled {
  background: #f3f5f9;
  color: #8d99ad;
  border-color: #d9e1ec;
  cursor: not-allowed;
  pointer-events: none;
}

.icon-action.is-loading i {
  animation: spin-icon 1s linear infinite;
}

.inline-action {
  width: 32px;
  height: 32px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #2d66d6;
  font-weight: 600;
  margin-bottom: 6px;
}

.back-link:hover {
  color: #1f4ea9;
}

.clients-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.clients-page-head h3 {
  margin: 0 0 4px;
}

.filtered-summary {
  margin: 4px 0 8px;
  color: #4f5f78;
  font-size: 0.9rem;
}

.filtered-summary strong {
  color: #1f4ea9;
}

.clients-table th {
  background: #f2f6ff;
  color: #27446f;
  font-weight: 700;
  font-size: 0.9rem;
}

.clients-table td,
.clients-table th {
  vertical-align: middle;
  padding: 8px 10px;
}

.clients-table tbody td {
  padding-top: 7px;
  padding-bottom: 7px;
}

.internet-plans-table th {
  background: #eef3f9;
  color: #27446f;
  font-weight: 700;
  font-size: 0.78rem;
  text-align: left;
  white-space: nowrap;
}

.internet-plans-table td,
.internet-plans-table th {
  vertical-align: middle;
  height: 30px;
  padding: 4px 8px;
  border: 1px solid #d7dee9;
  font-size: 0.8rem;
}

.internet-plans-table {
  width: 100%;
  border: 1px solid #cbd6e5;
  border-collapse: collapse;
  table-layout: fixed;
}

.internet-plans-table tbody tr:hover {
  background: #f4f8ff;
}

.internet-plans-table tbody tr:nth-child(even) {
  background: #fbfdff;
}

.internet-plans-table .actions-cell {
  white-space: nowrap;
}

.table-filters-row th {
  background: #fbfdff;
  padding-top: 6px;
  padding-bottom: 6px;
}

.table-filter-input {
  width: 100%;
  min-width: 110px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #cfdbef;
  background: #fff;
  color: #27446f;
  font-size: 0.8rem;
}

.table-filter-input::placeholder {
  color: #8193b3;
}

.table-filter-input:focus {
  outline: none;
  border-color: #2d66d6;
  box-shadow: 0 0 0 3px rgba(45, 102, 214, 0.12);
}

.type-pill,
.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.1;
}

.type-pill.positive,
.status-chip.positive {
  background: #dff7e3;
  color: #12763b;
}

.type-pill.negative,
.status-chip.negative {
  background: #ffe3e3;
  color: #a02727;
}

.type-pill.neutral,
.status-chip.neutral {
  background: #e8f1ff;
  color: #244d95;
}

@keyframes spin-icon {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
}

.mikrotik-stat-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  overflow: hidden;
  box-shadow: 0 10px 22px rgba(25, 53, 110, 0.09);
  display: flex;
  flex-direction: column;
}

.mikrotik-stat-head {
  padding: 14px 16px;
  border-bottom: 1px solid #e4ebf8;
  background: linear-gradient(90deg, #edf3ff, #f5f8ff);
}

.mikrotik-stat-head h4 {
  margin: 0;
  font-size: 1.03rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1a3470;
}

.mikrotik-stat-head p {
  margin: 4px 0 0;
  color: #4f6291;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-row {
  margin-top: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 700;
}

.status-pill.online {
  background: #dff7e3;
  color: #12763b;
}

.status-pill.offline {
  background: #ffe3e3;
  color: #a02727;
}

.stats-error {
  margin-top: 6px;
  color: #9b3131;
  font-size: 0.8rem;
}

.mikrotik-stat-list {
  display: grid;
  gap: 10px;
  padding: 14px 16px 16px;
  flex: 1;
}

.stat-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid #e4ebf8;
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #304366;
  min-width: 0;
}

.stat-label i {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.stat-label span {
  color: #4f5f78;
  overflow-wrap: anywhere;
}

.stat-item strong {
  text-align: right;
  color: #1e2e4f;
  max-width: 170px;
  overflow-wrap: anywhere;
}

.stat-item.positive .stat-label span,
.stat-item.positive strong {
  color: #12763b;
}

.stat-item.negative .stat-label span,
.stat-item.negative strong {
  color: #a02727;
}

.stat-item.neutral .stat-label span,
.stat-item.neutral strong {
  color: #2a4c8a;
}

.tone-temp .stat-label i {
  background: #ffe5d9;
  color: #bf3b16;
}

.tone-model .stat-label i {
  background: #e2e9ff;
  color: #2c4fb8;
}

.tone-cpu .stat-label i {
  background: #d9f2ff;
  color: #096090;
}

.tone-memory .stat-label i {
  background: #efe4ff;
  color: #6c3eb3;
}

.tone-active .stat-label i {
  background: #dff7e3;
  color: #12763b;
}

.tone-disabled .stat-label i {
  background: #ffe3e3;
  color: #a02727;
}

.tone-conn .stat-label i {
  background: #ffeccf;
  color: #9f5c00;
}

.tone-access .stat-label i {
  background: #e0f2ff;
  color: #0e5f89;
}

.tone-source .stat-label i {
  background: #e8f1ff;
  color: #244d95;
}

.tone-leases .stat-label i {
  background: #dff6ff;
  color: #0b628c;
}

.tone-morosos .stat-label i {
  background: #ffe1e1;
  color: #a11f1f;
}

.section-head {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.add-mikrotik-panel {
  width: 100%;
}

.add-mikrotik-panel > summary {
  list-style: none;
  display: inline-block;
}

.add-mikrotik-panel > summary::-webkit-details-marker {
  display: none;
}

.add-mikrotik-body {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: #fbfcff;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

.router-form-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}

.full-row {
  grid-column: 1 / -1;
  justify-self: start;
}

.edit-mikrotik-box {
  margin: 14px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: #fbfcff;
}

.form-actions {
  display: flex;
  gap: 10px;
}

.inline-action-form {
  display: inline-flex;
  margin: 0;
}

.client-actions-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.btn-muted {
  background: #79879c;
}

.btn-muted:hover {
  background: #657389;
}

.actions-col {
  text-align: right;
}

.actions-cell {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  cursor: pointer;
  text-decoration: none;
}

.icon-btn i {
  font-size: 0.95rem;
}

.icon-btn.edit {
  color: #1e5bd8;
}

.icon-btn.delete {
  color: #c0392b;
}

.icon-btn:hover {
  background: #f0f4ff;
}

.icon-btn.disabled,
.icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  background: #f5f7fb;
}

.hero {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 8px 22px rgba(15, 47, 107, 0.08);
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 8px 22px rgba(15, 47, 107, 0.06);
}

.narrow {
  max-width: 420px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.staff-create-card {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(420px, 1.2fr);
  gap: 24px;
}

.staff-page {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(300px, .8fr);
  gap: 28px;
}

.staff-directory {
  border-left: 1px solid var(--border);
  padding-left: 24px;
}

.staff-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.staff-section-heading h2 {
  margin: 0;
}

.staff-user-cards {
  display: grid;
  gap: 8px;
}

.staff-user-card {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 12px;
  text-align: left;
  color: var(--text);
  background: #f7f9fc;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.staff-user-card:hover,
.staff-user-card.is-selected {
  border-color: var(--brand);
  background: #eef4ff;
}

.staff-user-card-name {
  font-weight: 700;
}

.staff-access-panel {
  margin-top: 0;
}

.staff-access-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 16px;
}

.staff-access-grid .staff-permissions {
  grid-column: 1 / -1;
}

.staff-access-box {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.staff-access-grid > #staff-save-button {
  grid-column: 1 / -1;
  width: max-content;
}

.staff-create-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.staff-create-form > button {
  width: max-content;
}

.staff-permissions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px 14px;
  margin: 4px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.staff-permissions legend,
.staff-access-form legend {
  padding: 0 6px;
  font-weight: 700;
}

.staff-users-section {
  grid-column: 2;
}

.staff-user-list {
  display: grid;
  gap: 12px;
}

.staff-user-row,
.staff-access-row {
  display: table-row;
}

.staff-access-row td {
  background: #f7f9fc;
  padding: 14px;
}

.staff-access-form {
  grid-template-columns: 1fr;
}

.staff-access-form fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

@media (max-width: 1000px) {
  .staff-page,
  .staff-access-grid {
    grid-template-columns: 1fr;
  }

  .staff-directory {
    border-left: none;
    border-top: 1px solid var(--border);
    padding: 20px 0 0;
  }

  .staff-access-grid .staff-permissions {
    grid-column: auto;
  }
}

.form-grid {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
}

.btn:hover {
  background: var(--brand-dark);
}

.btn-danger {
  background: #c0392b;
}

.btn-danger:hover {
  background: #a92f22;
}

.btn-success {
  background: #12763b;
}

.btn-success:hover {
  background: #0f6130;
}

.btn-ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.6);
  padding: 8px 10px;
}

.btn-small {
  padding: 5px 9px;
  font-size: 0.82rem;
  line-height: 1.1;
}

.inline-form {
  display: inline;
}

.table-wrap {
  overflow: hidden;
}

.clients-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.clients-list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.clients-zone-bar,
.clients-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  background: #f0f2f4;
  margin-bottom: 10px;
}

.zone-select-wrap {
  flex: 0 1 420px;
  min-width: 240px;
  max-width: 420px;
}

.zone-select,
.bulk-action-select {
  width: 100%;
  background: #fff;
}

.bulk-action-label {
  margin: 0;
  font-weight: 600;
}

.bulk-action-select {
  flex: 0 1 460px;
  min-width: 260px;
  max-width: 460px;
}

.bulk-run-btn {
  background: #0c9cd8;
}

.bulk-run-btn:hover {
  background: #0a85b8;
}

.bulk-selected-count {
  color: #1f2f45;
  font-weight: 500;
}

.client-create-panel {
  border: 1px solid var(--border);
  background: #f0f2f4;
  margin-bottom: 12px;
}

.client-create-head {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.client-create-head h3 {
  margin: 0;
  color: #12498d;
}

.client-create-head i {
  color: #2f7be8;
}

.client-create-tabs {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: #e7edf7;
}

.client-tab {
  border: none;
  border-right: 1px solid #ccd8ea;
  background: transparent;
  padding: 10px 12px;
  color: #274364;
  cursor: pointer;
  font-weight: 600;
}

.client-tab.is-active {
  background: #2f7be8;
  color: #fff;
}

.client-create-body {
  padding: 14px 12px;
}

.client-create-body h4 {
  margin-top: 0;
  color: #1a3455;
}

.client-form-panel + .client-form-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #d7e0ea;
}

.client-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 12px 18px;
}

.client-field-grid label {
  color: #263f5f;
}

.client-create-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
}

.clients-toolbar {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  background: #2f7be8;
  border: 1px solid #2465c6;
  border-radius: 8px;
  overflow: visible;
  margin-bottom: 10px;
}

.toolbar-segment {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.24);
  color: #fff;
}

.toolbar-segment:last-child {
  border-right: none;
}

.toolbar-select-label {
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.toolbar-select {
  min-width: 62px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: #296ed1;
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
}

.toolbar-actions {
  gap: 0;
  padding: 0;
}

.toolbar-icon-btn {
  border: none;
  border-right: 1px solid rgba(255, 255, 255, 0.24);
  background: transparent;
  color: #fff;
  height: 100%;
  min-height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.toolbar-icon-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

.toolbar-actions {
  flex-wrap: wrap;
  overflow: visible;
  align-items: stretch;
}

.toolbar-actions .toolbar-icon-btn {
  white-space: nowrap;
}

.general-client-search {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: 12px;
  padding: 0 12px;
  color: #1f2f45;
}

.general-client-search input {
  width: 260px;
  min-width: 180px;
  border: 1px solid #c8d5e5;
  border-radius: 6px;
  padding: 8px 10px;
  color: #1f2f45;
  background: #fff;
}

.general-client-search input:focus {
  outline: 2px solid rgba(47, 123, 232, 0.35);
  outline-offset: 1px;
}

.clients-bulk-bar .general-client-search {
  margin-left: 12px;
}

.table-columns-menu {
  position: relative;
  z-index: 75;
}

.table-columns-menu > summary {
  list-style: none;
}

.table-columns-menu > summary::-webkit-details-marker {
  display: none;
}

.table-columns-menu[open] .table-menu-btn {
  background: rgba(0, 0, 0, 0.12);
}

.table-menu-btn .caret {
  font-size: 0.78rem;
}

.tools-menu {
  position: relative;
  z-index: 76;
}

.tools-menu > summary {
  list-style: none;
}

.tools-menu > summary::-webkit-details-marker {
  display: none;
}

.tools-menu[open] .tools-menu-btn {
  background: rgba(0, 0, 0, 0.12);
}

.tools-menu-btn {
  background: #0ea5cf;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.tools-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 70;
  width: 390px;
  max-height: 64vh;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #2c3e50;
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(15, 38, 76, 0.28);
  padding: 0;
}

.tools-item {
  width: 100%;
  border: none;
  border-bottom: 1px solid #e3e8f0;
  background: #fff;
  color: #1e2f45;
  text-align: left;
  padding: 8px 10px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tools-item:first-child {
  background: #45b85a;
  color: #fff;
  font-weight: 700;
}

.tools-item:hover {
  background: #f2f6fb;
}

.tools-item:first-child:hover {
  background: #3aa34f;
}

.tools-item:last-child {
  border-bottom: none;
}

.table-columns-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  min-width: 260px;
  max-height: 62vh;
  overflow-y: auto;
  background: #2f7be8;
  border: 1px solid #2465c6;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 10px 22px rgba(16, 42, 94, 0.3);
}

.table-columns-hint {
  margin: 0 0 8px;
  color: #d8e8ff;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.table-columns-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 600;
  margin-bottom: 0;
}

.table-columns-panel input[type='checkbox'] {
  width: 15px;
  height: 15px;
}

.column-order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 2px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
}

.column-order-item.is-dragging {
  opacity: 0.55;
  background: rgba(255, 255, 255, 0.12);
}

.column-order-item:last-child {
  border-bottom: none;
}

.column-order-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.column-order-actions button {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.column-order-actions button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.column-drag-handle {
  cursor: grab;
}

.column-drag-handle:active {
  cursor: grabbing;
}

.clients-column-filter-row th {
  background: #fbfdff;
  padding: 5px;
}

.clients-column-filter-row {
  display: table-row;
}

.client-column-filter {
  box-sizing: border-box;
  width: 100%;
  min-width: 70px;
  padding: 5px 6px;
  border: 1px solid #cfdbef;
  border-radius: 5px;
  background: #fff;
  color: #27446f;
  font: inherit;
  font-size: 0.75rem;
}

.client-column-filter:focus {
  outline: none;
  border-color: #2d66d6;
  box-shadow: 0 0 0 2px rgba(45, 102, 214, 0.12);
}

.page-feedback {
  margin: 8px 0 10px;
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid transparent;
  white-space: pre-line;
  line-height: 1.4;
  font-weight: 600;
}

.page-feedback-success {
  background: #e8f8ee;
  border-color: #8fd2a7;
  color: #1d6a3b;
  box-shadow: 0 4px 10px rgba(31, 105, 64, 0.12);
}

.page-feedback-error {
  background: #fdeced;
  border-color: #e3a7ac;
  color: #9f2f37;
  box-shadow: 0 4px 10px rgba(120, 31, 43, 0.08);
}

table {
  width: 100%;
  border-collapse: collapse;
}

#clients-master-table {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}

#clients-master-table th,
#clients-master-table td {
  height: 30px;
  padding: 3px 4px;
  border: 1px solid #d7dee9;
  text-align: left;
  vertical-align: middle;
  font-size: 0.68rem;
  line-height: 1.1;
  white-space: normal;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#clients-master-table th[data-col],
#clients-master-table td[data-col] {
  min-width: 0;
}

#clients-master-table th[data-col="nombre"],
#clients-master-table td[data-col="nombre"] {
  width: 12%;
}

#clients-master-table th[data-col="router"],
#clients-master-table td[data-col="router"],
#clients-master-table th[data-col="planInternet"],
#clients-master-table td[data-col="planInternet"] {
  width: 12%;
}

/* Keep the eight primary columns readable when the row detail is expanded. */
#clients-master-table th[data-col="nombre"],
#clients-master-table td[data-col="nombre"] { width: 11%; }

#clients-master-table th[data-col="ip"],
#clients-master-table td[data-col="ip"] { width: 10%; }

#clients-master-table th[data-col="router"],
#clients-master-table td[data-col="router"] { width: 13%; }

#clients-master-table th[data-col="estado"],
#clients-master-table td[data-col="estado"] { width: 7%; }

#clients-master-table th[data-col="telefono"],
#clients-master-table td[data-col="telefono"] { width: 11%; }

#clients-master-table th[data-col="planInternet"],
#clients-master-table td[data-col="planInternet"] { width: 17%; }

#clients-master-table th[data-col="planPrecio"],
#clients-master-table td[data-col="planPrecio"] { width: 9%; }

#clients-master-table th[data-col="serviciosAdicionales"],
#clients-master-table td[data-col="serviciosAdicionales"] { width: 15%; }

#clients-master-table th[data-col="nombre"],
#clients-master-table th[data-col="ip"],
#clients-master-table th[data-col="router"],
#clients-master-table th[data-col="estado"],
#clients-master-table th[data-col="telefono"],
#clients-master-table th[data-col="planInternet"],
#clients-master-table th[data-col="planPrecio"],
#clients-master-table th[data-col="serviciosAdicionales"],
#clients-master-table td[data-col="nombre"],
#clients-master-table td[data-col="ip"],
#clients-master-table td[data-col="router"],
#clients-master-table td[data-col="estado"],
#clients-master-table td[data-col="telefono"],
#clients-master-table td[data-col="planInternet"],
#clients-master-table td[data-col="planPrecio"],
#clients-master-table td[data-col="serviciosAdicionales"] {
  word-break: normal;
  overflow-wrap: normal;
}

#clients-master-table th[data-col="planPrecio"],
#clients-master-table th[data-col="serviciosAdicionales"] {
  white-space: normal;
  line-height: 1.15;
}

#clients-master-table th[data-col="accion"],
#clients-master-table td[data-col="accion"] {
  width: 7%;
}

#clients-master-table th[data-col="ip"],
#clients-master-table td[data-col="ip"] { width: 10%; }

#clients-master-table th[data-col="municipio"],
#clients-master-table td[data-col="municipio"] { width: 9%; }

#clients-master-table th[data-col="router"],
#clients-master-table td[data-col="router"] { width: 12%; }

#clients-master-table th[data-col="servicio"],
#clients-master-table td[data-col="servicio"],
#clients-master-table th[data-col="estado"],
#clients-master-table td[data-col="estado"] { width: 8%; }

#clients-master-table th[data-col="telefono"],
#clients-master-table td[data-col="telefono"] { width: 10%; }

#clients-master-table th[data-col="planInternet"],
#clients-master-table td[data-col="planInternet"] { width: 12%; }

.clients-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.clients-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 4px 4px;
}

.clients-pagination-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.clients-page-numbers {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.clients-page-numbers .page-number-btn {
  min-width: 32px;
  padding: 5px 8px;
}

.clients-page-numbers .page-number-btn:disabled {
  opacity: 1;
  background: #2f7be8;
  border-color: #2f7be8;
  color: #fff;
  cursor: default;
}

.clients-page-ellipsis {
  color: #27446f;
  padding: 0 2px;
}

.clients-pagination .pagination-btn {
  border: 1px solid #c8d5e5;
  border-radius: 4px;
  background: #fff;
  color: #27446f;
  padding: 5px 10px;
  cursor: pointer;
}

.clients-pagination .pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#clients-master-table th {
  height: 26px;
  background: #eef3f9;
  color: #27446f;
  font-weight: 700;
}

#clients-master-table tbody tr:nth-child(even) {
  background: #fbfdff;
}

.col-expand,
.row-expand-cell {
  width: 38px;
  min-width: 38px;
  text-align: center;
}

.row-expand-btn {
  width: 22px;
  height: 22px;
  border: 1px solid #1b6dcc;
  border-radius: 50%;
  background: #2f7be8;
  color: #fff;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.row-expand-btn:hover {
  background: #2465c6;
}

.client-main-row.is-expanded {
  background: #f8fbff;
}

.client-extra-row td {
  white-space: normal;
  max-width: none;
  background: #f8fbff;
}

.client-extra-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 18px;
  align-items: start;
  width: 100%;
  font-size: 0.84rem;
}

.client-extra-grid > div {
  min-width: 0;
  padding: 3px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow-wrap: anywhere;
}

.client-extra-grid strong {
  color: #214872;
}

.row-action-icons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.floating-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 42, 0.45);
  z-index: 250;
  display: grid;
  place-items: center;
  padding: 20px;
}

.floating-modal[hidden] {
  display: none !important;
}

.floating-modal-card {
  width: min(520px, 100%);
  background: #fff;
  border: 1px solid #d6dfeb;
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(12, 30, 58, 0.28);
  padding: 16px;
}

.floating-modal-card h4 {
  margin: 0 0 10px;
  color: #123d71;
}

.modal-check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 10px 0;
  color: #1f3858;
}

.modal-check-row input {
  width: 16px;
  height: 16px;
}

.floating-modal-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.invoice-duplicate-card {
  width: min(650px, 100%);
  padding: 0;
  overflow: hidden;
}

.invoice-duplicate-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  background: linear-gradient(135deg, #123f73, #236fbd);
  color: #fff;
}

.invoice-duplicate-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 1.35rem;
}

.invoice-duplicate-kicker {
  display: block;
  margin-bottom: 3px;
  color: #cfe4ff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.invoice-duplicate-header h3 {
  margin: 0;
  color: #fff;
  font-size: 1.2rem;
}

.invoice-duplicate-message {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 16px 20px 12px;
  padding: 11px 12px;
  border: 1px solid #cfe0f5;
  border-radius: 8px;
  background: #f4f8fd;
  color: #294665;
  line-height: 1.4;
}

.invoice-duplicate-message i {
  color: #236fbd;
  font-size: 1.05rem;
}

.invoice-duplicate-details {
  display: grid;
  gap: 10px;
  max-height: min(42vh, 330px);
  overflow-y: auto;
  padding: 0 20px 4px;
}

.invoice-duplicate-item {
  padding: 13px 14px;
  border: 1px solid #d7e2ef;
  border-radius: 9px;
  background: #fff;
}

.invoice-duplicate-item-head,
.invoice-duplicate-meta,
.invoice-duplicate-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.invoice-duplicate-item-head {
  color: #173f6d;
  font-size: 0.97rem;
}

.invoice-duplicate-status {
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff3cd;
  color: #8a5d00;
  font-size: 0.7rem;
  font-weight: 700;
}

.invoice-duplicate-meta {
  margin-top: 9px;
  padding-bottom: 9px;
  border-bottom: 1px solid #e7edf5;
  color: #60748d;
  font-size: 0.82rem;
}

.invoice-duplicate-meta strong {
  color: #173f6d;
  font-size: 1rem;
}

.invoice-duplicate-items {
  display: grid;
  gap: 6px;
  margin-top: 9px;
}

.invoice-duplicate-line {
  color: #38516e;
  font-size: 0.8rem;
}

.invoice-duplicate-line span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.invoice-duplicate-line strong {
  flex: 0 0 auto;
  color: #284e7b;
}

.invoice-duplicate-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 20px 0;
  color: #63778f;
  font-size: 0.78rem;
}

.invoice-duplicate-note i {
  color: #236fbd;
}

.invoice-duplicate-card .floating-modal-actions {
  margin-top: 16px;
  padding: 13px 20px;
  border-top: 1px solid #e0e8f2;
  background: #f7f9fc;
}

@media (max-width: 620px) {
  .invoice-duplicate-card .floating-modal-actions {
    flex-direction: column-reverse;
  }

  .invoice-duplicate-card .floating-modal-actions .btn {
    width: 100%;
  }
}

.icon-btn.whatsapp {
  color: #1db954;
}

.icon-btn.invoice {
  color: #1f4f85;
  border: 1px solid #cfd8e6;
  background: #fff;
}

.icon-btn.invoice:hover {
  background: #eef4ff;
}

.alert {
  color: var(--danger);
  font-weight: 600;
}

.ok {
  color: var(--ok);
  font-weight: 600;
}

.muted {
  color: var(--muted);
}

@media (max-width: 860px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    grid-template-columns: 1fr;
    width: 100%;
    min-width: 0;
  }

  .sidebar,
  .container {
    grid-column: 1;
  }

  .sidebar {
    grid-row: 2;
    position: static;
    height: auto;
    min-height: 0;
    align-self: start;
  }

  .container {
    grid-row: 3;
    min-width: 0;
    margin: 12px 0;
    padding: 0 12px 20px;
  }

  .menu {
    gap: 0;
  }

  .menu-link {
    grid-template-columns: 24px 1fr auto;
  }

  .topbar {
    justify-content: flex-end;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .router-form-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .compact-kpis {
    grid-template-columns: 1fr;
  }

  .dashboard-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .clients-page-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .clients-list-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .clients-toolbar {
    width: 100%;
  }

  .clients-zone-bar,
  .clients-bulk-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .client-field-grid {
    grid-template-columns: 1fr;
  }

  .zone-select-wrap,
  .bulk-action-select {
    width: 100%;
    max-width: none;
  }

  .toolbar-segment {
    border-right: none;
    width: 100%;
  }

  .toolbar-actions {
    justify-content: flex-start;
  }

  .card,
  .hero {
    min-width: 0;
    padding: 14px;
  }

  .table-wrap,
  .compact-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .clients-table-wrap {
    overflow-x: hidden;
  }

  .tools-panel {
    left: auto;
    right: 0;
    width: min(390px, calc(100vw - 24px));
  }

  .login-page {
    padding: 16px;
  }

  .login-card {
    padding: 24px 20px;
  }

  .menu-landing {
    margin: 24px auto;
    padding: 20px 12px;
  }
}
