/* ==========================================================================
   УУНиТ РАСПИСАНИЕ И КОНСПЕКТЫ — DESIGN SYSTEM & 120 FPS STYLES
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Dark Mode Palette (Default) */
  --bg-primary: #0A0E17;
  --bg-secondary: #111827;
  --bg-card: rgba(22, 30, 46, 0.7);
  --bg-card-hover: rgba(30, 41, 64, 0.85);
  --bg-input: rgba(15, 23, 42, 0.8);
  --bg-glass: rgba(15, 23, 42, 0.65);
  --bg-modal: rgba(11, 15, 25, 0.92);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  --border-card: rgba(255, 255, 255, 0.06);

  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --text-inverse: #0F172A;

  /* Accent Colors */
  --accent-blue: #3B82F6;
  --accent-indigo: #6366F1;
  --accent-cyan: #06B6D4;
  --accent-emerald: #10B981;
  --accent-amber: #F59E0B;
  --accent-rose: #F43F5E;
  --accent-purple: #A855F7;

  /* Lesson Type Badges */
  --badge-lecture: #3B82F6;
  --badge-practice: #10B981;
  --badge-lab: #EC4899;
  --badge-exam: #F59E0B;

  /* Shadows & Glass */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 24px rgba(99, 102, 241, 0.25);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="light"] {
  --bg-primary: #F1F5F9;
  --bg-secondary: #FFFFFF;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.98);
  --bg-input: #FFFFFF;
  --bg-glass: rgba(255, 255, 255, 0.75);
  --bg-modal: rgba(255, 255, 255, 0.96);

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(59, 130, 246, 0.5);
  --border-card: rgba(0, 0, 0, 0.06);

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --text-inverse: #FFFFFF;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.18);
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 60%, rgba(99, 102, 241, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 28px)); /* space for mobile bottom nav with safe area */
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.2);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.4);
}

/* ==========================================================================
   Header & Brand
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border-subtle);
  padding: calc(10px + env(safe-area-inset-top, 24px)) calc(14px + env(safe-area-inset-right, 0px)) 10px calc(14px + env(safe-area-inset-left, 0px));
}

.header-container {
  max-width: 1020px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #FFFFFF, #93C5FD);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .brand-title {
  background: linear-gradient(135deg, #0F172A, #1D4ED8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Group & Subgroup Selector Pill */
.group-selector-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.group-selector-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.group-selector-btn .pin-indicator {
  font-size: 10px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  transform: scale(1.05);
}

/* ==========================================================================
   Main Layout & Container
   ========================================================================== */

.main-container {
  max-width: 1020px;
  margin: 0 auto;
  padding: 16px 18px;
}

/* Tab Content Visibility */
.tab-pane {
  display: none;
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

/* ==========================================================================
   Tab 1: «Сегодня» (Today View)
   ========================================================================== */

.today-header-card {
  background: linear-gradient(135deg, rgba(30, 41, 64, 0.7), rgba(15, 23, 42, 0.8));
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.today-header-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-indigo), var(--accent-cyan));
}

.today-date-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.today-date-text {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.today-week-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.15);
  color: #A5B4FC;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Horizontal Day Picker */
.day-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.day-strip-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 4px;
  text-align: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.day-strip-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.day-strip-btn.active {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
  transform: translateY(-2px);
}

.day-strip-short {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.day-strip-num {
  font-size: 15px;
  font-weight: 800;
  margin-top: 2px;
}

/* Live Active Pair Banner («Идет сейчас») */
.live-pair-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(6, 182, 212, 0.1));
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.live-pulse-dot {
  width: 10px;
  height: 10px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  position: relative;
}

.live-pulse-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent-emerald);
  animation: pulseRing 1.5s infinite;
}

@keyframes pulseRing {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

.live-info {
  flex: 1;
}

.live-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.live-tag {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--accent-emerald);
  color: #064E3B;
}

.live-subject {
  font-size: 14px;
  font-weight: 700;
}

.live-details {
  font-size: 12px;
  color: var(--text-secondary);
}

