* {
  box-sizing: border-box;
}

/* Touch-friendly interactions */
button, .btn, input[type="button"], input[type="submit"] {
  min-height: 44px; /* iOS recommended touch target size */
  min-width: 44px;
  touch-action: manipulation; /* Prevents double-tap zoom */
}

/* Improve text readability on mobile */
@media (max-width: 768px) {
  body {
    font-size: 16px; /* Prevents zoom on iOS */
    line-height: 1.5;
  }
  
  input, textarea, select {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, 'Helvetica Neue', Arial, sans-serif;
  margin: 0;
  background: #0b1220;
  color: #e6e9f0;
}
a {
  color: #9cc1ff;
  text-decoration: none;
}
.container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 1.5rem;
}

.report-container {
  max-width: 100%;
  padding: 0.5rem;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #1b243b;
  background: #0e172a;
  position: sticky;
  top: 0;
}
.brand {
  font-weight: 700;
}
form {
  display: grid;
  gap: .75rem;
  max-width: 380px;
  margin-top: 1rem;
}
label {
  display: grid;
  gap: .35rem;
  font-size: .95rem;
}
input {
  padding: .65rem .75rem;
  border-radius: .55rem;
  border: 1px solid #24304d;
  background: #0e172a;
  color: #e6e9f0;
}
button {
  padding: .65rem .9rem;
  border-radius: .55rem;
  border: 1px solid #2b3a60;
  background: #1a2542;
  color: #e6e9f0;
  cursor: pointer;
}
button:hover {
  background: #22305a;
}
.muted {
  color: #9aa3b2;
}
.error {
  color: #ff8a8a;
}
.card-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.card {
  border: 1px solid #203053;
  border-radius: 12px;
  padding: 1rem;
  background: #0e172a;
}
.iframe-wrap {
  position: relative;
  width: 100%;
  padding-top: 62%;
}
.iframe-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 12px;
}

/* Admin Panel Styles */
.admin-link {
  color: #ffd700;
  text-decoration: none;
  margin-right: 1rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.3);
  transition: all 0.3s ease;
}

.admin-link:hover {
  background: rgba(255, 215, 0, 0.2);
  border-color: rgba(255, 215, 0, 0.5);
}

.admin-dashboard {
  background: #0e172a;
  border-radius: 12px;
  padding: 2rem;
  border: 1px solid #1b243b;
}

.admin-dashboard h1 {
  color: #e6e9f0;
  margin-bottom: 0.5rem;
  font-size: 2rem;
}

.admin-dashboard .subtitle {
  color: #9aa3b2;
  margin-bottom: 2rem;
}

.api-key-section {
  background: #1b243b;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  border: 1px solid #2d3748;
}

.api-key-section label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #e6e9f0;
}

.api-key-section input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 0.55rem;
  border: 1px solid #2d3748;
  background: #0b1220;
  color: #e6e9f0;
  margin-bottom: 0.75rem;
}

.api-key-section input:focus {
  outline: none;
  border-color: #9cc1ff;
  box-shadow: 0 0 0 2px rgba(156, 193, 255, 0.2);
}

.admin-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid #1b243b;
}

.tab-btn {
  background: none;
  border: none;
  color: #9aa3b2;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.tab-btn:hover {
  color: #e6e9f0;
}

.tab-btn.active {
  color: #9cc1ff;
  border-bottom-color: #9cc1ff;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.section-header h2 {
  color: #e6e9f0;
  margin: 0;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: transform 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
}

.btn-secondary {
  background: #1a2542;
  color: #e6e9f0;
  border: 1px solid #2b3a60;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.btn-secondary:hover {
  background: #22305a;
}

