:root {
  color-scheme: dark;
  --c-border: #252b3a;
  --c-border-strong: #343c51;
  --c-border-field: #30384b;
}

/* Searcher is dark-only by design. These overrides keep browser-native
   widgets (Chrome/Edge autofill, date pickers, scrollbars, etc.) from
   leaking light backgrounds when the OS prefers-color-scheme is light.
   A real light theme is not implemented; UserProfile.theme is reserved
   but currently unused. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #090c12 inset !important;
  -webkit-text-fill-color: #f8fafc !important;
  caret-color: #f8fafc;
  transition: background-color 5000s ease-in-out 0s;
}

html {
  scrollbar-color: var(--c-border-field) #07090f;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.skip-link {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  background: #8b5cf6;
  color: #fff;
  font-size: .85rem;
  font-weight: 850;
  pointer-events: none;
}

.app-sidebar {
  width: 18rem;
  transition: width 180ms ease;
}

.app-main {
  transition: padding-left 180ms ease;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-toggle {
  display: grid;
  align-self: flex-end;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border: 1px solid var(--c-border-strong);
  border-radius: .65rem;
  color: #dbe3f4;
  background: rgba(15, 20, 31, .72);
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.sidebar-toggle:hover {
  border-color: rgba(167, 139, 250, .72);
  background: rgba(139, 92, 246, .16);
  color: white;
}

.sidebar-toggle:focus-visible {
  outline: none;
  border-color: #a78bfa;
  box-shadow: 0 0 0 4px rgba(139, 92, 246, .18);
}

.sidebar-toggle-closed {
  display: none;
}

.sidebar-toggle-icon {
  display: block;
}

@media (min-width: 1024px) {
  .app-main {
    padding-left: 18rem;
  }

  .sidebar-collapsed .app-sidebar {
    width: 5.25rem;
  }

  .sidebar-collapsed .app-main {
    padding-left: 5.25rem;
  }

  .sidebar-collapsed .sidebar-label,
  .sidebar-collapsed .sidebar-note,
  .sidebar-collapsed .sidebar-toggle-open {
    display: none;
  }

  .sidebar-collapsed .sidebar-toggle-closed {
    display: inline;
  }

  .sidebar-collapsed .sidebar-brand {
    width: 2.95rem;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
  }

  .sidebar-collapsed .sidebar-toggle {
    align-self: center;
  }

  .sidebar-collapsed .nav-item {
    width: 2.95rem;
    min-height: 2.95rem;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
  }
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0.75rem;
  min-height: 3rem;
  padding: 0.55rem 0.75rem;
  color: #d8def0;
  font-size: 0.92rem;
  font-weight: 750;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.nav-item:hover,
.nav-active {
  background: linear-gradient(135deg, rgba(139, 92, 246, .28), rgba(88, 80, 236, .13));
  color: white;
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, .35);
}

.nav-icon {
  display: inline-flex;
  width: 1.5rem;
  height: 1.5rem;
  flex: 0 0 1.5rem;
  align-items: center;
  justify-content: center;
  place-items: center;
  color: #f1f5f9;
  transition: color 160ms ease, filter 160ms ease;
}

.nav-svg {
  display: block;
  width: 1.38rem;
  height: 1.38rem;
  fill: none;
  stroke: currentColor !important;
  overflow: visible;
}

.nav-active .nav-icon,
.nav-item:hover .nav-icon {
  color: #fff;
  filter: drop-shadow(0 0 8px rgba(196, 181, 253, .45));
}

.sidebar-collapsed .nav-icon {
  width: 1.5rem;
  height: 1.5rem;
  flex-basis: 1.5rem;
}

.user-menu {
  z-index: 20;
}

.user-menu-button {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  cursor: pointer;
  list-style: none;
  place-items: center;
  border: 1px solid rgba(167, 139, 250, .38);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(139, 92, 246, .34), rgba(18, 23, 34, .98));
  color: white;
  font-size: .95rem;
  font-weight: 950;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .24);
}

.user-menu-button::-webkit-details-marker {
  display: none;
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + .65rem);
  right: 0;
  display: grid;
  width: min(18rem, calc(100vw - 2rem));
  gap: .35rem;
  border: 1px solid var(--c-border);
  border-radius: .9rem;
  background: #0d111a;
  padding: .85rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .42);
}

.user-menu-email,
.user-menu-role {
  min-width: 0;
  overflow-wrap: anywhere;
}

.user-menu-email {
  color: #fff;
  font-size: .9rem;
  font-weight: 850;
}

.user-menu-role {
  margin-bottom: .35rem;
  color: #8d95a8;
  font-size: .75rem;
  font-weight: 850;
  text-transform: uppercase;
}

.user-menu-panel a,
.user-menu-panel button {
  display: flex;
  width: 100%;
  min-height: 2.4rem;
  align-items: center;
  border-radius: .65rem;
  padding: .55rem .7rem;
  color: #dbe3f4;
  font-size: .88rem;
  font-weight: 800;
  text-align: left;
}

.user-menu-panel a:hover,
.user-menu-panel button:hover {
  background: rgba(139, 92, 246, .16);
  color: #fff;
}

.preview-pill {
  display: inline-flex;
  width: fit-content;
  border: 1px solid rgba(251, 191, 36, .32);
  border-radius: 999px;
  background: rgba(251, 191, 36, .12);
  padding: .25rem .6rem;
  color: #fde68a;
  font-size: .72rem;
  font-weight: 900;
}

.preview-switcher {
  display: grid;
  gap: .55rem;
  margin: .45rem 0;
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
  padding: .7rem 0;
}

.preview-switcher p {
  color: #a78bfa;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.preview-role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .4rem;
}

.user-menu-panel .preview-role-grid button {
  justify-content: center;
  min-height: 2rem;
  border: 1px solid var(--c-border);
  background: rgba(9, 12, 18, .72);
  padding: .4rem .45rem;
  font-size: .76rem;
  text-align: center;
}

.user-menu-panel .preview-role-grid .preview-role-active {
  border-color: rgba(167, 139, 250, .75);
  background: rgba(139, 92, 246, .22);
  color: #fff;
}

.page-title {
  margin-top: 0.35rem;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0;
  color: #fff;
}

.page-copy {
  margin-top: 1rem;
  max-width: 46rem;
  color: #c4cbda;
  line-height: 1.7;
}

.eyebrow {
  color: #a78bfa;
  font-size: .75rem;
  font-weight: 850;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.panel,
.metric-card {
  border: 1px solid var(--c-border);
  background: linear-gradient(180deg, rgba(18, 23, 34, .94), rgba(10, 13, 20, .96));
  border-radius: 1rem;
  box-shadow: 0 16px 40px rgba(0,0,0,.22);
}

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

.metric-card {
  padding: 1.25rem;
}

.manager-kpi-card {
  min-width: 0;
  border: 1px solid var(--c-border);
  border-radius: 1rem;
  background: linear-gradient(180deg, rgba(18, 23, 34, .94), rgba(10, 13, 20, .96));
  padding: 1.15rem;
  box-shadow: 0 16px 40px rgba(0,0,0,.2);
}

.manager-kpi-card p,
.manager-kpi-card span {
  color: #8d95a8;
  font-size: .78rem;
  font-weight: 850;
}

.manager-kpi-card p {
  text-transform: uppercase;
}

.manager-kpi-card strong {
  display: block;
  margin-top: .55rem;
  color: #fff;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 950;
  line-height: 1;
}

.manager-kpi-card span {
  display: block;
  margin-top: .65rem;
}

.manager-pill {
  display: inline-flex;
  width: fit-content;
  border: 1px solid rgba(167, 139, 250, .36);
  border-radius: 999px;
  background: rgba(139, 92, 246, .16);
  padding: .35rem .7rem;
  color: #ddd6fe;
  font-size: .78rem;
  font-weight: 900;
}

.funnel-stack,
.milestone-list,
.manager-list,
.manager-warnings,
.manager-compact-list {
  display: grid;
  gap: .8rem;
}

.funnel-row,
.milestone-row {
  display: grid;
  grid-template-columns: minmax(8rem, 11rem) minmax(0, 1fr) 3.2rem;
  gap: .85rem;
  align-items: center;
}

.funnel-row strong,
.milestone-row strong {
  display: block;
  color: #fff;
  font-size: .92rem;
  font-weight: 900;
}

.funnel-row span,
.milestone-row span {
  color: #8d95a8;
  font-size: .78rem;
  font-weight: 750;
}

.funnel-row em,
.milestone-row em {
  color: #dbe3f4;
  font-size: .82rem;
  font-style: normal;
  font-weight: 900;
  text-align: right;
}

.funnel-bar,
.milestone-bar {
  height: .65rem;
  overflow: hidden;
  border-radius: 999px;
  background: #0b0f17;
  box-shadow: inset 0 0 0 1px rgba(37, 43, 58, .95);
}

.funnel-bar span,
.milestone-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8b5cf6, #38bdf8);
}

.manager-interpretation {
  margin-top: 1.25rem;
  border: 1px solid rgba(56, 189, 248, .22);
  border-radius: .85rem;
  background: rgba(56, 189, 248, .08);
  padding: .85rem 1rem;
  color: #dbeafe;
  font-size: .92rem;
  line-height: 1.6;
}

.manager-list p,
.manager-warnings p,
.manager-compact-list > p {
  border: 1px solid var(--c-border);
  border-radius: .85rem;
  background: rgba(9, 12, 18, .72);
  padding: .85rem 1rem;
  color: #dbe3f4;
  font-size: .9rem;
  line-height: 1.55;
}

.manager-warnings p {
  border-color: rgba(251, 191, 36, .22);
  background: rgba(251, 191, 36, .08);
  color: #fde68a;
}

.manager-table-shell {
  overflow-x: auto;
  border: 1px solid var(--c-border);
  border-radius: .9rem;
}

.manager-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #090c12;
  font-size: .88rem;
}

.manager-table th,
.manager-table td {
  border-bottom: 1px solid var(--c-border);
  padding: .85rem 1rem;
  text-align: left;
}

.manager-table th {
  background: rgba(15, 23, 42, .82);
  color: #8d95a8;
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.manager-table td {
  color: #dbe3f4;
  vertical-align: top;
}

.manager-table tr:last-child td {
  border-bottom: 0;
}

.manager-placeholder {
  display: grid;
  gap: .85rem;
  align-content: start;
}

.manager-placeholder > span {
  display: inline-flex;
  width: fit-content;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 999px;
  background: rgba(148, 163, 184, .1);
  padding: .3rem .65rem;
  color: #cbd5e1;
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.manager-placeholder > p:last-child {
  color: #c4cbda;
  font-size: .9rem;
  line-height: 1.6;
}

.manager-compact-list a {
  display: block;
  min-width: 0;
  border: 1px solid var(--c-border);
  border-radius: .85rem;
  background: rgba(9, 12, 18, .72);
  padding: .85rem 1rem;
}

.manager-compact-list a:hover {
  border-color: rgba(167, 139, 250, .55);
}

.manager-compact-list strong,
.manager-compact-list span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manager-compact-list strong {
  color: #fff;
  font-size: .92rem;
  font-weight: 900;
}

.manager-compact-list span {
  margin-top: .35rem;
  color: #8d95a8;
  font-size: .78rem;
  font-weight: 750;
}

.chart-card {
  display: flex;
  min-height: 22rem;
  flex-direction: column;
}

.chart-title {
  color: #fff;
  font-size: 1.2rem;
  font-weight: 950;
  letter-spacing: 0;
}

.chart-total {
  margin-top: .35rem;
  color: #c4cbda;
  font-size: .92rem;
  font-weight: 750;
}

.chart-card-body {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(8.5rem, 11rem) minmax(0, 1fr);
  gap: 1.35rem;
  align-items: center;
  margin-top: 1.35rem;
}

.doughnut-chart {
  display: grid;
  width: min(100%, 11rem);
  aspect-ratio: 1;
  place-items: center;
  border-radius: 999px;
  background: var(--chart-gradient);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 18px 36px rgba(0,0,0,.25);
}

.doughnut-center {
  display: grid;
  width: 58%;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 999px;
  background: #0b0f17;
  box-shadow: 0 0 0 1px rgba(37, 43, 58, .95);
  text-align: center;
}

.doughnut-center span,
.doughnut-center small {
  display: block;
}

.doughnut-center span {
  align-self: end;
  color: white;
  font-size: 1.6rem;
  font-weight: 950;
  line-height: 1;
}

.doughnut-center small {
  align-self: start;
  margin-top: .3rem;
  color: #8d95a8;
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.chart-legend {
  display: grid;
  gap: .7rem;
  min-width: 0;
}

.legend-row,
.activity-legend-item {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: .55rem;
  color: #dbe3f4;
  font-size: .86rem;
  font-weight: 750;
}

.legend-swatch {
  width: .65rem;
  height: .65rem;
  flex: 0 0 .65rem;
  border-radius: 999px;
  background: var(--swatch-color);
  box-shadow: 0 0 14px color-mix(in srgb, var(--swatch-color) 55%, transparent);
}

.legend-label {
  min-width: 0;
  flex: 1;
}

.legend-value {
  color: white;
  font-weight: 950;
}

.legend-percent {
  min-width: 2.35rem;
  color: #8d95a8;
  text-align: right;
  font-size: .78rem;
}

.tracking-note {
  color: #93c5fd;
  font-size: .82rem;
  font-weight: 750;
}

.line-chart-shell {
  min-width: 0;
}

.line-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-grid-line {
  stroke: rgba(148, 163, 184, .16);
  stroke-width: 1;
}

.chart-axis-line {
  stroke: rgba(148, 163, 184, .24);
  stroke-width: 1.2;
}

.chart-axis-label,
.chart-week-label {
  fill: #8d95a8;
  font-size: .72rem;
  font-weight: 750;
}

.activity-line {
  fill: none;
  stroke: var(--series-color);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3.5;
  filter: drop-shadow(0 0 7px color-mix(in srgb, var(--series-color) 34%, transparent));
}

.activity-line-opened {
  stroke-dasharray: 7 7;
  opacity: .72;
}

.activity-dot {
  fill: #0b0f17;
  stroke: var(--series-color);
  stroke-width: 2.2;
}

.activity-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .85rem 1.2rem;
  margin-top: 1.2rem;
}

.activity-legend-item small {
  color: #8d95a8;
  font-size: .74rem;
  font-weight: 700;
}

@media (max-width: 1279px) {
  .chart-card-body {
    grid-template-columns: 10rem minmax(0, 1fr);
  }
}

/* On large desktops the dashboard status charts sit 4-up (xl:grid-cols-4),
   so each card is too narrow for a side-by-side donut + legend (the legend
   gets cramped). Stack the donut above a full-width legend instead. */
