/* iOS-minimal, light only. No dark theme, no emoji, no neon gradients. */

:root {
  --bg: #f2f2f7;
  --bg-elevated: #ffffff;
  --bg-grouped: #f7f7fa;
  --bg-press: #ececf0;
  --fill-1: rgba(120, 120, 128, 0.12);
  --fill-2: rgba(120, 120, 128, 0.16);
  --fill-3: rgba(120, 120, 128, 0.24);
  --sep: rgba(60, 60, 67, 0.13);
  --sep-strong: rgba(60, 60, 67, 0.22);

  --label: #1c1c1e;
  --label-2: rgba(60, 60, 67, 0.72);
  --label-3: rgba(60, 60, 67, 0.48);
  --label-4: rgba(60, 60, 67, 0.3);

  --blue: #0a84ff;
  --blue-deep: #0071e3;
  --green: #34c759;
  --green-deep: #248a3d;
  --red: #ff3b30;
  --red-deep: #d70015;
  --orange: #ff9f0a;
  --orange-deep: #b25000;
  --purple: #af52de;
  --teal: #30b0c7;

  --r-card: 18px;
  --r-sheet: 22px;
  --r-chip: 11px;
  --r-pill: 999px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 14px rgba(0, 0, 0, 0.045);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.06), 0 18px 48px rgba(0, 0, 0, 0.12);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  --nav-h: 52px;
  --tab-h: 56px;

  --ease-ios: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.5, 1);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue",
    Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior-y: none;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--label);
  font-size: 15px;
  line-height: 1.42;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

body.locked { overflow: hidden; }

.num, .mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--blue-deep); text-decoration: none; }

input, select, textarea {
  -webkit-appearance: none;
  appearance: none;
}

.ic { display: block; flex: 0 0 auto; }
.sr {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ app shell */

.app {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.appbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  padding-top: var(--safe-t);
  background: rgba(242, 242, 247, 0.76);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid transparent;
  transition: border-color 0.25s var(--ease-ios), background 0.25s var(--ease-ios);
}
.appbar.scrolled { border-bottom-color: var(--sep); }

.appbar-row {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}
.appbar-title {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.024em;
  margin-right: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appbar-title small {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--label-3);
  letter-spacing: 0;
  margin-top: -1px;
}

.icon-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--fill-1);
  color: var(--label);
  transition: transform 0.22s var(--ease-spring), background 0.18s var(--ease-ios), opacity 0.18s;
  position: relative;
  flex: 0 0 auto;
}
.icon-btn:active { transform: scale(0.9); background: var(--fill-3); }
.icon-btn.plain { background: none; }
.icon-btn.plain:active { background: var(--fill-1); }
.icon-btn[aria-expanded="true"] { background: var(--label); color: #fff; }
.icon-btn:disabled { opacity: 0.35; pointer-events: none; }

.icon-btn .badge {
  position: absolute;
  top: -3px; right: -3px;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--red);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--bg);
  font-variant-numeric: tabular-nums;
}
.icon-btn .badge[hidden] { display: none; }

/* search field in appbar */
.searchbar {
  padding: 0 12px 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.search-field {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--fill-1);
  color: var(--label-3);
  transition: background 0.18s var(--ease-ios), box-shadow 0.18s var(--ease-ios);
}
.search-field:focus-within {
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.16);
}
.search-field input {
  flex: 1;
  border: 0;
  background: none;
  outline: none;
  font-size: 16px;
  color: var(--label);
  min-width: 0;
}
.search-field input::placeholder { color: var(--label-3); }
.search-field .clear {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--fill-3);
  color: #fff;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.18s var(--ease-ios), transform 0.22s var(--ease-spring);
  pointer-events: none;
}
.search-field.has-value .clear { opacity: 1; transform: scale(1); pointer-events: auto; }

/* horizontal chip scroller */
.chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 0 12px 10px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--fill-1);
  color: var(--label-2);
  font-size: 13.5px;
  font-weight: 590;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  scroll-snap-align: start;
  transition: transform 0.2s var(--ease-spring), background 0.18s var(--ease-ios), color 0.18s;
}
.chip:active { transform: scale(0.94); }
.chip[aria-pressed="true"], .chip.is-on {
  background: var(--label);
  color: #fff;
}
.chip.is-on .ic { color: #fff; }
.chip.subtle { background: none; border: 1px solid var(--sep-strong); }

.summary-line {
  padding: 0 16px 10px;
  font-size: 13px;
  color: var(--label-3);
  display: flex;
  align-items: center;
  gap: 8px;
}
.summary-line .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--label-4); }

