/* =================================================================== */
/* Modern License Panel CSS - Professional Design System              */
/* =================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* =================================================================== */
/* CSS Variables - Dark Theme (Default)                               */
/* =================================================================== */

:root,
:root[data-theme="dark"] {
  /* Background Colors */
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-card: #141414;
  --bg-elevated: #1a1a1a;
  --bg-hover: #1f1f1f;

  /* Border Colors */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.15);

  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --text-tertiary: #6b6b6b;

  /* Brand Colors */
  --brand-blue: #0ea5e9;
  --brand-blue-hover: #0284c7;
  --brand-purple: #8b5cf6;
  --brand-green: #10b981;
  --brand-orange: #f59e0b;
  --brand-red: #ef4444;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* =================================================================== */
/* CSS Variables - Light Theme                                         */
/* =================================================================== */

:root[data-theme="light"] {
  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-card: #ffffff;
  --bg-elevated: #f1f3f5;
  --bg-hover: #e9ecef;

  /* Border Colors */
  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-default: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.15);

  /* Text Colors */
  --text-primary: #1a1a1a;
  --text-secondary: #6b6b6b;
  --text-tertiary: #a0a0a0;

  /* Brand Colors - Same as dark theme */
  --brand-blue: #0ea5e9;
  --brand-blue-hover: #0284c7;
  --brand-purple: #8b5cf6;
  --brand-green: #10b981;
  --brand-orange: #f59e0b;
  --brand-red: #ef4444;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.2);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* =================================================================== */
/* Base Styles                                                         */
/* =================================================================== */

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =================================================================== */
/* Login Page - Modern Card Design                                     */
/* =================================================================== */

.login-wrapper {
  min-height: 100vh;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 2rem;
  background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(14, 165, 233, 0.15), transparent), var(--bg-primary);
}

.login-container {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 3rem 2.5rem;
  box-shadow: var(--shadow-xl);
  position: relative;
  overflow: hidden;
  display: block !important;
}

.login-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(14, 165, 233, 0.5), transparent);
}

.login-header {
  text-align: center;
  margin-bottom: 2.5rem;
  display: block !important;
}

.login-header .logo {
  display: flex !important;
  justify-content: center !important;
  margin-bottom: 1.5rem;
}

.login-header .logo img {
  width: 80px;
  height: auto;
  border-radius: 8px;
  filter: drop-shadow(0 0 20px rgba(14, 165, 233, 0.3));
}

.login-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.login-form {
  display: flex !important;
  flex-direction: column !important;
  width: 100%;
  gap: 0;
}

.login-form[style*="display: none"],
.login-form[style*="display:none"] {
  display: none !important;
}

.login-form[style*="display: flex"],
.login-form[style*="display:flex"],
.login-form[style*="display: block"],
.login-form[style*="display:block"] {
  display: flex !important;
  flex-direction: column !important;
}

.login-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  display: block !important;
}

.btn-toggle {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-base);
  padding: 0.5rem;
  display: inline-block !important;
  width: auto !important;
}

.btn-toggle:hover {
  color: var(--text-primary);
}

.btn-toggle .toggle-text {
  color: var(--brand-blue);
  font-weight: 600;
  text-decoration: underline;
}

.credits-footer {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  text-align: center;
  padding: 1.25rem;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  background: transparent;
  /* Oculta el pie de página en todas las vistas */
  display: none !important;
}

.credits-footer a {
  pointer-events: auto;
}

.credits-footer p {
  margin: 0;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
  display: block !important;
  width: 100%;
}

.form-group label {
  display: block !important;
  margin-bottom: 0.625rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: all var(--transition-base);
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand-blue);
  background: var(--bg-primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

input::placeholder {
  color: var(--text-tertiary);
}

/* Buttons */
.btn,
.btn-primary,
button.btn-primary {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: linear-gradient(135deg, var(--brand-blue) 0%, #0284c7 100%);
  color: white !important;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
  position: relative;
  overflow: hidden;
  display: block !important;
  text-align: center;
}

.btn::before,
.btn-primary::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before,
.btn-primary:hover::before {
  left: 100%;
}

.btn:hover,
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

.btn:active,
.btn-primary:active {
  transform: translateY(0);
}

.login-btn {
  margin-top: 0.5rem;
}

.register-btn {
  width: 100%;
  margin-top: 1rem;
  padding: 0.875rem 1.5rem;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.register-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

/* Login Footer */
/* Rest of the code here */

/* Dashboard Layout                                                    */
/* =================================================================== */

.app-main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Dashboard Layout - Sidebar + Main Content                          */
/* =================================================================== */

.dashboard-wrapper {
  display: flex;
  min-height: 100vh;
  background: var(--bg-primary);
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-default);
}

.sidebar-header .logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-header .logo svg {
  width: 28px;
  height: 28px;
  color: var(--brand-blue);
}

/* User Profile Section in Sidebar */
.user-profile-section {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: left;
  width: 100%;
}

.nav-item i {
  width: 20px;
  font-size: 1rem;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.nav-item.active {
  background: rgba(14, 165, 233, 0.1);
  color: var(--brand-blue);
  border-color: rgba(14, 165, 233, 0.2);
  font-weight: 600;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-default);
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.875rem 1rem;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--brand-red);
  border-color: rgba(239, 68, 68, 0.2);
}

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 2rem;
  max-width: 1400px;
  margin-left: 280px;
  margin-right: auto;
  width: 100%;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  gap: 1rem;
}

