:root {
  color-scheme: light;
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --surface-muted: #eef2f4;
  --surface-inverse: #071a2b;
  --text-inverse: #ffffff;
  --muted-inverse: #b9c8d4;
  --text: #102a43;
  --text-strong: #071a2b;
  --muted: #5f7285;
  --muted-strong: #40566b;
  --line: #d7e0e6;
  --line-strong: #bdcbd5;
  --sidebar: #102f49;
  --sidebar-hover: #183d5a;
  --sidebar-text: #d7e4ee;
  --sidebar-muted: #9eb2c2;
  --primary: #1769e0;
  --primary-hover: #0f58c3;
  --primary-soft: #eaf2ff;
  --success: #087f5b;
  --success-soft: #e9f8f1;
  --warning: #9a6100;
  --warning-soft: #fff7df;
  --danger: #c82d43;
  --danger-soft: #fff0f2;
  --info: #175fa8;
  --info-soft: #edf5ff;
  --shadow-xs: 0 1px 2px rgba(10, 31, 49, 0.04);
  --shadow-sm: 0 8px 24px rgba(10, 31, 49, 0.06);
  --shadow-md: 0 18px 48px rgba(10, 31, 49, 0.11);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-width: 276px;
  --content-width: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #09141d;
    --surface: #101e29;
    --surface-soft: #142530;
    --surface-muted: #1a2c38;
    --surface-inverse: #061a2a;
    --text-inverse: #f7fbff;
    --muted-inverse: #b8c9d5;
    --text: #dbe8f1;
    --text-strong: #f5f9fc;
    --muted: #9cb0bf;
    --muted-strong: #becdd8;
    --line: #29404f;
    --line-strong: #3b5668;
    --sidebar: #081b2b;
    --sidebar-hover: #122f45;
    --sidebar-text: #dce8f0;
    --sidebar-muted: #91a9ba;
    --primary: #5d9dff;
    --primary-hover: #80b2ff;
    --primary-soft: #142d4d;
    --success: #54d2a3;
    --success-soft: #12372d;
    --warning: #f2bf5b;
    --warning-soft: #3a2c13;
    --danger: #ff7c8f;
    --danger-soft: #3d1c24;
    --info: #73b5f4;
    --info-soft: #142e46;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.18);
    --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 18px 48px rgba(0, 0, 0, 0.3);
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body.app-booting > * {
  visibility: hidden;
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
summary,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 32%, transparent);
  outline-offset: 2px;
}

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

h1,
h2,
h3,
strong {
  color: var(--text-strong);
}

svg {
  display: block;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.2;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

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

.button-primary {
  background: var(--primary);
  color: #fff;
}

.button-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.button-secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

.button-secondary:hover:not(:disabled) {
  background: var(--surface-soft);
}

.button-danger {
  background: var(--danger);
  color: #fff;
}

.button-danger:hover:not(:disabled) {
  filter: brightness(0.93);
}

.button-small {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 13px;
}

.button-full {
  width: 100%;
}

.button-loader {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.button.is-loading .button-loader {
  display: block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Acceso */
.auth-screen {
  display: grid;
  min-height: 100vh;
  padding: clamp(18px, 4vw, 48px);
  place-items: center;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--primary) 5%, transparent) 1px, transparent 1px),
    linear-gradient(color-mix(in srgb, var(--primary) 5%, transparent) 1px, transparent 1px),
    var(--bg);
  background-size: 44px 44px;
}

