:root {
  color-scheme: dark;
  --bg: #0c0f1d;
  --panel: #141830;
  --panel-2: #1a1f3d;
  --line: #262b4a;
  --text: #e7e9f4;
  --muted: #9aa0bd;
  --accent: #8b5cf6;
  --accent-2: #a78bfa;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --price: #f87171;
  --rare: #ffff00;
  --unique: #dbc77d;
  --radius: 10px;
  font: 14px/1.5 system-ui, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
button {
  padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2);
  cursor: pointer; white-space: nowrap;
}
button:hover { border-color: var(--accent); }
a.btn { display: inline-block; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); white-space: nowrap; }
a.btn:hover { text-decoration: none; border-color: var(--accent); }
button.primary, a.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.ghost { background: transparent; }
button.danger:hover { border-color: var(--bad); color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
input, select {
  padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: #0a0d1a; min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ---- Üst çubuk ---- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 10px 20px; background: rgba(12, 15, 29, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; letter-spacing: .02em; color: var(--text); }
.brand span { color: var(--accent-2); }
.spacer { flex: 1; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pill.ok { color: var(--good); border-color: rgba(52, 211, 153, .4); }
.pill.warn { color: var(--warn); border-color: rgba(251, 191, 36, .4); }
.pill.bad { color: var(--bad); border-color: rgba(248, 113, 113, .4); }
.who { color: var(--muted); }

/* ---- Zil ---- */
.bell { position: relative; }
.bell > button { font-size: 18px; line-height: 1; padding: 6px 10px; }
.bell .badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.bell-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: min(400px, calc(100vw - 24px)); max-height: 70vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
}
.bell-panel header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 700; }
.bell-panel header button { font-size: 12px; padding: 4px 8px; }
.notif { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif:hover { background: var(--panel-2); }
.notif.unread { background: rgba(139, 92, 246, .10); }
.notif.unread::before { content: ""; flex: 0 0 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--accent); }
.notif .body { flex: 1; min-width: 0; }
.notif .line1 { display: flex; justify-content: space-between; gap: 8px; }
.notif .meta { color: var(--muted); font-size: 12px; }
.empty { padding: 18px; color: var(--muted); text-align: center; }

/* ---- Düzen ---- */
main { max-width: 1180px; margin: 0 auto; padding: 20px; display: grid; gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card h2 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card h2 .count { color: var(--muted); font-weight: 400; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--bad); }

.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.form-row label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.form-row .grow { flex: 1 1 220px; }
.form-row .grow input { width: 100%; }
.hint { font-size: 12px; color: var(--muted); min-height: 18px; }

/* ---- Tablolar ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--panel-2); }
tr.focus { background: rgba(139, 92, 246, .18) !important; box-shadow: inset 3px 0 0 var(--accent); }
.item-cell { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.icon { width: 32px; height: 32px; border-radius: 4px; background: #000; flex: 0 0 auto; object-fit: cover; }
.icon.lg { width: 56px; height: 56px; }
.price { color: var(--price); font-weight: 700; font-variant-numeric: tabular-nums; }
.price small { display: block; color: var(--good); font-weight: 400; font-size: 11px; }
.price.good { color: var(--good); }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.tag.hot { color: #fff; background: var(--good); border-color: var(--good); }
.g-yellow { color: var(--rare); }
.g-unique_item { color: var(--unique); }
.threshold-edit { width: 120px; }

/* ---- Item sayfası ---- */
.item-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.item-head h1 { margin: 0; font-size: 22px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: transparent; }
.seg button.on { background: var(--accent); color: #fff; }
.chart-box { position: relative; height: 320px; }
.kpis { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.kpi { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; min-width: 130px; }
.kpi b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--muted); }
.stats { display: grid; grid-template-columns: 1fr auto; gap: 2px 14px; font-size: 13px; }
.stats .bonus { color: var(--good); }
.notice { border-left: 3px solid var(--warn); padding: 8px 12px; background: rgba(251, 191, 36, .08); border-radius: 6px; }

/* ---- Giriş ---- */
.login { max-width: 360px; margin: 12vh auto; }
.login .card { display: grid; gap: 12px; }
.login label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.login input { width: 100%; }

@media (max-width: 600px) {
  .topbar { padding: 10px 16px; gap: 8px; flex-wrap: wrap; }
  main { padding: 16px; }
  .who { display: none; }
}
