:root {
  --bg: #14110d;
  --bg-card: #1f1a13;
  --border: #3a2f20;
  --text: #ece5d8;
  --text-dim: #a89a84;
  --accent: #d9a441;
  --accent-dim: #c98f27;
  --accent-soft: #3d2d10;
  --live: #e0512f;
  --live-soft: #3a1810;
  --now-red: #dc241f;
  --tab-active-text: #211705;
  --display-font: "Cinzel", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}
.mono { font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; font-variant-numeric: tabular-nums; }

.wrap { max-width: 980px; margin: 0 auto; padding: 28px 20px 80px; }

#page-loading-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 17, 21, 0.82);
  flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  color: var(--text-dim); font-size: 0.9rem;
}
/* Specificity note: an ID selector beats the browser's own [hidden] {
   display: none } rule, so "display: flex" can't live on the bare
   #page-loading-overlay selector above - that would show the overlay on
   every page load regardless of the hidden attribute. Gating it behind
   :not([hidden]) lets the native rule win whenever the attribute is set. */
#page-loading-overlay:not([hidden]) { display: flex; }
#page-loading-overlay .spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  #page-loading-overlay .spinner { animation-duration: 2s; }
}

/* --- Top nav: full-width, sticky --- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 var(--accent-soft);
}
.topbar-inner {
  max-width: 980px; margin: 0 auto; padding: 14px 20px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
}
.brand {
  font-family: var(--display-font); font-weight: 700; font-size: 1.3rem;
  color: var(--text); text-decoration: none; letter-spacing: 0.03em;
}
.brand span { color: var(--accent); }

.tabs { display: flex; gap: 4px; }
.tab {
  border: none; background: transparent; color: var(--text-dim); text-decoration: none;
  padding: 8px 16px; border-radius: 7px; font-size: 0.88rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent); color: var(--tab-active-text); }

section { margin-bottom: 40px; }
h2 {
  font-family: var(--display-font);
  font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-dim); margin: 0 0 6px; font-weight: 700;
}
.hint, .section-sub { color: var(--text-dim); font-size: 0.85rem; margin: 0 0 16px; }
.dim { color: var(--text-dim); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }

.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; text-decoration: none; color: inherit; display: block;
  transition: border-color 0.15s ease;
}
a.card:hover { border-color: var(--accent-dim); }
.card-icon { width: 30px; height: 30px; border-radius: 6px; margin-bottom: 8px; object-fit: cover; }
.card-title { font-weight: 600; font-size: 0.94rem; margin-bottom: 2px; }
.card-desc { color: var(--text-dim); font-size: 0.82rem; }

table { width: 100%; border-collapse: collapse; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
th { font-family: var(--display-font); color: var(--text-dim); font-weight: 600; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
.row-icon { width: 20px; height: 20px; vertical-align: middle; border-radius: 4px; }
td.num, th.num { text-align: right; }
td.dim { color: var(--text-dim); }
.table-scroll { overflow-x: auto; }

.coin { white-space: nowrap; }
.coin.gold { color: #e1b746; }
.coin.silver { color: #b6bcc4; }
.coin.copper { color: #c17a4e; }

.profit-pos { color: #4ade80; font-weight: 700; }
.profit-neg { color: #f87171; font-weight: 700; }

.recipe-toggle {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 6px; padding: 4px 10px; font-size: 0.76rem; font-weight: 600;
  cursor: pointer; font-family: inherit; white-space: nowrap;
}
.recipe-toggle:hover { border-color: var(--accent); color: var(--accent); }
.recipe-toggle.open { color: var(--accent); border-color: var(--accent); }

.recipe-row td { padding: 0; border-bottom: 1px solid var(--border); }
.recipe-detail { padding: 14px 20px; background: var(--bg); }
.recipe-title { font-weight: 700; font-size: 0.85rem; margin-bottom: 10px; }
.ingredient-line {
  display: flex; align-items: center; gap: 10px; padding: 6px 0;
  border-bottom: 1px dashed var(--border); font-size: 0.85rem;
}
.ingredient-line:last-child { border-bottom: none; }
.ingredient-line img { width: 20px; height: 20px; border-radius: 4px; }
.ing-qty { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.ing-name { flex: 1; }
.ing-price { color: var(--text-dim); }
.ing-subtotal { min-width: 90px; text-align: right; }
.recipe-total { font-weight: 700; padding-top: 10px; }
.recipe-total:not(:last-child) { border-bottom: 1px dashed var(--border); }

.flip-caveat {
  background: var(--accent-soft); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; font-size: 0.85rem; color: var(--text); line-height: 1.5;
}
.flip-caveat strong { color: var(--accent); }

/* --- Market tab layout: sidebar + main --- */
.market-bleed {
  width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw);
  padding: 0 24px; box-sizing: border-box;
}
.market-layout { max-width: 1360px; margin: 0 auto; display: flex; gap: 28px; align-items: flex-start; }
.market-sidebar { width: 250px; flex-shrink: 0; }
.market-main { flex: 1; min-width: 0; }
.market-main .section-sub { max-width: none; }

