:root {
  --ink: #2f3f4a;
  --ink-2: #40535f;
  --ink-3: #546873;
  --paper: #f5f4ef;
  --panel: #ffffff;
  --panel-2: #f8f8f4;
  --text: #2c3942;
  --text-2: #5f6e78;
  --text-3: #8d99a2;
  --line: #e6e6df;
  --line-strong: #d7d9d2;
  --court: #df7738;
  --court-soft: #fdf0e5;
  --foil: #218d88;
  --foil-soft: #e8f5f3;
  --blue: #3972d9;
  --blue-soft: #edf3fd;
  --violet: #7c5cd6;
  --violet-soft: #f2eefc;
  --rose: #cf537d;
  --rose-soft: #fceef3;
  --gain: #16895f;
  --gain-soft: #e8f6f0;
  --loss: #cf4b4b;
  --loss-soft: #fdecec;
  --display: "Bebas Neue", Impact, "Arial Black", "Microsoft YaHei", sans-serif;
  --body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  --shadow: 0 1px 2px rgba(47, 63, 74, .05), 0 10px 28px rgba(47, 63, 74, .06);
  --radius: 8px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--text);
  font-family: var(--body);
  letter-spacing: 0;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid rgba(223, 119, 56, .28);
  outline-offset: 2px;
}

svg.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px clamp(16px, 4vw, 48px);
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  animation: topbar-in .35s ease both;
}

@keyframes topbar-in {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border-radius: 12px;
  background: #15181d;
  color: #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .18);
}

.brand-logo-text {
  font-family: var(--display);
  font-size: 25px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  color: #fff;
}

.brand-name {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  color: #000;
}

.changelog-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 34px;
  margin-left: 2px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease, color .14s ease;
}

.changelog-trigger:hover {
  border-color: #b9c8c4;
  background: var(--panel);
  color: var(--text);
}

.changelog-trigger .icon {
  width: 15px;
  height: 15px;
  color: var(--text-3);
}

.changelog-dot {
  position: absolute;
  top: -3px;
  right: -2px;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, .18);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tools-wrap {
  position: relative;
}

.tools-btn {
  gap: 7px;
}

.tools-caret {
  width: 14px;
  height: 14px;
  transition: transform .16s ease;
}

.tools-btn[aria-expanded="true"] .tools-caret {
  transform: rotate(180deg);
}

.auth-wrap {
  position: relative;
  margin-left: auto;
}

.auth-btn {
  max-width: 170px;
}

.auth-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  min-width: 240px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 16px 36px rgba(47, 63, 74, .18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(.98);
  transform-origin: top right;
  transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}

.auth-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.tools-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  min-width: 190px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 16px 36px rgba(47, 63, 74, .18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(.98);
  transform-origin: top right;
  transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}

.tools-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.tools-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: left;
}

.tools-menu button:hover {
  background: var(--panel-2);
}

.tools-menu button .icon {
  width: 16px;
  height: 16px;
  color: var(--text-3);
}

.auth-menu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 6px 8px 10px;
  border-bottom: 1px solid var(--line);
}

.auth-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--court), var(--foil));
  color: #fff;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(47, 63, 74, .16);
}

.auth-avatar.has-avatar {
  background-position: center;
  background-size: cover;
  cursor: pointer;
}

.auth-avatar:not(.has-avatar) {
  cursor: pointer;
}

.auth-id {
  min-width: 0;
}

.auth-id b {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-id span {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-3);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-sig {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-3);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: left;
}

.auth-menu button:hover {
  background: var(--panel-2);
}

.auth-menu button .icon {
  width: 16px;
  height: 16px;
  color: var(--text-3);
}

#logoutBtn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--loss);
  font: inherit;
  font-weight: 700;
  text-align: left;
}

#logoutBtn:hover {
  background: var(--loss-soft);
}

.auth-shell {
  padding: 20px;
}

.auth-field {
  display: block;
  margin-bottom: 12px;
}

.auth-field span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
}

.auth-error {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--loss-soft);
  color: var(--loss);
  font-size: 12px;
  font-weight: 700;
}

.auth-tip {
  margin: -6px 0 12px;
  color: var(--text-3);
  font-size: 12px;
}

.auth-legal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 12px;
}

.auth-legal label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
}

.auth-legal input {
  flex: none;
  width: 15px;
  height: 15px;
  accent-color: var(--court);
}

.avatar-preview {
  display: grid;
  place-items: center;
  width: 140px;
  height: 140px;
  margin: 4px auto 16px;
  overflow: hidden;
  border: 1px dashed var(--line-strong);
  border-radius: 24px;
  background: var(--panel-2);
  color: var(--text-3);
  font-size: 13px;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-actions {
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  transition: background .14s ease, border-color .14s ease, color .14s ease, transform .1s ease, box-shadow .14s ease;
}

.btn:hover {
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 8px 20px rgba(47, 63, 74, .09);
}

.btn:active {
  transform: translateY(0) scale(.98);
  box-shadow: none;
}

.btn.ghost {
  border-color: var(--line-strong);
  background: var(--panel);
}

.btn.ghost:hover {
  background: var(--panel-2);
  border-color: #c3c8c4;
}

.btn.primary {
  background: var(--court);
  color: #fff;
  box-shadow: 0 6px 16px rgba(223, 119, 56, .22);
}

.btn.primary:hover {
  background: #cc662b;
}

.btn.danger {
  border-color: #efc5c5;
  background: var(--loss-soft);
  color: var(--loss);
}

.btn.danger-ghost {
  color: var(--loss);
}

.btn.danger-ghost:hover {
  background: var(--loss-soft);
  border-color: #efc5c5;
}

.btn.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.icon-btn {
  width: 38px;
  padding: 0;
}

main {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 48px) 56px;
}

