
:root {
  --ink: #151513;
  --muted: #73716b;
  --line: #e9e5dc;
  --surface: #ffffff;
  --paper: #f5f3ee;
  --gold: #b4872e;
  --gold-dark: #8b641c;
  --gold-soft: #f4ead3;
  --green: #16895c;
  --red: #c24f4f;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100dvh;
  padding-bottom: 32px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(40, 38, 32, 0.08);
  background: rgba(250, 249, 246, 0.92);
  backdrop-filter: blur(18px);
}

.topbar-inner,
.dashboard {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar-inner {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  color: inherit;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(145deg, #dec079, #9a6c18);
  color: #15120b;
  font: 700 22px Georgia, serif;
  box-shadow: 0 7px 24px rgba(164, 116, 29, 0.2);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-copy b {
  font-size: 16px;
  letter-spacing: -0.3px;
}

.brand-copy small {
  color: var(--muted);
  font-size: 10px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.connection {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 6px;
  color: #4f554f;
  font-size: 12px;
}

.connection i,
.live-badge > span {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: #20a66d;
  box-shadow: 0 0 0 4px rgba(32, 166, 109, 0.11);
}

.icon-button,
.avatar,
.modal-close {
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}

.icon-button {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 12px;
}

.icon-button.active {
  color: var(--gold-dark);
  border-color: #decfae;
  background: #fffaf0;
}

.avatar {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: #252421;
  font-weight: 700;
  text-decoration: none;
}

.dashboard {
  padding: 36px 0 0;
}

.welcome-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 7px;
  color: var(--gold-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.welcome-row h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -1.1px;
}

.subtle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.install-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid #d7d1c4;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 0.88fr;
  gap: 14px;
}

.balance-card,
.market-card,
.prices-panel,
.side-panel {
  border: 1px solid var(--line);
  border-radius: 21px;
  background: var(--surface);
  box-shadow: 0 8px 35px rgba(58, 49, 30, 0.04);
}

.balance-card,
.market-card {
  min-height: 180px;
  padding: 20px 22px;
}

.gold-balance {
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 4% 0%, rgba(213, 174, 91, 0.22), transparent 38%), linear-gradient(135deg, #fffdf8, #f8f0de);
  border-color: #e2d1a9;
}

.gold-balance::after {
  content: "D";
  position: absolute;
  left: -8px;
  bottom: -40px;
  color: rgba(161, 115, 31, 0.055);
  font: 700 145px Georgia, serif;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
}

.card-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--gold-dark);
  background: var(--gold-soft);
}

.rial-balance .card-icon {
  color: #3a6259;
  background: #e9f2ef;
}

.demo-badge {
  padding: 5px 8px;
  border: 1px solid rgba(147, 102, 25, 0.16);
  border-radius: 99px;
  color: #805b1b;
  background: rgba(255, 255, 255, 0.56);
  font-size: 9px;
}

.balance-card > p {
  margin: 16px 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.balance-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.balance-value strong {
  font-size: clamp(23px, 2.3vw, 29px);
  letter-spacing: -0.8px;
}

.balance-value span,
.balance-card > small {
  color: var(--muted);
  font-size: 10px;
}

.balance-card > small {
  display: block;
  margin-top: 8px;
}

.text-link {
  padding: 0;
  border: 0;
  color: var(--gold-dark);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.market-card {
  color: #f4f1e8;
  background: radial-gradient(circle at 12% 12%, rgba(197, 150, 58, 0.18), transparent 36%), #171715;
  border-color: #171715;
}

.market-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cfcabf;
  font-size: 11px;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #37ca89;
  box-shadow: 0 0 0 5px rgba(55, 202, 137, 0.12);
}

.pulse.closed {
  background: #bd5858;
  box-shadow: 0 0 0 5px rgba(189, 88, 88, 0.12);
}

.market-card > strong {
  display: block;
  margin-top: 19px;
  font-size: 26px;
  direction: ltr;
  text-align: right;
  letter-spacing: 1px;
}

.market-card > p {
  margin: 5px 0 15px;
  color: #89877f;
  font-size: 10px;
}

.market-tags {
  display: flex;
  gap: 6px;
}

.market-tags span {
  padding: 5px 8px;
  border-radius: 99px;
  font-size: 9px;
}

.market-tags .open {
  color: #71dbaa;
  background: rgba(31, 159, 103, 0.13);
}

.market-tags .closed {
  color: #aaa8a2;
  background: rgba(255, 255, 255, 0.07);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 14px;
  margin-top: 14px;
}

.prices-panel,
.side-panel {
  padding: 22px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin-bottom: 17px;
}

.section-heading h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.5px;
}

.section-heading.compact {
  margin-bottom: 12px;
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
}

.live-badge small {
  padding-right: 8px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  font-weight: 400;
}

.live-badge b {
  font-size: inherit;
}

.live-badge.paused,
.live-badge.paused > span {
  color: #a75555;
}

.live-badge.paused > span {
  background: #bd5858;
  box-shadow: 0 0 0 4px rgba(189, 88, 88, 0.11);
}

.price-head,
.price-row {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr 0.8fr;
  align-items: center;
  gap: 12px;
}

.price-head {
  padding: 0 14px 10px;
  color: #94918a;
  font-size: 9px;
}

.price-row {
  position: relative;
  min-height: 76px;
  padding: 12px 14px;
  border-top: 1px solid #efede8;
}

.price-name,
.price-number {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.price-name b,
.price-number strong {
  font-size: 12px;
}

.price-name small,
.price-number small {
  color: #9a9790;
  font-size: 8px;
}

.price-number strong {
  font-variant-numeric: tabular-nums;
  transition: color 140ms ease;
}

.flash-up .price-number:first-of-type strong {
  color: var(--green);
}

.flash-down .price-number:first-of-type strong {
  color: var(--red);
}

.price-number.sell strong {
  color: #685125;
}

.price-change {
  min-width: 70px;
}

.price-change > span {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  font-size: 10px;
  direction: ltr;
}

.price-change.up {
  color: var(--green);
}

.price-change.down {
  color: var(--red);
}

.price-change.flat {
  color: #88857f;
}

.mini-chart {
  width: 64px;
  height: 25px;
  display: block;
  margin: 0 0 2px auto;
  overflow: visible;
}

.mini-chart polyline {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.data-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 13px 0 0;
  padding: 10px 12px 0;
  border-top: 1px dashed #e7e3db;
  color: #98948b;
  font-size: 9px;
}

.quick-actions {
  display: flex;
  flex-direction: column;
}

.quick-actions button {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 11px;
  padding: 13px 0;
  border: 0;
  border-bottom: 1px solid #efede8;
  background: transparent;
  cursor: pointer;
  text-align: right;
}

.quick-actions button > span:nth-child(2) {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quick-actions b {
  font-size: 11px;
}

.quick-actions small {
  color: var(--muted);
  font-size: 8px;
}

.quick-actions button > svg {
  color: #aaa69e;
  transform: rotate(180deg);
}

.action-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
}

.action-icon.buy {
  color: var(--green);
  background: #e8f5ef;
}

.action-icon.sell {
  color: var(--red);
  background: #faeeee;
}

.action-icon.wallet {
  color: var(--gold-dark);
  background: #f6efdf;
}

.trust-box {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  padding: 14px;
  border-radius: 14px;
  color: #494741;
  background: #f6f4ef;
}

.trust-box > svg {
  flex: 0 0 auto;
  color: var(--gold-dark);
}

.trust-box b {
  font-size: 10px;
}

.trust-box p {
  margin: 5px 0 0;
  color: #8f8b83;
  font-size: 8px;
  line-height: 1.8;
}

.mobile-nav {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(12, 12, 11, 0.62);
  backdrop-filter: blur(7px);
  animation: fade-in 180ms ease-out;
}

.balance-modal {
  position: relative;
  width: min(440px, 100%);
  padding: 29px;
  border: 1px solid #e3d7bc;
  border-radius: 24px;
  background: #fffdfa;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
  animation: modal-in 240ms ease-out;
}

.modal-close {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #88847d;
}

.modal-logo {
  width: 51px;
  height: 51px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 16px;
  color: #1b1710;
  background: linear-gradient(145deg, #ebce8c, #a97b24);
}

.modal-kicker {
  color: var(--gold-dark);
  font-size: 10px;
  font-weight: 700;
}

.balance-modal h2 {
  margin: 7px 0 7px;
  font-size: 21px;
  letter-spacing: -0.7px;
}

.balance-modal > p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
}

.modal-balances {
  margin: 19px 0 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
  background: #fff;
}

.modal-balances > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 15px;
}

.modal-balances > div + div {
  border-top: 1px solid var(--line);
}

.modal-balances span {
  color: var(--muted);
  font-size: 10px;
}

.modal-balances strong {
  font-size: 13px;
}

.modal-balances small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 400;
}