/* main scroll region */
.main {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding-top: calc(var(--safe-t) + var(--nav-h) + 46px);
  padding-bottom: calc(var(--safe-b) + var(--tab-h) + 28px);
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
}
.main.no-tabs { padding-bottom: calc(var(--safe-b) + 32px); }

/* ------------------------------------------------------------------ section */

.section { margin: 0 0 18px; }
.section-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 16px 8px;
}
.section-head h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--label-3);
  margin: 0;
}
.section-head .count {
  font-size: 13px;
  color: var(--label-4);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

.group {
  background: var(--bg-elevated);
  border-radius: var(--r-card);
  margin: 0 12px;
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

/* ------------------------------------------------------------------ row card */

.row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 13px 14px;
  border-bottom: 0.5px solid var(--sep);
  background: var(--bg-elevated);
  transition: background 0.16s var(--ease-ios), transform 0.2s var(--ease-ios);
  will-change: transform;
}
.group > .row:last-child { border-bottom: 0; }
.row:active { background: var(--bg-press); }

.row-main { min-width: 0; }
.row-top {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.row-sym {
  font-size: 16px;
  font-weight: 640;
  letter-spacing: -0.012em;
  color: var(--label);
  white-space: nowrap;
}
.row-name {
  font-size: 13px;
  color: var(--label-2);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
}

.row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex: 0 0 auto;
  text-align: right;
}
.row-price {
  font-size: 15px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  color: var(--label);
  letter-spacing: -0.01em;
}
.row-chg {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px;
  border-radius: 6px;
}
.row-chg.up { color: var(--green-deep); background: rgba(52, 199, 89, 0.12); }
.row-chg.down { color: var(--red-deep); background: rgba(255, 59, 48, 0.1); }
.row-chg.flat { color: var(--label-3); background: var(--fill-1); }
.row-time {
  font-size: 12.5px;
  color: var(--label-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

mark {
  background: rgba(255, 159, 10, 0.28);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

/* tags */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--fill-1);
  color: var(--label-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tag.dot::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.tag.green { background: rgba(52, 199, 89, 0.14); color: var(--green-deep); }
.tag.orange { background: rgba(255, 159, 10, 0.16); color: var(--orange-deep); }
.tag.red { background: rgba(255, 59, 48, 0.12); color: var(--red-deep); }
.tag.blue { background: rgba(10, 132, 255, 0.12); color: var(--blue-deep); }
.tag.purple { background: rgba(175, 82, 222, 0.13); color: #8944ab; }
.tag.gray { background: var(--fill-1); color: var(--label-3); }
.tag.plain { background: none; padding: 0; color: var(--label-3); font-weight: 500; }

.row-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  padding-top: 9px;
  margin-top: 3px;
  border-top: 0.5px solid var(--sep);
  overflow-x: auto;
  scrollbar-width: none;
}
.row-actions::-webkit-scrollbar { display: none; }
.act {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 11px;
  border-radius: 9px;
  background: var(--fill-1);
  color: var(--label-2);
  font-size: 12.5px;
  font-weight: 580;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: transform 0.2s var(--ease-spring), background 0.16s var(--ease-ios), color 0.16s;
}
.act:active { transform: scale(0.93); background: var(--fill-3); }
.act.on { background: var(--label); color: #fff; }
.act.on.gold { background: var(--orange); color: #fff; }
.act.ghost { background: none; border: 1px solid var(--sep-strong); }

.fav-btn {
  position: absolute;
  top: 10px; right: 10px;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--label-4);
  transition: transform 0.22s var(--ease-spring), color 0.18s;
}
.fav-btn:active { transform: scale(0.85); }
.fav-btn.on { color: var(--orange); }
.fav-btn.on .ic { fill: rgba(255, 159, 10, 0.2); }

/* ------------------------------------------------------------------ states */

.empty {
  margin: 0 12px;
  padding: 46px 24px;
  background: var(--bg-elevated);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-1);
  text-align: center;
  color: var(--label-3);
}
.empty .ic { margin: 0 auto 12px; color: var(--label-4); }
.empty h3 { margin: 0 0 4px; font-size: 16px; font-weight: 620; color: var(--label); }
.empty p { margin: 0; font-size: 13.5px; }

.skeleton {
  height: 68px;
  margin: 0 12px 8px;
  border-radius: var(--r-card);
  background: linear-gradient(100deg, #fff 30%, #f2f2f7 50%, #fff 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s var(--ease-ios) infinite;
}
@keyframes shimmer { from { background-position: 130% 0; } to { background-position: -30% 0; } }

/* ------------------------------------------------------------------ stagger */

.enter { animation: rowIn 0.42s var(--ease-ios) both; }
@keyframes rowIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ tabbar */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;
  padding-bottom: var(--safe-b);
  background: rgba(242, 242, 247, 0.78);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--sep);
  display: flex;
}
.tab {
  flex: 1;
  height: var(--tab-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--label-3);
  font-size: 10.5px;
  font-weight: 570;
  position: relative;
  transition: color 0.2s var(--ease-ios), transform 0.22s var(--ease-spring);
}
.tab:active { transform: scale(0.92); }
.tab.on { color: var(--blue); }
.tab .badge {
  position: absolute;
  top: 6px;
  left: 50%;
  margin-left: 4px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}
.tab .badge[hidden] { display: none; }

/* ------------------------------------------------------------------ backdrop */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.28);
  opacity: 0;
  transition: opacity 0.34s var(--ease-ios);
  -webkit-backdrop-filter: blur(0);
  backdrop-filter: blur(0);
}
.scrim.show { opacity: 1; }
.scrim[hidden] { display: none; }

/* ------------------------------------------------------------------ sheet */

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 90;
  max-height: 92vh;
  background: var(--bg-grouped);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.42s var(--ease-ios);
  padding-bottom: var(--safe-b);
  will-change: transform;
  touch-action: none;
}
.sheet.open { transform: translateY(0); }
.sheet.dragging { transition: none; }
.sheet[hidden] { display: none; }
.sheet.tall { height: 92vh; }
.sheet.full { height: 100vh; max-height: 100vh; border-radius: 0; padding-top: var(--safe-t); }

