/* ===== IRANSansWeb ===== */
@font-face {
  font-family: 'IRANSansWeb';
  src: url('fonts/IRANSansWeb_Light.woff2') format('woff2'),
       url('fonts/IRANSansWeb_Light.woff')  format('woff');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IRANSansWeb';
  src: url('fonts/IRANSansWeb.woff2') format('woff2'),
       url('fonts/IRANSansWeb.woff')  format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IRANSansWeb';
  src: url('fonts/IRANSansWeb_Medium.woff')  format('woff'),
       url('fonts/IRANSansWeb-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IRANSansWeb';
  src: url('fonts/IRANSansWeb_Bold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
/* No separate black weight ships with the project: bold is the heaviest face we expose. */
@font-face {
  font-family: 'IRANSansWeb';
  src: url('fonts/IRANSansWeb_Bold.woff') format('woff');
  font-weight: 800 950;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* Surfaces */
  --bg: #070c16;
  --bg-0: #04070d;
  --bg-soft: #0b1322;
  --panel: #0e1729;
  --panel-2: #142035;
  --panel-3: #1b2b45;

  /* Text */
  --text: #eef4ff;
  --text-soft: #cfddef;
  --muted: #96a9c6;
  --muted-2: #6b7f9e;

  /* Lines & accents */
  --border: rgba(150, 178, 214, .16);
  --border-strong: rgba(152, 192, 234, .3);
  --accent: #7cc9ff;
  --accent-2: #7ae5c4;
  --accent-3: #a78bfa;
  --danger: #ff7b94;
  --warn: #fbbf24;
  --ok: #4ade80;

  --grad-accent: linear-gradient(135deg, #7cc9ff, #7ae5c4);
  --grad-accent-soft: linear-gradient(135deg, rgba(124, 201, 255, .16), rgba(122, 229, 196, .12));
  --grad-hairline: linear-gradient(150deg, rgba(138, 206, 255, .46), rgba(122, 229, 196, .2) 44%, rgba(255, 255, 255, .05));
  --grad-glass: linear-gradient(162deg, rgba(255, 255, 255, .062), rgba(255, 255, 255, .014));

  --ring: 0 0 0 4px rgba(124, 201, 255, .13);
  --shadow-sm: 0 8px 22px -14px rgba(0, 0, 0, .9);
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, .95);
  --shadow-accent: 0 18px 40px -18px rgba(106, 206, 236, .75);

  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.2, .8, .25, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }

body.popup {
  direction: rtl;
  text-align: right;
  font-family: "IRANSansWeb", "Vazirmatn", "IRANSans", "Segoe UI", Tahoma, sans-serif;
  font-weight: 400;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(120% 95% at 50% -12%, #101c2f 0%, #070c16 52%, var(--bg-0) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Ambient aurora behind every surface */
body.popup::before {
  content: '';
  position: fixed;
  inset: -25% -15%;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(34% 38% at 10% 2%, rgba(56, 132, 255, .3), transparent 64%),
    radial-gradient(30% 34% at 94% 4%, rgba(45, 212, 191, .2), transparent 62%),
    radial-gradient(36% 40% at 78% 100%, rgba(139, 92, 246, .18), transparent 64%),
    radial-gradient(42% 46% at 18% 96%, rgba(34, 211, 238, .14), transparent 62%);
  animation: auroraDrift 28s var(--ease) infinite alternate;
}

/* Faint technical grid, faded out with a radial mask */
body.popup::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(146, 186, 226, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(146, 186, 226, .05) 1px, transparent 1px);
  background-size: 46px 46px, 46px 46px;
  mask-image: radial-gradient(85% 70% at 50% 26%, #000 12%, transparent 88%);
  -webkit-mask-image: radial-gradient(85% 70% at 50% 26%, #000 12%, transparent 88%);
}

button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
::selection { background: rgba(124, 201, 255, .32); color: #fff; }
:focus-visible { outline: 2px solid rgba(124, 201, 255, .7); outline-offset: 2px; }
.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; }

/* No z-index here: keeping .app out of a stacking context lets the toast and the admin dialog
   keep their original root-level layering (toast 999 above dialog 100). */
.app { position: relative; display: flex; flex-direction: column; min-height: 100vh; }

/* ===== Top bar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px clamp(16px, 3vw, 34px);
  border-bottom: 1px solid rgba(150, 178, 214, .1);
  background: linear-gradient(180deg, rgba(9, 14, 25, .93), rgba(9, 14, 25, .74));
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.topbar::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(124, 201, 255, .55), rgba(122, 229, 196, .4), transparent);
  opacity: .75;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: #04121d;
  background: var(--grad-accent);
  box-shadow: 0 12px 28px -10px rgba(106, 206, 236, .8), inset 0 1px 0 rgba(255, 255, 255, .55);
}
.logo::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 20px;
  background: var(--grad-accent);
  opacity: .22;
  filter: blur(12px);
  z-index: -1;
  animation: logoPulse 4.5s ease-in-out infinite;
}
.logo svg { position: relative; z-index: 1; width: 21px; height: 21px; stroke-width: 1.9; }
.brand-text { min-width: 0; }
.brand h1 {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  font-weight: 800;
  letter-spacing: -.3px;
  background: linear-gradient(115deg, #f4f9ff 12%, #b6dcff 58%, #93efdd);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #eaf4ff;
}
.brand-text p { margin: 1px 0 0; max-width: min(46vw, 650px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.muted { color: var(--muted); }
.tiny { font-size: 11px; line-height: 1.8; font-weight: 400; }
.small { font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.switcher-wrap { display: inline-flex; align-items: center; }

.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--grad-glass);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  line-height: 1;
  transition: transform .18s var(--ease), color .18s ease, border-color .18s ease, box-shadow .22s ease, background .22s ease;
}
.icon-btn:hover {
  color: #eaf6ff;
  border-color: var(--border-strong);
  background: rgba(124, 201, 255, .1);
  box-shadow: 0 14px 30px -16px rgba(124, 201, 255, .9), inset 0 1px 0 rgba(255, 255, 255, .08);
  transform: translateY(-1px);
}
.icon-btn:active { transform: translateY(0) scale(.95); }
.icon-btn svg { width: 18px; height: 18px; }

.file-switcher {
  max-width: min(38vw, 380px);
  min-width: 170px;
  height: 40px;
  padding: 0 12px;
  border-radius: 13px;
  border: 1px solid var(--border);
  outline: 0;
  color: var(--text-soft);
  background: var(--grad-glass), rgba(14, 23, 41, .8);
  font-size: 12px;
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .22s ease, color .2s ease;
}
.file-switcher:hover { color: var(--text); border-color: var(--border-strong); }
.file-switcher:focus { border-color: rgba(124, 201, 255, .7); box-shadow: var(--ring); }

/* ===== Layout ===== */
.main {
  flex: 1;
  width: 100%;
  max-width: 1560px;
  margin-inline: auto;
  padding: clamp(18px, 2.2vw, 30px) clamp(16px, 3vw, 34px) 34px;
  overflow-y: auto;
}

/* ===== Empty state ===== */
.empty-state { display: flex; justify-content: center; align-items: center; min-height: min(64vh, 540px); padding: 26px 0; }
.empty-card {
  position: relative;
  width: 100%;
  max-width: 580px;
  border: 1px solid transparent;
  border-radius: 26px;
  padding: 52px 30px;
  text-align: center;
  background:
    linear-gradient(165deg, rgba(20, 33, 55, .95), rgba(9, 16, 30, .96)) padding-box,
    var(--grad-hairline) border-box;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .05);
  overflow: hidden;
  animation: blockIn .5s var(--ease) both;
}
.empty-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(90% 70% at 50% -10%, rgba(124, 201, 255, .16), transparent 62%);
  pointer-events: none;
}
.empty-icon {
  position: relative;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  width: 68px;
  height: 68px;
  border-radius: 22px;
  color: var(--accent);
  border: 1px solid rgba(124, 201, 255, .24);
  background: var(--grad-accent-soft);
  box-shadow: 0 18px 40px -22px rgba(124, 201, 255, .9), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.empty-icon::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 28px;
  border: 1px solid rgba(124, 201, 255, .22);
  animation: iconPulse 3.4s ease-in-out infinite;
}
.empty-icon svg { width: 31px; height: 31px; }
.empty-card h2 { position: relative; font-size: 17.5px; margin: 0 0 10px; font-weight: 800; letter-spacing: -.2px; }
.empty-card p { position: relative; margin: 0 auto; max-width: 420px; font-size: 12.5px; line-height: 2.05; }

/* ===== Search toolbar ===== */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.search-wrap { position: relative; z-index: 0; flex: 1; min-width: 0; }
.search-wrap::before {
  content: '';
  position: absolute;
  inset: -3px;
  z-index: -1;
  border-radius: 20px;
  background: var(--grad-accent);
  filter: blur(16px);
  opacity: 0;
  transition: opacity .3s ease;
}
.search-wrap:focus-within::before { opacity: .2; }
.search-icon {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--muted-2);
  pointer-events: none;
  transition: color .2s ease, transform .2s var(--ease);
}
.search-wrap:focus-within .search-icon { color: var(--accent); transform: translateY(-50%) scale(1.06); }
.search-input {
  width: 100%;
  height: 48px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--grad-glass), rgba(10, 17, 31, .78);
  color: var(--text);
  padding: 0 44px 0 42px;
  font-size: 13.5px;
  font-weight: 500;
  outline: none;
  direction: rtl;
  text-align: right;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 12px 30px -24px rgba(0, 0, 0, .9);
  transition: border-color .2s ease, box-shadow .26s ease, background .2s ease;
}
.search-input::placeholder { color: var(--muted-2); font-weight: 400; }
.search-input:hover { border-color: var(--border-strong); }
.search-input:focus {
  border-color: rgba(124, 201, 255, .62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), var(--ring), 0 22px 44px -28px rgba(124, 201, 255, .95);
}
.search-input::-webkit-search-cancel-button { display: none; }
.clear-search {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid transparent;
  color: var(--muted);
  background: rgba(255, 255, 255, .05);
  font-size: 20px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: .18s var(--ease);
}
.clear-search:hover { color: #fff; background: rgba(255, 123, 148, .18); border-color: rgba(255, 123, 148, .4); transform: translateY(-50%) rotate(90deg); }
.result-count {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 700;
  color: #d9ecff;
  white-space: nowrap;
  background:
    linear-gradient(160deg, rgba(124, 201, 255, .16), rgba(122, 229, 196, .08)) padding-box,
    linear-gradient(135deg, rgba(124, 201, 255, .5), rgba(122, 229, 196, .3)) border-box;
  box-shadow: 0 12px 26px -20px rgba(124, 201, 255, .9);
}
.result-count::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 10px rgba(122, 229, 196, .9);
}

/* ===== Result cards ===== */
.blocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 336px), 1fr)); gap: 14px; align-items: start; }
.block {
  position: relative;
  isolation: isolate;
  min-width: 0;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 16px 18px;
  background:
    linear-gradient(165deg, rgba(23, 37, 60, .95), rgba(10, 17, 31, .97)) padding-box,
    var(--grad-hairline) border-box;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, .045);
  transition: transform .22s var(--ease), box-shadow .24s var(--ease);
  animation: blockIn .42s var(--ease) both;
}
.block::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 100% at 100% 0%, rgba(124, 201, 255, .16), transparent 58%);
  opacity: 0;
  transition: opacity .26s var(--ease);
  pointer-events: none;
}
.block::after {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 18%;
  bottom: 18%;
  width: 3px;
  border-radius: 99px;
  background: var(--grad-accent);
  opacity: 0;
  transform: scaleY(.3);
  transition: opacity .26s var(--ease), transform .26s var(--ease);
}
.block:hover {
  transform: translateY(-3px);
  box-shadow: 0 28px 50px -26px rgba(0, 0, 0, .95), 0 0 0 1px rgba(124, 201, 255, .16), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.block:hover::before { opacity: 1; }
.block:hover::after { opacity: .95; transform: scaleY(1); }

.block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.block-title {
  min-width: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: #f7fbff;
  letter-spacing: -.1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.block-badge {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 500;
  color: #a8bcd6;
  border: 1px solid rgba(150, 178, 214, .2);
  border-radius: 999px;
  padding: 3px 9px;
  background: rgba(255, 255, 255, .045);
  font-variant-numeric: tabular-nums;
}
.fields { display: grid; gap: 9px; }
.field { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; min-width: 0; }
.field-label {
  flex: 0 0 auto;
  max-width: 44%;
  font-size: 11px;
  color: var(--muted-2);
  font-weight: 500;
  line-height: 1.9;
  overflow-wrap: anywhere;
}
.field-label::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  margin-inline-end: 6px;
  vertical-align: middle;
  background: rgba(124, 201, 255, .55);
  box-shadow: 0 0 8px rgba(124, 201, 255, .55);
}
.field-value {
  min-width: 0;
  max-width: 72%;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.95;
  color: #dbe6f6;
  overflow-wrap: anywhere;
  text-align: right;
  direction: rtl;
  unicode-bidi: plaintext;
  font-variant-numeric: tabular-nums;
}
.field.empty .field-label::before { background: rgba(150, 178, 214, .3); box-shadow: none; }
.field.empty .field-value { color: #66798f; font-weight: 400; }

/* ===== Results footer / states ===== */
.results-footer { display: flex; justify-content: center; padding: 20px 0 6px; }
.no-results {
  max-width: 460px;
  margin: 6px auto 0;
  padding: 36px 22px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed rgba(150, 178, 214, .22);
  border-radius: 22px;
  background: rgba(255, 255, 255, .018);
  animation: blockIn .4s var(--ease) both;
}
.no-results::before {
  content: '';
  display: block;
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  border-radius: 15px;
  border: 1px solid rgba(124, 201, 255, .24);
  background-color: rgba(124, 201, 255, .07);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 22px 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237cc9ff' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.2-3.2'/%3E%3C/svg%3E");
}

/* ===== Buttons ===== */
.btn {
  position: relative;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 11px 16px;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  transition: transform .18s var(--ease), box-shadow .22s ease, filter .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
}
.btn.primary {
  color: #03141f;
  background: var(--grad-accent);
  box-shadow: var(--shadow-accent), inset 0 1px 0 rgba(255, 255, 255, .55);
}
.btn.primary:hover { transform: translateY(-1px); filter: brightness(1.07) saturate(1.05); }
.btn.primary:active { transform: translateY(0) scale(.985); filter: brightness(.98); }
.btn.ghost { color: var(--text-soft); background: var(--grad-glass); border-color: var(--border); }
.btn.ghost:hover { color: #fff; border-color: var(--border-strong); background: rgba(124, 201, 255, .1); transform: translateY(-1px); }
.btn.ghost:active { transform: translateY(0) scale(.985); }
.btn.small { padding: 9px 13px; font-size: 11.5px; border-radius: 12px; }
.btn svg { width: 15px; height: 15px; }

/* ===== Status bar ===== */
.statusbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(16px, 3vw, 34px);
  border-top: 1px solid rgba(150, 178, 214, .1);
  background: linear-gradient(0deg, rgba(9, 14, 25, .92), rgba(9, 14, 25, .7));
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}
.statusbar::before {
  content: '';
  position: absolute;
  inset-inline: 0;
  top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(122, 229, 196, .45), rgba(124, 201, 255, .5), transparent);
  opacity: .7;
}
.statusbar #statusText { display: inline-flex; align-items: center; gap: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.statusbar #statusText::before {
  content: '';
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(122, 229, 196, .14);
  animation: dotBlink 2.6s ease-in-out infinite;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  right: 50%;
  bottom: 24px;
  transform: translateX(50%);
  max-width: calc(100vw - 30px);
  color: #04141d;
  font-size: 12.5px;
  line-height: 1.85;
  font-weight: 700;
  padding: 11px 18px;
  border-radius: 15px;
  background: var(--grad-accent);
  box-shadow: 0 24px 55px -22px rgba(106, 206, 236, .95), inset 0 1px 0 rgba(255, 255, 255, .5);
  z-index: 999;
  animation: toastIn .26s var(--ease);
  text-align: center;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(50%) translateY(12px) scale(.96); }
  to { opacity: 1; transform: translateX(50%) translateY(0) scale(1); }
}