.modal-updated {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  color: #9a968e;
  font-size: 8px;
}

.modal-updated button {
  padding: 0;
  border: 0;
  color: var(--gold-dark);
  background: transparent;
  cursor: pointer;
  font-size: 8px;
  font-weight: 700;
}

.primary-button,
.danger-button,
.review-button {
  min-height: 44px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.primary-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #171714;
  color: #fff;
  background: #171714;
}

.secondary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.danger-button {
  border: 1px solid #efcccc;
  color: #b54848;
  background: #fff7f7;
}

.review-button {
  border: 1px solid #ded7c9;
  color: #635d51;
  background: #f9f7f2;
}

.modal-footnote {
  display: block;
  margin-top: 13px;
  color: #aaa69e;
  text-align: center;
  font-size: 8px;
}

.toast {
  position: fixed;
  right: 50%;
  bottom: 24px;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  color: white;
  background: #20201e;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  font-size: 10px;
  transform: translateX(50%);
  animation: toast-in 220ms ease-out;
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(50%, 10px); }
}

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

  .market-card {
    grid-column: 1 / -1;
    min-height: 155px;
  }

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

  .side-panel {
    display: none;
  }
}

@media (max-width: 640px) {
  body {
    background: #f7f5f0;
  }

  .app-shell {
    padding-bottom: calc(91px + env(safe-area-inset-bottom));
  }

  .topbar-inner,
  .dashboard {
    width: min(100% - 28px, 1180px);
  }

  .topbar-inner {
    height: 66px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .brand-copy b {
    font-size: 14px;
  }

  .connection,
  .brand-copy small {
    display: none;
  }

  .dashboard {
    padding-top: 25px;
  }

  .welcome-row {
    align-items: flex-start;
    margin-bottom: 19px;
  }

  .welcome-row h1 {
    font-size: 22px;
  }

  .eyebrow {
    font-size: 9px;
  }

  .install-button {
    width: 42px;
    min-width: 42px;
    height: 42px;
    overflow: hidden;
    padding: 0;
    justify-content: center;
    color: var(--gold-dark);
    font-size: 0;
  }

  .summary-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .balance-card,
  .market-card {
    min-height: 158px;
    padding: 18px;
    border-radius: 18px;
  }

  .market-card {
    grid-column: auto;
  }

  .balance-value strong {
    font-size: 26px;
  }

  .content-grid {
    margin-top: 10px;
  }

  .prices-panel {
    padding: 18px 0 14px;
    border-radius: 18px;
  }

  .section-heading {
    padding: 0 17px;
  }

  .price-head {
    display: none;
  }

  .price-row {
    grid-template-columns: 1.1fr 1fr 1fr;
    gap: 7px;
    min-height: 84px;
    padding: 13px 17px;
  }

  .price-change {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 0;
    margin-top: -11px;
  }

  .price-change > span {
    min-width: 47px;
  }

  .mini-chart {
    width: 57px;
    height: 20px;
    margin: 0 0 0 8px;
  }

  .price-name b,
  .price-number strong {
    font-size: 11px;
  }

  .price-number.sell {
    text-align: left;
  }

  .data-note {
    margin: 10px 17px 0;
    line-height: 1.8;
  }

  .mobile-nav {
    position: fixed;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 12px;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: 67px;
    padding: 7px 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 19px;
    background: rgba(23, 23, 21, 0.97);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(18px);
  }

  .mobile-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 0;
    border-radius: 13px;
    color: #85837d;
    background: transparent;
    font-size: 8px;
  }

  .mobile-nav button.active {
    color: #e8c97f;
    background: rgba(225, 190, 108, 0.08);
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .balance-modal {
    width: 100%;
    padding: 26px 20px calc(22px + env(safe-area-inset-bottom));
    border-radius: 25px 25px 0 0;
    animation-name: sheet-in;
  }

  .modal-logo {
    width: 46px;
    height: 46px;
  }

  .balance-modal h2 {
    font-size: 19px;
  }

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

  .toast {
    bottom: calc(90px + env(safe-area-inset-bottom));
    white-space: nowrap;
  }
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(40px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Admin market controls */
.admin-shell {
  min-height: 100dvh;
  padding-bottom: 120px;
  background: #f4f2ed;
}

.admin-topbar {
  border-bottom: 1px solid #e6e2d9;
  background: #fff;
}

.admin-topbar-inner,
.admin-main {
  width: min(1060px, calc(100% - 40px));
  margin: 0 auto;
}

.admin-topbar-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 10px;
}

.admin-user span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #6d6961;
}

.admin-user a {
  padding: 7px 10px;
  border: 1px solid #e5e1d8;
  border-radius: 9px;
  color: #6d6961;
  text-decoration: none;
}

.admin-main {
  padding-top: 38px;
}

.admin-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 13px;
  color: var(--gold-dark);
  text-decoration: none;
  font-size: 10px;
  font-weight: 700;
}

