body.panel {
  --pa: #FF8A1F;
  --pa-ink: #1C0E02;
  --warn: #FACC15;
  --bg: #090B10;
  --surface: #10131A;
  --surface-2: #161A23;
  --surface-3: #1C212C;
  --line: rgba(255, 255, 255, 0.065);
  --line-2: rgba(255, 255, 255, 0.12);
  --accent: var(--pa);
  --glow: var(--muted);
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  --side: 252px;
  --radius: 16px;
  color-scheme: dark;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
}

body.panel ::selection {
  background: color-mix(in srgb, var(--pa) 35%, transparent);
}

body.panel * {
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

.ic {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid var(--line-2);
  border-top-color: var(--pa);
  animation: spin 0.8s linear infinite;
}

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

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.shell {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 14px 14px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto;
}

.side-brand {
  padding: 4px 8px 6px;
  font-size: 17px;
}

.side-brand img {
  width: 30px;
  height: 30px;
}

.side-nav {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 18px;
}

.nav-group {
  display: grid;
  gap: 2px;
}

.nav-title {
  padding: 0 10px 6px;
  color: var(--dim);
  font: 600 11px/1 var(--body);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 38px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.nav-item.on {
  background: color-mix(in srgb, var(--pa) 11%, transparent);
  color: var(--text);
}

.nav-item.on::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--pa);
}

.nav-item.on .ic {
  color: var(--pa);
}

.side-foot {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.store-link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.store-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.store-link .ic {
  width: 16px;
  height: 16px;
}

.me-card {
  display: flex;
  align-items: center;
  gap: 4px;
}

.me {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 12px;
  transition: background 0.15s;
}

.me:hover {
  background: rgba(255, 255, 255, 0.04);
}

.me-text {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}

.me-text b,
.me-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.me-text b {
  font-weight: 600;
}

.me-text small {
  color: var(--dim);
  font-size: 12px;
}

.side-veil {
  display: none;
}

.stage {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px max(32px, calc(100% - 1408px)) 18px 32px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.menu-btn {
  display: none;
}

.top-text {
  flex: 1;
  min-width: 0;
}

.top-text h1 {
  font-size: 22px;
}

.top-text p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13.5px;
}

.top-text p:empty {
  display: none;
}

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

.view {
  width: 100%;
  max-width: 1440px;
  display: grid;
  align-content: start;
  gap: 20px;
  padding: 24px 32px 56px;
  animation: fade 0.25s var(--ease);
}

@media (max-width: 960px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(280px, 86vw);
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
    box-shadow: 30px 0 60px -30px rgba(0, 0, 0, 0.8);
  }

  body.nav-open .side {
    transform: none;
  }

  .side-veil {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(3, 5, 10, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }

  body.nav-open .side-veil {
    opacity: 1;
    pointer-events: auto;
  }

  body.nav-open {
    overflow: hidden;
  }

  .menu-btn {
    display: grid;
  }

  .top {
    flex-wrap: wrap;
    gap: 10px 12px;
    padding: 14px 16px;
  }

  .top-text h1 {
    font-size: 19px;
  }

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

  .top-actions:empty {
    display: none;
  }

  .view {
    padding: 16px 16px 48px;
    gap: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.panel *,
  body.panel *::before,
  body.panel *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  padding: 32px 20px;
  background:
    radial-gradient(60% 50% at 50% 0%, color-mix(in srgb, var(--pa) 13%, transparent), transparent 70%),
    var(--bg);
}

.gate-card {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 32px 30px 30px;
  border-radius: 22px;
  border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.85);
  animation: rise 0.4s var(--ease);
}

.gate-logo,
.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 600 18px/1 var(--display);
  letter-spacing: -0.01em;
}

.gate-logo {
  margin-bottom: 6px;
}

.gate-logo i,
.side-brand i {
  font-style: normal;
  color: var(--pa);
}

.gate-logo em,
.side-brand em {
  margin-left: auto;
  padding: 4px 9px;
  border-radius: 99px;
  border: 1px solid var(--line-2);
  color: var(--muted);
  font: 500 11px/1 var(--body);
  font-style: normal;
  letter-spacing: 0.04em;
}

