/* ============================================
   STUDENT PLANNER — GLOBAL STYLES
   ============================================ */
:root {
  --bg: #0d0f14;
  --bg2: #13161d;
  --surface: #1a1e27;
  --border: rgba(255,255,255,0.07);
  --primary: #3b82f6;
  --primary-glow: rgba(59,130,246,0.25);
  --primary-hover: #2563eb;
  --accent: #6366f1;
  --success: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;
  --text: #f1f5f9;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --nav-h: 68px;
  --top-h: 62px;
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.4,0,.2,1);
  --transition: 0.25s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg); color: var(--text);
  height: 100%; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: pan-y;
}

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 99px; }

/* VIEW SYSTEM */
.view {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transform: translateY(20px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
  will-change: opacity, transform;
  background: var(--bg);
}
.view.active-view {
  opacity: 1; pointer-events: auto; transform: translateY(0);
}
#view-login {
  overflow-y: auto; align-items: center; justify-content: center; padding: 24px 20px;
}

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; padding: 14px 22px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: var(--transition); font-family: inherit; letter-spacing: 0.01em;
}
.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 4px 20px var(--primary-glow);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(0.97); }
.btn-ghost {
  background: rgba(255,255,255,0.06); color: var(--text-soft);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); }
.w-full { width: 100%; }

.icon-btn {
  background: rgba(255,255,255,0.07); border: 1px solid var(--border);
  color: var(--primary); width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; transition: var(--transition);
}
.icon-btn:hover { background: rgba(59,130,246,0.15); }

/* FORM */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 11px; font-weight: 600; color: var(--text-muted);
  margin-bottom: 6px; margin-left: 2px; text-transform: uppercase; letter-spacing: 0.06em;
}
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input-icon {
  position: absolute; left: 14px; color: var(--text-muted); pointer-events: none;
  font-size: 17px; display: flex; z-index: 1;
}
.form-control {
  width: 100%; padding: 13px 16px 13px 44px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 15px;
  outline: none; transition: var(--transition); font-family: inherit;
}
.form-control:focus {
  border-color: var(--primary); background: rgba(59,130,246,0.05);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control.no-icon { padding-left: 16px; }
textarea.form-control { resize: vertical; padding-top: 12px; min-height: 90px; }

/* ERROR / SUCCESS MSG */
.error-msg, .success-msg {
  font-size: 13px; text-align: center; margin-top: 10px;
  border-radius: 8px; padding: 10px 14px; display: none;
}
.error-msg   { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.2);  color: var(--danger); }
.success-msg { background: rgba(34,197,94,0.1);  border: 1px solid rgba(34,197,94,0.2);  color: var(--success); }

/* LOGIN VIEW */
/* ════════════════════════════════════════════════
   AUTH / LOGIN VIEW  — full redesign
   ════════════════════════════════════════════════ */
#view-login {
  overflow-y: auto; align-items: center; justify-content: center;
  padding: 28px 20px;
}

/* Animated background blobs */
.auth-bg-blob {
  position: fixed; border-radius: 50%; pointer-events: none; z-index: 0;
  filter: blur(90px); animation: blobDrift 12s ease-in-out infinite alternate;
}
.auth-bg-blob-1 {
  width: 420px; height: 420px; background: rgba(59,130,246,0.10);
  top: -140px; left: -100px; animation-delay: 0s;
}
.auth-bg-blob-2 {
  width: 340px; height: 340px; background: rgba(99,102,241,0.08);
  bottom: -100px; right: -70px; animation-delay: -5s;
}
.auth-bg-blob-3 {
  width: 220px; height: 220px; background: rgba(34,197,94,0.05);
  top: 45%; left: 60%; animation-delay: -9s;
}
@keyframes blobDrift {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(30px,20px) scale(1.08); }
}

/* Container */
.auth-container {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px;
  display: flex; flex-direction: column; align-items: center; gap: 32px;
}

/* Logo */
.auth-logo {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center; animation: authLogoIn 0.6s var(--ease) both;
}

/* Announcement banner */
.auth-announcement {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, rgba(59,130,246,0.14), rgba(139,92,246,0.12));
  border: 1px solid rgba(99,102,241,0.35);
  border-radius: 14px;
  padding: 12px 14px;
  animation: authLogoIn 0.5s var(--ease) 0.2s both;
  position: relative;
}
.auth-ann-icon { font-size: 22px; flex-shrink: 0; line-height: 1; }
.auth-ann-text {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.auth-ann-text strong {
  font-size: 13px; font-weight: 700; color: var(--text);
}
.auth-ann-text span {
  font-size: 12px; color: var(--text-muted); line-height: 1.4;
}
.auth-ann-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 14px; padding: 2px 4px;
  border-radius: 6px; flex-shrink: 0; line-height: 1;
  transition: color var(--transition), background var(--transition);
}
.auth-ann-close:hover { color: var(--text); background: rgba(255,255,255,0.08); }
.auth-announcement.ann-hiding {
  animation: annFadeOut 0.3s var(--ease) forwards;
}
@keyframes annFadeOut {
  to { opacity: 0; transform: translateY(-6px); max-height: 0; padding: 0; margin: 0; border-width: 0; }
}
.auth-logo-icon {
  width: 166px; height: 166px;
  background: transparent;
  border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  animation: logoFloat 4s ease-in-out infinite;
  /* subtle drop shadow so icon pops on dark bg */
  filter: drop-shadow(0 8px 26px rgba(160,100,40,0.40)) drop-shadow(0 0 16px rgba(210,140,60,0.30));
}
@keyframes logoFloat {
  0%,100% { transform: translateY(0) rotate(-1deg); }
  50%      { transform: translateY(-8px) rotate(1deg); }
}
.auth-logo-text h1 {
  font-size: 26px; font-weight: 800; letter-spacing: -0.03em;
  background: linear-gradient(135deg, #f1f5f9 30%, #94a3b8);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-logo-text p { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
@keyframes authLogoIn {
  from { opacity: 0; transform: translateY(-18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Card wrapper — handles sliding panels */
.auth-card-wrap {
  width: 100%;
  background: rgba(26,30,39,0.92);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 24px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.03);
  overflow: hidden;
  backdrop-filter: blur(20px);
  animation: authCardIn 0.55s var(--ease) 0.1s both;
}
@keyframes authCardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Individual panel */
.auth-panel {
  padding: 32px 28px 26px;
}
.auth-panel-hidden { display: none; }
@keyframes panelSlideIn {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes panelSlideInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to   { opacity: 1; transform: translateX(0); }
}
.auth-panel.do-slide-right { animation: panelSlideIn     0.34s var(--ease) both; }
.auth-panel.do-slide-left  { animation: panelSlideInLeft 0.34s var(--ease) both; }

/* Panel header */
.auth-panel-hdr {
  margin-bottom: 26px;
  display: flex; flex-direction: column; gap: 3px;
}
.auth-panel-title {
  font-size: 20px; font-weight: 800; letter-spacing: -0.02em; color: var(--text);
}
.auth-panel-sub { font-size: 13px; color: var(--text-muted); }
.auth-remember-row { margin: 0 0 14px; }
.auth-remember-label {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 13px; color: var(--text-soft);
}
.auth-remember-label input[type=checkbox] {
  width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0;
}

/* Field */
.auth-field { margin-bottom: 18px; }
.auth-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.07em;
  margin-bottom: 8px;
}
.auth-label i { font-size: 11px; color: var(--primary); }
.auth-hint { font-weight: 500; text-transform: none; letter-spacing: 0; opacity: 0.75; }

/* Input */
.auth-input {
  width: 100%; padding: 13px 16px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.08);
  border-radius: 12px; color: var(--text); font-size: 15px;
  outline: none; transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  font-family: inherit; letter-spacing: 0.01em;
}
.auth-input:focus {
  border-color: var(--primary);
  background: rgba(59,130,246,0.06);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.18);
}
.auth-input::placeholder { color: rgba(100,116,139,0.7); }
.auth-input:focus::placeholder { opacity: 0.5; }

/* Password field with eye toggle */
.auth-pass-wrap { position: relative; display: flex; align-items: center; }
.auth-pass-wrap .auth-input { padding-right: 46px; }
.auth-eye-btn {
  position: absolute; right: 12px;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 15px; padding: 4px;
  transition: color 0.18s; line-height: 1;
}
.auth-eye-btn:hover { color: var(--primary); }

/* Message banners */
.auth-msg {
  font-size: 13px; border-radius: 10px; padding: 10px 14px;
  margin-bottom: 14px; display: none;
  animation: authMsgIn 0.22s ease both;
}
@keyframes authMsgIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.auth-msg-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.22); color: #f87171; }
.auth-msg-ok    { background: rgba(34,197,94,0.1);  border: 1px solid rgba(34,197,94,0.22);  color: #4ade80; }

/* Submit button */
.auth-submit-btn {
  width: 100%; padding: 14px 22px; margin-top: 6px;
  background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
  border: none; border-radius: 12px; color: #fff;
  font-size: 15px; font-weight: 700; letter-spacing: 0.01em;
  cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  box-shadow: 0 4px 22px rgba(59,130,246,0.32);
  transition: opacity 0.18s, transform 0.18s, box-shadow 0.18s;
  position: relative; overflow: hidden;
}
.auth-submit-btn::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12), transparent);
  border-radius: inherit;
}
.auth-submit-btn:hover:not(:disabled) {
  opacity: 0.92; transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(59,130,246,0.42);
}
.auth-submit-btn:active:not(:disabled) { transform: scale(0.97); }
.auth-submit-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Divider */
.auth-card-divider {
  height: 1px; background: rgba(255,255,255,0.06); margin: 0 28px;
}

/* Switch row */
.auth-switch-row {
  text-align: center; margin-top: 22px; padding: 0 0 4px;
  font-size: 13px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.auth-switch-link {
  background: none; border: none; cursor: pointer;
  color: var(--primary); font-weight: 700; font-size: 13px;
  font-family: inherit; padding: 0; transition: opacity 0.18s;
}
.auth-switch-link:hover { opacity: 0.8; text-decoration: underline; }

/* Shake animation (login error) */
@keyframes authShake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-7px); }
  40%,80% { transform: translateX(7px); }
}

/* TOP NAV */
.top-nav {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--top-h); padding: 0 18px;
  background: rgba(13,15,20,0.88);
  backdrop-filter: blur(20px) saturate(1.6);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; z-index: 10; position: relative;
}
.top-nav-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }

.content-area {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 14px 14px calc(var(--nav-h) + 20px);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* BOTTOM NAV */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; width: 100%;
  height: var(--nav-h);
  background: rgba(13,15,20,0.94);
  backdrop-filter: blur(28px) saturate(1.6);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  z-index: 200; padding-bottom: env(safe-area-inset-bottom);
  display: none;
}

.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px; cursor: pointer;
  color: var(--text-muted); transition: color var(--transition); user-select: none;
  padding: 6px 0;
}
.nav-item i { font-size: 21px; transition: transform 0.22s cubic-bezier(.34,1.56,.64,1); }
.nav-item .nav-label { font-size: 10px; font-weight: 500; }
.nav-item.active { color: var(--primary); }
.nav-item.active i { transform: scale(1.2) translateY(-1px); }

.nav-fab {
  width: 50px; height: 50px; margin-top: -14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 15px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 22px; cursor: pointer;
  box-shadow: 0 6px 24px var(--primary-glow);
  transition: transform 0.22s cubic-bezier(.34,1.56,.64,1), box-shadow var(--transition);
  position: relative; z-index: 1;
}
.nav-fab:hover  { transform: scale(1.1) translateY(-2px); box-shadow: 0 10px 32px var(--primary-glow); }
.nav-fab:active { transform: scale(0.93); }

/* ── Nav profile avatar button ── */
#btn-nav-profile {
  position: relative;
}
#nav-profile-icon {
  width: 32px; height: 32px; border-radius: 50%;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  font-size: 18px; color: #fff;
  border: 2px solid rgba(255,255,255,0.15);
  transition: transform 0.22s cubic-bezier(.34,1.56,.64,1), box-shadow var(--transition);
  box-shadow: 0 2px 10px var(--primary-glow);
}
#nav-profile-icon img {
  width: 100%; height: 100%; object-fit: cover;
}
#btn-nav-profile.active #nav-profile-icon,
#btn-nav-profile:hover  #nav-profile-icon {
  transform: scale(1.1);
  box-shadow: 0 4px 16px var(--primary-glow);
  border-color: var(--primary);
}

/* SCHEDULE VIEW */
.schedule-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; height: var(--top-h);
  background: rgba(13,15,20,0.88);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.day-nav-btn {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  color: var(--text-soft); display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 20px; transition: var(--transition);
}
.day-nav-btn:hover  { background: rgba(59,130,246,0.15); color: var(--primary); }
.day-nav-btn:active { transform: scale(0.91); }

.day-name  { font-size: 16px; font-weight: 700; text-align: center; }
.day-date  { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 2px; }

