/* ═══════════════════════════════════════════════════════════════════════════
   StudijaAI – Stylesheet
   ═══════════════════════════════════════════════════════════════════════════ */

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

/* Osiguraj da [hidden] uvijek sakriva element bez obzira na display klase */
[hidden] { display: none !important; }

:root {
  --bg: #f7f5f0;
  --bg-card: #ffffff;
  --bg-warm: #f0ece4;
  --ink: #1a1a2e;
  --ink-light: #4a4a5e;
  --ink-muted: #8a8a9e;
  --text: #1a1a2e;
  --text-muted: #8a8a9e;
  --accent: #e85d3a;
  --accent-hover: #d14e2e;
  --accent-light: rgba(232, 93, 58, 0.08);
  --accent-glow: rgba(232, 93, 58, 0.15);
  --blue: #4a90d9;
  --blue-light: rgba(74, 144, 217, 0.1);
  --green: #3aae6f;
  --green-light: rgba(58, 174, 111, 0.1);
  --red-bg: #fef2f0;
  --red-border: #f5c6bc;
  --red-text: #b33a1f;
  --border: #e0ddd6;
  --shadow-sm: 0 1px 3px rgba(26, 26, 46, 0.06);
  --shadow-md: 0 4px 16px rgba(26, 26, 46, 0.08);
  --shadow-lg: 0 8px 32px rgba(26, 26, 46, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --transition: 0.2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%231a1a2e' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(247, 245, 240, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

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

.logo-icon {
  width: 34px;
  height: 34px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 2px 8px rgba(232, 93, 58, 0.3);
}

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

.logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.logo-text span { color: var(--accent); }

.nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.nav-link:hover { color: var(--ink); background: var(--bg-warm); }
.nav-link.active { color: var(--accent); background: var(--accent-light); }

.main {
  position: relative;
  z-index: 1;
  flex: 1;
  max-width: min(1440px, calc(100vw - 32px));
  width: 100%;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.main-container {
  min-height: calc(100vh - 180px);
  display: grid;
  place-items: center;
}

.main-card h1 {
  background: linear-gradient(90deg, #4f46e5, #06b6d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.page-intro {
  margin-bottom: 24px;
}

.page-intro__eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.upload-section { animation: fadeInUp 0.5s ease; }

.upload-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 6px;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.upload-subtitle {
  text-align: center;
  color: var(--ink-light);
  font-size: 1rem;
  margin-bottom: 18px;
  max-width: 62ch;
  margin-left: auto;
  margin-right: auto;
}

.hierarchy-path {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.hierarchy-path__item {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-light);
}

.hierarchy-path__item--current {
  color: var(--accent);
}

.hierarchy-path__divider {
  color: var(--ink-muted);
  font-size: 0.82rem;
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.upload-meta {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.upload-meta__header {
  margin-bottom: 18px;
}

.upload-meta__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.upload-meta__text {
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.field-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-grid--two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-field--full { grid-column: 1 / -1; }

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.form-label--primary {
  font-size: 0.92rem;
  color: var(--accent);
}

.form-label__optional {
  color: var(--ink-muted);
  font-weight: 500;
}

.form-input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.92rem;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  background: white;
}

.form-input--primary {
  font-size: 0.98rem;
  border-color: rgba(232, 93, 58, 0.25);
}

.form-help {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.form-help--muted {
  opacity: 0.7;
}

/* Scope toggle */
.scope-toggle {
  display: flex;
  gap: 8px;
}

.scope-toggle__option {
  flex: 1;
  cursor: pointer;
}

.scope-toggle__option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.scope-toggle__label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-muted);
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.scope-toggle__option input[type="radio"]:checked + .scope-toggle__label {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  color: var(--primary);
}

.scope-toggle__option:hover .scope-toggle__label {
  border-color: var(--primary);
  color: var(--ink);
}

.materials-hierarchy {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), #fff);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}

.materials-hierarchy__title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--ink);
}

.materials-hierarchy__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.materials-hierarchy__item {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.materials-hierarchy__label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.materials-hierarchy__value {
  display: block;
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.4;
  word-break: break-word;
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 56px 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--bg-card);
  position: relative;
  overflow: hidden;
}

.drop-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-light), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.drop-zone:hover::before, .drop-zone.drag-over::before { opacity: 1; }

.drop-zone-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: var(--accent-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  transition: transform 0.3s ease;
  position: relative;
  z-index: 1;
}

.drop-zone:hover .drop-zone-icon { transform: translateY(-3px); }
.drop-zone-icon svg { width: 26px; height: 26px; }

.drop-zone-text {
  font-size: 1rem;
  color: var(--ink);
  font-weight: 500;
  position: relative;
  z-index: 1;
}

.drop-zone-text em {
  color: var(--accent);
  font-style: normal;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(232, 93, 58, 0.3);
  text-underline-offset: 3px;
}

.drop-zone-hint {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-top: 8px;
  position: relative;
  z-index: 1;
}

.drop-zone-preview {
  display: block;
  max-width: 180px;
  max-height: 140px;
  margin: 0 auto 12px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  border: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

.drop-zone.has-image .drop-zone-icon { display: none; }
.drop-zone.drag-over { background: var(--accent-light); }

.file-input { display: none; }

.api-key-field {
  margin-top: 4px;
  padding: 20px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  animation: fadeInUp 0.4s ease;
}

.api-key-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}

.api-key-input {
  font-family: var(--font-body);
  font-size: 0.88rem;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  width: 100%;
  transition: border-color var(--transition);
  outline: none;
}

.api-key-input:focus { border-color: var(--accent); }
.api-key-input::placeholder { color: var(--ink-muted); }

.api-key-hint {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.api-key-hint code {
  background: var(--bg-warm);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.76rem;
}

.file-bar {
  display: none;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-top: 20px;
  animation: fadeInUp 0.3s ease;
}

.file-bar.visible { display: flex; }

.mobile-upload-toast {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #86efac;
  background: #f0fdf4;
  color: #166534;
  font-size: 0.82rem;
  font-weight: 700;
  animation: fadeInUp 0.2s ease;
}

.file-bar-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #e85d3a, #d14e2e);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.file-bar-icon svg { width: 20px; height: 20px; }
.file-bar-info { flex: 1; min-width: 0; }

.file-bar-name {
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-bar-size { font-size: 0.78rem; color: var(--ink-muted); }

.file-bar-remove {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.file-bar-remove:hover { background: rgba(232, 93, 58, 0.1); color: var(--accent); }
.file-bar-remove svg { width: 18px; height: 18px; }

.error-box {
  display: none;
  align-items: flex-start;
  gap: 10px;
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 0.88rem;
  color: var(--red-text);
  animation: shake 0.35s ease;
}

.error-box.visible { display: flex; }
.error-box svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.generate-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 24px;
  padding: 16px 32px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(232, 93, 58, 0.25);
  letter-spacing: 0.01em;
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(232, 93, 58, 0.35);
}

.generate-btn:active:not(:disabled) { transform: scale(0.98); }

.generate-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--ink);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.action-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }
.action-btn:active { transform: scale(0.98); }

.action-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.action-btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: white;
}

.action-btn.danger:hover {
  border-color: var(--red-text);
  color: var(--red-text);
  background: var(--red-bg);
}

/* ── Processing Overlay (glassmorphism) ─────────────────────────────── */

.proc-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(26, 26, 46, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  align-items: center;
  justify-content: center;
}
.proc-overlay.visible { display: flex; }

.proc-card {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 24px;
  padding: 48px 40px 36px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(255,255,255,0.15) inset;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* AI ring ───────────────────────────────────────────────────────────── */

.proc-ring {
  position: relative;
  width: 120px;
  height: 120px;
}
.proc-ring__svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.proc-ring__track {
  fill: none;
  stroke: var(--border);
  stroke-width: 5;
}
.proc-ring__fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s ease-in-out, stroke 0.4s ease;
}
.proc-ring__icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

/* Pulse animation keyed on ring speed class */
.ring--slow .proc-ring__svg { animation: ringPulse 2.4s ease-in-out infinite; }
.ring--fast .proc-ring__svg { animation: ringPulse 1s ease-in-out infinite; }
.ring--fast .proc-ring__fill { stroke: var(--blue); }
.ring--fast .proc-ring__icon { color: var(--blue); }
.ring--done .proc-ring__svg { animation: none; }
.ring--done .proc-ring__fill { stroke: var(--green); }
.ring--done .proc-ring__icon { color: var(--green); }
.ring--error .proc-ring__svg { animation: none; }
.ring--error .proc-ring__fill { stroke: var(--accent); stroke-dashoffset: 339.292 !important; }
.ring--error .proc-ring__icon { color: var(--accent); }

@keyframes ringPulse {
  0%, 100% { transform: rotate(-90deg) scale(1); opacity: 1; }
  50%      { transform: rotate(-90deg) scale(1.06); opacity: 0.85; }
}

/* Progress bar ──────────────────────────────────────────────────────── */

.proc-progress {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}
.proc-progress__bar {
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.5s ease-in-out, background 0.4s ease;
}
.proc-progress__bar--done { background: var(--green); }

/* Status text with fade */
.proc-status {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  transition: opacity 0.2s ease;
  min-height: 1.4em;
}
.proc-hint {
  font-size: 0.78rem;
  color: var(--ink-muted);
  transition: opacity 0.2s ease;
}

/* Error state */
.proc-overlay--error .proc-card {
  border-color: rgba(232, 93, 58, 0.25);
  box-shadow: 0 8px 40px rgba(232, 93, 58, 0.1), 0 0 0 1px rgba(232,93,58,0.12) inset;
}
.proc-retry {
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease;
}
.proc-retry:hover { background: var(--accent-hover); }

/* Legacy compat: keep .loading-overlay rule for other pages using it */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(247, 245, 240, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 28px;
}
.loading-overlay.visible { display: flex; }

.spinner {
  width: 52px;
  height: 52px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loading-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  transition: opacity 0.3s ease;
}
.loading-hint { font-size: 0.85rem; color: var(--ink-muted); }

/* ═══════════════════════════════════════════════════════════════════════
   Drop Hero — Split upload zone (file + QR)
   ═══════════════════════════════════════════════════════════════════════ */

.drop-hero {
  position: relative;
  border: 2px dashed #e5e7eb;
  border-radius: 24px;
  background: var(--bg-card);
  cursor: pointer;
  padding: 48px 16px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  overflow: hidden;
}
.drop-hero:hover,
.drop-hero:focus-visible {
  border-color: #e5b9a8;
  background: #faf6f4;
}
.drop-hero--drag {
  border-color: #e5b9a8 !important;
  background: #f3e8e2 !important;
  box-shadow: 0 0 0 6px rgba(229,185,168,0.15) !important;
}
.drop-hero--has-file {
  border-style: solid;
  border-color: var(--green);
  background: var(--green-light);
}

/* Pulsating ring around dropzone during processing */
.drop-hero__pulse {
  position: absolute;
  inset: -4px;
  border-radius: 28px;
  pointer-events: none;
  transition: box-shadow 0.4s ease;
}
.drop-ring--active {
  animation: pulseRingBrand 2s infinite;
}
@keyframes pulseRingBrand {
  0%   { box-shadow: 0 0 0 0 rgba(229,185,168,0.7); }
  70%  { box-shadow: 0 0 0 12px rgba(229,185,168,0); }
  100% { box-shadow: 0 0 0 0 rgba(229,185,168,0); }
}

/* Icon box hover lift */
.drop-hero__icon-box {
  transition: transform 0.3s ease;
}
.drop-hero:hover .drop-hero__icon-box { transform: scale(1.1); }
.drop-hero__qr-box {
  transition: transform 0.3s ease;
}
.drop-hero:hover .drop-hero__qr-box { transform: scale(1.05); }

.pulse-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pulse-ring::before,
.pulse-ring::after {
  content: "";
  position: absolute;
  inset: -10px;
  border: 2px solid rgba(79, 70, 229, 0.3);
  border-radius: 20px;
  animation: pulseRing 2.4s infinite;
}

.pulse-ring::after {
  animation-delay: 1.2s;
}

@keyframes pulseRing {
  0% {
    transform: scale(0.95);
    opacity: 0.7;
  }
  70% {
    transform: scale(1.08);
    opacity: 0;
  }
  100% {
    transform: scale(1.1);
    opacity: 0;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   Scope Cards v2 — Horizontal with icon + text
   ═══════════════════════════════════════════════════════════════════════ */

.scope-card-v2 {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border: 2px solid #f3f4f6;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
}
.scope-card-v2:hover {
  border-color: #d1d5db;
  box-shadow: var(--shadow-sm);
}
.scope-card-v2--active {
  border-color: #e5b9a8 !important;
  box-shadow: 0 0 0 1px #e5b9a8, var(--shadow-sm) !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   Generate Button v2 — Pill, brand color, full-width-mobile
   ═══════════════════════════════════════════════════════════════════════ */

.gen-btn-v2 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 16px 48px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  background: #e5b9a8;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(229,185,168,0.3);
  transition: all 0.3s ease;
}
.gen-btn-v2:hover:not(:disabled) {
  background: #c99a89;
  box-shadow: 0 12px 32px rgba(229,185,168,0.4);
  transform: translateY(-1px);
}
.gen-btn-v2:disabled,
.gen-btn-v2--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════════════
   Smart Settings — shared form inputs
   ═══════════════════════════════════════════════════════════════════════ */

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ss-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ss-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.ss-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.settings-details__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
}

.settings-details__summary::-webkit-details-marker {
  display: none;
}

.settings-details__hint {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.result-area {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  animation: resultFadeSlide 0.45s ease;
}

.result-area__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.result-area__content {
  font-size: 0.92rem;
  color: var(--ink-light);
}

.result-area__content ul {
  margin: 8px 0 12px 18px;
}

.drop-hero:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.35);
  outline-offset: 3px;
}

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

.results-section { animation: fadeInUp 0.5s ease; }
.results-section.visible { display: block; }

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

.results-header__content { flex: 1; min-width: 0; }

.results-title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

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

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.results-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  max-width: 100%;
}

.result-header-toast {
  margin-top: 8px;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #86efac;
  background: #f0fdf4;
  color: #166534;
  font-size: 0.78rem;
  font-weight: 700;
}

.result-header-toast--error {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #b91c1c;
}

.export-pdf-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.export-pdf-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(2px);
}

