/* ============ Tokeni ============ */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f2f2f5;
  --fill: rgba(118, 118, 128, 0.12);
  --fill-strong: rgba(118, 118, 128, 0.2);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #8e8e93;
  --line: rgba(0, 0, 0, 0.08);
  --accent: #0071e3;
  --accent-press: #0062c4;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --danger: #ff3b30;
  --success: #34c759;
  --heart: #ff2d55;
  --material: rgba(245, 245, 247, 0.72);
  --material-border: rgba(0, 0, 0, 0.06);
  --scrim: rgba(0, 0, 0, 0.3);
  --underlay: #000;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 10px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.04), 0 14px 34px rgba(0, 0, 0, 0.09);
  --shadow-lg: 0 30px 90px rgba(0, 0, 0, 0.22), 0 6px 20px rgba(0, 0, 0, 0.08);

  --r-card: 22px;
  --r-sheet: 28px;
  --r-field: 12px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, "Inter", Roboto, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, "Inter", Roboto, sans-serif;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --fill: rgba(118, 118, 128, 0.24);
    --fill-strong: rgba(118, 118, 128, 0.36);
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #8e8e93;
    --line: rgba(255, 255, 255, 0.1);
    --accent: #0a84ff;
    --accent-press: #0071e3;
    --accent-soft: rgba(10, 132, 255, 0.18);
    --danger: #ff453a;
    --success: #30d158;
    --heart: #ff375f;
    --material: rgba(22, 22, 24, 0.72);
    --material-border: rgba(255, 255, 255, 0.08);
    --scrim: rgba(0, 0, 0, 0.55);
    --shadow-sm: 0 0 0 1px rgba(255, 255, 255, 0.06);
    --shadow-md: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 14px 34px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 30px 90px rgba(0, 0, 0, 0.7);
  }
}

/* ============ Osnova ============ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
  background: var(--bg);
}

html.is-locked {
  overflow: hidden;
}

body {
  margin: 0;
  font: 400 1rem/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

html.is-locked body {
  background: var(--underlay);
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}

[hidden] {
  display: none !important;
}

.icon,
svg {
  flex: none;
}

svg path,
svg circle,
svg rect {
  vector-effect: non-scaling-stroke;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
}

#app {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  will-change: auto;
}

#app.is-behind {
  overflow: clip;
  will-change: transform;
}

#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

/* Meke boje iza naslova — statične, bez pokreta u pozadini */
.backdrop {
  position: absolute;
  inset: 0 0 auto;
  height: 520px;
  overflow: hidden;
  pointer-events: none;
}

.backdrop span {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
}

.backdrop span:nth-child(1) {
  width: 420px;
  height: 320px;
  left: -80px;
  top: -120px;
  background: #7cc4ff;
}

.backdrop span:nth-child(2) {
  width: 380px;
  height: 300px;
  left: 35%;
  top: -160px;
  background: #d7a8ff;
}

.backdrop span:nth-child(3) {
  width: 360px;
  height: 280px;
  right: -100px;
  top: -60px;
  background: #ffc7a1;
}

@media (prefers-color-scheme: dark) {
  .backdrop span {
    opacity: 0.28;
  }
}

/* ============ Gornja traka (materijal) ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--material);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid transparent;
  transition: border-color 200ms ease;
  padding-top: env(safe-area-inset-top);
}

.topbar.is-scrolled {
  border-bottom-color: var(--material-border);
}

.topbar-inner {
  max-width: 1160px;
  margin: 0 auto;
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  min-width: 0;
}

.brand #class-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #007aff, #af52de);
  box-shadow: 0 2px 8px rgba(88, 86, 214, 0.35);
}

.brand-mark svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.brand-mark-lg {
  width: 64px;
  height: 64px;
  border-radius: 16px;
}

.brand-mark-lg svg {
  width: 34px;
  height: 34px;
}

/* ============ Dugmad ============ */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
  user-select: none;
  transition: transform 160ms var(--ease-out), background-color 160ms ease, opacity 160ms ease;
}

.btn:active {
  transform: scale(0.96);
  transition-duration: 80ms;
}

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

.btn-primary:hover {
  background: var(--accent-press);
}

.btn .icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.btn-text {
  color: var(--accent);
  font-size: 1.0625rem;
  padding: 6px 4px;
  border-radius: 8px;
  transition: opacity 120ms ease;
}

.btn-text:active {
  opacity: 0.5;
  transition-duration: 0ms;
}

