*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #050616;
  --bg-panel: #090b22;
  --bg-panel-soft: #0b102b;
  --border-soft: rgba(255,255,255,0.06);
  --accent: #ffae45;
  --accent-2: #ff4f7a;
  --accent-soft: rgba(255,174,69,0.18);
  --text-main: #f5f3ff;
  --text-muted: #9ca2d6;
}

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top, #25143e 0, #050616 50%, #02020a 100%);
  color: var(--text-main);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

body {
  min-height: 100vh;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: linear-gradient(90deg, rgba(4,4,18,0.98), rgba(12,14,50,0.98));
  border-bottom: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 18px 40px rgba(0,0,0,0.8);
}

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

.brand-orb {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 20%, #fff 0, #ffe7c1 22%, #ffae45 40%, #ff4f7a 70%);
  box-shadow: 0 0 35px rgba(255,144,84,0.9);
}

.brand-title {
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.topnav {
  display: flex;
  gap: 8px;
}

.nav-link {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.nav-link-active {
  color: var(--bg);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: rgba(255,255,255,0.4);
}

/* Layout */

.layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px 14px 18px;
  gap: 14px;
}

.panel {
  background: radial-gradient(circle at top, rgba(18,20,60,0.96), rgba(3,4,18,0.98));
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.9);
  border: 1px solid var(--border-soft);
  padding: 14px 16px;
}

.panel-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-split {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 12px;
}

.panel-left,
.panel-right {
  background: linear-gradient(145deg, #08091d, #050617);
  border-radius: 14px;
  padding: 10px 11px;
  border: 1px solid rgba(255,255,255,0.05);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}

/* Hero */

.hero-search h1 {
  margin: 0 0 6px;
  font-size: 20px;
}

.hero-sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.hero-sub.small {
  font-size: 12px;
}

.search-bar {
  margin-top: 10px;
  display: flex;
  align-items: center;
  background: #050616;
  border-radius: 999px;
  border: 1px solid rgba(116,132,210,0.8);
  padding: 2px 2px 2px 10px;
}

.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 14px;
  padding: 7px 4px;
}

.search-bar input:focus {
  outline: none;
}

#search-clear {
  border-radius: 999px;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

/* Sections */

.panel-left {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 210px);
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.meta {
  font-size: 11px;
  color: var(--text-muted);
}

.section-list {
  margin-top: 8px;
  overflow-y: auto;
  padding-right: 4px;
}

.section-card {
  display: block;
  padding: 8px 9px;
  border-radius: 11px;
  margin-bottom: 6px;
  text-decoration: none;
  background: rgba(6,9,32,0.96);
  border: 1px solid rgba(65,82,172,0.9);
  color: var(--text-main);
  transition: background 0.12s ease, transform 0.08s ease, box-shadow 0.12s ease;
}

.section-card:hover {
  background: rgba(12,18,60,0.98);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.6);
}

.section-card.active {
  background: radial-gradient(circle at top left, var(--accent), var(--accent-2));
  border-color: rgba(255,255,255,0.7);
}

.section-name {
  font-size: 14px;
  font-weight: 600;
}

.section-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* Files */

.panel-right {
  max-height: calc(100vh - 210px);
  display: flex;
  flex-direction: column;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
}

.section-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.file-table-wrapper {
  flex: 1;
  overflow: auto;
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.file-table thead {
  position: sticky;
  top: 0;
  background: #050616;
}

.file-table th,
.file-table td {
  padding: 6px 6px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.file-name {
  font-weight: 500;
}

.file-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.col-size,
.col-tags,
.col-downloads,
.col-actions,
.col-section {
  white-space: nowrap;
}

.tag-pill {
  display: inline-block;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(170,180,250,0.6);
  margin-right: 3px;
}

.btn-primary,
.btn-ghost {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #02020a;
  box-shadow: 0 10px 24px rgba(0,0,0,0.7);
  text-decoration: none;
  display: inline-block;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: rgba(134,148,224,0.85);
}

.btn-primary:hover,
.btn-ghost:hover {
  filter: brightness(1.08);
}

.btn-download {
  font-size: 11px;
}

.btn-sm {
  padding: 3px 8px;
  font-size: 10px;
}

/* Admin */

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 14px;
}

.admin-col {
  background: #050616;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.05);
}

/* Forms */

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-top: 8px;
}

.field label {
  display: block;
  font-size: 12px;
  margin-bottom: 2px;
  color: var(--text-muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(114,132,215,0.85);
  background: #050616;
  color: var(--text-main);
  font-size: 13px;
  padding: 7px 8px;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  box-shadow: 0 0 0 1px rgba(181,197,255,0.9);
}

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

/* Alerts */

.alert {
  margin-top: 8px;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  background: rgba(255,80,120,0.12);
  border: 1px solid rgba(255,120,160,0.7);
}

.alert-ok {
  background: rgba(80,220,140,0.12);
  border-color: rgba(120,255,190,0.7);
}

/* Misc */

.inline {
  display: inline-block;
  margin: 0;
}

.details-empty {
  margin: auto;
  text-align: center;
  color: var(--text-muted);
}

.footer {
  padding: 8px 14px 14px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}

/* Scrollbars */

.section-list,
.file-table-wrapper {
  scrollbar-width: thin;
  scrollbar-color: rgba(150,150,230,0.8) transparent;
}

.section-list::-webkit-scrollbar,
.file-table-wrapper::-webkit-scrollbar {
  width: 6px;
}

.section-list::-webkit-scrollbar-track,
.file-table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.section-list::-webkit-scrollbar-thumb,
.file-table-wrapper::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--accent), var(--accent-2));
  border-radius: 999px;
}

/* Responsive */

@media (max-width: 900px) {
  .panel-split {
    grid-template-columns: 1fr;
  }
  .panel-left,
  .panel-right {
    max-height: none;
  }
}

@media (max-width: 800px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .layout {
    padding: 10px;
  }
}
