:root{
  --bg:#0b0f17;
  --panel:#121a2a;
  --panel2:#0f1626;
  --text:#eaf0ff;
  --muted:#a9b3d6;
  --accent:#6ee7ff;
  --accent2:#7c5cff;
  --danger:#ff4d6d;
  --ok:#2ee59d;
  --border: rgba(255,255,255,.10);
  --shadow: 0 14px 40px rgba(0,0,0,.35);
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  /* Solid base; decorative gradients drawn once (no tiling) */
  background-color: #0b0f17;
  background-image:
    radial-gradient(1200px 700px at 20% -10%, rgba(124,92,255,.25), transparent 60%),
    radial-gradient(900px 600px at 80% 0%, rgba(110,231,255,.18), transparent 55%);
  background-repeat: no-repeat;
  color:var(--text);
}

.topBar{
  position: sticky;
  top:0;
  z-index:30;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:16px 18px;
  background: rgba(11,15,23,.65);
  border-bottom:1px solid var(--border);
  backdrop-filter: blur(10px);
}
.brand{ display:flex; gap:12px; align-items:center; }
.logoMark{
  width:36px; height:36px;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  border-radius:10px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 14px 40px rgba(124,92,255,.24);
}
.brandTitle{ font-weight:800; letter-spacing:.2px; }
.brandSub{ color:var(--muted); font-size:13px; margin-top:2px; }

.ghost{
  background: transparent;
  border:1px solid var(--border);
  color:var(--text);
  padding:9px 12px;
  border-radius:12px;
  cursor:pointer;
}
.ghost:hover{ border-color: rgba(255,255,255,.22); }

.topBarRight{ display:flex; align-items:center; gap:10px; }

.dropZone{
  position: sticky;
  top:72px;
  z-index:25;
  margin:14px 16px 0;
  border:1px dashed rgba(110,231,255,.35);
  background: linear-gradient(180deg, rgba(18,26,42,.72), rgba(15,22,38,.55));
  border-radius:18px;
  box-shadow: var(--shadow);
  transition: height .25s ease, padding .25s ease, transform .25s ease;
  overflow:hidden;
}
.dropInner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:18px 18px;
  min-height:96px;
}
.dropTitle{ font-weight:800; font-size:16px; }
.dropSub{ margin-top:4px; font-size:13px; }

.filePickBtn{
  display:inline-flex;
  align-items:center;
  background: linear-gradient(135deg, rgba(124,92,255,.9), rgba(110,231,255,.75));
  padding:10px 14px;
  border-radius:14px;
  cursor:pointer;
  border:1px solid rgba(255,255,255,.16);
  user-select:none;
}
.filePickBtn input{ display:none; }
.filePickBtn span{ font-weight:700; }

body.uploading .dropZone .dropInner{
  min-height:64px;
  padding:12px 18px;
}

