:root {
  --color-bg: #0b1112;
  --color-surface: #121b1c;
  --color-accent-emerald: #059669;
  --color-accent-emerald-hover: #10b981;
  --color-border: rgba(148, 163, 159, .2);
  --color-text-muted: #a4b4af;
  --ecosystem-blur: 16px;
  --ecosystem-font: 'Inter', sans-serif;
}

body.ecosystem-ui { font-family: var(--ecosystem-font); }

/* Global Apple + Google App Switcher Top Bar */
.tf-global-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;
  z-index: 1000;
  background: rgba(10, 15, 13, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  font-family: var(--ecosystem-font);
  color: #edf5f1;
}

.tf-global-bar-inner {
  max-width: 1280px;
  height: 100%;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tf-global-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f1f5f3;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.tf-global-logo-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
}

.tf-global-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tf-app-switcher-container {
  position: relative;
  display: inline-flex;
}

.tf-app-switcher-trigger,
.tf-help-switcher-trigger {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.tf-app-switcher-trigger:hover,
.tf-app-switcher-trigger[aria-expanded="true"],
.tf-help-switcher-trigger:hover,
.tf-help-switcher-trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: var(--color-border);
}

.tf-help-switcher-trigger {
  color: #cbd5e1;
  font: 600 0.85rem var(--ecosystem-font);
}

.tf-help-switcher-trigger span {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid currentColor;
  border-radius: 50%;
  line-height: 1;
}

.tf-app-switcher-trigger:focus-visible,
.tf-help-switcher-trigger:focus-visible,
.tf-global-auth-btn:focus-visible,
.tf-app-switcher-link:focus-visible {
  outline: 2px solid #34d399;
  outline-offset: 2px;
}

.tf-app-switcher-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 1001;
  width: min(360px, calc(100vw - 24px));
  max-height: calc(100dvh - 60px);
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: rgba(18, 27, 28, 0.96);
  color: #edf5f1;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-family: var(--ecosystem-font);
}

.tf-app-switcher-menu[hidden] {
  display: none;
}

.tf-app-switcher-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  color: #edf5f1;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 0.15s;
}

.tf-app-switcher-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.tf-app-switcher-link strong,
.tf-app-switcher-link small {
  display: block;
  line-height: 1.25;
}

.tf-app-switcher-link strong {
  font-size: 0.82rem;
  font-weight: 600;
}

.tf-app-switcher-link small {
  margin-top: 2px;
  color: #9fb0a8;
  font-size: 0.7rem;
}

.tf-app-switcher-icon {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  font-size: 0.68rem;
  font-weight: 700;
}

.tf-app-current {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  font-size: 0.65rem;
  font-weight: 600;
}

.tf-global-auth-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  flex: none;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(16, 185, 129, 0.5);
  background: #102b25;
  color: #b6f3d9;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.16s;
}

.tf-global-auth-btn:not([aria-label="Cuenta"]) {
  background: #102b25;
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #b6f3d9;
}

