/* Telecom Voucher — Enterprise UI Enhancements
 * Modern animations, utilities, and polish for 2026 SaaS standards
 * Version: 2026.1.0
 */

/* ============================================
   ANIMATIONS
   Smooth, professional micro-interactions
   ============================================ */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Animation utility classes */
.tw-animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

.tw-animate-fade-in-up {
  animation: fadeInUp 0.4s ease-out;
}

.tw-animate-fade-in-down {
  animation: fadeInDown 0.4s ease-out;
}

.tw-animate-slide-in-right {
  animation: slideInRight 0.3s ease-out;
}

.tw-animate-slide-in-left {
  animation: slideInLeft 0.3s ease-out;
}

.tw-animate-scale-in {
  animation: scaleIn 0.2s ease-out;
}

.tw-animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.tw-animate-bounce {
  animation: bounce 2s ease-in-out infinite;
}

/* Stagger animations for lists */
.tw-stagger-1 { animation-delay: 0.05s; }
.tw-stagger-2 { animation-delay: 0.1s; }
.tw-stagger-3 { animation-delay: 0.15s; }
.tw-stagger-4 { animation-delay: 0.2s; }
.tw-stagger-5 { animation-delay: 0.25s; }
.tw-stagger-6 { animation-delay: 0.3s; }
.tw-stagger-7 { animation-delay: 0.35s; }
.tw-stagger-8 { animation-delay: 0.4s; }

/* ============================================
   SCROLLBAR ENHANCEMENTS
   Modern, themed scrollbars
   ============================================ */

/* Custom scrollbar for webkit browsers */
.tw-custom-scrollbar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.tw-custom-scrollbar::-webkit-scrollbar-track {
  background: var(--tv-bg-muted);
  border-radius: 4px;
}

.tw-custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--tv-border-strong);
  border-radius: 4px;
}

.tw-custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--tv-text-muted);
}

/* Thin scrollbar variant */
.tw-scrollbar-thin::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

/* ============================================
   FOCUS STATES
   Enhanced accessibility focus indicators
   ============================================ */

/* Focus visible for keyboard navigation */
.tw-focus-visible:focus-visible {
  outline: 2px solid var(--tv-primary);
  outline-offset: 2px;
}

/* Focus ring for interactive elements */
.tw-focus-ring:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--tv-primary-soft);
}

/* ============================================
   TEXT UTILITIES
   Modern text styling
   ============================================ */

.tw-text-balance {
  text-wrap: balance;
}

.tw-text-pretty {
  text-wrap: pretty;
}

.tw-text-gradient {
  color: var(--tv-primary);
}

/* ============================================
   CARD ENHANCEMENTS
   Premium card styles
   ============================================ */

/* Glass card effect */
.tw-card-glass {
  background: var(--tv-glass-bg);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Elevated card */
.tw-card-elevated {
  box-shadow: var(--tv-shadow-md);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tw-card-elevated:hover {
  transform: translateY(-4px);
  box-shadow: var(--tv-shadow-lg);
}

/* Card with gradient border */
.tw-card-gradient-border {
  position: relative;
  background: var(--tv-surface);
  border-radius: var(--tv-radius-lg);
}

.tw-card-gradient-border::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--tv-radius-lg) + 2px);
  background: var(--tv-primary);
  z-index: -1;
}

/* ============================================
   BUTTON ENHANCEMENTS
   Modern button styles
   ============================================ */

/* Button with icon */
.tw-btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Button loading state */
.tw-btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.tw-btn-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   INPUT ENHANCEMENTS
   Modern form input styles
   ============================================ */

/* Floating label input */
.tw-input-floating {
  position: relative;
}

.tw-input-floating .form-control {
  padding-top: 1.5rem;
  padding-bottom: 0.5rem;
}

.tw-input-floating .form-label {
  position: absolute;
  top: 1rem;
  left: 1rem;
  transition: all 0.2s ease;
  pointer-events: none;
  color: var(--tv-text-muted);
}

.tw-input-floating .form-control:focus ~ .form-label,
.tw-input-floating .form-control:not(:placeholder-shown) ~ .form-label {
  top: 0.25rem;
  font-size: 0.75rem;
  color: var(--tv-primary);
}