.login-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 56vh;
  padding: 40px 20px;
  text-align: center;
  animation: rise-in .35s ease both;
}

.gate-mark {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border-radius: 24px;
  background: #15181d;
  color: #fff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .22);
}

.gate-logo-text {
  font-family: var(--display);
  font-size: 50px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  color: #fff;
}

.login-gate h2 {
  margin: 0;
  color: var(--ink);
  font-size: 28px;
  font-weight: 900;
}

.login-gate p {
  margin: 0;
  color: var(--text-3);
  font-size: 14px;
}

.gate-docs {
  display: grid;
  gap: 8px;
  width: fit-content;
  max-width: min(560px, 100%);
  margin: 14px auto 0;
  text-align: left;
}

.gate-docs details {
  width: fit-content;
  min-width: 150px;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.gate-docs summary {
  cursor: pointer;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 800;
}

.gate-docs p {
  margin: 8px 0 0;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.6;
}

.app-main {
  position: relative;
}

.boot-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44vh;
  color: var(--text-3);
  font-size: 14px;
  background: var(--paper);
}

.boot-loading::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--court);
  border-radius: 50%;
  animation: boot-spin .7s linear infinite;
}

@keyframes boot-spin {
  to {
    transform: rotate(360deg);
  }
}

.schema-warning {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid #f0c36d;
  border-radius: var(--radius);
  background: #fff7e6;
  color: #8a5b12;
  font-size: 13px;
  font-weight: 700;
}

.schema-warning .icon {
  width: 17px;
  height: 17px;
  flex: none;
}

.schema-warning span {
  flex: 1 1 auto;
}

.summary {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.summary {
  animation: rise-in .4s ease both;
}

.toolbar,
.list-panel,
.insights {
  animation: rise-in .45s ease both;
}

.toolbar {
  animation-delay: .05s;
}

.list-panel {
  animation-delay: .1s;
}

.insights {
  animation-delay: .14s;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

.stat-card {
  position: relative;
  min-height: 126px;
  padding: 17px 18px 21px;
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line);
}

.stat-card:first-child {
  border-left: 0;
}

button.stat-card {
  display: block;
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: 0;
  left: 16px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
  opacity: 0;
  transform: scaleX(.55);
  transform-origin: left;
  transition: opacity .18s ease, transform .18s ease;
}

@media (hover: hover) {
  .stat-card:hover {
    background: var(--soft);
  }

  .stat-card:hover::after {
    opacity: 1;
    transform: scaleX(1);
  }
}

button.stat-card:active {
  background: var(--line);
}

.stat-hint {
  width: 13px;
  height: 13px;
  margin-left: auto;
  color: var(--text-3);
  transition: transform .18s ease;
}

button.stat-card:hover .stat-hint {
  transform: translateX(2px);
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
}

.stat-label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
  flex: none;
}

.accent-blue {
  --accent: var(--blue);
  --soft: var(--blue-soft);
}

.accent-green {
  --accent: var(--gain);
  --soft: var(--gain-soft);
}

.accent-orange {
  --accent: var(--court);
  --soft: var(--court-soft);
}

.accent-violet {
  --accent: var(--violet);
  --soft: var(--violet-soft);
}

.accent-rose {
  --accent: var(--rose);
  --soft: var(--rose-soft);
}

.stat-card strong {
  display: block;
  margin: 11px 0 9px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 27px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.stat-sub {
  display: inline-block;
  max-width: 100%;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar {
  display: grid;
  position: relative;
  z-index: 10;
  grid-template-columns: minmax(220px, 1fr) repeat(4, minmax(118px, auto)) 76px;
  gap: 8px;
  align-items: center;
  margin: 18px 0 14px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.reset-btn {
  color: var(--rose);
}

.reset-btn:hover {
  background: var(--rose-soft);
  color: var(--rose);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-3);
}

.search-box:focus-within {
  border-color: var(--court);
  background: var(--panel);
  box-shadow: 0 0 0 3px rgba(223, 119, 56, .12);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

#resetFilterBtn .icon {
  transition: transform .18s ease;
}

#resetFilterBtn:hover .icon {
  transform: rotate(90deg);
}

.select {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  outline: none;
  font-size: 13px;
  font-weight: 650;
}

.select:focus {
  border-color: var(--court);
  box-shadow: 0 0 0 3px rgba(223, 119, 56, .12);
}

.select-wrap {
  position: relative;
  min-width: 0;
}

.custom-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  transition: border-color .14s ease, background .14s ease, box-shadow .14s ease;
}

.custom-select:hover {
  border-color: #c3c8c4;
  background: var(--panel-2);
}

.custom-select[aria-expanded="true"] {
  border-color: var(--court);
  box-shadow: 0 0 0 3px rgba(223, 119, 56, .14);
}

.custom-select .icon {
  width: 16px;
  height: 16px;
  color: var(--text-3);
  transition: transform .16s ease;
}

.custom-select[aria-expanded="true"] .icon {
  transform: rotate(180deg);
}

.custom-select-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 40;
  min-width: 100%;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 16px 36px rgba(47, 63, 74, .18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(.98);
  transform-origin: top center;
  transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}

.select-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.select-option {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  transition: background .12s ease, color .12s ease;
}

.select-option:hover {
  background: var(--panel-2);
  color: var(--text);
}

.select-option.selected {
  background: var(--court-soft);
  color: var(--court);
}

.select-option:focus-visible {
  outline: 3px solid rgba(223, 119, 56, .28);
  outline-offset: -1px;
}