@media (min-width: 1280px) {
  .chart-card-body {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 1.25rem;
  }

  .chart-card-body .chart-legend {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .chart-card-body {
    grid-template-columns: 1fr;
  }

  .doughnut-chart {
    justify-self: center;
  }

  .chart-week-label {
    font-size: .62rem;
  }
}

.section-title {
  font-size: clamp(1.45rem, 2vw, 2rem);
  font-weight: 950;
  letter-spacing: 0;
  color: #fff;
}

.section-copy,
.empty-line {
  margin-top: .8rem;
  color: #c4cbda;
  line-height: 1.7;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  border-radius: .75rem;
  padding: .75rem 1.1rem;
  font-size: .9rem;
  font-weight: 850;
  transition: transform 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.btn-primary {
  background: linear-gradient(135deg, #8b5cf6, #6d5dfc);
  color: white;
  box-shadow: 0 14px 34px rgba(109, 93, 252, .24);
}

.btn-secondary {
  border: 1px solid var(--c-border-strong);
  background: rgba(15, 20, 31, .86);
  color: white;
}

.btn-primary:hover,
.btn-secondary:hover {
  transform: translateY(-1px);
}

.mini-card {
  border: 1px solid var(--c-border);
  border-radius: .75rem;
  background: #121722;
  padding: 1rem;
}

.mini-card strong,
.mini-kicker {
  display: block;
}

.mini-card strong {
  margin-top: .45rem;
  color: white;
}

.mini-kicker {
  color: #8d95a8;
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .16em;
}

.provider-card,
.preset-button,
.query-builder,
.advanced-query,
.result-card {
  border: 1px solid var(--c-border);
  border-radius: .9rem;
  background: #121722;
}

.provider-card {
  display: block;
  cursor: pointer;
  padding: 1.15rem;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.provider-card strong {
  display: block;
  margin-top: .55rem;
  color: #fff;
  font-size: 1.05rem;
}

.provider-card:hover,
.provider-card-active {
  border-color: rgba(167, 139, 250, .75);
  background: linear-gradient(180deg, rgba(139, 92, 246, .18), rgba(18, 23, 34, .98));
}

.provider-card:hover {
  transform: translateY(-1px);
}

.preset-button {
  min-height: 3rem;
  padding: .8rem 1rem;
  color: #dbe3f4;
  font-size: .9rem;
  font-weight: 800;
  text-align: left;
}

.preset-button:hover {
  border-color: rgba(167, 139, 250, .72);
  color: white;
}

.query-builder {
  padding: 1.15rem;
}

.advanced-query {
  padding: .9rem 1rem;
}

.advanced-query summary {
  cursor: pointer;
  color: #dbe3f4;
  font-size: .9rem;
  font-weight: 850;
}

.advanced-query summary:hover {
  color: #fff;
}

.result-card {
  padding: 1rem;
}

.result-card span {
  display: block;
  color: #8d95a8;
  font-size: .75rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .14em;
}

.result-card strong {
  display: block;
  margin-top: .5rem;
  color: white;
  font-size: 2rem;
  line-height: 1;
}

.discovery-activity-panel {
  align-self: start;
}

.activity-meta-row {
  display: grid;
  gap: .35rem;
  border: 1px solid var(--c-border);
  border-radius: .8rem;
  background: rgba(9, 12, 18, .72);
  padding: .85rem 1rem;
}

.activity-meta-row span {
  color: #8d95a8;
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.activity-meta-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #fff;
  font-size: .92rem;
  line-height: 1.55;
}

.activity-steps {
  display: grid;
  gap: .75rem;
  counter-reset: activity-step;
}

.activity-steps li {
  display: grid;
  grid-template-columns: 1.65rem minmax(0, 1fr);
  gap: .75rem;
  align-items: start;
  color: #dbe3f4;
  font-size: .9rem;
  line-height: 1.5;
}

.activity-steps li::before {
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  place-items: center;
  border-radius: 999px;
  background: rgba(139, 92, 246, .18);
  color: #ddd6fe;
  content: counter(activity-step);
  counter-increment: activity-step;
  font-size: .74rem;
  font-weight: 950;
}

.field {
  width: 100%;
  resize: vertical;
  appearance: none;
  border-radius: .9rem;
  border: 1px solid var(--c-border-field);
  background: #090c12;
  padding: 1rem;
  color: #f8fafc;
  outline: none;
}

.location-field {
  min-height: 3rem;
  height: 3rem;
  resize: none;
  overflow: hidden;
}

.file-field {
  width: 100%;
  border-radius: .9rem;
  border: 1px solid var(--c-border-field);
  background: #090c12;
  padding: .85rem;
  color: #dbe3f4;
  font-size: .9rem;
}

.file-field::file-selector-button {
  margin-right: 1rem;
  border: 0;
  border-radius: .65rem;
  background: #2a214f;
  padding: .6rem .85rem;
  color: #ede9fe;
  font-weight: 850;
}

.field:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 4px rgba(139, 92, 246, .15);
}

.filter-panel {
  border: 1px solid var(--c-border);
  border-radius: 1rem;
  background: linear-gradient(180deg, rgba(18, 23, 34, .92), rgba(10, 13, 20, .95));
  padding: 1rem;
  box-shadow: 0 16px 40px rgba(0,0,0,.18);
}

.filter-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: .85rem;
  align-items: end;
}

.filter-field {
  display: grid;
  gap: .4rem;
  min-width: 0;
}

.filter-field span {
  color: #8d95a8;
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.filter-select {
  width: 100%;
  min-height: 2.75rem;
  appearance: none;
  border: 1px solid var(--c-border-field);
  border-radius: .75rem;
  background:
    linear-gradient(45deg, transparent 50%, #a78bfa 50%) calc(100% - 1rem) 1.18rem / .36rem .36rem no-repeat,
    linear-gradient(135deg, #a78bfa 50%, transparent 50%) calc(100% - .75rem) 1.18rem / .36rem .36rem no-repeat,
    #090c12;
  color: #f8fafc;
  font-size: .9rem;
  font-weight: 750;
  outline: none;
  padding: .7rem 2rem .7rem .85rem;
}

.filter-select:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 4px rgba(139, 92, 246, .15);
}

.filter-actions {
  display: flex;
  gap: .65rem;
  white-space: nowrap;
}

.filter-actions .btn-primary,
.filter-actions .btn-secondary {
  min-height: 2.75rem;
  padding: .65rem .9rem;
}

.table-head,
.table-cell {
  padding: .9rem 1rem;
}

.leads-table {
  width: 100%;
  min-width: 900px;
  table-layout: fixed;
}

.leads-table th:nth-child(1) {
  width: 8.75rem;
}

.leads-table th:nth-child(2) {
  width: 7.4rem;
}

.leads-table th:nth-child(4) {
  width: 12rem;
}

.leads-table th:nth-child(5) {
  width: 7rem;
}

/* Column 6 is now "Obserwujący / Kontakty" (the Sygnał column was removed
   from the user-facing table). Column 7, "Przypisany do", auto-sizes. */
.leads-table th:nth-child(6) {
  width: 8rem;
}

.profile-url-head,
.profile-url-cell {
  width: 22%;
  max-width: 22rem;
}

.profile-url-cell {
  min-width: 0;
}

.profile-url-link,
.username-cell {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions-cell {
  width: 16.5rem;
  min-width: 16.5rem;
  position: sticky;
  right: 0;
  z-index: 1;
  background: #090c12;
  box-shadow: -14px 0 24px rgba(7, 9, 15, .75);
}

thead .actions-cell {
  z-index: 2;
  background: #0f172a;
}

.leads-table tbody tr:hover .actions-cell {
  background: #0f172a;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
}

.action-row {
  display: flex;
  justify-content: center;
  gap: .4rem;
}

.action-buttons form {
  flex: 0 0 auto;
}

.pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .3rem .65rem;
  font-size: .75rem;
  font-weight: 850;
}

.pill {
  background: rgba(99, 102, 241, .12);
  color: #c4b5fd;
}

.status-pill {
  background: rgba(148, 163, 184, .1);
  color: #e2e8f0;
}

/* Per-status badge colors mirror the action-button colors (same rgba values).
   `new` and `contacted` fall back to the neutral .status-pill above.
   Spam is a flag (is_spam), not a status, and spam leads are hidden from the
   queue, so there is no spam badge here. */
.status-pill--accepted {
  background: rgba(16, 185, 129, .12);
  color: #a7f3d0;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, .45);
}

.status-pill--rejected {
  background: rgba(248, 113, 113, .12);
  color: #fecaca;
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, .45);
}

.status-pill--archived {
  background: rgba(148, 163, 184, .12);
  color: #cbd5e1;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, .4);
}

.status-pill--extra {
  background: rgba(245, 158, 11, .12);
  color: #fcd34d;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, .6);
}

.btn-table {
  min-height: 2rem;
  border-radius: .55rem;
  border: 1px solid var(--c-border-strong);
  padding: .35rem .48rem;
  color: #e5e7eb;
  font-size: .74rem;
  font-weight: 850;
}

.btn-table:hover {
  border-color: #8b5cf6;
}

.btn-accept {
  border-color: rgba(16, 185, 129, .45);
  color: #a7f3d0;
}

.btn-reject {
  border-color: rgba(248, 113, 113, .45);
  color: #fecaca;
}

.btn-archive {
  border-color: rgba(148, 163, 184, .4);
  color: #cbd5e1;
}

.btn-extra {
  border-color: rgba(245, 158, 11, .6);
  color: #fcd34d;
  background: rgba(245, 158, 11, .12);
}

.btn-spam {
  border-color: rgba(244, 63, 94, .5);
  color: #fca5a5;
  background: rgba(244, 63, 94, .12);
}

@media (max-width: 1023px) {
  .app-sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
  }

  .app-sidebar .mt-auto {
    display: none;
  }

  /* Compact top bar: brand on the left, collapse toggle on the right.
     DOM order is [toggle, brand], so row-reverse puts the brand first. */
  .sidebar-top {
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1rem;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-nav .nav-item {
    flex: 1 1 7rem;
    justify-content: center;
  }

  /* The toggle is the mobile/tablet expand-collapse control. Existing JS
     flips .sidebar-collapsed on <html> + the cookie, so no JS change is
     needed — we only need the button visible here. */
  .sidebar-toggle {
    display: grid;
    align-self: center;
  }

  /* On small screens the toggle reads vertically: expanded shows an up
     chevron (fold up), collapsed shows a down chevron (drop down). The
     base icons point left/right, so rotate them 90deg here only. */
  .sidebar-toggle-icon {
    transform: rotate(90deg);
  }

  .sidebar-collapsed .sidebar-toggle-open {
    display: none;
  }

  .sidebar-collapsed .sidebar-toggle-closed {
    display: inline;
  }

  /* Collapsed on small screens = nav hidden, leaving just the compact bar.
     The toggle stays reachable, so navigation is never inaccessible. */
  .sidebar-collapsed .sidebar-nav {
    display: none;
  }

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

  .filter-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .filter-form {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    flex-wrap: wrap;
  }
}

/* ────────────────────────────────────────────────────────────────────────
   Discovery v2 — step cards, depth picker, side panel
   ───────────────────────────────────────────────────────────────────── */
.step-card-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.step-badge {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 2.25rem;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(139, 92, 246, .28), rgba(88, 80, 236, .15));
  border: 1px solid rgba(167, 139, 250, .42);
  color: #ddd6fe;
  font-size: .9rem;
  font-weight: 950;
}

.depth-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  padding: 1rem 1.1rem;
  border: 1px solid var(--c-border);
  border-radius: .9rem;
  background: rgba(15, 20, 31, .55);
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.depth-card:hover {
  border-color: rgba(167, 139, 250, .55);
  background: rgba(139, 92, 246, .06);
}

.depth-card-active {
  border-color: #a78bfa;
  background: linear-gradient(135deg, rgba(139, 92, 246, .14), rgba(15, 20, 31, .85));
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, .35), 0 14px 34px rgba(0, 0, 0, .28);
}

.depth-card-main {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-width: 0;
}

.depth-card-main strong {
  color: #fff;
  font-size: 1rem;
  font-weight: 850;
}

.depth-card-meta {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.depth-card-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(148, 163, 184, .12);
  padding: .3rem .65rem;
  font-size: .72rem;
  font-weight: 850;
  color: #cbd5e1;
  white-space: nowrap;
}

.depth-card-active .depth-card-pill {
  background: rgba(167, 139, 250, .18);
  color: #ddd6fe;
}

.discovery-summary {
  display: grid;
  gap: .55rem;
}

.discovery-summary > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .75rem;
  align-items: baseline;
  padding: .55rem .75rem;
  border-radius: .55rem;
  background: rgba(15, 20, 31, .55);
  border: 1px solid var(--c-border);
}

