:root {
  --bg: #f2f2f7;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --ink: #1c1c1e;
  --muted: #8e8e93;
  --line: rgba(60, 60, 67, 0.12);
  --accent: #0f766e;
  --accent-dark: #0c5f58;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --warn: #9a3412;
  --warn-soft: #fff4ea;
  --danger: #ff3b30;
  --danger-soft: #ffe8e6;
  --ok: #248a3d;
  --ok-soft: #e8f8ec;
  --shadow: 0 1px 1px rgba(0, 0, 0, 0.04), 0 10px 28px rgba(0, 0, 0, 0.05);
  --radius: 22px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select { font-family: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:active { transform: scale(0.98); }
img { max-width: 100%; }

.portal { min-height: 100vh; display: flex; flex-direction: column; }
.portal-body { flex: 1; display: grid; grid-template-columns: 248px 1fr; min-height: 0; }
.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(242, 242, 247, 0.78);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  padding: 18px 12px 28px;
}
.sidebar .group {
  margin: 18px 14px 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.nav-tile {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: 12px;
  min-height: 40px;
  padding: 0 12px;
  font-weight: 500;
  font-size: 0.98rem;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.nav-tile:hover { background: rgba(255, 255, 255, 0.7); }
.nav-tile.on { background: var(--accent); color: #fff; }
.stage { padding: 28px 40px 64px; min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
}
.api-pill {
  border: 0;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.04em;
}
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.balance-chip { color: var(--ink); font-weight: 650; letter-spacing: -0.02em; }
.role-badge {
  display: inline-flex;
  align-items: center;
  background: #fff6d8;
  color: #8a5a00;
  border: 1px solid #e6c56a;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.wallet-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 10px 8px 10px 16px;
  margin: 0 0 14px;
}
.wallet-bar span { font-weight: 650; letter-spacing: -0.02em; }

.app { width: min(860px, 100%); }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  text-align: left;
}
.mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  display: grid;
  place-items: center;
}
.mark span {
  display: flex;
  gap: 2px;
  height: 16px;
  align-items: stretch;
}
.mark i {
  display: block;
  background: #fff;
  width: 2px;
  border-radius: 1px;
}
.mark i:nth-child(2),
.mark i:nth-child(5) { width: 3px; }
.word {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.03em;
}
.word small {
  display: block;
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
  margin-top: 2px;
}
.nav { display: flex; gap: 8px; align-items: center; }
.nav button, .ghost, .primary, .soft {
  border-radius: 980px;
  border: 0;
  min-height: 36px;
  padding: 0 16px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: background 0.2s var(--ease), transform 0.15s var(--ease);
}
.ghost {
  background: rgba(120, 120, 128, 0.12);
  color: var(--ink);
}
.ghost[aria-current="page"], .nav button[aria-current="page"] {
  background: var(--ink);
  color: #fff;
}
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-dark); }
.soft { background: var(--accent-soft); color: var(--accent-dark); }
.primary:disabled, .soft:disabled, .ghost:disabled { opacity: 0.45; cursor: wait; }

.hero, .card, .panel {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero { padding: 28px 22px 22px; }
.kicker {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 0.82rem;
  margin: 0 0 6px;
}
h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.035em;
  margin: 0;
}
h1 { font-size: clamp(2rem, 4.4vw, 3.15rem); line-height: 1.05; }
h2 { font-size: 1.35rem; font-weight: 650; }
.lede { color: var(--muted); font-size: 1.05rem; line-height: 1.45; margin: 10px 0 0; font-weight: 400; }

