:root{
  --magenta: #d100ff;
  --magenta2:#ff2bd6;
  --muted2: rgba(255,255,255,.55);
  --card: rgba(20,18,30,.58);
  --card2: rgba(20,18,30,.44);
  --stroke: rgba(255,255,255,.12);
  --shadow: 0 20px 50px rgba(0,0,0,.35);
  --radius: 18px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: rgba(255,255,255,.92);
  overflow-x:hidden;

  background:
    radial-gradient(1200px 800px at 18% 10%, rgba(209,0,255,.32) 0%, rgba(209,0,255,0) 55%),
    radial-gradient(900px 700px at 90% 20%, rgba(255,43,214,.20) 0%, rgba(255,43,214,0) 55%),
    radial-gradient(900px 700px at 40% 110%, rgba(110,50,255,.18) 0%, rgba(110,50,255,0) 60%),
    linear-gradient(180deg, #090914 0%, #070711 60%, #06060f 100%);
}

body.has-bg{
  background:
    linear-gradient(180deg, rgba(6,6,15,.35) 0%, rgba(6,6,15,.74) 70%, rgba(6,6,15,.88) 100%),
    url("tło.png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.wrap{ max-width: 1180px; margin: 0 auto; padding: 18px; }

.bgOrbs{
  position: fixed;
  inset: -120px;
  pointer-events:none;
  z-index:0;
  filter: blur(24px);
  opacity:.9;
}
.orb{
  position:absolute;
  border-radius: 999px;
  mix-blend-mode: screen;
  animation: floaty 10s ease-in-out infinite;
}
.o1{ width: 520px; height: 520px; left: -120px; top: 40px; background: radial-gradient(circle at 30% 30%, rgba(209,0,255,.55), rgba(209,0,255,0) 60%); }
.o2{ width: 460px; height: 460px; right: -120px; top: 120px; animation-delay: -2s; background: radial-gradient(circle at 30% 30%, rgba(255,43,214,.45), rgba(255,43,214,0) 60%); }
.o3{ width: 520px; height: 520px; left: 30%; bottom: -220px; animation-delay: -4s; background: radial-gradient(circle at 30% 30%, rgba(120,70,255,.35), rgba(120,70,255,0) 60%); }

@keyframes floaty{
  0%,100%{ transform: translate3d(0,0,0) scale(1); }
  50%{ transform: translate3d(0,-16px,0) scale(1.03); }
}

.topbar{
  position: relative;
  z-index: 2;
  display:flex;
  align-items:center;
  justify-content: flex-start;
  padding-top: 22px;
}

.brand{ display:flex; align-items:center; gap: 12px; }

.brandMark{
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 18px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 16px 34px rgba(209,0,255,.16);
}

.brandTitle{ font-weight: 800; letter-spacing: .2px; font-size: 18px; }
.brandSub{ font-size: 12px; color: rgba(255,255,255,.55); margin-top: 2px; }

.layout{
  position: relative;
  z-index: 2;
  display:grid;
  grid-template-columns: 420px 1fr;
  gap: 18px;
  align-items:start;
  padding-bottom: 16px;
}
@media (max-width: 980px){ .layout{ grid-template-columns: 1fr; } }

.card{
  background: linear-gradient(180deg, var(--card) 0%, var(--card2) 100%);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  overflow: hidden;
}

.cardHeader{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 10px;
}
.cardHeader h1{ margin: 0; font-size: 20px; letter-spacing: .2px; }
.cardHeader h2{ margin: 0; font-size: 16px; letter-spacing: .2px; color: rgba(255,255,255,.88); }

.badge{
  min-width: 44px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(209,0,255,.16);
  border: 1px solid rgba(209,0,255,.30);
  color: rgba(255,255,255,.92);
  font-weight: 700;
  box-shadow: 0 0 0 6px rgba(209,0,255,.08);
}

.searchRow{
  padding: 0 18px 14px;
  display:flex;
  gap: 10px;
}
.searchInput{
  flex: 1;
  display:flex;
  align-items:center;
  gap: 10px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 12px 12px;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.searchInput:focus-within{
  border-color: rgba(209,0,255,.55);
  box-shadow: 0 0 0 6px rgba(209,0,255,.14);
  transform: translateY(-1px);
}
.searchInput .icon{ width: 18px; height: 18px; fill: rgba(255,255,255,.70); }
#q{
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: rgba(255,255,255,.92);
  font-size: 15px;
}
#q::placeholder{ color: rgba(255,255,255,.52); }

.btn{
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.90);
  padding: 10px 12px;
  border-radius: 14px;
  cursor:pointer;
  text-decoration:none;
  font-weight: 650;
  letter-spacing: .1px;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  white-space: nowrap;
}
.btn:hover{
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.22);
  background: rgba(255,255,255,.08);
}
.btn:active{ transform: translateY(0); }

.btn.primary{
  background: linear-gradient(135deg, rgba(209,0,255,.92), rgba(255,43,214,.84));
  border-color: rgba(255,255,255,.10);
  box-shadow: 0 12px 30px rgba(209,0,255,.20);
}
.btn.primary:hover{ box-shadow: 0 14px 34px rgba(209,0,255,.26); }

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

.statusLine{ padding: 0 18px 10px; color: var(--muted2); font-size: 13px; }

.results{
  list-style:none;
  margin: 0;
  padding: 0 10px 14px;
  display:grid;
  gap: 10px;
  max-height: calc(100vh - 300px);
  overflow:auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.22) transparent;
}
.results::-webkit-scrollbar{ width: 10px; }
.results::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,.18);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.resultItem{
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  cursor:pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
  position: relative;
  overflow: hidden;
}
.resultItem::before{
  content:"";
  position:absolute;
  inset: -1px;
  border-radius: 16px;
  background: radial-gradient(220px 90px at 20% 10%, rgba(209,0,255,.18), rgba(209,0,255,0) 60%);
  opacity: .0;
  transition: opacity .15s ease;
}
.resultItem:hover{
  transform: translateY(-1px);
  border-color: rgba(209,0,255,.34);
  background: rgba(255,255,255,.06);
  box-shadow: 0 10px 24px rgba(0,0,0,.22);
}
.resultItem:hover::before{ opacity: 1; }

.resultTitle{ font-weight: 750; letter-spacing: .15px; color: rgba(255,255,255,.92); }
.resultTags{ margin-top: 3px; font-size: 12px; color: rgba(255,255,255,.60); }
.resultItem.active{ border-color: rgba(255,43,214,.52); box-shadow: 0 12px 28px rgba(255,43,214,.14); }

.previewCard{ min-height: 520px; }

.preview{ padding: 0 18px 18px; }
.hidden{ display:none; }

.docMetaRow{ padding: 10px 0 12px; }
.docTitle{ font-weight: 850; letter-spacing: .2px; font-size: 16px; }
.docMeta{ margin-top: 4px; font-size: 12px; color: rgba(255,255,255,.62); word-break: break-all; }

.frameWrap{
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.12);
  overflow: hidden;
  background: rgba(0,0,0,.18);
  box-shadow: 0 18px 42px rgba(0,0,0,.28);
}
.pdfFrame{ width:100%; height: 72vh; border: none; display:block; background: rgba(0,0,0,.12); }

@media (prefers-reduced-motion: reduce){
  .orb{ animation: none; }
  .btn, .resultItem, .searchInput{ transition: none; }
}