.exchange-box {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
}
.exchange-line { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; font-size: 0.86rem; color: var(--text-dim); }
.exchange-icon { width: 18px; height: 18px; vertical-align: middle; }
.exchange-value { font-weight: 700; white-space: nowrap; color: var(--text); }

#exchange-history-toggle { margin-top: 10px; }
.exchange-history-panel { flex-direction: column; gap: 4px; margin-top: 10px; }
/* Same [hidden] specificity gotcha as .ach-children/#page-loading-overlay -
   an unconditional "display: flex" beats the browser's own [hidden] rule
   regardless of selector specificity, so gate it behind :not([hidden]). */
.exchange-history-panel:not([hidden]) { display: flex; }
.chart-wrap { position: relative; }
.chart-wrap canvas {
  width: 100%; height: 140px; display: block;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
.chart-label { font-size: 0.76rem; color: var(--text-dim); text-align: center; margin: 2px 0 8px; }
.chart-tooltip {
  position: absolute; pointer-events: none; transform: translate(-50%, -100%);
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 9px; margin-top: -8px; font-size: 0.76rem; white-space: nowrap; color: var(--text);
}
.chart-tooltip .t { color: var(--text-dim); font-size: 0.68rem; }

.gem-list { display: flex; flex-direction: column; gap: 10px; }
.gem-item {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px;
}
.gem-item .gi-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; }
.gem-item img { width: 32px; height: 32px; border-radius: 6px; flex-shrink: 0; object-fit: cover; }
.gem-item .gi-text { min-width: 0; }
.gem-item .gi-name {
  font-weight: 600; font-size: 0.84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--accent-dim);
}
.gem-item.unavailable { opacity: 0.45; }
.gem-item.unavailable img { filter: grayscale(1); }
.gem-item.unavailable .gi-name { color: var(--text); }
.gem-item .gi-desc { color: var(--text-dim); font-size: 0.74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.favorite-add-form { display: flex; gap: 8px; margin-bottom: 14px; }
.favorite-add-form input[type="text"] { flex: 1; margin: 0; min-width: 0; }
.favorite-add-form button { flex-shrink: 0; }

@media (max-width: 860px) {
  .market-layout { flex-direction: column; }
  .market-sidebar { width: 100%; }
}

/* --- Dashboard layout: same sidebar + main pattern as Market --- */
.dash-bleed {
  width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw);
  padding: 0 24px; box-sizing: border-box;
}
.dash-layout { max-width: 1360px; margin: 0 auto; display: flex; gap: 28px; align-items: flex-start; }
.dash-sidebar { width: 320px; flex-shrink: 0; }
.dash-main { flex: 1; min-width: 0; }

@media (max-width: 860px) {
  .dash-layout { flex-direction: column; }
  .dash-sidebar { width: 100%; }
}

/* --- Hero banner: full-bleed key art with a dark gradient underneath so
   text never fights the image. One per page (Home: per-boss art, Market:
   Lion's Arch, Characters: Destiny's Edge, Dashboard: Vigil Castle) -
   Materials/To-Do/Settings stay flat/dense, since those are pure data with
   no obvious matching art. --- */
