:root {
  --bg: #0f1419;
  --panel: #1a222c;
  --text: #e8eef4;
  --muted: #8b9aab;
  --accent: #3d9cf0;
  --ok: #2f9e62;
  --bad: #d64545;
  --line: #2a3542;
  --font: "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
}
body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #1c2a3a, var(--bg));
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px max(20px, env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid rgba(42, 53, 66, 0.95);
  background: rgba(12, 17, 23, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}
.site-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px max(20px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(61, 156, 240, 0.25);
}
.brand-text {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  padding: 4px;
  border-radius: 12px;
  background: rgba(26, 34, 44, 0.72);
  border: 1px solid var(--line);
}
.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  line-height: 1.2;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-link:hover {
  color: var(--text);
  background: rgba(61, 156, 240, 0.1);
  text-decoration: none;
}
.nav-link.is-active {
  color: #041018;
  background: var(--accent);
}
.nav-link.is-active:hover {
  color: #041018;
  background: #54aaf5;
}
.nav-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.nav-logout .ico-logout {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: none;
}
.nav-logout:hover {
  color: #ffb4b4;
  border-color: rgba(214, 69, 69, 0.45);
  background: rgba(214, 69, 69, 0.12);
  text-decoration: none;
}

.price-stamp-bar {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 max(20px, env(safe-area-inset-right)) 10px max(20px, env(safe-area-inset-left));
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.bot-stamp-card,
.price-stamp-card {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(26, 34, 44, 0.92);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  line-height: 1.25;
}
.bot-stamp-card { gap: 10px 12px; }
.bot-stamp {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 650;
  color: var(--muted);
  white-space: nowrap;
}
.bot-stamp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e88989;
  box-shadow: 0 0 7px rgba(232, 137, 137, 0.45);
}
.bot-stamp.is-on { color: #86efac; }
.bot-stamp.is-on .bot-stamp-dot {
  background: #3dcc7a;
  box-shadow: 0 0 8px rgba(61, 204, 122, 0.55);
}
.bot-stamp.is-off { color: #fca5a5; }
.bot-stamp.is-off .bot-stamp-dot {
  background: #e88989;
  box-shadow: 0 0 7px rgba(232, 137, 137, 0.45);
}
.price-stamp-k {
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.68rem;
}
.price-stamp-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}
.price-stamp-name {
  color: var(--muted);
  font-weight: 600;
}
.price-stamp-time {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
.price-stamp-item.is-fresh .price-stamp-time { color: #7dcea0; }
.price-stamp-item.is-stale .price-stamp-time { color: #e8c36a; }
.price-stamp-item.is-old .price-stamp-time,
.price-stamp-item.is-missing .price-stamp-time { color: #e88989; }
.price-stamp-errors,
.price-stamp-err {
  color: #fca5a5;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.price-stamp-errors {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(214, 69, 69, 0.18);
  border: 1px solid rgba(214, 69, 69, 0.35);
}

@media (max-width: 900px) {
  .site-header-inner {
    grid-template-columns: 1fr;
    gap: 10px;
    padding-right: max(48px, calc(env(safe-area-inset-right) + 40px));
  }
  .nav-logout {
    position: absolute;
    top: calc(env(safe-area-inset-top) + 8px);
    right: max(8px, env(safe-area-inset-right));
    z-index: 45;
    width: 36px;
    height: 36px;
    min-height: 0;
    padding: 0;
    border-radius: 10px;
    border-color: var(--line);
    background: rgba(26, 34, 44, 0.92);
    justify-content: center;
  }
  .nav-logout .ico-logout { display: block; }
  .nav-logout-text { display: none; }
  .site-nav {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .price-stamp-card { max-width: 100%; }
  .nav-link {
    flex: 0 0 auto;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }
}

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}
.card .n { font-size: 1.8rem; font-weight: 700; }
.card .l { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.api-links { margin-top: 28px; }
.api-links h2 {
  font-size: 1.05rem;
  font-weight: 650;
  margin: 0 0 6px;
}
.api-links > .muted { margin: 0 0 12px; }
.api-link-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.api-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
}
a.api-link:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.api-link.is-write {
  opacity: 0.72;
  cursor: default;
}
.api-method {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #9fe0b8;
  background: rgba(47, 158, 98, 0.16);
  padding: 2px 6px;
  border-radius: 4px;
}
.api-method.is-post {
  color: #f0d59f;
  background: rgba(176, 132, 48, 0.18);
}
.api-link code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.84rem;
  color: #9fd0ff;
  word-break: break-all;
}
.api-note { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; align-items: end; }
input, select, button {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #121820;
  color: var(--text);
  padding: 8px 10px;
}
button, .btn {
  background: var(--accent);
  border: none;
  color: #041018;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
}
button.danger { background: var(--bad); color: #fff; }
button.ghost, .btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
th, td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
}
th { color: var(--muted); font-weight: 600; }
.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.dot.on { background: var(--ok); }
.dot.off { background: var(--bad); }
.muted { color: var(--muted); }
.actions { display: flex; gap: 6px; }
form.inline { display: inline; }

.skins-table .actions {
  white-space: nowrap;
  vertical-align: middle;
}
.skins-table tbody tr:hover { background: rgba(61, 156, 240, 0.05); }
.skins-table tr.is-editing { background: rgba(61, 156, 240, 0.08); }
.pattern-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(61, 156, 240, 0.14);
  border: 1px solid rgba(61, 156, 240, 0.45);
  color: #9fd0ff;
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
}
.btn-edit {
  background: #1a222c;
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 600;
}
.btn-edit:hover { border-color: #4a6075; text-decoration: none; }
.dot-btn {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.dot-btn .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(47, 158, 98, 0.35);
}
.dot-btn .dot.off { box-shadow: 0 0 8px rgba(214, 69, 69, 0.35); }
.skin-edit-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0;
}
.skin-edit-title { min-width: 280px; flex: 1 1 280px; }
.skin-edit-float { width: 90px; }
.skin-edit-patterns { min-width: 220px; flex: 1 1 200px; }
.skin-add-card {
  background: var(--panel);
  border: 1px solid rgba(61, 156, 240, 0.35);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 0 0 16px;
}
.skin-add-title {
  font-weight: 700;
  margin-bottom: 10px;
  color: #9fd0ff;
}

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.page-head h1 { margin: 0 0 6px; }
.page-head p { margin: 0; }
.page-head-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.meta-pill {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 0.92rem;
}
.meta-pill b { color: var(--text); }

.page-purchases .page-head {
  align-items: center;
  margin-bottom: 18px;
}
.page-purchases .page-head h1 {
  font-size: 1.85rem;
  letter-spacing: -0.02em;
}
.purchase-head-sum {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text);
}
.purchase-head-sum .ico-bag {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex: 0 0 18px;
}
.purchase-head-sum .is-money {
  color: #3dcc7a;
  font-weight: 700;
}
.purchase-head-sum .is-money.is-profit.is-plus { color: #86efac; }
.purchase-head-sum .is-money.is-profit.is-minus { color: #fca5a5; }
.btn-clear-filters {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.btn-clear-filters svg {
  width: 14px;
  height: 14px;
}
.btn-clear-filters:hover {
  border-color: #4a6075;
  text-decoration: none;
}

.day-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.day-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 6px;
  row-gap: 4px;
  align-items: center;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 8px 7px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.day-card:hover {
  text-decoration: none;
  border-color: #3d5368;
  transform: translateY(-1px);
}
.day-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(61,156,240,0.25); }
.day-card-date {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 0;
  white-space: nowrap;
}
.day-card-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.day-card-count {
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.day-card-sum {
  color: #3dcc7a;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.day-card-sum.is-profit.is-plus { color: #86efac; }
.day-card-sum.is-profit.is-minus { color: #fca5a5; }
.day-card-kinds {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
  margin-top: 0;
  justify-self: end;
}
.day-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.day-pill.is-roi {
  color: #ff7b7b;
  background: rgba(214, 69, 69, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.5);
}
.day-pill.is-float {
  color: #3dcc7a;
  background: rgba(47, 158, 98, 0.12);
  border: 1px solid rgba(61, 204, 122, 0.48);
}

.ico-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.purchase-filters {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px;
  margin: 0 0 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.purchase-filters .field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  min-width: 148px;
}
.purchase-filters .field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  height: 14px;
}
.purchase-date-fields {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}
.purchase-filters .field input,
.purchase-filters .field select {
  height: 42px;
  min-height: 42px;
  box-sizing: border-box;
}
.purchase-search-zone {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex: 1 1 560px;
  min-width: 0;
  flex-wrap: nowrap;
  height: 42px;
}
.purchase-search-field {
  position: relative;
  flex: 1 1 220px;
  min-width: 180px;
  display: flex;
  align-items: center;
  height: 42px;
}
.purchase-search-field .ico-search {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.purchase-search-field input {
  width: 100%;
  height: 42px;
  min-height: 42px;
  padding-left: 38px;
  border-radius: 999px;
  box-sizing: border-box;
}
.filter-kind,
.filter-cats {
  display: flex;
  align-items: stretch;
  gap: 6px;
  flex: 0 0 auto;
  height: 42px;
}
.filter-chip,
.filter-cat,
.filter-more-btn {
  height: 42px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
}
.filter-chip.is-all {
  color: #6eb6f5;
  border: 1px solid rgba(61, 156, 240, 0.55);
}
.filter-chip.is-all.is-active {
  background: rgba(61, 156, 240, 0.12);
  box-shadow: 0 0 0 1px rgba(61, 156, 240, 0.25);
}
.filter-chip.is-roi {
  color: #ff7b7b;
  border: 1px solid rgba(255, 107, 107, 0.55);
}
.filter-chip.is-roi.is-active {
  background: rgba(255, 107, 107, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 107, 107, 0.25);
}
.filter-chip.is-float {
  color: #3dcc7a;
  border: 1px solid rgba(61, 204, 122, 0.55);
}
.filter-chip.is-float.is-active {
  background: rgba(61, 204, 122, 0.12);
  box-shadow: 0 0 0 1px rgba(61, 204, 122, 0.25);
}
.filter-cat,
.filter-more-btn {
  color: var(--text);
  border: 1px solid var(--line);
  gap: 7px;
}
.filter-cat svg,
.filter-more-btn svg,
.filter-more-item svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: #e6edf4;
}
.filter-more-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}
.filter-cat:hover,
.filter-more-btn:hover {
  border-color: #4a6075;
}
.filter-cat.is-active,
.filter-more.is-active .filter-more-btn {
  border-color: var(--accent);
  background: rgba(61, 156, 240, 0.12);
  color: var(--text);
}
.filter-more {
  position: relative;
  height: 42px;
  display: flex;
}
.filter-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.4);
  z-index: 30;
}
.filter-more-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.filter-more-item:hover {
  background: rgba(61, 156, 240, 0.1);
}
.filter-more-item.is-active {
  color: var(--accent);
  background: rgba(61, 156, 240, 0.12);
}
.filter-more-sep {
  margin: 6px 8px 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.filter-more-range {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.filter-more-item.is-active .filter-more-range {
  color: inherit;
}
.filter-more.is-open .filter-more-btn svg { transform: rotate(180deg); }
.filter-more-btn svg { transition: transform 0.15s ease; }
.purchase-range-split {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  align-self: flex-end;
  height: 42px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #121820;
  box-sizing: border-box;
}
.purchase-range-split.is-today,
.purchase-range-split.is-range,
.purchase-range-split.is-open {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(61, 156, 240, 0.22);
}
.range-split-main {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 0;
  padding: 0 14px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  box-sizing: border-box;
}
.range-split-main:hover { text-decoration: none; color: var(--text); }
.purchase-range-split.is-today .range-split-main::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateX(-50%);
}
.range-split-caret {
  width: 36px;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 9px 9px 0;
}
.range-split-caret:hover { color: var(--text); background: rgba(61, 156, 240, 0.08); }
.range-split-caret svg {
  width: 11px;
  height: 8px;
  transition: transform 0.15s ease;
}
.purchase-range-split.is-open .range-split-caret svg { transform: rotate(180deg); }
.range-split-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 148px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.4);
  z-index: 30;
}
.range-split-item {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.range-split-item:hover {
  background: rgba(61, 156, 240, 0.1);
  text-decoration: none;
}
.range-split-item.is-active {
  color: var(--accent);
  background: rgba(61, 156, 240, 0.12);
}

.page-purchases .wrap { max-width: 1500px; }
.page-purchases .site-header-inner { max-width: 1500px; }

.purchases-layout {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.purchases-board {
  flex: 0 1 auto;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.purchases-aside {
  flex: 1 1 300px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 16px 14px;
}
.stat-card h2 {
  margin: 0 0 14px;
  font-size: 0.98rem;
  font-weight: 700;
}
.stat-donut-row {
  display: flex;
  align-items: center;
  gap: 18px;
}
.stat-donut {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 118px;
}
.stat-donut-hole {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.stat-donut-hole b {
  font-size: 1.35rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-donut-hole span {
  color: var(--muted);
  font-size: 0.72rem;
  margin-top: 2px;
}
.stat-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}
.stat-legend li {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 10px;
  align-items: center;
}
.stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 8px;
}
.stat-legend-name { font-weight: 700; font-size: 0.9rem; }
.stat-legend-val {
  color: var(--muted);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.wear-list { display: grid; gap: 12px; }
.wear-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.wear-name {
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 5px;
}
.wear-range { color: var(--muted); font-weight: 500; }
.wear-track {
  height: 6px;
  border-radius: 99px;
  background: #24303c;
  overflow: hidden;
}
.wear-fill {
  display: block;
  height: 100%;
  border-radius: 99px;
  min-width: 0;
}
.wear-count {
  color: var(--muted);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cat-list { display: grid; gap: 10px; }
.cat-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.cat-ico {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: #e6edf4;
}
.cat-ico svg {
  width: 18px;
  height: 18px;
  display: block;
}
.cat-name { font-weight: 700; font-size: 0.92rem; }
.cat-count { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.cat-sum {
  color: #f0c56e;
  font-size: 0.98rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.purchases-table {
  width: max-content;
  max-width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: auto;
}
.purchases-table th,
.purchases-table td {
  padding: 10px 12px;
  vertical-align: middle;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--line);
}
.purchases-table tbody tr:last-child td { border-bottom: none; }
.purchases-table .purchase-date,
.purchases-table .purchase-id-cell,
.purchases-table .purchase-type-cell,
.purchases-table .purchase-float-cell,
.purchases-table .purchase-price,
.purchases-table .purchase-chevron,
.purchases-table .purchase-chevron-th {
  width: 1%;
  white-space: nowrap;
}
.purchases-table .purchase-item-th,
.purchases-table .purchase-item-cell {
  width: auto;
}
.purchases-table th {
  color: #8b9aab;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.purchases-table .num { text-align: right; white-space: nowrap; }
.purchases-table .th-sort {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  box-shadow: none;
}
.purchases-table .th-sort:hover {
  color: var(--accent);
  text-decoration: none;
}
.purchases-table .th-sort.is-active { color: var(--accent); }
.price-sort-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
}
.price-sort-wrap .ico-caret {
  width: 9px;
  height: 6px;
  opacity: 0.7;
  transition: transform 0.15s ease;
}
.price-sort-wrap.is-open .ico-caret { transform: rotate(180deg); }
.price-sort-wrap.is-loading .th-sort { opacity: 0.55; }
.price-sort-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 168px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.4);
  z-index: 40;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
}
.price-sort-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
  cursor: pointer;
}
.price-sort-item:hover {
  background: rgba(61, 156, 240, 0.1);
}
.price-sort-item.is-active {
  color: var(--accent);
  background: rgba(61, 156, 240, 0.12);
}
.purchases-table .ico-sort {
  width: 9px;
  height: 12px;
  fill: currentColor;
  opacity: 0.7;
}
.purchases-table .mono {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.9rem;
}
.purchases-table .nowrap { white-space: nowrap; }
.purchase-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.purchase-thumb {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  object-fit: contain;
  border-radius: 8px;
  background: #121820;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.purchase-thumb-empty {
  display: block;
  background: #121820;
}
.purchase-item-meta {
  min-width: 0;
  line-height: 1.25;
}
.purchase-wear {
  margin-top: 3px;
  color: #8b9aab;
  font-size: 0.8rem;
  font-weight: 500;
}
.purchase-time {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.purchase-time-d {
  color: #f3f6fa;
  font-size: 0.92rem;
  font-weight: 600;
}
.purchase-time-t {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #8b9aab;
  font-size: 0.8rem;
  font-weight: 500;
}
.purchase-time-t .ico-clock {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
}
.purchases-table .purchase-copy {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-align: left;
  cursor: pointer;
  vertical-align: baseline;
  box-shadow: none;
}
.purchases-table .purchase-copy-title {
  display: block;
  color: #f5f9ff;
  font-size: 0.95rem;
  font-weight: 650;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.purchases-table .purchase-copy-id {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #c5d0dc;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
}
.purchases-table .ico-copy {
  width: 13px;
  height: 13px;
  color: #7f91a5;
  flex: 0 0 13px;
}
.purchases-table .purchase-copy-float {
  background: transparent;
  border: none;
  padding: 0;
  color: #f3f6fa;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.86rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.purchase-float-cell {
  min-width: 132px;
}
.purchase-float {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
}
.float-bar {
  position: relative;
  display: block;
  width: 118px;
  height: 6px;
  min-height: 6px;
  margin: 0;
  border-radius: 999px;
  background-color: #3ddc84;
  background-image: linear-gradient(90deg, #3ddc84 0%, #e8d44d 48%, #e85d5d 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
  overflow: visible;
  flex: 0 0 auto;
}
.float-bar-marker {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #1a222c;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}
.purchase-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.purchase-type.is-roi {
  color: #ff6b6b;
  background: rgba(214, 69, 69, 0.1);
  border: 1px solid rgba(255, 90, 90, 0.5);
}
.purchase-type.is-float {
  color: #3dcc7a;
  background: rgba(47, 158, 98, 0.1);
  border: 1px solid rgba(61, 204, 122, 0.48);
}
.purchases-table .purchase-copy:hover {
  color: var(--accent);
  text-decoration: none;
}
.purchases-table .purchase-copy-title:hover {
  color: #9fd0ff;
}
.purchases-table .purchase-copy-id:hover {
  color: #e8f4ff;
}
.purchases-table .purchase-copy-id:hover .ico-copy {
  color: #d5e8f7;
}
.purchases-table .purchase-copy-float:hover {
  color: #ffffff;
  background: transparent;
}
.purchases-table .purchase-copy-title.is-flash {
  color: #9fd0ff;
}
.purchases-table .purchase-copy-id.is-flash {
  color: #d5e8f7;
}
.purchases-table .purchase-copy-float.is-copied {
  border-radius: 4px;
  padding: 0 4px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}
.purchases-table td.purchase-price {
  color: #f0c56e;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.purchase-prices {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  line-height: 1.2;
}
.purchase-buy {
  color: #f0c56e;
}
.purchase-ref {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.purchase-ref.is-buff { color: #5eead4; }
.purchase-ref.is-empire { color: #93c5fd; }
.purchase-ref.is-buy { color: #fbbf24; }
.purchase-ref.is-empty { color: #6d7d8e; font-weight: 500; }
.purchase-delta {
  display: block;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.purchase-delta.is-plus { color: #86efac; }
.purchase-delta.is-minus { color: #fca5a5; }
.purchase-chevron-th,
.purchase-chevron {
  width: 36px;
  padding-left: 4px;
  padding-right: 12px;
  color: #6d7d8e;
}
.purchase-dmarket {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: #6d7d8e;
  text-decoration: none;
}
.purchase-dmarket .ico-dmarket {
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  box-shadow: 0 0 0 1px rgba(94, 240, 230, 0.2);
}
.purchase-dmarket:hover {
  color: var(--accent);
  text-decoration: none;
}
.purchase-dmarket:hover .ico-dmarket {
  box-shadow: 0 0 0 1px rgba(94, 240, 230, 0.55);
}
.purchase-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.purchase-search-wrap input { flex: 1 1 auto; min-width: 0; }
.purchases-table tr.is-hit-title .purchase-copy-title {
  box-shadow: 0 0 0 1px rgba(61, 156, 240, 0.45);
  border-radius: 6px;
  background: rgba(61, 156, 240, 0.12);
}
.purchases-table tr.is-hit-id .purchase-copy-id {
  color: #e8f4ff;
}
.purchases-table tr.is-hit-float .purchase-copy-float {
  border-radius: 4px;
  padding: 0 4px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}
.purchases-table tbody tr:hover { background: rgba(61, 156, 240, 0.06); }

.pager {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
}

@media (max-width: 1100px) {
  .day-strip { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .purchases-layout { flex-direction: column; }
  .purchases-board,
  .purchases-aside { width: 100%; max-width: 100%; min-width: 0; }
}
@media (max-width: 900px) {
  .day-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .wrap {
    padding: 14px max(14px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  }
}

.log-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel);
}
.log-header-badge span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(47, 158, 98, 0.12);
}
.log-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.log-category-field,
.log-search-field {
  display: grid;
  gap: 7px;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.log-category-field { width: 320px; }
.log-search-field { flex: 1 1 280px; min-width: 220px; }
.log-clear-button { height: 42px; }
.log-list-card {
  overflow: visible;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.log-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}
.log-row:last-child { border-bottom: none; }
.log-row:hover { background: rgba(61, 156, 240, 0.05); }
.log-time {
  flex: 0 0 4.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  color: var(--muted);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.15;
  white-space: nowrap;
}
.log-time-d { color: #7f91a5; }
.log-time-t { color: #a7b6c6; letter-spacing: 0.01em; }
.log-body {
  flex: 1 1 36rem;
  min-width: 16rem;
  color: #c5d0db;
  line-height: 1.45;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  font-size: 0.98rem;
  font-weight: 400;
}
.log-body b {
  color: #e8eef4;
  font-weight: 600;
}
.log-tag {
  display: inline-block;
  margin: 0 4px 0 2px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  vertical-align: middle;
}
.log-tag-roi {
  color: #8fa3b8;
  background: rgba(143, 163, 184, 0.1);
  border: 1px solid rgba(143, 163, 184, 0.22);
}
.log-tag-float {
  color: #3dba7a;
  background: rgba(47, 158, 98, 0.16);
  border: 1px solid rgba(61, 186, 122, 0.38);
}
.log-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  margin: 0 3px 0 0;
  padding: 0;
  border: none;
  background: transparent;
  vertical-align: middle;
  white-space: nowrap;
}
.log-metric-k {
  color: #6f8296;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.log-metric-v {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.log-metric-buff { color: #e6bc74; }
.log-metric-skin { color: #74d498; }
.log-metric-con { color: #f0a36b; }
.log-metric-pct { color: #93c5fd; }
.log-prefix {
  color: #8b9aab;
  margin-right: 4px;
  font-weight: 400;
}
.log-copy {
  display: inline;
  margin: 0 2px 0 0;
  padding: 0 3px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1.3;
  cursor: pointer;
  vertical-align: baseline;
}
.log-copy-title {
  display: inline;
  max-width: none;
  overflow: visible;
  text-overflow: unset;
  white-space: nowrap;
  color: #f5f9ff;
  font-size: 1.02rem;
  font-weight: 600;
}
.log-copy-float {
  color: #8fa0b2;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.86em;
  font-weight: 400;
}
.log-copy:hover {
  border-color: #36536e;
  color: #7dccff;
  background: #142638;
}
.log-copy-title.is-flash {
  border-color: #49a9ef;
  color: #b8e0ff;
  background: rgba(55, 157, 239, 0.18);
}
.log-copy-float.is-copied {
  border-color: #32a852;
  color: #b8f7c8;
  background: rgba(50, 168, 82, 0.28);
  box-shadow: 0 0 0 2px rgba(50, 168, 82, 0.12);
}
.log-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 1px 8px 1px 6px;
  border-radius: 999px;
  border: 1px solid rgba(61, 156, 240, 0.42);
  background: rgba(61, 156, 240, 0.12);
  color: #7ec8ff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.35;
  text-transform: uppercase;
  text-decoration: none;
  vertical-align: middle;
  white-space: nowrap;
}
.log-link::before {
  content: "";
  width: 10px;
  height: 10px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M6.2 2.5H2.8A1.3 1.3 0 0 0 1.5 3.8v9.4A1.3 1.3 0 0 0 2.8 14.5h9.4a1.3 1.3 0 0 0 1.3-1.3V9.4h-1.6v3.5a.2.2 0 0 1-.2.2H3.1a.2.2 0 0 1-.2-.2V4.1a.2.2 0 0 1 .2-.2h3.1V2.5Zm3.4 0V1H15v5.4h-1.6V3.73L7.47 9.66l-1.13-1.13 5.93-5.93H9.6Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M6.2 2.5H2.8A1.3 1.3 0 0 0 1.5 3.8v9.4A1.3 1.3 0 0 0 2.8 14.5h9.4a1.3 1.3 0 0 0 1.3-1.3V9.4h-1.6v3.5a.2.2 0 0 1-.2.2H3.1a.2.2 0 0 1-.2-.2V4.1a.2.2 0 0 1 .2-.2h3.1V2.5Zm3.4 0V1H15v5.4h-1.6V3.73L7.47 9.66l-1.13-1.13 5.93-5.93H9.6Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.log-link:hover {
  color: #e8f6ff;
  background: rgba(61, 156, 240, 0.28);
  border-color: rgba(158, 214, 255, 0.75);
  text-decoration: none;
}

.toast-host {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  min-width: 180px;
  max-width: 320px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #2a3d52;
  background: rgba(20, 32, 45, 0.96);
  color: #e8eef4;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.log-cat-pill {
  flex: 0 0 auto;
  display: inline-flex;
  min-width: 28px;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #14202d;
  color: #afc2d7;
  font-weight: 700;
  font-size: 0.85rem;
}
.log-cat-pill.cat-1 { border-color: #3d6a9a; color: #9fd0ff; }
.log-cat-pill.cat-2 { border-color: #6a5a3d; color: #f0d59f; }
.log-cat-pill.cat-3 { border-color: #3d6a52; color: #9fe0b8; }
.log-cat-pill.cat-4 { border-color: #6a3d3d; color: #f0a9a9; }
.log-cat-pill.cat-5 { border-color: #5a3d6a; color: #d2a9f0; }
.log-empty-remark { color: #536a81; padding: 18px 14px; }

.lowball-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(18, 24, 32, 0.85);
  font-size: 0.88rem;
  font-weight: 600;
}
.lowball-ctrl .lowball-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bad);
  box-shadow: 0 0 8px rgba(214, 69, 69, 0.45);
}
.lowball-ctrl.is-on .lowball-dot {
  background: var(--ok);
  box-shadow: 0 0 8px rgba(47, 158, 98, 0.5);
}
.lowball-ctrl .lowball-hint {
  font-size: 0.72rem;
  font-weight: 500;
  color: #7f91a5;
  margin-left: 2px;
}
.lowball-ctrl.is-stopping .lowball-dot {
  background: #e6a23c;
  box-shadow: 0 0 8px rgba(230, 162, 60, 0.55);
  animation: lowball-stopping 0.7s ease-in-out infinite;
}
.lowball-ctrl.is-stopping .lowball-form-stop button.danger {
  background: #b4532a;
  cursor: wait;
  opacity: 0.92;
}
@keyframes lowball-stopping {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}
.flash {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.flash.ok {
  border-color: rgba(47, 158, 98, 0.45);
  background: rgba(47, 158, 98, 0.12);
  color: #b8f7c8;
}
.flash.bad {
  border-color: rgba(214, 69, 69, 0.45);
  background: rgba(214, 69, 69, 0.12);
  color: #ffb4b4;
}
.log-price-edit {
  flex: 0 0 auto;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 3px 6px;
  border-radius: 8px;
  border: 1px solid rgba(42, 53, 66, 0.95);
  background: rgba(12, 17, 23, 0.55);
}
.log-price-paid {
  color: #7dccff;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.log-price-min {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  color: #7f91a5;
  font-size: 0.72rem;
}
.log-price-min input {
  width: 72px;
  padding: 3px 6px;
  font-size: 0.8rem;
}
.log-price-edit button {
  padding: 3px 8px;
  font-size: 0.76rem;
}
.log-price-edit.is-saved {
  border-color: rgba(47, 158, 98, 0.55);
  box-shadow: 0 0 0 1px rgba(47, 158, 98, 0.18);
}
.log-price-edit.is-error {
  border-color: rgba(214, 69, 69, 0.55);
  box-shadow: 0 0 0 1px rgba(214, 69, 69, 0.18);
}
.log-bulk-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 10px;
}
.log-bulk-btn,
.log-all-ok {
  padding: 6px 12px;
  font-size: 0.84rem;
  font-weight: 700;
}
.log-bulk-btn {
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
}
.log-bulk-btn:hover { border-color: rgba(61, 156, 240, 0.45); }
.log-sort-btn {
  padding: 6px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
}
.log-sort-btn:hover { border-color: rgba(61, 156, 240, 0.45); }
.log-sort-btn.is-on {
  border-color: rgba(61, 156, 240, 0.55);
  color: #9fd0ff;
}

@media (max-width: 760px) {
  input, select, textarea {
    font-size: 16px;
  }
  button, .btn, .nav-link, .nav-logout, .filter-chip, .filter-cat, .filter-more-btn,
  .range-split-main, .range-split-caret, .btn-clear-filters {
    touch-action: manipulation;
  }
  .site-header-inner {
    padding: 10px max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
    gap: 8px;
  }
  .brand-text { font-size: 1rem; }
  .wrap {
    padding: 12px max(12px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .page-head h1 { font-size: 1.4rem; }
  .page-purchases .page-head h1 { font-size: 1.45rem; }
  .page-head-meta {
    width: 100%;
  }
  .purchase-head-sum,
  .btn-clear-filters {
    width: 100%;
    justify-content: center;
  }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .api-link { width: 100%; }
  .api-note { display: none; }
  .toolbar {
    align-items: stretch;
  }
  .toolbar input,
  .toolbar select,
  .toolbar button,
  .toolbar .btn {
    min-height: 44px;
  }
  .toolbar input[type="search"],
  .toolbar input[type="text"] {
    width: 100%;
    flex: 1 1 100%;
  }
  .skin-edit-title,
  .skin-edit-patterns {
    min-width: 0;
    flex: 1 1 100%;
  }
  .skin-edit-float { width: calc(50% - 4px); }

  .day-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
  }
  .day-card {
    padding: 8px 7px 7px;
  }
  .day-card:hover { transform: none; }
  .day-card-sum { font-size: 0.72rem; }
  .day-pill { min-width: 0; padding: 2px 5px; }

  .purchase-filters {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }
  .purchase-search-zone {
    flex: 1 1 auto;
    flex-wrap: wrap;
    height: auto;
    width: 100%;
    gap: 8px;
  }
  .purchase-search-field {
    flex: 1 1 100%;
    min-width: 0;
    height: 44px;
  }
  .purchase-search-field input {
    height: 44px;
    min-height: 44px;
    font-size: 16px;
  }
  .filter-kind,
  .filter-cats {
    width: 100%;
    height: auto;
    flex-wrap: wrap;
  }
  .filter-chip,
  .filter-cat,
  .filter-more-btn {
    flex: 1 1 0;
    justify-content: center;
    min-width: 0;
    height: 44px;
    min-height: 44px;
    padding: 0 8px;
  }
  .filter-more {
    flex: 1 1 0;
    height: auto;
    min-width: 0;
  }
  .filter-more-btn { width: 100%; }
  .filter-more-menu {
    left: 0;
    right: auto;
    min-width: 100%;
  }
  .purchase-date-fields {
    width: 100%;
  }
  .purchase-date-fields .field {
    flex: 1 1 0;
    min-width: 0;
  }
  .purchase-filters .field input {
    width: 100%;
    height: 44px;
    min-height: 44px;
    font-size: 16px;
  }
  .purchase-range-split {
    width: 100%;
    margin-left: 0;
    height: 44px;
    align-self: stretch;
  }
  .range-split-main { flex: 1 1 auto; }
  .range-split-item { padding: 12px; }

  .purchases-board {
    width: 100%;
    max-width: 100%;
    overflow: visible;
  }
  .purchases-table,
  .purchases-table thead,
  .purchases-table tbody,
  .purchases-table tr,
  .purchases-table th,
  .purchases-table td {
    display: block;
    width: 100%;
    max-width: 100%;
  }
  .purchases-table {
    background: transparent;
    border: 0;
    overflow: visible;
    border-radius: 0;
  }
  .purchases-table tbody tr,
  .purchases-table tbody td {
    overflow: visible;
    max-width: none;
  }
  .purchases-table thead tr {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 0 10px;
    background: transparent;
  }
  .purchases-table thead th {
    display: none;
    width: auto;
    padding: 0;
    border: 0;
    background: transparent;
  }
  .purchases-table thead th.purchase-date,
  .purchases-table thead th.purchase-float-cell,
  .purchases-table thead th.purchase-price {
    display: block;
    width: auto;
  }
  .purchases-table thead .th-sort {
    padding: 8px 12px;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--muted);
  }
  .purchases-table thead .th-sort.is-active {
    color: var(--accent);
    border-color: rgba(61, 156, 240, 0.55);
    background: rgba(61, 156, 240, 0.12);
  }
  .purchases-table thead .price-sort-wrap {
    width: 100%;
    justify-content: flex-start;
  }
  .purchases-table thead .price-sort-menu {
    left: 0;
    right: auto;
  }
  .purchases-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .purchases-table tbody tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px 10px;
    align-items: center;
    padding: 12px;
    margin: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
  }
  .purchases-table tbody tr[data-empty] {
    display: block;
    text-align: center;
    color: var(--muted);
  }
  .purchases-table tbody td {
    width: auto;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    white-space: normal;
  }
  .purchases-table tbody tr:last-child td { border-bottom: none; }
  .purchases-table tbody .purchase-item-cell {
    grid-column: 1 / -1;
    grid-row: 1;
  }
  .purchase-item { align-items: flex-start; }
  .purchases-table tbody .purchase-type-cell {
    grid-column: 1;
    grid-row: 2;
    width: auto;
    white-space: nowrap;
  }
  .purchases-table tbody .purchase-date {
    grid-column: 2;
    grid-row: 2;
    width: auto;
  }
  .purchases-table tbody .purchase-id-cell {
    grid-column: 3;
    grid-row: 2;
    width: auto;
    white-space: nowrap;
    justify-self: end;
  }
  .purchases-table tbody .purchase-float-cell {
    grid-column: 1 / -1;
    grid-row: 3;
    min-width: 0;
    width: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
  .purchase-float {
    width: 100%;
    align-items: stretch;
    gap: 8px;
    padding: 2px 0 4px;
  }
  .purchases-table tbody .float-bar {
    width: 100%;
    height: 8px;
    min-height: 8px;
  }
  .purchases-table tbody .purchase-price {
    grid-column: 1 / 3;
    grid-row: 4;
    text-align: left;
    padding-top: 8px;
    margin-top: 2px;
    border-top: 1px solid var(--line);
    font-size: 1.2rem;
  }
  .purchases-table tbody .purchase-prices {
    align-items: flex-start;
  }
  .purchases-table tbody .purchase-ref {
    font-size: 0.82rem;
  }
  .purchases-table tbody .purchase-delta {
    font-size: 0.8rem;
  }
  .purchases-table tbody .purchase-chevron {
    grid-column: 3;
    grid-row: 4;
    width: auto;
    padding: 8px 0 0;
    margin-top: 2px;
    border-top: 1px solid var(--line);
    justify-self: end;
  }
  .purchase-time {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }
  .purchases-table .purchase-copy-title {
    max-width: none;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
  .float-bar { width: 100%; }
  .purchase-dmarket {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--line);
    justify-content: center;
  }
  .purchase-dmarket .ico-dmarket {
    width: 28px;
    height: 28px;
  }
  .purchases-aside { min-width: 0; }
  .stat-donut-row { flex-wrap: wrap; }
  .purchase-thumb {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .log-toolbar { align-items: stretch; flex-direction: column; }
  .log-category-field { width: 100%; }
  .log-category-field select {
    width: 100%;
    min-height: 44px;
  }
  .log-row {
    flex-wrap: wrap;
    gap: 6px 10px;
  }
  .log-body {
    flex: 1 1 100%;
    order: 3;
    white-space: normal;
  }
  .log-cat-pill { margin-left: auto; }
  .log-price-edit { width: 100%; justify-content: flex-start; }
  .log-bulk-bar { justify-content: stretch; }
  .log-bulk-btn,
  .log-sort-btn,
  .log-all-ok { flex: 1 1 auto; min-height: 44px; }
  .log-price-min input {
    font-size: 16px;
    width: 88px;
    min-height: 40px;
  }
  .lowball-ctrl {
    width: 100%;
    flex-wrap: wrap;
    border-radius: 14px;
  }
  input[type="date"] {
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 430px) {
  .day-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-chip,
  .filter-cat,
  .filter-more-btn {
    font-size: 0.78rem;
    gap: 5px;
  }
  .filter-cat svg,
  .filter-more-btn svg {
    width: 14px;
    height: 14px;
    flex-basis: 14px;
  }
  .day-card-count { font-size: 1.05rem; }
  .day-card-date { margin-bottom: 0; }
}

@media (hover: none) {
  .purchases-table tbody tr:hover { background: transparent; }
  .day-card:hover { transform: none; }
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 24px 24px;
}
.login-brand {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}
.login-form .field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.login-form .field span {
  color: var(--muted);
  font-size: 0.85rem;
}
.login-form input {
  font-size: 16px;
  min-height: 44px;
}
.login-form button {
  margin-top: 6px;
  padding: 12px;
  min-height: 44px;
}
.login-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(214, 69, 69, 0.15);
  border: 1px solid var(--bad);
  color: #f0b4b4;
  font-size: 0.92rem;
}

.totp-setup {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}
.totp-qr {
  background: #1a222c;
  border-radius: 12px;
  padding: 10px;
  line-height: 0;
}
.totp-qr svg { display: block; width: 196px; height: 196px; }
.totp-meta { flex: 1 1 240px; min-width: 0; }
.totp-meta p { margin: 0 0 12px; }
.totp-secret {
  display: block;
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #121820;
  color: #9fd0ff;
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  word-break: break-all;
}
.totp-confirm { margin-top: 0; max-width: 280px; }