.discovery-summary dt {
  font-size: .72rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #8d95a8;
}

.discovery-summary dd {
  font-size: .85rem;
  font-weight: 850;
  color: #e2e8f0;
  text-align: right;
  overflow-wrap: anywhere;
  margin: 0;
}

.discovery-checklist {
  display: grid;
  gap: .35rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.discovery-checklist li {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .45rem .65rem;
  border-radius: .5rem;
  background: rgba(15, 20, 31, .45);
  border: 1px solid var(--c-border);
  font-size: .82rem;
  color: #94a3b8;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.discovery-checklist li::before {
  content: "○";
  color: #475569;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.discovery-checklist li[data-done="true"] {
  color: #d1fae5;
  border-color: rgba(16, 185, 129, .35);
  background: rgba(16, 185, 129, .08);
}

.discovery-checklist li[data-done="true"]::before {
  content: "✓";
  color: #6ee7b7;
}

/* ────────────────────────────────────────────────────────────────────────
   Odrzuceni archive table — auto layout so URL/Etykieta takes the slack
   instead of the fixed review-queue column widths.
   ───────────────────────────────────────────────────────────────────── */
.rejected-table {
  table-layout: auto;
  width: 100%;
  min-width: 720px;
}

.rejected-table .rejected-url {
  display: block;
  max-width: 0;          /* let the auto layout give this cell the remainder */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rejected-table td.table-cell:nth-child(4),
.rejected-table th.table-head:nth-child(4) {
  width: 100%;           /* URL column absorbs the free horizontal space */
}

.rejected-col-date,
.rejected-col-provider,
.rejected-col-actor,
.rejected-col-action {
  white-space: nowrap;
}

.rejected-col-reason {
  max-width: 16rem;
}

/* ────────────────────────────────────────────────────────────────────────
   Review Queue — boss/admin assignment panel
   ───────────────────────────────────────────────────────────────────── */
.assign-worker {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem .7rem;
  border-radius: .55rem;
  border: 1px solid var(--c-border);
  background: rgba(15, 20, 31, .55);
  font-size: .85rem;
  color: #e2e8f0;
  cursor: pointer;
}

.assign-worker:hover {
  border-color: rgba(167, 139, 250, .5);
}

.assign-worker input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: #8b5cf6;
}

/* ────────────────────────────────────────────────────────────────────────
   Discovery wizard — one step at a time.
   Steps are visible by DEFAULT (no-JS fallback shows them all stacked).
   They are only hidden once JS adds .js-discovery-wizard to <html>.
   ───────────────────────────────────────────────────────────────────── */
.js-discovery-wizard .step-card {
  display: none;
}

.js-discovery-wizard .step-card.is-active {
  display: block;
}

.wizard-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--c-border);
}

.wizard-step-indicator {
  font-size: .8rem;
  font-weight: 850;
  letter-spacing: .04em;
  color: #8d95a8;
}

.discovery-summary-recap {
  display: grid;
  gap: .5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.discovery-summary-recap li {
  position: relative;
  padding-left: 1.4rem;
  font-size: .9rem;
  line-height: 1.5;
  color: #cbd5e1;
}

.discovery-summary-recap li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: #a78bfa;
  font-weight: 900;
}
