:root {
  --bg: #ffffff;
  --bg-soft: #f4f6f9;
  --ink: #163a6b;
  --muted: #6b7585;
  --line: rgba(22, 58, 107, 0.12);
  --blue: #1e4d8c;
  --blue-bright: #2563a8;
  --gray: #8b93a1;
  --ok: #2f6b45;
  --err: #8f2f2f;
  --card: #ffffff;
  --header: #ffffff;
  --radius: 14px;
  --shadow: 0 14px 36px rgba(22, 58, 107, 0.08);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", system-ui, sans-serif;
}

html[data-theme="dark"] {
  --bg: #0b1220;
  --bg-soft: #0f172a;
  --ink: #e8eef8;
  --muted: #9aa8bf;
  --line: rgba(232, 238, 248, 0.12);
  --blue: #7eb6ff;
  --blue-bright: #93c5fd;
  --gray: #94a3b8;
  --ok: #86efac;
  --err: #fca5a5;
  --card: #152033;
  --header: #111827;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg-soft);
  line-height: 1.55;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem clamp(1rem, 3vw, 2rem);
  background: var(--header);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand img {
  display: block;
  width: 7.5rem;
  height: auto;
  aspect-ratio: 850 / 356;
  object-fit: contain;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.1rem;
  align-items: center;
  font-weight: 600;
  font-size: 0.95rem;
}

.app-nav a {
  color: var(--muted);
  text-decoration: none;
}

.app-nav a:hover {
  color: var(--blue);
}

.app-main {
  width: min(960px, calc(100% - 2rem));
  margin: 1.5rem auto 3rem;
}

.app-footer {
  border-top: 1px solid var(--line);
  background: var(--header);
  padding: 1.25rem clamp(1rem, 3vw, 2rem);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.9rem;
}

.app-footer .developed-by,
.site-footer .developed-by {
  flex: 1 0 100%;
  margin: 0.35rem 0 0;
  text-align: center;
  font-size: 0.82rem;
}

.app-footer .developed-by a,
.site-footer .developed-by a {
  color: var(--blue);
  font-weight: 600;
}

h1,
h2 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.stack {
  display: grid;
  gap: 0.9rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.92rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1.25rem;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover,
button.btn:hover {
  background: var(--blue-bright);
  text-decoration: none;
  color: #fff;
}

.btn-small {
  padding: 0.55rem 0.95rem;
  font-size: 0.9rem;
}

.btn-ghost {
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  background: var(--bg-soft);
  color: var(--blue);
}

.btn-danger {
  background: #a33b3b;
}

.btn-warn {
  background: #b45309;
}

.btn-warn:hover {
  background: #92400e;
  color: #fff;
}

.flash {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-weight: 600;
}

.flash-ok {
  background: #e7f6ec;
  color: var(--ok);
}

.flash-error {
  background: #fdecec;
  color: var(--err);
}

.auth-wrap {
  width: min(420px, 100%);
  margin: 2rem auto;
}

.auth-wrap-wide {
  width: min(640px, 100%);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  width: 100%;
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.1rem;
  height: 2.1rem;
  border: 0;
  background: transparent;
  color: var(--muted, #64748b);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.password-toggle svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: currentColor;
}

.password-toggle .icon-eye-off {
  display: none;
}

.password-toggle.is-visible .icon-eye {
  display: none;
}

.password-toggle.is-visible .icon-eye-off {
  display: block;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1.25rem;
  margin: 0;
}

.info-grid dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #64748b);
  margin: 0 0 0.15rem;
}

.info-grid dd {
  margin: 0;
  font-weight: 600;
  color: var(--text, #0f172a);
  word-break: break-word;
}

.coin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
  overflow: visible;
}

.coin-card {
  background: #fff;
  color: #163a6b;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: visible;
  display: grid;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}

.coin-card:hover {
  z-index: 30;
}

.coin-card a {
  color: inherit;
  text-decoration: none;
}

.coin-card .coin-body h3,
.coin-card strong {
  color: #163a6b;
}

.coin-card .meta {
  color: rgba(0, 0, 0, 0.75);
}

.coin-media {
  display: grid;
  place-items: center;
  padding: 0.85rem 0.85rem 0;
  min-height: 166px;
}

.coin-zoom {
  position: relative;
  display: inline-block;
  width: 150px;
  height: 150px;
}

.coin-thumb {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  cursor: zoom-in;
  background: #e8edf4;
  transition: width 0.18s ease, height 0.18s ease, box-shadow 0.18s ease;
}

.coin-zoom:hover .coin-thumb,
.coin-zoom:focus-within .coin-thumb {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 500px;
  height: 500px;
  max-width: min(500px, 92vw);
  max-height: min(500px, 80vh);
  z-index: 40;
  box-shadow: 0 18px 50px rgba(22, 58, 107, 0.28);
}

.coin-thumb-empty {
  width: 150px;
  height: 150px;
  border-radius: 10px;
  margin: 0 auto;
}

.coin-photo {
  aspect-ratio: 4 / 3;
  background: #e8edf4;
  object-fit: cover;
  width: 100%;
  height: 100%;
  display: block;
}

.coin-photo-empty {
  display: grid;
  place-items: center;
  color: var(--gray);
  font-size: 0.9rem;
  aspect-ratio: 4 / 3;
  background: #e8edf4;
}

.admin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

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

.admin-row-block {
  align-items: flex-start;
  flex-direction: column;
}

.admin-user-card .alert-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.admin-user-grid {
  margin-top: 0.75rem;
}

.admin-user-list {
  display: grid;
  gap: 0.55rem;
}

.admin-user-card {
  padding: 0.7rem 0.85rem;
}

.admin-card-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  justify-content: space-between;
  align-items: flex-start;
}

.admin-card-line {
  margin-top: 0.2rem;
  line-height: 1.35;
}

.admin-card-actions {
  margin-top: 0;
}

.admin-card-details {
  margin-top: 0.45rem;
}

.admin-card-details summary {
  cursor: pointer;
  color: var(--blue);
  font-size: 0.88rem;
  font-weight: 600;
  list-style: none;
}

.admin-card-details summary::-webkit-details-marker {
  display: none;
}

.admin-user-card .admin-user-grid {
  margin-top: 0.55rem;
  gap: 0.45rem 0.75rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-user-card .admin-user-grid dt {
  font-size: 0.7rem;
}

.admin-user-card .admin-user-grid dd {
  font-size: 0.88rem;
  font-weight: 600;
}

.admin-alert-inline {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.65rem;
  align-items: center;
}

.admin-alert-inline input[type="text"] {
  flex: 1;
  margin: 0;
}

.admin-finder {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: end;
  margin-bottom: 0.85rem;
  padding: 0.75rem 0.9rem;
}

.admin-finder-label {
  flex: 1;
  min-width: 220px;
  margin: 0;
}

.badge-status {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
  background: #e2e8f0;
  color: #334155;
}

.badge-status-pending { background: #fef3c7; color: #92400e; }
.badge-status-approved { background: #dcfce7; color: #166534; }
.badge-status-rejected { background: #fee2e2; color: #991b1b; }
.badge-status-suspended { background: #ffedd5; color: #9a3412; }

.badge-ok {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #dbeafe;
  color: #1e40af;
}

.badge-warn {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.admin-tabs a {
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--muted);
  text-decoration: none;
}

.admin-tabs a:hover {
  text-decoration: none;
  color: var(--blue);
  background: #fff;
}

.admin-tabs a.is-active {
  color: #fff;
  background: var(--blue);
}

.admin-tab-count {
  display: inline-block;
  min-width: 1.25rem;
  margin-left: 0.25rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 0.75rem;
}

.admin-tabs a.is-active .admin-tab-count {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.admin-panel {
  margin-bottom: 1.5rem;
}

.admin-subhead {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
}

.admin-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  padding: 0.75rem 0.9rem;
}

.admin-bulk-left {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.admin-card-main {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  flex: 1;
  min-width: 220px;
}

.admin-check,
.admin-check-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-weight: 600;
  font-size: 0.88rem;
}

.admin-user-card.is-ready {
  border-color: rgba(30, 77, 140, 0.35);
  box-shadow: 0 0 0 1px rgba(30, 77, 140, 0.08);
}

.admin-user-card.is-waiting-email {
  opacity: 0.96;
  background: #fffdf7;
}

.dash-stat.is-hot {
  border-color: rgba(185, 28, 28, 0.28);
  background: #fff7f7;
}

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

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--blue);
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  margin: 1.25rem 0 0.5rem;
}

.legal-page h2 {
  margin-top: 1.25rem;
  font-size: 1.1rem;
}

.legal-page ul {
  margin: 0.4rem 0 0.8rem;
  padding-left: 1.2rem;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.65rem 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.alert-item {
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft, #f5f7fa);
}

.alert-item-new {
  border-color: #93c5fd;
  background: #eff6ff;
}

.coin-body {
  padding: 0.9rem 1rem 1.05rem;
  display: grid;
  gap: 0.35rem;
}

.coin-body h3 {
  margin: 0;
  font-size: 1.05rem;
  font-family: var(--font-display);
  color: #163a6b;
}

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

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-sale {
  background: #e8f0fa;
  color: var(--blue);
}

.badge-trade {
  background: #eef2f6;
  color: #4b5563;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.filters-advanced {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
}

.coin-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  justify-items: center;
}

.coin-pair-side {
  text-align: center;
}

.coin-specs {
  margin: 0.35rem 0;
}

.messages-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 1rem;
  align-items: start;
}

.message-thread-link {
  display: block;
  padding: 0.7rem 0.75rem;
  border-radius: 10px;
  border: 1px solid transparent;
  color: inherit;
  text-decoration: none;
  margin-bottom: 0.35rem;
}

.message-thread-link:hover,
.message-thread-link.is-active {
  background: var(--bg-soft, #f5f7fa);
  border-color: var(--line);
}

.message-bubbles {
  display: grid;
  gap: 0.55rem;
  max-height: 420px;
  overflow: auto;
  padding-right: 0.25rem;
}

.message-bubble {
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: #f1f5f9;
  max-width: 85%;
}

.message-bubble.is-mine {
  margin-left: auto;
  background: #e8f0fa;
}

.guide-list {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.45rem;
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.dash-stat {
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

a.dash-stat:hover {
  text-decoration: none;
  border-color: rgba(30, 77, 140, 0.35);
  transform: translateY(-1px);
}

.dash-stat-value {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 600;
  color: var(--blue);
  line-height: 1.1;
  margin-top: 0.15rem;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.dash-checklist {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.4rem;
}

.dash-progress {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.dash-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #1e4d8c, #2563a8);
}

.dash-shortcuts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.dash-shortcuts a {
  display: block;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-weight: 600;
  font-size: 0.92rem;
}

.dash-shortcuts a:hover {
  border-color: rgba(30, 77, 140, 0.35);
  text-decoration: none;
  background: #f8fafc;
}

.dash-msg {
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

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

.dash-msg:hover {
  text-decoration: none;
}

.dash-details summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
}

.dash-details summary::-webkit-details-marker {
  display: none;
}

.btn.is-fav,
button.is-fav {
  border-color: #f59e0b;
  color: #b45309;
}

.fav-remove {
  padding: 0 0.85rem 0.85rem;
}

.coin-card .fav-remove {
  margin-top: -0.25rem;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-weight: 600;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

@media (max-width: 720px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
  }

  .app-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
  }

  .app-nav.is-open {
    display: flex;
  }

  .app-nav a,
  .app-nav .btn {
    width: 100%;
    justify-content: center;
  }

  .grid-2,
  .filters,
  .filters-advanced,
  .info-grid,
  .admin-user-card .admin-user-grid,
  .admin-stats,
  .messages-layout,
  .coin-pair,
  .dash-stats,
  .admin-stats-grid,
  .dash-grid {
    grid-template-columns: 1fr;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-alert-inline {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (min-width: 721px) and (max-width: 980px) {
  .dash-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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