.content-header > div {
  flex: 1;
}

.content-header h2,
.content-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.content-header p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.content-header .btn-primary {
  width: auto !important;
  padding: 0.625rem 1.25rem !important;
  font-size: 0.875rem !important;
  display: inline-flex !important;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.content-header .btn-primary svg {
  width: 16px;
  height: 16px;
}

/* Activity Section */
.activity-section {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 2rem;
}

.activity-section .content-header {
  margin-bottom: 1.5rem;
}

.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.activity-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: currentColor;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.activity-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-default);
  transform: translateX(4px);
}

.activity-item:hover::before {
  opacity: 1;
}

/* Color-coded activity icons for different event types */
.activity-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-base);
}

.activity-icon svg {
  width: 20px;
  height: 20px;
}

.activity-icon.magenta {
  background: rgba(14, 165, 233, 0.1);
  color: #0ea5e9;
  border: 1px solid rgba(14, 165, 233, 0.2);
}

.activity-item:has(.activity-icon.magenta)::before {
  color: #0ea5e9;
}

.activity-icon.cyan {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.activity-item:has(.activity-icon.cyan)::before {
  color: #10b981;
}

.activity-icon.yellow {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.activity-item:has(.activity-icon.yellow)::before {
  color: #f59e0b;
}

.activity-icon.green {
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.activity-item:has(.activity-icon.green)::before {
  color: #8b5cf6;
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.375rem 0;
  letter-spacing: -0.01em;
}

.activity-description {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0 0 0.5rem 0;
  line-height: 1.5;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.activity-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

/* Icon Overlay for Stats */
.icon-overlay {
  position: absolute;
  right: 1.5rem;
  top: 1.5rem;
  font-size: 2rem;
  opacity: 0.1;
}

.icon-overlay.blue {
  color: var(--brand-blue);
}
.icon-overlay.purple {
  color: var(--brand-purple);
}
.icon-overlay.green {
  color: var(--brand-green);
}
.icon-overlay.red {
  color: var(--brand-red);
}

/* Header */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-default);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo img {
  width: 40px;
  height: auto;
}

.user-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Navigation Tabs */
.nav-tabs {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-default);
  padding: 0 2rem;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  position: relative;
  border-bottom: 2px solid transparent;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.tab-btn.active {
  color: var(--brand-blue);
  border-bottom-color: var(--brand-blue);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-purple));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.stat-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card h3 {
  font-size: 0.6875rem; /* Reduced font size from 0.75rem to 0.6875rem for smaller text */
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.stat-card p {
  font-size: 1.75rem; /* Reduced font size from 2rem to 1.75rem for smaller numbers */
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* Data Tables */
.data-table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-default);
}

table td {
  padding: 1rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-subtle);
}

table tr:last-child td {
  border-bottom: none;
}

table tr:hover {
  background: var(--bg-hover);
}

/* Action Buttons - Small horizontal buttons for table actions */
.action-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.action-buttons .btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.action-buttons .btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.action-buttons .btn-icon.delete:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--brand-red);
  border-color: rgba(239, 68, 68, 0.3);
}

.action-buttons .btn-icon svg {
  width: 14px;
  height: 14px;
}

