:root {
  color-scheme: light;
  --bg: #f4f3f0; --surface: #fcfcfb; --surface-2: #efeee9; --border: #dedcd5;
  --text: #0b0b0b; --text-2: #52514e; --muted: #807e78;
  --accent: #2a78d6; --accent-soft: rgba(42,120,214,.14);
  --good: #0f7a3d; --bad: #c0392b; --warn: #a86b00;
  --gold: #a07a00; --silver: #6f7377; --copper: #9a5a2e;
  /* item quality as text colour: WoW's colours, darkened where needed to stay readable on the light surface;
     common (q1) is plain text colour since WoW's white would vanish */
  --q0:#7d7d7d; --q1:var(--text); --q2:#1a7f00; --q3:#005fc4; --q4:#8a2bd1; --q5:#b85a00;
  /* recipe difficulty (skill-up chance), as in the profession window */
  --d0:#c25400; --d1:#8f7600; --d2:#2a8a2a; --d3:#85847f;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --d0:#ff8040; --d1:#e6d32e; --d2:#4cc44c; --d3:#9d9d9d; }
}
:root[data-theme="dark"] { --d0:#ff8040; --d1:#e6d32e; --d2:#4cc44c; --d3:#9d9d9d; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --border: #33332f;
    --text: #f0efec; --text-2: #c3c2b7; --muted: #8d8c84;
    --accent: #3987e5; --accent-soft: rgba(57,135,229,.2);
    --good: #3fbf6f; --bad: #e66767; --warn: #e0a72e;
    --gold: #e3c04a; --silver: #b9bec4; --copper: #d08a55;
    --q0:#9d9d9d; --q1:#e6e6e6; --q2:#1eff00; --q3:#3d9bff; --q4:#b860ff; --q5:#ff8000;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --border: #33332f;
  --text: #f0efec; --text-2: #c3c2b7; --muted: #8d8c84;
  --accent: #3987e5; --accent-soft: rgba(57,135,229,.2);
  --good: #3fbf6f; --bad: #e66767; --warn: #e0a72e;
  --gold: #e3c04a; --silver: #b9bec4; --copper: #d08a55;
  --q0:#9d9d9d; --q1:#e6e6e6; --q2:#1eff00; --q3:#3d9bff; --q4:#b860ff; --q5:#ff8000;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
header { display: flex; align-items: center; gap: 16px; padding: 12px 20px;
  background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
header .brand { font-size: 17px; font-weight: 700; letter-spacing: .2px; color: var(--text); text-decoration: none; }
header .gold { font-weight: 600; font-size: 13.5px; }
.btn.icon { padding: 4px 9px; text-decoration: none; display: inline-block; line-height: 1.35; }
.btn.active { border-color: var(--accent); }
/* header item search */
.search { position: relative; flex: 0 1 340px; }
.search input { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 10px; font: inherit; font-size: 13px; }
.search .results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); max-height: 60vh; overflow-y: auto; }
.search .hit { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; cursor: pointer; font-size: 13px; }
.search .hit.sel, .search .hit:hover { background: var(--surface-2); }
header .meta { color: var(--muted); font-size: 12.5px; }
header .spacer { flex: 1; }
nav { display: flex; gap: 2px; padding: 0 20px; background: var(--surface);
  border-bottom: 1px solid var(--border); overflow-x: auto; }
nav a { border-bottom: 2px solid transparent; padding: 10px 14px; color: var(--text-2); text-decoration: none;
  white-space: nowrap; }
nav a:hover { color: var(--text); }
nav a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
/* second row: page tabs of a section, or profession chips */
.subnav { background: var(--bg); gap: 8px; padding: 8px 20px; align-items: center; }
.subnav a.tab { border: 0; border-radius: 6px; padding: 5px 11px; }
.subnav a.tab.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.chip { display: inline-flex; flex-direction: column; gap: 3px; padding: 6px 12px 7px; border: 1px solid var(--border) !important;
  border-radius: 8px; background: var(--surface); color: var(--text) !important; text-decoration: none; min-width: 120px; }