.gate h1 {
  font-size: 25px;
}

.gate-sub {
  margin-top: -10px;
  color: var(--muted);
}

.gate-foot {
  color: var(--dim);
  font-size: 12.5px;
  text-align: center;
}

.invite-info {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px dashed color-mix(in srgb, var(--pa) 45%, transparent);
  background: color-mix(in srgb, var(--pa) 6%, transparent);
  color: var(--muted);
}

.invite-role {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 11px;
  margin-bottom: 4px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--pa) 16%, transparent);
  color: var(--pa);
  font-weight: 600;
  font-size: 12.5px;
}

.gate-oauth {
  display: grid;
  gap: 10px;
}

.gate-or {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--dim);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.gate-or::before,
.gate-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-2);
}

.obtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 46px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  transition: filter 0.2s, transform 0.15s var(--ease), box-shadow 0.25s;
}

.obtn:hover {
  filter: brightness(1.1);
}

.obtn:active {
  transform: scale(0.98);
}

.obtn.sm {
  height: 34px;
  padding: 0 12px;
  gap: 8px;
  border-radius: 10px;
  font-size: 13px;
}

.obtn.discord {
  background: #5865F2;
  color: #FFFFFF;
}

.obtn.discord:hover {
  box-shadow: 0 12px 30px -14px #5865F2;
}

.obtn.google {
  background: #131314;
  border-color: #8E918F;
  color: #E3E3E3;
}

body.panel img.brand {
  display: block;
  width: 20px;
  height: 20px;
  flex: none;
}

.obtn.sm img.brand {
  width: 16px;
  height: 16px;
}

.panel .btn {
  gap: 8px;
}

.panel .btn .ic {
  width: 17px;
  height: 17px;
}

.panel .btn.sm {
  height: 36px;
  padding: 0 13px;
  border-radius: 10px;
  font-size: 13.5px;
}

.panel .btn.primary {
  background: var(--pa);
  color: var(--pa-ink);
}

.panel .btn.primary:hover {
  background: color-mix(in srgb, var(--pa) 88%, #FFFFFF);
  box-shadow: 0 12px 30px -14px var(--pa);
}

.panel .btn.danger {
  border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent);
  background: color-mix(in srgb, var(--bad) 12%, transparent);
  color: var(--bad);
}

.panel .btn.danger:hover {
  background: color-mix(in srgb, var(--bad) 20%, transparent);
  border-color: color-mix(in srgb, var(--bad) 60%, transparent);
}

.iconbtn {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}

.iconbtn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.iconbtn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

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

.accent {
  color: var(--pa);
}

.link {
  color: var(--pa);
  font-weight: 600;
  font-size: 13px;
}

.link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

code.mono,
.mono-in {
  font-family: var(--mono);
  font-size: 12.5px;
}

code.mono {
  color: var(--muted);
  word-break: break-all;
}

.card {
  min-width: 0;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 34px;
  margin-bottom: 14px;
}

.card-head h3 {
  flex: 1;
  min-width: 0;
  font-size: 15.5px;
  font-weight: 600;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card > * + .card-note,
.card-note {
  margin-top: 12px;
  color: var(--dim);
  font-size: 12.5px;
}

.card + .card {
  margin-top: 0;
}

.stack {
  display: grid;
  justify-items: start;
  gap: 4px;
}

.stack small {
  color: var(--dim);
  font-size: 12px;
}

.stack-lg,
.results {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.row.end {
  justify-content: flex-end;
}

.row .end {
  margin-left: auto;
}

.tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.card .toolbar {
  margin-bottom: 14px;
}

.toolbar .search {
  flex: 1 1 260px;
  max-width: 420px;
}

.kv {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px 20px;
}

.kv dt {
  color: var(--dim);
}

.kv dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.stat {
  --tone: var(--line-2);
  position: relative;
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
}

.stat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--tone);
  opacity: 0.85;
}

.stat.ok {
  --tone: var(--ok);
}

.stat.bad {
  --tone: var(--bad);
}

.stat.warn {
  --tone: var(--warn);
}

