:root {
  --navy: #0b1020;
  --navy-2: #121735;
  --navy-3: #1a2047;
  --ink: #e8ebff;
  --muted: #aab0d6;
  --gold: #ffd05a;
  --gold-2: #ffb400;
  --accent: #7aa2ff;
  --ok: #2ecc71;
  --warn: #ffb347;
  --err: #ff6b6b;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: light) {
  :root {
    --navy: #0b1020;
  } /* keep brand dark even in light mode */
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font:
    15px/1.55 ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    "Noto Sans",
    "Apple Color Emoji",
    "Segoe UI Emoji";
  background:
    radial-gradient(1200px 600px at 10% -10%, #1a2047 0%, transparent 60%),
    radial-gradient(900px 500px at 90% 10%, #0f1540 0%, transparent 55%),
    radial-gradient(600px 300px at 50% 120%, #121735 0%, transparent 60%),
    var(--navy);
  background-attachment: fixed;
  color: var(--ink);
}

a,
a:visited {
  color: var(--muted);
}

.wrap {
  max-width: 1060px;
  margin: 36px auto 56px;
  padding: 0 20px;
}

header {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

header img {
  width: 92px;
  height: 92px;
  border-radius: 20px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

header h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 12px;
}

header p {
  margin: 6px 0 0 0;
  color: var(--muted);
}

.badge {
  display: inline-block;
  font-weight: 700;
  letter-spacing: 0.6px;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  color: #1b1200;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  box-shadow: 0 8px 26px rgba(255, 208, 90, 0.25);
}

.card {
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.04),
    rgba(255, 255, 255, 0.02)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: blur(8px);
  /* prevent grid overflow from long content */
  min-width: 0;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 840px) {
  .grid {
    /* allow tracks to shrink even with long content */
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  }
}

label {
  font-weight: 700;
  display: block;
  margin-bottom: 6px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
}

textarea,
input,
select {
  width: 100%;
  background: #0f1633;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 208, 90, 0.2);
}

.row {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr 1fr;
}

.filters-grid {
  display: grid;
  column-gap: 14px;
  row-gap: 6px;
  grid-template-columns: minmax(0, 1fr);
}

.filters-grid .filter-label {
  margin: 0;
}

.filters-grid .filter-label--spaced {
  margin-top: 8px;
}

@media (min-width: 720px) {
  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 719px) {
  .filters-grid label[for="components"] {
    order: 1;
  }

  .filters-grid textarea#components {
    order: 2;
  }

  .filters-grid label[for="whiteboards"] {
    order: 3;
  }

  .filters-grid textarea#whiteboards {
    order: 4;
  }

  .filters-grid label[for="metabugs"] {
    order: 5;
  }

  .filters-grid textarea#metabugs {
    order: 6;
  }

  .filters-grid label[for="assignees"] {
    order: 7;
  }

  .filters-grid textarea#assignees {
    order: 8;
  }
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-block: 12px;
}

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

.actions-row .actions {
  margin: 0;
  flex: 0 0 auto;
}

.actions-row .status {
  margin: 0;
  flex: 1 1 240px;
}

button {
  border: 0;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  color: #1b1200;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  box-shadow: 0 8px 26px rgba(255, 208, 90, 0.22);
  transition: transform 0.06s ease;
}

button.secondary {
  background: #1b214b;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
}

.status {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 22px;
  color: var(--muted);
}

.progress {
  margin: 8px 0 14px;
  height: 10px;
  background: #0f1633;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}

.progress .bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  transition: width 0.2s ease;
}

.phase-title {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.kicker {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 6px;
}

.out {
  background: #0f1633;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 14px;
  border-radius: 12px;
  min-height: 160px;
  white-space: pre-wrap;
  overflow: auto;
  overflow-wrap: anywhere;
}

.log {
  background: #0b122c;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  padding: 12px;
  border-radius: 12px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  /* extra safety so long tokens never blow out the column */
  max-width: 100%;
  word-break: break-word;
}

.log .line {
  margin: 0;
  opacity: 0.95;
}

.log .info {
  color: #b9c3ff;
}

.log .warn {
  color: var(--warn);
}

.log .error {
  color: var(--err);
}

details {
  margin-top: 10px;
  max-width: 100%;
}

summary {
  cursor: pointer;
  color: var(--muted);
}

.footer {
  margin-top: 22px;
  padding-bottom: 22px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  text-align: center;
}

.footer .source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.footer .footer-source {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.footer .source-link svg {
  width: 14px;
  height: 14px;
  display: block;
  transform: translateY(1px);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #0f1633;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.link-like {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.progress .bar.indeterminate {
  position: absolute;
  top: 0;
  height: 100%;
  width: 40%; /* chunk size; tweak as desired */
  left: -40%; /* start just off the left edge */
  animation: indet 2s ease-in-out infinite;
}
@keyframes indet {
  from {
    left: -40%;
  } /* fully off left */
  to {
    left: 100%;
  } /* fully off right */
}

/* Saved Searches Section */
.saved-searches-section {
  margin: 24px 0 18px 0;
}

.saved-searches-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0;
}

.saved-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--navy-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  max-width: 280px;
}

.saved-search:hover {
  background: var(--navy-3);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.search-name {
  color: var(--ink);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  cursor: pointer;
}

.search-name-deleted {
  color: var(--muted);
  text-decoration: line-through;
  font-size: 14px;
  flex: 1;
}

.search-name-input {
  background: var(--navy-3);
  border: 1px solid var(--accent);
  color: var(--ink);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 14px;
  width: 180px;
  font-family: inherit;
}

.edit-btn,
.share-btn,
.delete-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  opacity: 0.6;
  transition:
    opacity 0.2s ease,
    color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.edit-btn svg,
.share-btn svg,
.delete-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.edit-btn:hover {
  opacity: 1;
  color: var(--gold);
}

.share-btn:hover {
  opacity: 1;
  color: var(--accent);
}

.delete-btn:hover {
  opacity: 1;
  color: var(--err);
}

.new-tab-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-left: 4px;
  animation: fadeIn 0.2s ease;
}

.new-tab-indicator svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  pointer-events: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.undo-btn {
  background: var(--accent);
  border: none;
  color: var(--navy);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.undo-btn:hover {
  background: var(--gold);
}

#save-search {
  margin-left: 12px;
}

/* overlay for bursts */
#fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

@media (prefers-reduced-motion: reduce) {
  .progress .bar {
    transition: none;
  }

  button {
    transition: none;
  }
}
