:root {
  color-scheme: light dark;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #10141f;
  color: #f7f8fc;
  --card-width: clamp(320px, 92vw, 520px);
  --auth-card-max: 640px;
  --app-max: 1160px;
  /* design tokens */
  --brand: #38b6ff;
  --text: #f7f8fc;
  --bg: linear-gradient(160deg, #10141f 0%, #1e293b 100%);
  --card: rgba(15, 23, 42, 0.85);
  --muted: rgba(148, 163, 184, 0.85);
  --border: rgba(148, 163, 184, 0.25);
  --input-bg: rgba(15, 23, 42, 0.5);
  --input-border: rgba(148, 163, 184, 0.4);
  --panel: rgba(15, 23, 42, 0.4);
  --panel-strong: rgba(15, 23, 42, 0.6);
  --overlay: rgba(15, 23, 42, 0.85);
  /* spacing scale (4px base) */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-6: 1.5rem;
  --s-8: 2rem;
}

/* light theme override */
html[data-theme="light"] {
  --text: #0f172a;
  --bg: linear-gradient(160deg, #f8fafc 0%, #e2e8f0 100%);
  --card: rgba(255, 255, 255, 0.9);
  --muted: #475569;
  --border: rgba(2, 6, 23, 0.12);
  --input-bg: rgba(248, 250, 252, 0.9);
  --input-border: rgba(148, 163, 184, 0.35);
  --panel: rgba(241, 245, 249, 0.9);
  --panel-strong: rgba(226, 232, 240, 0.95);
  --overlay: rgba(248, 250, 252, 0.92);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: var(--s-6);
  padding: var(--s-8) var(--s-4) var(--s-6);
  background: var(--bg);
  color: var(--text);
}

html,
body {
  overflow-x: hidden;
}

.brand-header {
  text-align: center;
  color: var(--text);
  display: grid;
  gap: var(--s-2);
}

.brand-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: 0.06em;
}

.brand-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.top-bar {
  width: min(var(--card-width), 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.top-bar h1 {
  flex: 1 1 auto;
  margin-bottom: 0;
}

.top-bar-controls {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  flex: 0 0 auto;
}

.card {
  width: min(var(--card-width), 100%);
  padding: var(--s-8);
  border-radius: 1rem;
  background: var(--card);
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(10px);
  position: relative;
  margin-inline: auto;
}

.card.seller-page {
  width: min(var(--app-max), 100%);
  display: grid;
  gap: var(--s-8);
}

.seller-page .top-bar {
  width: 100%;
  align-items: flex-start;
  gap: var(--s-4);
}

.seller-page .top-bar h1 {
  margin-bottom: 0;
}

.seller-hero {
  display: grid;
  gap: var(--s-6);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: var(--s-6);
}

.seller-hero__info {
  display: grid;
  gap: var(--s-4);
}

.seller-bio {
  font-size: 1rem;
  line-height: 1.7;
  margin: 0;
}

.seller-hero__details {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s-4);
  padding: var(--s-4);
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
}

.seller-detail {
  display: grid;
  gap: 0.35rem;
}

.seller-hero__details dd {
  word-break: break-word;
  overflow-wrap: anywhere;
}

.seller-hero__media {
  display: flex;
  align-items: center;
  justify-content: center;
}

.seller-hero__media img {
  width: min(320px, 100%);
  border-radius: 1rem;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.45);
}

@media (min-width: 720px) {
  .seller-hero {
    grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.9fr);
    align-items: start;
  }

  .seller-hero__media {
    justify-content: flex-end;
  }
}

.app-shell {
  margin-inline: auto;
}

.card.auth {
  width: min(clamp(340px, 92vw, var(--auth-card-max)), 100%);
}

.app-shell > main.card {
  width: 100%;
  max-width: none;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--overlay);
  border-radius: 1rem;
  z-index: 10;
  font-weight: 600;
  letter-spacing: 0.02em;
}


.card section {
  margin-bottom: var(--s-6);
}

h1,
h2 {
  margin-top: 0;
}

.form {
  display: grid;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}

label {
  display: grid;
  gap: 0.4rem;
  font-weight: 600;
}

input {
  padding: 0.75rem;
  border-radius: 0.6rem;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: inherit;
}

textarea {
  padding: 0.75rem;
  border-radius: 0.6rem;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: inherit;
  resize: vertical;
  min-height: 120px;
}

button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  border: none;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  min-height: 44px;
  font-size: 0.95rem;
  white-space: nowrap;
}

button.primary {
  background: var(--brand);
  color: #0b1220;
}

button.secondary {
  background: rgba(148, 163, 184, 0.2);
  color: inherit;
}