.hero-banner {
  width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw);
  position: relative; background-size: cover; background-position: center;
  border-bottom: 1px solid var(--border); margin-bottom: 16px; box-sizing: border-box;
}
.hero-banner::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20,17,13,0.25) 0%, rgba(20,17,13,0.85) 72%, var(--bg) 100%);
}
.hero-banner-inner {
  position: relative; z-index: 1; max-width: 980px; margin: 0 auto;
  padding: 56px 24px 26px; display: flex; justify-content: space-between;
  align-items: flex-end; gap: 24px; flex-wrap: wrap;
}
.hero-eyebrow {
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--accent); font-weight: 700; margin: 0 0 8px;
}
.hero-title {
  font-family: var(--display-font); font-size: 2rem; margin: 0 0 10px;
  color: #fbf6ea; text-wrap: balance; text-shadow: 0 2px 14px rgba(0,0,0,0.7);
}
.hero-desc {
  margin: 0; max-width: 62ch; color: rgba(236,229,216,0.86); font-size: 0.96rem; line-height: 1.5;
}
/* Specificity note: same [hidden] gotcha as #page-loading-overlay/.ach-children -
   an unconditional "display: flex" would beat the browser's own
   [hidden] { display: none }, so this stays hidden behind :not([hidden]). */
.hero-badge:not([hidden]) { display: flex; }
.hero-badge { flex-direction: column; align-items: center; flex-shrink: 0; }
.hero-badge img { width: 150px; height: auto; filter: drop-shadow(0 6px 14px rgba(0,0,0,0.6)); }
.hero-nameplate {
  background: rgba(10,8,6,0.88); border: 1px solid var(--accent-dim); border-radius: 6px;
  padding: 5px 14px; margin-top: -12px; font-family: var(--display-font); font-size: 0.82rem;
  color: var(--accent); text-align: center; white-space: nowrap; letter-spacing: 0.03em;
}

/* --- Home view switcher: Streamlined (default) vs. Classic Gantt --- */
.view-switcher-bar { display: flex; justify-content: center; margin: 18px 0 26px; }
.view-switcher {
  display: inline-flex; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px; gap: 4px;
}
.view-switcher button {
  font-family: inherit; font-size: 0.86rem; font-weight: 700; color: var(--text-dim);
  background: transparent; border: none; border-radius: 7px; padding: 8px 18px; cursor: pointer;
}
.view-switcher button.active { background: var(--accent); color: var(--tab-active-text); }
.view-switcher button:not(.active):hover { color: var(--text); }

/* --- Streamlined world-boss rows: one line per boss, no horizontal scroll --- */
.boss-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 8px 22px; position: relative; }
.boss-row { display: flex; align-items: center; gap: 18px; padding: 15px 0; border-bottom: 1px dashed var(--border); }
.boss-row:last-child { border-bottom: none; }
.boss-row-name { font-weight: 700; font-size: 0.96rem; min-width: 210px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.boss-row-track { flex: 1; min-width: 160px; height: 34px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; position: relative; overflow: hidden; }
.boss-row-pill {
  position: absolute; top: 3px; bottom: 3px; border-radius: 6px; background: var(--bg-card);
  border: 1px solid var(--border); display: flex; align-items: center; padding: 0 10px;
  font-size: 0.76rem; color: var(--text-dim); white-space: nowrap; gap: 6px; cursor: pointer;
}
.boss-row-pill:hover { border-color: var(--accent-dim); }
.boss-row-pill.soon { border-color: var(--accent); background: rgba(217,164,65,0.16); color: var(--text); }
.boss-row-pill.live { border-color: var(--live); background: var(--live-soft); color: #ffd9c9; }
.boss-row-pill.copied { border-color: var(--accent); background: var(--accent-soft); }
.boss-row-now-line {
  position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--now-red); z-index: 5;
  box-shadow: 0 0 6px rgba(220,36,31,0.6);
}
.boss-row-now-line::before {
  content: "NOW"; position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  background: var(--now-red); color: #fff; font-size: 0.6rem; font-weight: 800;
  padding: 1px 6px; border-radius: 4px; letter-spacing: 0.04em; white-space: nowrap;
}
.boss-row-live-badge {
  background: var(--live); color: #2a0e07; font-weight: 800; font-size: 0.6rem;
  text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 6px; border-radius: 4px;
}

.boss-row-name a { color: inherit; text-decoration: none; }
.boss-row-name a:hover { color: var(--accent); text-decoration: underline; }
.boss-row-pill.static { cursor: default; }

@media (max-width: 640px) {
  .boss-row-name { min-width: 120px; font-size: 0.86rem; }
}

/* --- Streamlined: sidebar filter + one colored section per category --- */
.stream-bleed {
  width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw);
  padding: 0 24px; box-sizing: border-box;
}
.stream-layout { max-width: 1200px; margin: 0 auto; display: flex; gap: 28px; align-items: flex-start; }
.stream-sidebar { width: 270px; flex-shrink: 0; position: sticky; top: 76px; }
.stream-main { flex: 1; min-width: 0; }

