/* The Crow's Forge - Vault frontend theme. Crimson/dark, distinct from the Manager's own gold theme on purpose -
   this is the customer-facing brand, not the admin tool. See vault_template/README.md for how to redesign this
   safely without touching main.py/data.py. */

@font-face { font-family: "Rajdhani"; src: url("/static/fonts/rajdhani/Rajdhani-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Rajdhani"; src: url("/static/fonts/rajdhani/Rajdhani-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/static/fonts/inter/Inter-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/static/fonts/inter/Inter-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/static/fonts/inter/Inter-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/static/fonts/inter/Inter-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #0a0908;
  --panel: #161211;
  --panel-hi: #1e1917;
  --text: #ece7e0;
  --muted: #96897d;
  --line: #2c2523;
  --crimson: #c8192c;
  --crimson-hi: #e42438;
  --crimson-dim: #5c1319;
  --ink: #150c0d;
}
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--crimson-dim) transparent; }
/* scrollbars in the theme: slim, a dark track, a dim-crimson thumb that lights up on hover */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--crimson-dim); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--crimson); }
::-webkit-scrollbar-corner { background: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text); margin: 0;
  font-family: "Inter", -apple-system, "Segoe UI", Arial, sans-serif;
  position: relative;
}
h1, h2, h3, .display {
  font-family: "Rajdhani", "Inter", sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
}
a { color: inherit; }
.muted { color: var(--muted); }
.icon { width: 16px; height: 16px; flex: none; }

/* ---------------------------------------------------------------- background effects (the "old CRT" look) */
.bg-effects {
  position: fixed;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.noise-layer {
  position: absolute;
  inset: -50px;
  opacity: 0.25; /* <--- <adjust> for effect control */
  mix-blend-mode: screen;
  background: url('/static/noise.svg') repeat;
}

.light-sweep {
  position: absolute;
  top: -20%;
  left: -20%;
  width: 70%;
  height: 70%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 25, 44, 0.35) 0%, rgba(200, 25, 44, 0) 70%);
  filter: blur(40px);
}

.scanlines {
  position: absolute;
  inset: 0;

  background: linear-gradient(
    to bottom,
    rgba(18, 16, 16, 0) 50%,
    rgba(0, 0, 0, 0.3) 50% /* <--- 0,0,0,<adjust> for effect control */
  );
  background-size: 100% 3px;
  animation: scanline-scroll 1s linear infinite; /* <adjust>s for effect control */
}

/* Animations */
@keyframes scanline-scroll {
  0%   { background-position: 0 0; }
  100% { background-position: 0 6px; }
}

@keyframes noise-jitter {
  0%   { transform: translate(0, 0); }
  10%  { transform: translate(-5px, -10px); }
  20%  { transform: translate(-15px, 5px); }
  30%  { transform: translate(7px, -25px); }
  40%  { transform: translate(-5px, 25px); }
  50%  { transform: translate(-15px, 10px); }
  60%  { transform: translate(15px, 0); }
  70%  { transform: translate(0, 15px); }
  80%  { transform: translate(-15px, -5px); }
  90%  { transform: translate(10px, 5px); }
  100% { transform: translate(0, 0); }
}

@keyframes light-sweep {
  0%   { transform: translate(-20%, -20%) scale(1); opacity: 0.15; }
  33%  { transform: translate(10%, -10%) scale(1.1); opacity: 0.25; }
  66%  { transform: translate(-5%, 15%) scale(0.9); opacity: 0.2; }
  100% { transform: translate(-20%, -20%) scale(1); opacity: 0.15; }
}

/* Animation utility classes */
.animate-noise {
  animation: noise-jitter 0.20s steps(1) infinite; /* <adjust>s for effect control */
}

.animate-light-sweep {
  animation: light-sweep 15s ease-in-out infinite;
}

/* ---------------------------------------------------------------- generic fallback (error page) */
.card { position: relative; z-index: 1; max-width: 560px; margin: 80px auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; }
.card .error { color: var(--crimson-hi); }

