:root {
  color-scheme: dark;
  --bg: #0f1115;
  --sidebar: #11151b;
  --panel: #171b22;
  --panel-soft: #1e242d;
  --text: #f4f1e9;
  --muted: #a9b0bb;
  --line: #303845;
  --gold: #d6b060;
  --teal: #4db6ac;
  --green: #7bc67e;
  --shadow: rgba(0, 0, 0, 0.28);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  background: var(--bg);
  color: var(--text);
}

#nl-badge-frame {
  display: none !important;
}

a {
  color: inherit;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.1rem;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  text-decoration: none;
}

.brand > span:last-child {
  display: grid;
  gap: 0.2rem;
}

.brand-mark {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  place-items: center;
  border: 1px solid var(--gold);
  background: #060708;
  color: var(--gold);
  font-weight: 900;
}

.brand small,
.quiet,
.metric-card small,
.product-meta,
.channel-list span,
.queue-list span,
.date-card span,
.side-note span {
  color: var(--muted);
}

nav {
  display: grid;
  gap: 0.45rem;
}

nav a,
.button,
.status-pill {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  padding: 0.75rem 0.85rem;
  font-weight: 800;
}

nav a:hover,
.button:hover {
  border-color: var(--gold);
}

.side-note {
  margin-top: auto;
  display: grid;
  gap: 0.4rem;
  border: 1px solid rgba(214, 176, 96, 0.35);
  border-radius: 8px;
  padding: 1rem;
  background: rgba(214, 176, 96, 0.08);
}

.logout-form { margin: 0; }
.logout-form .button { width: 100%; }

main {
  min-width: 0;
  padding: clamp(1rem, 3vw, 2rem);
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.topbar h1,
.panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  max-width: 820px;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 1.02;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.date-card,
.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 40px var(--shadow);
}

.date-card {
  display: grid;
  gap: 0.25rem;
  min-width: 190px;
  padding: 1rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.metric-card {
  display: grid;
  gap: 0.35rem;
  min-height: 138px;
  padding: 1rem;
}

.metric-card strong {
  color: var(--teal);
  font-size: 2.2rem;
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 0.8rem;
}

.panel {
  min-width: 0;
  padding: 1rem;
}

.panel.wide {
  grid-column: span 2;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel h2 {
  font-size: 1.35rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  color: var(--green);
  font-size: 0.78rem;
  padding: 0.45rem 0.65rem;
}

.product-table {
  display: grid;
  gap: 0.65rem;
}

.product-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.9fr) minmax(0, 1.4fr) 160px 150px;
  gap: 0.8rem;
  align-items: center;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.product-title,
.health,
.channel-list,
.queue-list,
.link-output,
.generated-link {
  display: grid;
  gap: 0.45rem;
}

.product-title strong,
.queue-list strong {
  font-size: 0.98rem;
}

.product-meta {
  line-height: 1.45;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag {
  border: 1px solid rgba(214, 176, 96, 0.4);
  border-radius: 999px;
  color: var(--gold);
  padding: 0.25rem 0.5rem;
  font-size: 0.74rem;
  font-weight: 800;
}

.bar {
  height: 0.5rem;
  overflow: hidden;
  border-radius: 999px;
  background: #0b0d10;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--gold));
}

.channel-item,
.queue-list li,
.generated-link {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 0.85rem;
}

.channel-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
}

.channel-score {
  color: var(--teal);
  font-weight: 900;
}

.queue-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: queue;
}

.queue-list li {
  counter-increment: queue;
  position: relative;
  padding-left: 3rem;
}

.queue-list li::before {
  content: counter(queue);
  position: absolute;
  left: 0.85rem;
  top: 0.85rem;
  display: grid;
  width: 1.45rem;
  height: 1.45rem;
  place-items: center;
  border-radius: 999px;
  background: #0b0d10;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 900;
}

.tool-panel {
  display: grid;
  gap: 0.9rem;
}

label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0d10;
  color: var(--text);
  font: inherit;
  padding: 0.78rem;
}

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

.button {
  cursor: pointer;
}

.button.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #101215;
}

.generated-link code {
  overflow-wrap: anywhere;
  color: var(--teal);
}

.caption {
  color: var(--muted);
  line-height: 1.55;
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.integration-grid article {
  display: grid;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 0.9rem;
}

.integration-grid span { color: var(--muted); line-height: 1.5; }
.inline-button { display: inline-flex; margin-top: 1rem; }

@media (max-width: 1080px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .metric-grid,
  .workspace,
  .product-row,
  .integration-grid {
    grid-template-columns: 1fr;
  }

  .panel.wide {
    grid-column: span 1;
  }
}

@media (max-width: 720px) {
  main {
    padding: 1rem;
  }

  .topbar,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