.scan-box { margin-top: 22px; }
label { display: block; font-weight: 600; margin-bottom: 8px; font-size: 0.92rem; }
.scan-row { display: flex; gap: 10px; flex-wrap: wrap; }
input[type="text"], input[type="number"], input[type="email"], input[type="password"], input[type="search"], select, textarea {
  width: 100%;
  background: #f2f2f7;
  border: 0;
  border-radius: 14px;
  min-height: 52px;
  padding: 0 16px;
  font-size: 1.05rem;
  color: var(--ink);
  transition: box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
input::placeholder { color: #aeaeb2; }
input:focus, select:focus, textarea:focus {
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.16);
}
.scan-row input { flex: 1 1 240px; letter-spacing: 0.02em; }
.scan-row .primary { min-width: 140px; }
.lookup h1 { font-size: clamp(2.4rem, 5vw, 3.6rem); max-width: 14ch; }
.brand-line {
  color: var(--accent);
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.quota-bar {
  margin-top: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #fff;
  color: var(--ink);
  border-radius: 16px;
  padding: 14px 16px;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.quota-bar button { color: var(--accent); }
.lookup-card {
  margin-top: 12px;
  background: #ffffff;
  border: 0;
  border-radius: 22px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.lookup-card input { display: block; width: 100%; }
.tabs {
  display: inline-flex;
  gap: 2px;
  margin-bottom: 12px;
  background: #f2f2f7;
  border-radius: 12px;
  padding: 3px;
}
.tab {
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: 10px;
  min-height: 32px;
  padding: 0 14px;
  font-weight: 600;
  font-size: 0.92rem;
}
.tab.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.06); }
.wide { width: 100%; margin-top: 10px; min-height: 52px; font-size: 1.05rem; border-radius: 14px; }
.steps { margin-top: 28px; background: #fff; border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }
.steps h2 { padding: 18px 18px 4px; }
.step {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}
.step b {
  color: var(--accent);
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
}
.step p { margin: 2px 0 0; }
.menu-toggle { display: none; background: transparent; color: var(--ink); border: 0; font-size: 1.4rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  border: 0;
  background: #f2f2f7;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--ink);
  font-size: 0.92rem;
}
.hint { color: var(--muted); font-size: 0.92rem; margin-top: 12px; }

.camera {
  margin-top: 16px;
  background: #1c1c1e;
  border-radius: 22px;
  overflow: hidden;
  position: relative;
}
.camera video { width: 100%; max-height: 280px; object-fit: cover; display: block; }
.camera p {
  position: absolute;
  left: 12px;
  bottom: 12px;
  margin: 0;
  color: white;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.85rem;
}

.banner {
  border-radius: 16px;
  padding: 12px 14px;
  margin: 0 0 14px;
  line-height: 1.4;
}
.banner.error { background: var(--danger-soft); color: #c4120a; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner.net { background: #fff4ea; color: #9a3412; }

.grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 16px; }
.card { padding: 18px 18px 16px; }
.commercial {
  font-family: var(--display);
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.08;
  margin: 6px 0 8px;
}
.meta { color: var(--muted); margin: 0; }
.price-grid, .form-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 14px; }
.stat {
  background: #f2f2f7;
  border-radius: 16px;
  padding: 12px 14px;
}
.stat span { display: block; color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.stat strong { font-size: 1.28rem; letter-spacing: -0.03em; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.split { display: grid; grid-template-columns: 1fr; gap: 12px; }
.public-box, .private-box { border-radius: 18px; padding: 14px; }
.public-box { background: var(--accent-soft); }
.private-box { background: #fff8ee; }
.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
  color: var(--muted);
}
.list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.item {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 0;
  border-radius: 18px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  box-shadow: var(--shadow);
}
.item strong { font-size: 1.02rem; letter-spacing: -0.02em; }
.item em { font-style: normal; color: var(--muted); font-size: 0.9rem; }
.item b { font-size: 1.02rem; }

.empty { text-align: center; padding: 28px 16px; }
.bars { display: flex; justify-content: center; gap: 3px; height: 48px; margin-bottom: 12px; }
.bars i { display: block; width: 3px; background: var(--accent); border-radius: 2px; }
.bars i:nth-child(odd) { height: 100%; }
.bars i:nth-child(even) { height: 70%; align-self: center; }
.bars i:nth-child(3), .bars i:nth-child(7) { width: 6px; }

.check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
  display: grid;
  place-items: center;
  font-size: 2rem;
  margin-bottom: 8px;
}

.units { margin: 8px 0 0; padding-left: 18px; color: var(--ink); }
.footer-note { color: var(--muted); font-size: 0.82rem; margin-top: 22px; text-align: center; }

.login-wrap { min-height: calc(100vh - 120px); display: grid; place-items: center; }
.login-card { width: min(420px, 100%); padding: 28px 22px 20px; }
.login-card h1 { text-align: center; font-size: 1.8rem; }
.login-card .lede { text-align: center; margin-bottom: 18px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.88rem; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.google {
  width: 100%;
  background: #f2f2f7;
  border: 0;
  border-radius: 14px;
  min-height: 50px;
  font-weight: 600;
}
.linkish { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 0; min-height: 0; }
.shell { display: grid; grid-template-columns: 1fr; gap: 16px; }
.side { display: flex; gap: 8px; overflow: auto; }
.side button { white-space: nowrap; }
.work { min-width: 0; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 14px 0; }
.toolbar input { flex: 1 1 220px; min-height: 48px; font-size: 1rem; }
.product-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.unit-row { display: grid; grid-template-columns: 1.4fr 0.7fr auto; gap: 8px; align-items: end; }
.panel-title { font-family: var(--font); font-size: 1.02rem; font-weight: 650; letter-spacing: -0.02em; margin-bottom: 4px; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 6px 0 0; }
.public-head { display: flex; flex-direction: column; gap: 8px; }
.admin-links { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 16px; }
.admin-link {
  text-align: left;
  background: var(--surface);
  color: inherit;
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.admin-link span { display: block; color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.admin-link strong { display: block; margin-top: 4px; font-family: var(--display); font-size: 1.35rem; letter-spacing: -0.03em; }
.balance { font-family: var(--display); font-size: clamp(2.6rem, 6vw, 3.6rem); font-weight: 700; letter-spacing: -0.045em; margin: 0; }
.balance-card { margin: 12px 0 16px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 14px 0 0; }
.facts div { margin: 0; }
.facts dt { color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.facts dd { margin: 2px 0 0; font-size: 1.02rem; letter-spacing: -0.02em; }
.key-reveal {
  background: var(--ok-soft);
  border-radius: 18px;
  padding: 14px;
  margin: 14px 0;
}
.key-value {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.45;
  word-break: break-all;
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  margin: 10px 0 0;
}
.key-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.key-row strong { display: block; }
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 650;
}
.pill.on { background: var(--ok-soft); color: var(--ok); }
.pill.off { background: var(--danger-soft); color: #c4120a; }
.pill.gold { background: #fff6d8; color: #8a5a00; }
textarea {
  width: 100%;
  min-height: 88px;
  border: 0;
  border-radius: 14px;
  background: #f2f2f7;
  padding: 12px 14px;
  font: inherit;
  color: inherit;
  resize: vertical;
}
.extra { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.extra .form-grid { margin-top: 0; }
.muted { color: var(--muted); }
.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid rgba(15, 118, 110, 0.18);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
  margin: 12px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
  .portal-body { grid-template-columns: 1fr; }
  .sidebar {
    display: flex;
    gap: 6px;
    overflow: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
  }
  .sidebar .group { display: none; }
  .nav-tile { width: auto; white-space: nowrap; }
  .stage { padding: 18px 16px 48px; }
}
@media (min-width: 760px) {
  .hero { padding: 32px 28px 24px; }
  .admin-links { grid-template-columns: 1fr 1fr; }
  .price-grid, .form-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid.two { grid-template-columns: 1fr 1fr; }
  .split { grid-template-columns: 1.1fr 0.9fr; }
  .grid.two { grid-template-columns: 1.15fr 0.85fr; align-items: start; }
  .shell { grid-template-columns: 200px 1fr; align-items: start; }
  .side { flex-direction: column; position: sticky; top: 12px; }
  .product-grid { grid-template-columns: 1fr 1fr; }
}