.live-timer {
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-emerald);
  text-align: right;
  white-space: nowrap;
}

/* ==========================================================================
   Pair Cards & Slots
   ========================================================================== */

.pair-slot-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pair-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  backdrop-filter: blur(14px);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.pair-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-subtle);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.pair-card.is-current {
  border: 1px solid rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.pair-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.pair-time-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.pair-slot-num {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
}

.pair-type-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.pair-type-badge.lecture {
  background: rgba(59, 130, 246, 0.15);
  color: #60A5FA;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.pair-type-badge.practice {
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pair-type-badge.lab {
  background: rgba(236, 72, 153, 0.15);
  color: #F472B6;
  border: 1px solid rgba(236, 72, 153, 0.3);
}

.pair-subject {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 8px;
  line-height: 1.35;
}

.pair-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

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

.pair-meta-item svg {
  color: var(--text-muted);
}

.subgroup-tag {
  font-size: 11px;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* Attached Notes Section on Pair Card */
.pair-notes-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pair-contributors {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-stack {
  display: flex;
  align-items: center;
}

.contributor-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #FFFFFF;
  border: 2px solid var(--bg-secondary);
  margin-left: -6px;
}

.contributor-avatar:first-child {
  margin-left: 0;
}

.pair-notes-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.pair-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-open-notes {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #A5B4FC;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-open-notes:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #FFFFFF;
}

.btn-upload-quick {
  background: var(--accent-blue);
  color: #FFFFFF;
  border: none;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-upload-quick:hover {
  background: #2563EB;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

/* Free Window (Окно) Card */
.window-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 12px;
}

.window-card .window-time {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* ==========================================================================
   Tab 2: «Неделя» (Week View)
   ========================================================================== */

.week-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  backdrop-filter: blur(14px);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  margin-bottom: 20px;
}

.week-nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.week-title {
  font-size: 15px;
  font-weight: 700;
}

.subgroup-filter-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border-radius: var(--radius-full);
}

.chip-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip-btn.active {
  background: var(--accent-blue);
  color: #FFFFFF;
}

.week-days-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.week-day-block {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.week-day-header {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 800;
}

.week-day-lessons-list {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ==========================================================================
   Tab 3: «Медиатека пар» (Media Archive View)
   ========================================================================== */

.archive-filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  backdrop-filter: blur(14px);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: 2fr 1.5fr 1fr auto;
  gap: 10px;
  align-items: center;
}

@media (max-width: 768px) {
  .archive-filter-bar {
    grid-template-columns: 1fr;
  }
}

.filter-select, .filter-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s;
}

.filter-select:focus, .filter-input:focus {
  border-color: var(--border-focus);
}

.btn-zip-download {
  background: linear-gradient(135deg, var(--accent-emerald), #059669);
  color: #FFFFFF;
  border: none;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-zip-download:hover {
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

/* Archive Pair Group */
.archive-pair-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 18px;
}

.archive-pair-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.archive-subject {
  font-size: 17px;
  font-weight: 800;
}

/* Author Block: «День -> Пара -> Блок первого автора -> Сетка фото» */
.author-block {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 12px;
}

.author-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.author-info-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.author-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #FFFFFF;
}

.author-text-meta .author-name {
  font-size: 14px;
  font-weight: 700;
}

.author-text-meta .author-time {
  font-size: 11px;
  color: var(--text-muted);
}

.author-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-author-action {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.btn-author-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-author-action.active {
  background: var(--accent-blue) !important;
  border-color: var(--accent-blue) !important;
  color: #FFFFFF !important;
}

[data-theme="light"] .btn-author-action.active {
  background: var(--accent-blue) !important;
  border-color: var(--accent-blue) !important;
  color: #FFFFFF !important;
}

/* Photo Grid */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.photo-thumb-card {
  position: relative;
  aspect-ratio: 1/1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border-card);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  background: #1E293B linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
}

.photo-thumb-card:hover {
  transform: scale(1.03);
  border-color: var(--accent-blue);
  box-shadow: var(--shadow-md);
}

.photo-thumb-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.photo-thumb-card:hover img {
  transform: scale(1.06);
}

.admin-quick-del-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  color: #FFFFFF;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s ease, background 0.15s ease;
}

.admin-quick-del-btn:hover {
  transform: scale(1.18);
  background: #DC2626;
}

.admin-quick-del-btn:active {
  transform: scale(0.95);
}

.photo-thumb-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  font-size: 9px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  color: #FFFFFF;
  padding: 2px 5px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Tab 4: «OCR / Расшифровка текста лекций»
   ========================================================================== */

.ocr-search-header {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  backdrop-filter: blur(14px);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 20px;
}

.ocr-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.ocr-search-input-wrap svg {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
}

.ocr-search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 15px;
  padding: 12px 14px 12px 44px;
  border-radius: var(--radius-md);
  outline: none;
  transition: all 0.2s;
}

.ocr-search-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.2);
}

