@font-face {
  font-family: Vazirmatn;
  src: url("Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: Manrope;
  src: url("Manrope-Latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --navy: #101f35;
  --ocean: #29435c;
  --gold: #c5a46d;
  --gold-light: #e7d5af;
  --canvas: #f4f6f9;
  --surface: #ffffff;
  --ink: var(--navy);
  --muted: #52647a;
  --line: #dbe3ec;
  --field-line: #8191a3;
  --subtle-surface: #eef2f7;
  --dark-muted: #b8c6d7;
  --dark-line: #52667a;
  --focus: #85590e;
  --buy: #116b49;
  --buy-text: #0e5f41;
  --buy-bg: #e5f2eb;
  --sell: #b92a38;
  --sell-text: #9c2533;
  --sell-bg: #f9ecee;
  --warn-text: #70480c;
  --warn-bg: #f5ecd6;
  --radius: 12px;
  font-family: Vazirmatn, Tahoma, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
h1, h2, h3, p, dl, dd { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.sidebar :focus-visible, .skip-link:focus-visible { outline-color: var(--gold-light); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: 10px; inset-inline-start: 10px; z-index: 2; padding: 10px 14px; background: var(--navy); color: white; border-radius: 6px; transform: translateY(-160%); }
.skip-link:focus { transform: none; }

.app-body { display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  height: 100dvh;
  min-height: 390px;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 14px 16px;
  background: var(--navy);
  color: white;
}
.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  min-width: 0;
  padding: 4px 8px 20px;
  border-bottom: 1px solid var(--dark-line);
}
.brand strong { display: block; font-size: 16px; font-weight: 820; }
.latin-wordmark { font-family: Manrope, Arial, sans-serif; letter-spacing: .16em; font-weight: 800; white-space: nowrap; }
.latin-wordmark b { color: var(--gold-light); font-weight: inherit; }
.brand small { display: block; font-size: 10px; margin-top: 2px; }
.brand-mark {
  position: relative;
  display: inline-block;
  flex: none;
  width: 44px;
  aspect-ratio: 2 / 1;
  direction: ltr;
}
.brand-mark::before, .brand-mark::after, .brand-mark i {
  content: "";
  display: block;
  position: absolute;
  inset: 0;
  background: linear-gradient(156deg, var(--gold-light), var(--gold) 68%, #ab8140);
}
.brand-mark::before { clip-path: polygon(0 100%, 31% 0, 42% 0, 70% 100%, 55% 100%, 36% 31%, 15% 100%); }
.brand-mark::after { clip-path: polygon(57% 0, 100% 0, 90% 19%, 61% 19%, 55% 34%, 47% 15%); }
.brand-mark i { clip-path: polygon(72% 44%, 100% 44%, 100% 100%, 75% 100%, 70% 81%, 87% 81%, 87% 63%, 72% 63%); }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 8px;
  color: #e4ecf4;
  font-size: 13px;
  font-weight: 600;
}
.sidebar nav a:hover { background: var(--ocean); }
.sidebar nav a[aria-current] { background: var(--gold); color: var(--navy); font-weight: 820; }
.sidebar nav a[aria-current]:hover { background: var(--gold-light); }
.nav-icon { position: relative; display: inline-block; width: 17px; height: 17px; flex: none; color: currentColor; }
.nav-icon::before, .nav-icon::after { content: ""; position: absolute; display: block; }
.nav-icon.market::before { width: 11px; height: 11px; inset: 3px; border: 1.5px solid currentColor; transform: rotate(45deg); border-radius: 2px; }
.nav-icon.market::after { width: 4px; height: 4px; inset: 6.5px; background: currentColor; transform: rotate(45deg); }
.nav-icon.orders::before { inset: 1px 2px; border: 1.5px solid currentColor; border-radius: 2px; }
.nav-icon.orders::after { inset: 5px 5px 6px; border-block: 1.5px solid currentColor; }
.nav-icon.account::before { width: 6px; height: 6px; inset: 0 5.5px auto; border: 1.5px solid currentColor; border-radius: 50%; }
.nav-icon.account::after { width: 13px; height: 6px; inset: auto 2px 1px; border: 1.5px solid currentColor; border-radius: 6px 6px 2px 2px; }
.nav-icon.admin::before { inset: 3px 1px; border-block: 1.5px solid currentColor; }
.nav-icon.admin::after { width: 15px; height: 1.5px; inset: 7.75px 1px; background: currentColor; }
.sidebar-account { margin-top: auto; padding: 14px 5px 1px; border-top: 1px solid var(--dark-line); display: flex; gap: 9px; align-items: center; }
.sidebar-account > div:nth-child(2) { min-width: 0; }
.sidebar-account strong, .sidebar-account small { display: block; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.sidebar-account strong { font-size: 12px; }
.sidebar-account small { font-size: 11px; color: var(--dark-muted); }
.sidebar-account form { margin-inline-start: auto; }
.avatar, .exit { display: grid; flex: none; place-items: center; width: 35px; height: 35px; }
.avatar { border-radius: 50%; background: var(--ocean); color: var(--gold-light); font-weight: 800; }
.exit { border-radius: 7px; border: 1px solid var(--dark-line); background: transparent; color: white; }
.exit:hover { background: var(--ocean); }

.app-body main { width: min(100%, 1510px); margin: 0 auto; padding: 27px clamp(22px, 3.25vw, 48px) 50px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding-bottom: 18px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: clamp(25px, 2.9vw, 36px); line-height: 1.4; font-weight: 860; letter-spacing: -.025em; }
.page-head p { font-size: 13px; color: var(--muted); margin-top: 3px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.section-head h2 { font-size: 17px; font-weight: 820; }
.section-head > span:not(.pill) { font-size: 12px; color: var(--muted); }
.card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 6px #101f3508; }
.rate-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.rate-card {
  padding: 13px 15px 12px;
  background: linear-gradient(145deg, #1d344c, var(--navy) 76%);
  color: white;
  border: 1px solid #374e66;
  border-block-start-color: var(--gold);
  box-shadow: none;
}
.rate-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.rate-heading > div { min-width: 0; flex: 1; }
.rate-heading h3 { font-size: 14px; font-weight: 790; }
.rate-heading small { display: block; color: var(--dark-muted); font-size: 11px; margin-top: 1px; }
.rate-heading .pill { margin-inline-start: auto; }
.metal { flex: none; display: grid; place-items: center; width: 35px; height: 35px; border-radius: 8px; background: #ffffff09; border: 1px solid var(--dark-line); color: var(--gold-light); }
.metal i { width: 16px; height: 16px; border: 1.5px solid currentColor; border-radius: 50%; box-shadow: 0 0 0 2px var(--navy) inset, 0 0 0 3px currentColor inset; }
.metal.gold i { width: 18px; height: 12px; border-radius: 2px; transform: skew(-13deg); box-shadow: none; }
.metal.half i { width: 13px; height: 13px; }
.rate-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; border-top: 1px solid var(--dark-line); padding-top: 9px; }
.rate-values > div + div { border-inline-start: 1px solid var(--dark-line); padding-inline-start: 8px; }
.rate-values span, .rate-values strong { display: block; }
.rate-values span { color: var(--dark-muted); font-size: 11px; }
.rate-values strong { font-size: clamp(13px, 1.55vw, 21px); font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.rate-time { color: var(--dark-muted); font-size: 10px; margin-top: 7px; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 760; padding: 4px 7px; border-radius: 5px; line-height: 1.5; white-space: nowrap; }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.demo, .pill.pending { color: var(--warn-text); background: var(--warn-bg); }
.pill.active, .pill.approved, .pill.settled { color: var(--buy-text); background: var(--buy-bg); }
.pill.muted, .pill.cancelled { color: var(--muted); background: var(--subtle-surface); }
.pill.rejected { color: var(--sell-text); background: var(--sell-bg); }
.rate-card .pill.active { color: #b8f2d5; background: #214839; }
.rate-card .pill.muted { color: #e0e9f2; background: #394b5e; }

.trade-grid { display: grid; grid-template-columns: minmax(270px, 1fr) minmax(0, 1.45fr); gap: 14px; margin-top: 18px; align-items: start; }
.panel { padding: 17px; scroll-margin-top: 12px; }
.panel-head { padding-bottom: 11px; border-bottom: 1px solid var(--line); margin-bottom: 13px; }
.text-link { font-size: 12px; color: var(--ocean); font-weight: 780; white-space: nowrap; }
.text-link:hover { text-decoration: underline; }
.trade-form { display: grid; gap: 11px; }
.field { display: grid; gap: 4px; }
.field label, .stack label, .filters label { font-size: 13px; font-weight: 720; }
.segment { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; padding: 4px; margin: 0 0 2px; border: 1px solid var(--line); background: var(--subtle-surface); border-radius: 8px; min-inline-size: 0; }
.segment label { position: relative; display: block; cursor: pointer; }
.segment input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.segment span { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; border: 1px solid transparent; border-radius: 6px; padding: 6px; color: var(--muted); font-weight: 760; font-size: 13px; }
.segment input:not(:checked):hover + span { background: white; color: var(--ink); }
.segment input[value="buy"]:checked + span { color: white; background: var(--buy); }
.segment input[value="sell"]:checked + span { color: white; background: var(--sell); }
.segment input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
input:not([type=checkbox]):not([type=radio]), select {
  border: 1px solid var(--field-line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 7px;
  min-height: 43px;
  padding: 8px 11px;
  min-width: 0;
  width: 100%;
}
.input-unit { position: relative; }
.input-unit input { padding-inline-end: 55px !important; }
.input-unit span { position: absolute; inset-inline-end: 11px; top: 11px; color: var(--muted); pointer-events: none; font-size: 12px; }
.estimate { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 11px; background: var(--subtle-surface); border-radius: 7px; font-size: 12px; }
.estimate > span, .estimate small { color: var(--muted); }
.estimate strong { font-size: 16px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.estimate small { font-size: 11px; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 8px 13px; border-radius: 7px; border: 1px solid transparent; font-weight: 800; font-size: 13px; }
.primary { background: var(--gold); color: var(--navy); border-color: #9b7946; }
.primary:hover:not(:disabled) { background: var(--gold-light); }
.primary:active:not(:disabled) { background: #b28d50; }
.primary.with-arrow { justify-content: space-between; }
.primary.with-arrow span { font-size: 20px; line-height: 1; }
.secondary { background: white; color: var(--ink); border-color: var(--field-line); }
.secondary:hover { background: var(--subtle-surface); }
.secondary.positive { color: var(--buy-text); background: var(--buy-bg); border-color: #549078; }
.secondary.small { min-height: 32px; padding: 4px 8px; font-size: 11px; white-space: nowrap; }
.narrow { max-width: 560px; }
.empty { display: grid; min-height: 138px; justify-items: center; align-content: center; gap: 9px; padding: 13px; color: var(--muted); text-align: center; font-size: 13px; }
.empty-icon { display: grid; place-items: center; border-radius: 8px; width: 35px; height: 35px; color: var(--ocean); background: var(--subtle-surface); font-size: 17px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: start; font-size: 12px; }
thead { background: var(--subtle-surface); }
th, td { padding: 10px 8px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 11px; font-weight: 750; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:target { background: var(--warn-bg); }
td small { display: block; margin-top: 3px; color: var(--muted); white-space: nowrap; font-size: 10px; }
td strong { font-weight: 760; }
.details { margin-bottom: 15px; }
.details > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.details dt { color: var(--muted); }
.details dd { font-weight: 780; text-align: end; }
.actions, .row-actions, .pagination { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pagination { justify-content: end; padding-top: 14px; }
.filters { display: flex; align-items: center; gap: 8px; margin-bottom: 13px; flex-wrap: wrap; }
.filters select { width: auto; min-width: 140px; max-width: 100%; }
.notice { display: block; padding: 11px 13px; margin-bottom: 15px; background: var(--warn-bg); color: var(--warn-text); border: 1px solid #e3d1a3; border-radius: 7px; font-size: 13px; }
.notice.error { background: var(--sell-bg); color: var(--sell-text); border-color: #e7bdc4; }
.notice.success { background: var(--buy-bg); color: var(--buy-text); border-color: #b6d8c8; }
.subtle { color: var(--muted); }
.stack { display: grid; gap: 7px; }
.stack input { margin-bottom: 6px; }
.stack h3 { font-size: 15px; margin-bottom: 4px; }
.stack .primary { margin-top: 6px; }
.stack .checkbox { display: flex; align-items: center; min-height: 30px; gap: 7px; padding: 3px 0; }
.stack .checkbox input { accent-color: var(--ocean); margin: 0; }
.admin-section + .admin-section { margin-top: 19px; }

.guest-body main { display: grid; align-content: center; min-height: 100dvh; padding: 22px; }
.guest-body main > .notice { width: min(850px, 100%); margin-inline: auto; }
.login-shell {
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1fr .95fr;
  width: min(850px, 100%);
  min-height: 447px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 12px 42px #101f351a;
}
.login-brand {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 32px 21px;
  color: white;
  text-align: center;
  background: linear-gradient(143deg, #203b57, var(--navy) 55%, #0a1829);
}
.login-brand::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -80px -100px auto auto;
  width: 510px;
  height: 184px;
  transform: rotate(-34deg);
  background: linear-gradient(180deg, transparent, #7083981a);
  border-bottom: 1px solid #526c862f;
}
.login-brand::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: auto -65px -136px -120px;
  height: 231px;
  transform: skewY(-26deg);
  background: repeating-linear-gradient(177deg, #c5a46d50 0 1px, transparent 1px 6px);
  border-top: 2px solid var(--gold);
  opacity: .7;
}
.login-brand-inner { display: grid; justify-items: center; padding-bottom: 15px; }
.login-brand .brand-mark { width: clamp(74px, 8vw, 124px); margin-bottom: 17px; }
.login-brand .latin-wordmark { font-size: clamp(16px, 2.1vw, 29px); }
.login-brand h1 { margin-top: 9px; color: var(--gold-light); font-size: 22px; font-weight: 850; }
.brand-description { margin-top: 7px; color: var(--dark-muted); font-size: 13px; }
.login-content { padding: clamp(24px, 4vw, 50px); align-self: center; min-width: 0; }
.login-content h2 { margin-bottom: 21px; font-size: 25px; font-weight: 840; }
.login-content .notice { overflow-wrap: anywhere; }
.error-page { width: min(560px, 100%); margin-inline: auto; }
.error-page p { margin: 9px 0 15px; }

@media (max-width: 1120px) {
  .app-body { grid-template-columns: 199px minmax(0, 1fr); }
  .rate-heading .pill { margin-inline-start: 0; }
}
@media (max-width: 870px) {
  .trade-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .app-body { display: block; }
  .sidebar {
    position: static;
    height: auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 6px;
    row-gap: 10px;
    padding: 11px 13px 8px;
  }
  .brand { padding: 1px 0 2px; border: 0; width: fit-content; }
  .sidebar nav { grid-row: 2; grid-column: 1 / -1; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
  .sidebar nav a { flex-direction: column; justify-content: center; gap: 3px; padding: 5px 1px; min-height: 44px; font-size: 11px; text-align: center; }
  .sidebar-account { margin: 0; padding: 0; border: 0; grid-column: 2; grid-row: 1; }
  .sidebar-account .avatar, .sidebar-account > div:nth-child(2) { display: none; }
  .exit { width: 40px; height: 40px; }
  .app-body main { padding: 16px 13px 34px; }
  input:not([type=checkbox]):not([type=radio]), select { font-size: 16px; }
  .rate-grid { gap: 8px; }
  .rate-card { padding: 10px; }
}
@media (max-width: 515px) {
  .page-head { align-items: start; padding-bottom: 12px; margin-bottom: 14px; }
  .page-head p { font-size: 12px; }
  .page-head .primary { flex: none; align-self: center; }
  .rate-grid { grid-template-columns: minmax(0, 1fr); }
  .rate-card { padding: 9px 11px; }
  .rate-heading { margin-bottom: 6px; }
  .rate-heading .pill { margin-inline-start: auto; }
  .metal { width: 29px; height: 29px; }
  .rate-values { padding-top: 5px; }
  .rate-values strong { font-size: 16px; }
  .rate-time { margin-top: 3px; }
  .panel { padding: 13px; }
  .guest-body main { padding: 12px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { padding: 19px 16px; }
  .login-brand::after { bottom: -171px; }
  .login-brand-inner { padding-bottom: 0; }
  .login-brand .brand-mark { width: 66px; margin-bottom: 8px; }
  .login-brand .latin-wordmark { font-size: 18px; }
  .login-brand h1 { font-size: 20px; margin-top: 5px; }
  .brand-description { margin-top: 3px; }
  .login-content { padding: 21px; }
  .login-content h2 { margin-bottom: 15px; }
}

@media (forced-colors: active) {
  .segment input:checked + span, .sidebar nav a[aria-current] { border: 2px solid Highlight; color: Highlight; }
  .brand-mark::before, .brand-mark::after, .brand-mark i { background: CanvasText; forced-color-adjust: none; }
}