.stat.hot {
  --tone: var(--pa);
  background: linear-gradient(180deg, color-mix(in srgb, var(--pa) 7%, var(--surface)), var(--surface) 70%);
}

.stat-k {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

.stat-v {
  font: 600 24px/1.15 var(--display);
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-s {
  color: var(--dim);
  font-size: 12px;
}

.stat.ok .stat-s,
.stat.bad .stat-s,
.stat.warn .stat-s {
  color: var(--tone);
}

.kpis,
.stats,
.dstats {
  display: grid;
  gap: 12px;
}

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

.stats {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.badge.ok {
  --glow: var(--ok);
}

.badge.bad {
  --glow: var(--bad);
}

.badge.warn {
  --glow: var(--warn);
}

.panel .badge {
  height: 22px;
  padding: 0 9px;
  font-size: 11px;
  white-space: nowrap;
}

.pill {
  --tone: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 24px;
  padding: 0 10px 0 9px;
  border-radius: 99px;
  border: 1px solid color-mix(in srgb, var(--tone) 28%, transparent);
  background: color-mix(in srgb, var(--tone) 11%, transparent);
  color: var(--tone);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.st-paid,
.st-done,
.st-sent,
.sub-active,
.sale-live {
  --tone: var(--ok);
}

.st-pending,
.st-held {
  --tone: var(--warn);
}

.st-failed,
.st-refunded,
.st-chargeback,
.st-cancelled,
.sale-ended {
  --tone: var(--bad);
}

.st-expired,
.sub-expired,
.sale-off {
  --tone: var(--dim);
}

.sale-live::before,
.st-pending::before {
  animation: beat 1.6s ease-in-out infinite;
}

@keyframes beat {
  50% {
    opacity: 0.35;
  }
}

.av {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 8px;
  background: var(--surface-3);
  image-rendering: pixelated;
  object-fit: cover;
}

.av.initial {
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--pa) 14%, var(--surface-2));
  color: var(--pa);
  font: 600 13px/1 var(--display);
  text-transform: uppercase;
}

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

.who-text {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}

.who-text b {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who-text small {
  color: var(--dim);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who-mini {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.who-mini .av {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 11px;
}

.tablewrap {
  min-width: 0;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  overflow-x: auto;
}

.card .tablewrap {
  margin-inline: -20px;
  border-width: 1px 0 0;
  border-radius: 0;
  background: transparent;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.table th {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table th:first-child,
.table td:first-child {
  padding-left: 20px;
}

.table th:last-child,
.table td:last-child {
  padding-right: 20px;
}

.table tr.click {
  cursor: pointer;
  transition: background 0.12s;
}

.table tr.click:hover {
  background: rgba(255, 255, 255, 0.025);
}

.table .c-num {
  text-align: right;
  white-space: nowrap;
}

.table .c-date {
  color: var(--muted);
  white-space: nowrap;
}

.table .c-act {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

.table .c-id {
  width: 1%;
  white-space: nowrap;
}

.table .c-id code.mono {
  word-break: normal;
}

.table .c-clip {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table .dim,
.table .dim span {
  color: var(--dim);
}

.amount {
  display: grid;
  justify-items: end;
  line-height: 1.3;
}

.amount b {
  font-weight: 600;
}

.amount small {
  color: var(--dim);
  font-size: 11.5px;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 4px;
}

.pager.center {
  justify-content: center;
}

.pager-info {
  color: var(--dim);
  font-size: 13px;
}

.pager-btns {
  display: flex;
  gap: 8px;
}

.chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.chip-btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.chip-btn:hover {
  color: var(--text);
}

.chip-btn.on {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-2);
}

.search {
  position: relative;
  display: block;
}

.search .ic {
  position: absolute;
  left: 13px;
  top: 50%;
  width: 17px;
  height: 17px;
  color: var(--dim);
  transform: translateY(-50%);
  pointer-events: none;
}

.search .input {
  height: 40px;
  padding-left: 40px;
}

.search .input::-webkit-search-cancel-button {
  filter: grayscale(1) brightness(1.6);
}

.panel .input {
  height: 40px;
  border-radius: 10px;
  font-size: 14px;
}

.panel .input:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pa) 18%, transparent);
}

.panel .input:disabled {
  opacity: 0.55;
}

.input.sel {
  padding-right: 36px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398A2B5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 16px;
  cursor: pointer;
}

.input.sel option {
  background: var(--surface-2);
  color: var(--text);
}

.table .input.sel {
  width: auto;
  min-width: 130px;
  height: 34px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field-label {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

.field-hint {
  color: var(--dim);
  font-size: 12px;
}

.form {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 6px;
}

.form-sub {
  margin-top: 6px;
  color: var(--dim);
  font: 600 11px/1 var(--body);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-err {
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--bad) 12%, transparent);
  color: var(--bad);
  font-size: 13px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.form-actions.sticky {
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.switch {
  position: relative;
  display: inline-flex;
  flex: none;
  cursor: pointer;
}

.switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch span {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 99px;
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--line-2);
  transition: background 0.2s;
}

.switch span::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s var(--ease), background 0.2s;
}

.switch input:checked + span {
  background: var(--pa);
  box-shadow: none;
}

.switch input:checked + span::after {
  background: #FFFFFF;
  transform: translateX(16px);
}

.switch input:focus-visible + span {
  outline: 2px solid var(--pa);
  outline-offset: 2px;
}

.switch input:disabled + span {
  opacity: 0.5;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.switch-row:first-of-type {
  padding-top: 0;
}

.copyable {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 2px 2px 10px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
}

.copyable code.mono {
  min-width: 0;
  color: var(--text);
}

.copyable .iconbtn {
  width: 30px;
  height: 30px;
}

.lines {
  display: grid;
  min-width: 0;
}

.line {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.line:last-child {
  border-bottom: 0;
}

button.line {
  width: 100%;
}

.line.click {
  margin-inline: -10px;
  width: calc(100% + 20px);
  padding-inline: 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
}

.line.click:hover {
  background: rgba(255, 255, 255, 0.03);
}

.line-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.line-main b {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-main small {
  color: var(--dim);
  font-size: 12.5px;
}

.line-side {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 44px 20px;
  color: var(--dim);
  text-align: center;
}

.empty .ic {
  width: 28px;
  height: 28px;
  stroke-width: 1.5;
}

.empty.bad {
  color: var(--bad);
}

.skeleton {
  display: grid;
  gap: 10px;
}

.skeleton span {
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-3) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.panel .toasts {
  left: auto;
  right: 24px;
  bottom: 24px;
  justify-items: end;
  transform: none;
}

.panel .toast {
  max-width: min(380px, calc(100vw - 48px));
  padding: 12px 16px 12px 14px;
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--ok);
  background: var(--surface-3);
  color: var(--text);
  font-weight: 500;
}

.panel .toast.bad {
  border-left-color: var(--bad);
  background: var(--surface-3);
  color: var(--text);
}

.veil {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(3, 5, 10, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.22s;
}

.veil.on {
  opacity: 1;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 75;
  width: min(580px, 100vw);
  border-left: 1px solid var(--line-2);
  background: var(--surface);
  box-shadow: -40px 0 80px -40px rgba(0, 0, 0, 0.8);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(100%);
  transition: transform 0.26s var(--ease);
}

.drawer.on {
  transform: none;
}

.drawer-body {
  display: grid;
  align-content: start;
  gap: 22px;
  min-height: 100%;
  padding: 0 24px 28px;
}

.drawer-body > .skeleton {
  padding-top: 24px;
}

.dhead {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 -24px;
  padding: 20px 20px 16px 24px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.dhead .av {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  font-size: 18px;
}

.dhead-text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.dhead-text h2 {
  font-size: 19px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dhead-text small {
  color: var(--dim);
  font-size: 12.5px;
}

.dhead-extra {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.dhead-extra:empty {
  display: none;
}

.dsec {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.dsec h4 {
  color: var(--dim);
  font: 600 11px/1 var(--body);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.dstats .stat {
  padding: 12px 14px;
  background: var(--surface-2);
}

.dstats .stat-v {
  font-size: 18px;
}

.dactions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dactions:empty {
  display: none;
}

.drawer .tablewrap {
  background: var(--surface-2);
}

.drawer .form > .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 4px -24px -28px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.pbox {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.pbox-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.note {
  flex-basis: 100%;
  padding: 8px 12px;
  border-left: 2px solid var(--line-2);
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.balance {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.balance small {
  color: var(--dim);
}

.balance b {
  font: 600 22px/1 var(--display);
  font-variant-numeric: tabular-nums;
}

textarea.input.area {
  height: auto;
  min-height: 88px;
  padding: 10px 14px;
  line-height: 1.5;
  resize: vertical;
}

.fresh {
  display: grid;
  justify-items: start;
  gap: 8px;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px dashed color-mix(in srgb, var(--pa) 45%, transparent);
  background: color-mix(in srgb, var(--pa) 5%, transparent);
}

.view > .fresh {
  margin-top: 0;
}

.fresh small {
  color: var(--muted);
}

.fresh small.dim {
  color: var(--dim);
}

.modal-veil {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 5, 10, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade 0.18s var(--ease);
}

.modal {
  width: min(420px, 100%);
  display: grid;
  gap: 10px;
  padding: 24px;
  border-radius: 18px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.9);
  animation: rise 0.22s var(--ease);
}

.modal h3 {
  font-size: 18px;
}

.modal p {
  color: var(--muted);
  overflow-wrap: anywhere;
}

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

@media (max-width: 600px) {
  .drawer-body {
    padding: 0 16px 24px;
  }

  .dhead {
    margin: 0 -16px;
    padding: 16px 12px 14px 16px;
  }

  .drawer .form > .form-actions {
    margin: 4px -16px -24px;
    padding: 12px 16px;
  }
}

.card-actions .card-note {
  margin: 0;
}

.grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.chartwrap {
  position: relative;
}

.chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  touch-action: pan-y;
  cursor: crosshair;
}

.chart .stop-a {
  stop-color: var(--pa);
  stop-opacity: 0.28;
}

.chart .stop-b {
  stop-color: var(--pa);
  stop-opacity: 0;
}

.chart .grid {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

.chart .ylab,
.chart .xlab {
  fill: var(--dim);
  font: 500 11.5px var(--body);
  font-variant-numeric: tabular-nums;
}

.chart .ylab {
  text-anchor: end;
}

.chart .xlab {
  text-anchor: middle;
}

.chart .area {
  stroke: none;
}

.chart .line {
  fill: none;
  stroke: var(--pa);
  stroke-width: 2.25;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart .guide {
  stroke: var(--line-2);
  stroke-width: 1;
  opacity: 0;
}

.chart .dot {
  fill: var(--bg);
  stroke: var(--pa);
  stroke-width: 2.5;
  opacity: 0;
}

.chartwrap.hover .guide,
.chartwrap.hover .dot {
  opacity: 1;
}

.tip {
  position: absolute;
  top: 4px;
  z-index: 4;
  display: grid;
  gap: 1px;
  min-width: 132px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--surface-3);
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.9);
  transform: translateX(12px);
  pointer-events: none;
  white-space: nowrap;
}

.tip.flip {
  transform: translateX(calc(-100% - 12px));
}

.tip small {
  color: var(--dim);
  font-size: 12px;
}

.tip b {
  font: 600 16px/1.3 var(--display);
  font-variant-numeric: tabular-nums;
}

.feed {
  display: grid;
  margin: -4px -10px;
}

.feed-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  text-align: left;
  transition: background 0.12s;
}

button.feed-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.feed-row .who {
  flex: 1;
}

.feed-end {
  flex: none;
  display: grid;
  justify-items: end;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}

.feed-end b {
  font-weight: 600;
}

.feed-end small {
  color: var(--dim);
  font-size: 12px;
}

.bars {
  display: grid;
  gap: 16px;
}

.bar {
  display: grid;
  gap: 6px;
}

.bar-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.bar-top b {
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-top span {
  flex: none;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.bar-track {
  height: 6px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--pa) 55%, transparent), var(--pa));
}

.bar small {
  color: var(--dim);
  font-size: 12px;
}

.leaders {
  display: grid;
  margin: -4px -10px;
  padding: 0;
  list-style: none;
}

.leader {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  text-align: left;
  transition: background 0.12s;
}

button.leader:hover {
  background: rgba(255, 255, 255, 0.03);
}

.leader .who {
  flex: 1;
}

.leader > b {
  flex: none;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.rank {
  width: 24px;
  height: 24px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--dim);
  font: 600 12px/1 var(--display);
}

.rank.r1 {
  background: color-mix(in srgb, var(--pa) 20%, transparent);
  color: var(--pa);
}

.rank.r2,
.rank.r3 {
  background: var(--surface-3);
  color: var(--text);
}

.health {
  display: grid;
}

.hrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.hrow:first-child {
  padding-top: 0;
}

.hrow:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.hrow > span:first-child {
  color: var(--muted);
}

.hrow-val {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.hrow-val small {
  color: var(--dim);
  font-size: 12px;
}

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

.pimg {
  width: 40px;
  height: 40px;
  flex: none;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  object-fit: contain;
  image-rendering: pixelated;
}

.prod.big .pimg {
  width: 56px;
  height: 56px;
  padding: 6px;
  border-radius: 13px;
}

.prod-text {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}

.prod-text b {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prod-text small {
  color: var(--dim);
  font-size: 12px;
}

.prod.big .prod-text b {
  font: 600 17px/1.25 var(--display);
}

.prod-price {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.money-in {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.money-in.grow {
  flex: 1 1 180px;
  max-width: 260px;
}

.money-in .input {
  padding-right: 54px;
  font-variant-numeric: tabular-nums;
}

.money-in span {
  position: absolute;
  right: 12px;
  color: var(--dim);
  font-size: 12.5px;
  font-weight: 600;
  pointer-events: none;
}

.input.price {
  text-align: right;
}

.mono-in {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.prov .ic-box {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.prov .ic-box .ic {
  width: 18px;
  height: 18px;
}

.steps {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  min-height: 26px;
  padding: 3px 0 0 40px;
  color: var(--muted);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--pa) 14%, transparent);
  color: var(--pa);
  font: 600 12.5px/1 var(--display);
}

@media (max-width: 1240px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .grid2 {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .kpis,
  .dstats {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
  }

  .stat {
    padding: 13px 14px;
  }

  .stat-v {
    font-size: 19px;
  }

  .card {
    padding: 16px;
  }

  .card .tablewrap {
    margin-inline: -16px;
  }

  .table th:first-child,
  .table td:first-child {
    padding-left: 16px;
  }

  .table th:last-child,
  .table td:last-child {
    padding-right: 16px;
  }

  .toolbar .search {
    flex-basis: 100%;
    max-width: none;
  }

  .chips {
    max-width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .panel .toasts {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }
}

.ap-accepted {
  --tone: var(--ok);
}

.ap-pending {
  --tone: var(--warn);
}

.ap-rejected {
  --tone: var(--bad);
}

.ap-pending::before {
  animation: beat 1.6s ease-in-out infinite;
}

.ap-forms {
  margin: -4px 0 14px;
}

.ap-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ap-status small {
  color: var(--muted);
  font-size: 12px;
}

.ap-answers {
  display: grid;
  gap: 14px;
}

.ap-q {
  display: grid;
  gap: 4px;
}

.ap-q > small {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

.ap-text,
.ap-long {
  overflow-wrap: anywhere;
}

.ap-long {
  white-space: pre-wrap;
  line-height: 1.5;
}

.ap-link {
  color: var(--accent);
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ap-img {
  display: block;
  max-width: 100%;
  max-height: 340px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.aq-form {
  display: grid;
  gap: 14px;
}

.aq-title {
  margin-top: 6px;
  font-size: 14px;
}

.aq {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.aq-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.aq-head small {
  color: var(--muted);
  font-size: 12px;
}

.aq-tools {
  display: inline-flex;
  gap: 4px;
  margin-left: auto;
}

.aq-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 14px;
}

.iconbtn[disabled] {
  opacity: 0.35;
  pointer-events: none;
}
