:root {
  --ink: #eef6ff;
  --muted: #9aacbd;
  --line: #26394d;
  --paper: #132235;
  --paper-soft: #182b41;
  --wash: #09131f;
  --navy: #0b1623;
  --green: #14b882;
  --green-dark: #0c966b;
  --red: #e0524d;
  --blue: #60a5fa;
  --amber: #f0b454;
  --cyan: #22d3ee;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--wash);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

button,
.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.small-button,
.order-row {
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease, opacity 160ms ease;
}

button:hover,
.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.small-button:hover {
  transform: translateY(-1px);
}

button:active,
.primary-button:active,
.secondary-button:active,
.ghost-button:active,
.danger-button:active,
.small-button:active {
  transform: translateY(0) scale(0.98);
}

.hidden {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  padding: clamp(18px, 4vw, 48px);
  color: white;
  background:
    linear-gradient(120deg, rgba(9, 19, 31, 0.97), rgba(12, 48, 60, 0.82)),
    url("https://images.unsplash.com/photo-1565514020179-026b92b84bb6?auto=format&fit=crop&w=1800&q=80") center/cover;
}

.auth-brand,
.brand,
.top-actions,
.nav,
.language-row,
.chat-head {
  display: flex;
  align-items: center;
}

.auth-brand,
.brand {
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.auth-brand {
  margin-bottom: clamp(36px, 8vw, 80px);
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(20, 184, 130, 0.32);
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  align-items: center;
  gap: clamp(24px, 6vw, 88px);
  max-width: 1180px;
  margin: 0 auto;
}

.auth-copy {
  max-width: 740px;
}

.auth-copy h1 {
  margin-bottom: 18px;
  font-size: clamp(38px, 6vw, 68px);
  line-height: 1;
}

.auth-copy p,
.hero-text {
  color: #d6e4ed;
  font-size: 18px;
}

.auth-copy p {
  max-width: 610px;
}

.auth-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.auth-stats span,
.user-badge,
.status-dot,
.tag,
.pill {
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 800;
}

.auth-stats span {
  color: #e8fff7;
  background: rgba(20, 184, 130, 0.16);
  border: 1px solid rgba(34, 211, 238, 0.18);
}

.auth-card,
.market-panel,
.trade-form,
.admin-card,
.order-card,
.rate-card,
.chat-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.auth-card {
  padding: 22px;
}

.auth-tabs,
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1b2b;
}

.auth-tab,
.segment {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.auth-tab.active,
.segment.active {
  color: white;
  background: linear-gradient(135deg, var(--green), var(--cyan));
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.message {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.message.success {
  color: var(--green);
}

.message.error {
  color: var(--red);
}

.language-row {
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 15px clamp(18px, 4vw, 56px);
  color: white;
  background: rgba(9, 19, 31, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
}

.nav {
  gap: 22px;
  color: #c6d3dd;
  font-size: 14px;
}

.nav a:hover {
  color: white;
}

.top-actions {
  gap: 10px;
}

.language,
.ghost-button,
.primary-button,
.secondary-button,
.danger-button,
.small-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 0 14px;
}

.language,
.ghost-button,
.secondary-button,
.small-button {
  background: #eef6ff;
  color: #0b1623;
}

.topbar .ghost-button {
  color: white;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
}

.primary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
}

.primary-button {
  border-color: var(--green);
  background: linear-gradient(135deg, var(--green), var(--cyan));
  box-shadow: 0 10px 22px rgba(20, 184, 130, 0.2);
}

.primary-button:hover {
  background: linear-gradient(135deg, var(--green-dark), var(--cyan));
  box-shadow: 0 14px 30px rgba(34, 211, 238, 0.24);
}

.danger-button {
  border-color: var(--red);
  background: var(--red);
  box-shadow: 0 10px 22px rgba(224, 82, 77, 0.18);
}

.small-button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 800;
}

.large {
  min-height: 48px;
  padding: 0 20px;
}

.full {
  width: 100%;
}

.user-badge {
  max-width: 260px;
  overflow: hidden;
  color: #e6f7ff;
  background: rgba(8, 145, 178, 0.22);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(320px, 0.94fr);
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
  min-height: calc(100vh - 70px);
  padding: clamp(36px, 6vw, 82px) clamp(18px, 5vw, 72px);
  color: white;
  background:
    linear-gradient(115deg, rgba(9, 19, 31, 0.98), rgba(12, 33, 52, 0.9) 48%, rgba(8, 88, 112, 0.62)),
    url("https://images.unsplash.com/photo-1541354329998-f4d9a9f9297f?auto=format&fit=crop&w=1800&q=80") center/cover;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero .eyebrow,
.auth-screen .eyebrow {
  color: #7ee2bd;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 18px;
  font-size: clamp(40px, 7vw, 74px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.1;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 20px;
  letter-spacing: 0;
}

.hero-text {
  max-width: 650px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.market-panel {
  padding: 24px;
}

.panel-head,
.price-row,
.form-summary,
.footer,
.list-item-head,
.order-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-head p,
.panel-note {
  color: var(--muted);
  font-size: 13px;
}

.status-dot {
  color: var(--green);
  background: rgba(20, 184, 130, 0.14);
}

.price-row {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.price-row strong {
  font-size: 30px;
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 18px 0;
}

.flow-steps span {
  min-height: 54px;
  display: grid;
  place-items: center;
  padding: 8px;
  border-radius: 8px;
  color: var(--ink);
  background: rgba(20, 184, 130, 0.13);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.section,
.trade-section,
.admin-section {
  padding: clamp(44px, 7vw, 84px) clamp(18px, 5vw, 72px);
}

.section-title {
  max-width: 760px;
  margin-bottom: 28px;
}

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

.rate-card {
  min-height: 190px;
  padding: 24px;
}

.rate-card p,
.trade-copy p,
.check-list,
.order-card p {
  color: var(--muted);
}

.tag {
  display: inline-flex;
  margin-bottom: 18px;
}

.buy {
  color: var(--green);
  background: rgba(20, 184, 130, 0.15);
}

.sell {
  color: var(--red);
  background: rgba(224, 82, 77, 0.15);
}

.neutral {
  color: var(--blue);
  background: rgba(96, 165, 250, 0.15);
}

.matching,
.pending {
  color: var(--amber);
  background: rgba(240, 180, 84, 0.15);
}

.approved {
  color: var(--green);
  background: rgba(20, 184, 130, 0.15);
}

.rejected {
  color: var(--red);
  background: rgba(224, 82, 77, 0.15);
}

.trade-section,
.admin-section {
  background: #0c1724;
}

.trade-section {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 0.72fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: start;
}

.check-list {
  padding-left: 20px;
  color: var(--muted);
}

.check-list li {
  margin: 12px 0;
}

.trade-form,
.admin-card {
  display: grid;
  gap: 18px;
  padding: 22px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: #eef6ff;
  color: #0b1623;
}

textarea {
  resize: vertical;
}

.form-summary {
  padding: 14px;
  border-radius: 8px;
  background: rgba(20, 184, 130, 0.1);
}

.form-message {
  display: none;
  margin: 0;
  color: var(--green);
  font-size: 14px;
}

.form-message.visible {
  display: block;
}

.order-board {
  display: grid;
  gap: 14px;
}

.order-board.compact {
  margin-top: 16px;
}

.order-card {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.order-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  animation: riseIn 240ms ease both;
}

.order-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.order-row:hover {
  border-color: rgba(34, 211, 238, 0.55);
  background: var(--paper-soft);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
  transform: translateY(-2px);
}

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

.order-meta span {
  display: grid;
  gap: 3px;
  padding: 12px;
  border-radius: 8px;
  background: var(--paper-soft);
  color: var(--muted);
  font-size: 13px;
}

.order-meta strong {
  color: var(--ink);
  font-size: 15px;
}

.progress-line {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #23384d;
}

.progress-line span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--cyan));
}

.chat-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 8, 14, 0.72);
  backdrop-filter: blur(10px);
  animation: fadeIn 160ms ease both;
}

.modal-card {
  display: grid;
  width: min(940px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  gap: 14px;
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  animation: modalIn 190ms ease both;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 7px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  vertical-align: -2px;
  animation: spin 760ms linear infinite;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.list-item,
.rate-card,
.market-panel,
.trade-form,
.admin-card {
  animation: riseIn 260ms ease both;
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-head {
  justify-content: space-between;
  gap: 16px;
}

.chat-messages {
  display: grid;
  max-height: 260px;
  overflow: auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1623;
}

.active-order-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.active-order-summary div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 8px;
  background: var(--paper-soft);
}

.active-order-summary span {
  color: var(--muted);
  font-size: 12px;
}

.active-order-summary strong {
  color: var(--ink);
  font-size: 15px;
}

.chat-message {
  max-width: 78%;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--paper-soft);
  color: var(--ink);
}

.chat-message.customer {
  justify-self: end;
  background: rgba(20, 184, 130, 0.18);
}

.chat-message.admin {
  justify-self: start;
  background: rgba(96, 165, 250, 0.16);
}

.chat-message small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.45fr) auto;
  gap: 10px;
}

.file-input {
  min-height: 40px;
  padding: 8px;
}

.chat-image {
  display: block;
  max-width: min(320px, 100%);
  max-height: 260px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 18px;
}

.admin-card.wide {
  grid-column: 1 / -1;
}

.list-stack {
  display: grid;
  gap: 12px;
}

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

.list-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
}

.list-item p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

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

.footer {
  padding: 24px clamp(18px, 5vw, 72px);
  border-top: 1px solid var(--line);
  background: #0b1623;
  color: var(--muted);
}

.footer span:first-child {
  color: var(--ink);
  font-weight: 800;
}

@media (max-width: 1040px) {
  .admin-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 920px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .nav {
    order: 3;
    width: 100%;
  }

  .auth-shell,
  .hero,
  .trade-section,
  .rate-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .order-meta {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .top-actions,
  .nav,
  .hero-actions,
  .footer,
  .auth-stats {
    width: 100%;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .user-badge {
    grid-column: 1 / -1;
    max-width: 100%;
  }

  .nav {
    justify-content: space-between;
    gap: 10px;
  }

  h1,
  .auth-copy h1 {
    font-size: 38px;
  }

  .hero-actions a,
  .order-meta {
    width: 100%;
  }

  .flow-steps,
  .order-meta,
  .active-order-summary,
  .chat-form {
    grid-template-columns: 1fr;
  }
}