/* Input with icon */
.tw-input-icon {
  position: relative;
}

.tw-input-icon .form-control {
  padding-left: 2.75rem;
}

.tw-input-icon > svg,
.tw-input-icon > i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--tv-text-muted);
  pointer-events: none;
}

/* ============================================
   BADGE ENHANCEMENTS
   Modern badge styles
   ============================================ */

/* Animated badge */
.tw-badge-animated {
  position: relative;
}

.tw-badge-animated::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 2px solid currentColor;
  animation: pulse 2s ease-in-out infinite;
}

/* Dot badge */
.tw-badge-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.tw-badge-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 1px color-mix(in srgb, currentColor 22%, transparent);
}

.tw-badge-dot--lg::before {
  width: 8px;
  height: 8px;
}

/* ============================================
   TABLE ENHANCEMENTS
   Enterprise data table styles
   ============================================ */

/* Sticky table header */
.tw-table-sticky thead th,
table.tw-table-sticky thead th {
  position: sticky;
  top: 0;
  z-index: 10;
}

/* DataTables sticky header with proper z-index */
.dataTables_scrollHead.tw-sticky-header th {
  position: sticky;
  top: 0;
  z-index: 20;
}

/* Enhanced sticky header with shadow on scroll */
.tw-table-sticky-shadow thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Table row hover with transition */
.tw-table-hover tbody tr {
  transition: background-color 0.15s ease;
}

/* Compact table */
.tw-table-compact td,
.tw-table-compact th {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
}

/* ============================================
   MODAL ENHANCEMENTS
   Modern modal styles
   ============================================ */

/* Modal with backdrop blur */
.tw-modal-blur .modal-backdrop {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Modal animation */
.tw-modal-animate .modal-content {
  animation: scaleIn 0.2s ease-out;
}

/* ============================================
   TOOLTIP ENHANCEMENTS
   Modern tooltip styles
   ============================================ */

.tw-tooltip {
  position: relative;
}

.tw-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  padding: var(--bs-tooltip-padding-y, 0.35rem) var(--bs-tooltip-padding-x, 0.65rem);
  background: var(--tv-tooltip-bg);
  color: var(--tv-tooltip-text);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border: 1px solid var(--tv-tooltip-border);
  border-radius: var(--tv-radius-md);
  box-shadow: var(--tv-shadow-md);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s var(--ease-smooth), transform 0.15s var(--ease-smooth), visibility 0.15s;
  z-index: var(--z-tooltip);
}

.tw-tooltip:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-8px);
}

/* ============================================
   SKELETON LOADING
   Content placeholder animations
   ============================================ */

.tw-skeleton {
  background: linear-gradient(
    90deg,
    var(--tv-bg-muted) 25%,
    var(--tv-border-subtle) 50%,
    var(--tv-bg-muted) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--tv-radius-sm);
}

.tw-skeleton-text {
  height: 1em;
  margin-bottom: 0.5rem;
}

.tw-skeleton-title {
  height: 1.5em;
  width: 60%;
  margin-bottom: 0.75rem;
}

.tw-skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.tw-skeleton-button {
  height: 36px;
  width: 100px;
}

/* ============================================
   RESPONSIVE UTILITIES
   Modern responsive helpers
   ============================================ */

/* Hide scrollbar but keep functionality */
.tw-scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.tw-scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Truncate text with ellipsis */
.tw-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Line clamp */
.tw-line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tw-line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================
   PRINT STYLES
   Enterprise print optimization
   ============================================ */

@media print {
  .tw-no-print {
    display: none !important;
  }

  .tw-print-break-before {
    page-break-before: always;
  }

  .tw-print-break-after {
    page-break-after: always;
  }

  .tw-print-avoid-break {
    page-break-inside: avoid;
  }
}

/* ============================================
   DARK MODE ENHANCEMENTS
   ============================================ */

html[data-theme="dark"] {
  /* Enhanced dark mode shadows */
  --tv-shadow-dark-glow: 0 0 40px rgba(var(--tv-primary-rgb), 0.15);
}

html[data-theme="dark"] .tw-card-glow {
  box-shadow: var(--tv-shadow-dark-glow);
}