.ocr-quick-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.ocr-tag-pill {
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ocr-tag-pill:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #93C5FD;
  border-color: rgba(59, 130, 246, 0.4);
}

.ocr-results-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ocr-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  gap: 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ocr-result-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-subtle);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.ocr-result-thumb {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: #000000;
}

.ocr-result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ocr-result-content {
  flex: 1;
}

.ocr-result-subject {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 4px;
}

.ocr-result-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.ocr-matched-snippet {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-blue);
}

.ocr-matched-snippet mark {
  background: rgba(245, 158, 11, 0.35);
  color: #FDE68A;
  padding: 1px 4px;
  border-radius: 2px;
  font-weight: 700;
}

/* ==========================================================================
   Bottom Navigation Bar (Mobile 120 FPS feel)
   ========================================================================== */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  padding: 8px calc(12px + env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 28px)) calc(12px + env(safe-area-inset-left, 0px));
}

.nav-container {
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.nav-item-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.nav-item-btn svg {
  transition: transform 0.2s ease;
}

.nav-item-btn.active {
  color: var(--accent-blue);
}

.nav-item-btn.active svg {
  transform: scale(1.15);
  color: var(--accent-blue);
}

.nav-item-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  width: 14px;
  height: 3px;
  border-radius: var(--radius-full);
  background: var(--accent-blue);
}

/* ==========================================================================
   Modals & Dialogs (Gallery, PIN, Upload, Profile, Report)
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: modalFadeIn 0.2s ease;
}

.modal-overlay.active {
  display: flex;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-box {
  background: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  from { transform: translateY(20px) scale(0.96); }
  to { transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

/* PIN Code Inputs */
.pin-input-container {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 20px 0;
}

.pin-digit-input {
  width: 54px;
  height: 64px;
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font-mono);
  background: var(--bg-input);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s;
}

.pin-digit-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.3);
  transform: scale(1.05);
}

/* Fullscreen Gallery Modal */
.gallery-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(5, 7, 12, 0.96);
  display: none;
  flex-direction: column;
}

.gallery-modal-overlay.active {
  display: flex;
}

.gallery-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 24px)) 16px 12px 16px;
  background: rgba(5, 7, 12, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 10;
  position: relative;
}

.gallery-top-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.btn-gallery-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.btn-gallery-back:hover,
.btn-gallery-back:active {
  background: rgba(255, 255, 255, 0.22);
  transform: translateX(-2px);
}

.gallery-author-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.gallery-author-info {
  min-width: 0;
  overflow: hidden;
}

.gallery-author-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-pair-short {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.gallery-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.gallery-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  touch-action: none;
  background: #020408;
}

.gallery-main-img {
  max-width: 96%;
  max-height: 75vh;
  object-fit: contain;
  transition: transform 0.15s ease-out;
  user-select: none;
  -webkit-user-drag: none;
}

.gallery-bottom-bar {
  background: rgba(5, 7, 12, 0.9);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 10;
}