/* Status badges for tables */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-badge.activo,
.status-badge.activa {
  background: rgba(16, 185, 129, 0.1);
  color: var(--brand-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.inactivo,
.status-badge.inactiva {
  background: rgba(107, 107, 107, 0.1);
  color: var(--text-tertiary);
  border: 1px solid rgba(107, 107, 107, 0.2);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge.active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--brand-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge.inactive {
  background: rgba(107, 107, 107, 0.1);
  color: var(--text-tertiary);
  border: 1px solid rgba(107, 107, 107, 0.2);
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: none !important;
  align-items: center;
  justify-content: center;
  z-index: 10050;
  padding: 2rem;
}

.modal.active,
.modal[style*="display: flex"],
.modal[style*="display:flex"] {
  display: flex !important;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-large {
  max-width: 1200px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-default);
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-close {
  display: none !important;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-default);
}

.modal-footer .btn,
.modal-footer .btn-primary,
.modal-footer .btn-secondary {
  width: auto !important;
  padding: 0.625rem 1.25rem !important;
  font-size: 0.875rem !important;
}

.modal-footer .btn-secondary {
  background: transparent !important;
  color: var(--text-secondary) !important;
  border: 1px solid var(--border-default) !important;
  box-shadow: none !important;
}

.modal-footer .btn-secondary:hover {
  background: var(--bg-hover) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-strong) !important;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border-default);
  color: var(--text-tertiary);
  font-size: 0.8125rem;
}

/* =================================================================== */
/* Toast Notifications                                                 */
/* =================================================================== */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 320px;
  max-width: 420px;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.success {
  border-left: 4px solid var(--brand-green);
}

.toast.success .toast-icon {
  color: var(--brand-green);
}

.toast.error {
  border-left: 4px solid var(--brand-red);
}

.toast.error .toast-icon {
  color: var(--brand-red);
}

.toast.info {
  border-left: 4px solid var(--brand-blue);
}

.toast.info .toast-icon {
  color: var(--brand-blue);
}

.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

.toast-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toast-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.toast-message {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.toast-close {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  padding: 0;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-close:hover {
  color: var(--text-primary);
}

.toast-close svg {
  width: 16px;
  height: 16px;
}

/* Responsive toast notifications */
@media (max-width: 640px) {
  .toast-container {
    left: 12px;
    right: 12px;
    top: 12px;
  }

  .toast {
    min-width: auto;
    max-width: none;
    width: 100%;
  }
}

/* =================================================================== */
/* Ticket Detail UI                                                     */
/* =================================================================== */

.ticket-detail-container {
  display: grid;
  grid-template-columns: minmax(380px, 38%) minmax(0, 62%);
  gap: 28px;
}

.ticket-sidebar,
.ticket-main {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

/* Usuario */
.ticket-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.user-avatar-large {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-default);
}

.ticket-user-info h3 { font-size: 1rem; margin: 0; }
.ticket-user-info p { color: var(--text-secondary); margin: 0; }

/* Meta en grid */
.ticket-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.meta-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px;
}

.meta-item label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.meta-item span { font-weight: 600; }

/* Acciones admin */
.ticket-actions {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-subtle);
}

/* Descripción y comentarios */
.ticket-description-section,
.ticket-comments-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
}

.ticket-description-section h3,
.ticket-comments-section h3 { margin-bottom: 10px; }

.ticket-description-section p {
  font-size: 0.95rem;
  line-height: 1.7;
}

.comments-list { display: flex; flex-direction: column; gap: 12px; }

.comment-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px;
  line-height: 1.45;
}

.comment-item.admin-comment {
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(14, 165, 233, 0.35);
}

.comment-item.user-comment {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
}

.comment-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px; align-items: start; margin-top: 12px;
}

#ticketCommentInput { resize: vertical; min-height: 90px; }

/* Badges de estado de tickets */
.status-badge.pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--brand-orange);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.status-badge.en-curso {
  background: rgba(14, 165, 233, 0.15);
  color: var(--brand-blue);
  border: 1px solid rgba(14, 165, 233, 0.35);
}

.status-badge.completed {
  background: rgba(16, 185, 129, 0.15);
  color: var(--brand-green);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.status-badge.closed {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
  border: 1px solid rgba(107, 114, 128, 0.35);
}

/* Responsive */
@media (min-width: 1400px) {
  .modal-large { max-width: 1280px; }
  .ticket-detail-container { grid-template-columns: minmax(420px, 36%) minmax(0, 64%); }
}

@media (max-width: 1200px) {
  .modal-large { max-width: 1000px; }
  .ticket-detail-container { grid-template-columns: 360px 1fr; gap: 20px; }
}

@media (max-width: 768px) {
  .ticket-detail-container { grid-template-columns: 1fr; }
}

/* Responsive */
@media (max-width: 1200px) {
  .main-content { margin-left: 240px; }
}

/* NUEVO: overlay del sidebar para pantallas medianas */
@media (max-width: 1100px) {
  .menu-toggle { display: flex; }
  .sidebar { transform: translateX(-100%); transition: transform var(--transition-base); z-index: 200; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 1.5rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  .sidebar { transform: translateX(-100%); transition: transform var(--transition-base); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr; }
}

/* Controles de brand para móvil en el header */
.mobile-brand-controls { display: none; gap: 8px; align-items: center; }
.mobile-logo { width: 28px; height: auto; border-radius: 4px; }
.content-subtitle { /* subtítulo por defecto visible en desktop */ }

@media (max-width: 768px) {
  .content-header { align-items: center; }
  .mobile-brand-controls { display: flex; margin-left: auto; }
  .content-subtitle { display: none; }
}

/* Botón de menú móvil */
.menu-toggle {
  position: fixed;
  left: auto;
  right: 12px;
  top: 12px;
  z-index: 200;
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  display: none; /* visible solo en móvil */
  align-items: center;
  justify-content: center;
}
.menu-toggle:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-strong); }

/* Backdrop para overlay del sidebar */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}
.sidebar-backdrop.visible { opacity: 1; pointer-events: auto; }

/* Mostrar botón en móviles y usar overlay */
@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  .sidebar { transform: translateX(-100%); transition: transform var(--transition-base); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr; }
}

/* =================================================================== */
/* Data Management Section - Add Buttons                              */
/* =================================================================== */

.hidden-field { display: none !important; }

.data-management-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.data-management-header .btn-primary {
  width: auto !important;
  padding: 0.625rem 1.25rem !important;
  font-size: 0.875rem !important;
  display: inline-flex !important;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.data-management-header .btn-primary svg {
  width: 16px;
  height: 16px;
}

/* Removed permanent hiding of add buttons - now controlled by JavaScript based on user role */