/* ============================================
   REDUCED MOTION
   Accessibility support
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .tw-animate-fade-in,
  .tw-animate-fade-in-up,
  .tw-animate-fade-in-down,
  .tw-animate-slide-in-right,
  .tw-animate-slide-in-left,
  .tw-animate-scale-in,
  .tw-animate-pulse,
  .tw-animate-bounce,
  .tw-skeleton,
  .modal-content.tw-modal-animate {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .tw-shell-card,
  .tw-card-elevated,
  .modal-content.tw-modal-animate {
    transition-duration: 0.01ms !important;
  }

  .tv-table-scroll {
    scroll-behavior: auto;
  }
}

/* ----- Shared Razor partials (confirm dialog, empty state) ----- */
.tv-confirm-dialog__icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.tv-confirm-dialog__icon--danger {
  background: var(--tv-danger-soft);
  color: var(--tv-danger);
}

.tv-confirm-dialog__icon--warning {
  background: var(--tv-warning-soft);
  color: var(--tv-warning);
}

.tv-confirm-dialog__icon--success {
  background: var(--tv-success-soft);
  color: var(--tv-success);
}

.tv-confirm-dialog__icon--primary {
  background: var(--tv-primary-soft);
  color: var(--tv-primary);
}

.tv-confirm-dialog__icon--info {
  background: var(--tv-info-soft, #eff6ff);
  color: var(--tv-info);
}

.tv-confirm-dialog__icon--secondary {
  background: var(--tv-bg-muted);
  color: var(--tv-text-muted);
}

.tv-confirm-dialog__title {
  text-align: center;
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  line-height: 1.35;
  color: var(--tv-text);
  margin-bottom: 0.5rem;
}

.tv-confirm-dialog__message {
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--tv-text-secondary);
  max-width: 26rem;
}

/* Tabler-style confirmation modal: top accent, floating close, muted footer */
.tv-confirm-modal {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--tv-border-subtle);
}

.tv-confirm-modal__accent {
  height: 3px;
  width: 100%;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--tv-border) 85%, var(--tv-text-muted));
}

.tv-confirm-modal--danger .tv-confirm-modal__accent {
  background: var(--tv-danger);
}

.tv-confirm-modal--warning .tv-confirm-modal__accent {
  background: var(--tv-warning);
}

.tv-confirm-modal--success .tv-confirm-modal__accent {
  background: var(--tv-success);
}

.tv-confirm-modal--primary .tv-confirm-modal__accent {
  background: var(--tv-primary);
}

.tv-confirm-modal--info .tv-confirm-modal__accent {
  background: var(--tv-info);
}

.tv-confirm-modal--neutral .tv-confirm-modal__accent {
  background: color-mix(in srgb, var(--tv-slate-400) 70%, var(--tv-border));
}

.tv-confirm-modal__close {
  position: absolute;
  top: 0.55rem;
  inset-inline-end: 0.55rem;
  z-index: 3;
  opacity: 0.55;
  padding: 0.5rem;
  transition: opacity 0.15s ease;
}

.tv-confirm-modal__close:hover,
.tv-confirm-modal__close:focus {
  opacity: 1;
}

.tv-confirm-modal__body {
  padding-top: 2.35rem;
}

.tv-confirm-modal__glyph-icon {
  width: 28px;
  height: 28px;
  stroke-width: 1.75px;
}

.tv-confirm-modal--danger .tv-confirm-dialog__icon,
.tv-confirm-modal--warning .tv-confirm-dialog__icon {
  background: transparent !important;
  border: 2px solid currentColor;
  box-shadow: none;
}

.tv-confirm-modal--danger .tv-confirm-dialog__icon {
  color: var(--tv-danger);
}

.tv-confirm-modal--warning .tv-confirm-dialog__icon {
  color: var(--tv-warning);
}

.tv-confirm-modal--success .tv-confirm-dialog__icon {
  background: transparent !important;
  border: 2px solid var(--tv-success);
  color: var(--tv-success);
  box-shadow: none;
}

.tv-confirm-modal--primary .tv-confirm-dialog__icon,
.tv-confirm-modal--info .tv-confirm-dialog__icon,
.tv-confirm-modal--neutral .tv-confirm-dialog__icon {
  border: 1px solid color-mix(in srgb, currentColor 35%, transparent);
}