.fab {
  display: none;
}

/* ============ Glavni sadržaj ============ */
.page {
  position: relative;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px 120px;
}

.hero {
  padding: 44px 0 28px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.display {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 7vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 700;
  font-optical-sizing: auto;
  background: linear-gradient(100deg, var(--text) 30%, color-mix(in srgb, var(--text) 55%, #5856d6));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  margin: 10px 0 0;
  color: var(--text-2);
  font-size: 1.1875rem;
  line-height: 1.4;
  letter-spacing: -0.012em;
}

/* ============ Filteri ============ */
.controls {
  display: grid;
  gap: 14px;
  margin-bottom: 24px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--fill);
  max-width: 520px;
  transition: background-color 160ms ease, box-shadow 160ms ease;
}

.search:focus-within {
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-sm);
}

.search .icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--text-3);
  stroke-width: 2;
  stroke-linecap: round;
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 1rem;
}

.search input::placeholder {
  color: var(--text-3);
}

.segmented {
  position: relative;
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  padding: 2px;
  border-radius: 10px;
  background: var(--fill);
  overflow-x: auto;
  scrollbar-width: none;
}

.segmented::-webkit-scrollbar {
  display: none;
}

.segmented-indicator {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: 0;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.04);
  will-change: transform, width;
}

@media (prefers-color-scheme: dark) {
  .segmented-indicator {
    background: #636366;
  }
}

.segmented button {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  height: 32px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text);
  transition: transform 160ms var(--ease-out);
}

.segmented button[aria-checked="true"],
.segmented button[aria-selected="true"] {
  font-weight: 600;
}

.segmented button:active {
  transform: scale(0.95);
}

.segmented-full {
  display: flex;
  width: 100%;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -20px;
  padding: 2px 20px 6px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent);
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  --c: var(--accent);
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: transform 160ms var(--ease-out), background-color 200ms ease, color 200ms ease, box-shadow 200ms ease;
}

.chip:active {
  transform: scale(0.95);
  transition-duration: 80ms;
}

.chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c);
  transition: background-color 200ms ease;
}

.chip[aria-selected="true"],
.chip[aria-checked="true"] {
  background: var(--c);
  color: #fff;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--c) 40%, transparent);
}

.chip[data-value="all"][aria-selected="true"] {
  background: var(--text);
  color: var(--bg);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.chip[data-value="all"][aria-selected="true"] .dot {
  background: var(--bg);
}

.chip[aria-selected="true"] .dot,
.chip[aria-checked="true"] .dot {
  background: rgba(255, 255, 255, 0.9);
}

/* ============ Kartice ============ */
.grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
  align-items: start;
}

.card {
  --c: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  outline: none;
  transition: box-shadow 260ms var(--ease-out), translate 260ms var(--ease-out), scale 160ms var(--ease-out);
}

@media (hover: hover) {
  .card:hover {
    box-shadow: var(--shadow-md);
    translate: 0 -3px;
  }
}

.card:active {
  scale: 0.985;
  transition-duration: 80ms;
}

.card:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent), var(--shadow-md);
}

.card.is-exiting {
  pointer-events: none;
}

.card-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background: color-mix(in srgb, var(--c) 14%, var(--surface-2));
  overflow: hidden;
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 400ms ease;
}

.card-cover img.is-loaded {
  opacity: 1;
}

.card-band {
  height: 6px;
  background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 50%, #fff));
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px 14px;
}

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

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  white-space: nowrap;
}

.tag-subject {
  color: color-mix(in srgb, var(--c) 85%, var(--text));
  background: color-mix(in srgb, var(--c) 13%, transparent);
}

.tag-subject i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c);
}

.tag-type {
  color: var(--text-2);
  background: var(--fill);
}

.card-title {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -0.016em;
  overflow-wrap: anywhere;
}

.card-desc {
  margin: -4px 0 0;
  color: var(--text-2);
  font-size: 0.9375rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.file-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.file-chip {
  --fc: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px 0 7px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-2);
}

.file-chip b {
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #fff;
  background: var(--fc);
  border-radius: 4px;
  padding: 1px 4px;
  text-transform: uppercase;
}

.card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--text-2);
  min-width: 0;
}

.avatar {
  --c: var(--accent);
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #000));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.author {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.sep {
  color: var(--text-3);
}

.card-foot time {
  white-space: nowrap;
}

.like {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background-color 160ms ease, color 160ms ease;
}