.back-link svg {
  transform: rotate(180deg);
}

.admin-intro h1 {
  margin: 0;
  font-size: clamp(24px, 3.1vw, 33px);
  letter-spacing: -1.2px;
}

.admin-intro p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.admin-state {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
}

.admin-state span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.admin-state.open {
  border-color: #cbe5d9;
  color: #197b56;
  background: #f1faf6;
}

.admin-state.open span {
  background: #1a9a65;
}

.admin-state.closed {
  border-color: #ebcece;
  color: #a74343;
  background: #fff5f5;
}

.admin-state.closed span {
  background: #bd4e4e;
}

.admin-notice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 23px 0 14px;
  padding: 14px 16px;
  border: 1px solid #dfd4ba;
  border-radius: 14px;
  color: #5b4a27;
  background: #fbf6e9;
}

.admin-notice > svg {
  flex: 0 0 auto;
  color: #9c7425;
}

.admin-notice b {
  font-size: 10px;
}

.admin-notice p {
  margin: 4px 0 0;
  color: #84775d;
  font-size: 9px;
  line-height: 1.7;
}

.admin-loading {
  padding: 70px 0;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}

.market-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.market-setting-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: #fff;
  box-shadow: 0 8px 30px rgba(45, 38, 24, 0.035);
}

.setting-title,
.schedule-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.setting-title > div,
.schedule-toggle > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.market-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.market-dot.open {
  background: #22a66e;
  box-shadow: 0 0 0 5px #e6f5ee;
}