.layout{
  margin:18px 16px 28px;
  display:grid;
  grid-template-columns: 1fr;
  gap:14px;
  align-items:start;
}
.panel{
  background: rgba(18,26,42,.65);
  border:1px solid var(--border);
  border-radius:18px;
  box-shadow: var(--shadow);
  overflow:hidden;
}
/* Outer shell has no border — each inner row has its own border */
.panel.panelMain{
  border:none;
  box-shadow:none;
  border-radius:0;
  overflow:visible;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.panelMain > .panelHeader{
  border:1px solid var(--border);
  border-radius:12px 12px 0 0; /* no rounding on bottom corners */
}
.panelMain > .fileList{
  border:none;
}
.panelMain > .resultsPanel{
  border:1px solid var(--border);
  border-radius:12px;
}
/* Tab row: outer border + accent line under tab buttons */
.panelMain > .tabs{
  border:none;
  border-bottom:1px solid rgba(110,231,255,.45);
  border-radius:0;
}
.panelHeader{
  padding:16px 16px 12px;
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  background: rgba(15,22,38,.35);
}
.panelTitle{ font-weight:900; }
.panelHint{ font-size:13px; margin-top:4px; }
.panelStats{ display:flex; gap:12px; }
.stat{ text-align:right; }
.statLabel{ color:var(--muted); font-size:12px; display:block; }
.stat span{ font-weight:900; }

.panelMain{
  min-height:420px;
  background: transparent; /* override .panel; inner rows keep their own fills */
}
/* categories panel removed */

.fileList{
  padding:10px 12px 8px;
  display:flex; flex-direction:column; gap:10px;
  background: rgba(12,18,32,.35);
}
.fileCard{
  background: rgba(12,18,32,.55);
  border:1px solid var(--border);
  border-radius:16px;
  padding:12px 12px;
}
.fileRowTop{
  display:flex; justify-content:space-between; gap:12px;
  align-items:center;
}
.fileNameWrap{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.fileName{ font-weight:800; flex:1 1 auto; max-width:none; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.fileSize{ color:var(--muted); font-size:13px; white-space:nowrap; }

.progressWrap{
  margin-top:10px;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.barTrack{
  width:100%;
  height:11px;
  border-radius:999px;
  background: rgba(255,255,255,.08);
  overflow:hidden;
}
.barFill{
  height:100%;
  width:0%;
  border-radius:999px;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  transition: width .2s ease;
}
.progressText{
  font-size:12px;
  color: var(--muted);
}

.editBtn{
  margin-top:10px;
  width:100%;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:10px 12px;
  border-radius:14px;
  background: rgba(110,231,255,.12);
  border:1px solid rgba(110,231,255,.35);
  color: var(--text);
  text-decoration:none;
  font-weight:800;
}
.editBtn:hover{ border-color: rgba(110,231,255,.55); }

.editTextLink{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:0;
  margin:0;
  border:none;
  background:transparent;
  color: var(--accent);
  text-decoration: underline;
  font-weight:900;
  font-size:13px;
  white-space:nowrap;
}
.editTextLink:hover{
  color: var(--accent2);
}

.uploadStatusIcon{
  width:20px;
  display:inline-flex;
  justify-content:center;
  align-items:center;
  font-weight:1000;
  font-size:14px;
  color: var(--muted);
}
.uploadStatusIcon.success{ color: var(--ok); }
.uploadStatusIcon.error{ color: var(--danger); }
.subtleWarn{
  margin-top:8px;
  font-size:12px;
  color: var(--muted);
}

.muted{ color: var(--muted); }
.error{
  color: var(--danger);
  margin:10px 0 10px;
  font-weight:700;
}

.categoryList{
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:10px;
  max-height: calc(100vh - 330px);
  overflow-y: auto;
}
.categoryList::-webkit-scrollbar{ width: 10px; }
.categoryList::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,.14);
  border-radius: 999px;
}
.categoryList::-webkit-scrollbar-track{ background: transparent; }

.catHeader{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start;
}
.catMetaStrong{
  font-size:12px;
  color: var(--muted);
  margin-top:4px;
}
.catValues{
  margin-top:10px;
  padding-top:10px;
  border-top:1px solid var(--border);
  display:flex;
  flex-direction:column;
  gap:8px;
}
.catValues.hidden{ display:none; }
.valRow{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:13px;
}
.valRow input{
  width:16px;
  height:16px;
  accent-color: var(--accent2);
}
.valValue{
  color: var(--text);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.catItem{
  text-align:left;
  padding:10px 10px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(12,18,32,.50);
  color: var(--text);
  cursor:pointer;
}
.catItem:hover{ border-color: rgba(110,231,255,.32); }
.catItem.selected{
  border-color: rgba(110,231,255,.55);
  box-shadow: 0 0 0 1px rgba(110,231,255,.25) inset;
}
.catTitle{ font-weight:850; }
.catMeta{ margin-top:4px; font-size:12px; color:var(--muted); }
.catBulkRow{
  display:flex;
  gap:8px;
  margin-top:10px;
}
.catBulkBtn{
  flex:1 1 auto;
  border-radius:12px;
  padding:8px 10px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
  cursor:pointer;
  font-weight:850;
  font-size:12px;
  white-space:nowrap;
}
.catBulkBtn:hover{
  border-color: rgba(110,231,255,.45);
}

.selectedBlock{
  padding:14px 12px 14px;
  border-top:1px solid var(--border);
  background: rgba(15,22,38,.35);
}
.selectedTitle{ font-weight:900; margin-bottom:8px; }
.selectedList{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.chip{
  font-size:12px;
  padding:7px 9px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
}

.tabs{
  display:flex;
  gap:10px;
  padding:10px 12px 0;
  background: transparent;
  position: relative;
  z-index: 3;
}
.tab{
  flex:0 0 auto;
  border-radius:14px 14px 0 0; /* remove bottom corner rounding */
  padding:10px 12px;
  border:1px solid var(--border);
  background: rgba(12,18,32,.40);
  color: var(--text);
  cursor:pointer;
  font-weight:900;
  border-bottom:0; /* tabs look attached to panel */
}
.tab.active{
  border-color: rgba(110,231,255,.45);
  background: rgba(18,26,42,.70);
}
.tab:disabled{
  opacity:.55;
  cursor:not-allowed;
}
.resultsPanel{
  padding:10px 12px 16px;
  background: rgba(15,22,38,.35); /* match .panelHeader */
}
.resultsHeader{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:10px;
}
.resultsTitle{ font-weight:950; font-size:16px; }
.resultsList{ display:flex; flex-direction:column; gap:10px; }
.resultItem{
  border:1px solid var(--border);
  border-radius:16px;
  padding:12px 12px;
  background: rgba(12,18,32,.45);
}
.resultTop{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:center;
}
.resultNameWrap{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.resultName{ font-weight:900; flex:1 1 auto; max-width:none; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.resultSize{ color:var(--muted); font-size:13px; white-space:nowrap; }
.resultStatus{ margin-top:6px; font-size:13px; color:var(--muted); }

.modal{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.65);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:100;
  padding:20px;
}
.modal.show{ display:flex; }
.modalCard{
  width:min(520px, 95vw);
  background: rgba(18,26,42,.92);
  border:1px solid rgba(255,255,255,.14);
  border-radius:20px;
  padding:18px 18px;
  box-shadow: 0 20px 80px rgba(0,0,0,.55);
}
.modalCard h2{ margin:0 0 8px; font-size:18px; }
.field{
  display:flex; flex-direction:column; gap:8px;
  margin-top:12px;
}
.field span{ font-size:13px; color: var(--muted); }
.field input{
  height:44px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.16);
  background: rgba(12,18,32,.55);
  color: var(--text);
  padding:0 12px;
  outline:none;
}
.modalActions{ margin-top:14px; display:flex; justify-content:flex-end; }
.primary{
  border:none;
  border-radius:14px;
  background: linear-gradient(135deg, rgba(124,92,255,.95), rgba(110,231,255,.78));
  color: var(--text);
  padding:10px 14px;
  cursor:pointer;
  font-weight:900;
}

@media (max-width: 980px){
  .layout{ grid-template-columns: 1fr; }
  .panelRight{ position: relative; top:auto; }
}