.grabber {
  padding: 8px 0 4px;
  display: grid;
  place-items: center;
  cursor: grab;
  flex: 0 0 auto;
}
.grabber span {
  width: 36px; height: 5px;
  border-radius: 3px;
  background: var(--fill-3);
  display: block;
}
.sheet.full .grabber { display: none; }

.sheet-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 12px;
}
.sheet-head h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sheet-head .sub {
  font-size: 12.5px;
  color: var(--label-3);
  font-weight: 500;
  margin-top: 1px;
}
.sheet-head .grow { flex: 1; min-width: 0; }
.sheet-head .icon-btn.done {
  width: auto;
  padding: 0 13px;
  border-radius: var(--r-pill);
  background: var(--label);
  color: #fff;
  font-size: 13.5px;
  font-weight: 620;
  height: 32px;
}

.sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 24px;
}

/* ------------------------------------------------------------------ detail */

.detail-hero {
  padding: 4px 18px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.detail-hero .big {
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.detail-hero .full {
  font-size: 14.5px;
  color: var(--label-2);
  margin-top: 3px;
}
.detail-hero .price-col {
  margin-left: auto;
  text-align: right;
  flex: 0 0 auto;
}
.detail-hero .price-col .p {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.kv {
  background: var(--bg-elevated);
  border-radius: var(--r-card);
  margin: 0 12px 14px;
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.kv-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 0.5px solid var(--sep);
  min-height: 44px;
}
.kv-row:last-child { border-bottom: 0; }
.kv-row .k {
  font-size: 14px;
  color: var(--label-2);
  flex: 0 0 auto;
  min-width: 74px;
}
.kv-row .v {
  margin-left: auto;
  text-align: right;
  font-size: 14.5px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
  min-width: 0;
}
.kv-row .v.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; font-weight: 500; }
.kv-row .v .ic { display: inline-block; vertical-align: -3px; }

.action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0 12px 14px;
}
.action-grid .act-cell {
  background: var(--bg-elevated);
  border-radius: 14px;
  box-shadow: var(--shadow-1);
  padding: 11px 6px 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 560;
  color: var(--label-2);
  transition: transform 0.2s var(--ease-spring), background 0.16s;
}
.action-grid .act-cell:active { transform: scale(0.94); }
.action-grid .act-cell.on { color: var(--orange); }
.action-grid .act-cell.on.gold { color: var(--blue); }
.action-grid .act-cell .ic { color: var(--label); }
.action-grid .act-cell.on .ic { color: var(--orange); }
.action-grid .act-cell.on.gold .ic { color: var(--blue); }

/* ------------------------------------------------------------------ accordion */

.acc {
  background: var(--bg-elevated);
  border-radius: var(--r-card);
  margin: 0 12px 14px;
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.acc-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--label);
}
.acc-head .ic.chev {
  margin-left: auto;
  color: var(--label-4);
  transition: transform 0.32s var(--ease-ios);
}
.acc.open .acc-head .ic.chev { transform: rotate(180deg); }
.acc-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.36s var(--ease-ios);
}
.acc.open .acc-body { grid-template-rows: 1fr; }
.acc-body > .inner { overflow: hidden; }
.acc-body .pad { padding: 0 14px 14px; }