.export-pdf-modal__card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(2, 6, 23, 0.2);
  padding: 18px 16px;
}

.export-pdf-modal__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.export-pdf-modal__text {
  margin: 8px 0 14px;
  color: var(--ink-muted);
  font-size: 0.86rem;
}

.export-pdf-modal__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.export-pdf-modal__actions .action-btn {
  flex: 1 1 46%;
  justify-content: center;
}

.export-pdf-modal__close {
  margin-top: 10px;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.results-actions--export { align-items: flex-start; }

.results-export {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.results-export__label {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}

.results-export__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
}

.results-export__btn { text-decoration: none; }

.results-export__btn--primary { min-width: 92px; }

/* ── Regeneracija ──────────────────────────────────────────────────────────── */

.regen-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.regen-details { }

.regen-summary {
  padding: 12px 18px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-light);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
  -webkit-user-select: none;
  user-select: none;
}

.regen-summary::-webkit-details-marker { display: none; }

.regen-summary:hover {
  background: var(--bg-warm);
  color: var(--ink);
}

.regen-details[open] .regen-summary {
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  color: var(--accent);
}

.regen-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 18px;
}

.regen-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-muted);
}

/* ── Info tooltip ──────────────────────────────────────────── */
.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  font-size: 0.75rem;
  font-style: normal;
  color: var(--ink-muted);
  cursor: help;
  position: relative;
  vertical-align: middle;
  margin-left: 3px;
  opacity: 0.6;
  transition: opacity .15s;
}
.info-tip:hover { opacity: 1; }
.info-tip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: pre;
  background: #1a1a1a;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 999;
  min-width: 220px;
  text-align: left;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.info-tip:hover::after { opacity: 1; }

.regen-field select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font-size: 0.88rem;
  min-width: 140px;
}

.regen-status {
  padding: 0 18px 14px;
  font-size: 0.85rem;
  color: var(--ink-muted);
  min-height: 1.4em;
}

.results-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}

.results-summary {
  color: var(--ink-light);
  font-size: 0.92rem;
}

/* Lesson picker (multi-lesson material) */
.lesson-picker {
  margin-bottom: 20px;
}

.lesson-picker__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.lesson-picker__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lesson-picker__btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--theme-text-secondary, #374151);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.lesson-picker__btn.active,
.lesson-picker__btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.lesson-picker__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-warm);
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.lesson-picker__btn.active .lesson-picker__num {
  background: var(--primary);
  color: #fff;
}

.tab-nav {
  display: flex;
  gap: 4px;
  background: var(--bg-warm);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 28px;
}

.tab-btn {
  flex: 1;
  padding: 12px 20px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.tab-btn.active {
  background: var(--bg-card);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.tab-btn:hover:not(.active) { color: var(--ink-light); }

.tab-due-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.tab-count {
  font-size: 0.72rem;
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 700;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s ease;
  animation: fadeInUp 0.4s ease both;
}

.section-card--notes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

.section-card:hover { box-shadow: var(--shadow-md); }

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.section-card__main {
  min-width: 0;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-tag {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--blue-light);
  color: var(--blue);
}

.section-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.section-list li {
  position: relative;
  padding-left: 20px;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--ink-light);
}

.section-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}

.section-list li b { color: var(--ink); font-weight: 600; }

.qa-controls { display: flex; gap: 8px; margin-bottom: 20px; }

.qa-ctrl-btn {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--ink-light);
  cursor: pointer;
  transition: all var(--transition);
}

.qa-ctrl-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }

.qa-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s ease;
  animation: fadeInUp 0.4s ease both;
}

.qa-item:hover { box-shadow: var(--shadow-md); }

.qa-question {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 22px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: background 0.2s ease;
}

.qa-question:hover { background: rgba(0,0,0,0.015); }

.qa-num {
  width: 30px;
  height: 30px;
  background: var(--accent);
  color: white;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.qa-q-text {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.5;
}

.qa-chevron {
  width: 20px;
  height: 20px;
  color: var(--ink-muted);
  flex-shrink: 0;
  margin-top: 3px;
  transition: transform 0.3s ease;
}

.qa-item.open .qa-chevron { transform: rotate(180deg); }

.qa-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.qa-item.open .qa-answer { max-height: 600px; }

.qa-answer-inner {
  padding: 0 22px 12px 66px;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--ink-light);
}