.tf-global-auth-btn[aria-label="Cuenta"] {
  background: linear-gradient(145deg, #164e63, #172554 68%, #111827);
  border: 1px solid rgba(6, 182, 212, 0.72);
  color: #ecfeff;
  font-weight: 700;
  font-size: 0.78rem;
}

.tf-global-auth-btn:hover {
  background: #059669;
  border-color: #059669;
  color: #ffffff;
}

.tf-auth-avatar-initial {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #059669;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
}

/* Fallback legacy support */
.tf-app-switcher { position: relative; display: inline-flex; flex: 0 0 42px; }
.tf-account-trigger {
  display: inline-grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(16, 185, 129, .5);
  border-radius: 50%;
  background: #102b25;
  color: #b6f3d9;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.tf-account-trigger:hover { background: #174536; border-color: #34d399; }
.tf-account-trigger:focus-visible, .tf-account-dialog button:focus-visible, .tf-account-dialog a:focus-visible { outline: 3px solid #6ee7b7; outline-offset: 3px; }
.tf-account-trigger svg { width: 20px; height: 20px; }
.tf-account-container { position: relative; display: inline-flex; flex: 0 0 42px; }
.tf-account-floating { position: fixed; top: 20px; right: 20px; z-index: 20; }
.tf-account-container.tf-account-floating { right: 72px; }
.tf-account-popover { position: absolute; top: calc(100% + 10px); right: 0; z-index: 50; width: min(340px, calc(100vw - 32px)); max-height: calc(100vh - 100px); overflow-y: auto; padding: 12px; border: 1px solid var(--color-border); border-radius: 14px; background: rgba(18, 27, 28, .96); color: #edf5f1; box-shadow: 0 20px 60px rgba(0, 0, 0, .4); backdrop-filter: blur(var(--ecosystem-blur)); font-family: var(--ecosystem-font); }
.tf-account-popover[hidden], .tf-account-popover [hidden] { display: none; }
.tf-account-modal { width: min(460px, calc(100% - 32px)); max-width: none; max-height: calc(100% - 32px); padding: 0; border: 0; background: transparent; color: #edf5f1; font-family: var(--ecosystem-font); }
.tf-account-modal::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(var(--ecosystem-blur)); }
.tf-account-modal-panel { position: relative; padding: 24px; border: 1px solid var(--color-border); border-radius: 18px; background: #121b1c; }
.tf-account-modal-panel h2 { margin: 0 42px 12px 0; font-size: 1.15rem; }
.tf-account-auth-frame { display: block; width: 100%; height: min(580px, calc(100vh - 180px)); min-height: 260px; border: 0; background: transparent; }
.tf-account-auth-frame[hidden] { display: none; }
.tf-account-message { margin: 0; padding: 0 8px; color: #c6d9d0; font-size: .75rem; line-height: 1.4; }
.tf-account-identity { display: flex; align-items: center; gap: 12px; padding: 8px 8px 14px; border-bottom: 1px solid var(--color-border); }
.tf-account-initial { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 50%; background: #164e3c; color: #a7f3d0; font-size: .75rem; font-weight: 700; }
.tf-account-identity strong, .tf-account-identity small { display: block; overflow-wrap: anywhere; }
.tf-account-identity strong { font-size: .85rem; }
.tf-account-identity small { margin-top: 3px; color: #9fb0a8; font-size: .72rem; }
.tf-account-section { margin: 8px 8px 2px; padding-top: 10px; border-top: 1px solid var(--color-border); color: #9fb0a8; font-size: .7rem; }
.tf-account-item { display: block; width: 100%; padding: 10px 8px; border: 0; border-radius: 8px; background: transparent; color: #e2eee8; font: 500 .82rem var(--ecosystem-font); text-align: left; text-decoration: none; }
.tf-account-item:hover:not(:disabled) { background: rgba(255,255,255,.07); }
.tf-account-danger { color: #fca5a5; }
.tf-account-item:disabled { opacity: .5; cursor: not-allowed; }
.tf-account-dialog { width: min(440px, calc(100% - 32px)); max-width: none; max-height: calc(100% - 32px); margin: auto; padding: 0; border: 0; background: transparent; color: #f1f5f3; font-family: var(--ecosystem-font); }
.tf-account-dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(var(--ecosystem-blur)); }
.tf-account-panel { position: relative; padding: 32px; border: 1px solid var(--color-border); border-radius: 22px; background: rgba(18, 27, 28, .96); box-shadow: 0 24px 80px rgba(0, 0, 0, .5); }
.tf-account-dialog[open] .tf-account-panel { animation: tf-account-in .2s ease-out both; }
.tf-account-dialog.tf-closing .tf-account-panel { animation: tf-account-out .16s ease-in both; }
.tf-account-close { position: absolute; top: 17px; right: 17px; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .06); color: #c4d2cc; font-size: 24px; cursor: pointer; }
.tf-account-eyebrow { margin: 0 0 12px; color: #6ee7b7; font-size: .68rem; font-weight: 700; }
.tf-account-panel h2 { margin: 0 38px 10px 0; color: #f1f5f3; font: 700 1.4rem var(--ecosystem-font); }
.tf-account-panel p:not(.tf-account-eyebrow) { margin: 0 0 24px; color: var(--color-text-muted); font-size: .875rem; line-height: 1.5; }
.tf-account-primary, .tf-account-secondary { display: flex; justify-content: center; align-items: center; min-height: 48px; padding: 12px 16px; border-radius: 12px; font-size: .875rem; font-weight: 600; text-align: center; text-decoration: none; }
.tf-account-primary { background: var(--color-accent-emerald); color: white; box-shadow: 0 8px 24px rgba(2, 44, 34, .4); transition: background .2s; }
.tf-account-primary:hover { background: var(--color-accent-emerald-hover); }
.tf-account-secondary { margin-top: 10px; border: 1px solid var(--color-border); color: #d3ded9; }
.tf-account-secondary:hover { background: rgba(255, 255, 255, .06); }
@keyframes tf-account-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes tf-account-out { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(8px) scale(.97); } }
@media (max-width: 560px) {
  .tf-account-panel { padding: 26px 22px; }
  .tf-account-container.tf-account-floating { top: 16px; right: 68px; }
  .tf-account-popover { width: min(340px, calc(100vw - 96px)); }
  .tf-app-switcher-floating { top: 16px; right: 16px; }
  .tf-app-switcher-floating .tf-app-switcher-menu { top: 68px; }
  .ecosystem-ui .topbar-right { gap: 8px; }
  .ecosystem-ui .kiosk-exit { display: none; }
  .report-page .topbar { height: auto; min-height: 72px; flex-wrap: wrap; gap: 8px; padding-block: 12px; }
  .report-page .topbar-right { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .tf-account-dialog[open] .tf-account-panel, .tf-account-dialog.tf-closing .tf-account-panel { animation-duration: .01ms; } }