.sidebar-filter {
  display: flex; flex-direction: column; gap: 11px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
}
.sidebar-filter-item { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; color: var(--text); cursor: pointer; }
.sidebar-filter-item input { cursor: pointer; accent-color: var(--accent); width: 15px; height: 15px; flex-shrink: 0; }
/* Fixed box (not just a fixed height) so every icon - square crests, wide
   logo-shaped ones alike - occupies the same width; otherwise each row's
   text starts at a different x depending on that row's own icon's aspect
   ratio, which is what actually read as "misaligned" rather than the text
   itself being off. */
.sidebar-filter-item img { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; }
.sidebar-filter-item:has(input:not(:checked)) { opacity: 0.4; }

.stream-main .category-group[data-cat-id].stream-hidden { display: none; }

@media (max-width: 860px) {
  .stream-layout { flex-direction: column; }
  .stream-sidebar { width: 100%; position: static; }
  .sidebar-filter { flex-direction: row; flex-wrap: wrap; gap: 8px 16px; }
}

/* --- Boss/meta timeline (Gantt-style, lebusmagique-inspired) --- */
.clocks { display: flex; gap: 10px; flex-shrink: 0; }
.clock {
  background: rgba(31,26,19,0.85); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px; display: flex; flex-direction: column; align-items: center; min-width: 84px;
  backdrop-filter: blur(2px);
}
.clock-label { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }
.clock-value { font-size: 1rem; font-weight: 700; color: var(--accent); }

.filter-bleed {
  width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw);
  padding: 0 24px; margin-bottom: 16px; box-sizing: border-box;
}
.cat-filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 16px;
}
.cat-filter { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 0.82rem; font-weight: 600; color: var(--text); user-select: none; }
.cat-filter input { cursor: pointer; accent-color: var(--accent); width: 15px; height: 15px; }
.cat-filter img { height: 16px; width: auto; max-width: 42px; object-fit: contain; }
.cat-filter:has(input:not(:checked)) { opacity: 0.4; }
.filter-toggle-all {
  margin-left: auto; background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 7px; padding: 6px 12px; font-size: 0.78rem; font-weight: 600; cursor: pointer; font-family: inherit;
}
.filter-toggle-all:hover { border-color: var(--accent); color: var(--accent); }
.category-group.cat-hidden { display: none; }

.timeline-bleed {
  width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw);
  padding: 0 24px;
}
.timeline-scroll {
  overflow-x: auto; overflow-y: hidden;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  scrollbar-width: thin;
}
.timeline-inner { position: relative; padding: 22px 0 14px; }

.ruler { position: relative; height: 26px; border-bottom: 1px solid var(--border); }
.tick {
  position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--border);
  font-size: 0.68rem; color: var(--text-dim); padding-left: 4px; padding-top: 5px; white-space: nowrap;
}
.tick.hour { border-left-color: var(--text-dim); font-weight: 700; color: var(--text); }