/* ------------------------------------------------------------------ options */

.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 0.5px solid var(--sep);
  font-size: 15px;
  transition: background 0.16s;
  width: 100%;
  text-align: left;
}
.opt:last-child { border-bottom: 0; }
.opt:active { background: var(--bg-press); }
.opt .ic.lead { color: var(--label-2); }
.opt .lbl { flex: 1; font-weight: 500; }
.opt .sub { font-size: 12.5px; color: var(--label-3); }
.opt .tick {
  margin-left: auto;
  color: var(--blue);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s var(--ease-ios), transform 0.26s var(--ease-spring);
}
.opt[aria-selected="true"] { color: var(--blue); }
.opt[aria-selected="true"] .tick { opacity: 1; transform: scale(1); }
.opt[aria-selected="true"] .ic.lead { color: var(--blue); }

.seg {
  display: flex;
  gap: 3px;
  padding: 2px;
  margin: 0 12px 14px;
  background: var(--fill-1);
  border-radius: 10px;
}
.seg button {
  flex: 1;
  height: 30px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 570;
  color: var(--label-2);
  transition: background 0.2s var(--ease-ios), color 0.18s, box-shadow 0.2s;
}
.seg button.on {
  background: var(--bg-elevated);
  color: var(--label);
  font-weight: 620;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.09);
}

/* form bits */
.field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--sep);
}
.field-row:last-child { border-bottom: 0; }
.field-row label { font-size: 14px; color: var(--label-2); min-width: 60px; }
.field-row input[type="date"],
.field-row input[type="text"],
.field-row input[type="number"] {
  flex: 1;
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  background: var(--fill-1);
  border: 0;
  outline: none;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
.field-row input:focus { box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.16); }

.switch {
  margin-left: auto;
  width: 47px; height: 29px;
  border-radius: var(--r-pill);
  background: var(--fill-3);
  position: relative;
  transition: background 0.28s var(--ease-ios);
  flex: 0 0 auto;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 25px; height: 25px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.28s var(--ease-ios);
}
.switch[aria-checked="true"] { background: var(--green); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }

/* ------------------------------------------------------------------ calendar */

.cal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 12px;
}
.cal-head .m {
  font-size: 17px;
  font-weight: 680;
  letter-spacing: -0.02em;
  min-width: 118px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin: 0 12px 14px;
}
.cal-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--label-3);
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.cal-cell {
  aspect-ratio: 1 / 1.06;
  border-radius: 11px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  position: relative;
  transition: transform 0.2s var(--ease-spring), background 0.16s;
}
.cal-cell:active { transform: scale(0.93); }
.cal-cell.pad { background: none; box-shadow: none; pointer-events: none; }
.cal-cell .d {
  font-size: 14px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  color: var(--label);
}
.cal-cell.today .d { color: var(--blue-deep); font-weight: 720; }
.cal-cell.today { box-shadow: 0 0 0 1.5px var(--blue) inset, var(--shadow-1); }
.cal-cell.sel { background: var(--label); }
.cal-cell.sel .d { color: #fff; }
.cal-cell .dots { display: flex; gap: 2.5px; height: 5px; align-items: center; }
.cal-cell .dots i {
  width: 4.5px; height: 4.5px;
  border-radius: 50%;
  background: var(--blue);
  display: block;
}
.cal-cell.sel .dots i { background: rgba(255, 255, 255, 0.85); }
.cal-cell .n {
  position: absolute;
  top: 3px; right: 5px;
  font-size: 10px;
  font-weight: 700;
  color: var(--label-3);
  font-variant-numeric: tabular-nums;
}
.cal-cell.sel .n { color: rgba(255, 255, 255, 0.8); }

/* ------------------------------------------------------------------ stats */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 0 12px 16px;
}
.stat {
  background: var(--bg-elevated);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-1);
  padding: 13px 14px;
}
.stat .l {
  font-size: 12px;
  color: var(--label-3);
  font-weight: 560;
  letter-spacing: 0.01em;
}
.stat .v {
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.stat .u { font-size: 13px; font-weight: 560; color: var(--label-3); margin-left: 2px; }

.meter {
  height: 5px;
  border-radius: 3px;
  background: var(--fill-2);
  overflow: hidden;
  margin-top: 9px;
}
.meter i {
  display: block;
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s var(--ease-ios);
}

.stab-row { grid-template-columns: 1fr auto; }
.stab-name { font-size: 15.5px; font-weight: 620; letter-spacing: -0.01em; }
.stab-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.stab-side { text-align: right; }
.stab-side .wear {
  font-size: 17px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ------------------------------------------------------------------ toast */

.toast-wrap {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--safe-b) + var(--tab-h) + 14px);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 16px;
}
.toast {
  pointer-events: auto;
  max-width: 92vw;
  background: rgba(28, 28, 30, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: #fff;
  font-size: 13.5px;
  font-weight: 560;
  padding: 9px 15px;
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-2);
  display: flex;
  align-items: center;
  gap: 7px;
  animation: toastIn 0.42s var(--ease-spring) both;
}
.toast.out { animation: toastOut 0.3s var(--ease-ios) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(0.97); } }

