:root {
  color-scheme: dark;
  --bg: #06111a;
  --bg-soft: rgba(12, 25, 38, 0.8);
  --panel: rgba(9, 21, 34, 0.78);
  --panel-strong: rgba(7, 16, 26, 0.92);
  --line: rgba(136, 197, 255, 0.18);
  --line-strong: rgba(120, 225, 255, 0.32);
  --text: #f2f7fb;
  --muted: #8fa8bb;
  --cyan: #57e6ff;
  --teal: #49c7a8;
  --amber: #ffca70;
  --danger: #ff7d90;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.32);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --transition: 220ms ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans Arabic", "Space Grotesk", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(87, 230, 255, 0.08), transparent 32%),
    radial-gradient(circle at bottom right, rgba(73, 199, 168, 0.12), transparent 28%),
    var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.hidden {
  display: none !important;
}

.page-shell {
  position: relative;
  overflow-x: hidden;
}

.bg-grid,
.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.bg-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black, transparent 82%);
}

.bg-glow {
  filter: blur(70px);
  opacity: 0.55;
}

.bg-glow-one {
  background: rgba(87, 230, 255, 0.18);
  width: 28rem;
  height: 28rem;
  top: -5rem;
  left: -6rem;
  border-radius: 50%;
}

.bg-glow-two {
  background: rgba(73, 199, 168, 0.15);
  width: 24rem;
  height: 24rem;
  right: -4rem;
  bottom: 10rem;
  border-radius: 50%;
}

.hero,
.layout,
.dashboard-layout {
  position: relative;
  z-index: 1;
}

.hero {
  padding: 28px 24px 16px;
}

.viewer-hero {
  padding-bottom: 8px;
}

.compact-hero {
  padding-bottom: 0;
}

.topbar,
.hero-content,
.layout,
.dashboard-layout {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.topbar-viewer {
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr) auto;
  align-items: center;
}

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

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

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: #031018;
  background: linear-gradient(135deg, var(--cyan), #7df7c6);
  box-shadow: 0 10px 30px rgba(87, 230, 255, 0.35);
}

.brand h1,
.hero-copy h2,
.results-head h3,
.dashboard-section h2 {
  margin: 0;
  font-family: "Space Grotesk", "IBM Plex Sans Arabic", sans-serif;
}

.brand h1 {
  font-size: 1.3rem;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  background: linear-gradient(135deg, rgba(73, 199, 168, 0.28), rgba(73, 199, 168, 0.12));
  border: 1px solid rgba(73, 199, 168, 0.36);
  color: #d6fff3;
  font-size: 0.86rem;
}

.topbar-search input {
  width: 100%;
}

.hero-content {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr;
  gap: 24px;
  margin-top: 40px;
  align-items: end;
}

.hero-copy h2 {
  font-size: clamp(2.4rem, 5vw, 4.75rem);
  line-height: 0.95;
  max-width: 10ch;
}

.hero-text {
  max-width: 60ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.8;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
}

.glass-card,
.glass-inset {
  background: linear-gradient(180deg, rgba(16, 31, 47, 0.8), rgba(7, 16, 26, 0.86));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.glass-card {
  border-radius: var(--radius-xl);
}

.glass-inset {
  border-radius: var(--radius-lg);
}

.hero-panel {
  padding: 22px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.panel-stat {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.panel-stat span {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 2rem;
  font-weight: 700;
}

.panel-stat label,
.muted {
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  padding: 20px 0 48px;
}

.viewer-main {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  position: relative;
  z-index: 1;
  padding: 8px 0 48px;
}

.filters-bar {
  padding: 18px 22px;
}

.filters-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.filters-group + .filters-group {
  margin-top: 16px;
}

.filters-group h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.sidebar,
.dashboard-section {
  padding: 22px;
}

.sidebar {
  align-self: start;
  position: sticky;
  top: 18px;
}

.sidebar-section + .sidebar-section,
.dashboard-section + .dashboard-section {
  margin-top: 22px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.search-wrap input,
input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(126, 171, 205, 0.16);
  background: rgba(4, 12, 19, 0.78);
  color: var(--text);
  border-radius: 14px;
  padding: 13px 14px;
  transition: border-color var(--transition), transform var(--transition), background var(--transition);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--line-strong);
  transform: translateY(-1px);
  background: rgba(7, 18, 30, 0.95);
}

textarea {
  resize: vertical;
  min-height: 112px;
}

.chip-stack,
.toggle-group,
.tag-row,
.row-actions,
.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-chip,
.ghost-button,
.solid-button,
.text-button,
.icon-button {
  border-radius: 999px;
  border: 1px solid rgba(126, 171, 205, 0.18);
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  transition: transform var(--transition), border-color var(--transition), background var(--transition);
}

.filter-chip:hover,
.ghost-button:hover,
.solid-button:hover,
.text-button:hover,
.icon-button:hover,
.link-card:hover,
.dashboard-link-item:hover,
.category-item:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.filter-chip.is-active,
.solid-button {
  background: linear-gradient(135deg, rgba(87, 230, 255, 0.2), rgba(73, 199, 168, 0.22));
  border-color: rgba(87, 230, 255, 0.4);
}

.ghost-button.is-active {
  background: linear-gradient(135deg, rgba(87, 230, 255, 0.2), rgba(73, 199, 168, 0.22));
  border-color: rgba(87, 230, 255, 0.4);
}

.text-button {
  padding: 0;
  background: transparent;
  border: none;
  color: var(--cyan);
}

.spotlight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.spotlight-card {
  padding: 20px;
}

.mini-list {
  display: grid;
  gap: 10px;
}

.mini-card,
.category-item,
.dashboard-link-item {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.mini-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
}

.mini-card-copy strong,
.dashboard-link-item h3,
.category-item strong,
.link-card h4 {
  display: block;
  margin-bottom: 3px;
}

.mini-card-copy span,
.category-item span {
  color: var(--muted);
  font-size: 0.92rem;
}

.results-head {
  margin: 28px 0 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.category-sections {
  display: grid;
  gap: 22px;
}

.category-block {
  display: grid;
  gap: 16px;
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.category-title {
  display: flex;
  gap: 14px;
  align-items: center;
}

.category-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.05);
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 520px));
  justify-content: center;
  gap: 14px;
}