.btn-danger {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.btn-danger:hover {
  background: #c0392b;
}

.user-card, .report-card {
  background: #0e172a;
  border: 1px solid #1b243b;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.user-info, .report-info {
  flex: 1;
}

.user-info h3, .report-info h3 {
  color: #e6e9f0;
  margin: 0 0 0.5rem 0;
}

.user-role {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
}

.role-user {
  background: rgba(52, 152, 219, 0.2);
  color: #3498db;
}

.role-admin {
  background: rgba(241, 196, 15, 0.2);
  color: #f1c40f;
}

.role-superuser {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
}

.report-id {
  color: #9aa3b2;
  font-size: 0.9rem;
  margin: 0.25rem 0;
}

.report-description {
  color: #9aa3b2;
  font-size: 0.9rem;
  margin: 0.5rem 0 0 0;
}

.user-actions, .report-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.permissions-btn {
  background: #9cc1ff;
  color: #0b1220;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
}

.permissions-btn:hover {
  background: #7ba3ff;
  transform: translateY(-1px);
}

.permissions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.permissions-list {
  background: #0e172a;
  border: 1px solid #1b243b;
  border-radius: 12px;
  padding: 1.5rem;
  max-height: 400px;
  overflow-y: auto;
}

.permissions-list h3 {
  color: #e6e9f0;
  margin: 0 0 1rem 0;
}

.permission-item {
  margin-bottom: 0.75rem;
}

.permission-item label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: #e6e9f0;
}

.permission-item input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
}

.modal-content {
  background: #0e172a;
  margin: 5% auto;
  padding: 0;
  border: 1px solid #1b243b;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #1b243b;
}

.modal-header h3 {
  color: #e6e9f0;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: #9aa3b2;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: #e6e9f0;
}

.modal form {
  padding: 1.5rem;
  max-width: none;
  margin: 0;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  color: #e6e9f0;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #1b243b;
  border-radius: 8px;
  background: #0b1220;
  color: #e6e9f0;
  font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #9cc1ff;
  box-shadow: 0 0 0 3px rgba(156, 193, 255, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
}

/* Notification Styles */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  z-index: 1001;
  animation: slideIn 0.3s ease;
}

.notification-success {
  background: #27ae60;
}

.notification-error {
  background: #e74c3c;
}

.notification-info {
  background: #3498db;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.loading {
  text-align: center;
  color: #9aa3b2;
  padding: 2rem;
}

.empty-state {
  text-align: center;
  color: #9aa3b2;
  padding: 2rem;
  background: #0e172a;
  border: 1px solid #1b243b;
  border-radius: 12px;
}

.error {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
}

/* Permissions Modal Styles */
.permissions-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
}

.permissions-modal-content {
  max-width: 600px;
  width: 90%;
  background: #0e172a;
  margin: 5% auto;
  border: 1px solid #1b243b;
  border-radius: 12px;
  max-height: 80vh;
  overflow-y: auto;
}

.permissions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #1b243b;
}

.permissions-header h3 {
  color: #e6e9f0;
  margin: 0;
}

.permissions-content {
  padding: 1.5rem;
}

.search-section {
  margin-bottom: 1.5rem;
}

.search-section .bulk-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.search-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #1b243b;
  border-radius: 8px;
  background: #0b1220;
  color: #e6e9f0;
  font-size: 1rem;
}

.search-input:focus {
  outline: none;
  border-color: #9cc1ff;
  box-shadow: 0 0 0 3px rgba(156, 193, 255, 0.1);
}

.reports-section {
  margin-bottom: 1.5rem;
}

.reports-section h4 {
  color: #e6e9f0;
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
}

.reports-list-scrollable {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #1b243b;
  border-radius: 8px;
  background: #0b1220;
  padding: 1rem;
}

.report-item {
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.report-item:hover {
  background: rgba(156, 193, 255, 0.05);
}

.report-checkbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  color: #e6e9f0;
  font-size: 0.95rem;
}

.report-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #9cc1ff;
}

.report-name {
  font-weight: 500;
  color: #e6e9f0;
}

.report-id {
  color: #9aa3b2;
  font-size: 0.85rem;
  font-style: italic;
}

.permissions-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid #1b243b;
}

.selected-count {
  color: #9aa3b2;
  font-size: 0.9rem;
}