.market-dot.closed {
  background: #c55757;
  box-shadow: 0 0 0 5px #f9eaea;
}

.setting-title h2 {
  margin: 0;
  font-size: 15px;
}

.setting-title p,
.schedule-toggle small {
  margin: 4px 0 0;
  color: #928f87;
  font-size: 8px;
}

.switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch > span {
  position: relative;
  width: 39px;
  height: 23px;
  border-radius: 99px;
  background: #ddd9d1;
  transition: background 150ms ease;
}

.switch > span::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.17);
  transition: transform 160ms ease;
}

.switch input:checked + span {
  background: #1c9564;
}

.switch input:checked + span::after {
  transform: translateX(-16px);
}

.switch b {
  min-width: 27px;
  color: #716d64;
  font-size: 9px;
}

.switch.small > span {
  width: 34px;
  height: 20px;
}

.switch.small > span::after {
  width: 14px;
  height: 14px;
}

.switch.small input:checked + span::after {
  transform: translateX(-14px);
}

.schedule-toggle {
  margin-top: 22px;
  padding: 14px 0;
  border-top: 1px solid #efede7;
  border-bottom: 1px solid #efede7;
}

.schedule-toggle > div > svg {
  color: var(--gold-dark);
}

.schedule-toggle span {
  display: flex;
  flex-direction: column;
}