.like:hover {
  background: var(--fill);
}

.like svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
}

.like[aria-pressed="true"] {
  color: var(--heart);
}

.like[aria-pressed="true"] svg {
  fill: currentColor;
}

/* ============ Prazno stanje i učitavanje ============ */
.empty {
  display: grid;
  justify-items: center;
  text-align: center;
  padding: 56px 20px;
}

.empty-art {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  margin-bottom: 18px;
}

.empty-art svg {
  width: 48px;
  height: 48px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linecap: round;
}

.empty h2 {
  margin: 0 0 6px;
  font-size: 1.375rem;
  letter-spacing: -0.02em;
}

.empty p {
  margin: 0 0 20px;
  color: var(--text-2);
  max-width: 34ch;
}

.skeletons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}

.skeleton {
  height: 210px;
  border-radius: var(--r-card);
  background: linear-gradient(100deg, var(--surface) 40%, var(--surface-2) 50%, var(--surface) 60%) var(--surface);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  box-shadow: var(--shadow-sm);
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ============ Sheet ============ */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
}

.sheet-scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  opacity: 0;
}

.sheet-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(580px, 100%);
  max-height: min(88vh, 900px);
  background: var(--surface);
  border-radius: var(--r-sheet);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  outline: none;
  opacity: 0;
  will-change: transform, opacity;
}

.sheet-grab {
  display: none;
}

.sheet-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px 18px 10px;
  touch-action: none;
}

.sheet-header > :first-child {
  justify-self: start;
}

.sheet-header > :last-child {
  justify-self: end;
}

.sheet-header h2 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 22px 24px;
  display: grid;
  gap: 18px;
}

/* ============ Forma ============ */
.dropzone {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 26px 16px;
  border-radius: 18px;
  border: 2px dashed var(--fill-strong);
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: transform 260ms var(--ease-out), border-color 200ms ease, background-color 200ms ease;
}

.dropzone:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}

.dropzone:active {
  transform: scale(0.985);
}

.dropzone.is-over {
  transform: scale(1.02);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone.is-invalid {
  border-color: var(--danger);
}

.dropzone-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 6px;
  border-radius: 14px;
  background: var(--accent);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform 300ms var(--ease-out);
}

.dropzone.is-over .dropzone-icon {
  transform: translateY(-4px);
}

.dropzone-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dropzone-title {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dropzone-title u {
  color: var(--accent);
  text-decoration: none;
}

.dropzone-hint {
  color: var(--text-3);
  font-size: 0.8125rem;
}

.file-list {
  list-style: none;
  margin: -8px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.file-list:empty {
  display: none;
}

.file-item {
  --fc: var(--text-3);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 12px;
  border-radius: 14px;
  background: var(--surface-2);
}

.file-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--fc);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  overflow: hidden;
}

.file-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-meta {
  flex: 1;
  min-width: 0;
  display: grid;
}

.file-name {
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 0.8125rem;
  color: var(--text-3);
}

.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-2);
  transition: background-color 160ms ease, transform 160ms var(--ease-out);
}

.icon-btn:hover {
  background: var(--fill);
}

.icon-btn:active {
  transform: scale(0.9);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.field {
  display: grid;
  gap: 8px;
}

.field > label,
.field > .label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.01em;
}

.optional {
  font-weight: 400;
  color: var(--text-3);
}

.field input,
.field textarea {
  width: 100%;
  border: 0;
  outline: 0;
  border-radius: var(--r-field);
  background: var(--surface-2);
  padding: 12px 14px;
  font-size: 1rem;
  line-height: 1.4;
  transition: box-shadow 160ms ease, background-color 160ms ease;
}

.field textarea {
  resize: vertical;
  min-height: 84px;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-3);
}

.field input:focus,
.field textarea:focus {
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 6px var(--accent-soft);
}

.field.is-invalid input,
.field.is-invalid .chip-picker,
.field.is-invalid textarea {
  box-shadow: 0 0 0 2px var(--danger);
}

.chip-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-radius: 18px;
}

.chip-picker .chip {
  background: var(--surface-2);
  box-shadow: none;
}

.form-error {
  margin: -6px 0 0;
  min-height: 1.4em;
  color: var(--danger);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
}

.form-error:empty {
  min-height: 0;
  margin: 0;
}

.btn-submit {
  height: 52px;
  width: 100%;
  font-size: 1.0625rem;
  overflow: hidden;
  isolation: isolate;
  transition: transform 160ms var(--ease-out), background-color 300ms ease;
}

