/* Blue Archive event planner — simplified dark UI */
:root {
  --bg: #0a1019;
  --bg-2: #0c1420;
  --panel: #0f1926;
  --panel-2: #111e2d;
  --panel-3: #172538;
  --line: #1d2c3f;
  --line-2: #293c53;
  --line-soft: rgba(255, 255, 255, 0.055);
  --text: #eaf2fb;
  --muted: #93a6be;
  --muted-2: #6b7f99;
  --accent: #4cc9f0;
  --accent-soft: rgba(76, 201, 240, 0.12);
  --green: #7ae582;
  --green-soft: rgba(122, 229, 130, 0.09);
  --gold: #e8b96a;
  --red: #ff6b7a;
  --red-soft: rgba(255, 107, 122, 0.09);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Segoe UI", "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #8fe4ff; }

button, input, select { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
.muted { color: var(--muted-2); }

.app { min-height: 100vh; }

/* ---------------- top bar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 60px;
  padding: 9px clamp(14px, 3vw, 34px);
  background: rgba(10, 16, 25, 0.88);
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  min-width: 0;
}
.brand:hover { color: var(--text); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #06111c;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.02em;
  background: var(--gold);
  flex: 0 0 auto;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 14px; letter-spacing: 0.01em; }
.brand-text small { color: var(--muted); font-size: 11px; margin-top: 2px; }

.topnav { display: flex; gap: 3px; margin-left: auto; }
.topnav a {
  padding: 7px 11px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.topnav a:hover { background: rgba(255, 255, 255, 0.045); color: var(--text); }
.topnav a.active { background: var(--accent-soft); color: #b9eeff; }

.top-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
}
.status-dot.ok { background: var(--green); }
.status-dot.saving { background: var(--gold); }
.status-dot.error { background: var(--red); }

/* ---------------- layout ---------------- */
.main {
  width: min(1460px, 100%);
  margin: 0 auto;
  padding: 16px clamp(12px, 2.4vw, 32px) 40px;
}

.hero {
  margin-bottom: 16px;
  padding: clamp(18px, 2.6vw, 28px);
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: var(--panel);
}
.hero-skeleton { color: var(--muted); padding: 14px 0; }

.hero-top { display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.hero-copy { flex: 1 1 560px; min-width: 0; }
.eyebrow {
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.hero h1 {
  margin: 7px 0 7px;
  font-size: clamp(23px, 3vw, 34px);
  line-height: 1.12;
  letter-spacing: -0.02em;
}
.hero-sub {
  margin: 0 0 13px;
  color: var(--muted);
  font-size: 13px;
}
.hero-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
  color: #c4d2e5;
  font-size: 11.5px;
  white-space: nowrap;
}
.chip strong { color: var(--text); font-weight: 700; }
.chip.gold { border-color: rgba(232, 185, 106, 0.32); color: #f0d5a4; }
.chip.green { border-color: rgba(122, 229, 130, 0.24); color: #b9f0be; }
.chip.red { border-color: rgba(255, 107, 122, 0.3); color: #ffc0c6; }

.hero-side {
  width: min(330px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.event-select {
  width: 100%;
  padding: 9px 11px;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
}
.event-select:focus { border-color: var(--accent); }

.layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.layout > * { min-width: 0; }

.panel {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
}
.plan-column { position: sticky; top: 72px; min-width: 0; }
.plan-panel { padding: 15px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel-head h2, .shop-head h2 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.icon-btn {
  width: 28px;
  height: 28px;
  color: var(--muted);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  line-height: 1;
}
.icon-btn:hover { color: var(--text); border-color: var(--muted-2); }
.plan-panel.collapsed #planBody { display: none; }
.plan-panel.collapsed .panel-head { margin-bottom: 0; }

.plan-loading { color: var(--muted); padding: 20px 0; text-align: center; }

/* ---------------- plan ---------------- */
.plan-section { padding: 12px 0; border-top: 1px solid var(--line-soft); }
.plan-section:first-child { padding-top: 0; border-top: 0; }
.section-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  margin-bottom: 8px;
  color: #c8d7ea;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.section-title .hint { min-width: 0; color: var(--muted-2); font-size: 10.5px; font-weight: 500; letter-spacing: 0; text-transform: none; }

.account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: stretch;
  margin-bottom: 7px;
}
.account-select {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}
.account-select > span { color: var(--muted-2); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.account-select select {
  min-width: 0;
  flex: 1;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 12px;
  font-weight: 700;
}
.account-select:focus-within { border-color: var(--accent); }
.account-row .btn { white-space: nowrap; }

.import-note {
  margin: 0 0 8px;
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.4;
}
.import-warn { display: block; margin-top: 2px; color: var(--red); }

.balance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.balance-field {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}
.balance-field img, .balance-field .fallback { width: 21px; height: 21px; flex: 0 0 21px; }
.balance-field .fallback { display: grid; place-items: center; border-radius: 5px; background: var(--panel-3); color: var(--muted); font-size: 8px; font-weight: 800; }
.balance-field label { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.balance-field label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; font-weight: 600; }
.balance-field input {
  width: 100%;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.balance-field:focus-within { border-color: var(--accent); }

/* bonus */
.bonus-empty { color: var(--muted-2); font-size: 11px; }
.bonus-cur { padding: 9px 0; border-top: 1px dashed var(--line-soft); }
.bonus-cur:first-child { padding-top: 0; border-top: 0; }
.bonus-cur-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bonus-cur-name { display: flex; align-items: center; gap: 6px; min-width: 0; color: #d7e4f4; font-size: 12px; font-weight: 700; }
.bonus-cur-name img, .bonus-cur-name .fallback { width: 18px; height: 18px; flex: 0 0 18px; }
.bonus-cur-name .fallback { display: grid; place-items: center; border-radius: 4px; background: var(--panel-3); color: var(--muted); font-size: 8px; font-weight: 800; }
.bonus-cur-total { color: var(--accent); font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bonus-selected { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.bonus-none { color: var(--muted-2); font-size: 10.5px; }
.bonus-chip {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--bg-2);
}
.bonus-chip img, .bonus-chip .fallback {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-2);
  border: 1px solid var(--line);
}
.bonus-chip .fallback { display: grid; place-items: center; color: var(--muted); font-size: 10px; font-weight: 800; }
.bonus-chip > span {
  position: absolute;
  right: -3px;
  bottom: -3px;
  padding: 0 3px;
  border-radius: 4px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  color: var(--accent);
  font-size: 8.5px;
  font-weight: 800;
  line-height: 1.35;
}
.bonus-edit {
  margin-left: auto;
  padding: 2px 5px;
  color: var(--muted-2);
  background: transparent;
  border: 0;
  font-size: 10px;
  font-weight: 600;
}
.bonus-edit:hover { color: var(--accent); }
.bonus-picker-note { margin-top: 7px; color: var(--muted-2); font-size: 9.5px; line-height: 1.35; }
.bonus-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  margin-top: 7px;
  padding: 7px;
  max-height: 224px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}
.bonus-unit {
  position: relative;
  display: block;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
}
.bonus-unit img, .bonus-unit .fallback {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 7px;
  object-fit: cover;
  background: var(--panel-3);
  border: 1px solid var(--line);
}
.bonus-unit .fallback { display: grid; place-items: center; color: var(--muted); font-size: 11px; font-weight: 800; }
.bonus-unit:hover { border-color: var(--muted-2); }
.bonus-unit.on { border-color: var(--accent); }
.bonus-unit.on img { border-color: var(--accent); }
.bonus-unit.locked { opacity: 0.3; cursor: default; }
.bonus-unit .bu-bonus {
  position: absolute;
  right: 1px;
  bottom: 1px;
  padding: 0 2px;
  border-radius: 3px;
  background: rgba(10, 16, 25, 0.88);
  color: var(--text);
  font-size: 8px;
  font-weight: 800;
  line-height: 1.35;
}
.bonus-unit.on .bu-bonus { color: var(--accent); }

.formula { margin-top: 8px; color: var(--muted-2); font-size: 10.5px; }
.formula summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.formula p { margin: 6px 0 0; line-height: 1.45; }

.plan-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.plan-card {
  min-width: 0;
  padding: 8px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  text-align: center;
}
.plan-card .pc-label { color: var(--muted); font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.plan-card .pc-value { margin-top: 2px; font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.plan-card .pc-sub { color: var(--muted-2); font-size: 9.5px; margin-top: 2px; }
.plan-card.accent .pc-value { color: var(--accent); }

.req-list { display: flex; flex-direction: column; gap: 2px; }
.req-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 6px;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line-soft);
  font-size: 11px;
}
.req-row:last-child { border-bottom: 0; }
.req-name { display: flex; align-items: center; gap: 5px; min-width: 0; color: #c4d2e5; }
.req-name img, .req-name .fallback { width: 18px; height: 18px; flex: 0 0 18px; }
.req-name .fallback { display: grid; place-items: center; border-radius: 4px; background: var(--panel-3); color: var(--muted); font-size: 7px; font-weight: 800; }
.req-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-val { font-variant-numeric: tabular-nums; color: var(--muted-2); font-size: 10px; white-space: nowrap; }
.req-val strong { color: var(--text); font-size: 11px; }
.req-val.deficit strong { color: var(--red); }
.req-val.ok strong { color: var(--green); }

.mini-block {
  margin-top: 7px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}
.mini-title { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 11.5px; font-weight: 800; }
.mini-title .tag { margin-left: auto; padding: 2px 5px; border-radius: 4px; background: var(--panel-3); color: var(--muted); font-size: 9px; }
.mini-line { margin-top: 4px; color: var(--muted); font-size: 11px; }
.mini-line strong { color: var(--text); }
.mini-note { margin-top: 5px; color: var(--muted-2); font-size: 10px; line-height: 1.4; }

.stage-table-wrap { overflow-x: auto; margin: 0 -2px; }
.stage-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.stage-table th {
  padding: 5px 4px;
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: right;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.stage-table th:first-child, .stage-table td:first-child { text-align: left; }
.stage-table th:nth-child(2), .stage-table td:nth-child(2) { text-align: left; }
.stage-table td {
  padding: 6px 4px;
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stage-table tr:last-child td { border-bottom: 0; }
.stage-table tr.active td { background: rgba(76, 201, 240, 0.055); }
.stage-name { color: #d7e4f4; font-weight: 700; font-size: 10.5px; }
.stage-drops { display: flex; flex-wrap: wrap; gap: 2px 4px; }
.drop-chip { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: 10px; }
.drop-chip img, .drop-chip .fallback { width: 12px; height: 12px; flex: 0 0 12px; }
.drop-chip .fallback { display: grid; place-items: center; border-radius: 3px; background: var(--panel-3); color: var(--muted); font-size: 6px; font-weight: 800; }
.drop-chip strong { color: #d7e4f4; font-weight: 700; }
.drop-none { color: var(--muted-2); font-size: 10px; }
.stage-count { color: var(--accent); font-size: 13px; font-weight: 800; }
.stage-count.zero { color: var(--muted-2); font-weight: 500; }

.plan-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
  padding: 8px 9px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: #cfe9f5;
  font-size: 11px;
}
.plan-total strong { color: #fff; font-size: 15px; font-variant-numeric: tabular-nums; }
.leftovers { margin-top: 6px; color: var(--muted-2); font-size: 10px; line-height: 1.45; }
.leftovers strong { color: var(--muted); }
.status-line {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 10.5px;
  line-height: 1.4;
}
.status-line.ok { color: #b9f0be; background: var(--green-soft); border: 1px solid rgba(122, 229, 130, 0.18); }
.status-line.warn { color: #ffd9a1; background: rgba(232, 185, 106, 0.06); border: 1px solid rgba(232, 185, 106, 0.2); }
.status-line .ico { flex: 0 0 auto; font-size: 12px; }

details.notes { margin-top: 8px; color: var(--muted-2); font-size: 10px; }
details.notes summary { cursor: pointer; color: var(--muted); font-weight: 600; }
details.notes ul { margin: 6px 0 0; padding-left: 15px; line-height: 1.45; }
details.notes li { margin-bottom: 3px; }

/* ---------------- shop ---------------- */
.shop-panel { padding: 15px; }
.shop-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.shop-head .eyebrow { margin-bottom: 2px; }
.shop-actions { display: flex; gap: 6px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 11.5px;
  line-height: 1.2;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.btn-sm { padding: 6px 8px; font-size: 10.5px; }
.btn-ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.btn-ghost:hover { color: var(--text); border-color: var(--line-2); background: rgba(255, 255, 255, 0.04); }
.btn-accent { color: #06111c; background: var(--accent); border-color: var(--accent); }
.btn-accent:hover { background: #7bdcff; color: #06111c; }
.btn-danger { color: #ffd7db; background: var(--red-soft); border-color: rgba(255, 107, 122, 0.25); }

.shop-tools { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.currency-tabs { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.currency-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 6px 9px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.currency-tab img, .currency-tab .fallback { width: 16px; height: 16px; }
.currency-tab .fallback { display: grid; place-items: center; border-radius: 4px; background: var(--panel-3); color: var(--muted); font-size: 7px; font-weight: 800; }
.currency-tab .count { color: var(--muted-2); font-size: 9.5px; font-weight: 600; }
.currency-tab:hover { color: var(--text); border-color: var(--line-2); }
.currency-tab.active { color: #06111c; background: var(--accent); border-color: var(--accent); }
.currency-tab.active .count { color: rgba(6, 17, 28, 0.65); }

.shop-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1 1 220px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  color: var(--muted-2);
}
.search:focus-within { border-color: var(--accent); }
.search input { width: 100%; padding: 0; color: var(--text); background: transparent; border: 0; outline: 0; font-size: 11.5px; }
.search input::placeholder { color: var(--muted-2); }
.switch { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; cursor: pointer; }
.switch input { accent-color: var(--accent); }

.shop-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10.5px;
}
.summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
}
.summary-pill img, .summary-pill .fallback { width: 14px; height: 14px; }
.summary-pill .fallback { display: grid; place-items: center; border-radius: 3px; background: var(--panel-3); color: var(--muted); font-size: 6px; font-weight: 800; }
.summary-pill strong { color: var(--text); }

.shop-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(296px, 1fr)); gap: 8px; }
.shop-empty { grid-column: 1 / -1; padding: 32px 16px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 10px; }

.item-card {
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 8px 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-2);
  transition: border-color 0.12s ease, opacity 0.12s ease;
  overflow: hidden;
}
.item-card:hover { border-color: var(--line-2); }
.item-card.selected { border-color: rgba(76, 201, 240, 0.48); }
.item-card.bought { opacity: 0.5; }
.item-card.bought:hover { opacity: 0.75; }

.item-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  overflow: hidden;
  flex: 0 0 auto;
}
.item-icon img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.item-icon .fallback { color: var(--muted); font-size: 19px; line-height: 1; }
.item-icon .fallback.txt { font-size: 10px; font-weight: 800; }

.item-main { min-width: 0; }
.item-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.item-title {
  margin: 0;
  color: #eef5ff;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.item-stock { color: var(--muted-2); font-size: 10px; white-space: nowrap; flex: 0 0 auto; }
.item-meta { margin-top: 2px; color: var(--muted-2); font-size: 10px; }
.item-cost-row { display: flex; align-items: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.item-cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.item-cost img, .item-cost .fallback { width: 15px; height: 15px; }
.item-cost .fallback { display: grid; place-items: center; border-radius: 3px; background: var(--panel-3); color: var(--muted); font-size: 6px; font-weight: 800; }
.item-total {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  min-height: 24px;
}
.item-total img, .item-total .fallback { width: 14px; height: 14px; }
.item-total .fallback { display: grid; place-items: center; border-radius: 3px; background: var(--panel-3); color: var(--muted); font-size: 6px; font-weight: 800; }
.item-total strong { color: var(--muted); font-weight: 700; }

.item-controls {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 7px;
  border-top: 1px solid var(--line-soft);
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.check input { accent-color: var(--accent); }
.check.bought-check input { accent-color: var(--green); }
.item-controls .check-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.qty {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: var(--bg-2);
}
.qty button {
  width: 24px;
  height: 24px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-size: 13px;
  line-height: 1;
}
.qty button:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.qty input {
  width: 38px;
  height: 24px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  outline: 0;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.qty input:disabled, .qty button:disabled { opacity: 0.35; cursor: default; }

/* ---------------- footer / misc ---------------- */
.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding: 13px 2px 0;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-2);
  font-size: 10.5px;
}
.footer a { color: var(--muted); }
.footer a:hover { color: var(--accent); }

.mobile-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(10, 16, 25, 0.95);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.mobile-bar-main { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
.mobile-bar-main span { color: var(--muted); font-size: 10px; }
.mobile-bar-main strong { color: var(--text); font-size: 12px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-bar .btn { flex: 0 0 auto; padding: 8px 11px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 80;
  transform: translate(-50%, 18px);
  max-width: min(92vw, 480px);
  padding: 9px 13px;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 11.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255, 107, 122, 0.35); color: #ffd7db; }

/* ---------------- responsive ---------------- */
@media (max-width: 1120px) {
  .layout { grid-template-columns: 1fr; }
  .shop-column { order: 1; }
  .plan-column { order: 2; position: static; }
  .shop-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .mobile-bar { display: flex; }
  body { padding-bottom: 68px; overflow-x: hidden; }
}

@media (max-width: 720px) {
  .topbar { gap: 8px; padding: 8px 12px; }
  .topnav { display: none; }
  .top-status { margin-left: auto; }
  .brand-text small { display: none; }
  .main { padding: 11px 10px 28px; }
  .hero { padding: 15px; border-radius: 14px; }
  .hero h1 { font-size: 23px; }
  .hero-side { width: 100%; }
  .hero-chips { gap: 5px; }
  .chip { font-size: 10.5px; padding: 4px 8px; }
  .layout { gap: 11px; }
  .plan-panel, .shop-panel { padding: 12px; }
  .panel-head h2, .shop-head h2 { font-size: 16px; }
  .balance-grid { grid-template-columns: 1fr 1fr; }
  .shop-list { grid-template-columns: 1fr; }
  .shop-actions { width: 100%; }
  .shop-actions .btn { flex: 1; }
  .item-card { grid-template-columns: 50px minmax(0, 1fr); }
  .item-icon { width: 50px; height: 50px; }
  .footer { font-size: 10px; }
}

@media (min-width: 1121px) {
  .mobile-bar { display: none !important; }
}

@media (max-width: 430px) {
  .plan-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-cards .plan-card:last-child { grid-column: 1 / -1; }
  .balance-grid { grid-template-columns: 1fr; }
  .qty { margin-left: 0; }
  .account-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
