/* FFXIV BIS Gear Searcher - responsiv, dunkles Theme. */
:root {
  --bg: #14161b;
  --bg-card: #1d2027;
  --bg-soft: #23262f;
  --fg: #e6e8ec;
  --fg-dim: #9aa0ac;
  --accent: #6ea8fe;
  --border: #2a2e37;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-size: 15px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--fg-dim); }

/* Header + Filterleiste: zusammen oben fixiert */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); }
.app-header {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .6rem 1rem; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.app-header h1 { font-size: 1.1rem; margin: 0; white-space: nowrap; }
.tabs { display: flex; gap: .4rem; flex: 1; }
.tabs button, .lang-toggle button {
  background: var(--bg-soft); color: var(--fg-dim);
  border: 1px solid var(--border); border-radius: 6px;
  padding: .3rem .7rem; cursor: pointer; font-size: .9rem;
}
.tabs button.active { color: var(--fg); border-color: var(--accent); background: #25304a; }
.lang-toggle { display: flex; gap: .3rem; }
.lang-toggle button.active { color: var(--fg); border-color: var(--accent); }

/* Account-Control (Login/Logout) */
.account { display: flex; gap: .4rem; align-items: center; }
.account .acct-name { color: var(--fg); font-size: .9rem; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .acct-btn {
  background: var(--bg-soft); color: var(--fg-dim); text-decoration: none;
  border: 1px solid var(--border); border-radius: 6px;
  padding: .3rem .7rem; cursor: pointer; font-size: .9rem; line-height: 1.4;
}
.account .acct-btn:hover { color: var(--fg); border-color: var(--accent); }

/* ===== Dashboard shell (left sidebar + content) ===== */
.app-shell { display: flex; width: 100%; min-height: 100vh; }
.sidebar {
  width: 220px; flex: 0 0 220px; background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { padding: 1rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .5rem; }
.brand-logo { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 7px; display: block; }
.sidebar-brand h1 { font-size: 1.1rem; margin: 0; white-space: nowrap; flex: 1; }
.pin-btn {
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  cursor: pointer; font-size: 1rem; padding: .2rem .35rem; opacity: .55; filter: grayscale(1);
}
.pin-btn:hover { background: var(--bg-soft); }
.pin-btn[aria-pressed="true"] { opacity: 1; filter: none; border-color: var(--accent); }
.nav { display: flex; flex-direction: column; gap: .2rem; padding: .6rem; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left;
  background: transparent; color: var(--fg-dim); border: 1px solid transparent;
  border-radius: 8px; padding: .5rem .7rem; cursor: pointer; font-size: .95rem;
}
.nav-item:hover { background: var(--bg-soft); color: var(--fg); }
.nav-item.active { background: #25304a; color: var(--fg); border-color: var(--accent); }
.nav-ico { width: 1.3rem; text-align: center; }
.sidebar-foot { padding: .6rem; border-top: 1px solid var(--border); }

.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.content-head {
  display: flex; align-items: center; gap: 1rem; position: sticky; top: 0; z-index: 20;
  padding: .6rem 1rem; border-bottom: 1px solid var(--border); background: var(--bg);
}
.content-head .spacer { flex: 1; }
.view-title { font-size: 1.05rem; font-weight: 600; }
#sidebar-toggle { display: none; }
.scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 30; }
.filter-bar[hidden] { display: none; }

/* Unpinned (desktop): sidebar becomes a collapsible overlay driven by the burger. */
.app-shell.nav-unpinned .sidebar {
  position: fixed; left: 0; top: 0; height: 100vh; z-index: 40;
  transform: translateX(-100%); transition: transform .2s ease;
}
.app-shell.nav-unpinned.nav-open .sidebar { transform: translateX(0); }
.app-shell.nav-unpinned #sidebar-toggle { display: inline-flex; }
.app-shell.nav-unpinned.nav-open .scrim { display: block; }

/* ===== Dashboard widgets ===== */
.dash { padding: 1rem; }
.dash-bar { display: flex; justify-content: flex-end; gap: .4rem; margin-bottom: .8rem; }
.btn-ghost { background: transparent; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.dash-cell { position: relative; }
.dash-grid.editing .widget { border-style: dashed; }
.dash-edit { position: absolute; top: .4rem; right: .4rem; display: flex; gap: .2rem; z-index: 2; }
.dash-edit-btn {
  width: 1.6rem; height: 1.6rem; line-height: 1; padding: 0; cursor: pointer;
  background: var(--bg-soft); color: var(--fg); border: 1px solid var(--border); border-radius: 5px; font-size: .9rem;
}
.dash-edit-btn:hover:not(:disabled) { border-color: var(--accent); }
.dash-edit-btn:disabled { opacity: .35; cursor: default; }
.dash-edit-hide:hover { border-color: #c0506a; color: #e07a90; }
.dash-hidden { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: 1rem;
  padding-top: .8rem; border-top: 1px dashed var(--border); }
.widget { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.widget-title { margin: 0 0 .6rem; font-size: 1rem; }
.widget-body { color: var(--fg); font-size: .92rem; }
.widget-links { display: flex; flex-wrap: wrap; gap: .4rem; }
.btn {
  display: inline-block; background: var(--bg-soft); color: var(--fg); text-decoration: none;
  border: 1px solid var(--border); border-radius: 6px; padding: .4rem .8rem; cursor: pointer; font-size: .9rem;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-accent { border-color: var(--accent); background: #25304a; }
.badge-soon { display: inline-block; margin-top: .4rem; font-size: .75rem; color: var(--fg-dim);
  border: 1px dashed var(--border); border-radius: 6px; padding: .1rem .5rem; }
.dash-gear-head { margin: 0 0 .4rem; }
.dash-gear-head strong { font-size: 1.3rem; color: var(--accent); }
.dash-gap-label { margin: .3rem 0 .2rem; font-size: .8rem; }
.dash-gaps { list-style: none; margin: 0 0 .6rem; padding: 0; display: flex; flex-direction: column; gap: .15rem; }
.dash-gaps li { display: flex; justify-content: space-between; gap: .5rem; font-size: .88rem; }
.dash-gap-job { cursor: pointer; }
.dash-gap-job:hover { color: var(--accent); text-decoration: underline; }
.dash-gap-score { color: #e0a44a; font-variant-numeric: tabular-nums; }
.stat-row { display: flex; align-items: baseline; gap: .5rem; padding: .2rem 0; }
.stat-num { font-size: 1.4rem; font-weight: 700; color: var(--accent); }
.stat-lbl { color: var(--fg-dim); font-size: .85rem; }

/* ===== My Gear vs BiS ===== */
.gi-char { margin: 0 0 .8rem; font-weight: 600; }
.gi-char .muted { font-weight: 400; }
/* Two cards per row on wide screens; collapses to one when narrow (responsive). */
.gi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
  gap: 1rem; align-items: start; }
.gearset-card { padding: 0; overflow: hidden; }

/* Header row: collapse · title · avg-ilvl · score · hide */
.gi-head { display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem;
  border-bottom: 1px solid var(--border); }
.gi-title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gi-collapse, .gi-hide { background: none; border: 0; color: var(--fg-dim); cursor: pointer;
  font-size: .9rem; line-height: 1; padding: .2rem; border-radius: 4px; flex: 0 0 auto; }
.gi-collapse:hover, .gi-hide:hover { color: var(--fg); background: var(--bg-soft); }
.gi-avg { font-size: .72rem; color: var(--fg-dim); border: 1px solid var(--border);
  border-radius: 6px; padding: .1rem .4rem; white-space: nowrap; flex: 0 0 auto; }
.gi-score { font-size: .75rem; font-weight: 600; color: var(--fg-dim);
  border: 1px solid var(--border); border-radius: 6px; padding: .1rem .45rem; white-space: nowrap; flex: 0 0 auto; }
.gi-score-full { color: #5bd66e; border-color: #2f6b38; }
.gi-score-warn { color: #e0a44a; border-color: #6b5224; cursor: help; }
.gi-score-none { font-weight: 400; }
.gearset-card.is-collapsed .gi-body { display: none; }

.gi-body { padding: .5rem .7rem .7rem; }

/* Comparison-target picker (searchable combobox) */
.gi-targetrow { display: flex; align-items: center; gap: .4rem; font-size: .8rem;
  color: var(--fg-dim); margin-bottom: .55rem; position: relative; }
.gi-target-lbl { flex: 0 0 auto; }
.gi-combo-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: .3rem;
  background: var(--bg-soft); color: var(--fg); border: 1px solid var(--border);
  border-radius: 6px; padding: .25rem .5rem; cursor: pointer; font-size: .82rem; }
.gi-combo-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.gi-caret { color: var(--fg-dim); flex: 0 0 auto; }
.gi-combo-btn .gi-opt-dps { flex: 0 0 auto; }
.gi-target-link { flex: 0 0 auto; color: var(--fg-dim); text-decoration: none; font-size: .85rem; padding: 0 .15rem; }
.gi-target-link:hover { color: var(--accent); }
.gi-combo-searchwrap { position: relative; margin-bottom: .25rem; }
.gi-combo-clear { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%);
  background: none; border: 0; color: var(--fg-dim); cursor: pointer; font-size: .8rem; line-height: 1; padding: .15rem; }
.gi-combo-clear:hover { color: var(--fg); }
.gi-opt-meta { display: inline-flex; align-items: center; gap: .4rem; flex: 0 0 auto; }
.gi-opt-dps { font-size: .7rem; color: var(--accent); white-space: nowrap; }
.gi-combo-panel { position: absolute; z-index: 20; top: 100%; left: 0; right: 0; margin-top: .25rem;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); padding: .4rem; }
.gi-combo-search { width: 100%; box-sizing: border-box; background: var(--bg-soft); color: var(--fg);
  border: 1px solid var(--border); border-radius: 6px; padding: .3rem 1.7rem .3rem .5rem; font-size: .82rem; }
.gi-combo-help { margin: 0 0 .35rem; font-size: .7rem; color: var(--fg-dim); line-height: 1.3; }
.gi-cat-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .35rem; }
.gi-cat-chip { background: var(--bg-soft); color: var(--fg); border: 1px solid var(--border);
  border-radius: 999px; padding: .1rem .55rem; font-size: .72rem; cursor: pointer; }
.gi-cat-chip:hover { border-color: var(--accent); }
.gi-cat-chip.off { color: var(--fg-dim); opacity: .5; text-decoration: line-through; }
.gi-combo-list { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.gi-opt { display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  background: none; border: 0; color: var(--fg); cursor: pointer; text-align: left;
  padding: .3rem .45rem; border-radius: 5px; font-size: .82rem; }
.gi-opt:hover { background: var(--bg-soft); }
.gi-opt.is-sel { background: var(--bg-soft); border-left: 2px solid var(--accent); }
.gi-opt.hidden { display: none; }
.gi-opt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gi-opt-tag { flex: 0 0 auto; font-size: .7rem; color: var(--fg-dim); }

/* Slot rows: [slot] [item name (truncates)] [ilvl+link — fixed right]; melds/suggest span below. */
.gi-rows { display: flex; flex-direction: column; gap: .15rem; }
.gi-row { display: grid; grid-template-columns: 4.3rem minmax(0, 1fr) max-content;
  align-items: center; column-gap: .5rem; row-gap: .12rem; padding: .25rem .35rem; border-radius: 5px; }
.gi-row.gi-bad { background: rgba(214, 69, 69, .12); }
.gi-slot { color: var(--fg-dim); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gi-cur { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.gi-bad > .gi-cur .gi-name { color: #e07a7a; }
.gi-icon { width: 22px; height: 22px; border-radius: 4px; flex: 0 0 auto; }
.gi-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gi-cur .src-tag { flex: 0 0 auto; }
.gi-meta { display: inline-flex; align-items: center; justify-content: flex-end; gap: .35rem;
  min-width: 4.2rem; flex: 0 0 auto; }
.gi-ilvl { font-size: .7rem; color: var(--fg-dim); white-space: nowrap; }
.gi-link { color: var(--fg-dim); text-decoration: none; font-size: .8rem; line-height: 1; }
.gi-link:hover { color: var(--accent); }
.gi-suggest { grid-column: 2 / -1; display: flex; align-items: center; gap: .4rem;
  font-size: .85rem; color: #6fcf7d; min-width: 0; }
.gi-suggest .gi-name { color: #6fcf7d; }
.gi-arrow { flex: 0 0 auto; }
/* Materia melds (informational, order-independent) */
.gi-melds { grid-column: 2 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; }
.gi-melds-cur, .gi-melds-bis { display: inline-flex; align-items: center; gap: .15rem; }
.gi-melds-bis { color: #d8b24a; font-size: .72rem; }
.gi-meld { display: inline-flex; }
.gi-meld img { width: 14px; height: 14px; border-radius: 3px; }
.gi-empty { color: var(--fg-dim); }
.gi-error { color: #e07a7a; }

/* Hidden-sets drawer */
.gi-hidden-wrap { margin-top: 1rem; border-top: 1px solid var(--border); padding-top: .6rem; }
.gi-hidden-wrap summary { cursor: pointer; color: var(--fg-dim); font-size: .85rem; }
.gi-hidden-list { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.gi-hidden-item { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; max-width: 100%;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; padding: .2rem .5rem; }
.gi-hidden-item > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gi-show { background: var(--bg-soft); border: 1px solid var(--border); color: var(--fg-dim);
  border-radius: 5px; padding: .05rem .4rem; cursor: pointer; font-size: .78rem; flex: 0 0 auto; }
.gi-show:hover { color: var(--fg); border-color: var(--accent); }

/* ===== API keys (/me/keys) + Device approval (/device) ===== */
.keys-view, .device-view { display: flex; flex-direction: column; gap: 1rem; max-width: 920px; }
.keys-title { margin: 0; font-size: 1.15rem; }
.key-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.key-table th { text-align: left; color: var(--fg-dim); font-weight: 600; padding: .3rem .5rem; border-bottom: 1px solid var(--border); }
.key-table td { padding: .35rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.key-table .key-scopes { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-dim); }
.key-revoked { color: #e07a7a; }
.key-created { border: 1px solid var(--accent); }
.key-plain { display: block; margin: .5rem 0; padding: .5rem .7rem; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 6px; font-family: monospace; word-break: break-all; user-select: all; }
.key-create .key-form { display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }
.key-create #k-name { width: 100%; max-width: 22rem; background: var(--bg-soft); color: var(--fg);
  border: 1px solid var(--border); border-radius: 6px; padding: .35rem .5rem; }
.key-scopes-grid { display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.key-expiry select { background: var(--bg-soft); color: var(--fg); border: 1px solid var(--border); border-radius: 6px; padding: .2rem .4rem; }
.btn-danger { border-color: #6b2f2f; color: #e07a7a; }
.btn-danger:hover { border-color: #d64545; color: #fff; background: #6b2f2f; }

.device-form { display: flex; gap: .5rem; align-items: center; margin-top: .6rem; flex-wrap: wrap; }
.device-code { background: var(--bg-soft); color: var(--fg); border: 1px solid var(--border);
  border-radius: 6px; padding: .4rem .6rem; font-family: monospace; font-size: 1.05rem; letter-spacing: .08em; text-transform: uppercase; }
.device-ok { color: #5bd66e; font-weight: 600; font-size: 1.05rem; }
.btn-icon { padding: .4rem .55rem; line-height: 1; }

/* ===== My sets (custom imported targets) ===== */
.targets-view { display: flex; flex-direction: column; gap: 1rem; max-width: 920px; }
.tg-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.tg-form #tg-url { flex: 1; min-width: 16rem; background: var(--bg-soft); color: var(--fg);
  border: 1px solid var(--border); border-radius: 6px; padding: .4rem .6rem; }
.tg-ok { color: #5bd66e; }
.tg-group-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; }
.tg-link { color: var(--fg-dim); text-decoration: none; font-size: .82rem; }
.tg-link:hover { color: var(--accent); }
.tg-sim { font-size: .72rem; border: 1px solid var(--border); border-radius: 999px; padding: .08rem .5rem; }
.tg-sim-pending, .tg-sim-running { color: #d8b24a; border-color: #5a4f2a; }
.tg-sim-done { color: #5bd66e; border-color: #2f6b38; }
.tg-sim-error { color: #e07a7a; border-color: #5a2e33; }

/* ===== Responsive: collapsible sidebar ===== */
/* Mobile: always an overlay (docking is not useful on small screens). */
@media (max-width: 820px) {
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh; z-index: 40;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .app-shell.nav-open .sidebar { transform: translateX(0); }
  #sidebar-toggle { display: inline-flex; }
  .app-shell.nav-open .scrim { display: block; }
  #nav-pin { display: none; }
}

/* Filterleiste */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
  padding: .6rem 1rem; border-bottom: 1px solid var(--border); background: var(--bg-soft);
}
.filter-bar .filter > summary,
.filter-bar .slot-sel { cursor: pointer; font-size: .9rem; color: var(--fg-dim); }
details.filter {
  position: relative; border: 1px solid var(--border); border-radius: 6px;
  padding: .3rem .6rem; background: var(--bg-card);
}
details.filter[open] { z-index: 5; }
.fpanel {
  position: absolute; top: 110%; left: 0; min-width: 230px; max-width: 92vw;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  padding: .6rem; display: flex; flex-direction: column; gap: .3rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); max-height: 60vh; overflow: auto;
}
.fpanel.jobs { min-width: 300px; }
.frole { display: flex; flex-wrap: wrap; gap: .1rem .8rem; padding: .2rem 0; border-top: 1px solid var(--border); }
.frole:first-child { border-top: 0; }
.frole strong { width: 100%; font-size: .8rem; }
.chk { display: inline-flex; align-items: center; gap: .3rem; font-size: .85rem; color: var(--fg); }
.slot-sel select, #q {
  background: var(--bg-card); color: var(--fg); border: 1px solid var(--border);
  border-radius: 6px; padding: .3rem .5rem;
}
#q { flex: 1; min-width: 180px; }

/* Main */
.app-main { flex: 1; padding: 1rem; max-width: 1200px; width: 100%; margin: 0 auto; }
.loading { color: var(--accent); font-family: ui-monospace, monospace; }

/* Uebersicht */
.role-head { font-size: 1rem; margin: 1.2rem 0 .5rem; padding-left: .5rem; border-left: 4px solid var(--rc, var(--accent)); }
.job-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .8rem; }
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .8rem;
}
.job-card-head { display: flex; align-items: center; justify-content: space-between;
  border-bottom: 2px solid var(--rc, var(--border)); padding-bottom: .4rem; margin-bottom: .5rem; }
.job-card-head h3 { margin: 0; font-size: 1rem; }
.role-chip { font-size: .75rem; color: var(--fg-dim); }
.sheet { margin-bottom: .5rem; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin: .3rem 0; }
.cat-chip { font-size: .75rem; color: var(--fg-dim); }
.xg-link { font-size: .8rem; white-space: nowrap; }
details.set { border: 1px solid var(--border); border-radius: 6px; margin: .3rem 0; }
details.set > summary { cursor: pointer; padding: .35rem .5rem; font-size: .9rem; }

/* Klassen untereinander (volle Breite) */
.job-list { display: flex; flex-direction: column; gap: .8rem; }
.job-list .job-card { width: 100%; }

/* Gear als EIN gekoppeltes 2-Spalten-Grid (Zeilen links/rechts ausgerichtet).
   grid-auto-rows mit fester Mindesthoehe -> nichts verschiebt sich. */
.gear-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 1.6rem;
  grid-auto-rows: minmax(4.3rem, auto); align-items: stretch; padding: .2rem .6rem .4rem; }
.gear-cell { display: flex; gap: .55rem; align-items: flex-start; padding: .32rem 0; border-top: 1px dotted var(--border); }
.gear-cell.empty { border-top: 0; }

/* Waffe allein (kein Schild) - mittig ueber volle Breite */
.gear-solo { display: flex; justify-content: center; padding: .25rem .6rem .35rem; }
.gear-solo .gear-cell { border-top: 0; width: min(460px, 92%); }
.gear-info { flex: 1; min-width: 0; line-height: 1.25; }
.gear-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; min-height: 1.1em; }
.slot-mini { font-size: .64rem; color: var(--fg-dim); text-transform: uppercase; letter-spacing: .03em; }
.item-ilvl { color: var(--accent); font-weight: 600; }
.item-name { display: inline-block; font-size: .88rem; }
.item-name.custom { color: var(--fg); }
.src-tag.synced { color: #9a8cc0; border-color: #463a5e; }

/* Essen: gleiche zentrierte Box wie die Waffe, mit Trennlinie darueber */
.food-solo { border-top: 1px solid var(--border); margin-top: .15rem; padding-top: .45rem; }
.gear-cell.food { border-top: 0; }
.gear-cell.food .item-name { color: #d2b25a; }

/* Item-/Materia-Symbole */
.item-icon { width: 36px; height: 36px; border-radius: 5px; flex: 0 0 auto;
  background: var(--bg-soft); border: 1px solid var(--border); object-fit: contain; }
.item-icon.ph { display: inline-block; }
.melds { font-size: .72rem; color: var(--fg-dim); padding: .12rem 0 0; line-height: 1.25; }
.melds:empty { padding: 0; }
.melds-icons { display: flex; flex-wrap: wrap; gap: .3rem .5rem; }
.meld { display: inline-flex; align-items: center; gap: .2rem; }
.meld-icon { width: 16px; height: 16px; flex: 0 0 auto; }

/* Quelle-Tag - immer gleich: rechts in der Kopfzeile */
.src-tag { flex: 0 0 auto; font-size: .62rem; padding: .04rem .34rem; border-radius: 3px;
  border: 1px solid var(--border); color: var(--fg-dim); white-space: nowrap; }
.src-tag.empty { border: 0; padding: 0; }
.src-tag[data-src="Tome"], .src-tag[data-src="AugTome"] { color: #d2b25a; border-color: #5a4f2a; }
.src-tag[data-src="SavageRaid"], .src-tag[data-src="Ultimate"] { color: #d98088; border-color: #5a2e33; }
.src-tag[data-src="Crafted"], .src-tag[data-src="AugCrafted"] { color: #7fc99a; border-color: #2e5a3f; }

/* Filter-Aktionen + Modus-Umschalter */
.fpanel-actions { display: flex; gap: .3rem; padding-bottom: .35rem; margin-bottom: .35rem; border-bottom: 1px solid var(--border); }
.fpanel-actions button { font-size: .75rem; background: var(--bg-soft); color: var(--fg-dim);
  border: 1px solid var(--border); border-radius: 5px; padding: .15rem .5rem; cursor: pointer; }
.fpanel-actions button:hover { color: var(--fg); border-color: var(--accent); }
.role-toggle { cursor: pointer; }
.role-toggle:hover { text-decoration: underline; }
.reset-btn { margin-left: auto; font-size: .8rem; background: var(--bg-card); color: var(--fg-dim);
  border: 1px solid var(--border); border-radius: 6px; padding: .3rem .7rem; cursor: pointer; white-space: nowrap; }
.reset-btn:hover { color: var(--fg); border-color: var(--accent); }
.mini-btn { font-size: .8rem; background: var(--bg-card); color: var(--fg-dim); border: 1px solid var(--border);
  border-radius: 6px; padding: .3rem .55rem; cursor: pointer; white-space: nowrap; }
.mini-btn:hover { color: var(--fg); border-color: var(--accent); }
.card-head-right { display: flex; align-items: center; gap: .5rem; }
.card-toggle { background: var(--bg-soft); color: var(--fg-dim); border: 1px solid var(--border);
  border-radius: 5px; padding: .05rem .45rem; cursor: pointer; font-size: .85rem; line-height: 1.3; }
.card-toggle:hover { color: var(--fg); border-color: var(--accent); }

/* Vergleichstabelle */
.compare-note { font-size: .78rem; margin: 0 0 .5rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.compare { border-collapse: collapse; width: 100%; font-size: .85rem; white-space: nowrap; }
table.compare th, table.compare td { padding: .35rem .6rem; border-bottom: 1px solid var(--border); text-align: left; }
table.compare thead th { position: sticky; top: 0; background: var(--bg-soft); z-index: 1; }
table.compare td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.compare td.gcd { font-weight: 600; color: var(--accent); }
table.compare tbody tr:hover { background: var(--bg-soft); }
table.compare th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
table.compare th.sortable:hover { color: var(--fg); }
table.compare th.active { color: var(--accent); }
tr.cmp-row { cursor: pointer; }
details.set.flash { animation: flashbg 1.6s ease-out; }
@keyframes flashbg { 0% { background: rgba(110, 168, 254, .35); } 100% { background: transparent; } }
table.compare small { color: var(--fg-dim); }
table.compare td.dps { color: #6fd08a; font-weight: 600; }
table.compare td.dps.proxy { color: var(--fg-dim); font-weight: 400; }
.set-dps { font-size: .72rem; color: #6fd08a; font-weight: 600; margin-left: .4rem; }
.set-dps.proxy { color: var(--fg-dim); font-weight: 400; }
.set-ilvl { font-size: .72rem; color: var(--accent); font-weight: 600; margin-left: .35rem; }

/* Set-Diff */
.sd-controls { margin: 0 0 .6rem; }
.sd-controls select { background: var(--bg-card); color: var(--fg); border: 1px solid var(--border);
  border-radius: 6px; padding: .3rem .5rem; }
.sd-sets { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: 0 0 .8rem;
  padding: .5rem .6rem; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 8px; }
.sd-summary { margin: .2rem 0 .5rem; font-size: .85rem; }
table.sd-table td.slot { color: var(--fg-dim); white-space: nowrap; }
table.sd-table td.same { color: var(--fg-dim); }
table.sd-table td.diff { background: rgba(210, 178, 90, .14); }
table.sd-table td.mark { text-align: center; color: var(--fg-dim); }

/* Suche */
.search-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .8rem; }
.item-result-head { margin: 0 0 .5rem; font-size: 1rem; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.item-result-head .item-name { font-size: 1rem; }
.use-count { font-size: .75rem; color: var(--fg-dim); font-weight: normal; }
.use-list { list-style: none; margin: 0; padding: 0; }
.use-list li { display: flex; align-items: center; gap: .5rem; padding: .25rem 0; font-size: .85rem; border-top: 1px dotted var(--border); flex-wrap: wrap; }
.job-badge { padding: .05rem .4rem; border-radius: 4px; border: 1px solid var(--rc, #888); color: var(--fg); font-size: .8rem; }
.use-slot { color: var(--fg-dim); }
.use-set { flex: 1; min-width: 80px; }
.use-cat { font-size: .75rem; color: var(--fg-dim); }

/* Icon-Button (Refresh) */
.icon-btn {
  background: var(--bg-soft); color: var(--fg-dim); border: 1px solid var(--border);
  border-radius: 6px; padding: .25rem .5rem; cursor: pointer; font-size: 1rem; line-height: 1;
}
.icon-btn:hover { color: var(--fg); border-color: var(--accent); }

/* Farmen */
.small { font-size: .78rem; }
.farm-total { margin-bottom: .9rem; border-color: var(--accent); }
.farm-total h3 { margin: 0 0 .4rem; font-size: 1rem; }
.farm-summary { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; font-size: .9rem; }
.farm-summary b { color: var(--accent); font-size: 1.05rem; }
.src-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin: .5rem 0; }
.src-chip { font-size: .75rem; background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 4px; padding: .1rem .4rem; color: var(--fg-dim); }
.src-chip[data-src="Tome"], .src-chip[data-src="AugTome"] { color: #d2b25a; border-color: #5a4f2a; }
.src-chip[data-src="SavageRaid"], .src-chip[data-src="Ultimate"] { color: #d98088; border-color: #5a2e33; }
.src-chip[data-src="Crafted"], .src-chip[data-src="AugCrafted"] { color: #7fc99a; border-color: #2e5a3f; }
/* Missing-piece rows — flex (not a table) so long item names truncate cleanly */
.farm-miss-list { display: flex; flex-direction: column; gap: .15rem; padding: .3rem .1rem; }
.farm-miss { display: flex; align-items: center; gap: .5rem; font-size: .85rem; }
.farm-miss-slot { flex: 0 0 5rem; color: var(--fg-dim); }
.farm-miss-item { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: .4rem; overflow: hidden; }
.farm-miss-item .gi-icon { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 3px; }
.farm-miss-item .gi-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.farm-miss-src { flex: 0 0 auto; font-size: .78rem; color: var(--fg-dim); white-space: nowrap; }
.farm-miss-src[data-src="Tome"], .farm-miss-src[data-src="AugTome"] { color: #d2b25a; }
.farm-miss-src[data-src="SavageRaid"], .farm-miss-src[data-src="Ultimate"] { color: #d98088; }
.farm-miss-src[data-src="Crafted"], .farm-miss-src[data-src="AugCrafted"] { color: #7fc99a; }

/* Farm plan: job selection + per-job target line */
.farm-select { margin-bottom: .9rem; }
.farm-select h3 { margin: 0 0 .3rem; font-size: 1rem; }
.farm-picks { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.farm-pick { display: inline-flex; align-items: center; gap: .3rem; font-size: .85rem; cursor: pointer;
  background: var(--bg-soft); color: var(--fg-dim); border: 1px solid var(--border); border-radius: 6px; padding: .25rem .6rem; }
.farm-pick:hover { border-color: var(--accent); color: var(--fg); }
.farm-pick.on { color: var(--fg); border-color: var(--accent); background: #25304a; }
.farm-pick-ico { font-weight: 700; color: var(--accent); }
.farm-pick { max-width: 100%; }
/* Finished sets: a divider + a separate, non-interactive chip group below */
.farm-done-divider { margin-top: .8rem; padding-top: .5rem; border-top: 1px dashed var(--border);
  font-size: .8rem; color: var(--fg-dim); }
.farm-picks-done { margin-top: .4rem; opacity: .85; }
.farm-pick.static { cursor: default; }
.farm-pick.static:hover { border-color: var(--border); color: var(--fg-dim); }
.farm-pick.static .farm-pick-ico { color: #7fc99a; }

/* Plan card header: job name (truncates) · score (right) · remove */
.farm-head { gap: .5rem; }
.farm-job { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 1rem; font-weight: 500; }
.farm-score { flex: 0 0 auto; color: var(--fg-dim); font-size: .85rem; font-variant-numeric: tabular-nums; }
.farm-card-x { flex: 0 0 auto; background: none; border: none; color: var(--fg-dim); cursor: pointer; font-size: .9rem; }
.farm-card-x:hover { color: #e07a90; }
.farm-target { display: flex; align-items: center; gap: .5rem; margin: .2rem 0 .5rem; }
.farm-target-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--fg-dim); font-size: .85rem; }
.farm-target .link-btn { flex: 0 0 auto; white-space: nowrap; }
.link-btn { background: none; border: none; padding: 0; color: var(--accent); cursor: pointer; font-size: .82rem; }
.link-btn:hover { text-decoration: underline; }

.gearset-card.flash { animation: flashbg 1.6s ease-out; }

/* Footer */
.app-footer { border-top: 1px solid var(--border); padding: .6rem 1rem; font-size: .78rem; color: var(--fg-dim);
  display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; justify-content: space-between; }

@media (max-width: 520px) {
  .gear-grid { grid-template-columns: 1fr; }
  .gear-cell.empty { display: none; }
}
@media (max-width: 600px) {
  .app-header { gap: .5rem; }
  .app-header h1 { font-size: .95rem; }
  .tabs { order: 3; flex-basis: 100%; }
  .job-grid, .search-results { grid-template-columns: 1fr; }
}