.review-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 22px 20px 66px;
}

.section-chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #fcfbf7, #fff);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.section-chat__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-chat__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.section-chat__title {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink);
  margin-top: 2px;
}

.section-chat__status {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--blue);
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--blue-light);
  white-space: nowrap;
}

.section-chat__messages {
  min-height: 140px;
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.section-chat__empty {
  color: var(--ink-muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.section-chat__message {
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.86rem;
  line-height: 1.55;
  word-break: break-word;
  max-width: 100%;
}

.section-chat__message--user {
  align-self: flex-end;
  background: var(--accent-light);
  color: var(--ink);
  border: 1px solid rgba(232, 93, 58, 0.16);
}

.section-chat__message--assistant {
  align-self: flex-start;
  background: #fff;
  color: var(--ink-light);
  border: 1px solid var(--border);
}

.section-chat__form {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.section-chat__input {
  flex: 1;
  min-width: 0;
  padding: 11px 12px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  color: var(--ink);
  font: inherit;
  outline: none;
}

.section-chat__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.section-chat__send {
  flex-shrink: 0;
}

.tutor-chat {
  margin-top: 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #fbfbfd);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  font-family: "Inter", var(--font-body), sans-serif;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.28s ease, transform 0.28s ease;
  --keyboard-offset: 0px;
}

.tutor-chat--hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.tutor-chat--visible {
  opacity: 1;
  transform: translateY(0);
}

.tutor-chat__header {
  margin-bottom: 10px;
}

.tutor-chat__title {
  font-size: 1rem;
  font-weight: 800;
  margin: 0;
}

.tutor-chat__subtitle {
  margin: 2px 0 0;
  color: var(--ink-muted);
  font-size: 0.82rem;
}

.tutor-chat__history {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  scroll-behavior: smooth;
}

.tutor-chat__message {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.tutor-chat__rich p {
  margin: 0 0 8px;
}

.tutor-chat__rich p:last-child {
  margin-bottom: 0;
}

.tutor-chat__rich h4 {
  margin: 2px 0 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1f2937;
}

.tutor-chat__rich ul {
  margin: 0 0 8px;
  padding-left: 18px;
}

.tutor-chat__rich ol {
  margin: 0 0 8px;
  padding-left: 20px;
}

.tutor-chat__rich li {
  margin: 0 0 4px;
}

.tutor-chat__rich strong {
  font-weight: 700;
}

.tutor-chat__message--assistant {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--ink);
}

.tutor-chat__message--user {
  align-self: flex-end;
  background: var(--accent-light);
  border: 1px solid rgba(232, 93, 58, 0.2);
}
.tutor-chat__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.tutor-chat__model-badge {
  display: inline-block;
  font-size: 0.7rem;
  line-height: 1.2;
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  padding: 4px 8px;
  white-space: nowrap;
}

.tutor-chat__actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tutor-chat__quick {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink-light);
  font-size: 0.8rem;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
}

.tutor-chat__quick:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tutor-chat__form {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  position: sticky;
  bottom: 0;
  padding-top: 8px;
  z-index: 2;
  background: linear-gradient(180deg, rgba(251, 251, 253, 0), #fbfbfd 35%);
}

.tutor-chat__input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
}

.tutor-chat__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.tutor-chat__send {
  flex-shrink: 0;
}

.tutor-chat__error {
  margin: 7px 2px 0;
  color: #b91c1c;
  font-size: 0.78rem;
}

.tutor-chat__typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
}

.tutor-chat__typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #94a3b8;
  animation: tutorTyping 1s infinite ease-in-out;
}

.tutor-chat__typing span:nth-child(2) {
  animation-delay: 0.16s;
}

.tutor-chat__typing span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes tutorTyping {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

.highlight-ask-fab {
  position: fixed;
  z-index: 1200;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(79, 70, 229, 0.25);
  background: linear-gradient(90deg, #4f46e5, #06b6d4);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 7px 12px;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.25);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.highlight-ask-fab :is(i[data-lucide], svg.lucide) {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: #fff;
}

.highlight-ask-fab:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.32);
}

.highlight-ask-fab:active {
  transform: translateY(0);
}

#extracted-content ::selection {
  background: rgba(79, 70, 229, 0.2);
  color: inherit;
}

.action-btn.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

.flashcards-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.flashcard {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 240px;
}

.flashcard__side {
  flex: 1;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: var(--bg);
}

.flashcard__side--back {
  display: none;
  background: var(--bg-warm);
}

.flashcard.is-flipped .flashcard__side--front {
  display: none;
}

.flashcard.is-flipped .flashcard__side--back {
  display: block;
}

.flashcard__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 10px;
  font-weight: 700;
}

.flashcard__text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink);
}

.flashcard__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Plava točka uz broj — .v2-fc-bullet (JS postavlja !important; ovdje rezerva) */
.results-section [data-fc-number-wrap] {
  display: inline-flex;
  align-items: center;
  flex-direction: row;
}

