/* Smart Library — calm, content-first catalogue. */
:root {
  --bg: #f2f6f5;
  --surface: #ffffff;
  --surface-2: #eaf0ee;
  --ink: #17302c;
  --muted: #607370;
  --line: #dde6e3;
  --brand: #0f6e68;
  --brand-soft: #dcefec;
  --brand-ink: #ffffff;
  --accent: #e5603f;
  --danger: #c2412d;
  --focus: #f0a531;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(30, 42, 38, .06), 0 8px 24px rgba(30, 42, 38, .06);
  --shadow-hover: 0 2px 4px rgba(30, 42, 38, .06), 0 16px 36px rgba(30, 42, 38, .12);

  --en: #3767b0; --en-bg: #e5edf9;
  --es: #c9512f; --es-bg: #fbe8df;
  --it: #2c8455; --it-bg: #e1f2e7;
  --de: #a77d0c; --de-bg: #f8eecd;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.container { width: 100%; max-width: 1320px; margin-inline: auto; padding-inline: 16px; }
@media (min-width: 720px) { .container { padding-inline: 28px; } }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(242, 246, 245, .9);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand img { width: 36px; height: 36px; border-radius: 50%; }
.brand span { display: flex; flex-direction: column; line-height: 1.1; }
.brand strong { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: 12px; }
.header-nav { display: flex; align-items: center; gap: 4px; }
.header-link {
  border: 0; background: none; padding: 8px 14px; border-radius: 999px;
  font-weight: 500; font-size: 15px; color: var(--muted);
}
.header-link:hover { color: var(--ink); background: var(--surface-2); }
.header-link.is-active { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.icon-button {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 50%; background: none; color: var(--muted);
}
.icon-button:hover { background: var(--surface-2); color: var(--ink); }
.icon-button svg { width: 20px; height: 20px; }

/* Library layout */
.library { padding-top: 28px; padding-bottom: 64px; }
.library-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 24px; }
.library-head h1 { margin: 0; font-size: clamp(30px, 4.2vw, 44px); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.library-head p { margin: 8px 0 0; color: var(--muted); max-width: 62ch; }
.continue {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%;
  border: 1px solid var(--line); background: var(--surface); padding: 10px 16px; border-radius: 12px;
  font-size: 14px; color: var(--muted); box-shadow: var(--shadow);
}
.continue-label { font-weight: 600; color: var(--brand); white-space: nowrap; }
.continue-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); max-width: 28ch; }
.continue:hover { border-color: var(--brand); }

.library-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.library-main { min-width: 0; }
@media (min-width: 960px) { .library-layout { grid-template-columns: 260px minmax(0, 1fr); } }