.tv-confirm-modal__footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  margin: 0;
  background: color-mix(in srgb, var(--tv-bg-muted) 55%, var(--tv-surface));
  border-top: 1px solid var(--tv-border-subtle) !important;
}

.tv-confirm-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  width: 100%;
  padding: 1rem 1.25rem 1.1rem;
  justify-content: stretch;
}

.tv-confirm-modal__btn {
  flex: 1 1 calc(50% - 0.375rem);
  min-height: 2.75rem;
  font-weight: 600;
  border-radius: var(--tv-radius-md, 8px);
}

@media (max-width: 380px) {
  .tv-confirm-modal__btn {
    flex: 1 1 100%;
  }
}

html[data-theme="dark"] .tv-confirm-modal__footer {
  background: color-mix(in srgb, var(--tv-slate-900) 88%, var(--tv-slate-800));
  border-top-color: var(--tv-border) !important;
}

.modal-content.tw-modal-animate {
  border: none;
  border-radius: var(--tv-radius-xl, 16px);
  box-shadow: 0 20px 48px rgba(17, 24, 39, 0.18);
  animation: scaleIn 0.2s ease-out;
}

.modal-content.tw-modal-animate .modal-footer:not(.tv-confirm-modal__footer) {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.modal-content.tw-modal-animate .modal-footer:not(.tv-confirm-modal__footer) .btn {
  min-height: 2.75rem;
  padding-inline: 1rem;
}

@media (max-width: 380px) {
  .modal-content.tw-modal-animate .modal-footer:not(.tv-confirm-modal__footer) .btn {
    flex: 1 1 calc(50% - 0.25rem);
  }
}

html[data-theme="dark"] .modal-content.tw-modal-animate {
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.tv-empty-state-icon {
  color: var(--tv-text-muted);
  opacity: 0.55;
}

.tv-empty-state {
  background: var(--tv-bg-muted);
  border-radius: var(--tv-radius-lg);
  border: 2px dashed var(--tv-border);
}

/* ----- Form page footer (save / cancel) ----- */
.tv-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding-top: 1rem;
  margin-top: 0.25rem;
  border-top: 1px solid var(--tv-border-subtle);
}

.tv-form-actions .btn {
  min-height: 2.75rem;
  padding-inline: 1.25rem;
}

/* Sticky primary actions on long forms (opt-in wrapper) */
.tv-form-actions.tv-form-actions--sticky {
  position: sticky;
  bottom: 0;
  z-index: var(--z-sticky, 200);
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--tv-surface);
  border: 1px solid var(--tv-border-subtle);
  border-radius: var(--tv-radius-md);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.06);
}

html[data-theme="dark"] .tv-form-actions.tv-form-actions--sticky {
  box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.35);
}

@media (prefers-reduced-motion: reduce) {
  .tv-form-actions.tv-form-actions--sticky {
    box-shadow: 0 -2px 8px rgba(15, 23, 42, 0.08);
  }
}

/* ----- Keyboard-visible focus rings (pairs with Bootstrap / tv-form-control) ----- */
.tv-theme .btn:focus-visible {
  outline: 2px solid var(--tv-primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--tv-primary-soft);
}

.tv-filter-bar .btn {
  min-height: 2.75rem;
}

@media (min-width: 768px) {
  .tv-filter-bar .btn {
    min-height: 2.625rem;
  }
}

/* ============================================
   PREMIUM AVATARS
   Modern user/entity avatars
   ============================================ */

.tv-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
  background: linear-gradient(145deg, var(--tv-primary-soft), rgba(99, 102, 241, 0.15));
  color: var(--tv-primary);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.65) inset;
}

.tv-avatar--sm {
  width: 28px;
  height: 28px;
  font-size: 0.75rem;
}

.tv-avatar--md {
  width: 38px;
  height: 38px;
  font-size: 0.875rem;
}

.tv-avatar--lg {
  width: 56px;
  height: 56px;
  font-size: 1.25rem;
}

.tv-avatar--xl {
  width: 80px;
  height: 80px;
  font-size: 1.75rem;
}

html[data-theme="dark"] .tv-avatar {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1) inset;
}

/* ============================================
   PREMIUM BADGES & TAGS
   Unified status/tag system
   ============================================ */