.results-section .v2-fc-bullet {
  display: inline-block;
  width: 10px;
  height: 10px;
  min-width: 10px;
  min-height: 10px;
  box-sizing: border-box;
  border-radius: 50%;
  background-color: #3b82f6;
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

.quiz-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quiz-panel__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.quiz-panel__progress,
.quiz-panel__score {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 999px;
}

.quiz-panel__type {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 6px 10px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.quiz-panel__question {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-bottom: 14px;
}

.quiz-panel__options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.quiz-option:hover {
  border-color: var(--blue);
  background: var(--blue-light);
}

.quiz-option input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.quiz-option span {
  color: var(--ink);
  line-height: 1.5;
}

/* Quiz option states after answer */
.quiz-option--correct {
  border-color: #22c55e;
  background: #f0fdf4;
}
.quiz-option--correct span { color: #15803d; font-weight: 600; }
.quiz-option--wrong {
  border-color: #ef4444;
  background: #fef2f2;
}
.quiz-option--wrong span { color: #b91c1c; font-weight: 600; }
.quiz-option input:disabled { opacity: 0.6; }

/* Quiz feedback block */
.quiz-panel__feedback {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
  background: var(--bg-warm);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.quiz-feedback__verdict {
  font-weight: 700;
  font-size: 1rem;
}
.quiz-feedback__verdict--correct { color: #15803d; }
.quiz-feedback__verdict--wrong { color: #b91c1c; }
.quiz-feedback__answer {
  font-size: 0.9rem;
  color: var(--ink);
}
.quiz-feedback__explanation {
  font-size: 0.88rem;
  color: var(--ink-muted);
  font-style: italic;
}

.quiz-panel__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quiz-panel__note {
  margin-top: 12px;
  font-size: 0.84rem;
  color: var(--ink-muted);
}

/* Quiz summary screen */
.quiz-summary {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 32px 0;
}
.quiz-summary__header {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow-sm);
}
.quiz-summary__score-circle {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: conic-gradient(var(--quiz-colour, #22c55e) calc(var(--quiz-pct, 0) * 1%), #e5e7eb 0%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.quiz-summary__score-circle__inner {
  position: absolute;
  inset: 10px;
  background: var(--card-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
}
.quiz-summary__score-text {
  font-size: 1.1rem;
  color: var(--ink);
}
.quiz-summary__score-text strong {
  display: block;
  font-size: 2rem;
  font-family: var(--font-display);
  color: var(--ink);
}

.quiz-summary__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quiz-summary__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card-bg);
}
.quiz-summary__item--correct { border-color: #86efac; background: #f0fdf4; }
.quiz-summary__item--wrong   { border-color: #fca5a5; background: #fef2f2; }
.quiz-summary__badge {
  font-weight: 800;
  font-size: 1rem;
  width: 22px;
  flex-shrink: 0;
  text-align: center;
}
.quiz-summary__item--correct .quiz-summary__badge { color: #15803d; }
.quiz-summary__item--wrong   .quiz-summary__badge { color: #b91c1c; }
.quiz-summary__num {
  font-weight: 700;
  color: var(--ink-muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}
.quiz-summary__q {
  font-size: 0.9rem;
  color: var(--ink);
  line-height: 1.4;
}
.quiz-summary__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.quiz-summary__explanation {
  font-size: 0.83rem;
  color: var(--ink-muted);
  font-style: italic;
  line-height: 1.5;
  margin: 0;
}
.quiz-summary__actions {
  display: flex;
  justify-content: center;
}

/* Quiz attempt history (on result page) */
.quiz-history {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}
.quiz-history__title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.quiz-history__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quiz-history__item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
}
.quiz-history__date {
  color: var(--ink-muted);
  min-width: 120px;
  flex-shrink: 0;
}
.quiz-history__score {
  font-weight: 700;
  color: var(--ink);
  min-width: 42px;
  flex-shrink: 0;
}
.quiz-history__bar-wrap {
  flex: 1;
  height: 8px;
  background: #e5e7eb;
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}
.quiz-history__bar {
  position: absolute;
  inset: 0;
  width: 0%;
  border-radius: 99px;
  transition: width 0.4s ease;
}
.quiz-history__bar--good { background: #22c55e; }
.quiz-history__bar--mid  { background: #f59e0b; }
.quiz-history__bar--bad  { background: #ef4444; }

.quiz-history__pct {
  font-weight: 700;
  font-size: 0.82rem;
  min-width: 38px;
  text-align: right;
  flex-shrink: 0;
}
.quiz-history__pct--good { color: #15803d; }
.quiz-history__pct--mid  { color: #b45309; }
.quiz-history__pct--bad  { color: #b91c1c; }

.history-section { animation: fadeInUp 0.5s ease; }

/* Admin quiz results page */
.quiz-results__link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.quiz-results__link:hover { text-decoration: underline; }
.quiz-results__score {
  font-weight: 700;
  color: var(--ink);
}
.quiz-results__bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.quiz-results__bar-track {
  flex: 1;
  height: 8px;
  background: #e5e7eb;
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}
.quiz-results__bar {
  position: absolute;
  inset: 0;
  width: 0%;
  border-radius: 99px;
  transition: width 0.4s ease;
}
.quiz-results__bar--good { background: #22c55e; }
.quiz-results__bar--mid  { background: #f59e0b; }
.quiz-results__bar--bad  { background: #ef4444; }
/* legacy: keep for any old references */
.quiz-results__bar::after {
  content: none;
  width: 0;
  background: transparent;
  border-radius: 99px;
}
.quiz-results__pct {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-muted);
  min-width: 34px;
}

/* Quiz detail dialog */
.quiz-detail-dialog {
  max-width: 680px;
  margin: 0;
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
}
.quiz-inline-card {
  grid-column: 1 / -1;
  scroll-margin-top: 88px;
  margin-top: 16px;
}
.quiz-inline-card__header {
  margin-bottom: 10px;
}
.quiz-detail-dialog[open] .admin-dialog__form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  max-height: 90vh;
}
.quiz-detail-header {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}
.quiz-detail-header__student {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
}
.quiz-detail-header__naslov {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-muted);
  line-height: 1.3;
}
.quiz-detail-header__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
.quiz-detail-header__date {
  font-size: 0.8rem;
  color: var(--ink-muted);
  font-weight: 400;
}
.quiz-detail-score {
  font-size: 0.88rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 99px;
}
.quiz-detail-score--good { background: #dcfce7; color: #15803d; }
.quiz-detail-score--mid  { background: #fef9c3; color: #92400e; }
.quiz-detail-score--bad  { background: #fee2e2; color: #b91c1c; }
.quiz-detail-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  overflow-y: auto;
  overflow-x: visible;
  max-height: calc(90vh - 170px);
  padding: 20px 24px 28px;
}
.quiz-detail-list--inline {
  overflow: visible;
  max-height: none;
  padding: 4px 0 0;
}
.quiz-detail-item {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.quiz-detail-item--correct { border-color: #86efac; }
.quiz-detail-item--wrong   { border-color: #fca5a5; }
.quiz-detail-item__head {
  display: grid;
  grid-template-columns: 22px 18px minmax(0, 1fr);
  align-items: start;
  column-gap: 10px;
  row-gap: 0;
  padding: 14px 16px;
  background: transparent;
  min-height: 0;
}
.quiz-detail-item--correct .quiz-detail-item__head {
  background: #f0fdf4;
}
.quiz-detail-item--wrong   .quiz-detail-item__head {
  background: #fef2f2;
}
.quiz-detail-item__num { font-size: 0.82rem; color: var(--ink-muted); font-weight: 700; white-space: nowrap; line-height: 1.4; min-width: 22px; }
.quiz-detail-item__verdict { font-weight: 800; font-size: 1rem; white-space: nowrap; line-height: 1.4; min-width: 18px; }
.quiz-detail-item--correct .quiz-detail-item__verdict { color: #15803d; }
.quiz-detail-item--wrong   .quiz-detail-item__verdict { color: #b91c1c; }
.quiz-detail-item__q {
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.5;
  min-width: 0;
  width: 100%;
  overflow: visible;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  display: block;
  grid-column: 3;
}
.quiz-detail-item__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 16px;
  border-top: 1px solid #fca5a5;
  background: #fff;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.quiz-detail-item__row { display: flex; gap: 8px; font-size: 0.88rem; align-items: baseline; }
.quiz-detail-item__label { font-weight: 700; color: var(--ink-muted); flex-shrink: 0; }
.quiz-detail-item__val { color: var(--ink); }
.quiz-detail-item__val--wrong  { color: #b91c1c; }
.quiz-detail-item__val--correct { color: #15803d; font-weight: 600; }
.quiz-detail-item__explanation {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--ink-muted);
  font-style: italic;
  line-height: 1.55;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
}

.history-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.history-subtitle {
  color: var(--ink-muted);
  font-size: 0.95rem;
  margin-top: 4px;
  max-width: 64ch;
}

/* History groups */
.history-group {
  margin-bottom: 12px;
}

.history-group__header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  padding: 12px 16px;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.history-group--school > .history-group__header {
  background: var(--bg-warm);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  margin-bottom: 2px;
}

.history-group--grade > .history-group__header {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-left: 16px;
}

.history-group--subject > .history-group__header {
  background: transparent;
  padding: 8px 12px;
  margin-left: 32px;
}

.history-group__header:hover {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

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

.history-group__icon svg { width: 16px; height: 16px; }

.history-group__icon--school {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.history-group__icon--grade {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  width: 26px;
  height: 26px;
}

.history-group__icon--subject {
  background: var(--bg-warm);
  color: var(--ink-muted);
  width: 22px;
  height: 22px;
}

.history-group__title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  flex: 1;
}

.history-group--school > .history-group__header .history-group__title {
  font-size: 1.05rem;
  font-family: var(--font-display);
}

.history-group--subject > .history-group__header .history-group__title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-light);
}

.history-group__count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-muted);
  background: var(--bg-warm);
  padding: 2px 8px;
  border-radius: 20px;
}

.history-group__chevron {
  width: 16px;
  height: 16px;
  color: var(--ink-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.history-group__body {
  overflow: hidden;
  transition: max-height 0.25s ease;
}

/* Collapsed state — JS adds/removes group--open */
.history-group:not(.group--open) .history-group__body {
  display: none;
}

.history-group:not(.group--open) .history-group__chevron {
  transform: rotate(-90deg);
}

/* All open by default — JS initialises as open */
.history-group .history-group__body {
  padding-top: 6px;
}

.history-group--school > .history-group__body {
  padding-left: 0;
}

.history-group--grade > .history-group__body {
  padding-left: 16px;
}

.history-group--subject > .history-group__body {
  padding-left: 32px;
}

/* Batch selekcija */
.batch-toolbar {
  position: sticky;
  top: 12px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
  margin-bottom: 20px;
  animation: fadeInUp 0.2s ease;
}

.batch-toolbar__count {
  font-size: 0.875rem;
  font-weight: 700;
  white-space: nowrap;
}

.batch-toolbar__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.history-group__header-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-group__header-row .history-group__header--subject {
  flex: 1;
}

.batch-select-all {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-muted);
  white-space: nowrap;
  transition: background 0.15s;
}

.batch-select-all:hover {
  background: var(--bg-warm);
  color: var(--ink);
}

.batch-select-all input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--accent);
}

.batch-select-all__label {
  pointer-events: none;
}

.history-card__checkbox {
  display: flex;
  align-items: center;
  padding: 0 4px 0 2px;
  cursor: pointer;
  flex-shrink: 0;
}

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

.history-card--selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, var(--bg-card));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}

.history-card-lesson {
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-bottom: 2px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 8px;
}

.history-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.4s ease both;
  max-width: 100%;
}

.history-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
  transform: translateX(4px);
}

.history-card__link {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.history-card-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.history-card-icon svg { width: 22px; height: 22px; }
.history-card-body { flex: 1; min-width: 0; }

.history-card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-card-hierarchy {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.history-card-hierarchy__item {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-light);
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.history-card-hierarchy__item--current {
  color: var(--accent);
  background: var(--accent-light);
  border-color: transparent;
}

.history-card-hierarchy__divider {
  color: var(--ink-muted);
  font-size: 0.76rem;
}

.history-card-meta {
  font-size: 0.78rem;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.meta-dot { opacity: 0.4; }

.history-card-arrow {
  width: 20px;
  height: 20px;
  color: var(--ink-muted);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.history-card:hover .history-card-arrow { transform: translateX(3px); color: var(--accent); }

.history-card__actions {
  margin-left: auto;
  padding-left: 8px;
  flex-shrink: 0;
  display: flex;
  gap: 6px;
  align-items: center;
}

.history-card--hidden {
  opacity: 0.45;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 6px,
    rgba(0,0,0,0.03) 6px,
    rgba(0,0,0,0.03) 12px
  );
}

.history-card--hidden .history-card-title { color: var(--ink-muted); }

.history-card-hidden-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(0,0,0,0.08);
  color: var(--ink-muted);
  border-radius: 20px;
  vertical-align: middle;
}

/* Access dialog */
.access-dialog__subtitle {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 12px;
}

.access-dialog__add-row {
  display: flex;
  gap: 8px;
}

.access-dialog__select {
  flex: 1;
}

.access-dialog__list-section {
  margin-top: 16px;
}

.access-dialog__list-label {
  margin-bottom: 8px;
}

.access-dialog__empty {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.access-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.access-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-warm);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.access-list__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.access-list__name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
}

.access-list__date {
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.access-list__revoke {
  flex-shrink: 0;
}

.history-card-scope-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  border-radius: 20px;
  vertical-align: middle;
}

.history-card-level-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 20px;
  vertical-align: middle;
}
.history-card-level-badge--easy     { background: #d1fae5; color: #065f46; }
.history-card-level-badge--standard { background: #f3f4f6; color: #6b7280; }
.history-card-level-badge--hard     { background: #fee2e2; color: #991b1b; }
.history-card-level-badge--osnovno  { background: #e5e7eb; color: #374151; }
.history-card-level-badge--srednje  { background: #dbeafe; color: #1d4ed8; }
.history-card-level-badge--napredno { background: #ede9fe; color: #5b21b6; }

.empty-state {
  text-align: center;
  padding: 64px 24px;
}

.empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  background: var(--bg-warm);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
}

.empty-icon svg { width: 32px; height: 32px; }

.empty-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.empty-text {
  color: var(--ink-muted);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px;
  font-size: 0.8rem;
  color: var(--ink-muted);
  border-top: 1px solid var(--border);
}

.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

.auth-section {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  padding: 24px 16px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-md);
  animation: fadeInUp 0.45s ease;
}

.auth-card__header {
  margin-bottom: 24px;
}

.auth-card__title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
  margin: 6px 0 8px;
}

.auth-card__subtitle {
  font-size: 0.9rem;
  color: var(--ink-light);
  line-height: 1.6;
  margin: 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 20px;
}

.auth-submit {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 1rem;
  margin-top: 4px;
}

.auth-card__footer {
  text-align: center;
  font-size: 0.84rem;
  color: var(--ink-muted);
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 4px;
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-warm);
  color: var(--ink-light);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.account-chip strong {
  color: var(--ink);
  font-weight: 700;
}

.warning-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: #fff7e8;
  border: 1px solid #f1d4a7;
  color: #8a5b12;
  box-shadow: var(--shadow-sm);
}

.warning-banner svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.warning-banner strong {
  color: #70480d;
}

.admin-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(380px, 1.25fr);
  gap: 20px;
  align-items: start;
}

.admin-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), #fff);
  border: 1px solid rgba(224, 221, 214, 0.9);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.admin-card__header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.admin-card__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0;
}

.admin-card__subtitle,
.admin-card__text {
  color: var(--ink-light);
  font-size: 0.92rem;
  line-height: 1.6;
}

.admin-card:first-child {
  min-height: 100%;
}

.admin-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
  margin: 4px 0 0;
  max-width: 14ch;
}

.admin-subtitle {
  color: var(--ink-light);
  font-size: 0.96rem;
  line-height: 1.7;
  max-width: 46ch;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.admin-stat-card {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-card), #faf8f3);
}

.admin-stat-card__label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.admin-stat-card__value {
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1;
  color: var(--ink);
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-form .form-field span {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}

.admin-form .form-field input,
.admin-form .form-field select,
.admin-form .form-field textarea {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.admin-form .form-field input:focus,
.admin-form .form-field select:focus,
.admin-form .form-field textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px var(--accent-light);
}

.admin-form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-inline {
  display: contents;
}

.admin-row-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.admin-row-actions .action-btn {
  width: 100%;
  justify-content: center;
}

.admin-akcije {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
}

.admin-akcije .action-btn,
.admin-akcije .form-inline .action-btn {
  width: 100%;
  justify-content: center;
  text-align: center;
  font-size: 0.82rem;
  padding: 6px 10px;
}

.admin-dialog {
  border: none;
  border-radius: 18px;
  padding: 0;
  box-shadow: 0 12px 48px rgba(0,0,0,0.22);
  max-width: 460px;
  width: 95vw;
  max-height: 90vh;
  overflow: hidden;
}

.admin-dialog[open] {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

.admin-dialog::backdrop {
  background: rgba(0,0,0,0.45);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.admin-dialog__form {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.admin-dialog__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  line-height: 1.4;
}

.admin-dialog__fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.admin-dialog__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-warm);
  flex-shrink: 0;
}

.pwd-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Quiz results grouped view ──────────────────────────────── */
.quiz-student-card {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.quiz-student-header {
  padding: 16px 24px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.quiz-student-actions {
  flex-shrink: 0;
}

.quiz-student-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  display: block;
}

.quiz-student-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.quiz-subject-section {
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
}

.quiz-subject-section:last-child {
  border-bottom: none;
}

.quiz-subject-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 10px;
}

.quiz-lesson-block {
  margin-bottom: 16px;
}

.quiz-lesson-block:last-child {
  margin-bottom: 0;
}

.quiz-lesson-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.quiz-lesson-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 1px 8px;
}

.quiz-lekcija-sub {
  margin: 10px 0 14px 0;
  border-left: 3px solid var(--border);
  padding-left: 12px;
}

.quiz-lekcija-sub__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.quiz-lekcija-sub__naziv {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.quiz-lekcija-sub__count {
  font-size: 0.73rem;
  color: var(--text-muted);
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 1px 7px;
}

.quiz-no-answers {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.quiz-inline-td {
  padding: 0;
}

.quiz-detail-list--nested {
  margin: 8px 0;
}

.quiz-inline-close-row {
  padding: 8px 16px;
}

.history-card-quiz-avg {
  font-weight: 600;
  font-size: 0.78rem;
  padding: 1px 6px;
  border-radius: 99px;
}
.history-card-quiz-avg--good { color: #166534; background: #dcfce7; }
.history-card-quiz-avg--mid  { color: #92400e; background: #fef3c7; }
.history-card-quiz-avg--bad  { color: #991b1b; background: #fee2e2; }

.history-card-quiz-lessons {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.history-card-quiz-lesson {
  font-weight: 600;
  font-size: 0.74rem;
  padding: 1px 5px;
  border-radius: 99px;
  opacity: 0.9;
}

/* ── Combine dialog ────────────────────────────────────────── */
.combine-dialog {
  max-width: 520px;
}

.combine-dialog__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.combine-dialog__list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--text);
}

.combine-dialog__list-num {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 20px;
}

.combine-dialog__list-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combine-dialog__list-controls {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.combine-order-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.combine-order-btn:hover:not(:disabled) {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.combine-order-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.combine-dialog__warning {
  padding: 10px 14px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  font-size: 0.8rem;
  color: #92400e;
  line-height: 1.5;
}

.combine-dialog__error {
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #b91c1c;
}

.pwd-input-row .form-input {
  flex: 1;
}

.pwd-send-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--ink-light);
  cursor: pointer;
}

#subject-rights,
#student-stats,
#recent-activity,
#user-perms {
  grid-column: 1 / -1;
}

.admin-panel .admin-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-width: 100%;
  max-height: min(70vh, 640px);
  margin-bottom: 8px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

.admin-table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  margin-bottom: 8px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #fff;
}

.admin-panel .admin-table {
  table-layout: auto;
}

.admin-table {
  width: 100%;
  min-width: 600px;
  border-collapse: separate;
  border-spacing: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
  table-layout: auto;
}

.admin-table th,
.admin-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

#user-perms .admin-table th:nth-child(1),
#user-perms .admin-table td:nth-child(1) { width: 22%; }
#user-perms .admin-table th:nth-child(2),
#user-perms .admin-table td:nth-child(2) { width: 14%; white-space: nowrap; }
#user-perms .admin-table th:nth-child(3),
#user-perms .admin-table td:nth-child(3) { width: 20%; }
#user-perms .admin-table th:nth-child(4),
#user-perms .admin-table td:nth-child(4) { width: 30%; }
#user-perms .admin-table th:nth-child(5),
#user-perms .admin-table td:nth-child(5) { width: 14%; }

.admin-panel .admin-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 var(--border);
}

.admin-table th {
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  background: #f3efe8;
}

.admin-table th:first-child {
  border-top-left-radius: 18px;
}

.admin-table th:last-child {
  border-top-right-radius: 18px;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table td {
  font-size: 0.9rem;
  color: var(--ink-light);
  background: rgba(255, 255, 255, 0.94);
}

.admin-table tbody tr:hover td {
  background: #fcfaf6;
}

.admin-table td strong {
  color: var(--ink);
  font-weight: 700;
}

.admin-user {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-user span,
.admin-user__meta span {
  color: var(--ink-muted);
  font-size: 0.82rem;
}

.admin-user__meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.table-empty {
  color: var(--ink-muted);
  text-align: center;
  padding: 20px 16px;
}
.table-empty--padded {
  padding: 32px 0;
}

.admin-card--full {
  grid-column: 1 / -1;
}

.admin-card__note {
  display: grid;
  gap: 10px;
  color: var(--ink-light);
  font-size: 0.92rem;
  line-height: 1.7;
}

.permission-list {
  display: grid;
  gap: 10px;
  margin-top: 2px;
  min-width: 180px;
  justify-items: stretch;
}

.permission-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
}

.permission-toggle span {
  font-size: 0.84rem;
  color: var(--ink-light);
  line-height: 1.4;
}

.permission-toggle__label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.permission-toggle__label strong {
  font-size: 0.92rem;
  color: var(--ink);
}

.permission-toggle__label span {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.permission-toggle input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.permission-list > .action-btn.primary {
  width: 100%;
  justify-content: center;
  display: flex;
  margin-top: 2px;
  margin-left: 0;
  grid-column: 1 / -1;
}

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

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@media (max-width: 1360px) {
  .main {
    max-width: min(100vw - 24px, 1280px);
    padding-left: 12px;
    padding-right: 12px;
  }
  .admin-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1100px) {
  .header {
    height: auto;
    padding: 12px 20px;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
  }
  .logo {
    flex-shrink: 0;
  }
  .nav {
    width: 100%;
    justify-content: flex-start;
  }
  .main {
    max-width: min(100vw - 24px, 1200px);
    padding: 32px 12px 56px;
  }
  .upload-title,
  .history-title,
  .results-title {
    word-break: break-word;
  }
  .admin-grid {
    grid-template-columns: 1fr;
  }
  .results-header,
  .history-header {
    flex-direction: column;
  }
  .results-actions,
  .results-export,
  .results-export__buttons {
    width: 100%;
  }
  .results-actions .action-btn,
  .results-export__buttons .action-btn {
    flex: 1 1 220px;
    justify-content: center;
  }
  .section-card--notes {
    grid-template-columns: 1fr;
  }
  .section-chat {
    order: 2;
  }
  .materials-hierarchy__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .tab-nav {
    flex-wrap: wrap;
  }
  .tab-btn {
    flex: 1 1 calc(50% - 4px);
  }
  .results-card,
  .section-card,
  .upload-meta,
  .auth-card,
  .admin-card {
    padding-left: 16px;
    padding-right: 16px;
  }
  .qa-answer-inner,
  .review-actions {
    padding-left: 22px;
  }
}

@media (max-width: 640px) {
  .header {
    padding: 12px 16px;
  }
  .main {
    max-width: calc(100vw - 16px);
    padding: 28px 8px 48px;
  }
  .page-intro {
    margin-bottom: 18px;
  }
  .upload-title { font-size: 1.5rem; }
  .proc-card {
    width: 94%;
    padding: 30px 20px 22px;
    border-radius: 18px;
  }
  .proc-status {
    font-size: 0.95rem;
  }
  .result-area {
    padding: 16px;
  }
  .upload-subtitle { margin-bottom: 14px; }
  .hierarchy-path {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    white-space: nowrap;
    padding-bottom: 14px;
  }
  .drop-zone { padding: 36px 20px; }
  .results-header { flex-direction: column; }
  .results-actions { width: 100%; }
  .results-export { width: 100%; }
  .results-export__buttons { width: 100%; }
  .results-export__btn { flex: 1 1 calc(50% - 4px); justify-content: center; }
  .results-title { font-size: 1.3rem; }
  .section-card { padding: 18px 20px; }
  .qa-answer-inner { padding-left: 22px; }
  .review-actions { padding-left: 22px; }
  .section-card--notes {
    grid-template-columns: 1fr;
  }
  .section-chat {
    padding: 14px;
  }
  .section-chat__messages {
    max-height: 220px;
  }
  .tab-nav { flex-wrap: wrap; }
  .tab-btn { flex: 1 1 calc(50% - 4px); }
  .flashcard { min-height: auto; }
  .quiz-panel__actions { flex-direction: column; }
  .tutor-chat {
    padding-bottom: calc(16px + var(--keyboard-offset));
  }
  .tutor-chat__history {
    max-height: 42vh;
  }
  .tutor-chat__form {
    padding-bottom: calc(4px + min(var(--keyboard-offset), 28px));
  }
  .history-header { flex-direction: column; }
  .history-card { flex-wrap: wrap; }
  .history-card__link {
    flex-wrap: wrap;
    gap: 12px;
  }
  .history-card__actions {
    margin-left: 0;
    padding-left: 0;
    width: 100%;
  }
  .field-grid--two { grid-template-columns: 1fr; }
  .auth-card { padding: 22px 18px; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-card {
    padding: 20px;
    border-radius: 18px;
  }
  .admin-title {
    max-width: none;
    font-size: 1.8rem;
  }
  .admin-stats-grid,
  .admin-form-grid {
    grid-template-columns: 1fr;
  }
  .admin-form-actions,
  .admin-inline-actions {
    flex-direction: column;
  }
  .admin-form-actions .action-btn,
  .admin-inline-actions .action-btn {
    width: 100%;
    justify-content: center;
  }
  .admin-table {
    min-width: 100%;
  }
  .admin-table,
  .admin-table thead,
  .admin-table tbody,
  .admin-table th,
  .admin-table td,
  .admin-table tr { display: block; }
  .admin-table thead { position: absolute; left: -9999px; top: -9999px; }
  .admin-table-wrap {
    overflow: visible;
    border: none;
    background: transparent;
  }
  .admin-table tr {
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: var(--shadow-sm);
  }
  .admin-table td {
    border-bottom: 1px solid var(--border);
    padding: 10px 16px;
  }
  .admin-table tr td:last-child {
    border-bottom: none;
  }
  .admin-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-muted);
    margin-bottom: 4px;
  }
  /* Admin: ostavi pravu tablicu + vodoravni scroll (ne „kartice”) */
  .admin-panel .admin-table-wrap {
    max-height: none;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 16px;
  }
  .admin-panel .admin-table {
    display: table;
    min-width: 520px;
    width: 100%;
  }
  .admin-panel .admin-table thead {
    display: table-header-group;
    position: static;
    left: auto;
    top: auto;
    width: auto;
  }
  .admin-panel .admin-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 1px 0 var(--border);
  }
  .admin-panel .admin-table tbody { display: table-row-group; }
  .admin-panel .admin-table tr {
    display: table-row;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    background: transparent;
  }
  .admin-panel .admin-table th,
  .admin-panel .admin-table td {
    display: table-cell;
    padding: 12px 14px;
  }
  .admin-panel .admin-table td::before {
    content: none;
    display: none;
  }
  .permission-toggle {
    align-items: flex-start;
    flex-direction: column;
  }
  .materials-hierarchy {
    padding: 16px;
  }
  .materials-hierarchy__grid {
    grid-template-columns: 1fr;
  }
  .materials-hierarchy__item {
    padding: 12px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .pulse-ring::before,
  .pulse-ring::after,
  .ring--slow .proc-ring__svg,
  .ring--fast .proc-ring__svg,
  .drop-ring--active {
    animation: none !important;
  }
}

/* ── Admin Postavke ────────────────────────────────────────────────────────── */

.settings-grid {
  grid-template-columns: 1fr;
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.settings-tab {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-warm);
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}

.settings-tab:hover {
  background: var(--bg-card);
  border-color: var(--accent);
}

.settings-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.warning-banner--success {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46;
  margin-top: 16px;
}

.warning-banner--error {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
  margin-top: 16px;
}

.cache-hit-banner {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
  margin-top: 12px;
}

body.dark .cache-hit-banner {
  background: #0c1a3a;
  border-color: #1e40af;
  color: #93c5fd;
}

.cost-ceiling-banner {
  background: #fefce8;
  border-color: #fde047;
  color: #854d0e;
  margin-top: 8px;
}

body.dark .cost-ceiling-banner {
  background: #1c1400;
  border-color: #854d0e;
  color: #fde047;
}

.settings-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  vertical-align: middle;
  margin-left: 6px;
}

.settings-badge--ok  { background: #d1fae5; color: #065f46; }
.settings-badge--off { background: #f3f4f6; color: #6b7280; }

.settings-model-list { margin-top: 10px; }
.dialog-hint { margin-bottom: 12px; }
.settings-model-list__label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 6px; }
.settings-model-list__items { display: flex; flex-wrap: wrap; gap: 6px; }
.settings-model-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-family: var(--font-mono, monospace);
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 2px 8px;
}

.settings-provider-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  background: var(--bg-warm);
}
.settings-provider-box__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.settings-provider-box__header strong { font-size: 0.95rem; }
#openaiTestResult { font-size: 0.85rem; min-height: 1.2em; margin: 8px 0; }
.provider-section { margin: 0; padding: 0; border: none; }
.settings-test-btn { margin-left: auto; }
.settings-orchestrator-card {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 10px;
  padding: 12px;
}
.settings-orchestrator-title {
  display: inline-block;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 10px;
}
.settings-health-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  line-height: 1.3;
  font-weight: 700;
  vertical-align: middle;
}
.settings-health-badge--ok {
  background: #dcfce7;
  color: #166534;
}
.settings-health-badge--warning {
  background: #fef3c7;
  color: #92400e;
}
.settings-health-badge--critical {
  background: #fee2e2;
  color: #991b1b;
}
.settings-orchestrator-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 0.78rem;
  color: #4b5563;
}
.settings-orchestrator-stats__reason {
  flex-basis: 100%;
}
.settings-orchestrator-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}
.settings-orchestrator-overview__item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 10px;
}
.settings-orchestrator-overview__label {
  display: block;
  font-size: 0.74rem;
  color: #6b7280;
}
.settings-orchestrator-overview__value {
  font-size: 1rem;
  color: #111827;
}
.settings-orchestrator-actions {
  margin: 4px 0 8px;
}
.settings-phase-sparkline-wrap {
  margin: 4px 0 8px;
}
.settings-phase-sparkline__label {
  font-size: 0.72rem;
  color: #6b7280;
  margin-bottom: 4px;
}
.settings-phase-sparkline {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-height: 42px;
  border: 1px solid #eef2f7;
  border-radius: 8px;
  background: #f9fafb;
  padding: 4px 6px;
}
.settings-phase-sparkline__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.settings-phase-sparkline__bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  min-height: 28px;
}
.settings-phase-sparkline__bar {
  width: 5px;
  border-radius: 2px 2px 1px 1px;
}
.settings-phase-sparkline__bar--success { background: #10b981; }
.settings-phase-sparkline__bar--fallback { background: #f59e0b; }
.settings-phase-sparkline__day {
  font-size: 0.62rem;
  color: #94a3b8;
  line-height: 1;
}
.settings-orchestrator-trend {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  margin: 6px 0 12px;
}
.settings-orchestrator-trend__title {
  font-size: 0.8rem;
  color: #4b5563;
  margin-bottom: 8px;
  font-weight: 600;
}
.settings-orchestrator-trend__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}
.settings-orchestrator-trend__day {
  border: 1px solid #eef2f7;
  border-radius: 8px;
  padding: 6px;
  background: #f9fafb;
}
.settings-orchestrator-trend__date {
  font-size: 0.72rem;
  color: #6b7280;
  margin-bottom: 4px;
  text-align: center;
}
.settings-orchestrator-trend__bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  min-height: 64px;
}
.settings-orchestrator-trend__bar {
  width: 12px;
  border-radius: 4px 4px 2px 2px;
}
.settings-orchestrator-trend__bar--success { background: #34d399; }
.settings-orchestrator-trend__bar--fallback { background: #f59e0b; }
.settings-orchestrator-trend__meta {
  font-size: 0.68rem;
  color: #6b7280;
  text-align: center;
}
.settings-inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}
.settings-recommendation-chip {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.74rem;
  color: #6b7280;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 999px;
  padding: 2px 8px;
}
.settings-recommendation-chip--active {
  color: #065f46;
  background: #d1fae5;
  border-style: solid;
  border-color: #86efac;
  font-weight: 700;
}

.settings-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

.settings-section-title {
  font-size: 0.95rem;
  margin-top: 20px;
  margin-bottom: 8px;
}

.settings-section-subtitle {
  margin-bottom: 16px;
}

.settings-header-actions {
  margin-bottom: 0;
  padding-top: 4px;
}

.settings-code {
  background: var(--bg-warm);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.82rem;
}

.settings-field-hint {
  font-weight: 400;
  color: var(--ink-light);
}

.form-input--mono {
  font-family: monospace;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

.form-input--code {
  font-family: monospace;
  font-size: 0.8rem;
  resize: vertical;
  min-height: 160px;
}

.settings-preview-btn {
  align-self: flex-start;
  margin-top: 6px;
}

/* ── Notifikacije roditelja ─────────────────────────────────────────────────── */

.parent-notify-toggles {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.parent-notify-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--ink-light);
  cursor: pointer;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--bg-warm);
  -webkit-user-select: none;
  user-select: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.parent-notify-toggle:has(input:checked) {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46;
}

.parent-notify-toggle input[type="checkbox"] {
  width: 13px;
  height: 13px;
  accent-color: #059669;
  cursor: pointer;
}

/* ── Mail template pregled modal ───────────────────────────────────────────── */

.tpl-preview-open {
  overflow: hidden;
}

.tpl-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.tpl-preview-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.tpl-preview-modal__box {
  position: relative;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.18);
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tpl-preview-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tpl-preview-modal__title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.tpl-preview-modal__close {
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--ink-light);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}

.tpl-preview-modal__close:hover {
  background: var(--bg-warm);
  color: var(--ink);
}

.tpl-preview-modal__note {
  padding: 8px 20px;
  font-size: 0.78rem;
  color: var(--ink-muted);
  background: var(--bg-warm);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tpl-preview-modal__frame {
  flex: 1;
  border: none;
  width: 100%;
  min-height: 400px;
  background: #fff;
}

.tpl-preview-modal__box--narrow {
  max-width: 480px;
}

.tpl-preview-modal__form {
  padding: 20px;
  gap: 14px;
}

/* Quiz report modal */
.report-attempt-list {
  margin: 8px 0 16px;
}
.report-attempt-items {
  margin: 6px 0 0;
  padding-left: 20px;
  font-size: 0.85rem;
  color: var(--ink-muted);
  line-height: 1.7;
}
.report-modal-feedback {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.report-modal-feedback--ok {
  background: #d1fae5;
  color: #065f46;
}
.report-modal-feedback--err {
  background: #fee2e2;
  color: #991b1b;
}

/* Checkbox column in quiz tables */
.col-check {
  width: 36px;
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   NOVI STILOVI — dark mode, learning mode, flashcard session, QR upload,
   exam mode, admin usage/limits
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Utility ───────────────────────────────────────────────────────────────── */

.hidden { display: none !important; }

/* ── Dark mode ─────────────────────────────────────────────────────────────── */

body.dark {
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-warm: #14141f;
  --ink: #e8e6f0;
  --ink-light: #b0aec0;
  --ink-muted: #6a6a8a;
  --text: #e8e6f0;
  --text-muted: #6a6a8a;
  --border: #2a2a40;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --red-bg: #2a1010;
  --red-border: #6b2020;
  --red-text: #f08080;
}

body.dark .header {
  background: rgba(15, 15, 26, 0.92);
}

body.dark .action-btn {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--ink);
}

body.dark .action-btn:hover {
  background: var(--bg-warm);
}

body.dark .action-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

body.dark input,
body.dark select,
body.dark textarea {
  background: var(--bg-warm);
  border-color: var(--border);
  color: var(--ink);
}

body.dark .warning-banner--success {
  background: #052e16;
  border-color: #166534;
  color: #86efac;
}

body.dark .warning-banner--error {
  background: #2a0a0a;
  border-color: #7f1d1d;
  color: #fca5a5;
}

/* ── Learning mode bar ─────────────────────────────────────────────────────── */

.learning-mode-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.learning-mode-bar__label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-muted);
  margin-right: 4px;
}

.learning-mode-bar__sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 4px;
}

.mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-warm);
  color: var(--ink-light);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.mode-btn :is(i[data-lucide], svg.lucide) {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--ink-muted, #64748b);
}

.mode-btn:hover :is(i[data-lucide], svg.lucide) {
  color: var(--accent, #6366f1);
}

.mode-btn.active :is(i[data-lucide], svg.lucide) {
  color: #fff;
}

.mode-btn:hover {
  background: var(--bg-card);
  border-color: var(--accent);
  color: var(--ink);
}

.mode-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.learning-mode-bar__options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

#darkModeToggle,
.mode-dark-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  line-height: 0;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.mode-dark-toggle__moon,
.mode-dark-toggle__sun {
  display: flex;
  align-items: center;
  justify-content: center;
}

.mode-dark-toggle :is(i[data-lucide], svg.lucide) {
  width: 18px;
  height: 18px;
  color: var(--ink-muted, #64748b);
}

body.dark .mode-dark-toggle .mode-dark-toggle__sun :is(i[data-lucide], svg.lucide),
body.dark .mode-dark-toggle .mode-dark-toggle__sun svg {
  color: #fbbf24;
}

#darkModeToggle:hover,
.mode-dark-toggle:hover {
  background: var(--bg-warm);
  border-color: var(--accent);
}

#darkModeToggle:hover .mode-dark-toggle__moon :is(i[data-lucide], svg.lucide),
.mode-dark-toggle:hover .mode-dark-toggle__moon :is(i[data-lucide], svg.lucide) {
  color: var(--accent, #6366f1);
}

body.dark .mode-dark-toggle:hover .mode-dark-toggle__sun :is(i[data-lucide], svg.lucide) {
  color: #fde68a;
}

/* ── QR Upload ─────────────────────────────────────────────────────────────── */

.qr-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-modal.hidden { display: none !important; }

.qr-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 46, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.qr-modal__box {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  z-index: 1;
}

.qr-modal__title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--ink);
}

.qr-modal__sub {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 20px;
}

.qr-modal__img {
  width: 200px;
  height: 200px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: #fff;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-modal__img img { width: 100%; height: 100%; }

.qr-modal__url {
  font-size: 0.75rem;
  font-family: monospace;
  color: var(--ink-muted);
  word-break: break-all;
  margin-bottom: 20px;
}

.qr-modal__status {
  font-size: 0.88rem;
  color: var(--ink-muted);
  min-height: 1.4em;
}

.qr-modal__close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--ink-muted);
  padding: 4px 8px;
  border-radius: 6px;
  transition: background var(--transition);
}

.qr-modal__close:hover { background: var(--bg-warm); }

/* ── Flashcard session bar ─────────────────────────────────────────────────── */

.fc-session-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 4px;
}

.fc-session-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.fc-session-bar__info {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-muted);
  white-space: nowrap;
}

.fc-session-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(232, 93, 58, 0.22);
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition), background var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.fc-session-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(232, 93, 58, 0.28);
  filter: saturate(1.03);
}

.fc-session-btn:active {
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(232, 93, 58, 0.18);
}

.fc-session-btn--ghost {
  background: var(--bg-card);
  color: var(--ink);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.fc-session-btn--ghost:hover {
  background: var(--bg-warm);
  border-color: var(--accent);
  color: var(--accent);
}

.fc-progress-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
}

.fc-progress-track {
  position: relative;
  height: 8px;
  background: var(--bg-warm);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.fc-progress-znam,
.fc-progress-nisam {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0%;
  transition: width 0.3s ease;
}

.fc-progress-znam {
  left: 0;
  background: var(--green);
  border-radius: 999px 0 0 999px;
}

.fc-progress-nisam {
  left: 0;
  background: var(--blue);
  opacity: 0.8;
  border-radius: 999px;
}

.fc-timer-bar {
  height: 3px;
  background: var(--accent);
  border-radius: 999px;
  transition: width 1s linear;
  width: 100%;
}

.fc-session-bar__btns {
  display: flex;
  gap: 6px;
}

/* SM-2 answer buttons */
.sm2-btn {
  padding: 8px 18px;
  border-radius: 999px;
  border: 2px solid transparent;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform 0.1s;
}

.sm2-btn:active { transform: scale(0.95); }

.sm2-btn--ne_znam {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.sm2-btn--ne_znam:hover { background: #fecaca; }

.sm2-btn--nisam_siguran {
  background: #fef9c3;
  border-color: #fde047;
  color: #854d0e;
}

.sm2-btn--nisam_siguran:hover { background: #fef08a; }

.sm2-btn--znam {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46;
}

.sm2-btn--znam:hover { background: #a7f3d0; }

body.dark .sm2-btn--ne_znam      { background: #450a0a; border-color: #7f1d1d; color: #fca5a5; }
body.dark .sm2-btn--nisam_siguran { background: #422006; border-color: #92400e; color: #fcd34d; }
body.dark .sm2-btn--znam          { background: #052e16; border-color: #166534; color: #86efac; }

/* Flashcard done screen */
.fc-done-screen {
  text-align: center;
  padding: 40px 24px;
}

.fc-done-screen__emoji {
  font-size: 3rem;
  margin-bottom: 12px;
}

.fc-done-screen__title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--ink);
}

.fc-done-screen__stats {
  font-size: 0.88rem;
  color: var(--ink-muted);
  margin-bottom: 20px;
}

.fc-done-screen__btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Flashcard inner wrapper */
.flashcard__inner {
  display: contents;
}

/* Swipe gesture visual feedback */
.flashcard.swipe-left  { transform: translateX(-8px) rotate(-2deg); opacity: 0.7; transition: transform 0.15s, opacity 0.15s; }
.flashcard.swipe-right { transform: translateX(8px) rotate(2deg); opacity: 0.7; transition: transform 0.15s, opacity 0.15s; }

/* ── Exam (Ispit) mode ─────────────────────────────────────────────────────── */

.ispit-hidden {
  display: none !important;
}

.ispit-textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.9rem;
  resize: vertical;
  margin-top: 8px;
}

.ispit-reveal-btn {
  margin-top: 8px;
}

/* ── Admin — Usage & Limits ────────────────────────────────────────────────── */

.settings-loading-msg {
  padding: 16px;
  color: var(--ink-muted);
  font-size: 0.88rem;
}

.settings-empty-msg {
  padding: 16px;
  color: var(--ink-muted);
  font-size: 0.88rem;
  font-style: italic;
}

.admin-form-actions--top-gap    { margin-top: 1rem; }
.admin-form-actions--top-gap-lg { margin-top: 1.5rem; }

.action-btn--sm {
  padding: 4px 12px;
  font-size: 0.8rem;
}

.table-cell--mono { font-family: monospace; font-size: 0.85rem; }
.table-cell--cost { font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }

/* Usage summary cards */
.usage-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.usage-card {
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  transition: opacity 0.3s;
}

.usage-card--loading { opacity: 0.5; }

.usage-card__label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.usage-card__value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.usage-card__sub {
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-top: 4px;
}

/* Daily trend bar chart */
.usage-trend-wrap {
  overflow-x: auto;
}

.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100px;
  padding: 0 4px;
  min-width: max-content;
}

.trend-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 28px;
}

.trend-bar {
  width: 100%;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.4s ease;
  opacity: 0.75;
}

.trend-bar:hover { opacity: 1; }

.trend-bar-label {
  font-size: 0.65rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

/* ══ Tema: Lucide skala + vibrant detalji (izdvojeno iz theme.css) ══ */
:root {
  --theme-icon-xs: 14px;
  --theme-icon-sm: 16px;
  --theme-icon-md: 18px;
  --theme-icon-lg: 22px;
  --theme-icon-xl: 24px;
  --theme-icon-2xl: 40px;
  --theme-icon-3xl: 48px;
}

body.theme-vibrant .btn,
body.theme-vibrant button.action-btn,
body.theme-vibrant a.action-btn {
  border-radius: var(--theme-radius-btn);
}

body.theme-vibrant input,
body.theme-vibrant select,
body.theme-vibrant textarea {
  border-radius: 16px;
}

body.theme-vibrant .admin-card__header,
body.theme-vibrant .auth-card__header,
body.theme-vibrant .history-header {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.04));
  border-radius: 16px;
  padding: 14px;
}

body.theme-vibrant .admin-card,
body.theme-vibrant .auth-card,
body.theme-vibrant .history-card {
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

body.theme-vibrant .text-success,
body.theme-vibrant .badge.bg-success {
  color: #065f46 !important;
  background-color: var(--theme-success) !important;
}

body.theme-vibrant .text-danger,
body.theme-vibrant .badge.bg-danger,
body.theme-vibrant .text-warning {
  color: #881337 !important;
}

/* Lucide: normalizacija veličina */
body.theme-vibrant :is(i[data-lucide], svg.lucide) {
  stroke-width: 2;
  flex-shrink: 0;
  vertical-align: middle;
  width: var(--theme-icon-md);
  height: var(--theme-icon-md);
}

body.theme-vibrant .header .logo-icon :is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-lg);
  height: var(--theme-icon-lg);
}

body.theme-vibrant .header .nav-link :is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-md);
  height: var(--theme-icon-md);
}

body.theme-vibrant .tab-btn :is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-sm);
  height: var(--theme-icon-sm);
}

body.theme-vibrant .admin-v2-nav__link :is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-md);
  height: var(--theme-icon-md);
}