.chip:hover { border-color: var(--muted) !important; }
.chip.active { border-color: var(--accent) !important; box-shadow: 0 0 0 1px var(--accent); font-weight: 600; }
.chip .bar { display: block; height: 3px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.chip .bar span { display: block; height: 100%; background: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
main { padding: 18px 20px 40px; max-width: 1400px; margin: 0 auto; }
.btn { background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type=search], .toolbar select { background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 5px 9px; font: inherit; font-size: 13px; }
.toolbar label { color: var(--text-2); font-size: 13px; display: flex; gap: 5px; align-items: center; }
.hint { color: var(--text-2); font-size: 13px; margin: 0 0 12px; max-width: 900px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-2); font-weight: 600; font-size: 12px; cursor: pointer; user-select: none;
  position: sticky; top: 0; background: var(--surface); }
th.sorted::after { content: " ▾"; } th.sorted.asc::after { content: " ▴"; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; } tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
a.wh { color: inherit; text-decoration: none; }
a.wh:hover { text-decoration: underline; }
/* gap between Wowhead's inline icon and the item name */
a.wh .iconsmall, a.wh .iconmedium { margin-right: 6px !important; }
a.wh.icontinyl { padding-left: 22px !important; background-position: left center !important; }
.skill { font-variant-numeric: tabular-nums; }
.sub { color: var(--muted); font-size: 12px; }
.pos { color: var(--good); } .neg { color: var(--bad); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11.5px;
  border: 1px solid var(--border); color: var(--text-2); }
.tag.good { color: var(--good); border-color: currentColor; }
.tag.bad { color: var(--bad); border-color: currentColor; }
.tag.warn { color: var(--warn); border-color: currentColor; }
.m-g { color: var(--gold); } .m-s { color: var(--silver); } .m-c { color: var(--copper); }
.money .u { font-size: 10.5px; margin: 0 2px 0 0.5px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.tile .k { color: var(--text-2); font-size: 12px; } .tile .v { font-size: 19px; font-weight: 600; margin-top: 2px; }
h2 { font-size: 15px; margin: 22px 0 8px; } h2:first-child { margin-top: 0; }
.empty { padding: 28px; text-align: center; color: var(--text-2); }
.empty ol { text-align: left; display: inline-block; margin: 8px 0 0; }
/* profession page */
.pagehead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.pagehead h1 { font-size: 20px; margin: 0; }
.seg { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.seg a { padding: 7px 12px; color: var(--text-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.seg a:hover { color: var(--text); }
.seg a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
/* form bits */
.num-in { width: 64px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; font: inherit; font-size: 13px; }
.wide-in { flex: 1; min-width: 240px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; font: inherit; font-size: 13px; }
.chatline { margin-bottom: 8px; cursor: pointer; font-family: ui-monospace, monospace; font-size: 13px; padding: 10px 12px; }
tr.nolink { cursor: default; } tr.nolink td { vertical-align: top; }
.mat { margin-top: 3px; white-space: nowrap; } tr.nolink:hover { background: none; }
/* Today */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 14px; align-items: start; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.panel { padding: 12px 16px 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; }
.panel-head h2 { margin: 0 0 8px; }
.panel-head a { text-decoration: none; }
ul.rows { list-style: none; margin: 0; padding: 0; }
ul.rows li { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
ul.rows li:last-child { border-bottom: 0; }
ul.rows .right { margin-left: auto; }
a.todo { display: flex; gap: 10px; color: var(--text); text-decoration: none; }
a.todo:hover { color: var(--accent); }
a.todo .ico { width: 16px; text-align: center; color: var(--text-2); }
a { color: var(--accent); }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
/* drawer */
#drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface);
  border-left: 1px solid var(--border); box-shadow: -8px 0 24px rgba(0,0,0,.12); transform: translateX(105%);
  transition: transform .18s ease; overflow-y: auto; z-index: 10; padding: 18px 20px 30px; }
#drawer.open { transform: none; }
#drawer .close { position: absolute; top: 12px; right: 14px; }
#drawer h3 { margin: 0 34px 4px 0; font-size: 17px; }
.chart { position: relative; margin: 6px 0 4px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 10.5px; }
.chart .grid line { stroke: var(--border); stroke-width: 1; }
.tooltip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 9px; font-size: 12px; box-shadow: 0 4px 12px rgba(0,0,0,.15);
  white-space: nowrap; display: none; z-index: 2; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 13px; }
.kv .k { color: var(--text-2); }
@media (max-width: 640px) { main, header, nav { padding-left: 16px; padding-right: 16px; } .search { flex-basis: 100%; order: 5; } header .meta { display: none; } }