.btn-progress {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(255, 255, 255, 0.22);
  transform-origin: left center;
  transform: scaleX(0);
}

.btn-check {
  position: absolute;
  width: 28px;
  height: 28px;
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  opacity: 0;
}

.btn-submit.is-busy {
  pointer-events: none;
}

.btn-submit.is-done {
  background: var(--success);
  pointer-events: none;
}

.btn-submit.is-done .btn-label,
.btn-submit.is-done .btn-progress {
  opacity: 0;
}

.btn-submit.is-done .btn-check {
  opacity: 1;
  animation: draw 420ms 60ms var(--ease-out) forwards;
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* ============ Detalji ============ */
.detail-head {
  display: grid;
  gap: 12px;
}

.detail-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.75rem;
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 0.875rem;
}

.detail-desc {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.55;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.gallery a {
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-2);
  transition: transform 200ms var(--ease-out);
}

.gallery a:active {
  transform: scale(0.97);
}

.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.files {
  display: grid;
  gap: 8px;
}

.files h3,
.section-label {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.01em;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 12px;
  border-radius: 14px;
  background: var(--surface-2);
}

.file-actions {
  display: flex;
  gap: 4px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 160ms var(--ease-out), opacity 160ms ease;
}

.pill-btn:active {
  transform: scale(0.94);
}

.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.detail-actions .like {
  margin-left: 0;
  height: 40px;
  padding: 0 16px;
  background: var(--fill);
  font-size: 0.9375rem;
}

.btn-danger {
  margin-left: auto;
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

.btn-danger.is-armed {
  background: var(--danger);
  color: #fff;
}

/* ============ Šifra ============ */
.gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg);
}

.gate-card {
  width: min(380px, 100%);
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.gate-card h1 {
  margin: 10px 0 0;
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: -0.03em;
}

.gate-card p {
  margin: 0;
  color: var(--text-2);
}

.gate-card input {
  width: 100%;
  height: 50px;
  margin-top: 10px;
  border: 0;
  outline: 0;
  border-radius: 14px;
  padding: 0 16px;
  background: var(--fill);
  font-size: 1.0625rem;
  text-align: center;
  transition: box-shadow 160ms ease;
}

.gate-card input:focus {
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 6px var(--accent-soft);
}

.gate-card .btn {
  width: 100%;
  height: 50px;
}

/* ============ Toast ============ */
.toasts {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  translate: -50% 0;
  z-index: 90;
  display: grid;
  gap: 8px;
  justify-items: center;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--material);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--material-border);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
}

.toast svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toast-success svg {
  stroke: var(--success);
}

.toast-error svg {
  stroke: var(--danger);
}

/* ============ Telefon ============ */
@media (max-width: 640px) {
  .topbar-inner,
  .page {
    padding-left: 16px;
    padding-right: 16px;
  }

  .chips {
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .btn-add {
    display: none;
  }

  .hero {
    padding: 28px 0 22px;
  }

  .hero-sub {
    font-size: 1.0625rem;
  }

  .search {
    max-width: none;
  }

  .segmented:not(.segmented-full) {
    width: 100%;
  }

  .grid,
  .skeletons {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .fab {
    position: fixed;
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    z-index: 30;
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 45%, transparent), 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: transform 160ms var(--ease-out);
  }

  .fab:active {
    transform: scale(0.92);
    transition-duration: 80ms;
  }

  .fab svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.6;
    stroke-linecap: round;
  }

  .sheet {
    padding: 0;
    place-items: end stretch;
  }

  .sheet-panel {
    width: 100%;
    max-height: calc(100dvh - 44px - env(safe-area-inset-top));
    border-radius: var(--r-sheet) var(--r-sheet) 0 0;
    opacity: 1;
    /* produžetak ispod da se ne vidi rupa kad sheet odskoči gore */
    box-shadow: 0 140px 0 0 var(--surface), var(--shadow-lg);
  }

  .sheet-grab {
    display: grid;
    place-items: center;
    height: 20px;
    touch-action: none;
    cursor: grab;
  }

  .grabber {
    width: 38px;
    height: 5px;
    border-radius: 3px;
    background: var(--fill-strong);
  }

  .sheet-header {
    padding-top: 0;
  }

  .sheet-body {
    padding: 6px 16px calc(24px + env(safe-area-inset-bottom));
  }

  .detail-title {
    font-size: 1.5rem;
  }
}