body.theme-vibrant .admin-v2-health-item :is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-md);
  height: var(--theme-icon-md);
}

body.theme-vibrant .settings-vibrant-widget__head :is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-md);
  height: var(--theme-icon-md);
}

body.theme-vibrant .settings-theme-card__check:is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-lg);
  height: var(--theme-icon-lg);
}

body.theme-vibrant .history-group__icon :is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-lg);
  height: var(--theme-icon-lg);
}

body.theme-vibrant .history-group__chevron:is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-sm);
  height: var(--theme-icon-sm);
}

body.theme-vibrant .history-card-icon :is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-lg);
  height: var(--theme-icon-lg);
}

body.theme-vibrant .history-card-arrow:is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-sm);
  height: var(--theme-icon-sm);
}

body.theme-vibrant .action-btn :is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-md);
  height: var(--theme-icon-md);
}

body.theme-vibrant .empty-icon :is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-2xl);
  height: var(--theme-icon-2xl);
}

body.theme-vibrant .upload-cloud-icon :is(i[data-lucide], svg.lucide),
body.theme-vibrant .upload-cloud-icon svg {
  width: var(--theme-icon-2xl) !important;
  height: var(--theme-icon-2xl) !important;
}

body.theme-vibrant #qrInlineImg :is(i[data-lucide], svg.lucide),
body.theme-vibrant #qrInlineImg svg {
  width: var(--theme-icon-3xl) !important;
  height: var(--theme-icon-3xl) !important;
}

