:root {
  color-scheme: dark;
  --bg: #07040d;
  --panel: #120b1f;
  --panel-strong: #1a102b;
  --panel-muted: #211535;
  --text: #f3ecff;
  --muted: #a797bd;
  --line: #322247;
  --accent: #a855f7;
  --accent-soft: #7c3aed;
  --accent-dark: #5b21b6;
  --online: #22c55e;
  --offline: #fb7185;
  --other: #f59e0b;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(168, 85, 247, 0.22), transparent 32rem),
    radial-gradient(circle at 80% 10%, rgba(91, 33, 182, 0.16), transparent 28rem),
    var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.hero {
  min-height: 250px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  align-items: center;
  gap: 28px;
  padding: 34px;
  background:
    linear-gradient(135deg, rgba(12, 6, 22, 0.98), rgba(33, 13, 58, 0.82)),
    linear-gradient(90deg, rgba(168, 85, 247, 0.14) 0 1px, transparent 1px 80px),
    linear-gradient(0deg, rgba(168, 85, 247, 0.1) 0 1px, transparent 1px 80px);
  background-position: center;
  background-size: cover;
  border: 1px solid rgba(168, 85, 247, 0.28);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand-lockup {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}

.brand-logo {
  width: 210px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(168, 85, 247, 0.55)) drop-shadow(0 18px 30px rgba(0, 0, 0, 0.58));
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: #d8b4fe;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(3rem, 6vw, 6.3rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.subtitle {
  max-width: 760px;
  margin: 16px 0 0;
  color: rgba(243, 236, 255, 0.82);
  font-size: 1.1rem;
  line-height: 1.55;
}

.status-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 18px;
  background: rgba(18, 11, 31, 0.72);
  border: 1px solid rgba(216, 180, 254, 0.24);
  border-radius: 8px;
  backdrop-filter: blur(12px);
}

.status-dot {
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--other);
  box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.16);
}

.status-dot.ready {
  background: var(--online);
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.16);
}

.status-dot.error {
  background: var(--offline);
  box-shadow: 0 0 0 5px rgba(251, 113, 133, 0.16);
}

.status-panel p {
  margin-bottom: 4px;
  font-weight: 850;
}

.status-panel span:not(.status-dot) {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 18px 0;
}

.metrics article,
.toolbar,
.content-list,
.preview-panel,
.source-tabs {
  background: rgba(18, 11, 31, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.22);
}

.metrics article {
  padding: 18px;
}

.metric-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.metrics strong {
  color: #f8f2ff;
  font-size: 1.45rem;
}

.source-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px;
}

.source-tab {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.source-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 150px 180px 170px auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
  padding: 16px;
}

.search-box,
.select-box {
  display: grid;
  gap: 7px;
}

.search-box span,
.select-box span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

input,
select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d0716;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

input::placeholder {
  color: #76658f;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.18);
}

button,
.ghost-link {
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: #fff;
  padding: 0 16px;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.ghost-link:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(540px, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: start;
}

.content-list,
.preview-panel {
  min-height: 620px;
}

.list-header,
.preview-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.list-header h2,
.preview-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.list-header span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

.file-list {
  max-height: 720px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 14px;
  overflow: auto;
}

.file-item {
  width: 100%;
  height: auto;
  min-height: 286px;
  display: grid;
  grid-template-rows: 148px minmax(0, 1fr);
  gap: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 7, 22, 0.94);
  color: var(--text);
  text-align: left;
  overflow: hidden;
}

.file-item:hover,
.file-item.active {
  background: #160d25;
  border-color: rgba(168, 85, 247, 0.62);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.26);
}

.file-thumb {
  position: relative;
  min-width: 0;
  height: 148px;
  display: block;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(168, 85, 247, 0.16), rgba(7, 4, 13, 0.84)),
    repeating-linear-gradient(90deg, rgba(216, 180, 254, 0.08) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(0deg, rgba(216, 180, 254, 0.06) 0 1px, transparent 1px 28px);
  overflow: hidden;
}

.file-thumb .status-chip {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  min-width: 72px;
  backdrop-filter: blur(10px);
}

.file-thumb-image,
.file-thumb-placeholder {
  width: 100%;
  height: 100%;
}

.file-thumb-image {
  display: block;
  object-fit: cover;
  object-position: top center;
}

.file-thumb-placeholder {
  display: grid;
  place-items: center;
}

.file-thumb-placeholder img {
  width: min(82%, 190px);
  opacity: 0.9;
  filter: drop-shadow(0 0 18px rgba(168, 85, 247, 0.5));
}