.schedule-toggle b {
  font-size: 10px;
}

.schedule-fields {
  margin: 15px 0 0;
  padding: 0;
  border: 0;
  transition: opacity 150ms ease;
}

.schedule-fields:disabled {
  opacity: 0.42;
}

.time-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.time-fields label,
.day-field > span {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #7e7a72;
  font-size: 8px;
}

.time-fields input {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid #ddd9d0;
  border-radius: 10px;
  outline: none;
  color: #292722;
  background: #faf9f6;
  direction: ltr;
}

.time-fields input:focus {
  border-color: #bd9b56;
  box-shadow: 0 0 0 3px rgba(189, 155, 86, 0.1);
}

.day-field {
  margin-top: 14px;
}

.day-field > div {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin-top: 7px;
}

.day-field button {
  aspect-ratio: 1;
  border: 1px solid #e1ddd5;
  border-radius: 9px;
  color: #7f7b72;
  background: #faf9f6;
  cursor: pointer;
  font-size: 9px;
}

.day-field button.active {
  border-color: #c9a75f;
  color: #6d4c12;
  background: #f7edda;
  font-weight: 700;
}

.emergency-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 14px;
  padding: 16px 18px;
  border: 1px solid #eccdcd;
  border-radius: 16px;
  background: #fffafa;
}

.emergency-panel > div {
  display: flex;
  align-items: center;
  gap: 11px;
}

.emergency-icon {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 11px;
  color: #b24b4b;
  background: #faeaea;
}

.emergency-panel b {
  font-size: 10px;
}

.emergency-panel p {
  margin: 4px 0 0;
  color: #8e8981;
  font-size: 8px;
}

.emergency-panel button {
  min-height: 39px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid #cc5a5a;
  border-radius: 10px;
  color: #fff;
  background: #bd4f4f;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
}

.admin-message {
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid;
  border-radius: 11px;
  font-size: 9px;
}

.admin-message.success {
  border-color: #cce3d8;
  color: #18724f;
  background: #f1f9f5;
}

.admin-message.error {
  border-color: #eccfcf;
  color: #a24242;
  background: #fff4f4;
}

.admin-savebar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: min(35vw, 370px);
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid #e4dfd5;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.admin-savebar span {
  color: #8a867e;
  font-size: 8px;
}

.admin-savebar button {
  min-width: 156px;
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #1d1c19;
  border-radius: 11px;
  color: #fff;
  background: #1d1c19;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.admin-savebar button:disabled {
  cursor: wait;
  opacity: 0.55;
}

@media (max-width: 720px) {
  .admin-topbar-inner,
  .admin-main {
    width: min(100% - 28px, 1060px);
  }

  .admin-topbar-inner {
    min-height: 66px;
  }

  .admin-user span {
    display: none;
  }

  .admin-main {
    padding-top: 26px;
  }

  .admin-intro {
    align-items: flex-start;
  }

  .admin-intro h1 {
    font-size: 23px;
  }

  .admin-intro p {
    line-height: 1.8;
  }

  .admin-state {
    flex: 0 0 auto;
    padding: 8px;
    font-size: 0;
  }

  .market-settings-grid {
    grid-template-columns: 1fr;
  }

  .market-setting-card {
    padding: 18px;
  }

  .emergency-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .emergency-panel button {
    min-height: 43px;
  }

  .admin-savebar {
    justify-content: stretch;
    min-height: 70px;
  }

  .admin-savebar span {
    display: none;
  }

  .admin-savebar button {
    width: 100%;
  }
}

.hidden {
  display: none !important;
}

.connection.offline {
  color: #a75454;
}

.connection.offline i {
  background: #bd5858;
  box-shadow: 0 0 0 4px rgba(189, 88, 88, 0.11);
}