.form-panel {
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.form-panel[hidden] {
  display: none;
}

.form-panel:not([hidden]) {
  animation: panel-in .28s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(.99);
  }
}

.form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}

.form-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 19px;
  font-weight: 900;
}

.form-head p {
  margin: 4px 0 0;
  color: var(--text-3);
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 240px;
  gap: 18px;
  padding: 20px 22px;
}

.form-section {
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.form-section legend {
  padding: 0 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.form-row {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-row.split {
  grid-template-columns: 1fr 1fr;
}

label {
  display: block;
  min-width: 0;
}

label > span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  outline: none;
  font-size: 14px;
  transition: border-color .14s ease, box-shadow .14s ease;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--court);
  box-shadow: 0 0 0 3px rgba(223, 119, 56, .12);
}

input::placeholder,
textarea::placeholder {
  color: #a6b0bb;
}

.currency-rates-box {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.currency-rates-box > span {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
}

.currency-rates-grid {
  display: grid;
  gap: 6px;
}

.currency-rate-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.currency-rate-item span {
  min-width: 0;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
}

.currency-rate-item input {
  width: 92px;
  padding: 5px 7px;
}

.inline-currency-amount {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inline-currency-amount select {
  width: 120px;
  flex: none;
}

.inline-currency-amount input {
  flex: 1 1 auto;
  min-width: 0;
}

.wide {
  margin-top: 12px;
}

.image-section {
  display: flex;
  flex-direction: column;
}

.image-drop {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  overflow: hidden;
  border: 1.5px dashed #bcc4c1;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(223, 119, 56, .05) 25%, transparent 25%, transparent 50%, rgba(33, 141, 136, .05) 50%, rgba(33, 141, 136, .05) 75%, transparent 75%),
    var(--panel);
  background-size: 18px 18px;
  cursor: pointer;
  transition: border-color .14s ease, background-color .14s ease, transform .14s ease, box-shadow .14s ease;
}

.image-drop:hover {
  border-color: var(--court);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(47, 63, 74, .08);
}

.image-drop input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.image-drop img {
  width: 100%;
  height: 100%;
  max-height: 320px;
  object-fit: contain;
}

.image-drop span {
  position: absolute;
  inset: auto 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
}

.image-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.image-preview-item {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  color: #000;
  border: 1px solid rgba(47, 63, 74, .25);
  box-shadow: 0 2px 6px rgba(47, 63, 74, .18);
}

.image-preview-remove .icon {
  width: 18px;
  height: 18px;
  stroke-width: 3;
  color: #000;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
}

.list-panel {
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
}

.list-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 19px;
  font-weight: 900;
}

.list-head p {
  margin: 4px 0 0;
  color: var(--text-3);
  font-size: 12px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--rose);
  border-radius: 999px;
  background: var(--rose-soft);
  color: var(--rose);
  font-size: 12px;
  font-weight: 700;
}

.filter-chip .icon {
  width: 14px;
  height: 14px;
}

.filter-chip:hover {
  background: #fde3ec;
}

.ledger-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 14px;
}

.ledger-stat {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.ledger-stat b {
  color: var(--ink);
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

.ledger {
  display: grid;
  grid-template-columns: minmax(250px, 1.5fr) minmax(140px, .9fr) minmax(160px, 1fr) minmax(120px, .8fr) minmax(90px, .6fr) 92px 284px;
  min-width: 1280px;
}

.ledger .th {
  padding: 11px 14px;
  background: var(--panel-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.ledger .th:not(:first-child):not(:last-child) {
  text-align: center;
}

.ledger .th:first-child,
.ledger .cell:first-child {
  padding-left: 20px;
}

.ledger .th:last-child,
.ledger .cell:last-child {
  padding-right: 20px;
}

.ledger .th:last-child,
.ledger .cell:last-child {
  justify-content: center;
  text-align: center;
}

.ledger .cell {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  animation: cell-in .22s ease both;
}

.ledger .cell.money-cell {
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ledger .cell.centered-cell {
  justify-content: center;
  text-align: center;
}

@keyframes cell-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.ledger-row {
  display: contents;
}

.ledger-row:hover .cell {
  background: #fdf9f4;
}

.card-cell {
  gap: 12px;
  min-height: 84px;
}

.card-quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  margin-left: auto;
}

.card-thumb .trade-filter-btn {
  position: absolute;
  top: 3px;
  left: 3px;
  z-index: 3;
  height: 18px;
  min-height: 18px;
  padding: 0 6px;
  border: 0;
  border-radius: 999px;
  background: rgba(20, 30, 36, .72);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.card-thumb .trade-filter-btn:hover {
  background: var(--foil);
}

.card-cell .btn.sell-btn {
  flex: none;
  color: var(--gain);
}

.card-cell .btn.sell-btn:hover {
  background: var(--gain-soft);
  border-color: #b9e4d3;
}

.card-cell .btn.trade-btn {
  flex: none;
  color: var(--violet);
}

.card-cell .btn.trade-btn:hover {
  background: var(--violet-soft);
  border-color: #e4d6f8;
}

.card-thumb {
  position: relative;
  width: 52px;
  height: 70px;
  flex: none;
  border-radius: 5px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .24), transparent),
    linear-gradient(150deg, #1b6f73 0%, #218d88 45%, #df7738 100%);
  border: 1px solid rgba(255, 255, 255, .65);
  box-shadow: 0 3px 0 rgba(47, 63, 74, .12), 0 10px 18px rgba(47, 63, 74, .14);
  overflow: hidden;
}

.card-thumb-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: none;
}

.thumb-grading {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--court-soft);
  color: var(--court);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.thumb-grading.done {
  background: var(--blue-soft);
  color: var(--blue);
}

.card-thumb::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 2px;
  pointer-events: none;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-thumb .thumb-count {
  position: absolute;
  right: 3px;
  bottom: 3px;
  z-index: 1;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(20, 30, 36, .78);
  color: #fff;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
}

.card-thumb.clickable {
  cursor: zoom-in;
  transition: transform .14s ease, box-shadow .14s ease;
}

.card-thumb.clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 0 rgba(47, 63, 74, .12), 0 16px 24px rgba(47, 63, 74, .18);
}

.card-thumb .thumb-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .9);
  font-family: var(--display);
  font-size: 26px;
  line-height: 1;
}