.now-line {
  position: absolute; top: 0; bottom: 14px; width: 2px; background: var(--now-red);
  z-index: 6; box-shadow: 0 0 6px rgba(248, 113, 113, 0.6);
}
.now-line::before {
  content: "NOW"; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  background: var(--now-red); color: #fff; font-size: 0.6rem; font-weight: 800;
  padding: 1px 6px; border-radius: 4px; letter-spacing: 0.04em; white-space: nowrap;
}

.category-group {
  --cat-color: hsl(var(--cat-h) 75% 64%);
  border: 2px solid var(--cat-color);
  border-radius: 12px;
  margin: 18px 0;
  padding: 6px 0 12px;
  background: hsla(var(--cat-h), 70%, 45%, 0.07);
}

.category-heading {
  position: sticky; left: 0; z-index: 4; width: fit-content; max-width: 90vw;
  display: flex; align-items: center; gap: 9px; font-family: var(--display-font);
  font-size: 1rem; font-weight: 700; letter-spacing: 0.01em; color: var(--cat-color);
  background: var(--bg-card); border: 1.5px solid var(--cat-color);
  border-radius: 7px; padding: 5px 14px; margin: 6px 0 10px 12px;
}
.cat-icon { height: 22px; width: auto; max-width: 68px; object-fit: contain; flex-shrink: 0; }

.track-label {
  position: sticky; left: 0; z-index: 4; width: fit-content; max-width: 90vw;
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-dim); background: var(--bg-card); padding: 8px 10px 6px 14px;
  border-radius: 0 6px 6px 0; box-shadow: 6px 0 8px -6px rgba(0,0,0,0.4);
}
.track-label a { color: var(--text-dim); text-decoration: none; }
.track-label a:hover { color: var(--accent); }
.track { position: relative; height: 80px; margin: 0 0 5px; }

.boss-block {
  position: absolute; top: 4px; bottom: 4px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border);
  overflow: hidden; display: block; text-decoration: none; color: inherit;
  transition: border-color 0.12s ease, transform 0.12s ease;
  min-width: 96px;
}
.boss-block:not(.empty) { cursor: pointer; }
.boss-block:not(.empty):hover { border-color: var(--accent); transform: translateY(-1px); z-index: 3; }
.boss-block .inner { padding: 6px 9px; height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.boss-block .bname {
  font-size: 0.85rem; font-weight: 700; line-height: 1.15; flex-shrink: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.boss-block .btime { font-size: 0.68rem; line-height: 1.2; color: var(--text-dim); display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.boss-block .tp-code { font-family: "JetBrains Mono", ui-monospace, monospace; opacity: 0.75; }
.boss-block.past { opacity: 0.35; }
.boss-block.soon { border-color: var(--accent); background: rgba(217, 164, 65, 0.14); }
.boss-block.empty { border-style: dashed; opacity: 0.35; pointer-events: none; }
.boss-block.copied { border-color: var(--accent); background: var(--accent-soft); }
.boss-block.copied .bname::after { content: " ✓ copied"; color: var(--accent); font-weight: 700; }

footer {
  text-align: center; color: var(--text-dim); font-size: 0.8rem;
  margin-top: 50px; border-top: 1px solid var(--border); padding-top: 20px;
}
footer .legal { opacity: 0.7; font-size: 0.72rem; margin-top: 8px; line-height: 1.6; }

.panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 20px 24px; max-width: 520px; }
.panel + .panel { margin-top: 20px; }
.panel p { color: var(--text-dim); font-size: 0.88rem; }
.panel a { color: var(--accent); }

.settings-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start;
}
.settings-layout .panel { max-width: none; }
.settings-col { display: flex; flex-direction: column; gap: 20px; }
.settings-col .panel + .panel { margin-top: 0; }
@media (max-width: 860px) { .settings-layout { grid-template-columns: 1fr; } }

.disclaimer-box .label {
  display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent-dim); margin-bottom: 8px;
}
.disclaimer-box p { margin: 0; }