/* Filter sidebar */
.filter-panel {
  display: grid; gap: 22px; padding: 20px; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
@media (min-width: 960px) { .filter-panel { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; } }
.filter-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.filter-head h2 { margin: 0; font-size: 18px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.filter-group h3 { margin: 0 0 10px; font-size: 14px; font-weight: 700; }
.pill-group { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 500;
  transition: background .15s, border-color .15s, color .15s;
}
.pill:hover { border-color: var(--brand); color: var(--brand); }
.pill .count { color: var(--muted); font-size: 12px; font-weight: 400; }
.pill.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pill.is-active .count { color: rgba(255,255,255,.75); }
.pill:disabled, .format-tab:disabled { opacity: .4; cursor: default; border-color: var(--line); color: inherit; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
.pill.is-active .dot { box-shadow: 0 0 0 2px #fff; }
.view-list { display: grid; gap: 2px; }
.view-option {
  display: flex; align-items: center; justify-content: space-between; border: 0; background: none;
  padding: 8px 10px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--muted); text-align: left;
}
.view-option:hover { background: var(--surface-2); color: var(--ink); }
.view-option.is-active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.view-count { color: var(--accent); font-weight: 700; }
.link-button { border: 0; background: none; padding: 4px 0; font-size: 13px; font-weight: 600; color: var(--brand); text-transform: uppercase; letter-spacing: .04em; }
.link-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.filter-head .link-button { color: var(--muted); }
.filter-close, .filter-apply, .filters-toggle { display: none !important; }
.filter-backdrop { display: none; }

@media (max-width: 959px) {
  .filter-panel {
    position: fixed; z-index: 55; inset: auto 0 0 0; max-height: 86vh; overflow-y: auto;
    border-radius: 20px 20px 0 0; padding: 20px 16px 16px; transform: translateY(105%);
    transition: transform .25s ease; visibility: hidden;
  }
  .filter-panel.is-open { transform: none; visibility: visible; }
  .filter-head .filter-close { display: grid !important; position: static; flex: none; }
  .filter-head .link-button { margin-left: auto; }
  .filter-apply { display: inline-flex !important; position: sticky; bottom: 0; width: 100%; }
  .filters-toggle { display: inline-flex !important; }
  .filter-backdrop { display: block; position: fixed; inset: 0; z-index: 54; background: rgba(15, 30, 28, .45); }
  .filter-backdrop[hidden] { display: none; }
}

/* Search + formats */
.searchbar { display: flex; gap: 8px; padding: 8px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.search { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; }
.search svg { position: absolute; left: 14px; width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 46px; border: 0; border-radius: 10px; background: var(--surface-2);
  padding: 0 14px 0 44px; font-size: 16px; outline: none; transition: box-shadow .15s, background .15s;
}
.search input:focus { background: var(--surface); box-shadow: inset 0 0 0 2px var(--brand); }
.search input::placeholder { color: #8b9895; }
.search-button { height: 46px; border-radius: 10px; padding: 0 22px; }
.filters-toggle { height: 46px; border-radius: 10px; padding: 0 14px; gap: 6px; }
.filters-toggle svg { width: 18px; height: 18px; }
.filters-badge { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 12px; }
@media (max-width: 559px) { .searchbar .search-button { display: none; } .filters-toggle { padding: 0 12px; } }

.format-row { display: flex; gap: 8px; margin: 16px 0 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.format-row::-webkit-scrollbar { display: none; }
@media (min-width: 720px) { .format-row { flex-wrap: wrap; } }
.format-tab {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted);
  transition: background .15s, border-color .15s, color .15s;
}
.format-tab svg { width: 16px; height: 16px; }
.format-tab .count { font-weight: 500; opacity: .7; }
.format-tab:hover { border-color: var(--brand); color: var(--brand); }
.format-tab.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0 16px; }
.sort { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); }
.sort select { border: 0; background: none; font-weight: 600; color: var(--ink); padding: 4px 2px; cursor: pointer; }
.result-count { margin: 0; color: var(--muted); font-size: 14px; }

/* Cards */
.lesson-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
@media (max-width: 559px) { .lesson-grid { grid-template-columns: 1fr; gap: 16px; } .card .cover { aspect-ratio: 16 / 8; } }
.card {
  display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: transform .2s ease, box-shadow .2s ease; animation: card-in .35s ease both;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
@keyframes card-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .card { animation: none; transition: none; } .card:hover { transform: none; } html { scroll-behavior: auto; } }

.cover {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; overflow: hidden;
  border: 0; padding: 0; background: var(--surface-2);
}
.cover img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform .4s ease; }
.card:hover .cover img { transform: scale(1.04); }
.cover-topic {
  position: absolute; left: 12px; top: 12px; z-index: 2; max-width: calc(100% - 24px);
  padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.95); color: var(--ink);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.cover-focus {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: grid; gap: 3px;
  padding: 28px 12px 10px; text-align: left; color: #fff; font-size: 12.5px; line-height: 1.3;
  background: linear-gradient(to top, rgba(10, 30, 28, .88) 0%, rgba(10, 30, 28, .7) 55%, transparent);
}
.focus-row { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.focus-row b { display: inline-block; min-width: 82px; margin-right: 6px; font-weight: 700; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: #8fe0d6; }
.more-button { border: 0; background: none; padding: 0 6px; height: 32px; font-size: 13px; font-weight: 600; color: var(--brand); }
.more-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.cover-art {
  position: absolute; inset: 0; display: grid; place-items: center; color: var(--tint);
  background: linear-gradient(135deg, var(--tint-bg), color-mix(in srgb, var(--tint-bg) 60%, var(--tint) 40%));
}
.cover-art::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(color-mix(in srgb, #fff 55%, transparent) 1.3px, transparent 1.5px);
  background-size: 18px 18px;
}
.cover-art::after {
  content: ""; position: absolute; width: 65%; aspect-ratio: 1; right: -15%; bottom: -35%;
  border-radius: 50%; background: #fff; opacity: .22;
}
.cover-art span {
  position: relative; z-index: 1; display: grid; place-items: center; width: 74px; height: 74px; border-radius: 22px;
  background: var(--surface); box-shadow: 0 12px 26px rgba(15, 40, 36, .16); transform: rotate(-6deg); transition: transform .3s ease;
}
.card:hover .cover-art span { transform: rotate(0) scale(1.06); }
.cover-art svg { width: 36px; height: 36px; stroke-width: 1.7; }
.tint-0 { --tint: #0f6e68; --tint-bg: #c9ebe6; }
.tint-1 { --tint: #2f62a8; --tint-bg: #cfe0f6; }
.tint-2 { --tint: #c9512f; --tint-bg: #fbd9c9; }
.tint-3 { --tint: #9a7409; --tint-bg: #f6e3a6; }
.tint-4 { --tint: #6d48a8; --tint-bg: #e0d4f4; }
.tint-5 { --tint: #b83a64; --tint-bg: #f7d0dd; }

.card-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 12px; flex: 1; }
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--ink);
}
.tag svg { width: 14px; height: 14px; }
.tag-format { background: #fff4d6; color: #7a5800; }
.tag-level { background: var(--brand); color: #fff; }
.tag-age { background: var(--brand-soft); color: var(--brand); }
.tag-lang { background: none; border: 1px solid var(--line); color: var(--muted); }
.tag-draft { background: #fff3cd; color: #7a5b00; }
.tag-hidden { background: #eceae4; color: var(--muted); }
.card-title { margin: 2px 0 0; font-size: 17px; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
.card-desc {
  margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-start { margin-top: auto; width: 100%; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-tools { display: flex; gap: 2px; }
.tool {
  display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: none; color: var(--muted); transition: background .15s, color .15s, transform .15s;
}
.tool:hover { background: var(--surface-2); color: var(--ink); }
.tool svg { width: 19px; height: 19px; }
.tool-fav.is-active { color: var(--accent); }
.tool-fav.is-active svg { fill: currentColor; }

.empty-state { padding: 56px 16px; text-align: center; background: var(--surface); border-radius: var(--radius); }
.empty-state h3 { margin: 0 0 6px; font-size: 22px; }
.empty-state p { margin: 0 0 20px; color: var(--muted); }

/* Lesson details */
.modal-card.detail-card { width: min(100%, 560px); padding: 0; gap: 0; max-height: calc(100vh - 32px); overflow-y: auto; }
.detail-cover { aspect-ratio: 16 / 8; }
.detail-card .modal-close { z-index: 3; background: rgba(255,255,255,.9); }
.detail-cover { cursor: default; }
.detail-body { display: grid; gap: 12px; padding: 18px 24px 22px; }
.detail-body h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.detail-body > p { margin: 0; color: var(--muted); }
.detail-facts { margin: 0; display: grid; gap: 8px; }
.detail-facts div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; font-size: 14px; padding-top: 8px; border-top: 1px solid var(--line); }
.detail-facts dt { color: var(--muted); }
.detail-facts dd { margin: 0; }
@media (max-width: 559px) { .detail-facts div { grid-template-columns: 1fr; gap: 2px; } }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.detail-actions .button-primary { flex: 1; }

/* Buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px; transition: background .15s, transform .15s;
}
.button-primary { background: var(--brand); color: var(--brand-ink); }
.button-primary:hover { background: #0b5853; }
.button-soft { background: var(--brand-soft); color: var(--brand); }
.button-soft:hover { background: var(--brand); color: #fff; }
.button-primary:disabled { opacity: .6; cursor: progress; }
.button-secondary { background: var(--surface); border-color: var(--line); }
.button-secondary:hover { border-color: var(--brand); color: var(--brand); }
.button-ghost { height: 36px; padding: 0 12px; background: none; color: var(--muted); font-weight: 500; }
.button-ghost:hover { background: var(--surface-2); color: var(--ink); }

/* Footer */
.site-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  padding-top: 24px; padding-bottom: 32px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13px;
}

/* Viewer */
.viewer { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: var(--bg); }
.viewer-bar {
  display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 12px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.viewer-bar button {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px;
  border: 0; border-radius: 999px; background: none; font-weight: 500; font-size: 14px; color: var(--ink);
}
.viewer-bar button:hover { background: var(--surface-2); }
.viewer-bar svg { width: 18px; height: 18px; }
.viewer-back { font-weight: 600 !important; }
.viewer-back span:first-child { font-size: 18px; }
.viewer-title { flex: 1; min-width: 0; text-align: center; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-actions { display: flex; gap: 2px; }
.viewer iframe { flex: 1; width: 100%; border: 0; background: #fff; }
body.no-scroll { overflow: hidden; }
@media (max-width: 559px) { .hide-sm { display: none; } .viewer-bar button { padding: 0 10px; } .viewer-bar { gap: 4px; padding: 0 6px; } }

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(20, 28, 25, .45); backdrop-filter: blur(4px);
}
.modal-card {
  position: relative; width: min(100%, 380px); padding: 28px; border-radius: 20px;
  background: var(--surface); box-shadow: 0 24px 60px rgba(0,0,0,.2); display: grid; gap: 14px;
}
.modal-card h2 { margin: 0; font-size: 22px; }
.modal-card p { margin: 0; color: var(--muted); font-size: 15px; }
.modal-close {
  position: absolute; right: 12px; top: 12px; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: none; font-size: 22px; color: var(--muted);
}
.modal-close:hover { background: var(--surface-2); }
.modal-card input, .field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  padding: 11px 13px; font-size: 15px; transition: border-color .15s, box-shadow .15s;
}
.modal-card input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 110, 104, .16);
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 70; transform: translate(-50%, 20px);
  padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 30px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Admin */
.admin-page { padding-top: 40px; padding-bottom: 64px; }
.admin-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.admin-head h1 { margin: 0; font-size: clamp(30px, 4vw, 40px); font-weight: 800; letter-spacing: -.03em; }
.admin-head p { margin: 6px 0 0; color: var(--muted); }
.admin-stats { display: flex; gap: 10px; }
.admin-stats div { min-width: 92px; padding: 10px 14px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.admin-stats strong { display: block; font-size: 22px; line-height: 1.1; }
.admin-stats span { font-size: 12px; color: var(--muted); }
.admin-layout { display: grid; gap: 20px; align-items: start; }
@media (min-width: 960px) { .admin-layout { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); } }
.panel { padding: 22px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panel-head h2 { margin: 0; font-size: 20px; }
.upload-zones { display: grid; gap: 12px; grid-template-columns: 1fr; margin-bottom: 18px; }
@media (min-width: 560px) { .upload-zones { grid-template-columns: 1.4fr 1fr; } }
.drop-zone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 140px; padding: 18px; border: 1.5px dashed #cfcabd; border-radius: 14px; background: var(--bg);
  text-align: center; cursor: pointer; overflow: hidden; transition: border-color .15s, background .15s;
}
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--brand); background: var(--brand-soft); }
.drop-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-zone strong { font-size: 15px; max-width: 100%; overflow-wrap: anywhere; }
.drop-zone > span:not(.drop-icon) { font-size: 13px; color: var(--muted); }
.drop-icon { padding: 4px 8px; margin-bottom: 4px; border-radius: 6px; background: var(--surface); font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--brand); box-shadow: var(--shadow); }
.drop-zone.has-file { border-style: solid; border-color: var(--brand); }
.drop-zone img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .25; }
.drop-zone.has-image > * { position: relative; }
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 559px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field-wide { grid-column: 1 / -1; }
.field textarea { resize: vertical; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-top: 22px; }
.segmented { display: flex; padding: 3px; border-radius: 999px; background: var(--surface-2); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; padding: 7px 13px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--muted); cursor: pointer; }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(30,42,38,.12); }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); }

.managed-list { display: grid; gap: 4px; }
.managed-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; }
.managed-item:hover { background: var(--bg); }
.managed-thumb { flex: none; width: 56px; height: 40px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: var(--lang-bg, var(--surface-2)); color: var(--lang, var(--muted)); font-size: 12px; font-weight: 700; }
.managed-thumb img { width: 100%; height: 100%; object-fit: cover; }
.managed-copy { flex: 1; min-width: 0; display: grid; }
.managed-copy strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.managed-copy span { font-size: 13px; color: var(--muted); }
.managed-actions { display: flex; }
.managed-actions button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; color: var(--muted); display: grid; place-items: center; }
.managed-actions button:hover { background: var(--surface-2); color: var(--ink); }
.managed-actions .delete:hover { color: var(--danger); }
.managed-actions svg { width: 17px; height: 17px; }
.managed-empty { padding: 32px 12px; text-align: center; color: var(--muted); font-size: 14px; }
.lang-en { --lang: var(--en); --lang-bg: var(--en-bg); }
.lang-es { --lang: var(--es); --lang-bg: var(--es-bg); }
.lang-it { --lang: var(--it); --lang-bg: var(--it-bg); }
.lang-de { --lang: var(--de); --lang-bg: var(--de-bg); }
.detail-cover .cover-focus { display: none; }

.cat-picker { border: 0; padding: 0; margin: 0; min-width: 0; }
.cat-picker legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.cat-options { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-option input { position: absolute; opacity: 0; }
.cat-option span {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 500; cursor: pointer;
}
.cat-option svg { width: 16px; height: 16px; }
.cat-option input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.cat-option input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
