:root {
  --ink: #1d211f;
  --muted: #68706b;
  --line: #d8ddd6;
  --paper: #f7f8f3;
  --panel: #ffffff;
  --coin: #c99722;
  --mint: #237764;
  --seal: #a73d2c;
  --blueprint: #e7f0ed;
  --shadow: 0 18px 50px rgba(29, 33, 31, 0.1);
}

* { box-sizing: border-box; }

html {
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  width: 100%;
  overflow-x: hidden;
  font-family: "Vazirmatn", system-ui, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(35,119,100,.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(35,119,100,.05) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

button, input, select, textarea { font: inherit; max-width: 100%; }

img, svg { max-width: 100%; }

button {
  border: 0;
  cursor: pointer;
  min-height: 42px;
}

button:disabled {
  cursor: progress;
  opacity: .64;
}

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(35, 119, 100, .28);
  outline-offset: 2px;
}

.shell { min-height: 100vh; overflow-x: hidden; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(247, 248, 243, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand-logo {
  display: block;
  width: 150px;
  height: auto;
}

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

.ghost, .primary, .danger, .icon-button {
  border-radius: 7px;
  padding: 10px 16px;
  font-weight: 700;
  white-space: nowrap;
}

.small {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

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

.primary {
  color: #fff;
  background: var(--mint);
  box-shadow: 0 8px 22px rgba(35,119,100,.24);
}

.danger { color: #fff; background: var(--seal); }

.hero {
  min-height: calc(100vh - 65px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
  gap: clamp(24px, 6vw, 72px);
  align-items: center;
  padding: clamp(32px, 6vw, 80px) clamp(18px, 4vw, 56px) 36px;
  width: 100%;
}

.hero h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(38px, 7vw, 92px);
  line-height: 1.02;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.hero p {
  max-width: 670px;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 20px);
  line-height: 2;
}

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

.ticker-board {
  width: min(100%, 520px);
  min-width: 0;
  justify-self: stretch;
  background: var(--panel);
  border: 2px solid var(--ink);
  box-shadow: 10px 10px 0 var(--ink);
  padding: 18px;
}

.ticker-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 12px;
  font-weight: 800;
}

.coin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.coin-row:last-child { border-bottom: 0; }
.coin-row span, .coin-row small { min-width: 0; overflow-wrap: anywhere; }
.coin-row small { color: var(--muted); }
.coin-row strong { direction: ltr; white-space: nowrap; }

.secure-list {
  display: grid;
  gap: 10px;
}

.secure-list span {
  display: block;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7faf8;
  font-weight: 700;
}

.section {
  padding: 34px clamp(18px, 4vw, 56px);
  border-top: 1px solid var(--line);
}

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

.step, .panel, .modal-card, .table-wrap {
  background: rgba(255,255,255,.9);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.step { padding: 18px; min-height: 150px; }
.step b { display: block; margin-bottom: 8px; }
.step p { margin: 0; color: var(--muted); line-height: 1.8; }

.app-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: calc(100vh - 65px);
  min-width: 0;
}

.sidebar {
  border-left: 1px solid var(--line);
  background: rgba(255,255,255,.78);
  padding: 18px;
}

.main { min-width: 0; padding: 20px; overflow: hidden; }
.panel { min-width: 0; padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.panel h2, .panel h3 { margin: 0 0 14px; }

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

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; color: #3d443f; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  min-height: 42px;
}

.field textarea { min-height: 88px; resize: vertical; }
.full { grid-column: 1 / -1; }

.dropzone {
  border: 2px dashed #a7b2aa;
  border-radius: 8px;
  background: var(--blueprint);
  padding: 22px;
  text-align: center;
  overflow: hidden;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.stat span { color: var(--muted); font-size: 13px; }
.stat b { display: block; margin-top: 6px; font-size: 22px; direction: ltr; text-align: right; }

table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
th { background: #eef4f1; color: #2b3c36; position: sticky; top: 0; }
.table-wrap { width: 100%; min-width: 0; overflow: auto; max-height: 520px; -webkit-overflow-scrolling: touch; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 10px;
  background: #eef4f1;
  color: var(--mint);
  font-size: 12px;
  font-weight: 800;
}

.warning { background: #fff4de; color: #7c4b00; }
.bad { background: #fde8e3; color: var(--seal); }

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(29, 33, 31, .48);
  z-index: 50;
  padding: 16px;
}

.modal-card {
  width: min(520px, 100%);
  padding: 22px;
  box-shadow: var(--shadow);
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}

.admin-panel {
  border-color: rgba(35, 119, 100, .34);
}

.notice-bar {
  position: sticky;
  top: 70px;
  z-index: 19;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px clamp(18px, 4vw, 56px) 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(29, 33, 31, .08);
  font-weight: 700;
}

.notice-bar span { min-width: 0; overflow-wrap: anywhere; }

.notice-bar.info { color: var(--mint); background: #f1f7f4; }
.notice-bar.success { color: #17634d; background: #edf8f1; }
.notice-bar.warning { color: #7c4b00; background: #fff8e8; }
.notice-bar.error { color: var(--seal); background: #fff0ed; }

.notice {
  border-radius: 7px;
  padding: 10px 12px;
  margin: 12px 0 0;
  font-weight: 700;
}

.notice.info { background: #eef4f1; color: var(--mint); }
.notice.warning { background: #fff4de; color: #7c4b00; }
.notice.error { background: #fde8e3; color: var(--seal); }

@media (max-width: 980px) {
  .hero, .app-layout { grid-template-columns: 1fr; }
  .flow, .stats, .grid { grid-template-columns: 1fr 1fr; }
  .ticker-board { width: 100%; }
  .sidebar { border-left: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 620px) {
  .flow, .stats, .grid { grid-template-columns: 1fr; }
  .topbar { align-items: stretch; flex-direction: column; gap: 12px; }
  .brand-logo { width: min(150px, 56vw); }
  .nav, .nav button, .hero-actions, .hero-actions button, .actions button { width: 100%; }
  .hero h1 { font-size: clamp(34px, 10vw, 40px); line-height: 1.12; }
  .hero p { font-size: 16px; line-height: 1.85; }
  .hero { min-height: auto; padding: 28px 16px 30px; gap: 24px; }
  .ticker-board { box-shadow: 6px 6px 0 var(--ink); }
  .coin-row { grid-template-columns: 1fr; }
  .coin-row strong { text-align: right; font-size: 20px; }
  .section, .main, .sidebar { padding-inline: 16px; }
  .panel, .step { padding: 14px; }
  .dropzone { padding: 16px; }
  .modal { align-items: end; padding: 0; }
  .modal-card { width: 100%; border-radius: 12px 12px 0 0; max-height: 92vh; overflow: auto; }
  .notice-bar { top: 125px; align-items: flex-start; flex-direction: column; }
  .notice-bar .small { width: 100%; }
  th, td { white-space: nowrap; }
}

@media (max-width: 380px) {
  .topbar, .section, .main, .sidebar { padding-inline: 12px; }
  .hero { padding-inline: 12px; }
  .ghost, .primary, .danger { padding-inline: 12px; }
  .ticker-board { padding: 14px; box-shadow: 4px 4px 0 var(--ink); }
}