.perm-list { display: flex; flex-direction: column; }
.perm-row { display: grid; grid-template-columns: 118px 1fr; gap: 14px; padding: 13px 0; border-top: 1px solid var(--border); }
.perm-row:first-child { border-top: none; padding-top: 4px; }
.perm-name {
  display: inline-flex; align-self: flex-start; align-items: center; gap: 6px;
  background: var(--accent-soft); color: var(--accent-dim); font-size: 0.74rem; font-weight: 700;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap;
}
.perm-body p { margin: 0; font-size: 0.84rem; color: var(--text); line-height: 1.5; }
.perm-used { margin-top: 5px !important; color: var(--text-dim) !important; font-size: 0.79rem !important; }
.perm-row.planned .perm-name { background: #23262f; color: #c9a86a; }
.perm-row.planned .perm-used { color: #c9a86a !important; }
.flag {
  display: inline-block; background: rgba(0, 0, 0, 0.25); font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.04em; padding: 1px 5px; border-radius: 4px; margin-left: 4px;
}
@media (max-width: 520px) { .perm-row { grid-template-columns: 1fr; } }
label { font-size: 0.82rem; font-weight: 600; display: block; margin-bottom: 4px; }

input[type="text"], input[type="password"], input[type="url"] {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 0.95rem; margin: 8px 0 14px; font-family: inherit;
}

button, .btn {
  display: inline-block; background: var(--accent-dim); color: #0b1013; border: none;
  border-radius: 8px; padding: 10px 18px; font-weight: 600; cursor: pointer;
  font-size: 0.92rem; text-decoration: none; font-family: inherit;
}
button.secondary, .btn.secondary { background: transparent; border: 1px solid var(--border); color: var(--text-dim); }

.notice { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 0.88rem; }
.notice.error { background: #3b1a1a; color: #fca5a5; border: 1px solid #7f1d1d; }
.notice.success { background: #14332c; color: #6ee7b7; border: 1px solid #065f46; }

.wallet-headline { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.wh-item { display: flex; align-items: center; gap: 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 18px; }
.wh-item img { width: 28px; height: 28px; }
.wh-value { font-size: 1.15rem; font-weight: 700; }
.wh-label { color: var(--text-dim); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }

.wallet-list { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.wallet-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.wallet-row:last-child { border-bottom: none; }
.wallet-row:nth-child(odd) { background: var(--bg-card); }
.wallet-row img { width: 18px; height: 18px; flex-shrink: 0; }
.wr-name { flex: 1; }
.wr-value { color: var(--text-dim); }

.objective { padding: 8px 0; border-bottom: 1px solid var(--border); }
.objective:last-child { border-bottom: none; }
.objective.done { color: var(--accent); }

/* --- Characters: a list, not a grid, now that each row carries a badge -
   GW2's API has no character-render endpoint (no way to get an image of a
   character's actual face/dyes/gear), so the badge is the closest honest
   substitute: the character's own elite spec icon, or that profession's
   base crest as a fallback - both real ArenaNet art, tinted per-profession
   with the wiki's own community-standard color reference (main.py passes
   gw2_api.PROFESSION_COLORS in as --prof-color per row). --- */
.character-list { display: flex; flex-direction: column; gap: 12px; }
.character-row { display: flex; gap: 18px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; align-items: flex-start; }
.char-badge {
  width: 72px; height: 72px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--prof-color) 30%, transparent) 0%, transparent 70%), var(--bg);
  border: 1.5px solid var(--prof-color);
}
.char-badge img { width: 42px; height: 42px; }
.char-info { flex: 1; min-width: 0; }
.char-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 2px; }
.char-name { font-weight: 700; font-size: 1.05rem; }
.char-level { color: var(--text-dim); font-size: 0.82rem; }
.char-guild { color: var(--text-dim); font-size: 0.82rem; }
.char-sub { color: var(--prof-color); font-weight: 600; font-size: 0.85rem; margin-bottom: 9px; }
.char-spec {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 3px 9px; margin-bottom: 9px;
}
.char-spec::before { content: "★"; color: var(--accent); font-size: 0.72rem; }
.char-crafting { display: flex; flex-wrap: wrap; gap: 6px; }
.craft-badge { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; font-size: 0.78rem; color: var(--text-dim); }
.craft-badge.maxed { color: var(--accent-dim); border-color: var(--accent-soft); }

@media (max-width: 520px) {
  .character-row { flex-direction: column; align-items: center; text-align: center; }
  .char-top, .char-crafting { justify-content: center; }
}

/* --- Generic full-bleed wide content, for pages with no sidebar that still
   want more room than the centered 980px .wrap column --- */
.wide-bleed {
  width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw);
  padding: 0 24px; box-sizing: border-box;
}
.wide-content { max-width: 1360px; margin: 0 auto; }

.material-category { margin-bottom: 28px; }
.material-category h3 {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent-dim); margin: 0 0 10px; font-weight: 700;
}
.material-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.material-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px;
}
.material-item img { width: 24px; height: 24px; border-radius: 4px; flex-shrink: 0; }
.mi-count { font-weight: 700; flex-shrink: 0; }
.mi-name { color: var(--text-dim); font-size: 0.82rem; }

