:root {
  --bg: #0f1116;
  --bg2: #161a23;
  --bg3: #1f2430;
  --fg: #e7e9ef;
  --muted: #8a8f9e;
  --gold: #f5b53d;        /* single warm accent */
  --gold-ink: #1c1606;    /* text on gold */
  --green: #34d399;       /* money / connected */
  --red: #ef5350;
  --line: #2b3140;
  --hi: rgba(245, 181, 61, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  width: 384px;
  max-height: 600px;
  font: 13px/1.4 "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; background: var(--bg2); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); }
.status { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status.ok { color: var(--green); }
.status.ok::before { background: var(--green); }
.status.auth, .status.error { color: var(--red); }
.status.auth::before, .status.error::before { background: var(--red); }

.tabs { display: flex; background: var(--bg2); border-bottom: 1px solid var(--line); }
.seg {
  flex: 1; padding: 9px; font-size: 13px; color: var(--muted);
  background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer;
}
.seg.on { color: var(--gold); border-bottom-color: var(--gold); font-weight: 600; }
.seg:hover { color: var(--fg); }

.hidden { display: none !important; }

.toolbar {
  display: flex; flex-direction: column; gap: 7px;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
}
.toolbar-row { display: flex; gap: 6px; align-items: center; }
.toolbar-row > .control { flex: 1 1 0; min-width: 0; }
.control {
  background: var(--bg3); color: var(--fg); border: 1px solid var(--line);
  border-radius: 7px; padding: 0 9px; height: 32px; font-size: 12px;
}
select.control { cursor: pointer; }
#f-region { flex: 1 1 auto; }
.chk {
  display: flex; align-items: center; gap: 5px; flex: 0 0 auto;
  font-size: 12px; color: var(--muted); white-space: nowrap;
  background: var(--bg3); border: 1px solid var(--line); border-radius: 7px;
  height: 32px; padding: 0 11px; cursor: pointer;
}

.list { overflow-y: auto; flex: 1; min-height: 90px; }
.empty { padding: 26px 16px; text-align: center; color: var(--muted); font-size: 12px; }

.stats { display: flex; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.stat { flex: 1; background: var(--bg2); border-radius: 7px; padding: 6px 8px; text-align: center; }
.stat .v { font-size: 15px; font-weight: 700; }
.stat .l { font-size: 10px; color: var(--muted); margin-top: 1px; }

.item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-bottom: 1px solid var(--line);
  position: relative; cursor: default;
}
.item:hover { background: var(--hi); }
.item.unread { background: var(--hi); }
.item.unread::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gold); }
.item.inactive { opacity: 0.62; }
.item.inactive::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--red); }
.item.inactive .flow { text-decoration: line-through; color: var(--muted); }
.item.inactive .price { color: var(--muted); }

/* Per-card actions: a small floating toolbar revealed on hover (right side). */
.row-actions {
  position: absolute; right: 8px; top: 7px;
  display: flex; gap: 6px; align-items: center;
  opacity: 0; pointer-events: none; transition: opacity 0.12s;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 9px; padding: 5px 6px; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
}
.item:hover .row-actions { opacity: 1; pointer-events: auto; }
.rowbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  border: 1px solid var(--line); border-radius: 7px; cursor: pointer;
  background: var(--bg3); color: var(--muted);
}
.rowbtn svg { display: block; }
.rowbtn.open:hover { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.rowbtn.dismiss:hover { color: var(--red); border-color: var(--red); }

.emb { width: 32px; height: 32px; object-fit: contain; flex: 0 0 auto; }
.emb-none {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg3); border: 1px solid var(--line); border-radius: 8px;
  font-weight: 700; font-size: 13px; color: var(--muted);
}