/* ---------------------------------------------------------------- language switcher (shared) */
.lang-switch { display: flex; gap: 14px; margin-top: 28px; }
.lang-code {
  font-family: "Rajdhani", sans-serif; font-weight: 700; font-size: 13px; letter-spacing: 0.06em;
  color: var(--muted); text-decoration: none; padding: 2px 4px; border-bottom: 2px solid transparent;
}
.lang-code:hover { color: var(--text); }
.lang-code.is-active { color: var(--crimson-hi); border-color: var(--crimson-hi); }

/* ================================================================== LOGIN PAGE */
.login-page { position: relative; min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 460px) 1fr; }
.login-panel { background: var(--bg); z-index:3; display: flex; flex-direction: column; justify-content: center; padding: 48px; position: relative; }
.login-panel-inner { max-width: 340px; margin: 0 auto; width: 100%; }
.login-logo { width: 56px; height: 56px; object-fit: contain; margin-bottom: 20px; border-radius: 50%; }
.login-title { font-size: 30px; margin: 0 0 8px; color: var(--text); }
.login-subtitle { color: var(--muted); font-size: 13px; letter-spacing: 0.08em; margin: 0 0 28px; }
.banner-error {
  background: rgba(200, 25, 44, 0.12); border: 1px solid var(--crimson-dim); color: #ff9aa4;
  border-radius: 8px; padding: 10px 14px; font-size: 12px; letter-spacing: 0.03em; margin-bottom: 18px;
}
.login-form { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }
.login-form input[type=text] {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 13px 14px;
  color: var(--text); font-size: 15px; font-family: "Inter", sans-serif;
}
.login-form input[type=text]:focus { outline: none; border-color: var(--crimson); box-shadow: 0 0 0 3px rgba(200, 25, 44, 0.2); }
.login-form input.has-error { border-color: var(--crimson); }
.btn-validate {
  margin-top: 10px; background: var(--crimson); border: 0; border-radius: 8px; padding: 13px 18px;
  font-family: "Rajdhani", sans-serif; font-weight: 700; letter-spacing: 0.06em; font-size: 15px;
  color: #fff; cursor: pointer; text-transform: uppercase;
}
.btn-validate:hover { background: var(--crimson-hi); }
.login-wordmark {
  position: absolute; bottom: 20px; right: 28px; font-family: "Rajdhani", sans-serif; font-weight: 700;
  font-size: 12px; letter-spacing: 0.1em; color: var(--muted);
}
.login-hero { position: relative; background: #050505 center/cover no-repeat; }
.login-hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to right, var(--bg) 0%, rgba(10, 9, 8, 0) 18%), linear-gradient(to top, rgba(10,9,8,0.4), rgba(10,9,8,0));
}
@media (max-width: 860px) {
  .login-page { grid-template-columns: 1fr; }
  .login-hero { min-height: 260px; order: -1; }
  .login-wordmark { position: static; text-align: center; margin-top: 24px; }
}

/* ================================================================== VAULT DASHBOARD */
/* The page is exactly one screen tall: a top bar, then the sidebar (folder tree that scrolls ON ITS OWN, with the
   filters + "authorized as" panel pinned under it - never overlapping it) and the main area (scrolls on its own too). */