/* ============ Pristupačnost ============ */
@media (prefers-reduced-motion: reduce) {
  .card,
  .chip,
  .btn,
  .dropzone,
  .dropzone-icon {
    transition-property: background-color, color, box-shadow, border-color, opacity;
  }

  .card:hover {
    translate: none;
  }

  .skeleton {
    animation: none;
  }

  .btn-submit.is-done .btn-check {
    animation: none;
    stroke-dashoffset: 0;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar,
  .toast {
    background: var(--surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: rgba(0, 0, 0, 0.3);
    --text-2: #3a3a3c;
  }

  .card,
  .chip,
  .toast {
    border: 1px solid var(--text-2);
  }
}

/* ============ Telefon: dodatne optimizacije ============ */
html {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* bez kašnjenja od 300ms i bez zumiranja na dupli dodir */
  overscroll-behavior-y: contain; /* gasi ugrađeno "povuci za osvežavanje", koristimo svoje */
}

.card,
.chip,
.segmented,
.btn,
.fab,
.like,
.icon-btn,
.pill-btn,
.camera-btn {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.sheet-scrim {
  touch-action: none;
}

/* Mali naslov u traci kad veliki ode ispod */
.topbar-inner {
  position: relative;
}

.topbar-title {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 220ms ease, transform 320ms var(--ease-out);
  pointer-events: none;
}

.topbar.is-collapsed .topbar-title {
  opacity: 1;
  transform: none;
}

.brand #class-name {
  transition: opacity 220ms ease;
}

/* Povuci za osvežavanje */
.ptr {
  position: fixed;
  top: calc(56px + env(safe-area-inset-top));
  left: 50%;
  z-index: 15;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translate3d(-50%, -12px, 0) scale(0.5);
  pointer-events: none;
}

.ptr svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.6;
  stroke-linecap: round;
}

.ptr.is-spinning svg {
  animation: spin 700ms linear infinite;
}

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

.page {
  will-change: auto;
}

/* Dugme za kameru — samo na uređajima na dodir */
.camera-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  margin-top: -6px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms var(--ease-out);
}

.camera-btn:active {
  transform: scale(0.97);
  transition-duration: 80ms;
}

.camera-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linejoin: round;
}

@media (pointer: coarse) {
  .camera-btn {
    display: flex;
  }
}

.dropzone.is-working {
  opacity: 0.6;
  pointer-events: none;
}

/* Fajl u detaljima: ceo red otvara fajl, dugme sa strane ga preuzima */
.file-open {
  color: inherit;
  text-decoration: none;
  border-radius: 8px;
}

.file-open .file-size {
  color: var(--text-3);
}

.file-row {
  position: relative;
  transition: transform 160ms var(--ease-out), background-color 160ms ease;
}

.file-open::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
}

.file-row:active {
  transform: scale(0.985);
}

.file-row .icon-btn {
  position: relative;
  z-index: 1;
}

.icon-btn-tinted {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-soft {
  background: var(--fill);
  color: var(--text);
}

.btn-soft .icon {
  stroke-width: 2;
}

@media (max-width: 640px) {
  .topbar.is-collapsed #class-name {
    opacity: 0;
  }

  /* Veće mete za prst (min. ~44px) */
  .chip {
    height: 38px;
    padding: 0 15px;
  }

  .segmented button {
    height: 36px;
  }

  .like {
    height: 40px;
    min-width: 48px;
    justify-content: center;
    margin-right: -6px;
  }

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

  .btn-text {
    padding: 10px 6px;
    margin: -4px -6px;
  }

  .card-body {
    padding: 15px 16px 10px;
  }

  .card-foot {
    padding-top: 6px;
  }

  .file-row,
  .file-item {
    min-height: 60px;
  }

  .detail-actions .btn,
  .detail-actions .like {
    height: 44px;
  }

  .fab {
    transition: transform 360ms var(--ease-out), opacity 200ms ease;
  }

  .fab.is-hidden {
    transform: translateY(calc(100% + 32px)) scale(0.9);
    opacity: 0;
    pointer-events: none;
  }

  .toasts {
    width: calc(100% - 32px);
  }

  .toast {
    white-space: normal;
    text-align: center;
  }
}

/* Instalirana aplikacija (dodata na početni ekran) */
@media (display-mode: standalone) {
  .hero {
    padding-top: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .topbar-title,
  .fab {
    transition: opacity 200ms ease;
    transform: none !important;
  }
}