.auth-panel {
  width: min(100%, 1000px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.auth-brand {
  display: flex;
  min-height: 68px;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.auth-brand strong,
.auth-brand small,
.brand-name strong,
.brand-name small {
  display: block;
}

.auth-brand strong {
  font-size: 16px;
}

.auth-brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.brand-logo-wrap {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  overflow: hidden;
  border-radius: 11px;
  background: var(--primary-soft);
}

.brand-logo-wrap img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: brightness(0) saturate(100%) invert(35%) sepia(98%) saturate(1608%) hue-rotate(203deg) brightness(91%);
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  align-items: stretch;
}

.auth-visual {
  display: grid;
  min-height: 510px;
  place-items: center;
  padding: 32px;
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
}

.auth-visual img {
  width: min(100%, 500px);
  max-height: 420px;
  object-fit: contain;
}

.auth-content {
  display: flex;
  padding: clamp(30px, 5vw, 54px);
  flex-direction: column;
  justify-content: center;
}

.section-kicker,
.content-eyebrow,
.sidebar-eyebrow {
  color: var(--success);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.085em;
  text-transform: uppercase;
}

.auth-content h1 {
  margin: 7px 0 10px;
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.auth-intro {
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 15px;
}

.session-form label,
.report-form-grid label,
.unlink-confirm-label {
  display: grid;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 13px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-strong);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input,
select {
  min-height: 48px;
  padding: 10px 12px;
}

textarea {
  min-height: 140px;
  padding: 12px 14px;
  line-height: 1.55;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 78%, transparent);
}

#pairing-code {
  min-height: 54px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.field-help {
  margin: 7px 0 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.form-message {
  min-height: 0;
  margin: 10px 0 0;
  color: var(--muted-strong);
  font-size: 13px;
}

.form-message:empty {
  display: none;
}

.form-message.is-error,
.form-message.is-success,
.form-message.is-info {
  padding: 10px 12px;
  border: 1px solid;
  border-radius: var(--radius-sm);
}

.form-message.is-error {
  border-color: color-mix(in srgb, var(--danger) 32%, var(--line));
  background: var(--danger-soft);
  color: var(--danger);
}

.form-message.is-success {
  border-color: color-mix(in srgb, var(--success) 32%, var(--line));
  background: var(--success-soft);
  color: var(--success);
}

.form-message.is-info {
  border-color: color-mix(in srgb, var(--info) 28%, var(--line));
  background: var(--info-soft);
  color: var(--info);
}

.auth-security-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 12px;
}

.auth-security-note svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--success);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Estructura autenticada */
.app-layout {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 80;
  display: flex;
  width: var(--sidebar-width);
  padding: 18px;
  flex-direction: column;
  background: var(--sidebar);
  color: var(--sidebar-text);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 2px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
}

.brand-logo-wrap-dark {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.09);
}