.permissions-actions {
  display: flex;
  gap: 0.75rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .permissions-grid {
    grid-template-columns: 1fr;
  }
  
  .user-card, .report-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .user-actions, .report-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  .modal-content {
    width: 95%;
    margin: 10% auto;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .permissions-modal-content {
    width: 95%;
    margin: 5% auto;
  }
  
  .reports-list-scrollable {
    max-height: 250px;
  }
}

/* User Card Collapsible Permissions Styles */
.user-card {
  background: transparent;
  border: 1px solid #2D2D44;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
}

.user-card:hover {
  border-color: #4A4A6A;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.user-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  background: transparent;
  border-bottom: 1px solid #2D2D44;
  cursor: pointer;
  transition: background-color 0.2s ease;
  width: 100%;
}

.user-header:hover {
  background: rgba(42, 42, 62, 0.3);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.user-info h3 {
  margin: 0;
  color: #FFFFFF;
  font-size: 1.2rem;
  font-weight: 600;
}

.user-role {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  border-radius: 24px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.role-admin {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.1) 100%);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.role-superuser {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.1) 100%);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.role-user {
  background: linear-gradient(135deg, rgba(156, 163, 175, 0.15) 0%, rgba(156, 163, 175, 0.1) 100%);
  color: #9ca3af;
  border: 1px solid rgba(156, 163, 175, 0.3);
}

.user-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.permissions-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
  white-space: nowrap;
}

.permissions-toggle-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.toggle-icon {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
}

.user-permissions-section {
  background: transparent;
  border-top: 1px solid #2D2D44;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  width: 100%;
}

.user-permissions-section.expanded {
  max-height: 1000px;
  padding: 0.5rem;
}

.permissions-content {
  padding: 0;
  width: 100%;
}

.permissions-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: transparent;
  border-radius: 8px;
  border: 1px solid #3A3A5A;
  width: 100%;
}

.permissions-search {
  flex: 1;
  min-width: 200px;
  padding: 0.75rem 1rem;
  border: 1px solid #4A4A6A;
  border-radius: 6px;
  font-size: 0.9rem;
  background: transparent;
  color: #FFFFFF;
  transition: all 0.3s ease;
}

.permissions-search:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.permissions-search::placeholder {
  color: #9ca3af;
  font-style: italic;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border: 1px solid #4A4A6A;
  border-radius: 6px;
  background: transparent;
  color: #FFFFFF;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  white-space: nowrap;
}

.btn-sm:hover {
  background: rgba(58, 58, 90, 0.3);
  border-color: #6A6A8A;
  transform: translateY(-1px);
}

.save-permissions-btn {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
  color: white !important;
  border-color: #22c55e !important;
  font-weight: 600 !important;
  padding: 0.75rem 1.5rem !important;
}

.save-permissions-btn:hover {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%) !important;
  border-color: #16a34a !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 8px rgba(34, 197, 94, 0.3) !important;
}

.permissions-reports-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #3A3A5A;
  border-radius: 8px;
  background: transparent;
  padding: 0.5rem;
  width: 100%;
}

.permissions-reports-list::-webkit-scrollbar {
  width: 8px;
}

.permissions-reports-list::-webkit-scrollbar-track {
  background: #2A2A3E;
  border-radius: 4px;
}

.permissions-reports-list::-webkit-scrollbar-thumb {
  background: #4A4A6A;
  border-radius: 4px;
}

.permissions-reports-list::-webkit-scrollbar-thumb:hover {
  background: #6A6A8A;
}

.report-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  border: 1px solid #3A3A5A;
  border-radius: 6px;
  background: transparent;
  transition: all 0.2s ease;
  cursor: pointer;
  width: 100%;
}