.dash { position: relative; z-index: 1; height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.dash-topbar {
  flex: none; display: flex; align-items: center; gap: 24px; padding: 14px 28px; border-bottom: 1px solid var(--line);
  background: rgba(20, 17, 16, 0.7);
}
.dash-brand { display: flex; align-items: center; gap: 10px; }
.dash-logo { width: 28px; height: 28px; object-fit: contain; border-radius: 50%; }
.dash-wordmark { font-family: "Rajdhani", sans-serif; font-weight: 700; letter-spacing: 0.06em; font-size: 14px; }
.dash-breadcrumb { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; letter-spacing: 0.06em; font-weight: 600; flex-wrap: wrap; }
.dash-breadcrumb .crumb { cursor: pointer; text-transform: uppercase; }
.dash-breadcrumb .crumb:hover { color: var(--text); }
.dash-breadcrumb .crumb.is-active { color: var(--crimson-hi); cursor: default; }
.dash-breadcrumb .crumb-sep { color: var(--line); }
.dash-logout {
  margin-left: auto; display: flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line);
  border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; white-space: nowrap;
}
.dash-studio + .dash-logout { margin-left: 8px; }          /* the "Studio" button (for customers who came in through it) sits left of Log out */
.dash-logout.dash-studio { margin-left: auto; }
.login-alt { margin: 18px 0 0; text-align: center; font-size: 0.82rem; }
.login-alt a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.login-alt a:hover { color: var(--text); border-bottom-color: var(--crimson); }
.dash-logout:hover { color: var(--text); border-color: var(--crimson-dim); background: rgba(200, 25, 44, 0.1); }
.hamburger-btn {
  display: none; width: 38px; height: 38px; flex: none; padding: 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.hamburger-btn span { display: block; width: 16px; height: 2px; background: var(--text); border-radius: 1px; }
.hamburger-btn:hover { border-color: var(--crimson-dim); }
.sidebar-backdrop { display: none; }

.dash-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px 1fr; }
.dash-sidebar {
  display: flex; flex-direction: column; min-height: 0; background: rgba(15, 12, 11, 0.5); border-right: 1px solid var(--line);
}
.tree { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 10px; }
.dash-footer { flex: none; padding: 14px 14px 16px; border-top: 1px solid var(--line); background: rgba(10, 9, 8, 0.7); }
.dash-main { min-width: 0; min-height: 0; overflow-y: auto; padding: 24px 28px; }
.empty-vault { text-align: center; margin-top: 80px; color: var(--muted); }
.empty-vault .empty-icon { width: 48px; height: 48px; margin-bottom: 12px; }
.empty-vault p { margin: 6px 0; }
.empty-vault .empty-order { margin-top: 14px; color: var(--text); }
.empty-vault .empty-btn { display: inline-block; margin: 0 0 0 8px; padding: 8px 20px; font-size: 14px; text-decoration: none; vertical-align: middle; }

/* ---- the filters panel (language + tag toggles, item count) */
.filter-group { margin-bottom: 14px; }
.filter-title { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; margin-bottom: 8px; }
.switch { position: relative; display: inline-block; width: 30px; height: 17px; flex: none; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch .slider { position: absolute; inset: 0; background: var(--panel-hi); border: 1px solid var(--line); border-radius: 17px; transition: background 0.15s ease, border-color 0.15s ease; }
.switch .slider::before {
  content: ""; position: absolute; width: 11px; height: 11px; left: 2px; top: 2px; border-radius: 50%; background: var(--muted);
  transition: transform 0.15s ease, background 0.15s ease;
}
.switch input:checked + .slider { background: var(--crimson-dim); border-color: var(--crimson); }
.switch input:checked + .slider::before { transform: translateX(13px); background: var(--crimson-hi); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px rgba(200, 25, 44, 0.3); }
/* languages: ALL on one row, each in its own small square - the flag, then the switch underneath, both centered */
.lang-toggles { display: flex; flex-wrap: nowrap; gap: 6px; }
.lang-toggle {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 9px 4px;
  cursor: pointer; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
}
.lang-toggle:hover { border-color: var(--crimson-dim); }
.lang-flag svg { display: block; width: 22px; height: 15px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12); }
/* tag toggles (on each folder page): the switch left, the name right */
.tag-toggle {
  flex: 0 0 auto; min-width: 0; display: flex; align-items: center; justify-content: flex-start; gap: 8px; cursor: pointer;
  font-size: 12px; color: var(--text); padding: 7px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
}
.tag-toggle:hover { border-color: var(--crimson-dim); }
.tag-toggle-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* the UI-language links: the full width, equal shares, centered, a thin divider between neighbours (EN | DE | IT ...) */
.dash-footer-actions { display: flex; align-items: stretch; width: 100%; }
.footer-lang {
  flex: 1 1 0; min-width: 0; text-align: center; padding: 6px 0; font-size: 11px; font-weight: 700; color: var(--muted);
  text-decoration: none; letter-spacing: 0.04em;
}
.footer-lang + .footer-lang { border-left: 1px solid var(--line); }
.footer-lang.is-active { color: var(--crimson-hi); }
.footer-lang:hover { color: var(--text); }

