:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #090b12;
  color: #f6f7fb;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% -10%, rgba(93, 74, 255, .22), transparent 34%),
    radial-gradient(circle at -10% 35%, rgba(0, 179, 255, .12), transparent 28%),
    #090b12;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.app {
  width: min(100%, 560px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px calc(34px + env(safe-area-inset-bottom));
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.header > div {
  display: flex;
  align-items: center;
  gap: 11px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: linear-gradient(145deg, #6857ff, #00b6ff);
  box-shadow: 0 10px 28px rgba(81, 82, 255, .28);
  font-weight: 900;
}
h1, h2, p { margin: 0; }
h1 { font-size: 18px; letter-spacing: -.02em; }
.header p { margin-top: 2px; color: #80889d; font-size: 12px; }
.readonly {
  padding: 7px 9px;
  border: 1px solid rgba(54, 226, 161, .24);
  border-radius: 999px;
  background: rgba(54, 226, 161, .08);
  color: #49e3a5;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
}

.panel, .hero-card, .position-card, .metrics article, .deal {
  border: 1px solid rgba(255,255,255,.075);
  background: rgba(18, 21, 32, .88);
  box-shadow: 0 18px 50px rgba(0,0,0,.18);
  backdrop-filter: blur(18px);
}
.panel {
  padding: 18px;
  border-radius: 22px;
}
.panel-title { margin-bottom: 18px; }
.panel-title h2 { font-size: 20px; }
.panel-title p, .security-note {
  margin-top: 5px;
  color: #858da0;
  font-size: 13px;
  line-height: 1.45;
}
form { display: grid; gap: 14px; }
label { display: grid; gap: 7px; }
label span { color: #aab0c0; font-size: 12px; font-weight: 650; }
input, textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 13px;
  background: #0d1019;
  color: #f7f8fc;
  outline: none;
}
input { min-height: 48px; padding: 0 13px; }
textarea { resize: vertical; padding: 13px; line-height: 1.4; }
input:focus, textarea:focus {
  border-color: #6255ff;
  box-shadow: 0 0 0 3px rgba(98,85,255,.15);
}
.primary {
  min-height: 48px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(135deg, #6857ff, #367cff);
  color: white;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(81, 82, 255, .25);
}
.primary:disabled, .icon-action:disabled { opacity: .55; cursor: wait; }

.message {
  margin-bottom: 13px;
  padding: 12px 14px;
  border-radius: 13px;
  background: rgba(69, 216, 157, .12);
  color: #69e8b5;
  font-size: 13px;
}
.message.error { background: rgba(255, 85, 110, .12); color: #ff8295; }

.toolbar {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-bottom: 12px;
}
.periods {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  flex: 1;
  padding: 4px;
  border: 1px solid rgba(255,255,255,.065);
  border-radius: 13px;
  background: #10131d;
}
.periods button, .icon-action, .text-action {
  border: 0;
  background: transparent;
  color: #858da0;
}
.periods button {
  min-height: 35px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
}
.periods button.active { background: #24283a; color: #f8f9fd; }
.icon-action {
  width: 45px;
  height: 45px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 13px;
  background: #121520;
  color: white;
  font-size: 23px;
}

.hero-card {
  padding: 20px;
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(104,87,255,.18), rgba(12,17,28,.92) 62%),
    #121520;
}
.hero-card span, .metrics span, .position-card span {
  color: #858da0;
  font-size: 12px;
}
.hero-card strong {
  display: block;
  margin: 12px 0 9px;
  font-size: clamp(34px, 11vw, 52px);
  line-height: .98;
  letter-spacing: -.05em;
}
.hero-card small { color: #697185; font-size: 11px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  margin-top: 9px;
}
.metrics article {
  display: grid;
  gap: 12px;
  min-height: 104px;
  padding: 15px;
  border-radius: 17px;
}
.metrics strong { align-self: end; font-size: 23px; letter-spacing: -.035em; }

.position-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 17px;
}
.position-card > div {
  display: grid;
  gap: 8px;
  padding: 15px;
}
.position-card > div + div { border-left: 1px solid rgba(255,255,255,.06); }
.position-card strong { font-size: 17px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 2px 10px;
}
.section-head h2 { font-size: 15px; }
.text-action { color: #80889d; font-size: 12px; }

.deals-list { display: grid; gap: 8px; }
.deal {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border-radius: 16px;
}
.deal-side {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 17px;
  font-weight: 900;
}
.deal-side.buy { background: rgba(55, 220, 160, .12); color: #4be0a8; }
.deal-side.sell { background: rgba(255, 99, 128, .12); color: #ff718b; }
.deal-main { min-width: 0; }
.deal-main strong, .deal-main span { display: block; }
.deal-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.deal-main span { margin-top: 4px; color: #737c90; font-size: 11px; }
.deal-rate { text-align: right; }
.deal-rate strong { display: block; font-size: 13px; }
.deal-rate span { color: #737c90; font-size: 10px; }

.empty {
  padding: 28px 16px;
  border: 1px dashed rgba(255,255,255,.09);
  border-radius: 16px;
  color: #737c90;
  text-align: center;
  font-size: 13px;
}

@media (max-width: 370px) {
  .app { padding-inline: 12px; }
  .periods button { font-size: 10px; }
  .hero-card strong { font-size: 36px; }
}