.gallery-zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Gallery Drawer: Description & Real OCR Separated */
.gallery-drawer {
  position: relative;
  background: rgba(11, 15, 23, 0.96);
  backdrop-filter: blur(18px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 16px;
  padding-bottom: max(env(safe-area-inset-bottom, 24px), 36px);
  max-height: 48vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
}

.gallery-meta-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.gallery-meta-title {
  font-size: 13px;
  font-weight: 700;
  color: #60A5FA;
  margin-bottom: 4px;
  line-height: 1.35;
}

.gallery-meta-details {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.gallery-dot {
  color: var(--text-muted);
}

.gallery-ocr-card {
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 11px 13px;
}

.gallery-ocr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.gallery-ocr-label {
  font-size: 12px;
  font-weight: 700;
  color: #93C5FD;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gallery-ocr-text {
  font-size: 12px;
  line-height: 1.55;
  color: #E2E8F0;
  max-height: 150px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: rgba(0, 0, 0, 0.35);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Upload Dropzone */
.upload-dropzone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.02);
}

.upload-dropzone:hover {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.05);
}

.upload-preview-container {
  max-height: 220px;
  overflow: hidden;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

.upload-preview-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast.success { border-color: var(--accent-emerald); }
.toast.error { border-color: var(--accent-rose); }

/* ==========================================================================
   Parallel Subgroups Shared Card («Общий округленный квадрат»)
   ========================================================================== */
.parallel-slot-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  backdrop-filter: blur(14px);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.parallel-slot-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-subtle);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.parallel-slot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.subgroup-shared-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.15);
  color: #A5B4FC;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.parallel-subgroup-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.parallel-subgroup-item {
  display: flex;
  flex-direction: column;
}

.parallel-subgroup-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.parallel-subgroup-divider {
  border: none;
  border-top: 1px dashed var(--border-subtle);
  margin: 14px 0;
}

/* ==========================================================================
   Group Autocomplete Dropdown
   ========================================================================== */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 120;
  background: var(--bg-modal);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 220px;
  overflow-y: auto;
}