body.theme-vibrant .scope-card-v2 :is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-xl);
  height: var(--theme-icon-xl);
}

body.theme-vibrant .file-bar-icon :is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-md);
  height: var(--theme-icon-md);
}

body.theme-vibrant .file-bar-remove :is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-sm);
  height: var(--theme-icon-sm);
}

body.theme-vibrant .error-box :is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-lg);
  height: var(--theme-icon-lg);
}

body.theme-vibrant .gen-btn-v2 :is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-xl);
  height: var(--theme-icon-xl);
}

body.theme-vibrant .proc-ring__icon :is(i[data-lucide], svg.lucide),
body.theme-vibrant .proc-ring__icon svg {
  width: 32px !important;
  height: 32px !important;
}

body.theme-vibrant .auth-input-icon:is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-md);
  height: var(--theme-icon-md);
}

body.theme-vibrant .parent-shield:is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-md);
  height: var(--theme-icon-md);
}

body.theme-vibrant .qa-question .qa-chevron:is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-sm);
  height: var(--theme-icon-sm);
}

body.theme-vibrant [data-flashcard-toggle] :is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-sm);
  height: var(--theme-icon-sm);
  margin-right: 6px;
}

body.theme-classic .header .logo-icon :is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-lg);
  height: var(--theme-icon-lg);
}

body.theme-classic .header .nav-link :is(i[data-lucide], svg.lucide) {
  width: var(--theme-icon-md);
  height: var(--theme-icon-md);
  flex-shrink: 0;
  vertical-align: middle;
  stroke-width: 2;
}