.tv-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3125rem;
  padding: 0.28rem 0.72rem;
  border-radius: var(--tv-radius-pill);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.35;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset;
}

html[data-theme="dark"] .tv-badge {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

.tv-badge__icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  margin-inline-end: -0.0625rem;
}

.tv-badge__icon svg,
.tv-badge__icon i {
  width: 0.8125rem;
  height: 0.8125rem;
}

.tv-badge--primary {
  background: var(--tv-primary-soft);
  color: var(--tv-primary-on-soft);
  border: 1px solid rgba(var(--tv-primary-rgb), 0.15);
}

.tv-badge--success {
  background: var(--tv-success-soft);
  color: var(--tv-success-text);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.tv-badge--warning {
  background: var(--tv-warning-soft);
  color: var(--tv-accent-orange);
  border: 1px solid rgba(249, 115, 22, 0.25);
}

.tv-badge--danger {
  background: var(--tv-danger-soft);
  color: var(--tv-danger-text);
  border: 1px solid rgba(220, 38, 38, 0.22);
}

.tv-badge--info {
  background: var(--tv-info-soft);
  color: var(--tv-info);
  border: 1px solid rgba(14, 165, 233, 0.25);
}

.tv-badge--neutral {
  background: var(--tv-neutral-soft);
  color: var(--tv-text-secondary);
  border: 1px solid var(--tv-border);
}

.tv-badge--secondary {
  background: color-mix(in srgb, var(--tv-text-secondary) 10%, var(--tv-surface, #fff));
  color: var(--tv-text-secondary);
  border: 1px solid color-mix(in srgb, var(--tv-text-secondary) 18%, var(--tv-border));
}

html[data-theme="dark"] .tv-badge--secondary {
  background: rgba(148, 163, 184, 0.12);
  color: var(--tv-text-secondary);
  border-color: rgba(148, 163, 184, 0.22);
}

.tv-badge--outline-primary {
  background: transparent;
  color: var(--tv-primary);
  border: 1px solid rgba(var(--tv-primary-rgb), 0.35);
}

.tv-badge--dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 1px color-mix(in srgb, currentColor 25%, transparent);
}

.tv-badge--circle {
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.35rem;
  border-radius: var(--tv-radius-full);
  font-variant-numeric: tabular-nums;
  font-size: 0.7rem;
}

.tv-badge--sm.tv-badge--circle {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.25rem;
  font-size: 0.625rem;
}

.tv-badge--solid-primary {
  background: var(--tv-primary);
  color: var(--tv-on-primary, #ffffff);
  border: 1px solid color-mix(in srgb, var(--tv-primary) 88%, #000);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset;
}

.tv-badge--solid-success {
  background: var(--tv-success, #16a34a);
  color: #ffffff;
  border: 1px solid color-mix(in srgb, var(--tv-success, #16a34a) 85%, #000);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset;
}

.tv-badge--solid-warning {
  background: var(--tv-warning, #f59e0b);
  color: var(--tv-slate-900, #0f172a);
  border: 1px solid color-mix(in srgb, var(--tv-warning) 80%, #000);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset;
}

.tv-badge--solid-danger {
  background: var(--tv-danger, #dc2626);
  color: #ffffff;
  border: 1px solid color-mix(in srgb, var(--tv-danger) 85%, #000);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset;
}

.tv-badge--solid-info {
  background: var(--tv-info, #0ea5e9);
  color: #ffffff;
  border: 1px solid color-mix(in srgb, var(--tv-info) 85%, #000);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset;
}

.tv-badge--solid-neutral {
  background: var(--tv-text-secondary, #64748b);
  color: var(--tv-surface, #ffffff);
  border: 1px solid color-mix(in srgb, var(--tv-text-secondary) 75%, #000);
}

.tv-badge--sm {
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
}

.tv-badge--lg {
  padding: 0.4rem 1rem;
  font-size: 0.875rem;
}

/* Tabler-style corner / menu counters: parent needs position:relative */
.tv-has-corner-badge {
  position: relative;
}

.tv-corner-badge {
  position: absolute;
  inset-block-start: 0;
  inset-inline-end: 0;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 4px;
  font-size: 0.625rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--tv-slate-900);
  background: var(--tv-warning);
  border-radius: var(--tv-radius-full);
  box-shadow: 0 0 0 2px var(--tv-surface, #fff);
  transform: translate(42%, -42%);
}

html[data-theme="dark"] .tv-corner-badge {
  color: var(--tv-slate-950);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--tv-slate-900) 92%, transparent);
}

.tv-corner-badge--danger {
  background: var(--tv-danger);
  color: var(--tv-on-primary, #fff);
}

html[data-theme="dark"] .tv-corner-badge--danger {
  color: #fff;
}

.tv-corner-badge--dot {
  min-width: 0.5rem;
  width: 0.5rem;
  height: 0.5rem;
  padding: 0;
  background: var(--tv-danger);
  box-shadow: 0 0 0 2px var(--tv-surface, #fff);
}

.tv-corner-badge--dot.tv-corner-badge--success {
  background: var(--tv-success);
}

.tv-corner-badge--dot.tv-corner-badge--warning {
  background: var(--tv-warning);
}

[dir="rtl"] .tv-corner-badge {
  transform: translate(-42%, -42%);
}

/* Inline end-aligned pill inside list rows / dropdown items */
.tv-menu-row-badge {
  margin-inline-start: auto;
  flex-shrink: 0;
}

/* ============================================
   STEPPER / PROGRESS STEPS
   Multi-step workflow indicator
   ============================================ */

.tv-stepper {
  display: flex;
  align-items: flex-start;
  gap: 0;
}

.tv-stepper__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}

.tv-stepper__item:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 14px;
  left: calc(50% + 16px);
  right: calc(-50% + 16px);
  height: 2px;
  background: var(--tv-border);
  z-index: 0;
}

.tv-stepper__item--complete:not(:last-child)::after {
  background: var(--tv-primary);
}

.tv-stepper__circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8125rem;
  font-weight: 600;
  z-index: 1;
  background: var(--tv-surface);
  border: 2px solid var(--tv-border);
  color: var(--tv-text-muted);
}

.tv-stepper__item--active .tv-stepper__circle {
  border-color: var(--tv-primary);
  color: var(--tv-primary);
  box-shadow: 0 0 0 4px var(--tv-primary-soft);
}

.tv-stepper__item--complete .tv-stepper__circle {
  background: var(--tv-primary);
  border-color: var(--tv-primary);
  color: #fff;
}

.tv-stepper__label {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--tv-text-muted);
  text-align: center;
}

.tv-stepper__item--active .tv-stepper__label {
  color: var(--tv-text);
  font-weight: 600;
}

/* ============================================
   LOGIN & AUTH PREMIUM STYLES
   ============================================ */

.tv-login-split {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
  width: 100%;
}

.tv-main--guest .tv-page-wrap > .tv-page-content-shell > .tv-login-split {
  min-height: calc(100vh - var(--tv-topbar-height));
  margin: calc(-1 * var(--tv-space-3, 0.75rem)) -0.5rem -2.25rem;
}

@media (min-width: 992px) {
  .tv-main--guest .tv-page-wrap > .tv-page-content-shell > .tv-login-split {
    margin: calc(-1 * var(--tv-space-3, 0.75rem)) -0.75rem -2.75rem;
  }
}

@media (min-width: 992px) {
  .tv-login-split {
    grid-template-columns: 1fr 1.15fr;
  }
}

.tv-login-brand-side {
  display: none;
  position: relative;
  background: linear-gradient(160deg, var(--tv-primary-deep) 0%, var(--tv-primary) 50%, #0e7490 100%);
  color: #fff;
  overflow: hidden;
}

@media (min-width: 992px) {
  .tv-login-brand-side {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem;
  }
}

.tv-login-brand-side::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 280px 280px;
  opacity: 0.08;
  mix-blend-mode: overlay;
  pointer-events: none;
}

.tv-login-brand-side__content {
  position: relative;
  z-index: 1;
}

.tv-login-brand-side__logo {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: #fff;
  text-decoration: none;
  margin-bottom: 2.5rem;
}

.tv-login-brand-side__logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  font-size: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.tv-login-brand-side__title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.tv-login-brand-side__text {
  font-size: 1rem;
  line-height: 1.6;
  opacity: 0.85;
  max-width: 26rem;
}

.tv-login-brand-side__footer {
  position: relative;
  z-index: 1;
  font-size: 0.8125rem;
  opacity: 0.7;
}

.tv-login-form-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem 1.5rem;
  background: var(--tv-bg-app);
  position: relative;
}

.tv-login-form-side::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  opacity: 0.06;
  mix-blend-mode: multiply;
  pointer-events: none;
}

html[data-theme="dark"] .tv-login-form-side::before {
  opacity: 0.12;
  mix-blend-mode: overlay;
}

.tv-login-form-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 2.5rem 2rem;
  border-radius: var(--tv-radius-xl);
  border: 1px solid var(--tv-border);
  background: var(--tv-surface);
  box-shadow: var(--tv-shadow-lg);
  animation: fadeInUp 0.5s ease-out;
}

.tv-login-form-card__header {
  margin-bottom: 1.75rem;
  text-align: center;
}

.tv-login-form-card__title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--tv-text);
  margin-bottom: 0.375rem;
}

.tv-login-form-card__subtitle {
  font-size: 0.875rem;
  color: var(--tv-text-muted);
}

.tv-login-form-card .form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--tv-text-secondary);
  margin-bottom: 0.35rem;
}

.tv-login-form-card .form-control {
  min-height: 2.75rem;
  padding: 0.65rem 0.9rem;
  font-size: 0.9375rem;
  border-radius: var(--tv-radius-md);
  border: 1px solid var(--tv-border);
  background: var(--tv-surface);
  color: var(--tv-text);
  box-shadow: var(--tv-shadow-inset-input);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tv-login-form-card .form-control:focus {
  border-color: rgba(var(--tv-primary-rgb), 0.55);
  box-shadow: var(--tv-shadow-inset-input), 0 0 0 3px var(--tv-primary-soft);
}

.tv-login-form-card .btn-primary {
  width: 100%;
  min-height: 2.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--tv-radius-md);
  margin-top: 0.5rem;
}

.tv-login-tenant-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--tv-radius-pill);
  background: var(--tv-primary-soft);
  color: var(--tv-primary-on-soft);
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* ============================================
   TIMELINE COMPONENT
   Vertical activity timeline
   ============================================ */

.tv-timeline {
  position: relative;
  padding-left: 1.5rem;
}

.tv-timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--tv-border);
  border-radius: 2px;
}

.tv-timeline__item {
  position: relative;
  padding-bottom: 1.5rem;
}

.tv-timeline__item:last-child {
  padding-bottom: 0;
}

.tv-timeline__dot {
  position: absolute;
  left: -1.5rem;
  top: 0.25rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--tv-surface);
  border: 2px solid var(--tv-primary);
  box-shadow: 0 0 0 3px var(--tv-primary-soft);
}

.tv-timeline__dot--success {
  border-color: var(--tv-success);
  box-shadow: 0 0 0 3px var(--tv-success-soft);
}

.tv-timeline__dot--warning {
  border-color: var(--tv-warning);
  box-shadow: 0 0 0 3px var(--tv-warning-soft);
}

.tv-timeline__dot--danger {
  border-color: var(--tv-danger);
  box-shadow: 0 0 0 3px var(--tv-danger-soft);
}

.tv-timeline__content {
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-radius-md);
  padding: 0.875rem 1rem;
  box-shadow: var(--tv-shadow-xs);
}

.tv-timeline__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  color: var(--tv-text-muted);
}

