:root {
  color-scheme: dark;

  --frame-bg-1: #58544c;
  --frame-bg-2: #423e38;
  --frame-border: #a8874f;
  --frame-border-dim: #6b5a3c;
  --panel: rgba(20, 19, 17, 0.35);
  --panel-border: rgba(168, 135, 79, 0.35);
  --row-alt: rgba(255, 255, 255, 0.035);
  --row-hover: rgba(255, 255, 255, 0.06);

  --text: #e9e4d8;
  --text-dim: #b6ae9e;
  --text-faint: #8a8271;
  --gold: #d8b877;
  --gold-dim: #a8874f;
  --link: #6fd2e8;
  --tag-green: #8fd18a;

  --danger: #e0685f;
  --good: #6fbf8b;

  --role-tank: #4f8fd6;
  --role-healer: #4cbf6f;
  --role-dps: #d8534c;
  --role-any: #9198ab;
  --slot-border: #1c1a16;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #2b2a27, #17160f 70%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  padding: 1.5rem;
}

.frame {
  max-width: 1100px;
  margin: 0 auto;
  background: linear-gradient(180deg, var(--frame-bg-1), var(--frame-bg-2));
  border: 1px solid var(--frame-border);
  border-radius: 8px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

/* --- Title bar --- */

.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.05));
  border-bottom: 1px solid var(--frame-border-dim);
}

.titlebar h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--gold);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.titlebar-sub {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-faint);
  margin-left: 0.4rem;
}

.titlebar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--frame-border-dim);
  color: var(--text-dim);
  border-radius: 6px;
  width: 2rem;
  height: 2rem;
  padding: 0;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.gear-btn:hover {
  color: var(--gold);
  border-color: var(--gold-dim);
}

.refresh-btn {
  background: transparent;
  border: 1px solid var(--frame-border-dim);
  color: var(--text-dim);
  border-radius: 6px;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}

.refresh-btn:hover:not(:disabled) {
  color: var(--gold);
  border-color: var(--gold-dim);
}

.refresh-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.refresh-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.refresh-timer {
  font-size: 0.72rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  min-width: 6.5em;
}

/* --- Settings panel --- */

.panel {
  margin: 0.75rem 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
}

.panel.hidden {
  display: none;
}

.panel h2 {
  margin: 0 0 0.6rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--text-dim);
}

label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

input,
select {
  background: #1c1a16;
  border: 1px solid var(--frame-border-dim);
  color: var(--text);
  padding: 0.4rem 0.55rem;
  border-radius: 5px;
  font-size: 0.88rem;
}

input:focus,
select:focus {
  outline: 1px solid var(--gold-dim);
}

.ilvl-range {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ilvl-range input {
  width: 4.5rem;
}

.ilvl-range-sep {
  color: var(--text-faint);
}

button {
  background: var(--gold);
  border: none;
  color: #1c1a16;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 5px;
  cursor: pointer;
}

/* --- Toggle rows (icon/pill multi-select: Data Center, Jobs) ---
   Shared by the DC picker (regions -> data centers) and the Jobs picker
   (roles -> classes). Each group is "All-or-nothing" via its parent pill;
   children toggle independently, so you can mix broad (role/region) and
   specific (job/DC) selections freely. */

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.dc-row {
  padding: 0.75rem 1.25rem 0;
}

.toggle-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.2);
}

.toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
}

.toggle-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.toggle-btn.active {
  border-color: var(--gold);
  background: rgba(216, 184, 119, 0.15);
  color: var(--gold);
}

.toggle-btn img {
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.toggle-group-btn img {
  width: 26px;
  height: 26px;
}

/* Job picker icons read better bigger than the plain DC text pills. */
.job-picker .toggle-btn img {
  width: 34px;
  height: 34px;
}

.job-picker .toggle-group-btn img {
  width: 40px;
  height: 40px;
}

.toggle-all {
  font-weight: 700;
}

/* --- Category icon filter row --- */

.category-row {
  display: flex;
  gap: 0.4rem;
  padding: 0.75rem 1.25rem 0;
  flex-wrap: wrap;
}

.category-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  min-width: 44px;
}

.category-btn:hover {
  background: rgba(0, 0, 0, 0.4);
}

.category-btn.active {
  border-color: var(--gold);
  background: rgba(216, 184, 119, 0.12);
}

.category-icon {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #14130f;
}

.category-icon-all {
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  color: #14130f;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.category-count {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dim);
}

.category-btn.active .category-count {
  color: var(--gold);
}

.search-input {
  flex: 1 1 240px;
}

.search-input.invalid {
  border-color: var(--danger);
  outline: 1px solid var(--danger);
}

.duty-select {
  flex: 1 1 200px;
}

/* Any control that currently represents an active filter gets the same
   gold-border treatment as the selected toggle pills/tabs, so it's obvious
   at a glance which filters are actually doing something right now. */
.filter-active {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 1px var(--gold);
}

label.checkbox.filter-active {
  border-radius: 5px;
  box-shadow: 0 0 0 1px var(--gold);
  padding: 0.1rem 0.35rem;
  margin: -0.1rem -0.35rem;
}