.schedule-content {
  flex: 1; overflow-y: auto;
  padding: 14px 14px calc(var(--nav-h) + 20px);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* LESSON CARD */
.lesson-card {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 15px 15px 18px;
  margin-bottom: 10px; position: relative; overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  animation: slideUp 0.38s var(--ease) both;
}
.lesson-card:active { transform: scale(0.985); }
.lesson-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(to bottom, var(--primary), var(--accent));
  border-radius: 0 3px 3px 0;
  box-shadow: 2px 0 10px rgba(59,130,246,0.25);
  transition: box-shadow 0.3s;
}
.lc-lab    .lesson-card::before { background: linear-gradient(to bottom,#6366f1,#4f46e5); box-shadow: 2px 0 10px rgba(99,102,241,0.30); }
.lc-online .lesson-card::before { background: linear-gradient(to bottom,#22c55e,#16a34a); box-shadow: 2px 0 10px rgba(34,197,94,0.28); }
.lesson-card-now::before {
  width: 5px !important;
  box-shadow: 2px 0 16px rgba(59,130,246,0.55) !important;
}

.lesson-time {
  display: flex; flex-direction: column; align-items: center;
  min-width: 48px; flex-shrink: 0; gap: 2px; padding-top: 2px;
}
.t-start { font-size: 14px; font-weight: 700; color: var(--primary); }
.t-dash  { font-size: 10px; color: var(--border); }
.t-end   { font-size: 11px; color: var(--text-muted); }

.lesson-body { flex: 1; min-width: 0; }
.lesson-name { font-size: 14px; font-weight: 600; line-height: 1.4; margin-bottom: 6px; color: var(--text); }
.lesson-meta { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-muted); }
.lesson-meta i { font-size: 11px; color: var(--primary); }
.lesson-type {
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px;
  background: rgba(59,130,246,0.1); color: var(--primary);
  border: 1px solid rgba(59,130,246,0.18);
  display: inline-flex; align-items: center; align-self: center;
}
.lesson-type.lab  { background: rgba(99,102,241,0.1); color: var(--accent); border-color: rgba(99,102,241,0.2); }
.lesson-type.wyk  { background: rgba(59,130,246,0.1); color: var(--primary); }

/* EVENTS */
.event-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px;
  margin-bottom: 10px;
  animation: slideUp 0.38s var(--ease) both;
}
.event-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.event-top h3 { font-size: 15px; font-weight: 600; line-height: 1.3; }
.event-badge {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; flex-shrink: 0;
}
.event-badge.urgent { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.25); }
.event-badge.soon   { background: rgba(245,158,11,0.15); color: var(--warn);   border: 1px solid rgba(245,158,11,0.25); }
.event-badge.normal { background: rgba(59,130,246,0.12); color: var(--primary); border: 1px solid rgba(59,130,246,0.2); }
.event-meta { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.event-meta i { font-size: 11px; }
.event-desc { font-size: 13px; color: var(--text-soft); margin-top: 8px; line-height: 1.5; }
.event-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.event-del-btn {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  font-size: 12px; padding: 4px 8px; border-radius: 6px; transition: var(--transition);
  display: flex; align-items: center; gap: 4px; font-family: inherit;
}
.event-del-btn:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

/* MATERIALS */
.materials-search { padding: 10px 14px; flex-shrink: 0; }
.search-wrap { position: relative; }
.search-wrap i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; }
.search-input {
  width: 100%; padding: 11px 14px 11px 40px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 14px;
  outline: none; transition: var(--transition); font-family: inherit;
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.search-input::placeholder { color: var(--text-muted); }

.materials-list {
  flex: 1; overflow-y: auto;
  padding: 8px 14px calc(var(--nav-h) + 20px);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.material-card {
  display: flex; align-items: center; gap: 13px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 15px 13px 20px;
  margin-bottom: 10px; cursor: pointer;
  position: relative; overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  animation: slideUp 0.38s var(--ease) both;
}
.material-card::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0;
}
.material-card.type-pdf::before   { background: linear-gradient(to bottom, #ef4444, #dc2626); }
.material-card.type-doc::before   { background: linear-gradient(to bottom, #3b82f6, #2563eb); }
.material-card.type-img::before   { background: linear-gradient(to bottom, #22c55e, #16a34a); }
.material-card.type-txt::before   { background: linear-gradient(to bottom, #94a3b8, #64748b); }
.material-card.type-other::before { background: linear-gradient(to bottom, var(--primary), var(--accent)); }
.material-card:hover  { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(0,0,0,0.3); }
.material-card:active { transform: scale(0.985); }

.mat-icon-box {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.mat-icon-box.type-pdf   { background: rgba(239,68,68,0.12);  color: #ef4444; }
.mat-icon-box.type-doc   { background: rgba(59,130,246,0.12); color: #3b82f6; }
.mat-icon-box.type-img   { background: rgba(34,197,94,0.12);  color: #22c55e; }
.mat-icon-box.type-txt   { background: rgba(148,163,184,0.1); color: #94a3b8; }
.mat-icon-box.type-other { background: rgba(99,102,241,0.12); color: var(--accent); }
.mat-img-preview { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.mat-body  { flex: 1; min-width: 0; }
.mat-title { font-size: 14px; font-weight: 600; line-height: 1.35; margin-bottom: 4px;
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-date  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* MODALS */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9996;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex; align-items: flex-end; justify-content: center;
  display: none;
}
.modal-sheet {
  position: relative; width: 100%; max-width: 500px;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -20px 60px rgba(0,0,0,0.6);
  animation: sheetUp 0.32s cubic-bezier(.4,0,.2,1) forwards;
  max-height: 92vh; overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom);
}
@keyframes sheetUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-handle {
  width: 38px; height: 4px; background: rgba(255,255,255,0.12);
  border-radius: 99px; margin: 12px auto 0;
}
.modal-body { padding: 18px 22px 28px; }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 18px; }
.modal-close {
  position: absolute; top: 14px; right: 18px;
  background: rgba(255,255,255,0.07); border: 1px solid var(--border);
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-muted); font-size: 15px;
  transition: var(--transition);
}
.modal-close:hover { background: rgba(255,255,255,0.12); color: var(--text); }

/* File upload */
.file-drop-area {
  border: 2px dashed rgba(59,130,246,0.3); border-radius: var(--radius-sm);
  padding: 26px 20px; text-align: center; cursor: pointer; transition: var(--transition);
  background: rgba(59,130,246,0.03);
}
.file-drop-area:hover { border-color: var(--primary); background: rgba(59,130,246,0.07); }
.file-drop-area i { font-size: 26px; color: var(--primary); display: block; margin-bottom: 8px; }
.file-drop-area p { font-size: 13px; color: var(--text-muted); }
.file-drop-area p strong { color: var(--primary); }
.file-selected { font-size: 12px; color: var(--success); margin-top: 8px; font-weight: 500; }
.file-drop-btns { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.btn-pick {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; font-size: 12px; font-weight: 600;
  border: 1.5px solid rgba(59,130,246,0.35); color: var(--primary);
  background: rgba(59,130,246,0.06); cursor: pointer; transition: var(--transition);
}
.btn-pick:hover { background: rgba(59,130,246,0.16); border-color: var(--primary); }
.btn-pick i { font-size: 13px; }

/* EMPTY STATE */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; gap: 10px; text-align: center;
}
.empty-state i    { font-size: 44px; opacity: 0.2; }
.empty-state p    { color: var(--text-muted); font-size: 15px; }

/* SKELETON */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, rgba(255,255,255,0.05) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skel-card { height: 86px; border-radius: var(--radius); margin-bottom: 10px; }

/* ANIMATIONS */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.fade-in { animation: fadeIn 0.3s ease forwards; }

.lesson-card:nth-child(1)   { animation-delay: .04s; }
.lesson-card:nth-child(2)   { animation-delay: .09s; }
.lesson-card:nth-child(3)   { animation-delay: .14s; }
.lesson-card:nth-child(4)   { animation-delay: .19s; }
.lesson-card:nth-child(5)   { animation-delay: .24s; }
.lesson-card:nth-child(6)   { animation-delay: .29s; }
.event-card:nth-child(1)    { animation-delay: .04s; }
.event-card:nth-child(2)    { animation-delay: .09s; }
.event-card:nth-child(3)    { animation-delay: .14s; }
.event-card:nth-child(4)    { animation-delay: .19s; }
.material-card:nth-child(1) { animation-delay: .04s; }
.material-card:nth-child(2) { animation-delay: .09s; }
.material-card:nth-child(3) { animation-delay: .14s; }
.material-card:nth-child(4) { animation-delay: .19s; }
.material-card:nth-child(5) { animation-delay: .24s; }
.material-card:nth-child(6) { animation-delay: .29s; }

/* Suppress slide-in animation on silent (timer) refresh */
.schedule-no-anim .lesson-card,
.schedule-no-anim .break-divider { animation: none !important; }

/* Fullscreen live-view button */
.sched-fs-btn { color: var(--primary) !important; }

/* === SCHEDULE FULLSCREEN LIVE VIEW === */
#sched-fs-overlay {
  position: fixed; inset: 0; z-index: 9500;
  background: var(--bg-main, #0f1117);
  display: flex; flex-direction: column;
  align-items: center;
  overflow-y: auto;
}
.sfs-topbar {
  width: 100%; max-width: 640px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 0;
  flex-shrink: 0;
}
.sfs-clock {
  font-size: 15px; font-weight: 600; color: var(--text-muted);
  font-variant-numeric: tabular-nums; letter-spacing: .04em;
}
.sfs-close-btn {
  background: rgba(255,255,255,.07); border: 1px solid var(--border);
  color: var(--text-soft); width: 38px; height: 38px;
  border-radius: 10px; display: flex; align-items: center;
  justify-content: center; cursor: pointer; font-size: 16px;
  transition: var(--transition);
}
.sfs-close-btn:hover { background: rgba(255,255,255,.14); color: var(--text); }
.sfs-inner {
  width: 100%; max-width: 640px;
  padding: 16px 20px 40px;
  display: flex; flex-direction: column; gap: 14px;
}
.sfs-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 22px 24px;
  position: relative; overflow: hidden;
}
.sfs-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; border-radius: 0 3px 3px 0;
  background: linear-gradient(to bottom, var(--primary), var(--accent));
}
.sfs-card-now::before  { background: linear-gradient(to bottom,#22c55e,#16a34a); box-shadow: 2px 0 14px rgba(34,197,94,.4); }
.sfs-card-break::before{ background: linear-gradient(to bottom,#f59e0b,#d97706); }
.sfs-card-next::before { background: linear-gradient(to bottom,var(--primary),var(--accent)); }
.sfs-label {
  font-size: 10px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-muted);
  display: flex; align-items: center; gap: 5px; margin-bottom: 10px;
}
.sfs-subject {
  font-size: 26px; font-weight: 800; line-height: 1.2;
  color: var(--text); margin-bottom: 8px;
}
.sfs-meta {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-muted); margin-bottom: 16px;
}
.sfs-meta span { display: flex; align-items: center; gap: 5px; }
.sfs-countdown {
  font-size: 56px; font-weight: 900; letter-spacing: -.03em;
  color: var(--success); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.sfs-countdown-label {
  font-size: 12px; color: var(--text-muted); margin-top: 4px; margin-bottom: 14px;
}
.sfs-progress-track {
  height: 5px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden;
}
.sfs-progress-bar {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  transition: width .8s linear;
}
.sfs-break-mins {
  font-size: 38px; font-weight: 800; color: #f59e0b;
  letter-spacing: -.02em; line-height: 1;
}
.sfs-break-sub {
  font-size: 13px; color: var(--text-muted); margin-top: 6px;
}
.sfs-next-subj {
  font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 6px;
}
.sfs-next-info {
  font-size: 13px; color: var(--primary);
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
}
.sfs-next-pill {
  background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.2);
  border-radius: 20px; padding: 3px 10px;
  font-size: 12px; color: var(--primary); font-weight: 600;
}
.sfs-done {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; gap: 14px; text-align: center;
}
.sfs-done i   { font-size: 56px; opacity: .3; }
.sfs-done p   { font-size: 18px; color: var(--text-muted); }
@media (min-width: 540px) {
  .sfs-subject  { font-size: 32px; }
  .sfs-countdown{ font-size: 68px; }
  .sfs-break-mins{ font-size: 48px; }
}

/* MISC */
.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Shake - błąd logowania */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(5px); }
}

/* ============================================
   CATEGORY FILTER CHIPS
   ============================================ */
.cat-filter-bar {
  display: flex; gap: 8px;
  padding: 6px 14px 10px;
  overflow-x: auto; flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}
.cat-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: 20px; white-space: nowrap;
  font-size: 12px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  transition: var(--transition);
}
.cat-chip:hover { background: rgba(59,130,246,0.1); color: var(--primary); border-color: rgba(59,130,246,0.3); }
.cat-chip.active {
  background: var(--primary); color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 10px var(--primary-glow);
}

/* Category badge on material card */
.mat-cat-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600; padding: 2px 7px;
  border-radius: 5px; margin-top: 4px;
  background: rgba(99,102,241,0.12); color: var(--accent);
  border: 1px solid rgba(99,102,241,0.2);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Category select in form */
select.form-control {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}
select.form-control option {
  background: #1a1e27; color: #f1f5f9;
}

/* ============================================
   EVENT TYPE CHIPS
   ============================================ */
.event-type-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.ev-type-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted); transition: var(--transition); font-family: inherit;
}
.ev-type-chip:hover  { border-color: rgba(59,130,246,0.35); color: var(--primary); background: rgba(59,130,246,0.07); }
.ev-type-chip.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; border-color: transparent;
  box-shadow: 0 3px 12px var(--primary-glow);
}
.ev-type-tag {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 6px; margin: 5px 0 4px;
}
.ev-type-tag[data-t="kolokwium"]        { background: rgba(245,158,11,0.12); color: var(--warn);    border: 1px solid rgba(245,158,11,0.25); }
.ev-type-tag[data-t="egzamin"]          { background: rgba(239,68,68,0.12);  color: var(--danger);  border: 1px solid rgba(239,68,68,0.25); }
.ev-type-tag[data-t="oddanie-projektu"] { background: rgba(34,197,94,0.12);  color: var(--success); border: 1px solid rgba(34,197,94,0.25); }
.ev-type-tag[data-t="inne"]             { background: rgba(148,163,184,0.1); color: var(--text-soft); border: 1px solid var(--border); }
.event-title-row { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; }
.event-title-row i { font-size: 14px; flex-shrink: 0; }
.event-title-row h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================
   MINI CALENDAR
   ============================================ */
.mini-cal {
  background: rgba(255,255,255,0.02); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px; margin-top: 4px;
}
.mini-cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mini-cal-header span { font-size: 12px; font-weight: 600; color: var(--text-soft); }
.mini-cal-nav {
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition); font-size: 11px; font-family: inherit;
}
.mini-cal-nav:hover { background: rgba(59,130,246,0.15); color: var(--primary); border-color: rgba(59,130,246,0.3); }
.mini-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-day {
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 2px; border-radius: 9px; cursor: pointer;
  transition: var(--transition); border: 1px solid transparent; user-select: none;
}
.cal-day .day-name { font-size: 9px; color: var(--text-muted); font-weight: 500; margin-bottom: 3px; }
.cal-day .day-num  { font-size: 13px; font-weight: 600; }
.cal-day:hover:not(.past) { background: rgba(255,255,255,0.07); }
.cal-day.today { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.25); }
.cal-day.today .day-num { color: var(--primary); }
.cal-day.selected { background: var(--primary) !important; border-color: var(--primary) !important; box-shadow: 0 2px 8px var(--primary-glow); }
.cal-day.selected .day-name { color: rgba(255,255,255,0.65); }
.cal-day.selected .day-num  { color: #fff; }
.cal-day.past { opacity: 0.3; cursor: default; pointer-events: none; }
.cal-date-display { font-size: 12px; color: var(--primary); text-align: center; margin-top: 8px; font-weight: 500; min-height: 18px; }

/* ============================================
   EVENT COUNTDOWN
   ============================================ */
.event-bottom-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-top: 8px;
}
.event-countdown {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 700; border: 1px solid; white-space: nowrap;
}
.event-countdown i { font-size: 11px; }
.event-countdown.urgent { background: rgba(239,68,68,0.1);   border-color: rgba(239,68,68,0.25);  color: var(--danger); }
.event-countdown.soon   { background: rgba(245,158,11,0.1);  border-color: rgba(245,158,11,0.25); color: var(--warn); }
.event-countdown.normal { background: rgba(59,130,246,0.08); border-color: rgba(59,130,246,0.2);  color: var(--primary); }

/* ============================================
   MATERIAL GROUPS
   ============================================ */
.mat-group { margin-bottom: 4px; }
.mat-group-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 0 10px; flex-shrink: 0;
}
.mat-group-icon {
  width: 36px; height: 36px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.mat-group-name { font-size: 15px; font-weight: 700; flex: 1; }
.mat-group-count {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 20px;
}

/* ============================================
   BTN-DANGER
   ============================================ */
.btn-danger {
  background: var(--danger); color: #fff;
  box-shadow: 0 4px 20px rgba(239,68,68,0.25);
}
.btn-danger:hover  { background: #dc2626; }
.btn-danger:active { transform: scale(0.97); }

/* ============================================
   FOLDER VIEW (materiały główny)
   ============================================ */
#mat-nav-title { flex: 1; text-align: center; }

.folder-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px 14px 18px;
  margin-bottom: 10px; cursor: pointer; position: relative; overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  animation: slideUp 0.38s var(--ease) both;
}
.folder-card:hover  { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(0,0,0,0.25); }
.folder-card:active { transform: scale(0.985); }

.folder-icon {
  width: 50px; height: 50px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.folder-body  { flex: 1; min-width: 0; }
.folder-name  { font-size: 15px; font-weight: 700; margin-bottom: 4px;
                white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-meta  { font-size: 12px; color: var(--text-muted); }
.folder-arrow { color: rgba(255,255,255,0.2); font-size: 13px; flex-shrink: 0; }

/* Actions on folder/subfolder cards */
.folder-actions {
  display: flex; gap: 4px; flex-shrink: 0; margin-right: 4px;
}
.folder-action-btn {
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: background 0.18s, color 0.18s;
  border: 1px solid transparent; background: rgba(255,255,255,0.04); color: var(--text-muted);
}
.folder-action-btn:active { transform: scale(0.9); }
.folder-action-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.folder-delete-btn:hover, .subfolder-delete-btn:hover,
.folder-delete-btn:active, .subfolder-delete-btn:active {
  background: rgba(239,68,68,0.14) !important;
  color: #ef4444 !important;
  border-color: rgba(239,68,68,0.25) !important;
}

/* ============================================
   FILE CARD (wewnątrz folderu)
   ============================================ */
.file-card {
  display: flex; align-items: center; gap: 13px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 15px 13px 20px;
  margin-bottom: 10px; cursor: pointer;
  position: relative; overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  animation: slideUp 0.38s var(--ease) both;
}
.file-card::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0;
}
.file-card.type-pdf::before   { background: linear-gradient(to bottom, #ef4444, #dc2626); }
.file-card.type-doc::before   { background: linear-gradient(to bottom, #3b82f6, #2563eb); }
.file-card.type-img::before   { background: linear-gradient(to bottom, #22c55e, #16a34a); }
.file-card.type-txt::before   { background: linear-gradient(to bottom, #94a3b8, #64748b); }
.file-card.type-other::before { background: linear-gradient(to bottom, var(--primary), var(--accent)); }
.file-card:hover  { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(0,0,0,0.25); }
.file-card:active { transform: scale(0.985); }

/* Action buttons on file cards */
.file-actions {
  display: flex; gap: 4px; flex-shrink: 0; align-self: center;
  opacity: 0; transition: opacity 0.18s;
}
.file-card:hover .file-actions { opacity: 1; }
/* Always show on touch devices */
@media (hover: none) {
  .file-actions { opacity: 1; }
}
.file-action-btn {
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: background 0.18s, color 0.18s;
  border: 1px solid transparent; background: rgba(255,255,255,0.05); color: var(--text-muted);
}
.file-action-btn:active { transform: scale(0.9); }
.file-action-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.file-delete-btn:hover, .file-delete-btn:active {
  background: rgba(239,68,68,0.14) !important;
  color: #ef4444 !important;
  border-color: rgba(239,68,68,0.25) !important;
}

.mat-img-thumb { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.mat-thumb-wrap { flex-shrink: 0; }

/* Video thumbnail placeholder */
.mat-video-thumb {
  width: 46px; height: 46px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.25);
  position: relative;
}
.mat-play-icon {
  font-size: 18px; color: #ef4444;
}

/* Code file type */
.type-code::before { background: linear-gradient(to bottom, #61afef, #4e94cc); }
.file-ext-badge.type-code { background: rgba(97,175,239,0.12); color: #61afef; border: 1px solid rgba(97,175,239,0.25); }

/* ─── Prompt dialog (Zmień nazwę) ─── */
.prompt-overlay {
  position: fixed; inset: 0; z-index: 9990;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s;
}
.prompt-overlay.visible { opacity: 1; }
.prompt-dialog {
  background: #1e2230; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px; padding: 32px 28px 24px;
  width: 340px; max-width: 92vw;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  transform: translateY(12px) scale(0.97);
  transition: transform 0.22s cubic-bezier(.34,1.56,.64,1), opacity 0.22s;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.prompt-overlay.visible .prompt-dialog { transform: translateY(0) scale(1); }
.prompt-icon {
  width: 48px; height: 48px; border-radius: 14px;
  background: rgba(97,175,239,0.12); border: 1px solid rgba(97,175,239,0.25);
  color: #61afef; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.prompt-title {
  font-size: 16px; font-weight: 700; color: var(--text); text-align: center;
}
.prompt-input {
  width: 100%; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px; padding: 10px 14px; color: var(--text);
  font-size: 14px; font-family: inherit; outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.prompt-input:focus { border-color: #61afef; box-shadow: 0 0 0 3px rgba(97,175,239,0.15); }
.input-shake { animation: inputShake 0.4s ease; }
@keyframes inputShake {
  0%,100% { transform: translateX(0); }
  20%,60%  { transform: translateX(-5px); }
  40%,80%  { transform: translateX(5px); }
}
.prompt-btns { display: flex; gap: 10px; width: 100%; }
.prompt-btn-cancel {
  flex: 1; padding: 10px; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted); font-size: 13px; font-weight: 600; font-family: inherit;
  transition: background 0.18s;
}
.prompt-btn-cancel:hover { background: rgba(255,255,255,0.1); }
.prompt-btn-ok {
  flex: 2; padding: 10px; border-radius: 10px; cursor: pointer;
  background: linear-gradient(135deg, #61afef, #4e94cc);
  border: none; color: #fff; font-size: 13px; font-weight: 700; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  box-shadow: 0 4px 16px rgba(97,175,239,0.3); transition: opacity 0.18s, transform 0.18s;
}
.prompt-btn-ok:hover { opacity: 0.9; transform: translateY(-1px); }

/* ─── Odtwarzacz wideo (materiały) ─── */
.mat-video-overlay {
  position: fixed; inset: 0; z-index: 9995;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.24s;
}
.mat-video-overlay.visible { opacity: 1; }
.mat-video-dialog {
  width: min(95vw, 860px);
  background: #161921; border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px; overflow: hidden;
  box-shadow: 0 32px 80px rgba(0,0,0,0.7);
  transform: scale(0.95); transition: transform 0.24s cubic-bezier(.34,1.56,.64,1);
}
.mat-video-overlay.visible .mat-video-dialog { transform: scale(1); }
.mat-video-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: rgba(0,0,0,0.4);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.mat-video-title { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mat-video-close {
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; flex-shrink: 0;
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444; font-size: 15px; display: flex; align-items: center; justify-content: center;
  transition: background 0.18s;
}
.mat-video-close:hover { background: rgba(239,68,68,0.25); }
.mat-video-body { background: #000; }
.mat-video-player {
  width: 100%; max-height: 70vh;
  display: block;
  outline: none;
}

/* ─── MD file type badge & icon ─── */
.type-md::before   { background: linear-gradient(to bottom, #61afef, #4e94cc); }
.type-html::before { background: linear-gradient(to bottom, #e34c26, #b83a1e); }
.file-ext-badge.type-md   { background: rgba(97,175,239,0.12); color: #61afef; border: 1px solid rgba(97,175,239,0.25); }
.file-ext-badge.type-html { background: rgba(227,76,38,0.12);  color: #e34c26; border: 1px solid rgba(227,76,38,0.25); }

/* ══════════════════════════════════════════
   MARKDOWN EDITOR / PREVIEW OVERLAY
══════════════════════════════════════════ */
.mat-md-overlay {
  position: fixed; inset: 0; z-index: 9992;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.22s;
}
.mat-md-overlay.visible { opacity: 1; }
.mat-md-dialog {
  width: min(98vw, 900px); height: min(92vh, 820px);
  background: #1a1d27; border: 1px solid rgba(255,255,255,0.09);
  border-radius: 18px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 32px 80px rgba(0,0,0,0.7);
  transform: scale(0.97); transition: transform 0.24s cubic-bezier(.34,1.56,.64,1);
}
.mat-md-overlay.visible .mat-md-dialog { transform: scale(1); }
.mat-md-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: rgba(0,0,0,0.4);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0; gap: 12px;
}
.mat-md-hdr-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.mat-md-title { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-md-tabs { display: flex; gap: 4px; flex-shrink: 0; }
.mat-md-tab {
  padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 600;
  background: transparent; border: 1px solid transparent; color: var(--text-muted);
  font-family: inherit; transition: all 0.18s; display: flex; align-items: center; gap: 6px;
}
.mat-md-tab.active { background: rgba(97,175,239,0.15); border-color: rgba(97,175,239,0.3); color: #61afef; }
.mat-md-tab:not(.active):hover { background: rgba(255,255,255,0.06); color: var(--text); }
.mat-md-hdr-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.mat-md-save-btn {
  padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 600;
  background: linear-gradient(135deg, #22c55e, #16a34a); border: none; color: #fff;
  font-family: inherit; display: flex; align-items: center; gap: 6px;
  box-shadow: 0 2px 10px rgba(34,197,94,0.3); transition: opacity 0.18s;
}
.mat-md-save-btn:hover { opacity: 0.88; }
.mat-md-close-btn {
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444; font-size: 14px; display: flex; align-items: center; justify-content: center;
  transition: background 0.18s;
}
.mat-md-close-btn:hover { background: rgba(239,68,68,0.25); }
.mat-md-body { flex: 1; overflow: auto; min-height: 0; }
.mat-md-loading { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-muted); gap: 10px; font-size: 14px; }

/* Raw markdown textarea editor */
.mat-md-editor {
  width: 100%; height: 100%; box-sizing: border-box;
  background: #141720; color: #abb2bf;
  font-family: 'JetBrains Mono','Fira Code','Consolas',monospace;
  font-size: 13px; line-height: 1.7; padding: 24px 28px;
  border: none; outline: none; resize: none;
  tab-size: 2;
}

/* GitHub-style markdown preview */
.mat-md-preview.github-md {
  padding: 32px 36px; color: #c9d1d9; font-size: 15px; line-height: 1.75;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}
.github-md h1,.github-md h2 { border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 8px; margin: 24px 0 12px; }
.github-md h1 { font-size: 2em; }
.github-md h2 { font-size: 1.5em; }
.github-md h3 { font-size: 1.25em; margin: 20px 0 10px; }
.github-md h4,.github-md h5,.github-md h6 { margin: 16px 0 8px; }
.github-md p { margin: 0 0 14px; }
.github-md a { color: #58a6ff; text-decoration: none; }
.github-md a:hover { text-decoration: underline; }
.github-md code {
  background: rgba(97,175,239,0.1); border: 1px solid rgba(97,175,239,0.2);
  border-radius: 4px; padding: 2px 6px; font-family: 'JetBrains Mono','Fira Code','Consolas',monospace;
  font-size: 0.875em; color: #79c0ff;
}
.github-md pre {
  background: #161b22; border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; padding: 18px 20px; overflow-x: auto; margin: 0 0 16px;
}
.github-md pre code { background: none; border: none; padding: 0; color: inherit; font-size: 13px; }
.github-md blockquote {
  border-left: 4px solid rgba(97,175,239,0.4); margin: 0 0 14px;
  padding: 8px 16px; background: rgba(97,175,239,0.05); border-radius: 0 6px 6px 0;
  color: var(--text-muted);
}
.github-md ul,.github-md ol { padding-left: 24px; margin: 0 0 14px; }
.github-md li { margin-bottom: 4px; }
.github-md table { border-collapse: collapse; width: 100%; margin: 0 0 16px; }
.github-md th,.github-md td { border: 1px solid rgba(255,255,255,0.1); padding: 8px 14px; text-align: left; }
.github-md th { background: rgba(255,255,255,0.05); font-weight: 600; }
.github-md tr:nth-child(even) { background: rgba(255,255,255,0.02); }
.github-md hr { border: none; border-top: 1px solid rgba(255,255,255,0.1); margin: 24px 0; }
.github-md img { max-width: 100%; border-radius: 8px; }
.github-md input[type="checkbox"] { margin-right: 6px; }

/* ══════════════════════════════════════════
   HTML VIEWER OVERLAY
══════════════════════════════════════════ */
.mat-html-overlay {
  position: fixed; inset: 0; z-index: 9993;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.22s;
}
.mat-html-overlay.visible { opacity: 1; }
.mat-html-dialog {
  width: min(98vw, 1024px); height: min(94vh, 860px);
  background: #1a1d27; border: 1px solid rgba(255,255,255,0.09);
  border-radius: 18px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 32px 80px rgba(0,0,0,0.7);
  transform: scale(0.97); transition: transform 0.24s cubic-bezier(.34,1.56,.64,1);
}
.mat-html-overlay.visible .mat-html-dialog { transform: scale(1); }
.mat-html-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: rgba(0,0,0,0.4);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.mat-html-hdr-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.mat-html-title { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-html-hdr-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.mat-html-open-btn {
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  background: rgba(97,175,239,0.1); border: 1px solid rgba(97,175,239,0.25);
  color: #61afef; font-size: 14px; display: flex; align-items: center; justify-content: center;
  text-decoration: none; transition: background 0.18s;
}
.mat-html-open-btn:hover { background: rgba(97,175,239,0.22); }
.mat-html-close-btn {
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444; font-size: 14px; display: flex; align-items: center; justify-content: center;
  transition: background 0.18s;
}
.mat-html-close-btn:hover { background: rgba(239,68,68,0.25); }
/* Browser-style address bar */
.mat-html-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px; background: rgba(0,0,0,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.06); flex-shrink: 0;
}
.mat-html-dots { display: flex; gap: 6px; }
.mat-html-dots span {
  width: 11px; height: 11px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
}
.mat-html-dots span:nth-child(1) { background: rgba(239,68,68,0.5); }
.mat-html-dots span:nth-child(2) { background: rgba(234,179,8,0.5); }
.mat-html-dots span:nth-child(3) { background: rgba(34,197,94,0.5); }
.mat-html-url-pill {
  flex: 1; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px; padding: 4px 12px; font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: monospace;
}
.mat-html-body { flex: 1; overflow: hidden; background: #fff; }
.mat-html-frame { width: 100%; height: 100%; border: none; display: block; }
.file-body    { flex: 1; min-width: 0; }
.file-title   { font-size: 14px; font-weight: 600; line-height: 1.35; margin-bottom: 4px;
                white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta    { font-size: 11px; color: var(--text-muted); display: flex; align-items: center;
                gap: 5px; margin-bottom: 5px; flex-wrap: wrap; }
.file-meta-sep { color: rgba(255,255,255,0.15); }
.file-ext-badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 5px; letter-spacing: 0.04em;
}
.file-ext-badge.type-pdf   { background: rgba(239,68,68,0.12);  color: #ef4444; border: 1px solid rgba(239,68,68,0.2); }
.file-ext-badge.type-doc   { background: rgba(59,130,246,0.12); color: #3b82f6; border: 1px solid rgba(59,130,246,0.2); }
.file-ext-badge.type-img   { background: rgba(34,197,94,0.12);  color: #22c55e; border: 1px solid rgba(34,197,94,0.2); }
.file-ext-badge.type-txt   { background: rgba(148,163,184,0.1); color: #94a3b8; border: 1px solid var(--border); }
.file-ext-badge.type-other { background: rgba(99,102,241,0.12); color: var(--accent); border: 1px solid rgba(99,102,241,0.2); }

/* ============================================
   INLINE SUBJECT PICKER
   ============================================ */
.subj-picker {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow-y: auto; max-height: 186px;
  background: rgba(255,255,255,0.02);
  -webkit-overflow-scrolling: touch;
}
.subj-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.subj-row:last-child { border-bottom: none; }
.subj-row:hover  { background: rgba(255,255,255,0.04); }
.subj-row.active { background: rgba(59,130,246,0.08); }
.subj-row-icon {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.subj-row-name { flex: 1; font-size: 13px; font-weight: 500; color: var(--text); }
.subj-check { font-size: 12px; color: var(--primary); opacity: 0; transition: opacity 0.18s; }
.subj-row.active .subj-check { opacity: 1; }

/* ============================================
   CONFIRM DIALOG
   ============================================ */
.confirm-icon {
  width: 58px; height: 58px; border-radius: 18px;
  background: rgba(239,68,68,0.12); color: var(--danger);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin: 0 auto 14px;
}
.confirm-title   { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.confirm-text    { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.5; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; }

/* ============================================
   UPLOAD PROGRESS
   ============================================ */
.upload-progress {
  display: none;
  background: rgba(59,130,246,0.06);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.upload-progress-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; margin-bottom: 8px;
}
.upload-progress-row #upload-status-text { color: var(--text-soft); font-weight: 500; }
.upload-progress-row #upload-pct         { color: var(--primary); font-weight: 700; font-size: 13px; }
.upload-progress-track {
  height: 7px; border-radius: 99px;
  background: rgba(255,255,255,0.07); overflow: hidden;
}
.upload-progress-fill {
  height: 100%; border-radius: 99px; width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.25s ease;
  box-shadow: 0 0 8px var(--primary-glow);
}

/* Drag-over state on file drop area */
.file-drop-area.drag-over {
  border-color: var(--primary) !important;
  background: rgba(59,130,246,0.1) !important;
  transform: scale(1.01);
}

/* ============================================
   SCHEDULE – TIME INDICATORS
   ============================================ */
.lesson-card-now {
  border-color: rgba(59,130,246,0.4) !important;
  box-shadow: 0 0 0 1px rgba(59,130,246,0.2), 0 4px 20px rgba(59,130,246,0.12);
}
.lesson-card-now::before {
  background: linear-gradient(to bottom, var(--primary), #60a5fa) !important;
  width: 4px !important;
}
.lesson-card-past { opacity: 0.55; }
.lesson-card-past .lesson-name { color: var(--text-muted); }

.lesson-name-row {
  display: flex; align-items: center; gap: 7px;
  flex-wrap: wrap; margin-bottom: 6px;
}
.lesson-name-row .lesson-name { margin-bottom: 0; }

.lesson-now-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 800; color: var(--primary);
  background: rgba(59,130,246,0.12); border: 1px solid rgba(59,130,246,0.3);
  padding: 2px 8px; border-radius: 20px; letter-spacing: 0.04em;
  white-space: nowrap;
}
.lesson-done-badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 20px;
}

.lesson-footer {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px;
}

/* Google Meet button in lesson card */
.lesson-meet-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
  background: rgba(34,197,94,0.1); color: #22c55e;
  border: 1px solid rgba(34,197,94,0.3);
  text-decoration: none; transition: background 0.18s;
  white-space: nowrap;
}
.lesson-meet-btn:hover { background: rgba(34,197,94,0.22); }
/* Materials peek button in lesson footer */
.lesson-mat-peek-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
  background: rgba(168,85,247,0.1); color: #c084fc;
  border: 1px solid rgba(168,85,247,0.3);
  cursor: pointer; font-family: inherit;
  transition: background 0.18s, color 0.18s; white-space: nowrap;
}
.lesson-mat-peek-btn:hover { background: rgba(168,85,247,0.22); color: #a855f7; }
.lesson-time-pill {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px;
  white-space: nowrap;
}
.lesson-pill-now  { background: rgba(34,197,94,0.12);  color: var(--success); border: 1px solid rgba(34,197,94,0.25); }
.lesson-pill-next { background: rgba(245,158,11,0.12); color: var(--warn);    border: 1px solid rgba(245,158,11,0.25); }

.break-divider {
  display: flex; align-items: center;
  gap: 0; margin: 6px 0; user-select: none;
  animation: slideUp 0.38s var(--ease) both;
  /* opacity driven by slideUp keyframe — delay set per-instance via JS */
}
.break-dots {
  flex: 1; border-top: 2px dashed rgba(255,255,255,0.07);
}
.break-label {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text-muted); font-weight: 500;
  padding: 4px 12px; white-space: nowrap;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 20px; letter-spacing: 0.01em;
}
.break-label i { font-size: 10px; }
.break-divider.break-active .break-dots {
  border-color: rgba(245,158,11,0.25);
}
.break-divider.break-active .break-label {
  color: var(--warn);
  background: rgba(245,158,11,0.06);
  border-color: rgba(245,158,11,0.2);
}

/* ============================================
   DAY EVENTS BAR (w widoku planu)
   ============================================ */
#day-events-bar {
  background: rgba(239,68,68,0.05);
  border-bottom: 1px solid rgba(239,68,68,0.12);
  padding: 8px 14px 10px;
  flex-shrink: 0;
  display: none;
}
.day-events-label {
  font-size: 10px; font-weight: 700; color: var(--danger);
  text-transform: uppercase; letter-spacing: 0.07em;
  margin-bottom: 7px; display: flex; align-items: center; gap: 5px;
}
.day-events-label i { font-size: 10px; }
.day-events-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.day-ev-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 5px 12px;
  border-radius: 20px; white-space: nowrap;
  color: var(--ev-color);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}
.day-ev-chip i { font-size: 11px; }

/* ── RIGHT-SIDE TIMELINE RAIL ─────────────────────────────── */
.lesson-actions {
  display: flex; flex-direction: column; justify-content: space-between;
  align-items: center; flex-shrink: 0; align-self: stretch;
  width: 36px; padding: 4px 0; position: relative; gap: 0;
}
/* Vertical rail line — sits BETWEEN buttons, not through them */
.lesson-actions::after {
  content: ''; position: absolute;
  left: 50%; transform: translateX(-50%);
  top: 39px; bottom: 39px; width: 2px; border-radius: 99px;
  background: rgba(59,130,246,0.18); pointer-events: none; z-index: 0;
  transition: background 0.3s;
}
.lc-lab    .lesson-actions::after { background: rgba(99,102,241,0.3); }
.lc-online .lesson-actions::after { background: rgba(34,197,94,0.28); }
.lc-wyk    .lesson-actions::after { background: rgba(59,130,246,0.18); }
.lesson-card-now .lesson-actions::after {
  background: linear-gradient(to bottom, rgba(59,130,246,0.8), rgba(96,165,250,0.15));
  box-shadow: 0 0 8px rgba(59,130,246,0.35);
}
/* Circular dot buttons sitting on the rail */
.lesson-cancel-btn,
.lesson-edit-btn {
  position: relative; z-index: 1;
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid;
  cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s; flex-shrink: 0;
}
.lesson-cancel-btn {
  color: #f87171;
  border-color: rgba(239,68,68,0.45);
  background: rgba(239,68,68,0.08);
}
.lesson-cancel-btn:hover {
  color: #fff; border-color: #ef4444;
  background: rgba(239,68,68,0.28);
  box-shadow: 0 0 10px rgba(239,68,68,0.4);
  transform: scale(1.12);
}
.lesson-edit-btn {
  color: #60a5fa;
  border-color: rgba(59,130,246,0.45);
  background: rgba(59,130,246,0.08);
}
.lesson-edit-btn:hover {
  color: #fff; border-color: var(--primary);
  background: rgba(59,130,246,0.28);
  box-shadow: 0 0 10px rgba(59,130,246,0.4);
  transform: scale(1.12);
}
.lesson-card-cancelled .lesson-cancel-btn { color: #4ade80; border-color: rgba(34,197,94,0.45); background: rgba(34,197,94,0.08); }
.lesson-card-cancelled .lesson-cancel-btn:hover { color: #fff; border-color: var(--success); background: rgba(34,197,94,0.28); box-shadow: 0 0 10px rgba(34,197,94,0.4); }
/* Materials peek button — purple, sits on the rail */
.lesson-materials-btn {
  position: relative; z-index: 1;
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid rgba(168,85,247,0.45);
  color: #c084fc;
  background: rgba(168,85,247,0.08);
  cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s; flex-shrink: 0;
}
.lesson-materials-btn:hover {
  color: #fff; border-color: #a855f7;
  background: rgba(168,85,247,0.28);
  box-shadow: 0 0 10px rgba(168,85,247,0.4);
  transform: scale(1.12);
}

/* Adjust lesson-card layout */
.lesson-card { position: relative; }
.lesson-card > .lesson-body { flex: 1; padding-right: 4px; }

/* ============================================
   MATERIALS – SUBFOLDER CARD
   ============================================ */
.subfolder-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 16px 13px 16px;
  margin-bottom: 8px; cursor: pointer; position: relative; overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  animation: slideUp 0.38s var(--ease) both;
}
.subfolder-card:hover  { transform: translateY(-1px); box-shadow: 0 4px 18px rgba(0,0,0,0.22); }
.subfolder-card:active { transform: scale(0.985); }
.subfolder-card.drag-over-folder {
  border-color: var(--primary) !important;
  background: rgba(59,130,246,0.07);
  transform: scale(1.01);
}

/* ── Protected seeded folder markers (Wykłady, Laboratoria…) — section-header banner ── */
.subfolder-card.subfolder-section {
  background: linear-gradient(135deg, rgba(59,130,246,0.13) 0%, rgba(99,102,241,0.07) 100%);
  border-color: rgba(59,130,246,0.28);
  border-left: 3px solid var(--primary);
  padding: 18px 16px 18px 18px;
  min-height: 74px;
  align-items: center;
}
.subfolder-card.subfolder-section:hover {
  background: linear-gradient(135deg, rgba(59,130,246,0.2) 0%, rgba(99,102,241,0.12) 100%);
  border-color: rgba(59,130,246,0.5);
  box-shadow: 0 6px 24px rgba(59,130,246,0.14);
}
.subfolder-card.subfolder-section .folder-arrow {
  color: rgba(96,165,250,0.4);
  font-size: 12px;
}
.subsection-content { flex: 1; min-width: 0; }
.subsection-title {
  font-size: 16px; font-weight: 800; letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 4px;
}
.subsection-sub { font-size: 11px; color: var(--text-muted); }
.subsection-badge {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
  background: rgba(59,130,246,0.16);
  color: #60a5fa;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-left: 10px;
  margin-right: 10px;
  border: 1px solid rgba(59,130,246,0.22);
}

.subfolder-icon {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  background: rgba(59,130,246,0.1); color: var(--primary);
}
.subfolder-icon-group {
  background: rgba(245,158,11,0.12); color: #f59e0b;
}

/* Drag state on file cards */
.file-card.dragging { opacity: 0.4; transform: scale(0.97); }

/* Event edit button */
.event-edit-btn {
  background: none; border: none; cursor: pointer; color: var(--primary);
  font-size: 12px; padding: 4px 8px; border-radius: 6px; transition: var(--transition);
  display: inline-flex; align-items: center; gap: 4px; font-family: inherit;
}
.event-edit-btn:hover { background: rgba(59,130,246,0.12); }

/* ============================================
   CANCELLED LESSON CARD
   ============================================ */
.lesson-card-cancelled {
  opacity: 0.55;
  border-color: rgba(239,68,68,0.25) !important;
  background: rgba(239,68,68,0.03) !important;
}
.lesson-card-cancelled .lesson-name {
  text-decoration: line-through;
  color: var(--text-muted);
}
.lesson-cancelled-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; padding: 3px 8px;
  border-radius: 20px; letter-spacing: 0.06em; white-space: nowrap;
  background: rgba(239,68,68,0.12); color: var(--danger);
  border: 1px solid rgba(239,68,68,0.25);
}
.lesson-cancelled-badge i { font-size: 9px; }

/* Online type chip */
.lesson-type.online {
  background: rgba(6,182,212,0.12); color: #06b6d4;
  border: 1px solid rgba(6,182,212,0.2);
}

/* Cancel/restore button in edit-lesson modal */
#btn-toggle-lesson-cancel {
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  padding: 12px; display: flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; transition: var(--transition);
}

/* ============================================
   MATERIAL TYPE BADGE (auto-detected)
   ============================================ */
.file-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.file-ext-badge { /* already defined elsewhere */ }
.mat-type-badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 10px; letter-spacing: 0.04em; white-space: nowrap;
}
.mat-type-badge.mb-wyk   { background: rgba(59,130,246,0.12);  color: #3b82f6; }
.mat-type-badge.mb-lab   { background: rgba(34,197,94,0.12);   color: #22c55e; }
.mat-type-badge.mb-cwicz { background: rgba(245,158,11,0.12);  color: #f59e0b; }
.mat-type-badge.mb-proj  { background: rgba(139,92,246,0.12);  color: #8b5cf6; }
.mat-type-badge.mb-kolo  { background: rgba(239,68,68,0.12);   color: #ef4444; }
.mat-type-badge.mb-egz   { background: rgba(236,72,153,0.12);  color: #ec4899; }

/* Extra file type colors */
.file-card.type-zip  .mat-icon-box { background: rgba(245,158,11,0.1);  color: #f59e0b; }
.file-card.type-ppt  .mat-icon-box { background: rgba(249,115,22,0.1);  color: #f97316; }
.file-card.type-xls  .mat-icon-box { background: rgba(34,197,94,0.1);   color: #22c55e; }
.file-card.type-vid  .mat-icon-box { background: rgba(99,102,241,0.1);  color: #6366f1; }
.file-ext-badge.type-zip  { background: rgba(245,158,11,0.12); color: #f59e0b; }
.file-ext-badge.type-ppt  { background: rgba(249,115,22,0.12); color: #f97316; }
.file-ext-badge.type-xls  { background: rgba(34,197,94,0.12);  color: #22c55e; }
.file-ext-badge.type-vid  { background: rgba(99,102,241,0.12); color: #6366f1; }

/* ================================================
   VIEW MODE TOGGLE (Dzień / Tydzień)
================================================ */
.view-mode-toggle {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.vmt-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.vmt-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.vmt-btn.active {
  background: rgba(59,130,246,0.14);
  color: var(--primary);
  border-color: rgba(59,130,246,0.35);
}

/* ================================================
   WEEK VIEW
================================================ */

/* Mobile: stacked (default) */
.week-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Desktop: 5-column horizontal grid */
@media (min-width: 900px) {
  .schedule-content {
    padding-left: 20px;
    padding-right: 20px;
  }
  .week-grid {
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 20px;
  }
  .week-day-section {
    flex: 1;
    min-width: 0;
  }
  .week-day-section .lesson-card-wrap {
    margin-bottom: 8px;
  }
  .week-day-section .lesson-card {
    padding: 10px 10px 10px 14px;
    gap: 8px;
  }
  .week-day-section .lesson-actions {
    flex-direction: column;
    width: 36px;
  }
}

.week-day-section {
  margin-bottom: 18px;
}

/* Day header: calendar-style box */
.week-day-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  user-select: none;
}
.week-day-section.is-today .week-day-header {
  background: rgba(59,130,246,0.07);
  border-color: rgba(59,130,246,0.25);
}

/* Left: short name + number */
.wdh-day-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 36px;
}
.wdh-short {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1;
}
.wdh-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
}
.wdh-num-today {
  color: var(--primary);
}

/* Right: full name + today pill */
.wdh-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.wdh-full {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.week-today-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(59,130,246,0.15);
  color: var(--primary);
  align-self: flex-start;
}
.week-day-body {
  display: flex;
  flex-direction: column;
}
.week-empty {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 12px 0 4px;
  font-style: italic;
}

/* ================================================
   LESSON CARD WRAP + ATTACHED EVENT ROWS
================================================ */
.lesson-card-wrap {
  margin-bottom: 10px;
}
.lesson-card-wrap .lesson-card {
  margin-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.lesson-card-wrap .lesson-ev-attached + .lesson-card,
.lesson-ev-attached ~ * { /* keep for future */ }

.lesson-ev-attached {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}
.lesson-ev-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: background var(--transition);
  border-top: 1px solid rgba(255,255,255,0.04);
}
.lesson-ev-row:first-child {
  border-top: none;
}
.lesson-ev-row:hover {
  background: rgba(255,255,255,0.05);
}
.lesson-ev-row-dot {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--ev-color) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--ev-color) 28%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--ev-color);
}
.lesson-ev-row-label {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--ev-color);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lesson-ev-row-label em {
  font-style: normal;
  font-weight: 400;
  color: var(--text-muted);
}
.lesson-ev-row-arrow {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Highlight flash when navigating to an event */
@keyframes evHighlight {
  0%   { box-shadow: 0 0 0 0 rgba(59,130,246,0.5); }
  50%  { box-shadow: 0 0 0 6px rgba(59,130,246,0.15); }
  100% { box-shadow: 0 0 0 0 rgba(59,130,246,0); }
}
.event-card-highlight {
  animation: evHighlight 0.9s ease 2;
  border-color: rgba(59,130,246,0.35) !important;
}

/* Keep old chip styles for any legacy references */
.lesson-ev-chips { display: none; }
.lesson-ev-chip  { display: none; }

/* ================================================
   EVENT DETAIL SHEET (inline w planie)
================================================ */
#ev-detail-sheet {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: flex-end;
}
.evds-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
}
.evds-panel {
  position: relative;
  width: 100%;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  padding: 20px 20px 28px;
  z-index: 1;
  animation: slideUpSheet 0.25s cubic-bezier(.22,1,.36,1) both;
  max-height: 80vh;
  overflow-y: auto;
}
@keyframes slideUpSheet {
  from { transform: translateY(100%); opacity: 0.4; }
  to   { transform: translateY(0);    opacity: 1; }
}
@media (min-width: 640px) {
  #ev-detail-sheet { align-items: center; justify-content: center; }
  .evds-panel {
    max-width: 440px;
    border-radius: 18px;
    border-bottom: 1px solid var(--border);
    animation: fadeIn 0.2s ease both;
  }
}
.evds-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.evds-icon-wrap {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.evds-titles { flex: 1; min-width: 0; }
.evds-type-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  opacity: 0.85;
  margin-bottom: 2px;
}
.evds-subject {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.evds-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.evds-close:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.evds-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.evds-date-val { display: flex; align-items: center; gap: 5px; }
.evds-cd { font-size: 12px; font-weight: 600; margin-left: auto; }
.evds-desc {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.6;
  padding-top: 4px;
}
.evds-desc p { margin: 0 0 6px; }
.evds-desc p:last-child { margin-bottom: 0; }
.evds-desc ul,.evds-desc ol { padding-left: 18px; margin: 4px 0 8px; }
.evds-desc code { background: rgba(99,102,241,0.12); border-radius: 4px; padding: 1px 5px; font-size: 12px; font-family: monospace; }
.evds-desc strong { color: var(--text); font-weight: 600; }
/* event detail sheet — files */
.evds-files { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; }
.evds-files-loading { text-align:center; padding:12px; color:var(--text-muted); }
.evds-files-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted);
  margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.evds-files-list { display: flex; flex-direction: column; gap: 4px; }
.evds-file-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; background: var(--surface-raised);
  border-radius: 8px; color: var(--text); text-decoration: none; font-size: 13px;
}
.evds-file-item:hover { background: var(--surface-active); }
.evds-file-item i { color: var(--text-muted); font-size: 14px; flex-shrink: 0; }
.evds-file-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* event modal — markdown description */
.form-label-flex {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px;
}
.form-label-flex label { margin-bottom: 0; }
.form-hint {
  font-size: 10px; font-weight: 500; color: var(--text-muted);
  background: var(--surface-raised); padding: 2px 6px;
  border-radius: 4px; margin-left: 6px;
}
#ev-preview-toggle {
  font-size: 12px; background: rgba(99,102,241,0.12); color: var(--primary);
  border: none; border-radius: 8px; padding: 4px 10px; cursor: pointer;
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
#ev-preview-toggle:hover { background: rgba(99,102,241,0.22); }
.ev-md-preview {
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; font-size: 13px;
  color: var(--text); line-height: 1.6; min-height: 60px;
}
.ev-md-preview p { margin: 0 0 8px; }
.ev-md-preview p:last-child { margin-bottom: 0; }
.ev-md-preview ul,.ev-md-preview ol { padding-left: 20px; margin: 4px 0 8px; }
.ev-md-preview code { background: rgba(99,102,241,0.1); border-radius: 4px; padding: 1px 5px; font-size: 12px; font-family: monospace; }
.ev-md-preview strong { color: var(--text); font-weight: 700; }

/* ================================================
   APP TOAST NOTIFICATIONS
================================================ */
.app-toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
}
.app-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.app-toast-success i { color: var(--success); }
.app-toast-error   i { color: var(--danger); }
.app-toast-info    i { color: var(--primary); }

/* ============================================
   CHAT
   ============================================ */

/* Nav badge */
.nav-chat-wrap { position: relative; display: inline-flex; }
.chat-badge {
  position: absolute; top: -6px; right: -8px;
  background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 700; min-width: 16px; height: 16px;
  border-radius: 99px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
}

/* Loading spinner placeholder */
.chat-loading {
  display: flex; align-items: center; justify-content: center;
  padding: 48px 0; color: var(--text-muted); font-size: 22px;
}

/* ---- User List ---- */
.chat-user-list {
  flex: 1; overflow-y: auto;
  padding: 10px 14px calc(var(--nav-h) + 20px);
}
.chat-user-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  margin-bottom: 8px; cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  animation: slideUp 0.3s var(--ease) both;
  position: relative;
}
.chat-user-row:hover  { background: rgba(59,130,246,0.07); }
.chat-user-row:active { transform: scale(0.985); }

.chat-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  flex-shrink: 0; position: relative;
}
.chat-online-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--success); border: 2px solid var(--bg2);
  position: absolute; bottom: 1px; right: 1px;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  50%      { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}
/* Inline dot (in thread header) */
.chat-header-status .chat-online-dot {
  position: static; display: inline-block; vertical-align: middle; margin-right: 4px;
}

.chat-user-info { flex: 1; min-width: 0; }
.chat-user-name { font-size: 14px; font-weight: 600; display: block; }
.chat-user-online-text { font-size: 11px; color: var(--success); font-weight: 500; }
.chat-user-lastseen    { font-size: 11px; color: var(--text-muted); }
.chat-user-badge {
  background: var(--primary); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 99px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ---- Global chat row ---- */
.chat-global-row {
  background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(139,92,246,0.10)) !important;
  border-color: rgba(59,130,246,0.35) !important;
  position: relative;
}
.chat-global-row:hover {
  background: linear-gradient(135deg, rgba(59,130,246,0.22), rgba(139,92,246,0.18)) !important;
}
.chat-global-row::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(to bottom, var(--primary), var(--accent));
  border-radius: 4px 0 0 4px;
}
.chat-avatar-global {
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff; flex-shrink: 0;
  box-shadow: 0 0 14px rgba(59,130,246,0.4);
}
.chat-badge-global {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 99px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 0 8px rgba(59,130,246,0.4);
}

/* No users placeholder */
.chat-no-users {
  padding: 48px 0; text-align: center;
  color: var(--text-muted); font-size: 14px;
}
.chat-no-users i { font-size: 30px; display: block; margin-bottom: 10px; opacity: .4; }

/* ---- Thread / Message Window ---- */
.chat-thread {
  flex: 1; flex-direction: column; overflow: hidden;
  display: flex;
}
.chat-messages {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 12px 14px 8px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 4px;
}

/* Date divider */
.chat-date-divider {
  text-align: center; margin: 12px 0 6px;
  position: relative;
}
.chat-date-divider::before {
  content: ''; position: absolute; top: 50%; left: 0; right: 0;
  height: 1px; background: var(--border);
}
.chat-date-divider span {
  position: relative; background: var(--bg);
  padding: 0 10px; font-size: 11px; color: var(--text-muted); font-weight: 500;
}

/* Chat message rows */
.chat-msg {
  display: flex; flex-direction: column; max-width: 80%;
  animation: msgIn 0.22s var(--ease) both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg-mine   { align-self: flex-end; align-items: flex-end; }
.msg-theirs { align-self: flex-start; align-items: flex-start; }

.chat-sender-name { font-size: 10px; color: var(--text-muted); margin-bottom: 3px; margin-left: 2px; }
.chat-time        { font-size: 10px; color: var(--text-muted); margin-top: 3px; }

/* Bubbles */
.chat-bubble {
  padding: 10px 14px; border-radius: 18px; max-width: 100%; word-break: break-word;
  line-height: 1.5;
}
.msg-mine   .chat-bubble {
  background: var(--primary); color: #fff;
  border-bottom-right-radius: 5px;
}
.msg-theirs .chat-bubble {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-bottom-left-radius: 5px;
}

/* Bare bubble — code / image / video: no background, no padding, no border */
.chat-bubble.chat-bubble-bare {
  padding: 0; background: transparent !important;
  border: none !important; border-radius: 0;
}

.chat-text { font-size: 14px; white-space: pre-wrap; }
.chat-link { color: inherit; text-decoration: underline; opacity: 0.85; }

/* Image / Video / File attachments */
.chat-img-preview {
  max-width: 240px; max-height: 220px; border-radius: 14px;
  display: block; object-fit: cover;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  cursor: zoom-in;
}
.chat-video-preview {
  max-width: 280px; max-height: 200px; border-radius: 14px;
  display: block;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.chat-file-attach {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 500;
  color: inherit; text-decoration: none;
}
.chat-file-attach i { font-size: 20px; opacity: 0.8; }
.chat-file-attach:hover { text-decoration: underline; }
.chat-file-attach-wrap {
  display: flex; align-items: center; gap: 8px;
}
.chat-file-code-preview {
  background: rgba(97,175,239,0.12);
  border: 1px solid rgba(97,175,239,0.3);
  color: #61afef; border-radius: 6px; cursor: pointer;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}
.chat-file-code-preview:hover { background: rgba(97,175,239,0.28); }
.chat-file-code-preview:disabled { opacity: 0.5; cursor: default; }

/* Code block — highlight.js powered */
.chat-code-block {
  background: #282c34;
  border-radius: 12px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  min-width: 220px; max-width: min(400px, 85vw);
  font-size: 12px;
}
.chat-code-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 10px;
  background: rgba(0,0,0,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.chat-code-lang-pill {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: #61afef;
  display: flex; align-items: center; gap: 5px;
}
.chat-copy-btn {
  display: flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer; color: #9da5b4; font-size: 10px; padding: 3px 9px;
  border-radius: 5px; transition: var(--transition); font-family: inherit;
}
.chat-copy-btn:hover { background: rgba(97,175,239,0.2); color: #61afef; border-color: rgba(97,175,239,0.4); }

/* Header button group */
.chat-code-hdr-btns { display: flex; align-items: center; gap: 5px; }

/* Expand to fullscreen button */
.chat-fullscreen-btn {
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; cursor: pointer;
  color: #9da5b4; font-size: 11px; padding: 3px 6px;
  border-radius: 5px; transition: var(--transition);
}
.chat-fullscreen-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ── Code fullscreen overlay ── */
.code-fs-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: #1a1e27;
  display: flex; flex-direction: column;
  animation: fadeIn 0.15s ease;
}
.code-fs-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; gap: 12px;
  background: rgba(0,0,0,0.45);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.code-fs-hdr-right { display: flex; align-items: center; gap: 10px; }
.code-fs-copy-btn {
  display: flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  cursor: pointer; color: #9da5b4; font-size: 13px; padding: 6px 16px;
  border-radius: 7px; transition: var(--transition); font-family: inherit;
}
.code-fs-copy-btn:hover { background: rgba(97,175,239,0.2); color: #61afef; border-color: rgba(97,175,239,0.4); }
.code-fs-close-btn {
  display: flex; align-items: center; gap: 7px;
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  cursor: pointer; color: #ef4444; font-size: 13px; padding: 6px 16px;
  border-radius: 7px; transition: var(--transition); font-family: inherit;
}
.code-fs-close-btn:hover { background: rgba(239,68,68,0.25); }
.code-fs-body {
  /* flex: 1 keeps it as a flex child of the overlay column */
  /* display: grid makes gutter+pre share one scroll container */
  flex: 1; display: grid;
  grid-template-columns: auto 1fr;
  overflow: auto; min-height: 0;
}
.code-fs-gutter {
  position: sticky; left: 0; z-index: 1;
  padding: 22px 12px !important;
  background: rgba(0,0,0,0.35) !important;
  /* no min-height — was causing gutter to be taller than the code */
}
.code-fs-gutter span { font-size: 14px !important; line-height: 23px !important; display: block !important; }
.code-fs-pre {
  /* no flex: 1 — grid handles sizing; no overflow — parent grid handles it */
  padding: 22px 24px !important;
  font-size: 14px !important; line-height: 23px !important; white-space: pre;
}
.code-fs-pre code.hljs { font-size: 14px !important; line-height: 23px !important; }


/* Scroll area with gutter — single grid scroll container so gutter+code always in sync */
.chat-code-scroll {
  display: grid;
  grid-template-columns: auto 1fr;
  overflow: auto;
  max-height: 300px;
}
.chat-code-gutter {
  /* sticky left: always visible during horizontal scroll */
  position: sticky; left: 0; z-index: 1;
  padding: 12px 10px 12px 8px;
  background: rgba(0,0,0,0.25);
  border-right: 1px solid rgba(255,255,255,0.05);
  user-select: none;
  /* flex column so the gutter width = widest line-number, not hardcoded */
  display: flex; flex-direction: column; align-items: flex-end;
}
.chat-code-gutter span {
  font-family: 'JetBrains Mono','Fira Code','Consolas',monospace;
  font-size: 12px; line-height: 19px; color: #4b5263;
  white-space: nowrap;
}
.chat-code-pre {
  margin: 0; padding: 12px 14px;
  /* no overflow here — parent grid handles both axes */
  font-family: 'JetBrains Mono','Fira Code','Consolas',monospace;
  font-size: 12px; line-height: 19px; white-space: pre;
}
.chat-code-pre code.hljs {
  padding: 0; background: transparent; white-space: pre;
  display: block; line-height: 19px;
}
/* Override hljs theme bg to match our dark container */
.chat-code-block .hljs { background: transparent; }

/* Code preview in panel */
.chat-code-preview {
  margin-top: 8px; border-radius: 10px; overflow: hidden;
}
.chat-code-preview .chat-code-block {
  max-width: 100%; border-radius: 8px;
}

/* Read receipt (like Messenger) */
.chat-read-receipt {
  display: flex; justify-content: flex-end;
  margin-top: 3px; margin-right: 2px;
}
.chat-read-avatar {
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 7px; font-weight: 700; letter-spacing: -0.5px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.85; cursor: default;
  border: 1.5px solid var(--bg);
  animation: msgIn 0.2s var(--ease) both;
}

/* Profile modal */
.profile-avatar-wrap {
  display: flex; justify-content: center; padding: 10px 0 6px;
}
.profile-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; font-size: 28px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: -1px;
  box-shadow: 0 8px 32px rgba(59,130,246,0.35);
}
.profile-info {
  text-align: center; margin-top: 14px;
}
.profile-name  { font-size: 20px; font-weight: 700; color: var(--text); }
.profile-login { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.btn-danger {
  background: rgba(239,68,68,0.12); color: #f87171;
  border: 1.5px solid rgba(239,68,68,0.3); border-radius: var(--radius-sm);
  padding: 12px; font-size: 14px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: var(--transition);
}
.btn-danger:hover { background: rgba(239,68,68,0.22); border-color: #ef4444; }

/* ---- Input Bar ---- */
.chat-input-bar {
  flex-shrink: 0;
  padding: 6px 10px calc(var(--nav-h) + env(safe-area-inset-bottom) + 4px);
  background: rgba(13,15,20,0.92);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(16px);
}
.chat-toolbar {
  display: none;
}
.chat-tool-btn {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  color: var(--text-soft); width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 15px; transition: var(--transition);
}
.chat-tool-btn:hover  { background: rgba(59,130,246,0.15); color: var(--primary); border-color: rgba(59,130,246,0.3); }
.chat-tool-btn.active { background: rgba(59,130,246,0.2);  color: var(--primary); border-color: var(--primary); }

.chat-input-row {
  display: flex; align-items: flex-end; gap: 8px;
}
.chat-textarea {
  flex: 1; background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: 20px; color: var(--text); font-size: 14px;
  padding: 10px 16px; resize: none; outline: none;
  font-family: inherit; line-height: 1.4; overflow-y: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.chat-textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow);
}
.chat-textarea::placeholder { color: var(--text-muted); }

.chat-send-btn {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary); border: none; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer;
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), background var(--transition);
  box-shadow: 0 4px 16px var(--primary-glow);
}
.chat-send-btn:hover  { background: var(--primary-hover); transform: scale(1.08); }
.chat-send-btn:active { transform: scale(0.92); }

/* Code panel */
.chat-code-panel {
  background: rgba(0,0,0,0.25); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px; margin-top: 6px;
}
.chat-code-panel-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  font-size: 12px; font-weight: 600; color: var(--text-soft);
}
.chat-code-lang-select {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  color: var(--text); padding: 4px 8px; border-radius: 7px;
  font-size: 12px; outline: none; font-family: inherit; flex: 1;
}
.chat-code-textarea {
  width: 100%; background: rgba(0,0,0,0.4); border: 1px solid var(--border);
  border-radius: 8px; color: #e2e8f0; font-family: 'JetBrains Mono','Fira Code','Consolas',monospace;
  font-size: 12px; padding: 10px 12px; resize: vertical; min-height: 90px;
  outline: none; line-height: 1.55;
  transition: border-color var(--transition);
}
.chat-code-textarea:focus { border-color: var(--primary); }

/* Header status */
.chat-header-status {
  font-size: 11px; font-weight: 500;
  display: flex; align-items: center; gap: 5px;
}
.chat-header-status.online  { color: var(--success); }
.chat-header-status.offline { color: var(--text-muted); }

/* ══════════════════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════════════════ */
body.lb-open { overflow: hidden; }

#lb-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s ease;
}
#lb-overlay.lb-visible {
  opacity: 1; pointer-events: all;
}

#lb-bg {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(8px);
}

/* Top bar */
#lb-top-bar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 18px 70px 18px 24px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
  z-index: 2;
}
#lb-counter {
  font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.55);
  min-width: 50px;
}
#lb-name {
  flex: 1; font-size: 14px; font-weight: 500; color: rgba(255,255,255,0.85);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#lb-download {
  color: rgba(255,255,255,0.6); font-size: 18px;
  text-decoration: none; transition: color 0.15s;
  padding: 6px 8px; border-radius: 8px;
}
#lb-download:hover { color: #fff; background: rgba(255,255,255,0.1); }

/* Close */
#lb-close {
  position: absolute; top: 14px; right: 18px; z-index: 3;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.8); font-size: 18px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
#lb-close:hover { background: rgba(255,255,255,0.18); color: #fff; }

/* Nav arrows */
#lb-prev, #lb-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 3; width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.85); font-size: 20px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.15s;
}
#lb-prev { left: 20px; }
#lb-next { right: 20px; }
#lb-prev:hover { background: rgba(255,255,255,0.18); transform: translateY(-50%) scale(1.07); }
#lb-next:hover { background: rgba(255,255,255,0.18); transform: translateY(-50%) scale(1.07); }
@media (max-width: 600px) {
  #lb-prev { left: 6px; } #lb-next { right: 6px; }
  #lb-prev, #lb-next { width: 40px; height: 40px; font-size: 16px; }
}

/* Image wrapper */
#lb-img-wrap {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  max-width: calc(100vw - 140px); max-height: calc(100vh - 180px);
  user-select: none;
}
@media (max-width: 600px) {
  #lb-img-wrap { max-width: 100vw; max-height: calc(100vh - 160px); }
}

#lb-img {
  max-width: 100%; max-height: calc(100vh - 180px);
  object-fit: contain; border-radius: 10px;
  opacity: 0; transition: opacity 0.2s ease;
  box-shadow: 0 20px 80px rgba(0,0,0,0.6);
  display: block;
}
#lb-img.lb-loaded { opacity: 1; }

/* Slide animation */
#lb-img.lb-slide-left  { animation: lbSlideLeft  0.18s ease forwards; }
#lb-img.lb-slide-right { animation: lbSlideRight 0.18s ease forwards; }
@keyframes lbSlideLeft  { from { opacity:0; transform: translateX(40px); } to { opacity:1; transform: translateX(0); } }
@keyframes lbSlideRight { from { opacity:0; transform: translateX(-40px); } to { opacity:1; transform: translateX(0); } }

/* Thumbnail strip */
#lb-strip-wrap {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 12px 0 18px;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  z-index: 2; display: flex; align-items: center; justify-content: center;
}
#lb-strip {
  display: flex; gap: 8px; overflow-x: auto; max-width: 90vw;
  padding: 4px 8px; scroll-behavior: smooth;
  scrollbar-width: none;
}
#lb-strip::-webkit-scrollbar { display: none; }
.lb-strip-thumb {
  width: 52px; height: 52px; border-radius: 8px; overflow: hidden;
  flex-shrink: 0; cursor: pointer; border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.15s, opacity 0.15s;
  opacity: 0.55;
}
.lb-strip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb-strip-thumb:hover { opacity: 0.85; transform: scale(1.06); }
.lb-strip-thumb.active {
  border-color: #fff; opacity: 1; transform: scale(1.1);
}

/* ── Paste preview bar (single + multi-file) ── */
.paste-preview-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  animation: slideUp 0.18s var(--ease) both;
  flex-wrap: wrap;
}

/* File cards row */
.pprev-cards {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.pprev-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; max-width: 56px;
}
.pprev-thumb {
  width: 48px; height: 48px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.pprev-thumb-img {
  background: #111 center/cover no-repeat;
  border: 1px solid rgba(255,255,255,0.08);
  transition: background-image 0.2s;
}
.pprev-thumb-icon { background: rgba(255,255,255,0.05); font-size: 22px; }
.pprev-card-name {
  font-size: 9px; color: var(--text-muted); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 54px; display: block;
}
.pprev-card-more {
  width: 48px; height: 48px; border-radius: 8px;
  background: rgba(255,255,255,0.07); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--text-muted);
}

.paste-preview-info {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px;
}
.paste-preview-name {
  font-size: 12px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; color: var(--text);
}
.paste-preview-size { font-size: 11px; color: var(--text-muted); }
.paste-preview-btns { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.paste-preview-btns .btn { padding: 6px 14px; font-size: 12px; }
.paste-btn-cancel {
  width: 32px; height: 32px; border-radius: 50%;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.paste-btn-cancel:hover { background: rgba(239,68,68,0.15); color: #ef4444; border-color: rgba(239,68,68,0.4); }

/* ── Chat section headers (Online / Offline) ── */
.chat-section-hdr {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
  padding: 6px 4px 4px;
  display: flex; align-items: center; gap: 6px;
  user-select: none;
}

/* ── Per-message online dot ── */
.msg-online-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted); margin-right: 5px;
  vertical-align: middle; flex-shrink: 0;
  transition: background 0.3s;
}
.msg-online-dot.msg-dot-online {
  background: var(--success);
  box-shadow: 0 0 5px rgba(34,197,94,0.6);
}

/* ── Attach button inside input row ── */
.chat-input-row .chat-tool-btn {
  flex-shrink: 0;
}

/* ── Chat drag-drop zone ── */
.chat-drop-zone {
  position: absolute; inset: 0; z-index: 50;
  background: rgba(10,14,22,0.88);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  pointer-events: all;
}
.chat-thread { position: relative; }
.chat-drop-inner {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 48px 56px;
  border: 2px dashed rgba(59,130,246,0.55);
  border-radius: 20px;
  text-align: center;
  pointer-events: none;
  animation: fadeIn 0.15s ease;
}
.chat-drop-inner i {
  font-size: 52px; color: var(--primary);
  filter: drop-shadow(0 0 18px rgba(59,130,246,0.5));
}
.chat-drop-inner span {
  font-size: 18px; font-weight: 700; color: var(--text);
}
.chat-drop-inner small {
  font-size: 12px; color: var(--text-muted);
}

/* ── Code file paste preview ── */
.paste-preview-code {
  flex-direction: column; gap: 8px; align-items: stretch;
}
.pprev-code-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.pprev-code-file {
  display: flex; align-items: center; gap: 10px; min-width: 0;
}
.pprev-code-file > div {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.pprev-code-block {
  max-height: 220px; overflow: hidden; border-radius: 8px;
  position: relative;
}
/* Fade out bottom of truncated preview */
.pprev-code-block::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 48px;
  background: linear-gradient(transparent, var(--surface));
  pointer-events: none;
}
.pprev-code-block .chat-code-block {
  max-width: 100%; border-radius: 8px;
}
.pprev-code-block .chat-code-scroll {
  max-height: 220px;
}
.pprev-expand-btn {
  align-self: center; background: rgba(255,255,255,0.05);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-muted); font-size: 12px; padding: 6px 16px;
  cursor: pointer; font-family: inherit; transition: var(--transition);
  display: flex; align-items: center; gap: 7px; width: 100%; justify-content: center;
}
.pprev-expand-btn:hover { background: rgba(59,130,246,0.12); color: var(--primary); border-color: rgba(59,130,246,0.35); }

/* ══════════════════════════════════════════
   UNIVERSAL FILE EDITOR OVERLAY
══════════════════════════════════════════ */
.fe-overlay {
  position: fixed; inset: 0; z-index: 9994;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.22s;
}
.fe-overlay.visible { opacity: 1; }
.fe-dialog {
  width: min(98vw, 980px); height: min(93vh, 860px);
  background: #1a1d27; border: 1px solid rgba(255,255,255,0.09);
  border-radius: 18px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 32px 80px rgba(0,0,0,0.7);
  transform: scale(0.97); transition: transform 0.24s cubic-bezier(.34,1.56,.64,1);
}
.fe-overlay.visible .fe-dialog { transform: scale(1); }
.fe-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: rgba(0,0,0,0.4);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0; gap: 12px;
}
.fe-hdr-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; overflow: hidden; }
.fe-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fe-lang-pill {
  padding: 3px 9px; border-radius: 6px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.5px; background: rgba(97,175,239,0.15);
  border: 1px solid rgba(97,175,239,0.3); color: #61afef;
  white-space: nowrap; flex-shrink: 0;
}
.fe-tabs { display: flex; gap: 4px; flex-shrink: 0; }
.fe-tab {
  padding: 6px 14px; border-radius: 8px; cursor: pointer;
  font-size: 12px; font-weight: 600; background: transparent;
  border: 1px solid transparent; color: var(--text-muted);
  font-family: inherit; transition: all 0.18s;
  display: flex; align-items: center; gap: 6px;
}
.fe-tab.active { background: rgba(97,175,239,0.15); border-color: rgba(97,175,239,0.3); color: #61afef; }
.fe-tab:not(.active):hover { background: rgba(255,255,255,0.06); color: var(--text); }
.fe-hdr-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.fe-save-btn {
  padding: 6px 14px; border-radius: 8px; cursor: pointer;
  font-size: 12px; font-weight: 600;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border: none; color: #fff; font-family: inherit;
  display: flex; align-items: center; gap: 6px;
  box-shadow: 0 2px 10px rgba(34,197,94,0.3); transition: opacity 0.18s;
}
.fe-save-btn:hover:not(:disabled) { opacity: 0.85; }
.fe-save-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.fe-close-btn {
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.18s;
}
.fe-close-btn:hover { background: rgba(239,68,68,0.25); }
.fe-lock-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; flex-shrink: 0;
  background: rgba(234,179,8,0.1); border-bottom: 1px solid rgba(234,179,8,0.25);
  color: #fbbf24; font-size: 13px;
}
.fe-lock-banner i { font-size: 15px; flex-shrink: 0; }
.fe-body { flex: 1; overflow: hidden; min-height: 0; display: flex; flex-direction: column; }
.fe-textarea {
  flex: 1; width: 100%; box-sizing: border-box;
  background: #141720; color: #abb2bf;
  font-family: 'JetBrains Mono','Fira Code','Consolas',monospace;
  font-size: 13px; line-height: 1.7; padding: 20px 26px;
  border: none; outline: none; resize: none; tab-size: 2; min-height: 0;
}
.fe-textarea[readonly] { opacity: 0.65; cursor: default; }
.fe-preview { flex: 1; overflow: auto; min-height: 0; }
.fe-html-frame { width: 100%; height: 100%; border: none; background: #fff; display: block; }

/* ─── Chat message action menu ─── */
.chat-msg {
  position: relative;
}
.chat-msg-menu-btn {
  position: absolute; top: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-muted);
  cursor: pointer; opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  z-index: 10;
  padding: 0; line-height: 1;
}
.chat-msg.msg-mine  .chat-msg-menu-btn { right: calc(100% + 6px); }
.chat-msg.msg-theirs .chat-msg-menu-btn { left: calc(100% + 6px); }
.chat-msg:hover .chat-msg-menu-btn { opacity: 1; }
.chat-msg-menu-btn:hover { background: rgba(255,255,255,0.1); color: var(--text); }

/* Dropdown menu card */
.chat-msg-menu {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  z-index: 9999;
  min-width: 154px;
  overflow: hidden;
  opacity: 0; transform: scale(0.92) translateY(-4px);
  transform-origin: top right;
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
  pointer-events: none;
}
.chat-msg.msg-mine  .chat-msg-menu { right: 0; top: 28px; }
.chat-msg.msg-theirs .chat-msg-menu { left: 0;  top: 28px; }
.chat-msg-menu.visible { opacity: 1; transform: scale(1) translateY(0); pointer-events: all; }
.chat-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; font-size: 14px; color: var(--text);
  background: transparent; border: none;
  cursor: pointer; width: 100%; text-align: left;
  transition: background 0.12s;
}
.chat-menu-item:hover { background: rgba(255,255,255,0.07); }
.chat-menu-item + .chat-menu-item { border-top: 1px solid var(--border); }
.chat-menu-delete { color: #f87171 !important; }

/* ── Mobile: always show 3-dot btn + fixed position menu ── */
@media (hover: none) {
  .chat-msg-menu-btn { opacity: 0.55; }
  .chat-msg-menu-btn:active { opacity: 1; background: rgba(255,255,255,0.12); }
}
@media (max-width: 640px) {
  .chat-msg-menu {
    position: fixed !important;
    bottom: calc(var(--nav-h, 62px) + 14px);
    left: 50% !important; right: auto !important; top: auto !important;
    transform: translateX(-50%) scale(0.93) translateY(12px) !important;
    transform-origin: bottom center;
    min-width: 220px; max-width: calc(100vw - 40px);
    border-radius: 18px;
    box-shadow: 0 -4px 40px rgba(0,0,0,0.55);
  }
  .chat-msg-menu.visible {
    transform: translateX(-50%) scale(1) translateY(0) !important;
  }
}

/* Deleted message tombstone */
.chat-msg-deleted {
  font-style: italic;
  opacity: 0.5;
  display: flex; align-items: center; gap: 6px;
  font-size: 13px;
}

/* Edited badge */
.chat-edited-badge {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
  margin-left: 4px;
}

/* Code edit fullscreen overlay */
.chat-code-edit-area {
  flex: 1; width: 100%; box-sizing: border-box;
  background: #141720; color: #abb2bf;
  font-family: 'JetBrains Mono','Fira Code','Consolas',monospace;
  font-size: 13px; line-height: 1.7; padding: 20px 26px;
  border: none; outline: none; resize: none; tab-size: 2;
}

/* ─── Code editor (edit mode) ─── */
.ce-editor-wrap {
  flex: 1; display: flex; overflow: hidden; min-height: 0;
  background: #141720;
}
.ce-gutter {
  flex-shrink: 0; width: 44px;
  background: #0d0f14; color: #4b5263;
  font-family: 'JetBrains Mono','Fira Code','Consolas',monospace;
  font-size: 13px; line-height: 1.7;
  padding: 20px 8px 20px 0;
  text-align: right;
  overflow: hidden; user-select: none;
  border-right: 1px solid rgba(255,255,255,0.05);
}
.ce-gutter span { display: block; }
.ce-textarea-wrap {
  flex: 1; position: relative; overflow: hidden;
}
.ce-textarea,
.ce-highlight-layer {
  position: absolute; inset: 0;
  font-family: 'JetBrains Mono','Fira Code','Consolas',monospace;
  font-size: 13px; line-height: 1.7;
  padding: 20px 20px 20px 16px;
  white-space: pre; tab-size: 2;
  overflow: auto; box-sizing: border-box;
  margin: 0; border: none; outline: none;
}
.ce-textarea {
  background: transparent; color: transparent;
  caret-color: #abb2bf; resize: none;
  z-index: 2;
}
.ce-highlight-layer {
  background: #141720; color: #abb2bf;
  pointer-events: none; z-index: 1;
}
.ce-highlight-layer code {
  display: block; background: transparent !important;
  padding: 0; white-space: pre; overflow: visible;
}

/* ─── Profile edit modal ─── */
.modal-sheet-tall .modal-body {
  max-height: 88vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.profile-avatar-label {
  position: relative; display: inline-block; cursor: pointer;
}
.profile-avatar-cam {
  position: absolute; bottom: 0; right: 0;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; border: 2px solid var(--bg);
  pointer-events: none;
}
.profile-avatar-label:hover .profile-avatar { filter: brightness(0.75); }

.profile-edit-sections {
  display: flex; flex-direction: column; gap: 16px;
  margin-top: 4px;
}
.profile-edit-group {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px;
}
.profile-edit-label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 10px; display: flex; align-items: center; gap: 6px;
}
.profile-edit-row {
  display: flex; gap: 8px; align-items: center;
}
.profile-edit-input {
  flex: 1; background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 13px;
  font-size: 14px; color: var(--text); outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.profile-edit-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.profile-save-btn {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff;
  border: none; cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.profile-save-btn:hover { background: var(--primary-hover); }
.profile-save-btn-full {
  width: 100%; padding: 11px; border-radius: var(--radius-sm);
  background: rgba(59,130,246,0.12); border: 1.5px solid rgba(59,130,246,0.28);
  color: var(--primary); font-size: 14px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s, border-color 0.15s;
}
.profile-save-btn-full:hover { background: rgba(59,130,246,0.22); border-color: var(--primary); }

/* ─── Notification pills ─── */
#notif-tray {
  position: fixed; top: 14px; right: 14px;
  z-index: 88888;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
  max-width: min(340px, calc(100vw - 28px));
}
.notif-pill {
  background: rgba(26,30,39,0.97);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex; align-items: flex-start; gap: 11px;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  cursor: pointer;
  pointer-events: all;
  opacity: 0; transform: translateX(24px) scale(0.97);
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease);
  position: relative;
}
.notif-pill.visible { opacity: 1; transform: translateX(0) scale(1); }
.notif-pill-icon {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px;
  background: rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; margin-top: 1px;
}
.notif-pill-body { flex: 1; min-width: 0; }
.notif-pill-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-pill-text {
  font-size: 12px; color: var(--text-soft); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-pill-close {
  flex-shrink: 0; background: transparent; border: none;
  color: var(--text-muted); font-size: 12px; cursor: pointer;
  padding: 2px 2px 2px 6px; margin-top: -2px;
  transition: color 0.15s;
}
.notif-pill-close:hover { color: var(--text); }



/* ============================================================
   EVENT FILES SHEET
   ============================================================ */
.evf-sheet {
  position: fixed; inset: 0; z-index: 600;
  display: flex; align-items: flex-end;
}
.evf-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.58);
  backdrop-filter: blur(4px);
}
.evf-panel {
  position: relative; z-index: 1;
  width: 100%; max-width: 560px; margin: 0 auto;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  border: 1px solid var(--border); border-bottom: none;
  display: flex; flex-direction: column;
  max-height: 82dvh; min-height: 300px;
  box-shadow: 0 -20px 60px rgba(0,0,0,0.55);
  transform: translateY(100%);
  transition: transform 0.34s cubic-bezier(.22,1,.36,1);
}
.evf-sheet.evf-visible .evf-panel {
  transform: translateY(0);
}
.evf-handle {
  width: 36px; height: 4px; border-radius: 99px;
  background: rgba(255,255,255,0.12);
  margin: 12px auto 0; flex-shrink: 0;
}
.evf-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 10px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.evf-hdr-left {
  display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1;
}
.evf-back-btn {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition);
}
.evf-back-btn:hover { background: rgba(59,130,246,0.14); color: var(--primary); }
.evf-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.evf-hdr-actions {
  display: flex; gap: 6px; flex-shrink: 0; margin-left: 8px;
}
.evf-action-btn {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition);
}
.evf-action-btn:hover { background: rgba(59,130,246,0.14); color: var(--primary); border-color: rgba(59,130,246,0.3); }
.evf-action-close:hover { background: rgba(239,68,68,0.14) !important; color: #ef4444 !important; border-color: rgba(239,68,68,0.3) !important; }

/* Upload progress bar inside sheet */
.evf-progress {
  margin: 0 14px 10px; flex-shrink: 0;
  background: rgba(59,130,246,0.06);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
}
.evf-progress-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; margin-bottom: 7px;
}
#evf-progress-text { color: var(--text-soft); font-weight: 500; }
#evf-progress-pct  { color: var(--primary); font-weight: 700; }
.evf-progress-track {
  height: 6px; border-radius: 99px;
  background: rgba(255,255,255,0.07); overflow: hidden;
}
.evf-progress-fill {
  height: 100%; width: 0%; border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.2s ease;
}

/* Scrollable content area */
.evf-body {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 8px 14px 24px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Event files button on event card */
.event-files-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 12px;
  padding: 4px 8px; border-radius: 6px;
  transition: var(--transition); display: inline-flex;
  align-items: center; gap: 4px; font-family: inherit;
  margin-right: 2px;
}
.event-files-btn:hover {
  color: var(--primary); background: rgba(59,130,246,0.1);
}

/* ============================================================
   SUBJECT MATERIALS SHEET  (sms-sheet)
   ============================================================ */
#sms-sheet {
  position: fixed; inset: 0; z-index: 600;
  display: flex; align-items: flex-end;
}
.sms-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.58);
  backdrop-filter: blur(4px);
}
.sms-panel {
  position: relative; z-index: 1;
  width: 100%; max-width: 560px; margin: 0 auto;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  border: 1px solid var(--border); border-bottom: none;
  display: flex; flex-direction: column;
  max-height: 78dvh; min-height: 220px;
  box-shadow: 0 -20px 60px rgba(0,0,0,0.55);
  transform: translateY(100%);
  transition: transform 0.34s cubic-bezier(.22,1,.36,1);
}
#sms-sheet.sms-visible .sms-panel { transform: translateY(0); }
.sms-hdr {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px 12px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.sms-hdr-icon {
  width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; transition: background 0.2s, color 0.2s;
}
.sms-hdr-info { flex: 1; min-width: 0; }
.sms-subject-name {
  font-size: 15px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sms-file-count { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.sms-hdr-actions { display: flex; gap: 6px; flex-shrink: 0; }
.sms-body {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 10px 14px 28px;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
/* Section header (subcategory name) */
.sms-section-hdr {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 2px 5px; margin-bottom: 4px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.sms-section-hdr:first-child { padding-top: 4px; }
.sms-section-hdr i { font-size: 11px; opacity: 0.7; }
/* File item rows */
.sms-file-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 10px; border-radius: 12px;
  background: rgba(255,255,255,0.025); border: 1px solid var(--border);
  margin-bottom: 6px; text-decoration: none;
  transition: background 0.14s, border-color 0.14s, transform 0.14s;
  animation: slideUp 0.3s var(--ease) both;
}
.sms-file-item:hover {
  background: rgba(255,255,255,0.06); border-color: rgba(168,85,247,0.35);
  transform: translateX(3px);
}
.sms-file-item:active { transform: scale(0.985) translateX(0); }
.sms-file-icon {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.sms-file-info { flex: 1; min-width: 0; }
.sms-file-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sms-file-meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.sms-file-arr { font-size: 11px; color: var(--text-muted); flex-shrink: 0; opacity: 0.5; }
.sms-file-item:hover .sms-file-arr { opacity: 1; color: rgba(168,85,247,0.9); }
/* Empty state */
.sms-empty {
  text-align: center; padding: 48px 20px 20px;
}
.sms-empty i { font-size: 40px; display: block; opacity: 0.2; margin-bottom: 14px; }
.sms-empty p { font-size: 14px; font-weight: 600; color: var(--text-soft); margin-bottom: 4px; }
.sms-empty small { font-size: 12px; color: var(--text-muted); }

/* Folder structure preview in SMS sheet (when no files yet) */
.sms-struct-list {
  margin: 0 16px 4px;
  border: 1px solid rgba(59,130,246,0.15);
  border-radius: 10px;
  overflow: hidden;
}
.sms-struct-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 14px;
  font-size: 12px; color: var(--text-soft);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sms-struct-item:last-child { border-bottom: none; }
.sms-struct-item i { color: var(--primary); font-size: 12px; opacity: 0.7; }
/* Footer "open in materials" button */
.sms-open-all { display: flex; justify-content: center; padding: 14px 0 4px; }
.sms-open-all-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; border-radius: 12px;
  background: rgba(168,85,247,0.1); border: 1px solid rgba(168,85,247,0.28);
  color: #c084fc; font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: background 0.15s, transform 0.15s;
}
.sms-open-all-btn:hover { background: rgba(168,85,247,0.2); transform: translateY(-1px); }

/* ============================================================
   AVATAR CROP OVERLAY
   ============================================================ */
.avcrop-overlay {
  position: fixed; inset: 0; z-index: 9997;
  display: flex; align-items: center; justify-content: center;
}
.avcrop-bg {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(14px);
}
.avcrop-dialog {
  position: relative; z-index: 1;
  background: #1a1d27;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 22px;
  padding: 0 0 20px;
  width: min(360px, 96vw);
  box-shadow: 0 32px 80px rgba(0,0,0,0.65);
  transform: scale(0.93) translateY(16px);
  opacity: 0;
  transition: transform 0.28s cubic-bezier(.34,1.56,.64,1), opacity 0.22s;
}
.avcrop-overlay.avcrop-visible .avcrop-dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}
.avcrop-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.avcrop-hdr-title {
  font-size: 14px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.avcrop-hdr-title i { color: var(--primary); font-size: 15px; }
.avcrop-x-btn {
  width: 28px; height: 28px; border-radius: 8px; cursor: pointer;
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.avcrop-x-btn:hover { background: rgba(239,68,68,0.24); }

.avcrop-canvas-wrap {
  display: flex; justify-content: center; align-items: center;
  padding: 18px 0 6px;
}
#avatar-crop-canvas {
  border-radius: 12px;
  cursor: grab;
  display: block;
  max-width: 300px; max-height: 300px;
  width: 300px; height: 300px;
  touch-action: none;
  user-select: none;
}
#avatar-crop-canvas:active { cursor: grabbing; }

.avcrop-zoom-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px 2px;
}
.avcrop-zoom-icon { font-size: 13px; color: var(--text-muted); flex-shrink: 0; }
.avcrop-zoom-slider {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 5px; border-radius: 99px;
  background: rgba(255,255,255,0.1);
  outline: none; cursor: pointer;
  accent-color: var(--primary);
}
.avcrop-zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
  cursor: grab;
}
.avcrop-zoom-slider::-webkit-slider-thumb:active { cursor: grabbing; }

.avcrop-hint {
  text-align: center; font-size: 11px; color: var(--text-muted);
  padding: 6px 20px 0; opacity: 0.7;
}

.avcrop-btns {
  display: flex; gap: 10px;
  padding: 16px 20px 0;
}
.avcrop-btn-cancel {
  flex: 1; padding: 11px; border-radius: 11px; cursor: pointer;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  font-family: inherit; transition: background 0.15s;
}
.avcrop-btn-cancel:hover { background: rgba(255,255,255,0.09); }
.avcrop-btn-save {
  flex: 2; padding: 11px; border-radius: 11px; cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none; color: #fff; font-size: 13px; font-weight: 700;
  font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  box-shadow: 0 4px 16px var(--primary-glow);
  transition: opacity 0.18s, transform 0.18s;
}
.avcrop-btn-save:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.avcrop-btn-save:disabled { opacity: 0.5; cursor: not-allowed; }

/* =============================================
   MATERIALS CONTEXT MENU (right-click / long-press)
   ============================================= */
.mat-ctx-menu {
  position: fixed;
  z-index: 9999;
  min-width: 190px;
  background: #1e2330;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
  padding: 6px 0;
  user-select: none;
  animation: ctxFadeIn 0.12s ease;
  overflow: hidden;
}
@keyframes ctxFadeIn {
  from { opacity: 0; transform: scale(0.94) translateY(-4px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}
.mat-ctx-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: 13px; font-weight: 500;
  color: var(--text); cursor: pointer;
  transition: background 0.1s;
}
.mat-ctx-item i { width: 16px; text-align: center; color: var(--text-muted); font-size: 13px; }
.mat-ctx-item:hover { background: rgba(255,255,255,0.07); }
.mat-ctx-item:hover i { color: var(--primary); }
.mat-ctx-item.hidden, .mat-ctx-sep.hidden { display: none; }
.mat-ctx-sep { height: 1px; background: rgba(255,255,255,0.07); margin: 4px 0; }
.mat-ctx-danger { color: var(--danger) !important; }
.mat-ctx-danger i { color: var(--danger) !important; }
.mat-ctx-danger:hover { background: rgba(239,68,68,0.1) !important; }

/* =============================================
   SUBCATEGORY FOLDER PICKER DROPDOWN
   ============================================= */
.subcat-picker-wrap { position: relative; }
.subcat-picker-dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  background: #1e2330;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  max-height: 220px; overflow-y: auto;
  z-index: 400;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  padding: 4px 0;
  animation: ctxFadeIn 0.12s ease;
}
.subcat-pick-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; cursor: pointer;
  font-size: 13px; color: var(--text);
  transition: background 0.1s;
}
.subcat-pick-item:hover { background: rgba(255,255,255,0.06); }
.subcat-pick-item.active { background: rgba(59,130,246,0.1); color: var(--primary); }
.subcat-pick-item i { color: var(--text-muted); font-size: 12px; width: 14px; text-align: center; }
.subcat-pick-item.active i { color: var(--primary); }
.subcat-pick-sep {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted);
  padding: 6px 14px 3px; opacity: 0.7;
}
.subcat-pick-manual {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid rgba(255,255,255,0.07);
  margin-top: 4px;
}
.subcat-pick-manual input {
  flex: 1; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 7px; padding: 6px 10px; font-size: 13px; color: var(--text);
  font-family: inherit; outline: none;
}
.subcat-pick-manual input:focus { border-color: rgba(59,130,246,0.5); }
.subcat-pick-manual button {
  background: rgba(59,130,246,0.15); border: 1px solid rgba(59,130,246,0.3);
  color: var(--primary); border-radius: 7px; padding: 6px 10px; cursor: pointer;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}

/* ================================================
   CHAT INFO PANEL (Messenger-like)
================================================ */
#chat-info-panel {
  position: fixed; inset: 0; z-index: 700;
  display: flex; align-items: stretch; justify-content: flex-end;
}
.cip-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(2px);
}
.cip-drawer {
  position: relative; z-index: 1;
  width: min(340px, 100vw);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
  animation: cipSlideIn 0.25s var(--ease) both;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
@keyframes cipSlideIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
.cip-drawer-handle {
  display: none;
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--border); margin: 12px auto 0;
  flex-shrink: 0;
}
.cip-close-row {
  display: flex; align-items: center; justify-content: flex-end;
  padding: 10px 14px 0;
}
.cip-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-raised); border: none; cursor: pointer;
  color: var(--text-muted); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.cip-close:hover { background: var(--surface-active); color: var(--text); }

.cip-body { flex: 1; padding: 0 0 40px; }

/* Identity block */
.cip-identity {
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 20px 16px; text-align: center;
}
.cip-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #fff;
  margin-bottom: 12px; flex-shrink: 0;
}
.cip-avatar-global {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  box-shadow: 0 0 18px rgba(59,130,246,0.35);
  font-size: 28px;
}
.cip-name {
  font-size: 17px; font-weight: 700; color: var(--text);
  margin-bottom: 4px;
}
.cip-status { font-size: 12px; color: var(--text-muted); }

/* Action buttons */
.cip-actions {
  display: flex; justify-content: center; gap: 16px;
  padding: 0 16px 20px;
}
.cip-action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 20px; cursor: pointer;
  color: var(--text-soft); font-size: 11px; font-weight: 600;
  transition: background var(--transition), color var(--transition);
  min-width: 72px;
}
.cip-action-btn i { font-size: 18px; color: var(--primary); }
.cip-action-btn:hover { background: var(--surface-active); color: var(--text); }

/* Search bar */
#cip-search-bar { padding: 0 14px 12px; }
.cip-search-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px;
}
.cip-search-wrap i { color: var(--text-muted); font-size: 13px; flex-shrink: 0; }
.cip-search-wrap input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 13px;
}
.cip-search-count {
  font-size: 11px; color: var(--text-muted);
  padding: 4px 4px 0; text-align: right;
}

/* Sections */
.cip-section {
  border-top: 1px solid var(--border);
}
.cip-section-hdr {
  width: 100%; background: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; font-size: 14px; font-weight: 700;
  color: var(--text); text-align: left;
}
.cip-section-hdr:hover { background: var(--surface-raised); }
.cip-chevron {
  font-size: 11px; color: var(--text-muted);
  transition: transform 0.2s;
}
.cip-chevron.rotated { transform: rotate(-180deg); }
.cip-section-body { padding: 0 14px 14px; }

/* Members */
.cip-member-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0;
}
.cip-member-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.cip-member-name { font-size: 13px; color: var(--text); }

/* Media grid */
.cip-tabs {
  display: flex; gap: 6px; margin-bottom: 10px;
}
.cip-tab {
  flex: 1; padding: 7px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-raised); color: var(--text-muted);
  font-size: 12px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.cip-tab.active {
  background: rgba(59,130,246,0.12); color: var(--primary);
  border-color: rgba(59,130,246,0.35);
}
.cip-media-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px;
  border-radius: 8px; overflow: hidden;
}
.cip-media-thumb {
  aspect-ratio: 1; background: var(--surface-raised) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; overflow: hidden; cursor: pointer;
  transition: opacity var(--transition);
}
.cip-media-thumb:hover { opacity: 0.85; }
.cip-media-video {
  background: var(--surface-raised);
  color: var(--text-muted); font-size: 20px;
}

/* Files list */
.cip-files-list { display: flex; flex-direction: column; gap: 4px; }
.cip-file-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px;
  background: var(--surface-raised); color: var(--text);
  text-decoration: none; transition: background var(--transition);
}
.cip-file-row:hover { background: var(--surface-active); }
.cip-file-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.cip-file-info { flex: 1; min-width: 0; }
.cip-file-name {
  display: block; font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cip-file-ext { font-size: 10px; color: var(--text-muted); font-weight: 600; }
.cip-file-dl { color: var(--text-muted); font-size: 13px; flex-shrink: 0; }

.cip-spinner { text-align: center; padding: 20px; color: var(--text-muted); font-size: 20px; }
.cip-empty   { text-align: center; padding: 20px 0; color: var(--text-muted); font-size: 13px; }

/* Active state for btn-chat-info */
#btn-chat-info.active { color: var(--primary); }

/* Markdown body in event description */
.md-body p { margin: 0 0 6px; }
.md-body p:last-child { margin-bottom: 0; }
.md-body ul, .md-body ol { padding-left: 18px; margin: 4px 0 8px; }
.md-body li { font-size: inherit; }
.md-body code { background: rgba(99,102,241,0.12); border-radius: 4px; padding: 1px 5px; font-size: 0.92em; font-family: monospace; }
.md-body strong { color: var(--text); font-weight: 700; }
.md-body em { font-style: italic; }
.md-body h1,.md-body h2,.md-body h3 { font-size: 14px; font-weight: 700; margin: 4px 0; }

/* Mobile: full-width bottom-sheet style */
@media (max-width: 640px) {
  #chat-info-panel { align-items: flex-end; justify-content: stretch; }
  .cip-drawer {
    width: 100%; height: 88dvh; border-left: none;
    border-top-left-radius: 18px; border-top-right-radius: 18px;
    border-top: 1px solid var(--border);
    animation: cipSlideUp 0.28s var(--ease) both;
  }
  .cip-drawer-handle { display: block; }
  @keyframes cipSlideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  .cip-media-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Wide desktop: side-by-side with chat */
@media (min-width: 960px) {
  #chat-info-panel { position: absolute; }
  .cip-backdrop { background: transparent; }
  .cip-drawer {
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 24px rgba(0,0,0,0.18);
    animation: cipSlideIn 0.22s var(--ease) both;
  }
}