.autocomplete-item {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s ease;
  font-size: 13px;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover, .autocomplete-item.selected {
  background: var(--bg-card-hover);
}

.autocomplete-name {
  font-weight: 700;
  color: var(--text-primary);
}

.autocomplete-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.autocomplete-empty {
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   High-Contrast Light Theme Polish (Photo 3 fixes)
   ========================================================================== */
[data-theme="light"] body {
  background-color: #F8FAFC;
  color: #0F172A;
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(37, 99, 235, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 60%, rgba(99, 102, 241, 0.04) 0%, transparent 40%);
}

[data-theme="light"] .app-header {
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid #E2E8F0;
}

[data-theme="light"] .brand-title {
  color: #0F172A;
}

[data-theme="light"] .brand-subtitle {
  color: #64748B;
}

[data-theme="light"] .group-selector-btn {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  color: #0F172A;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .group-selector-btn:hover {
  background: #F1F5F9;
  border-color: #3B82F6;
}

[data-theme="light"] .icon-btn {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  color: #334155;
}

[data-theme="light"] .icon-btn:hover {
  background: #F1F5F9;
  color: #0F172A;
}

[data-theme="light"] .today-header-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .today-date-text {
  color: #0F172A;
}

[data-theme="light"] .today-week-badge {
  background: #EEF2FF;
  color: #4338CA;
  border: 1px solid #C7D2FE;
}

[data-theme="light"] .day-strip-btn {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  color: #475569;
}

[data-theme="light"] .day-strip-btn:hover {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #0F172A;
}

[data-theme="light"] .day-strip-btn.active {
  background: linear-gradient(135deg, #2563EB, #1D4ED8);
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

[data-theme="light"] .day-strip-btn.active .day-strip-short,
[data-theme="light"] .day-strip-btn.active .day-strip-num {
  color: #FFFFFF;
}

[data-theme="light"] .pair-card,
[data-theme="light"] .parallel-slot-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .pair-card:hover,
[data-theme="light"] .parallel-slot-card:hover {
  background: #FFFFFF;
  border-color: #CBD5E1;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .pair-time-badge {
  background: #F1F5F9;
  color: #1E293B;
  border: 1px solid #E2E8F0;
}

[data-theme="light"] .pair-slot-num {
  color: #64748B;
}

[data-theme="light"] .subgroup-shared-badge {
  background: #EEF2FF;
  color: #4338CA;
  border: 1px solid #C7D2FE;
}

[data-theme="light"] .parallel-subgroup-divider {
  border-top-color: #E2E8F0;
}

/* Subgroup & Lesson Type Badges in Light Mode: Elegant, high-contrast, not neon! */
[data-theme="light"] .subgroup-tag {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}

[data-theme="light"] .pair-type-badge.lecture {
  background: #DBEAFE;
  color: #1E40AF;
  border: 1px solid #BFDBFE;
}

[data-theme="light"] .pair-type-badge.lab {
  background: #FCE7F3;
  color: #9D174D;
  border: 1px solid #FBCFE8;
}

[data-theme="light"] .pair-type-badge.practice {
  background: #D1FAE5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

[data-theme="light"] .pair-subject {
  color: #0F172A;
}

[data-theme="light"] .pair-meta-row {
  color: #475569;
}

[data-theme="light"] .live-pair-banner {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
}

[data-theme="light"] .live-tag {
  background: #2563EB;
  color: #FFFFFF;
}

[data-theme="light"] .live-subject {
  color: #1E3A8A;
}

[data-theme="light"] .live-details {
  color: #3B82F6;
}

[data-theme="light"] .bottom-nav {
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid #E2E8F0;
}

[data-theme="light"] .nav-item-btn {
  color: #64748B;
}

[data-theme="light"] .nav-item-btn.active {
  color: #2563EB;
}

[data-theme="light"] .modal-box {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  color: #0F172A;
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .filter-input,
[data-theme="light"] .filter-select {
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  color: #0F172A;
}

[data-theme="light"] .filter-input:focus,
[data-theme="light"] .filter-select:focus {
  background: #FFFFFF;
  border-color: #2563EB;
}

[data-theme="light"] .autocomplete-dropdown {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .autocomplete-item:hover {
  background: #F1F5F9;
}

[data-theme="light"] .autocomplete-item {
  border-bottom: 1px solid #E2E8F0;
}

/* PWA Mobile & Desktop Install Banner */
.pwa-install-banner {
  position: fixed;
  bottom: 74px;
  left: 16px;
  right: 16px;
  max-width: 520px;
  margin: 0 auto;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.45);
  z-index: 999;
  animation: slideUpPwa 0.3s ease-out;
}

[data-theme="light"] .pwa-install-banner {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(59, 130, 246, 0.3);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.15);
}

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

/* ==========================================================================
   Mobile Responsive Optimizations & Inset Adjustments (Screens <= 640px)
   ========================================================================== */
@media (max-width: 640px) {
  .app-header {
    padding-top: calc(8px + env(safe-area-inset-top, 24px));
    padding-bottom: 8px;
    padding-left: calc(10px + env(safe-area-inset-left, 0px));
    padding-right: calc(10px + env(safe-area-inset-right, 0px));
  }

  .header-container {
    gap: 6px;
  }

  .brand {
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
  }

  .brand-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }

  .brand-icon svg {
    width: 18px;
    height: 18px;
  }

  .brand-title {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 105px;
    flex-shrink: 1;
    min-width: 0;
  }

  .brand-subtitle {
    display: none !important;
  }

  .header-actions {
    flex-shrink: 0;
    gap: 4px;
    display: flex;
    align-items: center;
  }

  .group-selector-btn {
    font-size: 11px;
    padding: 4px 7px;
    max-width: 105px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    gap: 4px;
    flex-shrink: 1;
  }

  .icon-btn {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .icon-btn svg {
    width: 15px;
    height: 15px;
  }

  .bottom-nav {
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 28px));
  }

  .nav-item-btn {
    padding: 5px 6px;
    font-size: 9.5px;
  }

  .nav-item-btn svg {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 380px) {
  .brand-title {
    font-size: 13px;
    max-width: 75px;
  }

  .group-selector-btn {
    max-width: 82px;
    font-size: 10px;
    padding: 3px 5px;
  }

  .header-actions {
    gap: 3px;
  }

  .icon-btn {
    width: 28px;
    height: 28px;
  }

  .icon-btn svg {
    width: 14px;
    height: 14px;
  }
}

/* ==========================================================================
   Pull-To-Refresh Component
   ========================================================================== */

.ptr-container {
  height: 0px;
  opacity: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.14) 0%, transparent 100%);
  border-bottom: 1px solid rgba(59, 130, 246, 0.2);
  user-select: none;
  box-sizing: border-box;
  cursor: pointer;
}

.ptr-icon-box {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blue);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.ptr-icon {
  transition: transform 0.1s linear, color 0.2s ease;
}

.ptr-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(59, 130, 246, 0.25);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: ptrSpin 0.75s linear infinite;
}

@keyframes ptrSpin {
  to { transform: rotate(360deg); }
}

.ptr-ready .ptr-icon-box {
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
}

.ptr-refreshing .ptr-icon {
  display: none;
}

.ptr-refreshing .ptr-spinner {
  display: block;
}

.ptr-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.ptr-ready .ptr-label {
  color: var(--text-primary);
}

/* =============================================================
   Connection Status Monitoring Bar (ISU & Telegram)
   ============================================================= */
.connection-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: rgba(11, 15, 23, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 40;
  position: relative;
  gap: 8px;
}

.status-pills-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.status-pills-wrap::-webkit-scrollbar {
  display: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  background: rgba(30, 41, 59, 0.6);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.status-pill:hover {
  transform: translateY(-1px);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94A3B8;
  display: inline-block;
  flex-shrink: 0;
  transition: background-color 0.25s ease;
}

/* Status variants */
.status-pill.status-online {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34D399;
}
.status-pill.status-online .status-dot {
  background: #10B981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.status-pill.status-offline {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.35);
  color: #FB7185;
}
.status-pill.status-offline .status-dot {
  background: #F43F5E;
  box-shadow: 0 0 6px rgba(244, 63, 94, 0.6);
}

.status-pill.status-warning {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #FBBF24;
}
.status-pill.status-warning .status-dot {
  background: #F59E0B;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
}

.status-pill.status-checking .status-dot {
  background: #60A5FA;
  animation: pulse-dot 1s infinite alternate;
}

@keyframes pulse-dot {
  from { opacity: 0.3; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1.15); }
}

.status-refresh-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.status-refresh-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #60A5FA;
  border-color: rgba(59, 130, 246, 0.4);
}
.status-refresh-btn.rotating svg {
  animation: spin-refresh 0.6s linear infinite;
}
@keyframes spin-refresh {
  100% { transform: rotate(360deg); }
}

/* =============================================================
   Gallery Floating Nav Arrows & Photo Counter Pill
   ============================================================= */
.gallery-counter-pill {
  font-size: 11.5px;
  font-weight: 700;
  color: #E2E8F0;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.3px;
  backdrop-filter: blur(8px);
}

.gallery-img-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.gallery-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 25;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
.gallery-nav-btn:hover {
  background: rgba(59, 130, 246, 0.9);
  border-color: rgba(147, 197, 253, 0.5);
  transform: translateY(-50%) scale(1.08);
}
.gallery-nav-btn:active {
  transform: translateY(-50%) scale(0.95);
}
.gallery-nav-btn:disabled,
.gallery-nav-btn.disabled {
  opacity: 0.3;
  pointer-events: none;
}
.gallery-nav-prev {
  left: 12px;
}
.gallery-nav-next {
  right: 12px;
}

@media (max-width: 640px) {
  .gallery-nav-btn {
    width: 38px;
    height: 38px;
  }
  .gallery-nav-prev {
    left: 8px;
  }
  .gallery-nav-next {
    right: 8px;
  }
}