.center { flex: 1; min-width: 0; }
.chips { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; flex-wrap: wrap; }
.chip { font-size: 10px; padding: 2px 7px; border-radius: 999px; background: var(--bg3); color: var(--muted); white-space: nowrap; }
.chip.t-rank { color: #c4b5fd; }
.chip.t-placements { color: #67e8f9; }
.chip.t-netwins { color: #86efac; }
.chip.t-custom { color: #fca5a5; }
.chip.g-lol { color: #f5b53d; }
.chip.g-valorant { color: #ff6b81; }
.chip.s-taken, .chip.s-cancelled, .chip.s-expired, .chip.s-inactive {
  background: rgba(239, 83, 80, 0.18); color: #fca5a5; font-weight: 700;
}
.chip.hot { background: var(--gold); color: var(--gold-ink); font-weight: 700; }
.item.hot { background: rgba(245, 181, 61, 0.06); }
.item.hot .price { color: var(--gold); }
.flow { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow .arrow { color: var(--muted); margin: 0 5px; font-weight: 400; }
.sub { font-size: 11px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.right { text-align: right; flex: 0 0 auto; }
.price { color: var(--green); font-weight: 700; font-size: 16px; white-space: nowrap; }
.price.none { color: var(--muted); font-weight: 500; font-size: 14px; }
.time { font-size: 10px; color: var(--muted); }

.actions { display: flex; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--bg2); }
.btn {
  flex: 1; padding: 8px; border-radius: 7px; cursor: pointer;
  background: var(--gold); color: var(--gold-ink); border: none; font-weight: 700; font-size: 12px;
}
.btn.ghost { background: var(--bg3); color: var(--fg); }
.btn:hover { filter: brightness(1.08); }

#settings { padding: 10px 12px; background: var(--bg2); overflow-y: auto; }
.gtabs { display: flex; gap: 6px; margin: 2px 0 10px; }
.gtab {
  flex: 1; padding: 9px; font-size: 12px; cursor: pointer;
  background: var(--bg3); color: var(--muted); border: 1px solid var(--line); border-radius: 8px;
}
.gtab.on { color: var(--gold-ink); background: var(--gold); border-color: var(--gold); font-weight: 700; }
.gtab:hover { filter: brightness(1.08); }

.group { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.group-h {
  display: flex; align-items: center; gap: 6px;
  padding: 11px 12px; font-size: 12px; font-weight: 700; color: var(--gold);
  cursor: pointer; user-select: none;
}
.group-h:hover { background: rgba(255, 255, 255, 0.03); }
.group-sub { font-weight: 400; font-size: 10.5px; color: var(--muted); }
.chev { margin-left: auto; color: var(--muted); font-size: 10px; transition: transform 0.15s; }
.group:not(.open) .chev { transform: rotate(-90deg); }
.group-body { display: none; padding: 0 12px 12px; }
.group.open .group-body { display: block; }

.sublabel { font-size: 11px; color: var(--muted); margin: 11px 0 5px; }
.sublabel small { color: var(--muted); }
.ta {
  width: 100%; background: var(--bg3); color: var(--fg); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 7px; font: 12px/1.45 ui-monospace, monospace; resize: vertical;
}
input[type="checkbox"] { accent-color: var(--gold); }

.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 7px 0; }
.row.toggle { justify-content: flex-start; gap: 6px; }
.row input[type="number"], .row input[type="text"] {
  background: var(--bg3); color: var(--fg); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 7px; width: 120px;
}
.row select {
  background: var(--bg3); color: var(--fg); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 7px;
}
.catfilter { display: flex; gap: 12px; font-size: 12px; }
.catfilter label { display: flex; align-items: center; gap: 4px; }
.regionfilter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 10px; font-size: 12px; }
.regionfilter label {
  display: flex; align-items: center; gap: 5px;
  background: var(--bg3); border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; cursor: pointer;
}
.regionfilter label:hover { border-color: var(--gold); }

.pricegrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 10px; margin: 4px 0; }
.mini { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; }
.mini input { width: 66px; background: var(--bg3); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }

.matrix { display: flex; flex-direction: column; gap: 6px; }
.tcard { background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tcard-head { display: flex; align-items: center; gap: 8px; padding: 9px 10px; cursor: pointer; user-select: none; }
.tcard-head:hover { background: rgba(255, 255, 255, 0.04); }
.t-en { accent-color: var(--gold); }
.ticon { width: 28px; height: 28px; object-fit: contain; flex: 0 0 auto; }
.tname { font-weight: 700; }
.tedit { margin-left: auto; font-size: 11px; color: var(--muted); }
.tcard.open .tedit { color: var(--gold); }
.tcard-body { display: none; padding: 0 10px 10px; }
.tcard.open .tcard-body { display: block; }
.mlabel { font-size: 10px; color: var(--muted); margin: 9px 0 4px; }
.mrow { display: grid; grid-template-columns: repeat(var(--divs, 4), 1fr); gap: 8px; }
.mrow.one { grid-template-columns: 110px; }
.dcell { display: flex; flex-direction: column; gap: 3px; font-size: 10px; color: var(--muted); }
.dlabel { text-align: center; }
.dcell input {
  width: 100%; background: var(--bg2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 6px; font-size: 12px;
}

.settings-actions { display: flex; gap: 6px; margin-top: 4px; }
.hint { font-size: 10.5px; color: var(--muted); margin: 10px 0 0; line-height: 1.5; }

/* ---- Phase 2: offers + automation ---- */
.right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.offerbtn {
  background: var(--gold); color: var(--gold-ink); border: none; border-radius: 6px;
  padding: 4px 9px; font-size: 11px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.offerbtn:hover { filter: brightness(1.08); }
.offerbtn:disabled { background: var(--bg3); color: var(--muted); cursor: not-allowed; filter: none; }
.offered { font-size: 11px; font-weight: 700; color: var(--green); white-space: nowrap; }
.row.warn { color: var(--gold); }
.row.warn b { color: var(--gold); }
.row small { color: var(--muted); font-weight: 400; font-size: 10px; }