.tv-timeline__title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--tv-text);
  margin: 0;
}

.tv-timeline__desc {
  font-size: 0.8125rem;
  color: var(--tv-text-secondary);
  margin: 0.25rem 0 0;
}

/* ============================================
   PREMIUM HOVER LIFT EFFECTS
   ============================================ */

.tv-lift {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tv-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--tv-shadow-lg);
}

.tv-lift-sm:hover {
  transform: translateY(-1px);
  box-shadow: var(--tv-shadow-md);
}

/* ============================================
   NOTIFICATION / TOAST POSITIONING
   ============================================ */

.tv-notify-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: var(--z-toast, 800);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.tv-notify-container > * {
  pointer-events: auto;
}

html[dir="rtl"] .tv-notify-container {
  right: auto;
  left: 1rem;
}

/* ============================================
   SKIP LINK (Accessibility)
   ============================================ */

.tv-skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--tv-primary);
  color: #fff;
  padding: 8px 16px;
  z-index: 9999;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 0 0 var(--tv-radius-md) 0;
  transition: top 0.2s ease;
}

.tv-skip-link:focus {
  top: 0;
}

/* ============================================
   MOBILE RESPONSIVE UTILITIES
   ============================================ */

@media (max-width: 575.98px) {
  .tv-page-wrap {
    padding: var(--tv-space-2, 0.5rem) 0.5rem 1.5rem !important;
  }

  .tv-login-form-card {
    padding: 1.75rem 1.25rem;
    border-radius: var(--tv-radius-lg);
  }

  .tv-stat-card-premium__value {
    font-size: 1.5rem !important;
  }

  .tv-stat-card-premium__value--lg {
    font-size: 1.875rem !important;
  }

  .tv-action-group .tv-action-icon {
    width: 36px;
    height: 36px;
  }

  .tv-action-group .tv-row-view-btn.tv-row-view-btn--icon-only {
    min-width: 2.25rem;
    min-height: 2.25rem;
  }

  .tv-dt-toolbar-inner {
    padding: 0.75rem 1rem 0.5rem !important;
  }

  .tv-form-actions:not(.tv-form-actions--stack) {
    flex-direction: column;
    align-items: stretch;
  }

  .tv-form-actions:not(.tv-form-actions--stack) .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 767.98px) {
  .tv-shell-kpi-strip {
    grid-template-columns: 1fr 1fr !important;
  }

  .tv-page-title {
    font-size: 1.25rem !important;
  }

  .tv-sidebar--collapsed {
    width: var(--tv-sidebar-width) !important;
    min-width: var(--tv-sidebar-width) !important;
  }
}

