:root {
  color-scheme: dark;
  --bg: #06111c;
  --panel: #0c1d2b;
  --panel-2: #102536;
  --line: rgba(145, 190, 215, .15);
  --text: #eff8ff;
  --muted: #7f9daf;
  --cyan: #44d7e8;
  --blue: #4c8dff;
  --green: #47df9b;
  --orange: #ffb254;
  --red: #ff6c75;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 12% -10%, rgba(36, 173, 209, .18), transparent 33%),
    linear-gradient(180deg, #071521 0, var(--bg) 45%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 16, 27, .88);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 35px; height: 35px; }
.brand div { display: grid; gap: 2px; }
.brand strong { font-size: 17px; letter-spacing: .04em; }
.brand span { color: var(--muted); font-size: 11px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-pill { display: flex; align-items: center; gap: 7px; color: var(--orange); font-size: 12px; }
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.live-pill.is-online { color: var(--green); }
.live-pill.is-offline { color: var(--red); }

main { padding: 14px 14px calc(92px + env(safe-area-inset-bottom)); }
.screen { display: none; }
.screen.is-active { display: block; animation: reveal .18s ease-out; }
@keyframes reveal { from { opacity: .4; transform: translateY(4px); } }

.toolbar { display: grid; grid-template-columns: 1fr 44px; gap: 9px; }
.toolbar label { display: grid; gap: 6px; }
.toolbar label > span { color: var(--muted); font-size: 11px; }
select, input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  outline: none;
}
select { padding: 0 12px; }
input { width: 100%; padding: 0 12px; font-variant-numeric: tabular-nums; }
select:focus, input:focus { border-color: rgba(68, 215, 232, .62); box-shadow: 0 0 0 3px rgba(68, 215, 232, .08); }
.icon-button {
  align-self: end;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--cyan);
  font-size: 20px;
}

.sync-strip {
  display: flex;
  justify-content: space-between;
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid rgba(68, 215, 232, .13);
  border-radius: 11px;
  background: rgba(68, 215, 232, .055);
  color: var(--muted);
  font-size: 12px;
}
.sync-strip strong { color: var(--green); font-weight: 650; }
.notice { margin: 0 0 12px; padding: 10px 12px; border: 1px solid rgba(255, 178, 84, .25); border-radius: 11px; background: rgba(255, 178, 84, .08); color: #ffd29b; font-size: 12px; line-height: 1.5; }
.hidden { display: none !important; }
.cards { display: grid; gap: 10px; }
.empty { padding: 44px 20px; color: var(--muted); text-align: center; font-size: 13px; }

.quote-card, .task-card, .market-card, .device-card {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(16, 37, 54, .96), rgba(9, 25, 38, .96));
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
}
.quote-card { padding: 14px; }
.quote-head { display: flex; justify-content: space-between; gap: 12px; }
.quote-head > div { min-width: 0; }
.quote-head strong { display: block; overflow: hidden; font-size: 15px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.quote-head span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.price { color: var(--cyan); font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price small { color: var(--muted); font-size: 10px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 13px 0; }
.facts div { padding: 8px; border-radius: 9px; background: rgba(3, 14, 23, .5); }
.facts span { display: block; color: var(--muted); font-size: 10px; }
.facts strong { display: block; margin-top: 3px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote-action { display: grid; grid-template-columns: 1fr 92px; gap: 8px; }
.quote-action button {
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--blue), #3ac0df);
  color: #fff;
  font-weight: 700;
}
.quote-action button:disabled { opacity: .38; filter: grayscale(.5); }

.section-title { display: flex; justify-content: space-between; margin: 4px 2px 13px; }
.section-title div { display: grid; gap: 4px; }
.section-title strong { font-size: 18px; }
.section-title span { color: var(--muted); font-size: 12px; }
.task-card, .market-card { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 13px 14px; }
.task-card strong, .market-card strong { display: block; font-size: 14px; }
.task-card span, .market-card span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.status { align-self: start; padding: 4px 8px; border-radius: 999px; background: rgba(68, 215, 232, .1); color: var(--cyan); font-size: 10px; white-space: nowrap; }
.status.success { color: var(--green); background: rgba(71, 223, 155, .1); }
.status.failed { color: var(--red); background: rgba(255, 108, 117, .1); }
.device-card { display: grid; gap: 8px; margin-top: 14px; padding: 14px; }
.device-card > span { color: var(--muted); font-size: 11px; }
.device-card code { overflow-wrap: anywhere; color: var(--cyan); font-size: 12px; user-select: all; }
.device-card small { color: var(--muted); line-height: 1.55; }
.device-token-field { display: grid; gap: 6px; margin-top: 3px; }
.device-token-field span { color: var(--muted); font-size: 11px; }
.device-card button { min-height: 42px; border: 1px solid rgba(68, 215, 232, .25); border-radius: 11px; background: rgba(68, 215, 232, .08); color: var(--cyan); font-weight: 650; }

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 7px 18px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(5, 16, 27, .92);
  backdrop-filter: blur(18px);
}
.bottom-nav button { display: grid; justify-items: center; gap: 2px; border: 0; background: transparent; color: var(--muted); font-size: 10px; }
.bottom-nav button span { font-size: 20px; }
.bottom-nav button.is-active { color: var(--cyan); }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(78px + env(safe-area-inset-bottom));
  z-index: 40;
  max-width: calc(100vw - 30px);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #142a3b;
  color: var(--text);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: .2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
  body { max-width: 560px; margin: 0 auto; border-inline: 1px solid var(--line); }
  .bottom-nav { left: 50%; right: auto; width: 560px; transform: translateX(-50%); }
}
