:root {
  --bg: #07090c;
  --panel: #10141a;
  --panel-2: #10141a;
  --line: #1c222b;
  --text: #e8eef6;
  --muted: #8b98a8;
  --accent: #3ddc97;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}

.app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 -16px 16px;
  padding: 16px 16px 12px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.mode-toggle {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.mode-btn {
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
}

.mode-btn.is-active {
  background: var(--accent);
  color: #07090c;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.replace {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.replace input {
  width: auto;
  accent-color: var(--accent);
}

.import-status {
  margin: -8px 0 16px;
  color: var(--accent);
  font-size: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 600;
}

h1 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: -0.03em;
}

h1 a {
  color: var(--accent);
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-decoration: none;
}

h1 a:hover {
  text-decoration: underline;
}

h2 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.disclaimer {
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.45;
  background: var(--panel);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.panel-head h2 {
  margin: 0;
}

.panel-head p,
.muted {
  color: var(--muted);
  margin: 0;
  font-size: 13px;
}

.grid {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.grid.inputs,
.grid.trade {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.grid.week {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.price-field {
  min-width: 220px;
}

.price-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.price-row input {
  flex: 1;
  min-width: 0;
}

.price-row .btn {
  height: 42px;
  white-space: nowrap;
  flex-shrink: 0;
}

.price-status {
  min-height: 1em;
  font-size: 12px;
  color: var(--muted);
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

input:focus,
select:focus {
  outline: 1px solid var(--accent);
  border-color: var(--accent);
}

.btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

.btn.primary {
  background: var(--accent);
  color: #07090c;
  border-color: transparent;
  align-self: end;
  height: 42px;
}

.btn.span {
  grid-column: 1 / -1;
  justify-self: start;
}

.btn.ghost {
  background: transparent;
  color: var(--text);
}

.btn.danger {
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 4px 8px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.stats article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.stats strong {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 1.25rem;
}

.stats em {
  display: block;
  margin-top: 4px;
  font-style: normal;
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 10px 6px;
  border-bottom: 1px solid var(--line);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.empty td {
  color: var(--muted);
  font-family: "IBM Plex Sans", sans-serif;
}

.log-footer {
  text-align: center;
  padding-top: 8px;
}

.log-footer a {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}

.public {
  text-align: center;
  padding: 12px 0 32px;
}

.public-spot-label {
  margin: 0 0 8px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 600;
}

.public-spot {
  margin: 0;
  color: var(--accent);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: clamp(3.2rem, 12vw, 7rem);
  font-weight: 600;
  letter-spacing: -0.06em;
  line-height: 0.95;
}

.public-sub {
  margin: 18px 0 10px;
  color: var(--muted);
  font-size: clamp(0.95rem, 2.4vw, 1.15rem);
}

.public-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 10px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.public-price {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.public-price input {
  width: 96px;
  padding: 8px 10px;
  text-align: center;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.public-price .btn {
  height: 38px;
  padding: 8px 12px;
}

.public-history {
  text-align: left;
  max-width: 720px;
  margin: 0 auto 24px;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: min(100%, 280px);
  background: var(--accent);
  color: #07090c;
  text-decoration: none;
  font-weight: 700;
  border-radius: 12px;
  padding: 14px 22px;
}

button.cta {
  border: 0;
  cursor: pointer;
  font-family: inherit;
}

.share-x {
  margin: 0 0 24px;
}

.share-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}

.share-modal[hidden] {
  display: none;
}

.share-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.share-modal-panel {
  position: relative;
  width: min(920px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #0b0f14;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 20px 22px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.share-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.share-modal-head h2 {
  margin: 0;
  letter-spacing: 0.16em;
  font-size: 14px;
  font-weight: 700;
}

.share-modal-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.share-modal-preview {
  background: #05070a;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  line-height: 0;
}

.share-modal-preview canvas {
  display: block;
  width: 100%;
  height: auto;
}

.share-modal-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.share-modal-actions .cta {
  min-width: 0;
  width: 100%;
  padding: 12px 10px;
  font-size: 13px;
  letter-spacing: 0.04em;
}

body.share-open {
  overflow: hidden;
}

@media (max-width: 699px) {
  .share-modal-actions {
    grid-template-columns: 1fr;
  }
}

.public-disclaimer {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
}

body.view-public .log-only,
body.view-public #logView {
  display: none;
}

body.view-log #publicView {
  display: none;
}

.share-page .topbar {
  position: static;
}

.share-page .public {
  padding-top: 32px;
}

.share-page .share-note {
  margin: 16px auto 0;
  max-width: 420px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 699px) {
  .grid.inputs {
    grid-template-columns: 1fr;
  }

  .price-field {
    min-width: 0;
    width: 100%;
  }

  .price-row {
    flex-direction: column;
    align-items: stretch;
  }

  .price-row input,
  .price-row .btn {
    width: 100%;
    max-width: none;
    flex: none;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions,
  .toolbar {
    justify-content: stretch;
  }

  .toolbar .btn {
    flex: 1;
  }

  .btn.primary {
    width: 100%;
  }
}