.card-main {
  min-width: 0;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.card-title {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

.card-title:hover {
  color: var(--court);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.card-sub {
  margin: 5px 0 0;
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.money-line {
  display: block;
  font-family: var(--mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.muted-line {
  display: block;
  margin-top: 4px;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 12.5px;
  white-space: nowrap;
}

.graded-price {
  display: block;
  margin-top: 4px;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.profit {
  color: var(--gain);
}

.loss {
  color: var(--loss);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(47, 63, 74, .05);
}

.status-owned {
  border-color: #c7d8f6;
  background: var(--blue-soft);
  color: var(--blue);
}

.status-listed {
  border-color: #f0d2b9;
  background: var(--court-soft);
  color: #c45d27;
}

.status-sold {
  border-color: #b9e4d3;
  background: var(--gain-soft);
  color: var(--gain);
}

.status-traded {
  border-color: #e4d6f8;
  background: var(--violet-soft);
  color: var(--violet);
}

.row-actions {
  display: flex;
  gap: 6px;
}

.row-actions .btn {
  min-height: 30px;
  gap: 4px;
  padding: 0 7px;
  font-size: 12px;
}

.row-actions .btn.danger-ghost {
  color: var(--loss);
}

.row-actions .btn.danger-ghost:hover {
  background: var(--loss-soft);
  border-color: #efc5c5;
}

.row-actions .btn.sell-btn {
  color: var(--gain);
}

.row-actions .btn.sell-btn:hover {
  background: var(--gain-soft);
  border-color: #b9e4d3;
}

.row-actions .btn.complete-btn {
  color: var(--gain);
  border-color: #b9e4d3;
  background: var(--gain-soft);
}

.row-actions .btn.complete-btn:hover {
  background: #e3f6ee;
  border-color: #9fd9c0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 320px;
  padding: 40px 20px;
  color: var(--text-3);
  text-align: center;
  animation: rise-in .3s ease both;
}

.empty-state svg.icon {
  width: 46px;
  height: 46px;
  color: var(--court);
  stroke-width: 1.6;
}

.empty-state h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 19px;
  font-weight: 900;
}

.empty-state p {
  margin: 0 0 8px;
  font-size: 14px;
}

.insights {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.insight-card {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.insight-card h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 900;
}

.bar-row {
  display: grid;
  grid-template-columns: 52px 1fr 38px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  color: var(--text-2);
  font-size: 12px;
}

.bar-row .bar {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.bar-row .bar i {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--court), var(--foil));
}

.bar-row b {
  text-align: right;
  color: var(--text);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.leader {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  min-height: 84px;
}

.leader .name {
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader .detail {
  color: var(--text-3);
  font-size: 12px;
}

.leader .amount {
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.leader.empty {
  color: var(--text-3);
  font-size: 13px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  max-width: 1480px;
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 48px);
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 11px;
}

dialog {
  width: min(560px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(47, 63, 74, .24);
}

dialog[open] {
  animation: dialog-in .22s cubic-bezier(.22, 1, .36, 1) both;
}

dialog::backdrop {
  background: rgba(47, 63, 74, .42);
  backdrop-filter: blur(3px);
  animation: backdrop-in .2s ease both;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(.98);
  }
}

@keyframes backdrop-in {
  from {
    opacity: 0;
  }
}

dialog.wide-dialog {
  width: min(980px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
}

.dialog-shell {
  padding: 20px;
}

#settingsDialog .dialog-shell {
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.changelog-dialog {
  width: min(480px, calc(100% - 24px));
}

.changelog-shell {
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.changelog-dialog .dialog-head p {
  margin: 4px 0 0;
  color: var(--text-3);
  font-size: 12px;
}

.changelog-list {
  display: grid;
}

.changelog-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.changelog-item p {
  margin: 1px 0 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
}

.changelog-tag {
  flex: none;
  min-width: 40px;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  line-height: 1.2;
}

.changelog-tag.add {
  background: var(--gain-soft);
  color: var(--gain);
}

.changelog-tag.fix {
  background: var(--court-soft);
  color: var(--court);
}

.changelog-tag.change {
  background: var(--blue-soft);
  color: var(--blue);
}

.changelog-tag.keep {
  background: var(--foil-soft);
  color: var(--foil);
}

.trade-dialog {
  width: min(920px, calc(100% - 24px));
}

.trade-shell {
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.trade-chain-dialog {
  width: min(1100px, calc(100% - 24px));
}

.trade-chain-shell {
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.trade-chain-scroll {
  overflow-x: auto;
  padding: 2px 2px 10px;
}

.trade-chain {
  display: flex;
  align-items: center;
  min-width: max-content;
}

.chain-multi {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chain-role {
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
}

.trade-history {
  display: grid;
  gap: 10px;
}

.history-row {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.history-tag {
  justify-self: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.history-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.history-media {
  position: relative;
  width: 46px;
  height: 62px;
  flex: none;
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .24), transparent),
    linear-gradient(150deg, #1b6f73 0%, #218d88 45%, #df7738 100%);
  overflow: hidden;
}

.history-media img,
.history-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-placeholder {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .92);
  font-family: var(--display);
  font-size: 24px;
}

.history-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.history-body b {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-body span {
  color: var(--text-3);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-cash {
  color: var(--violet);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.chain-node {
  width: 172px;
  flex: none;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.chain-media {
  position: relative;
  height: 118px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .24), transparent),
    linear-gradient(150deg, #1b6f73 0%, #218d88 45%, #df7738 100%);
  overflow: hidden;
}

.chain-media img,
.chain-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chain-placeholder {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .92);
  font-family: var(--display);
  font-size: 34px;
}

.chain-status,
.chain-count {
  position: absolute;
  z-index: 2;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(20, 30, 36, .76);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.chain-status {
  top: 6px;
  right: 6px;
}

.chain-count {
  right: 6px;
  bottom: 6px;
}

.chain-body {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
}

.chain-title {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chain-sub,
.chain-source {
  color: var(--text-3);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chain-arrow {
  display: grid;
  place-items: center;
  flex: none;
  color: var(--text-3);
}

.chain-arrow .icon {
  width: 20px;
  height: 20px;
  transform: rotate(-90deg);
}

.chain-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 86px;
  flex: none;
}

.chain-cash {
  color: var(--violet);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.trade-source {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.trade-source b {
  display: block;
  font-size: 14px;
}

.trade-source span {
  display: block;
  margin-top: 3px;
  color: var(--text-3);
  font-size: 12px;
}

.trade-outgoing-pick {
  margin-bottom: 14px;
}

.trade-outgoing-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.trade-outgoing-head h3 {
  margin: 0;
  font-size: 15px;
}

.trade-outgoing-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.trade-outgoing-tools select {
  width: auto;
  min-width: 180px;
}

.trade-outgoing-list {
  display: grid;
  gap: 8px;
}

.trade-outgoing-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 10px 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.trade-outgoing-media {
  position: relative;
  width: 40px;
  height: 54px;
  flex: none;
  border-radius: 5px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .24), transparent),
    linear-gradient(150deg, #1b6f73 0%, #218d88 45%, #df7738 100%);
  overflow: hidden;
}

.trade-outgoing-media img,
.trade-outgoing-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trade-outgoing-placeholder {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .92);
  font-family: var(--display);
  font-size: 20px;
}

.trade-outgoing-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.trade-outgoing-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-outgoing-price {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 12px;
}

.trade-outgoing-row .trade-outgoing-remove {
  margin-left: auto;
}

.trade-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.trade-cash-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.trade-cash-inputs select {
  width: 96px;
  flex: none;
}

.trade-cash-inputs input {
  flex: 1 1 auto;
  min-width: 0;
}

.trade-divider {
  height: 1px;
  margin-bottom: 16px;
  background: var(--line);
}

.trade-incoming-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.trade-incoming-head h3 {
  margin: 0;
  font-size: 15px;
}

.trade-incoming-list {
  display: grid;
  gap: 10px;
}

.trade-incoming-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.trade-incoming-main {
  min-width: 0;
}

.trade-incoming-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.trade-row-media {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
}

.trade-image-pick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: none;
  min-height: 34px;
  padding: 0 10px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.trade-image-pick:hover {
  border-color: var(--court);
  color: var(--court);
}

.trade-image-pick input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.trade-image-pick .icon {
  width: 15px;
  height: 15px;
}

.trade-image-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.trade-image-preview {
  position: relative;
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 6px;
  overflow: hidden;
}

.trade-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trade-image-preview button {
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 30, 36, .76);
  color: #fff;
  cursor: pointer;
}

.trade-image-preview button .icon {
  width: 11px;
  height: 11px;
}

.trade-row-remove {
  align-self: center;
}

.card-dialog {
  width: min(980px, calc(100% - 32px));
}

.card-dialog .dialog-shell {
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.card-dialog .form-head {
  padding: 0 0 16px;
  background: transparent;
  border-bottom: 1px solid var(--line);
}

.card-dialog .form-grid {
  padding: 0;
}

.card-dialog .form-actions {
  padding: 16px 0 0;
  border-top: 0;
  background: transparent;
}

.tool-dialog {
  width: min(1180px, calc(100% - 24px));
  height: min(92vh, 920px);
  padding: 0;
}

.tool-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.tool-shell .dialog-head {
  flex: none;
  margin-bottom: 0;
  padding: 14px 16px;
}

.tool-frame {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 0;
  background: var(--paper);
}

.image-view-dialog {
  width: min(900px, calc(100% - 24px));
  padding: 0;
}

.image-view-shell {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
  padding: 20px;
  overflow: auto;
}

.image-view-body {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.image-view-body img {
  display: block;
  max-width: 100%;
  max-height: 68vh;
  border-radius: 6px;
  object-fit: contain;
}

.image-nav .icon {
  width: 18px;
  height: 18px;
}

.image-nav-prev .icon {
  transform: rotate(90deg);
}

.image-nav-next .icon {
  transform: rotate(-90deg);
}

.image-view-counter {
  margin: 10px 0 0;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
}

.profit-shell {
  max-height: calc(100vh - 32px);
  padding: 20px;
  overflow-y: auto;
}

.segmented {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.auth-shell .segmented {
  display: flex;
  width: 100%;
}

.auth-shell .segment {
  flex: 1 1 0;
}

.segment {
  min-height: 32px;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-weight: 700;
  transition: background .14s ease, color .14s ease, box-shadow .14s ease, transform .12s ease;
}

.segment:hover {
  background: var(--panel);
  color: var(--text);
}

.segment:active {
  transform: scale(.97);
}

.segment.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(47, 63, 74, .12);
}

.period-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.period-filters label {
  display: block;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
}

.period-filters label span {
  display: block;
  margin-bottom: 6px;
}

.period-filters select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  outline: none;
}

.period-filters select:focus {
  border-color: var(--court);
  box-shadow: 0 0 0 3px rgba(223, 119, 56, .12);
}

.grading-shell {
  max-height: calc(100vh - 32px);
  padding: 20px;
  overflow-y: auto;
}

.grading-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.grading-home-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.grading-count {
  margin: 0;
  color: var(--text-3);
  font-size: 13px;
}

.grading-form-view {
  animation: rise-in .22s ease both;
}

.grading-form-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.grading-form-head .icon {
  transform: rotate(90deg);
}

.grading-form-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.grading-toolbar select {
  flex: 1 1 260px;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
}

.grading-form {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.grading-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.grading-form label {
  display: block;
  min-width: 0;
}

.grading-form label span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
}

.grading-form input,
.grading-form select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.grading-form input:focus,
.grading-form select:focus {
  border-color: var(--court);
  box-shadow: 0 0 0 3px rgba(223, 119, 56, .12);
}

.grading-note-field {
  margin-top: 12px;
}

.grading-image-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.grading-image-pick {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
  min-height: 44px;
  padding: 0 14px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.grading-image-pick input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.grading-image-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.grading-image-preview img {
  width: 54px;
  height: 72px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.grading-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.grading-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  animation: cell-in .24s ease both;
}

.grading-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.grading-main-text {
  min-width: 0;
}

.grading-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.grading-main-text b {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grading-main-text span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-3);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grading-done-badge {
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.grading-thumb {
  width: 40px;
  height: 54px;
  flex: none;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.grading-meta {
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}

.grading-countdown {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--court);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.grading-countdown.overdue {
  color: var(--loss);
}

.grading-hourglass {
  width: 14px;
  height: 14px;
  animation: grading-sand 1.2s ease-in-out infinite;
}

@keyframes grading-sand {
  0%,
  100% {
    transform: translateY(0) scale(1);
    opacity: .75;
  }
  50% {
    transform: translateY(1px) scale(1.1);
    opacity: 1;
  }
}

.grading-status {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.grading-status.is-pending {
  background: var(--court-soft);
  color: var(--court);
}

.grading-status.is-shipped {
  background: var(--blue-soft);
  color: var(--blue);
}

.grading-status.is-graded {
  background: var(--gain-soft);
  color: var(--gain);
}

.grading-status.is-returned {
  background: var(--rose-soft);
  color: var(--rose);
}

.grading-empty {
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}

.profit-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 12px;
}

.profit-kpi {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  animation: kpi-in .3s ease both;
  animation-delay: calc(var(--i, 0) * 40ms);
}

@keyframes kpi-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.profit-kpi span {
  display: block;
  margin-bottom: 5px;
  color: var(--text-3);
  font-size: 12px;
}

.profit-kpi strong {
  display: block;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.chart-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
}

.chart {
  position: relative;
  display: inline-block;
  min-width: 100%;
  height: 380px;
  vertical-align: top;
}

.chart-inner {
  display: flex;
  align-items: stretch;
  gap: 6px;
  width: max-content;
  min-width: 100%;
  height: 100%;
  padding: 10px 14px 0;
}

.chart-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.chart-grid i {
  position: absolute;
  right: 0;
  left: 0;
  height: 1px;
  background: rgba(47, 63, 74, .07);
}

.chart-col {
  position: relative;
  width: 64px;
  min-width: 64px;
  cursor: pointer;
}

.chart-col:hover .chart-bar {
  filter: brightness(.92);
}

.chart-bar {
  position: absolute;
  left: 24%;
  right: 24%;
  animation: bar-rise .5s cubic-bezier(.22, 1, .36, 1) both;
  animation-delay: calc(var(--i, 0) * 24ms);
  transform-origin: 50% 50%;
  transition: filter .14s ease;
}

.chart-bar.positive {
  bottom: 50%;
  border-radius: 4px 4px 0 0;
  background: var(--gain);
  transform-origin: 50% 100%;
}

.chart-bar.negative {
  top: 50%;
  border-radius: 0 0 4px 4px;
  background: var(--loss);
  transform-origin: 50% 0;
}

.chart-bar.zero {
  top: calc(50% - 1px);
  height: 2px;
  background: var(--text-3);
}

@keyframes bar-rise {
  from {
    transform: scaleY(0);
  }
}

.chart-label {
  position: absolute;
  right: 0;
  bottom: 6px;
  left: 0;
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.chart-value {
  position: absolute;
  right: 0;
  left: 0;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.chart-value.positive {
  bottom: calc(50% + var(--barH) + 4px);
  color: var(--gain);
}

.chart-value.negative {
  top: calc(50% + var(--barH) + 4px);
  color: var(--loss);
}

.chart-col.current .chart-bar {
  box-shadow: 0 0 0 2px var(--court);
}

.chart-col.current .chart-label {
  color: var(--ink);
  font-weight: 800;
}

.chart-zero {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 1px;
  background: var(--line-strong);
}

.expense-chart .chart-zero {
  display: none;
}

.expense-chart {
  height: 280px;
}

.expense-chart .chart-inner {
  display: block;
  width: max-content;
  min-width: 100%;
  height: 100%;
  padding: 0 12px;
}

.expense-area {
  display: block;
  max-width: 100%;
}

.expense-grid-line {
  stroke: rgba(47, 63, 74, .07);
  stroke-width: 1;
}

.expense-area-fill {
  fill: rgba(223, 119, 56, .16);
}

.expense-area-line {
  fill: none;
  stroke: var(--court);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.expense-area-dot {
  fill: var(--court);
  stroke: var(--panel);
  stroke-width: 2;
  pointer-events: none;
}

.expense-area-value {
  fill: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
}

.expense-area-label {
  fill: var(--text-3);
  font-size: 11px;
}

.expense-hit {
  fill: transparent;
  cursor: pointer;
  outline: none;
}

.expense-hit:focus-visible {
  stroke: var(--court);
  stroke-width: 1;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 170px;
  max-width: 230px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 16px 36px rgba(47, 63, 74, .2);
  color: var(--text);
  font-size: 12px;
  pointer-events: none;
  transform: translate(-50%, 0);
}

.tooltip-title {
  margin-bottom: 5px;
  font-weight: 900;
}

.tooltip-line {
  color: var(--text-2);
  white-space: nowrap;
}

.tooltip-amount {
  display: block;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
}

.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 100%;
  color: var(--text-3);
  font-size: 14px;
}

.profit-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  margin-top: 14px;
  overflow-y: auto;
  padding-right: 2px;
}

.profit-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 92px 92px 78px auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  text-align: left;
  font: inherit;
  animation: row-in .28s ease both;
  animation-delay: calc(var(--i, 0) * 30ms);
  transition: border-color .14s ease, background .14s ease, transform .14s ease, box-shadow .14s ease;
}

.profit-row:hover {
  border-color: var(--court);
  background: var(--court-soft);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(47, 63, 74, .08);
}

.expense-row {
  grid-template-columns: minmax(140px, 1fr) 70px 120px 120px;
  cursor: pointer;
}

@keyframes row-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.profit-period {
  min-width: 0;
}

.profit-period b {
  display: block;
  font-size: 14px;
}

.profit-period span {
  display: block;
  margin-top: 2px;
  color: var(--text-3);
  font-size: 12px;
}

.profit-roi {
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}

.profit-stat {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}

.profit-amount {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.gallery-shell {
  max-height: calc(100vh - 32px);
  padding: 20px;
  overflow-y: auto;
}

.data-shell {
  max-height: calc(100vh - 32px);
  padding: 20px;
  overflow-y: auto;
}

.psa-shell {
  max-height: calc(100vh - 32px);
  padding: 20px;
  overflow-y: auto;
}

.psa-query-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.psa-query-row input {
  flex: 1 1 260px;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
}

.psa-query-row input:focus {
  border-color: var(--court);
  background: var(--panel);
  box-shadow: 0 0 0 3px rgba(223, 119, 56, .12);
  outline: 0;
}

.psa-ocr-status {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 13px;
}

.psa-note {
  margin: -6px 0 14px;
  color: var(--text-3);
  font-size: 12px;
}

.psa-existing-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: -4px 0 14px;
}

.psa-existing-row select {
  flex: 1 1 280px;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
}

.psa-result {
  min-height: 80px;
}

.psa-empty {
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}

.psa-result-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.psa-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
}

.psa-field-key {
  overflow-wrap: anywhere;
  color: var(--text-3);
  font-size: 12px;
}

.psa-field-value {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  text-align: right;
}

.data-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 14px;
}

.data-list {
  display: grid;
  gap: 8px;
}

.data-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.data-index {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.data-main {
  min-width: 0;
}

.data-main b {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-main span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-3);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-amount {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.data-track {
  display: block;
  height: 4px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel);
}

.data-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  animation: bar-rise .5s cubic-bezier(.22, 1, .36, 1) both;
}

.data-empty {
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}

.dist-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.dist-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.dist-panel h3 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.dist-bars {
  display: grid;
  gap: 9px;
}

.dist-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 10px;
}

.dist-row.clickable {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dist-row.clickable:hover .dist-name {
  color: var(--court);
}

.dist-name {
  overflow: hidden;
  color: var(--text-2);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dist-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel);
}

.dist-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  animation: bar-rise .5s cubic-bezier(.22, 1, .36, 1) both;
}

.dist-count {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 12px;
  text-align: right;
}

.gallery-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.gallery-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 220px;
  min-width: 180px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text-3);
  transition: border-color .14s ease, background .14s ease, box-shadow .14s ease;
}

.gallery-search:focus-within {
  border-color: var(--court);
  background: var(--panel);
  box-shadow: 0 0 0 3px rgba(223, 119, 56, .12);
}

.gallery-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.gallery-count {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}

.gallery-chart-title {
  margin: 4px 0 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.holding-chart {
  position: relative;
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  align-items: center;
  gap: 24px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.donut-tooltip {
  position: absolute;
  z-index: 6;
  min-width: 120px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 12px 28px rgba(47, 63, 74, .18);
  font-size: 12px;
  pointer-events: none;
  transform: translate(-50%, -110%);
}

.donut-tooltip b {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
}

.donut-tooltip span {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

.donut {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(47, 63, 74, .06);
}

.donut::after {
  content: "";
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  background: var(--panel-2);
  box-shadow: 0 0 0 1px rgba(47, 63, 74, .04);
}

.donut-center {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.donut-center span {
  color: var(--text-3);
  font-size: 12px;
}

.donut-center strong {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.holding-legend {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.holding-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  transition: background .14s ease, transform .14s ease;
}

.holding-row:hover {
  background: var(--panel);
  transform: translateX(2px);
}

.holding-row.clickable {
  cursor: pointer;
}

.holding-row i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex: none;
}

.holding-player {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.holding-count,
.holding-percent {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

.holding-amount {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.holding-empty {
  padding: 16px 0;
  color: var(--text-3);
  font-size: 13px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  padding: 2px;
}

.gallery-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  box-shadow: 0 6px 16px rgba(47, 63, 74, .06);
  animation: cell-in .24s ease both;
  animation-delay: calc(var(--i, 0) * 18ms);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.gallery-card:hover {
  transform: translateY(-3px);
  border-color: var(--court);
  box-shadow: 0 14px 30px rgba(47, 63, 74, .14);
}

.gallery-media {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, #1b6f73 0%, #218d88 45%, #df7738 100%);
}

.gallery-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--panel);
}

.gallery-placeholder {
  font-family: var(--display);
  font-size: 64px;
  color: #fff;
  text-shadow: 0 4px 16px rgba(20, 30, 36, .28);
}

.gallery-label {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, .92);
  border-top: 1px solid rgba(255, 255, 255, .5);
  backdrop-filter: blur(8px);
}

.gallery-label b {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-label .status-pill {
  min-height: 20px;
  padding: 0 7px;
  font-size: 10px;
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(20, 30, 36, 0) 30%, rgba(20, 30, 36, .88) 88%);
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}

.gallery-card:hover .gallery-overlay,
.gallery-card:focus-visible .gallery-overlay,
.gallery-card.reveal .gallery-overlay {
  opacity: 1;
  transform: translateY(0);
}

.gallery-name {
  font-size: 15px;
  font-weight: 900;
}

.gallery-sub {
  font-size: 12px;
  opacity: .82;
}

.gallery-line {
  font-family: var(--mono);
  font-size: 11px;
  opacity: .92;
}

.gallery-empty {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text-3);
  font-size: 14px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.dialog-note {
  margin: 14px 0 0;
  color: var(--text-3);
  font-size: 12px;
}

.backup-block {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.footer-version {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 11px;
}

.backup-block .btn {
  min-height: 38px;
}

.data-tools-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.market-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.market-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.market-links a:hover {
  border-color: var(--court);
  background: var(--court-soft);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 50;
  max-width: min(420px, calc(100% - 32px));
  padding: 11px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 12px 30px rgba(47, 63, 74, .24);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity .18s ease, transform .18s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1180px) {
  .summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stat-card:nth-child(4) {
    border-left: 0;
  }

  .stat-card:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }

  .toolbar {
    grid-template-columns: minmax(220px, 1fr) repeat(4, minmax(112px, 1fr)) 76px;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .image-section {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 12px;
    align-items: center;
  }

  .image-section .image-drop {
    min-height: 140px;
    grid-row: span 2;
  }

  .insights {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profit-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 16px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .top-tools {
    flex: 1 1 100%;
  }

  .top-tools .btn.ghost {
    flex: 1 1 auto;
  }

  .top-tools .btn.primary {
    flex: 1 1 100%;
  }

  .tools-menu {
    min-width: 100%;
  }

  .ledger-stats {
    padding: 0 14px 12px;
  }

  .data-tools-row {
    align-items: stretch;
    flex-direction: column;
  }

  .image-view-shell {
    padding: 16px;
  }

  .grading-shell {
    padding: 16px;
  }

  .grading-grid {
    grid-template-columns: 1fr;
  }

  .grading-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .grading-meta {
    grid-column: 1 / -1;
  }

  .grading-countdown {
    grid-column: 1 / -1;
  }

  main {
    padding: 14px 12px 40px;
  }

  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card:nth-child(2n) {
    border-left: 0;
  }

  .stat-card:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .stat-card {
    min-height: 112px;
    padding: 15px 16px 18px;
  }

  .stat-card strong {
    font-size: 22px;
  }

  .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-box {
    grid-column: 1 / -1;
  }

  .reset-btn {
    grid-column: 1 / -1;
    justify-self: end;
    width: 76px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .form-section {
    padding: 14px;
  }

  .form-row.split {
    grid-template-columns: 1fr;
  }

  .trade-grid,
  .trade-incoming-fields {
    grid-template-columns: 1fr 1fr;
  }

  .trade-shell {
    padding: 16px;
  }

  .image-section {
    display: block;
  }

  .image-section .image-drop {
    min-height: 220px;
  }

  .list-head {
    padding: 14px;
  }

  .insights {
    grid-template-columns: 1fr;
  }

  .market-links {
    grid-template-columns: 1fr;
  }

  .backup-block {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .segmented {
    display: flex;
    width: 100%;
  }

  .auth-legal {
    grid-template-columns: 1fr;
  }

  .segment {
    flex: 1 1 0;
  }

  .profit-shell {
    padding: 16px;
  }

  .tool-dialog {
    width: calc(100% - 12px);
    height: calc(100dvh - 12px);
  }

  .profit-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profit-row {
    grid-template-columns: 1fr auto;
  }

  .profit-roi {
    display: none;
  }

  .profit-stat {
    display: none;
  }

  .gallery-shell {
    padding: 16px;
  }

  .data-shell {
    padding: 16px;
  }

  .psa-shell {
    padding: 16px;
  }

  .psa-query-row input {
    flex-basis: 100%;
  }

  .data-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .data-row {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    gap: 10px;
  }

  .dist-grid {
    grid-template-columns: 1fr;
  }

  .gallery-search {
    flex-basis: 100%;
  }

  .holding-chart {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .donut {
    width: 180px;
    height: 180px;
  }

  .holding-row {
    grid-template-columns: 12px minmax(0, 1fr) auto auto;
  }

  .holding-count {
    display: none;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
  }

  footer {
    flex-direction: column;
    padding: 18px 16px;
  }
}

@media (max-width: 420px) {
  .summary {
    grid-template-columns: 1fr 1fr;
    gap: 0;
  }

  .stat-card {
    min-height: 106px;
    padding: 13px;
  }

  .stat-card strong {
    font-size: 19px;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 8px;
  }

  .donut {
    width: 160px;
    height: 160px;
  }

  .toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar .icon-btn {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
