/* ==========================================================================
   PARENTAL CONTROL ADMIN DASHBOARD - DESIGN SYSTEM
   Modern Dark Theme with Glassmorphism, Micro-interactions & Responsive Grid
   ========================================================================== */

:root {
  --bg-main: #0B0F17;
  --bg-card: rgba(22, 30, 46, 0.75);
  --bg-card-hover: rgba(30, 41, 64, 0.85);
  --bg-card-secondary: rgba(15, 23, 42, 0.65);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(99, 102, 241, 0.3);
  
  --primary: #6366F1;
  --primary-hover: #4F46E5;
  --primary-glow: rgba(99, 102, 241, 0.35);
  
  --success: #10B981;
  --success-glow: rgba(16, 185, 129, 0.3);
  --warning: #F59E0B;
  --warning-glow: rgba(245, 158, 11, 0.3);
  --danger: #EF4444;
  --danger-glow: rgba(239, 68, 68, 0.35);
  
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dim: #64748B;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  
  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-subtle);
  --shadow-modal: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1);
  --blur-glass: blur(16px);
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  position: relative;
}

/* Background Ambient Glows */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
}

.glow-1 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, #4338CA 0%, transparent 70%);
  top: -150px;
  left: -100px;
}

.glow-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #059669 0%, transparent 70%);
  bottom: 50px;
  right: -100px;
}

.glow-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #DC2626 0%, transparent 70%);
  top: 40%;
  left: 45%;
  opacity: 0.2;
}

/* ==========================================================================
   Authentication: Login Screen Overlay & Remember Me
   ========================================================================== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 13, 20, 0.88);
  backdrop-filter: blur(16px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  text-align: center;
}

.login-icon-box {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #818CF8;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.login-title {
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-main);
}

.login-subtitle {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.4;
}

.remember-me-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-top: 12px;
  margin-bottom: 14px;
}

.remember-me-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--text-muted);
  cursor: pointer;
}

.remember-me-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-color);
  cursor: pointer;
}

.login-error-msg {
  display: none;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #F87171;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  margin-bottom: 14px;
}

.login-footer-hint {
  margin-top: 20px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.app-container {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--primary) 0%, #3B82F6 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 8px 20px var(--primary-glow);
}

.brand-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #FFFFFF 0%, #CBD5E1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.server-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.pwa-install-btn {
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  border: 1px solid rgba(129, 140, 248, 0.4);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  font-weight: 600;
  animation: pulse-subtle 3s infinite;
}

.pwa-install-btn:hover {
  background: linear-gradient(135deg, #4338CA 0%, #6D28D9 100%);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.5);
  transform: translateY(-1px);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-dim);
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: pulse-dot 2s infinite;
}

.status-dot.offline {
  background: var(--danger);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.15); }
}

/* Global Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-blue { background: rgba(99, 102, 241, 0.15); color: #818CF8; }
.icon-green { background: rgba(16, 185, 129, 0.15); color: #34D399; }
.icon-red { background: rgba(239, 68, 68, 0.15); color: #F87171; }
.icon-amber { background: rgba(245, 158, 11, 0.15); color: #FBBF24; }

.stat-value {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Main Content & Section Headers */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Devices Grid */
.devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 22px;
  margin-bottom: 40px;
}

/* Device Card */
.device-card {
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.device-card:hover {
  border-color: var(--border-highlight);
  background: var(--bg-card-hover);
}

.device-card.locked {
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 10px 30px -5px rgba(239, 68, 68, 0.2), 0 0 0 1px rgba(239, 68, 68, 0.3);
}

.device-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.device-title-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.device-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1E293B 0%, #334155 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94A3B8;
  font-size: 1.3rem;
  border: 1px solid var(--border-subtle);
}

.device-card.locked .device-avatar {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(185, 28, 28, 0.4) 100%);
  color: #F87171;
}

.device-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #FFFFFF;
}