/* ---- a folder page's tag toggles: one row of switches; when they do not all fit, a collapse / expand bar */
.tag-bar { margin: 0 0 18px; }
.tag-bar-head {
  display: none; width: 100%; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; color: var(--text); font-family: inherit;
}
.tag-bar-head:hover { border-color: var(--crimson-dim); }
.tag-bar-title { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }
.tag-bar-count { font-size: 11px; color: var(--muted); margin-left: auto; }
.tag-bar-chevron { color: var(--muted); transition: transform 0.15s ease; }
.tag-bar.is-open .tag-bar-chevron { transform: rotate(90deg); }
.tag-bar-list { display: flex; flex-wrap: nowrap; gap: 6px; overflow: hidden; }
.tag-bar .tag-toggle { flex: 0 0 auto; }
.tag-bar.is-collapsible .tag-bar-head { display: flex; }
.tag-bar.is-collapsible .tag-bar-list { display: none; flex-wrap: wrap; overflow: visible; margin-top: 8px; }
.tag-bar.is-collapsible.is-open .tag-bar-list { display: flex; }

/* ---- "there are files, just not in the language(s) you have switched on" */
.lang-notice {
  display: flex; align-items: center; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; margin: 0 0 18px; padding: 16px 18px;
  background: var(--panel); border: 1px solid var(--crimson-dim); border-radius: 10px;
}
.lang-notice.is-hidden { display: none; }
.lang-notice p { margin: 0; flex: 1 1 280px; font-size: 13px; line-height: 1.5; color: var(--text); }
.lang-notice-btn { margin-top: 0; flex: none; }

/* sidebar: folders only, no files - single click selects (and shows in the main area), same as Explorer */
.sidebar-folder {
  cursor: pointer; padding: 7px 6px; border-radius: 6px; display: flex; align-items: center; gap: 6px;
}
.sidebar-folder:hover { background: var(--panel-hi); }
.sidebar-folder.is-active { background: rgba(200, 25, 44, 0.18); }
.sidebar-folder .chevron-toggle { display: flex; align-items: center; justify-content: center; width: 12px; height: 12px; cursor: pointer; flex: none; }
.sidebar-folder .chevron-toggle.is-empty { visibility: hidden; cursor: default; }
.sidebar-folder .chevron-toggle .chevron { color: var(--muted); width: 12px; height: 12px; transition: transform 0.15s ease; }
.sidebar-node:not(.is-collapsed) > .sidebar-folder .chevron-toggle .chevron { transform: rotate(90deg); }
.sidebar-node.is-collapsed > .sidebar-children { display: none; }
.sidebar-folder .folder-icon { color: var(--crimson-hi); width: 15px; height: 15px; }
.sidebar-folder .folder-name { font-size: 13px; }

/* ---- main content: the one open folder - its header, its subfolders (cards) and its files (cards, twice as wide) */
.folder-view.is-hidden { display: none; }

/* the folder's header: banner image with the title + subtitle on it (the same look as the Studio catalog's hero) */
.folder-hero {
  position: relative; margin: -24px -28px 14px; min-height: 290px; display: flex; align-items: flex-end; overflow: hidden;
}
/* the picture dissolves into the page at the bottom through a cloudy, noise-displaced mask (no straight edge or gradient line);
   the top and the sides stay solid. The mask is an SVG: a vertical fade, roughened by feTurbulence + feDisplacementMap - a fixed
   1600 x 290 picture that is never stretched sideways, so the clouds are round puffs rather than long smears. */