.report-item:hover {
  background: rgba(58, 58, 90, 0.3);
  border-color: #5A5A7A;
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.report-item:last-child {
  margin-bottom: 0;
}

.report-checkbox {
  display: flex;
  align-items: center;
  cursor: pointer;
  margin: 0;
  flex: 1;
}

.report-checkbox input[type="checkbox"] {
  margin-right: 0.75rem;
  accent-color: #3b82f6;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.report-name {
  font-weight: 600;
  color: #FFFFFF;
  margin-right: 0.75rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.report-name::before {
  content: "📊";
  font-size: 0.9rem;
}

.report-id {
  color: #9ca3af;
  font-size: 0.8rem;
  font-style: italic;
  margin-left: auto;
}

.loading {
  text-align: center;
  color: #9ca3af;
  padding: 2rem;
  font-style: italic;
  font-size: 1.1rem;
}

.error {
  color: #ef4444;
  padding: 1.5rem;
  text-align: center;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
  border: 2px solid rgba(239, 68, 68, 0.2);
  border-radius: 12px;
  font-weight: 500;
}

.no-reports {
  text-align: center;
  color: #9ca3af;
  padding: 2rem;
  font-style: italic;
  font-size: 1.1rem;
  background: transparent;
  border-radius: 8px;
  border: 1px dashed rgba(156, 163, 175, 0.3);
}

/* ========================================
   RESPONSIVE DESIGN - MOBILE FIRST
   ======================================== */

/* Mobile First Base Styles */
.container {
  max-width: 100%;
  margin: 1rem auto;
  padding: 1rem;
}

/* Small Mobile Devices (320px - 480px) */
@media (max-width: 480px) {
  .container {
    padding: 0.5rem;
    margin: 0.5rem auto;
  }
  
  .topbar {
    padding: 0.75rem 1rem;
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }
  
  .brand {
    text-align: center;
    font-size: 1.1rem;
  }
  
  .topbar .user-info {
    text-align: center;
  }
  
  form {
    max-width: 100%;
    margin-top: 0.75rem;
  }
  
  input, button {
    padding: 0.75rem;
    font-size: 1rem;
  }
  
  .card-list {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .card {
    padding: 0.75rem;
  }
  
  .iframe-wrap {
    padding-top: 75%;
  }
  
  /* Admin Panel Mobile */
  .admin-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .admin-header h1 {
    font-size: 1.5rem;
    text-align: center;
  }
  
  .admin-controls {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .api-key-section {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .api-key-input {
    width: 100%;
  }
  
  .user-actions {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }
  
  .permissions-toggle-btn,
  .edit-user-btn,
  .delete-user-btn {
    width: 100%;
    justify-content: center;
  }
  
  .permissions-controls {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }
  
  .permissions-search {
    width: 100%;
    min-width: auto;
  }
  
  .btn-sm {
    width: 100%;
    text-align: center;
  }
  
  .report-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .report-checkbox {
    width: 100%;
  }
  
  .report-id {
    margin-left: 0;
    font-size: 0.75rem;
  }
}

/* Mobile Devices (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
  .container {
    padding: 1rem;
    margin: 1rem auto;
  }
  
  .topbar {
    padding: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
  }
  
  .brand {
    font-size: 1.2rem;
  }
  
  form {
    max-width: 100%;
  }
  
  .card-list {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
  }
  
  .iframe-wrap {
    padding-top: 70%;
  }
  
  /* Admin Panel Tablet */
  .admin-header {
    flex-direction: column;
    gap: 1rem;
  }
  
  .admin-controls {
    flex-wrap: wrap;
    gap: 1rem;
  }
  
  .user-actions {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .permissions-controls {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  
  .permissions-search {
    min-width: 200px;
    flex: 1;
  }
  
  .btn-sm {
    flex: 1;
    min-width: 120px;
  }
}

/* Tablet Devices (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    max-width: 800px;
    padding: 1.5rem;
  }
  
  .topbar {
    padding: 1rem 1.5rem;
  }
  
  .card-list {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
  }
  
  .iframe-wrap {
    padding-top: 65%;
  }
  
  /* Admin Panel Tablet */
  .admin-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  
  .user-actions {
    gap: 0.75rem;
  }
  
  .permissions-controls {
    gap: 1rem;
  }
}

/* Desktop Devices (1025px+) */
@media (min-width: 1025px) {
  .container {
    max-width: 900px;
    padding: 2rem;
  }
  
  .topbar {
    padding: 1rem 1.5rem;
  }
  
  .card-list {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
  }
  
  .iframe-wrap {
    padding-top: 62%;
  }
  
  /* Admin Panel Desktop */
  .admin-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  
  .user-actions {
    gap: 0.75rem;
  }
  
  .permissions-controls {
    gap: 1rem;
  }
}

/* Large Desktop Devices (1440px+) */
@media (min-width: 1440px) {
  .container {
    max-width: 1200px;
  }
  
  .card-list {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
  }
  
  .iframe-wrap {
    padding-top: 60%;
  }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .card {
    border-width: 0.5px;
  }
  
  .topbar {
    border-bottom-width: 0.5px;
  }
}

/* Landscape Mobile Orientation */
@media (max-width: 768px) and (orientation: landscape) {
  .topbar {
    flex-direction: row;
    padding: 0.5rem 1rem;
  }
  
  .iframe-wrap {
    padding-top: 50%;
  }
  
  .admin-header {
    flex-direction: row;
  }
  
  .user-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* Print Styles */
@media print {
  .topbar {
    display: none;
  }
  
  .card {
    break-inside: avoid;
    border: 1px solid #000;
    background: #fff;
    color: #000;
  }
  
  .iframe-wrap {
    display: none;
  }
}

/* Additional Mobile Optimizations */
@media (max-width: 768px) {
  /* Improve scrolling on mobile */
  .permissions-reports-list {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  
  /* Better touch targets for admin buttons */
  .user-actions button {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
  
  /* Improve modal responsiveness */
  .modal {
    width: 95%;
    max-width: 95%;
    margin: 1rem auto;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  /* Better form layout on mobile */
  .form-group {
    margin-bottom: 1rem;
  }
  
  .form-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
  }
  
  /* Improve notification positioning */
  .notification {
    position: fixed;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 1000;
    max-width: none;
  }
}

/* Tablet-specific optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    padding: 1.5rem;
  }
  
  .card-list {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
  
  .user-card {
    margin-bottom: 1.25rem;
  }
  
  .permissions-controls {
    flex-wrap: nowrap;
  }
}

/* Desktop optimizations */
@media (min-width: 1025px) {
  .container {
    padding: 2rem;
  }
  
  .card-list {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
  
  .user-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  }
  
  .report-item:hover {
    transform: translateX(6px);
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  /* Already using dark theme, but ensure consistency */
  body {
    background: #0b1220;
    color: #e6e9f0;
  }
}

/* Focus improvements for keyboard navigation */
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #3b82f6;
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 1000;
}

.skip-link:focus {
  top: 6px;
}

/* ========================================
   PROFILE PAGE STYLES
   ======================================== */

/* Auto-generated indicator */
.auto-generated {
  font-size: 0.8em;
  color: #888;
  font-style: italic;
  font-weight: normal;
}

.profile-dashboard {
  max-width: 800px;
  margin: 0 auto;
}

.profile-section {
  background: #1E1E2E;
  border: 1px solid #2D2D44;
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.profile-section h2 {
  color: #FFFFFF;
  margin: 0 0 1.5rem 0;
  font-size: 1.5rem;
  font-weight: 600;
  border-bottom: 2px solid #3A3A5A;
  padding-bottom: 0.75rem;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  color: #E6E9F0;
  font-weight: 600;
  font-size: 0.95rem;
}

.form-group input {
  padding: 0.75rem 1rem;
  border: 1px solid #4A4A6A;
  border-radius: 8px;
  background: #2A2A3E;
  color: #FFFFFF;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.form-group input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.form-group input.readonly-input {
  background: #1A1A2E;
  color: #9CA3AF;
  cursor: not-allowed;
}

.form-help {
  color: #9CA3AF;
  font-size: 0.875rem;
  font-style: italic;
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  align-self: flex-start;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.account-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: #2A2A3E;
  border-radius: 8px;
  border: 1px solid #3A3A5A;
}

.info-label {
  color: #9CA3AF;
  font-weight: 500;
}

.info-value {
  color: #FFFFFF;
  font-weight: 600;
}

.notification-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.notification {
  padding: 1rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  animation: slideIn 0.3s ease-out;
}

.notification-success {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
  border: 1px solid #22c55e;
}

.notification-error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: 1px solid #ef4444;
}

.notification-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  border: 1px solid #f59e0b;
}

.notification-info {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: 1px solid #3b82f6;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Profile link styling */
.profile-link {
  color: #9cc1ff;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.3s ease;
  font-weight: 500;
}

.profile-link:hover {
  background: rgba(156, 193, 255, 0.1);
  color: #ffffff;
}

/* Responsive profile styles */
@media (max-width: 768px) {
  .profile-section {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
  }
  
  .profile-form {
    gap: 1.25rem;
  }
  
  .form-group input {
    padding: 0.875rem 1rem;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  .btn-primary {
    width: 100%;
    text-align: center;
  }
  
  .info-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .notification-container {
    top: 0.5rem;
    right: 0.5rem;
    left: 0.5rem;
  }
  
  .notification {
    padding: 0.875rem 1rem;
    font-size: 0.9rem;
  }
}