/* ===== Shared keyframes ===== */
@keyframes auroraDrift {
  from { transform: translate3d(-1.5%, -1%, 0) scale(1); }
  to { transform: translate3d(2.5%, 2%, 0) scale(1.08); }
}
@keyframes logoPulse {
  0%, 100% { opacity: .16; }
  50% { opacity: .34; }
}
@keyframes iconPulse {
  0%, 100% { transform: scale(1); opacity: .45; }
  50% { transform: scale(1.12); opacity: .1; }
}
@keyframes dotBlink {
  0%, 100% { opacity: .45; }
  50% { opacity: 1; }
}
@keyframes blockIn {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
/* Stagger only the first cards of each appended batch so long lists stay snappy. */
.blocks > .block:nth-child(-n + 10) { animation-delay: calc(var(--stagger, .04s) * var(--i, 0)); }
.blocks > .block:nth-child(1) { --i: 0; } .blocks > .block:nth-child(2) { --i: 1; }
.blocks > .block:nth-child(3) { --i: 2; } .blocks > .block:nth-child(4) { --i: 3; }
.blocks > .block:nth-child(5) { --i: 4; } .blocks > .block:nth-child(6) { --i: 5; }
.blocks > .block:nth-child(7) { --i: 6; } .blocks > .block:nth-child(8) { --i: 7; }
.blocks > .block:nth-child(9) { --i: 8; } .blocks > .block:nth-child(10) { --i: 9; }

/* ===== Animated full-screen startup splash ===== */
.splash-screen {
  position: fixed;
  z-index: 2000;
  inset: 0;
  display: grid;
  place-items: center;
  min-height: 100vh;
  overflow: hidden;
  isolation: isolate;
  color: var(--text);
  background:
    radial-gradient(ellipse at 50% 38%, rgba(52, 116, 160, .26), transparent 38%),
    radial-gradient(ellipse at 12% 92%, rgba(63, 205, 178, .14), transparent 34%),
    radial-gradient(ellipse at 88% 6%, rgba(79, 158, 232, .2), transparent 32%),
    #05080f;
  opacity: 1;
  visibility: visible;
  transition: opacity .52s ease, visibility .52s ease;
}
.splash-screen.is-leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash-grid {
  position: absolute;
  inset: -10%;
  z-index: -1;
  opacity: .16;
  background-image:
    linear-gradient(rgba(137, 190, 224, .14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(137, 190, 224, .14) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at center, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 0%, transparent 72%);
  animation: splashGridDrift 18s linear infinite;
}
.splash-ambient { position: absolute; z-index: -1; width: 380px; height: 380px; border-radius: 50%; filter: blur(80px); opacity: .2; pointer-events: none; }
.splash-ambient-one { top: -190px; right: -100px; background: #329be9; animation: splashAmbientFloat 7s ease-in-out infinite alternate; }
.splash-ambient-two { bottom: -230px; left: -110px; background: #30d8b1; animation: splashAmbientFloat 8s ease-in-out infinite alternate-reverse; }
.splash-content { position: relative; width: min(470px, calc(100vw - 34px)); display: flex; flex-direction: column; align-items: center; text-align: center; padding: 25px 18px 35px; animation: splashContentIn .85s cubic-bezier(.2, .75, .25, 1) both; }
.splash-art { position: relative; width: min(252px, 64vw); aspect-ratio: 1; display: grid; place-items: center; margin-bottom: 6px; }
.splash-art::before {
  content: '';
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(131, 215, 255, 0), rgba(131, 215, 255, .4), rgba(122, 229, 196, .32), rgba(167, 139, 250, .18), rgba(131, 215, 255, 0));
  filter: blur(30px);
  opacity: .55;
  animation: splashRingRotate 11s linear infinite;
  pointer-events: none;
}
.splash-illustration { position: relative; z-index: 2; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 18px 38px rgba(0, 0, 0, .32)); animation: splashIllustrationFloat 4.5s ease-in-out infinite; }
.splash-document { transform-origin: 110px 110px; animation: splashDocumentTilt 5.5s ease-in-out infinite; }
.splash-floating-tile { transform-origin: 170px 122px; animation: splashTileFloat 3.5s ease-in-out infinite; }
.splash-floating-mini { transform-origin: 45px 117px; animation: splashMiniFloat 4s ease-in-out infinite; }
.splash-art-ring { position: absolute; border: 1px solid rgba(126, 210, 239, .19); border-radius: 50%; }
.splash-ring-one { inset: 8%; animation: splashRingPulse 4s ease-in-out infinite; }
.splash-ring-two { inset: -2%; border-style: dashed; border-color: rgba(126, 210, 239, .18); animation: splashRingRotate 28s linear infinite; }
.splash-orbit-dot { position: absolute; z-index: 3; width: 7px; height: 7px; border-radius: 50%; background: #89e7da; box-shadow: 0 0 20px rgba(121, 226, 204, .9); }
.splash-dot-one { top: 15%; left: 25%; animation: splashDotBlink 2.2s ease-in-out infinite; }
.splash-dot-two { top: 34%; right: 7%; width: 5px; height: 5px; background: #80d8ff; animation: splashDotBlink 2.8s .4s ease-in-out infinite; }
.splash-dot-three { bottom: 17%; left: 18%; width: 4px; height: 4px; animation: splashDotBlink 2.5s .8s ease-in-out infinite; }
.splash-version {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  margin-top: 1px;
  border: 1px solid rgba(127, 211, 233, .22);
  border-radius: 999px;
  color: #b3cde0;
  background: rgba(18, 34, 53, .72);
  backdrop-filter: blur(8px);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .1px;
  box-shadow: 0 10px 26px -20px rgba(124, 201, 255, .9);
  animation: splashFadeUp .7s .16s both;
}
.splash-live-dot { width: 6px; height: 6px; border-radius: 50%; background: #7ae5c4; box-shadow: 0 0 0 4px rgba(122, 229, 196, .12); animation: splashDotBlink 1.8s ease-in-out infinite; }
.splash-title {
  margin: 17px 0 4px;
  font-size: clamp(26px, 5vw, 33px);
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: -.7px;
  background: linear-gradient(115deg, #f6fbff 18%, #b9e0ff 62%, #93efdd);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #f2f7ff;
  animation: splashFadeUp .7s .25s both;
}
.splash-title span { color: #8be6d0; -webkit-text-fill-color: #8be6d0; text-shadow: 0 0 34px rgba(121, 226, 204, .22); }
.splash-subtitle { margin: 0; color: #93a8c2; font-size: 13px; font-weight: 300; line-height: 2; animation: splashFadeUp .7s .34s both; }
.splash-loader { position: relative; width: 164px; height: 5px; margin-top: 28px; overflow: hidden; border-radius: 99px; background: rgba(142, 169, 199, .14); box-shadow: inset 0 0 0 1px rgba(142, 169, 199, .08); animation: splashFadeUp .7s .4s both; }
.splash-loader span { position: absolute; top: 0; bottom: 0; left: -42%; width: 42%; border-radius: inherit; background: linear-gradient(90deg, transparent, #83d7ff 40%, #7ae5c4); box-shadow: 0 0 18px rgba(126, 220, 230, .55); animation: splashProgress 1.35s cubic-bezier(.4, 0, .2, 1) infinite; }
.splash-loading-text { margin: 11px 0 0; color: #71869f; font-size: 11px; font-weight: 300; animation: splashFadeUp .7s .45s both; }
.splash-bottom-note { position: absolute; bottom: max(20px, env(safe-area-inset-bottom)); left: 16px; right: 16px; text-align: center; color: rgba(143, 163, 190, .5); font-size: 10px; font-weight: 300; letter-spacing: .15px; }
.splash-bottom-note span { margin: 0 7px; color: rgba(126, 220, 204, .7); }
@keyframes splashContentIn { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes splashFadeUp { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
@keyframes splashIllustrationFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes splashDocumentTilt { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-1.2deg); } }
@keyframes splashTileFloat { 0%, 100% { transform: translate(0, 0) rotate(0deg); } 50% { transform: translate(2px, -6px) rotate(3deg); } }
@keyframes splashMiniFloat { 0%, 100% { transform: translate(0, 0) rotate(0deg); } 50% { transform: translate(-2px, 5px) rotate(-3deg); } }
@keyframes splashRingPulse { 0%, 100% { transform: scale(.98); opacity: .6; } 50% { transform: scale(1.035); opacity: 1; } }
@keyframes splashRingRotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes splashGridDrift { from { transform: translateY(0); } to { transform: translateY(42px); } }
@keyframes splashAmbientFloat { from { transform: translate3d(-10px, 0, 0) scale(.95); } to { transform: translate3d(25px, 30px, 0) scale(1.12); } }
@keyframes splashDotBlink { 0%, 100% { opacity: .45; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.2); } }
@keyframes splashProgress { 0% { left: -42%; } 100% { left: 105%; } }
@media (max-height: 620px) {
  .splash-content { transform: scale(.82); padding-block: 8px; }
  .splash-art { width: min(190px, 48vh); margin-bottom: 0; }
  .splash-title { margin-top: 9px; }
  .splash-loader { margin-top: 15px; }
}

/* ===== Admin settings dialog ===== */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 100% at 50% 0%, rgba(3, 7, 15, .74), rgba(2, 4, 10, .9));
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  animation: backdropIn .22s ease both;
}
.admin-dialog {
  position: relative;
  width: min(780px, 100%);
  max-height: min(88vh, 860px);
  overflow: auto;
  border: 1px solid transparent;
  border-radius: 24px;
  padding: 24px;
  background:
    linear-gradient(168deg, rgba(19, 31, 52, .98), rgba(8, 14, 26, .99)) padding-box,
    var(--grad-hairline) border-box;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .05);
  animation: dialogIn .26s var(--ease);
}
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes dialogIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.admin-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--border); margin-bottom: 20px; position: relative; }
.admin-header::after {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  bottom: -1px;
  width: 120px;
  height: 1px;
  background: var(--grad-accent);
  box-shadow: 0 0 14px rgba(124, 201, 255, .7);
}
.admin-header h2 { margin: 0 0 4px; font-size: 17px; font-weight: 800; letter-spacing: -.2px; }
.admin-header p { margin: 0; }
.close-btn { width: 34px; height: 34px; border-radius: 12px; font-size: 22px; }
.login-form { max-width: 470px; margin: 32px auto 36px; }
.login-form > label { display: block; margin-bottom: 9px; font-size: 12px; font-weight: 700; }
.password-row { display: flex; gap: 9px; }
.password-row input {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: 1px solid var(--border);
  background: rgba(10, 17, 31, .8);
  border-radius: 13px;
  padding: 0 13px;
  color: var(--text);
  outline: none;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 3px;
  transition: border-color .2s ease, box-shadow .24s ease;
}
.password-row input:focus { border-color: rgba(124, 201, 255, .68); box-shadow: var(--ring); }
.form-error { margin: 9px 0 0; color: var(--danger); font-size: 11px; font-weight: 500; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 3px 0 14px; }
.admin-toolbar h3, .admin-columns h3 { margin: 0 0 3px; font-size: 13px; font-weight: 700; }
.admin-toolbar p, .admin-columns p { margin: 0; }
.admin-file-list { display: grid; gap: 9px; }
.admin-file-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid transparent;
  border-radius: 15px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .015)) padding-box,
    linear-gradient(140deg, rgba(150, 178, 214, .24), rgba(150, 178, 214, .07)) border-box;
  transition: transform .2s var(--ease), box-shadow .22s ease, background .2s ease;
}
.admin-file-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px -24px rgba(0, 0, 0, .95), 0 0 0 1px rgba(124, 201, 255, .14);
}
.admin-file-details { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.admin-file-details strong { font-size: 12.5px; font-weight: 700; overflow-wrap: anywhere; }
.admin-file-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.mini-btn {
  border: 1px solid var(--border);
  background: var(--grad-glass);
  color: var(--muted);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 10.5px;
  font-weight: 500;
  cursor: pointer;
  transition: .18s var(--ease);
}
.mini-btn:hover { color: #eaf6ff; border-color: rgba(124, 201, 255, .5); background: rgba(124, 201, 255, .12); transform: translateY(-1px); }
.mini-btn:active { transform: translateY(0) scale(.97); }
.mini-btn.danger { color: var(--danger); }
.mini-btn.danger:hover { border-color: rgba(255, 123, 148, .5); background: rgba(255, 123, 148, .12); color: #ff9db0; }
.admin-empty { padding: 20px; text-align: center; font-size: 12px; border: 1px dashed rgba(150, 178, 214, .22); border-radius: 15px; background: rgba(255, 255, 255, .016); }
.admin-columns { margin-top: 20px; padding: 16px; border: 1px solid rgba(124, 201, 255, .22); border-radius: 18px; background: linear-gradient(160deg, rgba(124, 201, 255, .07), rgba(122, 229, 196, .03)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04); }
.admin-columns-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.columns-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.columns-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 5px; max-height: 265px; overflow: auto; padding-inline-end: 2px; }
.col-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s var(--ease);
}
.col-item:hover { background: rgba(148, 178, 214, .07); transform: translateY(-1px); }
.col-item:has(input:checked) { background: rgba(124, 201, 255, .1); border-color: rgba(124, 201, 255, .28); }
.col-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, .045);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: .18s var(--ease);
}
.col-item input[type="checkbox"]::after {
  content: '';
  width: 11px;
  height: 11px;
  background: #061723;
  clip-path: polygon(14% 45%, 0 60%, 38% 100%, 100% 20%, 85% 7%, 37% 68%);
  transform: scale(0);
  transition: transform .18s var(--ease);
}
.col-item input[type="checkbox"]:checked { background: var(--grad-accent); border-color: transparent; box-shadow: 0 0 0 3px rgba(124, 201, 255, .14); }
.col-item input[type="checkbox"]:checked::after { transform: scale(1); }
.col-name { font-size: 11.5px; color: var(--text-soft); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-index {
  margin-inline-start: auto;
  flex: 0 0 auto;
  font-size: 10px;
  color: var(--muted-2);
  background: rgba(148, 178, 214, .09);
  padding: 2px 8px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.admin-columns-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--border); }