button.theme-toggle {
  padding: 0;
  border: none;
  background: transparent;
  min-height: auto;
  width: 52px;
  height: 28px;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(56, 182, 255, 0.3);
}

button.theme-toggle:hover {
  transform: none;
  box-shadow: none;
}

button.theme-toggle:focus-visible {
  outline: 3px solid rgba(56, 182, 255, 0.5);
  outline-offset: 3px;
}

button.theme-toggle .theme-toggle-track {
  position: relative;
  width: 52px;
  height: 28px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  transition: background 0.25s ease, border-color 0.25s ease;
}

button.theme-toggle .theme-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand);
  transition: transform 0.25s ease;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
}

button.theme-toggle .theme-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 0.9rem;
  line-height: 1;
  transition: opacity 0.25s ease;
}

button.theme-toggle .theme-toggle-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

button.theme-toggle .theme-toggle-icon--sun {
  color: #f59e0b;
}

button.theme-toggle .theme-toggle-icon--moon {
  color: #1e40af;
}

button.theme-toggle[data-theme-state='light'] .theme-toggle-thumb {
  transform: translateX(0);
}

button.theme-toggle[data-theme-state='dark'] .theme-toggle-thumb {
  transform: translateX(24px);
}

button.theme-toggle[data-theme-state='light'] .theme-toggle-icon--sun {
  opacity: 1;
}

button.theme-toggle[data-theme-state='light'] .theme-toggle-icon--moon {
  opacity: 0.45;
}

button.theme-toggle[data-theme-state='dark'] .theme-toggle-icon--sun {
  opacity: 0.45;
}

button.theme-toggle[data-theme-state='dark'] .theme-toggle-icon--moon {
  opacity: 1;
}

button.theme-toggle:hover .theme-toggle-track {
  border-color: rgba(56, 182, 255, 0.45);
}

select {
  padding: 0.75rem;
  border-radius: 0.6rem;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: inherit;
}

#boats-list {
  display: grid;
  gap: var(--s-4);
}

.item-card {
  padding: var(--s-4) 1.25rem;
  border-radius: 0.9rem;
  background: var(--panel);
  border: 1px solid var(--border);
  display: grid;
  gap: 0.75rem;
}

.item-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.item-meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.item-actions button {
  flex: 1 1 160px;
  min-width: 140px;
}

.muted {
  color: var(--muted);
  margin: 0;
}

.link {
  color: var(--brand);
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

.message {
  min-height: 1.25rem;
  margin: var(--s-3) 0 var(--s-4);
  color: #f97316;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.message.success {
  color: #4ade80;
}

.details {
  margin: 0 0 1.5rem;
  display: grid;
  gap: var(--s-4);
}

.details dt {
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.75);
  margin-bottom: 0.25rem;
}

.details dd {
  word-break: break-word;
  overflow-wrap: anywhere;
  margin: 0;
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.seller-boats {
  display: grid;
  gap: var(--s-4);
}

.seller-boats__grid {
  display: grid;
  gap: var(--s-6);
}

@media (min-width: 720px) {
  .seller-boats__grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

.seller-boats__grid .item-card {
  height: 100%;
}

.balance-pair {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-family: inherit;
}

.balance-main {
  font-size: 1.1rem;
  font-weight: 600;
  word-break: break-word;
}

.balance-sub {
  font-size: 0.9rem;
  color: var(--muted);
}

#wallet-overview {
  display: grid;
  gap: var(--s-4);
  margin-bottom: 1.5rem;
}

#wallet-seed {
  padding: 1.25rem;
  border-radius: 1rem;
  background: rgba(250, 204, 21, 0.12);
  border: 1px solid rgba(250, 204, 21, 0.35);
  display: grid;
  gap: 1rem;
}

#wallet-seed h2 {
  margin: 0;
}

.seed-warning {
  margin: 0;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
  font-weight: 600;
}

#wallet-seed-phrase {
  margin: 0;
  padding: 1rem;
  border-radius: 0.75rem;
  background: var(--panel);
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 1rem;
  line-height: 1.5;
}

#wallet-seed .item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

#send-usdt-review {
  margin-top: 1rem;
  padding: 1.25rem;
  border-radius: 0.9rem;
  background: var(--panel);
  border: 1px solid var(--border);
  display: grid;
  gap: var(--s-4);
}

#send-usdt-review h3 {
  margin: 0;
  font-size: 1.05rem;
}

#send-usdt-review .details {
  margin: 0;
  gap: 0.85rem;
}

#send-usdt-review .details dd {
  overflow-wrap: anywhere;
}

#send-usdt-review .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

#send-usdt-review .actions button {
  flex: 1 1 160px;
  min-width: 140px;
}