.link-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  min-height: 152px;
  align-items: start;
}

.link-card-visual {
  display: flex;
  align-items: flex-start;
}

.visual-box {
  width: 68px;
  min-width: 68px;
  height: 68px;
  border-radius: 18px;
  border: 1px solid rgba(126, 171, 205, 0.18);
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.visual-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.visual-letter,
.visual-glyph {
  color: var(--visual-color, var(--cyan));
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.08), transparent 40%),
    rgba(255, 255, 255, 0.04);
}

.visual-letter span {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
}

.visual-svg {
  width: 32px;
  height: 32px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.link-card-body {
  padding: 0;
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
}

.link-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.card-category {
  margin: 0 0 6px;
  color: var(--cyan);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.card-description {
  color: var(--muted);
  min-height: 0;
  line-height: 1.55;
  font-size: 0.94rem;
  margin: 6px 0 0;
}

.card-badges,
.meta-row,
.form-actions,
.toggle-row,
.inline-field {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.badge,
.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.82rem;
}

.tag {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(87, 230, 255, 0.08);
  border: 1px solid rgba(87, 230, 255, 0.14);
  color: #c8f9ff;
  font-size: 0.82rem;
}

.card-actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.link-card .tag-row {
  display: none;
}

.empty-state {
  padding: 32px;
  text-align: center;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 360px;
  gap: 24px;
  padding: 18px 0 48px;
}

.dashboard-main,
.dashboard-side {
  display: grid;
  gap: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid label,
.stack-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.wide {
  grid-column: 1 / -1;
}

.upload-panel {
  min-height: 120px;
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(126, 171, 205, 0.24);
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  gap: 12px;
  place-items: center;
  text-align: center;
}

.upload-panel.is-active {
  border-color: rgba(87, 230, 255, 0.45);
  background: rgba(87, 230, 255, 0.06);
}

.upload-panel kbd {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 2px 6px;
}

.image-preview {
  min-height: 150px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 20px;
}

.image-preview .visual-box {
  width: 96px;
  min-width: 96px;
  height: 96px;
  border-radius: 24px;
}

.image-preview .visual-svg {
  width: 44px;
  height: 44px;
}

.dashboard-links,
.category-list {
  display: grid;
  gap: 14px;
}

.dashboard-link-item,
.category-item {
  padding: 16px;
}

.dashboard-link-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.inline-link {
  display: inline-block;
  margin-top: 12px;
  color: var(--cyan);
  word-break: break-all;
}

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

.category-swatch {
  width: 14px;
  height: 48px;
  border-radius: 999px;
}

.category-item-copy {
  flex: 1;
}

.help-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 10px;
  line-height: 1.7;
}

.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 14, 0.55);
  backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 5;
}

.auth-card {
  width: min(100%, 460px);
  padding: 28px;
}

.form-message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--danger);
}

.success {
  color: var(--teal);
}

@media (max-width: 1080px) {
  .hero-content,
  .layout,
  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .topbar-viewer {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .spotlight-grid,
  .link-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar,
  .hero-content,
  .layout,
  .dashboard-layout,
  .viewer-main {
    width: min(100% - 20px, 1240px);
  }

  .hero {
    padding-inline: 10px;
  }

  .hero-panel,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .link-card {
    grid-template-columns: 70px minmax(0, 1fr);
    min-height: auto;
  }

  .dashboard-link-head,
  .category-item,
  .results-head,
  .category-header,
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .filters-row {
    flex-direction: column;
    align-items: stretch;
  }
}