/* ============================================
   FOCUS-TRAP / MODAL ACCESSIBILITY
   ============================================ */

.tv-modal-focusable:focus-visible {
  outline: 2px solid var(--tv-primary);
  outline-offset: 2px;
}

/* ============================================
   PREMIUM DIVIDERS
   ============================================ */

.tv-divider-gradient {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--tv-border), transparent);
  border: none;
  margin: 1.25rem 0;
}

/* ============================================
   GLASSMORPHISM UTILITIES
   ============================================ */

.tv-glass {
  background: var(--tv-glass-bg);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.tv-glass-dark {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ============================================
   ANIMATED BACKGROUNDS
   ============================================ */

.tv-bg-aurora {
  position: relative;
  overflow: hidden;
}

.tv-bg-aurora::before {
  content: "";
  position: absolute;
  inset: -50%;
  background: radial-gradient(circle at 30% 30%, rgba(var(--tv-primary-rgb), 0.12), transparent 50%),
    radial-gradient(circle at 70% 70%, rgba(14, 116, 144, 0.1), transparent 50%);
  animation: tv-aurora-rotate 20s linear infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes tv-aurora-rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ============================================
   CARD IMAGE / MEDIA
   ============================================ */

.tv-card-media {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--tv-radius-md) var(--tv-radius-md) 0 0;
}

.tv-card-media + .tv-card-body {
  border-top: none;
}

/* ============================================
   PREMIUM BUTTON GROUPS
   ============================================ */

.tv-btn-group {
  display: inline-flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tv-btn-group--padded {
  padding: 0.5rem;
  background: var(--tv-bg-muted);
  border-radius: var(--tv-radius-md);
  border: 1px solid var(--tv-border);
}

/* ============================================
   STAT TREND MINI (inline)
   ============================================ */

.tv-trend-mini {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--tv-radius-sm);
}

.tv-trend-mini--up {
  color: var(--tv-success);
  background: var(--tv-success-soft);
}

.tv-trend-mini--down {
  color: var(--tv-danger);
  background: var(--tv-danger-soft);
}

/* ============================================
   ACCESSIBILITY: PREFERS-REDUCED-MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .tv-lift:hover,
  .tv-lift-sm:hover {
    transform: none;
  }

  .tv-bg-aurora::before {
    animation: none;
  }

  .tv-login-form-card {
    animation: none;
  }
}