.todo-add-form { display: flex; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.todo-add-form input[type="text"] { flex: 1; min-width: 260px; margin: 0; width: auto; }
.todo-add-form input[type="url"] { flex: 1; min-width: 260px; margin: 0; width: auto; }
.todo-add-form input[name="achievement"] { flex: 1.2; min-width: 340px; margin: 0; width: auto; }
.todo-add-form button { flex-shrink: 0; }

.todo-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
.todo-column h2 { margin-bottom: 12px; }
@media (max-width: 860px) {
  .todo-columns { grid-template-columns: 1fr; }
}

.todo-list { display: flex; flex-direction: column; gap: 8px; }
.todo-item {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px;
}
.todo-item.done { opacity: 0.55; }
.todo-item.done .todo-text-line { text-decoration: line-through; }
.todo-check-form, .todo-delete-form { margin: 0; }
.todo-check {
  width: 22px; height: 22px; border-radius: 5px; border: 2px solid var(--text-dim);
  background: transparent; color: transparent; font-weight: 700; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0;
  margin-top: 2px;
}
.todo-check:hover { border-color: var(--accent); }
.todo-item.done .todo-check {
  background: var(--accent); border-color: var(--accent); color: #0b1013;
}
.todo-text { flex: 1; font-size: 0.92rem; word-break: break-word; min-width: 0; }
.todo-link { margin-left: 6px; color: var(--accent); text-decoration: none; }
.todo-delete {
  background: transparent; border: 1px solid var(--border); border-radius: 6px; color: var(--text-dim);
  cursor: pointer; font-size: 0.85rem; width: 26px; height: 26px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; margin-left: auto; margin-top: 1px;
}

.todo-achievement { font-size: 0.82rem; margin-top: 6px; }
.todo-achievement-done { color: var(--accent); font-weight: 700; margin-left: 6px; }
.todo-progress-bar {
  height: 5px; border-radius: 3px; background: var(--border); margin-top: 5px; overflow: hidden; max-width: 260px;
}
.todo-progress-fill { height: 100%; background: var(--accent-dim); }

.ach-toggle {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 6px; padding: 3px 9px; font-size: 0.74rem; font-weight: 600;
  cursor: pointer; font-family: inherit; margin-top: 8px;
}
.ach-toggle:hover { border-color: var(--accent); color: var(--accent); }
.ach-children { flex-direction: column; gap: 4px; margin-top: 8px; padding-left: 4px; }
/* Same specificity gotcha as #page-loading-overlay: an unconditional
   "display: flex" beats the browser's own [hidden] { display: none }
   regardless of selector specificity (author rules always win over
   user-agent rules), so the JS toggle would flip the attribute correctly
   while the element stayed visible (or invisible) no matter what. */
.ach-children:not([hidden]) { display: flex; }
.ach-child { font-size: 0.82rem; display: flex; align-items: flex-start; gap: 8px; color: var(--text-dim); }
.ach-child.done { color: var(--accent); }
.ach-child a { color: inherit; text-decoration: none; }
.ach-child a:hover { text-decoration: underline; }
.ach-child-text { min-width: 0; }
.ach-hint { font-size: 0.76rem; opacity: 0.8; margin-top: 2px; }
.todo-delete:hover { color: #f87171; border-color: #f87171; }