.file-card-copy {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 14px;
}

.file-name {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 850;
  line-height: 1.25;
}

.file-meta {
  color: var(--muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.file-url {
  color: #d8b4fe;
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.preview-header {
  align-items: start;
}

.preview-header .ghost-link {
  flex: 0 0 auto;
  background: transparent;
  color: #d8b4fe;
}

.preview-body {
  padding: 20px;
}

.empty-state {
  display: grid;
  min-height: 430px;
  place-items: center;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.empty-state.compact {
  min-height: 180px;
  padding: 18px;
}

.status-chip,
.detail-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-chip {
  min-width: 86px;
  max-width: 150px;
  min-height: 27px;
  padding: 5px 9px;
  overflow-wrap: anywhere;
}

.status-chip.online {
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.32);
}

.status-chip.offline {
  background: rgba(251, 113, 133, 0.13);
  color: #fda4af;
  border: 1px solid rgba(251, 113, 133, 0.32);
}

.status-chip.other {
  background: rgba(245, 158, 11, 0.14);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.detail-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d0716;
  overflow: hidden;
}

.detail-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.16), rgba(18, 11, 31, 0.2));
}

.detail-pill {
  padding: 7px 10px;
  border: 1px solid var(--line);
  color: #d8b4fe;
}

.detail-grid {
  display: grid;
  gap: 1px;
  margin: 0;
  background: var(--line);
}

.detail-grid div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
  background: #0d0716;
}

.detail-grid dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.detail-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-grid a,
.detail-notes a {
  color: #d8b4fe;
  font-weight: 850;
}

.detail-notes {
  padding: 18px;
}

.detail-notes h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.detail-notes p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.snapshot-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(220px, 0.9fr);
  gap: 16px;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.snapshot-frame {
  min-height: 230px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(168, 85, 247, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(168, 85, 247, 0.13), rgba(12, 7, 22, 0.84)),
    repeating-linear-gradient(90deg, rgba(216, 180, 254, 0.08) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(0deg, rgba(216, 180, 254, 0.06) 0 1px, transparent 1px 34px);
  overflow: hidden;
}

.snapshot-placeholder {
  width: min(84%, 460px);
  padding: 22px;
  border: 1px solid rgba(216, 180, 254, 0.24);
  border-radius: 8px;
  background: rgba(7, 4, 13, 0.74);
  text-align: center;
}

.snapshot-placeholder span {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
  font-size: 0.72rem;
  font-weight: 900;
}

.snapshot-panel.inactive .snapshot-placeholder span {
  background: rgba(251, 113, 133, 0.13);
  color: #fda4af;
}

.snapshot-placeholder strong {
  display: block;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
  font-size: 1.1rem;
}

.snapshot-placeholder p,
.snapshot-copy p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.snapshot-copy {
  align-self: center;
}

.snapshot-copy h3 {
  margin-bottom: 10px;
  font-size: 1.15rem;
}

.snapshot-button {
  margin-top: 16px;
  width: 100%;
}

.snapshot-button:disabled {
  border-color: var(--line);
  background: #160d25;
  color: var(--muted);
  cursor: not-allowed;
}

.snapshot-image-link,
.snapshot-image {
  width: 100%;
  height: 100%;
  display: block;
}

.snapshot-image {
  object-fit: cover;
  object-position: top center;
}

.error-box {
  padding: 16px;
  border: 1px solid rgba(251, 113, 133, 0.32);
  border-radius: 8px;
  background: rgba(251, 113, 133, 0.1);
  color: #fda4af;
  line-height: 1.5;
}

@media (max-width: 1080px) {
  .hero,
  .workspace,
  .metrics,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .source-tabs {
    grid-template-columns: 1fr;
  }

  .content-list,
  .preview-panel {
    min-height: auto;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1440px);
    padding-top: 10px;
  }

  .hero {
    min-height: 360px;
    padding: 22px;
  }

  .brand-lockup {
    grid-template-columns: 128px minmax(0, 1fr);
    gap: 14px;
  }

  .brand-logo {
    width: 128px;
  }

  h1 {
    font-size: 2.75rem;
  }

  .list-header,
  .preview-header,
  .detail-grid div,
  .snapshot-panel {
    grid-template-columns: 1fr;
  }

  .preview-header .ghost-link {
    width: 100%;
  }

  .file-item {
    grid-template-columns: 1fr;
  }

  .status-chip {
    justify-self: start;
  }
}