.brand-logo-wrap-dark img {
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.brand-name {
  min-width: 0;
}

.brand-name strong {
  color: #fff;
  font-size: 16px;
}

.brand-name small {
  color: var(--sidebar-muted);
  font-size: 11px;
}

.sidebar-drawer {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
}

.sidebar-header > div {
  min-width: 0;
}

.customer-avatar {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: #e8f8f0;
  color: #087f5b;
  font-size: 14px;
  font-weight: 850;
}

.sidebar-eyebrow {
  display: block;
  color: #68dbb0;
  font-size: 9px;
}

.sidebar-header h2 {
  overflow: hidden;
  margin: 2px 0 1px;
  color: #fff;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#sidebar-customer-subtitle {
  overflow: hidden;
  margin: 0;
  color: var(--sidebar-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu {
  display: grid;
  gap: 5px;
  margin-top: 16px;
}

.menu-link {
  display: flex;
  width: 100%;
  min-height: 54px;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--sidebar-text);
  cursor: pointer;
  text-align: left;
  transition: background-color 150ms ease, color 150ms ease;
}

.menu-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.menu-link.active {
  border-color: rgba(255, 255, 255, 0.76);
  background: #fff;
  color: #102a43;
  box-shadow: var(--shadow-sm);
}

.menu-icon {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
}

.menu-link.active .menu-icon {
  background: #e9f8f1;
  color: #087f5b;
}

.menu-icon svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-link > span:last-child {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.menu-link strong {
  color: inherit;
  font-size: 13px;
}

.menu-link small {
  overflow: hidden;
  color: var(--sidebar-muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-link.active small {
  color: #5f7285;
}

.account-security-menu {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
  color: var(--sidebar-muted);
  font-size: 11px;
}

.account-security-menu summary {
  padding: 8px 4px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  text-align: center;
}

.account-security-menu summary::-webkit-details-marker {
  display: none;
}

.account-security-content p {
  margin: 4px 2px 9px;
  line-height: 1.4;
}

.unlink-entry-btn {
  width: 100%;
  min-height: 39px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 11px;
  text-align: left;
}

.unlink-entry-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.content {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 28px clamp(22px, 4vw, 52px) 52px;
}

.content-header {
  display: flex;
  max-width: var(--content-width);
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.content-eyebrow {
  margin-bottom: 4px;
}

.content-header h1 {
  margin: 0;
  font-size: clamp(30px, 3.6vw, 40px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.connection-pill {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border: 1px solid color-mix(in srgb, var(--success) 28%, var(--line));
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.connection-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 13%, transparent);
}

.view {
  display: none;
  max-width: var(--content-width);
}

.view.active {
  display: block;
}

.surface-card {
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin: 3px 0 3px;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.compact-heading {
  align-items: center;
  margin-bottom: 18px;
}

.icon-button {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted-strong);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--surface-soft);
  color: var(--text-strong);
}

/* Inicio */
.dashboard {
  display: grid;
  gap: 16px;
}

.dashboard-hero {
  min-width: 0;
}

.service-status-card {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.65fr);
  gap: 12px;
}

.service-state,
.service-promise {
  position: relative;
  display: grid;
  min-height: 150px;
  align-content: center;
  overflow: hidden;
  padding: 22px;
  border: 1px solid;
  border-radius: var(--radius-md);
}

.service-state::after {
  position: absolute;
  top: 50%;
  right: -44px;
  width: 140px;
  height: 140px;
  border: 17px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 0 0 17px currentColor;
  content: "";
  opacity: 0.055;
  transform: translateY(-50%);
}

.service-state span,
.service-promise span {
  margin-bottom: 5px;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.service-state strong,
.service-promise strong {
  color: inherit;
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.service-state--activo {
  border-color: color-mix(in srgb, var(--success) 28%, var(--line));
  background: var(--success-soft);
  color: var(--success);
}

.service-state--mora {
  border-color: color-mix(in srgb, var(--warning) 32%, var(--line));
  background: var(--warning-soft);
  color: var(--warning);
}

.service-state--corte,
.service-state--suspendido {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
  background: var(--danger-soft);
  color: var(--danger);
}

.service-state--inhabilitado {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--muted-strong);
}

.service-promise {
  border-color: color-mix(in srgb, var(--info) 28%, var(--line));
  background: var(--info-soft);
  color: var(--info);
}

.service-promise strong {
  font-size: clamp(22px, 4vw, 30px);
}

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

.summary-card {
  display: flex;
  min-height: 150px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  flex-direction: column;
}

.summary-card-icon {
  display: grid;
  width: 34px;
  height: 34px;
  margin-bottom: 20px;
  place-items: center;
  border-radius: 9px;
  background: var(--surface-muted);
  color: var(--muted-strong);
}

.summary-card-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.summary-card-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.summary-card strong {
  margin-top: 3px;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.summary-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.summary-card-action {
  width: max-content;
  margin-top: auto;
  padding: 7px 0 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

/* Facturación */
.payment-schedule {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(0, 1.25fr);
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.payment-date-card,
.next-payment-card {
  display: grid;
  min-height: 120px;
  align-content: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.payment-date-card {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
}

.payment-day-label,
.next-payment-card > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.payment-day-number {
  grid-row: 1 / 3;
  color: var(--success);
  font-size: 48px;
  font-weight: 850;
  line-height: 1;
}

.payment-date-card p,
.next-payment-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.next-payment-card {
  border-color: color-mix(in srgb, var(--surface-inverse) 72%, var(--line));
  background: var(--surface-inverse);
  color: var(--text-inverse);
}

.next-payment-card > span,
.next-payment-card p {
  color: var(--muted-inverse);
}

.next-payment-card strong {
  color: var(--text-inverse);
  font-size: clamp(23px, 4vw, 30px);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.invoice-list {
  display: grid;
  gap: 12px;
}

.billing-summary {
  position: relative;
  display: grid;
  min-height: 118px;
  align-content: center;
  overflow: hidden;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.billing-summary::after {
  position: absolute;
  top: -48px;
  right: -30px;
  width: 150px;
  height: 150px;
  border: 22px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 0 0 20px currentColor;
  content: "";
  opacity: 0.055;
}

.billing-summary--pending {
  border-color: #204663;
  background: #143b59;
  color: #fff;
}

.billing-summary--clear {
  border-color: color-mix(in srgb, var(--success) 28%, var(--line));
  background: var(--success-soft);
  color: var(--success);
}

.billing-summary-label {
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.billing-summary strong {
  color: inherit;
  font-size: clamp(28px, 5vw, 36px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.billing-summary p {
  margin: 3px 0 0;
  color: inherit;
  font-size: 13px;
  opacity: 0.82;
}

.invoice-card {
  position: relative;
  overflow: hidden;
  padding: 18px 19px 18px 23px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.invoice-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--primary);
  content: "";
}

.invoice-card--paid::before { background: var(--success); }
.invoice-card--overdue::before { background: var(--danger); }
.invoice-card--partial::before { background: var(--warning); }

.invoice-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.invoice-kicker {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.invoice-head strong {
  display: block;
  font-size: 15px;
}

.status-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge.paid { background: var(--success-soft); color: var(--success); }
.status-badge.overdue { background: var(--danger-soft); color: var(--danger); }
.status-badge.partial { background: var(--warning-soft); color: var(--warning); }

.invoice-primary-amount {
  margin-top: 15px;
  color: var(--text-strong);
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 850;
  letter-spacing: -0.035em;
}

.invoice-friendly-date {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.payment-progress {
  margin-top: 14px;
}

.payment-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
}

.payment-progress-head strong {
  color: var(--muted-strong);
  font-size: 10px;
}

.payment-progress--overdue .payment-progress-head strong,
.payment-progress--urgent .payment-progress-head strong {
  color: var(--danger);
}

.payment-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.payment-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 350ms ease;
}

.payment-progress--paid .payment-progress-track span { background: var(--success); }
.payment-progress--warning .payment-progress-track span { background: var(--warning); }
.payment-progress--urgent .payment-progress-track span,
.payment-progress--overdue .payment-progress-track span { background: var(--danger); }

.invoice-help-text {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 11px;
}

.invoice-receipt-action {
  margin-top: 11px;
}

.receipt-download {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-inverse);
  color: var(--text-inverse);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.receipt-empty {
  color: var(--muted);
  font-size: 11px;
}

.invoice-details {
  margin-top: 11px;
  color: var(--muted-strong);
  font-size: 11px;
}

.invoice-details summary {
  width: max-content;
  cursor: pointer;
  font-weight: 800;
}

.invoice-details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 20px;
  margin-top: 9px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.invoice-details-grid strong {
  text-align: right;
}

/* Plan */
.simple-plan-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.plan-main {
  display: grid;
  min-height: 230px;
  align-content: center;
  padding: clamp(24px, 5vw, 42px);
}

.simple-plan-label {
  color: var(--success);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.simple-plan-card h3 {
  margin: 5px 0 12px;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.simple-plan-price strong {
  font-size: clamp(30px, 5vw, 44px);
  letter-spacing: -0.04em;
}

.simple-plan-price span {
  margin-left: 5px;
  color: var(--muted);
  font-size: 12px;
}

.simple-plan-speeds {
  display: grid;
  align-content: center;
  padding: 24px;
  background: var(--sidebar);
  color: #fff;
}

.simple-plan-speed {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 1px 10px;
  padding: 16px 0;
}

.simple-plan-speed + .simple-plan-speed {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.simple-plan-speed-icon {
  display: grid;
  grid-row: 1 / 3;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.09);
  color: #79b5ff;
  font-weight: 900;
}

.simple-plan-speed > span:not(.simple-plan-speed-icon) {
  color: #b9c9d5;
  font-size: 11px;
}

.simple-plan-speed strong {
  color: #fff;
  font-size: 18px;
}

/* Soporte */
.support-form-card {
  margin-bottom: 14px;
}

.report-form-grid {
  display: grid;
  grid-template-columns: minmax(200px, 0.35fr) minmax(0, 0.65fr);
  gap: 14px;
  align-items: start;
}

.report-description-label {
  grid-column: 2;
  grid-row: 1 / 3;
}

.report-form-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 14px;
}

.report-form-footer .field-help {
  margin: 0 auto 0 0;
}

.report-history {
  display: grid;
  gap: 10px;
}

.report-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.report-history-head > div {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.report-history-head span,
.report-history-head p {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.report-history-head strong {
  font-size: 18px;
}

.report-history-head p {
  margin: 0;
  text-align: right;
}

.report-history-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.report-history-card strong {
  font-size: 11px;
}

.report-history-card p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text);
  font-size: 14px;
  white-space: pre-wrap;
}

.report-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--success);
  font-size: 10px;
  font-weight: 800;
}

.report-status::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

/* Estados */
.state-panel,
.visual-empty-state {
  display: grid;
  min-height: 190px;
  place-items: center;
  padding: 26px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  text-align: center;
}

.state-panel-content {
  max-width: 430px;
}

.state-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--muted-strong);
  font-weight: 850;
}

.state-panel h3,
.visual-empty-state h3 {
  margin: 0 0 5px;
  font-size: 17px;
}

.state-panel p,
.visual-empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.state-panel .button {
  margin-top: 14px;
}

.skeleton-block {
  position: relative;
  min-height: 120px;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.skeleton-block::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent);
  content: "";
  transform: translateX(-100%);
  animation: shimmer 1.35s infinite;
}

.summary-skeleton { min-height: 150px; }
.invoice-skeleton { min-height: 190px; }
.plan-skeleton { min-height: 250px; }
.report-skeleton { min-height: 100px; }

@keyframes shimmer {
  to { transform: translateX(100%); }
}

/* Modal */
.unlink-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  padding: 18px;
  place-items: center;
}

.unlink-modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(3, 13, 22, 0.74);
  backdrop-filter: blur(3px);
}

.unlink-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34);
}

.unlink-warning-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 900;
}

.unlink-dialog h2 {
  margin: 13px 0 7px;
  font-size: 20px;
  letter-spacing: -0.025em;
}

.unlink-dialog > p {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
}

.unlink-confirm-label input {
  text-transform: uppercase;
}

.unlink-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
}

.sidebar-toggle,
.sidebar-backdrop {
  display: none;
}

/* Tablet y móvil */
@media (max-width: 980px) {
  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    min-height: 62px;
    padding: 10px 14px;
  }

  .brand-mark {
    width: 100%;
    padding: 0;
    border: 0;
  }

  .brand-logo-wrap-dark {
    margin-left: auto;
  }

  .sidebar-toggle {
    display: grid;
    order: -1;
    width: 42px;
    height: 42px;
    margin-right: 3px;
    padding: 10px 9px;
    align-content: center;
    gap: 5px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.07);
    cursor: pointer;
  }

  .sidebar-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 99px;
    background: #fff;
    transition: transform 180ms ease, opacity 180ms ease;
  }

  body.sidebar-open .sidebar-toggle {
    position: fixed;
    top: 14px;
    left: calc(min(86vw, 320px) - 56px);
    z-index: 130;
    margin: 0;
  }

  body.sidebar-open .sidebar-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.sidebar-open .sidebar-toggle span:nth-child(2) { opacity: 0; }
  body.sidebar-open .sidebar-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .sidebar-drawer {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 120;
    width: min(86vw, 320px);
    height: 100dvh;
    padding: 20px 18px 18px;
    overflow-y: auto;
    background: var(--sidebar);
    box-shadow: 24px 0 64px rgba(0, 0, 0, 0.34);
    transform: translateX(-105%);
    transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  body.sidebar-open .sidebar-drawer {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0 0 0 min(86vw, 320px);
    z-index: 110;
    display: block;
    width: auto;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(3, 12, 24, 0.6);
    backdrop-filter: blur(2px);
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .content {
    margin-left: 0;
    padding: 22px 16px 40px;
  }
}

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

  .auth-visual {
    min-height: 260px;
    padding: 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .auth-visual img {
    max-height: 230px;
  }

  .service-status-card,
  .simple-plan-card,
  .report-form-grid {
    grid-template-columns: 1fr;
  }

  .service-promise {
    min-height: 110px;
  }

  .dashboard-summary {
    grid-template-columns: 1fr 1fr;
  }

  .summary-card:last-child {
    grid-column: 1 / -1;
  }

  .report-description-label {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 560px) {
  .auth-screen {
    align-items: start;
    padding: 0;
    background: var(--surface);
  }

  .auth-panel {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .auth-brand {
    min-height: 62px;
    padding: 10px 16px;
  }

  .auth-visual {
    min-height: 220px;
    padding: 8px 18px;
  }

  .auth-visual img {
    max-height: 210px;
  }

  .auth-content {
    padding: 26px 20px 32px;
  }

  .auth-content h1 {
    font-size: 31px;
  }

  .content-header {
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 15px;
  }

  .content-header h1 {
    font-size: 30px;
  }

  .content-eyebrow,
  .connection-pill {
    display: none;
  }

  .surface-card {
    padding: 18px 16px;
    border-radius: var(--radius-md);
  }

  .section-heading {
    align-items: center;
    margin-bottom: 18px;
  }

  .section-heading h2 {
    font-size: 19px;
  }

  .section-heading p {
    font-size: 12px;
  }

  .service-status-card,
  .dashboard-summary,
  .payment-schedule {
    grid-template-columns: 1fr;
  }

  .service-state {
    min-height: 135px;
    padding: 20px;
  }

  .dashboard-summary {
    gap: 10px;
  }

  .summary-card,
  .summary-card:last-child {
    min-height: 124px;
    grid-column: auto;
  }

  .summary-card-icon {
    margin-bottom: 13px;
  }

  .payment-schedule {
    gap: 10px;
  }

  .payment-date-card,
  .next-payment-card {
    min-height: 108px;
  }

  .invoice-card {
    padding: 16px 15px 16px 20px;
  }

  .invoice-head {
    gap: 8px;
  }

  .payment-progress-head {
    align-items: flex-end;
  }

  .payment-progress-head strong {
    max-width: 52%;
    text-align: right;
  }

  .invoice-details-grid {
    gap: 7px 12px;
  }

  .plan-main,
  .simple-plan-speeds {
    padding: 22px 20px;
  }

  .report-form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .report-form-footer .button {
    width: 100%;
  }

  .report-history-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .report-history-head p {
    text-align: left;
  }

  .report-history-card {
    grid-template-columns: 1fr;
  }

  .report-status,
  .report-history-card p {
    grid-column: 1;
  }

  .unlink-dialog {
    padding: 21px;
  }

  .unlink-dialog-actions {
    flex-direction: column-reverse;
  }

  .unlink-dialog-actions .button {
    width: 100%;
  }
}

@media (max-height: 700px) and (min-width: 761px) {
  .auth-visual {
    min-height: 430px;
  }

  .auth-visual img {
    max-height: 330px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