.folder-hero-media {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 290' preserveAspectRatio='none'%3E%3Cdefs%3E%3Cfilter id='c' filterUnits='userSpaceOnUse' x='-400' y='-300' width='2400' height='900'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.011' numOctaves='4' seed='11' result='n'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='n' scale='110' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3ClinearGradient id='g' gradientUnits='userSpaceOnUse' x1='0' y1='0' x2='0' y2='290'%3E%3Cstop offset='0.5' stop-color='black'/%3E%3Cstop offset='0.92' stop-color='black' stop-opacity='0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect x='-300' y='-250' width='2200' height='800' fill='url(%23g)' filter='url(%23c)'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 290' preserveAspectRatio='none'%3E%3Cdefs%3E%3Cfilter id='c' filterUnits='userSpaceOnUse' x='-400' y='-300' width='2400' height='900'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.011' numOctaves='4' seed='11' result='n'/%3E%3CfeDisplacementMap in='SourceGraphic' in2='n' scale='110' xChannelSelector='R' yChannelSelector='G'/%3E%3C/filter%3E%3ClinearGradient id='g' gradientUnits='userSpaceOnUse' x1='0' y1='0' x2='0' y2='290'%3E%3Cstop offset='0.5' stop-color='black'/%3E%3Cstop offset='0.92' stop-color='black' stop-opacity='0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect x='-300' y='-250' width='2200' height='800' fill='url(%23g)' filter='url(%23c)'/%3E%3C/svg%3E");
  -webkit-mask-size: max(100%, 1600px) 100%; mask-size: max(100%, 1600px) 100%;
  -webkit-mask-position: center top; mask-position: center top; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.folder-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(0deg, rgba(10, 9, 8, 0.5) 0%, rgba(10, 9, 8, 0.25) 50%, rgba(10, 9, 8, 0.08) 100%);
}
.folder-hero-content { position: relative; z-index: 1; padding: 32px 28px; max-width: 720px; }
.folder-hero-content h1 { font-size: 2.2rem; margin: 0 0 8px; line-height: 1.1; }
.folder-hero-content p { margin: 0; color: rgba(236, 231, 224, 0.78); font-size: 1rem; max-width: 560px; }
.folder-hero.is-plain { margin: 0 0 22px; min-height: 0; display: block; background: none; }
.folder-hero.is-plain .folder-hero-content { padding: 0; }

.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.folder-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0; overflow: hidden;
  display: flex; flex-direction: row; align-items: stretch; cursor: pointer;
  font-family: inherit; text-align: left; color: var(--text);
}
.folder-card:hover { border-color: var(--crimson-dim); background: var(--panel-hi); }
.folder-card-body { flex: 1; min-height: 150px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 20px 16px; }
.folder-card-icon { width: 26px; height: 26px; color: var(--crimson-hi); }
.folder-card-name { font-family: "Rajdhani", sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 13px; }
.folder-card-meta { font-size: 11px; color: var(--muted); }
/* a folder with a preview picture: TWICE the width, the picture filling the left half (shown whole, never cropped) */
.folder-card.has-preview { grid-column: span 2; position: relative; min-height: 170px; }
.folder-card.has-preview .folder-card-body { margin-left: 50%; }
/* the picture fills the whole left half edge to edge - no padding, no bars (it is cropped to fit rather than letterboxed) */
.folder-card-preview {
  position: absolute; left: 0; top: 0; bottom: 0; width: 50%; height: 100%; margin: 0; padding: 0; display: block;
  object-fit: cover; object-position: center; border-right: 1px solid var(--line);
}

.file-list { display: flex; flex-direction: column; }
/* file cards sit on a grid of half-width units: a plain card takes 2, a card with a preview picture 1.5x as much (3) - so pictures cost a
   file only half a card more, where a folder's picture doubles its card */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; margin-bottom: 8px; }
.file-card {
  grid-column: span 2; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; min-height: 124px;
  display: flex; flex-direction: row; min-width: 0; overflow: hidden;
}
.file-card.has-preview { grid-column: span 3; }
.file-body { flex: 1; min-width: 0; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.file-card:hover { border-color: var(--crimson-dim); background: var(--panel-hi); }
.file-card.is-hidden { display: none; }
/* a file with a preview picture: a SQUARE picture on the left that is as tall as the card (a neighbour's two-line name makes the whole row
   taller) and as wide as it is tall, so it always covers its whole area - the picture is scaled up from the centre and trimmed on every side */
.file-thumb { position: relative; flex: none; display: block; align-self: stretch; aspect-ratio: 1 / 1; min-width: 124px; overflow: hidden; background: var(--panel-hi); border-right: 1px solid var(--line); }
.file-thumb img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; transition: transform 0.25s ease; }
.file-card.has-preview:hover .file-thumb img { transform: scale(1.04); }
.file-link { color: var(--text); text-decoration: none; font-size: 13px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.file-link:hover { color: var(--crimson-hi); }
.file-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 10px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 20px; padding: 1px 8px; white-space: nowrap;
}
/* the download button: full width along the bottom, deliberately quiet until hovered */
.file-download {
  margin-top: auto; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-hi); color: var(--muted); text-decoration: none;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.file-download:hover { color: var(--text); border-color: var(--crimson-dim); background: rgba(200, 25, 44, 0.12); }