#send-usdt-hint {
  margin-top: 1rem;
}

.overview-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  background: var(--panel-strong);
  border: 1px solid var(--border);
}

.overview-label {
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.78);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.overview-total-value {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.overview-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.overview-grid > div {
  padding: 0.9rem 1.1rem;
  border-radius: 0.9rem;
  background: var(--panel);
  border: 1px solid var(--border);
  display: grid;
  gap: 0.35rem;
}

.overview-value {
  font-size: 1.05rem;
  font-weight: 600;
}

.overview-sub {
  font-size: 0.9rem;
  color: var(--muted);
}

.overview-change {
  font-size: 0.85rem;
}

.change-positive {
  color: #4ade80;
}

.change-negative {
  color: #f87171;
}

.table-scroll {
  overflow-x: auto;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--panel);
}

.table-scroll table {
  width: 100%;
  border-collapse: collapse;
  min-width: 540px;
}

.table-scroll th,
.table-scroll td {
  padding: 0.75rem;
  text-align: left;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

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

@media (max-width: 480px) {
  body {
    padding: 2.5rem 1rem 1.5rem;
  }

  .brand-header h1 {
    font-size: clamp(1.6rem, 8vw, 2rem);
  }

  .top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .top-bar-controls {
    width: 100%;
    justify-content: space-between;
  }

  .card {
    padding: 1.5rem;
  }

  #wallet-overview {
    gap: 0.75rem;
  }

  .overview-total {
    padding: 0.85rem 1rem;
  }

  .overview-total-value {
    font-size: 1.2rem;
  }

  .overview-grid > div {
    padding: 0.8rem 1rem;
  }

  .form {
    gap: 0.75rem;
  }

  label {
    gap: 0.3rem;
  }

  .form input,
  .form select,
  .form button {
    width: 100%;
  }

  button {
    justify-content: center;
  }

  .details {
    gap: 0.75rem;
  }

  .table-scroll table {
    min-width: 100%;
  }

  #send-usdt-review {
    margin-top: 0.75rem;
    padding: 1rem;
  }

  #send-usdt-review .actions {
    flex-direction: column;
    align-items: stretch;
  }

  #send-usdt-review .actions button {
    width: 100%;
    flex: 0 0 auto;
  }
}

@media (max-width: 768px) {
  body {
    padding: 2.5rem 1.25rem 1.75rem;
  }

  .top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .card {
    padding: 1.75rem;
  }

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

  #send-usdt-review .actions {
    flex-direction: column;
    align-items: stretch;
  }

  #send-usdt-review .actions button {
    width: 100%;
    flex: 0 0 auto;
  }
}

/* App shell layout for multi-page dashboard */
.app-shell {
  width: min(var(--app-max), 96vw);
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.25rem;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 1rem;
  display: grid;
  gap: 0.5rem;
}

.sidebar a {
  padding: 0.6rem 0.8rem;
  border-radius: 0.6rem;
  color: inherit;
  text-decoration: none;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.sidebar a:hover {
  background: rgba(148, 163, 184, 0.2);
  border-color: rgba(148, 163, 184, 0.35);
}

.sidebar a.active {
  background: rgba(56, 182, 255, 0.18);
  color: var(--brand);
  border-color: rgba(56, 182, 255, 0.5);
}

.mobile-tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.35rem 0.75rem;
  display: none;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 0.5rem;
  background: var(--panel-strong);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 1000;
  align-items: center;
  min-height: calc(3.5rem + env(safe-area-inset-bottom, 0px));
}

.mobile-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.45rem 0.5rem;
  border-radius: 0.6rem;
  text-decoration: none;
  color: inherit;
  background: var(--panel);
  border: 1px solid transparent;
  font-size: 0.85rem;
  line-height: 1.2;
  min-height: 2.5rem;
}

.mobile-tabs a.active {
  background: rgba(56, 182, 255, 0.18);
  color: var(--brand);
  border-color: rgba(56, 182, 255, 0.35);
}

.mobile-only {
  display: none !important;
}

.desktop-only {
  display: initial !important;
}

@media (max-width: 768px) {
  body {
    padding-bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px));
  }

  .app-shell {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
  }

  .sidebar {
    display: none;
  }

  .mobile-tabs {
    display: grid;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    min-height: 4.25rem;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: initial !important;
  }

  /* Re-center the page card on mobile */
  .app-shell > main.card {
    width: min(var(--card-width), 100%);
    max-width: var(--card-width);
    margin-inline: auto;
  }
}

/* Desktop defaults for form controls */
.form > button,
.form > .actions {
  justify-self: start;
}
.form > .actions {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.form > .actions > button {
  flex: 0 0 auto;
}