/* ------------------------------------------------------------------ edge back */

/* Sits above scrim (80) and sheets (90) so the edge swipe always wins. */
.edge-hint {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 24px;
  z-index: 150;
  touch-action: pan-y;
  background: transparent;
}

.back-ghost {
  position: fixed;
  inset: 0;
  z-index: 160;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.16);
  opacity: 0;
  display: flex;
  align-items: center;
  padding-left: 14px;
  transition: opacity 0.12s linear;
}
.back-ghost .arrow {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  display: grid;
  place-items: center;
  color: var(--label);
  box-shadow: var(--shadow-1);
  transform: scale(0.8);
  transition: transform 0.16s var(--ease-ios);
}
.back-ghost.active { opacity: 1; }
.back-ghost.active .arrow { transform: scale(1); }

/* ------------------------------------------------------------------ fab / refresh */

.fab {
  position: fixed;
  right: calc(var(--safe-r) + 14px);
  bottom: calc(var(--safe-b) + var(--tab-h) + 14px);
  z-index: 65;
  height: 44px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  background: var(--label);
  color: #fff;
  font-size: 14px;
  font-weight: 620;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-shadow: var(--shadow-2);
  transition: transform 0.24s var(--ease-spring), opacity 0.2s;
}
.fab:active { transform: scale(0.93); }
.fab .ic { color: #fff; }
.fab.spin .ic { animation: spin 0.9s var(--ease-ios); }
@keyframes spin { to { transform: rotate(360deg); } }

.pull {
  position: fixed;
  top: calc(var(--safe-t) + 6px);
  left: 0; right: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
}
.pull .ring {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-1);
  display: grid;
  place-items: center;
  color: var(--label-2);
}
.pull.active { opacity: 1; }
.pull.active .ring .ic { animation: spin 0.8s linear infinite; }

/* ------------------------------------------------------------------ misc */

.divider { height: 0.5px; background: var(--sep); margin: 0 14px; }
.note { font-size: 12.5px; color: var(--label-3); padding: 0 18px 12px; line-height: 1.5; }
.stack { display: flex; flex-direction: column; }
.gap6 { display: flex; gap: 6px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

.binance-tag { color: #F0B90B; }

/* desktop */
/* Narrow phones: 7 labelled buttons cannot fit one row, so drop to even
   icon-only cells (aria-label keeps them announced). No mid-button clipping. */
@media (max-width: 699px) {
  .row-actions { overflow: visible; gap: 5px; }
  .act { flex: 1 1 0; min-width: 0; justify-content: center; padding: 0 4px; }
  .act .lbl { display: none; }
}

@media (min-width: 700px) {
  .main {
    max-width: 780px;
    margin: 0 auto;
    width: 100%;
    padding-left: 16px;
    padding-right: 16px;
  }
  .appbar-row, .searchbar, .chips, .summary-line { max-width: 780px; margin-left: auto; margin-right: auto; }
  .chips { flex-wrap: nowrap; }
  .tabbar { max-width: 780px; margin: 0 auto; border-radius: 18px 18px 0 0; }
  .sheet { max-width: 620px; margin: 0 auto; border-radius: var(--r-sheet) var(--r-sheet) 0 0; left: 0; right: 0; }
  .sheet.full { max-width: 780px; border-radius: 0; }
  .toast-wrap { bottom: calc(var(--safe-b) + var(--tab-h) + 22px); }
  .fab { right: calc(50vw - 390px + 14px); }
}
@media (min-width: 1100px) {
  .fab { right: auto; left: calc(50vw + 300px); }
}

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