.device-user {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.badge-status {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-online { background: rgba(16, 185, 129, 0.15); color: #34D399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-offline { background: rgba(100, 116, 139, 0.15); color: #94A3B8; border: 1px solid rgba(100, 116, 139, 0.3); }
.badge-locked { background: rgba(239, 68, 68, 0.15); color: #F87171; border: 1px solid rgba(239, 68, 68, 0.3); }

/* Progress & Quota Bar */
.time-progress-section {
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 18px;
}

.time-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.time-used-text {
  color: var(--text-muted);
}

.time-remaining-highlight {
  font-weight: 700;
  color: var(--text-main);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366F1 0%, #3B82F6 100%);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.progress-bar-fill.warning {
  background: linear-gradient(90deg, #F59E0B 0%, #D97706 100%);
}

.progress-bar-fill.danger {
  background: linear-gradient(90deg, #EF4444 0%, #B91C1C 100%);
}

.bonus-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: #34D399;
  background: rgba(16, 185, 129, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 6px;
}

/* PIN badge on card */
.active-pin-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(99, 102, 241, 0.12);
  border: 1px dashed rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 18px;
}

.pin-badge-text {
  font-size: 0.8rem;
  color: #A5B4FC;
}

.pin-badge-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: 0.15em;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
}

/* Device Card Actions */
.device-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: auto;
}

.device-actions-row2 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #4F46E5 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4F46E5 0%, #4338CA 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--primary-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 12px var(--danger-glow);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 12px var(--success-glow);
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  background: var(--bg-card);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto 20px;
  font-size: 0.9rem;
}

.empty-instructions {
  background: rgba(0, 0, 0, 0.4);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: #A5B4FC;
  border: 1px solid var(--border-subtle);
  max-width: 100%;
  overflow-x: auto;
}

/* Logs Section */
.logs-section {
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.logs-container {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.log-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card-secondary);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.85rem;
}

.log-time {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 62px;
  font-weight: 500;
}

.log-type-tag {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}

.log-details {
  flex: 1;
  word-break: break-word;
}

.tag-lock { background: rgba(239, 68, 68, 0.2); color: #F87171; }
.tag-unlock { background: rgba(16, 185, 129, 0.2); color: #34D399; }
.tag-pin { background: rgba(99, 102, 241, 0.2); color: #A5B4FC; }
.tag-login { background: rgba(16, 185, 129, 0.2); color: #34D399; }
.tag-logout { background: rgba(148, 163, 184, 0.2); color: #94A3B8; }
.tag-info { background: rgba(100, 116, 139, 0.2); color: #CBD5E1; }

/* Status Pictograms on Device Cards */
.device-status-badge {
  display: flex;
  align-items: center;
}

.status-pictogram {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.95rem;
  line-height: 1;
  user-select: none;
  cursor: default;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.status-pictogram.locked {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.45);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
}

.status-pictogram.online {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.25);
}

.status-pictogram.offline {
  background: rgba(100, 116, 139, 0.12);
  border: 1px solid rgba(100, 116, 139, 0.25);
  opacity: 0.65;
}

.empty-logs {
  color: var(--text-dim);
  text-align: center;
  padding: 24px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 8, 15, 0.85);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-backdrop.open {
  display: flex;
  opacity: 1;
}

.modal-card {
  background: #131B2E;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
  animation: modal-pop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card.modal-lg {
  max-width: 900px;
}

@keyframes modal-pop {
  0% { transform: scale(0.95) translateY(10px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

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

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 18px 24px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(10, 15, 28, 0.6);
}

/* Forms in Modals */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-range {
  width: 100%;
  accent-color: var(--primary);
  margin: 10px 0;
  cursor: pointer;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.quota-val-badge {
  font-size: 0.82rem;
  font-weight: 700;
  color: #818CF8;
  background: rgba(99, 102, 241, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Active PIN Display Card inside Modal */
.active-pin-display {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-md);
  padding: 22px;
  text-align: center;
  margin-bottom: 24px;
}

.pin-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #A5B4FC;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.pin-huge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  color: #FFFFFF;
  text-shadow: 0 0 20px var(--primary-glow);
  margin: 6px 0;
}

.pin-meta {
  font-size: 0.82rem;
  color: #CBD5E1;
  margin-bottom: 4px;
}

.pin-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.quick-messages, .schedule-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.preset-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-right: 4px;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: var(--transition);
}

.preset-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
  color: #fff;
}

/* 24/7 Schedule Grid */
.schedule-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 16px 0 12px;
  font-size: 0.82rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-box {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.legend-box.allowed { background: #10B981; }
.legend-box.blocked { background: #EF4444; }

.legend-hint {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 0.78rem;
}

.schedule-grid-container {
  overflow-x: auto;
  padding-bottom: 10px;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 650px;
  user-select: none;
}

.schedule-table th, .schedule-table td {
  padding: 6px 3px;
  text-align: center;
  font-size: 0.72rem;
}

.schedule-table th {
  color: var(--text-muted);
  font-weight: 500;
}

.day-label {
  text-align: left !important;
  font-weight: 600 !important;
  color: var(--text-main) !important;
  width: 110px;
  font-size: 0.8rem !important;
}

.hour-cell {
  height: 28px;
  min-width: 22px;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.1s ease, background-color 0.15s ease;
  border: 1px solid rgba(0, 0, 0, 0.4);
}

.hour-cell.allowed {
  background: #10B981;
}

.hour-cell.blocked {
  background: #EF4444;
}

.hour-cell:hover {
  transform: scale(1.15);
  z-index: 2;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

/* Toast Stacking */
.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: #1E293B;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  color: #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.3s ease;
  pointer-events: auto;
}

.toast.toast-success { border-color: rgba(16, 185, 129, 0.5); }
.toast.toast-error { border-color: rgba(239, 68, 68, 0.5); }

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

/* ==========================================================================
   AUTHENTICATION & LOGIN SCREEN
   ========================================================================== */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(11, 15, 23, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: rgba(22, 30, 46, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(99, 102, 241, 0.2);
  text-align: center;
  animation: login-card-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes login-card-in {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-icon-box {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(79, 70, 229, 0.15) 100%);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: #A5B4FC;
  box-shadow: 0 0 25px var(--primary-glow);
}

.login-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.login-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 26px;
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input {
  width: 100%;
  padding-right: 46px !important;
  font-size: 1.05rem !important;
  letter-spacing: 0.05em;
}

.btn-toggle-pw {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  font-size: 1.1rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-toggle-pw:hover {
  color: var(--text-main);
  transform: scale(1.1);
}

.login-error-msg, .form-error-msg {
  color: #F87171;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  margin-bottom: 16px;
  display: none;
  text-align: left;
}

.login-footer-hint {
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Header Admin Profile Controls */
.admin-profile-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
}

.admin-name {
  color: #C7D2FE;
  font-weight: 600;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: 6px;
}

.btn-danger-subtle {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #FCA5A5;
}

.btn-danger-subtle:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.45);
  color: #FFFFFF;
}

/* Danger Zone in Settings */
.danger-zone-box {
  margin-top: 22px;
  padding: 16px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.danger-zone-text strong {
  color: #F87171;
  font-size: 0.88rem;
  display: block;
  margin-bottom: 2px;
}

.danger-zone-text p {
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* Modal sizes & Delete styling */
.modal-sm {
  max-width: 440px;
}

.delete-icon-header {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 12px;
}

.delete-confirm-text {
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 10px;
  line-height: 1.5;
}

.delete-confirm-subtext {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.btn-card-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.78rem;
  border-radius: 4px;
  transition: var(--transition);
}

.btn-card-delete:hover {
  color: #EF4444;
  background: rgba(239, 68, 68, 0.12);
}

/* ==========================================================================
   Navigation Tabs Bar & Tab Panes
   ========================================================================== */
.nav-tabs-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.nav-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab-btn.active {
  color: #FFFFFF;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(129, 140, 248, 0.15) 100%);
  border: 1px solid rgba(99, 102, 241, 0.4);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.2);
}

.tab-icon {
  font-size: 1.1rem;
}

.tab-badge {
  background: var(--primary-color);
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Tab Panes */
.tab-pane {
  display: block;
  animation: fadeInTab 0.25s ease forwards;
}

@keyframes fadeInTab {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Stats Section & Filter Controls
   ========================================================================== */
.stats-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 24px;
}

.stats-filter-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stats-filter-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stats-select {
  padding: 6px 12px;
  min-width: 220px;
  font-size: 0.88rem;
  background: var(--bg-card-secondary);
}

.btn-group {
  display: inline-flex;
  background: var(--bg-card-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.btn-group .btn {
  border: none;
  background: transparent;
  padding: 5px 12px;
  font-size: 0.8rem;
  border-radius: 4px;
  color: var(--text-muted);
}

.btn-group .btn.active {
  background: var(--primary-color);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
}

/* Summary KPI Grid */
.stats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.3);
}

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.icon-indigo { background: rgba(99, 102, 241, 0.15); border: 1px solid rgba(99, 102, 241, 0.3); }

.kpi-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  font-family: 'Outfit', sans-serif;
}

.kpi-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  position: relative;
}

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.chart-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.chart-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.dot-used { background: #6366F1; }
.dot-bonus { background: #10B981; }
.dot-quota { background: #F59E0B; border: 1px dashed #F59E0B; }
.dot-hourly { background: linear-gradient(180deg, #818CF8 0%, #4F46E5 100%); }

.chart-body {
  position: relative;
  min-height: 220px;
  width: 100%;
}

/* SVG Chart Elements */
.svg-chart-container {
  width: 100%;
  height: 220px;
  overflow: visible;
}

.chart-bar-group {
  cursor: pointer;
}

.chart-bar-group:hover .chart-bar-rect {
  filter: brightness(1.25);
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.75rem;
  color: #F8FAFC;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  z-index: 100;
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

/* Analytics Table */
.table-card {
  margin-top: 24px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.analytics-table th {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.analytics-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.analytics-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.status-badge-ok {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge-over {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.15);
  color: #F87171;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge-zero {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(100, 116, 139, 0.15);
  color: #94A3B8;
  font-size: 0.75rem;
}

.standalone-logs {
  margin-top: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .app-container {
    padding: 16px 12px 60px;
  }
  
  .devices-grid {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .stats-controls-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-select {
    min-width: 100%;
  }

  .device-actions-row2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .header-status {
    flex-wrap: wrap;
  }
}

/* Quick Remaining Time Editor Styles */
.btn-edit-time {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #818CF8;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  cursor: pointer;
  margin-left: 6px;
  transition: all 0.2s ease;
  vertical-align: middle;
}

.btn-edit-time:hover {
  background: rgba(99, 102, 241, 0.3);
  color: #FFFFFF;
  border-color: #6366F1;
}

.input-with-addon {
  display: flex;
  align-items: center;
  position: relative;
}

.input-with-addon .form-input {
  padding-right: 50px;
}

.input-addon {
  position: absolute;
  right: 12px;
  color: #64748B;
  font-size: 0.85rem;
  font-weight: 500;
  pointer-events: none;
}