.auth-body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 15% 5%, rgba(190, 146, 58, 0.14), transparent 30%), #11110f;
}

.auth-card {
  width: min(430px, 100%);
  padding: 30px;
  border: 1px solid #dcd2bd;
  border-radius: 24px;
  background: #fffdfa;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
}

.install-card {
  width: min(650px, 100%);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.auth-brand > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-brand b {
  font-size: 14px;
}

.auth-brand small,
.auth-card > p {
  color: var(--muted);
  font-size: 10px;
}

.auth-card h1 {
  margin: 7px 0 8px;
  font-size: 23px;
  letter-spacing: -0.7px;
}

.auth-card > p {
  margin: 0 0 20px;
  line-height: 1.9;
}

.form-grid {
  display: grid;
  gap: 12px;
}

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

.form-grid label,
.admin-price-card label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #736f67;
  font-size: 9px;
}

.form-grid input,
.admin-price-card input,
.admin-user-create input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #dcd7cd;
  border-radius: 11px;
  outline: none;
  color: #24221e;
  background: #fff;
}

.form-grid input:focus,
.admin-price-card input:focus,
.admin-user-create input:focus {
  border-color: #ba9450;
  box-shadow: 0 0 0 3px rgba(186, 148, 80, 0.12);
}

.auth-card hr {
  margin: 20px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.auth-submit {
  min-height: 46px;
  margin-top: 16px;
  text-decoration: none;
}

.auth-footnote {
  display: block;
  margin-top: 14px;
  color: #9c988f;
  text-align: center;
  font-size: 8px;
}

.auth-error,
.auth-success {
  margin: 15px 0;
  padding: 12px 14px;
  border: 1px solid;
  border-radius: 12px;
  font-size: 10px;
  line-height: 1.9;
}

.auth-error {
  border-color: #eacbcb;
  color: #9f4141;
  background: #fff3f3;
}

.auth-success {
  border-color: #c9e1d5;
  color: #246f54;
  background: #f0f9f4;
}

.auth-success p {
  margin: 7px 0;
}

.auth-success code {
  display: block;
  direction: ltr;
  overflow-wrap: anywhere;
  padding: 10px;
  border-radius: 8px;
  color: #2d2b26;
  background: #fff;
  font-size: 9px;
}

.admin-section-title {
  margin: 28px 0 13px;
  font-size: 15px;
}

.admin-price-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-price-card {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, 1fr);
  align-items: end;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}

.admin-price-card > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-self: center;
}

.admin-price-card b {
  font-size: 11px;
}

.admin-price-card small {
  color: var(--muted);
  font-size: 8px;
}

.admin-price-card input {
  min-height: 38px;
  direction: ltr;
}

.admin-users-section {
  margin-top: 34px;
}

.admin-user-create {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}

.admin-user-create h3 {
  margin: 0 0 12px;
  font-size: 11px;
}

.admin-user-create form {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap: 8px;
}

.admin-user-create button,
.adjust-button {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid #22211e;
  border-radius: 10px;
  color: #fff;
  background: #22211e;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
}

.users-table-wrap {
  margin-top: 10px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}

.users-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  text-align: right;
}

.users-table th,
.users-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #efede8;
  font-size: 9px;
}

.users-table th {
  color: #8d8981;
  background: #faf9f6;
  font-weight: 500;
}

.users-table td:first-child {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.users-table td small {
  color: #99958d;
  font-size: 7px;
}

.mobile-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 13px;
  color: #85837d;
  text-decoration: none;
  font-size: 8px;
}

.quick-actions button > i {
  color: #aaa69e;
  font-style: normal;
}

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

@media (max-width: 640px) {
  .auth-body {
    align-items: end;
    padding: 0;
  }

  .auth-card {
    width: 100%;
    padding: 26px 20px calc(24px + env(safe-area-inset-bottom));
    border-radius: 25px 25px 0 0;
  }

  .form-grid.two,
  .admin-user-create form {
    grid-template-columns: 1fr;
  }

  .admin-price-card {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .admin-price-card > div {
    grid-column: 1 / -1;
  }
}