/* --- Filters panel (search + beginners toggle + jobs + ilvl) --- */

.profile-panel .row + .row {
  margin-top: 0.6rem;
}

.sprout-toggle-btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
}

.sprout-toggle-btn img {
  width: 26px;
  height: 26px;
}

.sprout-toggle-btn.active {
  border-color: var(--gold);
  background: rgba(216, 184, 119, 0.15);
}

/* --- Table header + listing rows --- */

main {
  padding: 0.75rem 1.25rem 0;
}

.list-header,
.listing {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) 180px 70px 170px;
  gap: 0.6rem;
  align-items: center;
}

.list-header {
  padding: 0.3rem 0.5rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  border-bottom: 1px solid var(--frame-border-dim);
}

.listings {
  display: flex;
  flex-direction: column;
}

.listing {
  padding: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.listing:nth-child(even) {
  background: var(--row-alt);
}

.listing:hover {
  background: var(--row-hover);
}

.col-icon {
  display: flex;
  justify-content: center;
}

.duty-icon {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #14130f;
  overflow: hidden;
}

.duty-icon img,
.category-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.col-duty {
  min-width: 0;
}

.duty-title-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sprout-icon {
  flex-shrink: 0;
  display: flex;
  width: 16px;
  height: 16px;
}

.sprout-icon.hidden {
  display: none;
}

.sprout-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.duty-name {
  color: var(--link);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  cursor: default;
}

/* Search-match highlight, used on duty name, description, and recruiter
   name — reset the browser's default yellow-background <mark> in favor of
   the site's own gold accent so it fits the dark theme. */
mark.search-hit {
  background: none;
  color: var(--gold);
  font-weight: 700;
}

.duty-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.listing-expandable {
  cursor: pointer;
}

/* Click a row to see the full description across multiple lines instead of
   the single-line ellipsis truncation above. */
.listing.expanded .duty-sub {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

.listing-tags:empty {
  display: none;
}

.listing-description {
  font-weight: 600;
  font-size: 0.9rem;
}

.pf-tag {
  margin-right: 0.1rem;
}

.pf-tag-plain {
  color: var(--text-dim);
}

.pf-tag-green {
  color: var(--good);
}

.pf-tag-gold {
  color: var(--gold);
}

.pf-tag-cyan {
  color: var(--link);
}

.duty-dc {
  flex-shrink: 0;
  color: #b18cf0;
  font-weight: 700;
  font-size: 0.72rem;
}

.duty-dc.hidden {
  display: none;
}

.duty-world {
  flex-shrink: 0;
  color: #e07fc0;
  font-weight: 700;
  font-size: 0.72rem;
}

.duty-world.hidden {
  display: none;
}

.col-role {
  display: flex;
  align-items: center;
}

.listing-jobs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
}

.col-ilvl {
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: center;
}

.col-recruiter {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
}

.recruiter-icon {
  color: #b18cf0;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.col-recruiter .leader-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Job squares (role slots) --- */

.job-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 24px;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  color: #fff;
  box-shadow: inset 0 0 0 1.5px var(--slot-border);
}

.job-chip.role-tank {
  background: var(--role-tank);
}

.job-chip.role-healer {
  background: var(--role-healer);
}

.job-chip.role-dps {
  background: var(--role-dps);
}

.job-chip.role-any {
  background: var(--role-any);
  color: #14130f;
}

.job-chip.matches {
  box-shadow: inset 0 0 0 1.5px var(--slot-border), 0 0 0 2px var(--gold);
}

/* Open (unfilled) slots: same role-colored square as a filled slot (still
   showing what role is needed), just dimmed, so filled vs. open reads at a
   glance without losing the color meaning. Every label here is one
   character or one emoji, so no size variant is needed. */
.job-chip.open-slot {
  opacity: 0.6;
}

.job-chip.open-slot.matches {
  opacity: 0.85;
}

.job-chip-more {
  font-size: 0.7rem;
  color: var(--text-faint);
  align-self: center;
}

/* Multi-party content (alliance raids, field operations): one letter box
   per linked party instead of per-seat job squares, since filled-seat job
   data isn't trustworthy beyond a single party. */
.job-chip.party-letter {
  background: var(--gold);
  color: #14130f;
}

.job-chip.party-full {
  background: #3a382f;
  color: #fff;
}

/* --- Status footer --- */

.status-line {
  color: var(--danger);
  font-size: 0.8rem;
  padding: 0.5rem;
}

.empty-state {
  color: var(--text-faint);
  padding: 2.5rem 0;
  text-align: center;
}

.empty-state p {
  margin: 0 0 0.4rem;
}

.empty-state-sub {
  color: var(--text-dim);
  font-size: 0.85rem;
  max-width: 420px;
  margin: 0 auto;
}

.statusbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--frame-border-dim);
  background: rgba(0, 0, 0, 0.15);
}

.result-count {
  color: var(--text-faint);
  font-size: 0.8rem;
}

@media (max-width: 800px) {

  .list-header,
  .listing {
    grid-template-columns: 66px minmax(0, 1fr) 130px 55px;
  }

  .col-recruiter {
    display: none;
  }
}