.admin-note { margin: 20px 0 0; padding-top: 13px; border-top: 1px solid var(--border); color: var(--muted-2); font-size: 10px; line-height: 2; }

/* ===== Scrollbars ===== */
.main::-webkit-scrollbar, .columns-list::-webkit-scrollbar, .admin-dialog::-webkit-scrollbar { width: 8px; height: 8px; }
.main::-webkit-scrollbar-thumb, .columns-list::-webkit-scrollbar-thumb, .admin-dialog::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(124, 201, 255, .42), rgba(122, 229, 196, .28));
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.main::-webkit-scrollbar-thumb:hover, .columns-list::-webkit-scrollbar-thumb:hover, .admin-dialog::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, rgba(124, 201, 255, .68), rgba(122, 229, 196, .5)); background-clip: padding-box; }
.main::-webkit-scrollbar-track, .columns-list::-webkit-scrollbar-track, .admin-dialog::-webkit-scrollbar-track { background: transparent; }

/* ===== Responsive ===== */
@media (max-width: 620px) {
  .topbar { gap: 9px; padding-inline: 12px; }
  .logo { width: 37px; height: 37px; border-radius: 13px; }
  .brand { gap: 8px; }
  .brand h1 { font-size: 13px; }
  .brand-text p { max-width: 34vw; font-size: 10px; }
  .file-switcher { min-width: 112px; max-width: 34vw; font-size: 10px; padding-inline: 7px; }
  .icon-btn { width: 36px; height: 36px; border-radius: 12px; }
  .main { padding-inline: 12px; }
  .toolbar { flex-wrap: wrap; }
  .search-input { height: 46px; }
  .result-count { padding-inline: 11px; }
  .blocks { grid-template-columns: minmax(0, 1fr); }
  .empty-card { padding: 38px 20px; }
  .statusbar { padding-inline: 12px; }
  .admin-dialog { padding: 16px; border-radius: 20px; }
  .admin-toolbar { align-items: flex-start; }
  .admin-file-row { align-items: flex-start; flex-direction: column; }
  .admin-file-actions { align-self: flex-end; }
  .admin-columns-head { flex-direction: column; }
}

/* ===== Motion preferences ===== */
@media (prefers-reduced-motion: reduce) {
  body.popup::before { animation: none; }
  .splash-screen *, .splash-screen *::before, .splash-screen *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .splash-screen { transition-duration: .18s; }
  .block, .no-results, .empty-card { animation: none; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