.language-group { margin: 14px 0 6px; }
.language-group.is-hidden { display: none; }
.language-heading {
  font-size: 11px; font-weight: 700; color: var(--crimson-hi); text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 8px;
}

/* download confirmation popup */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(5, 4, 4, 0.72); padding: 20px;
}
.modal-overlay.is-hidden { display: none; }
.modal-box {
  display: flex; flex-direction: row; overflow: hidden; width: 100%; max-width: 440px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}
.modal-box.has-preview { max-width: 700px; }
/* the file's picture: left, a 320 px square (the details beside it are at least as tall); it covers its whole area from the centre, so a
   taller popup (many tags) only trims a little more off the picture */
.modal-art { position: relative; flex: none; align-self: stretch; width: 320px; overflow: hidden; background: var(--panel-hi); border-right: 1px solid var(--line); }
.modal-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.modal-art.is-hidden { display: none; }
.modal-content { flex: 1; min-width: 0; min-height: 320px; padding: 28px; display: flex; flex-direction: column; }
.modal-kicker { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; color: var(--crimson-hi); text-transform: uppercase; margin: 0 0 18px; }
.modal-field { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.modal-field-icon {
  flex: none; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 10px;
  background: var(--panel-hi); border: 1px solid var(--line); color: var(--muted);
}
.modal-field-icon .icon { width: 18px; height: 18px; }
.modal-field-icon .lang-flag svg { width: 24px; height: 16px; }
.modal-field-body { flex: 1; min-width: 0; padding-top: 1px; }
.modal-label {
  display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: var(--muted);
  text-transform: uppercase; margin-bottom: 5px;
}
.modal-value { display: block; font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--text); overflow-wrap: anywhere; }
.modal-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.modal-tags .tag { font-size: 13px; font-weight: 600; color: var(--text); padding: 4px 13px; border-color: rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.03); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: auto; padding-top: 10px; }
.btn-cancel {
  background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 11px 18px;
  font-family: "Rajdhani", sans-serif; font-weight: 700; letter-spacing: 0.06em; font-size: 14px;
  color: var(--muted); cursor: pointer; text-transform: uppercase;
}
.btn-cancel:hover { color: var(--text); border-color: var(--muted); }
.modal-actions .btn-validate { margin-top: 0; display: inline-flex; align-items: center; text-decoration: none; }

/* ---- small screens: the whole left column becomes a slide-in menu behind a hamburger, the logo sits at the left */
@media (max-width: 900px) {
  .hamburger-btn { display: flex; }
  .dash-topbar { flex-wrap: wrap; gap: 10px 12px; padding: 12px 16px; }
  .dash-brand { margin-right: auto; }
  .dash-logout, .dash-studio + .dash-logout { margin-left: 0; padding: 9px 11px; }
  .dash-logout.dash-studio { margin-left: auto; padding: 9px 11px; }
  .dash-logout-label { display: none; }
  .dash-breadcrumb { order: 10; flex-basis: 100%; }
  .dash-body { grid-template-columns: 1fr; }
  .dash-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: min(320px, 86vw); z-index: 40; background: var(--bg);
    transform: translateX(-102%); transition: transform 0.2s ease; box-shadow: 8px 0 28px rgba(0, 0, 0, 0.5);
  }
  .dash-sidebar.is-open { transform: none; }
  .sidebar-backdrop.is-open { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(5, 4, 4, 0.62); }
  .dash-main { padding: 18px 16px; }
  .folder-hero { margin: -18px -16px 12px; min-height: 220px; }
  .folder-hero-content { padding: 22px 16px; }
  .folder-hero-content h1 { font-size: 1.6rem; }
}
@media (max-width: 520px) {
  .folder-card.has-preview { grid-column: auto; }          /* one card per row already - no room to span */
  .file-grid { grid-template-columns: 1fr; }
  .file-card, .file-card.has-preview { grid-column: auto; }
  .file-card { min-height: 104px; }
  .file-thumb { min-width: 104px; }
}
@media (max-width: 680px) {                                   /* too narrow for the picture beside the details: it goes on top */
  .modal-box.has-preview { flex-direction: column; max-width: 420px; }
  .modal-art { width: 100%; height: 220px; border-right: 0; border-bottom: 1px solid var(--line); }
}
