:root {
  --bg: #f5f7f3;
  --panel: #ffffff;
  --text: #1f2520;
  --muted: #697068;
  --line: #dfe6dc;
  --green: #62c653;
  --yellow: #e5c84d;
  --red: #d94b42;
  --gold: #be8d12;
  --shadow: 0 10px 28px rgba(32, 44, 30, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 14px 12px 28px;
}

.topbar {
  display: grid;
  gap: 8px;
  padding: 6px 2px 12px;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.header-back {
  margin-right: auto;
}

h2,
p {
  margin: 0;
}

h2 {
  font-size: 20px;
  line-height: 1.15;
}

.status-pill {
  min-width: 96px;
  max-width: 156px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.refresh-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.refresh-button:disabled {
  color: var(--muted);
  background: #f4f6f3;
}

.hero {
  min-height: 204px;
  border: 3px solid #9ad67a;
  background: linear-gradient(180deg, #ffffff 0%, #f6fbf6 100%);
  box-shadow: var(--shadow);
  padding: 16px;
}

.hero-title {
  text-align: center;
  font-size: 20px;
  font-weight: 800;
}

.hero-shop {
  margin-top: 16px;
  font-size: 24px;
  line-height: 1.08;
  font-weight: 800;
}

.stars {
  color: var(--gold);
  white-space: nowrap;
}

.hero-stars {
  margin-top: 8px;
  overflow: hidden;
  font-size: clamp(22px, 7vw, 34px);
}

.hero-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.kpi {
  min-width: 0;
  border: 1px solid #c8dcc8;
  background: #fbfefb;
  padding: 9px 10px;
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
}

.kpi-value {
  margin-top: 3px;
  font-size: 19px;
  font-weight: 800;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 0;
  background: rgba(245, 247, 243, 0.94);
  backdrop-filter: blur(8px);
}

.tabs a {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.section {
  margin-top: 12px;
  padding: 14px 0 4px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-head span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.hidden {
  display: none !important;
}

.rating-list,
.chart-list {
  display: grid;
  gap: 9px;
}

.rating-row,
.chart-row {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 4px 14px rgba(32, 44, 30, 0.05);
  padding: 11px;
}

button.rating-row,
button.chart-row {
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

button.rating-row:active,
button.chart-row:active {
  transform: translateY(1px);
}

.rating-main,
.chart-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.rank {
  position: relative;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 2px solid var(--gold);
  border-radius: 50%;
  font-weight: 800;
  line-height: 1;
}

.rank-number {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  padding-top: 1px;
}

.shop-cell {
  min-width: 0;
}

.shop-name {
  min-width: 0;
  font-weight: 800;
  line-height: 1.15;
}

.activity-strip {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  height: 6px;
  margin-top: 6px;
  overflow: hidden;
}

.activity-segment {
  height: 100%;
  background: #edf1eb;
}

.activity-segment-filled {
  background: var(--green);
}

.metric-value {
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.rating-stars {
  margin-top: 8px;
  overflow: hidden;
  font-size: clamp(18px, 5.6vw, 30px);
}

.rating-details {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.bar-track {
  position: relative;
  height: 18px;
  margin-top: 9px;
  overflow: hidden;
  background: #edf1eb;
}

.bar-fill {
  height: 100%;
  min-width: 2px;
}

.average-marker {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: rgba(0, 0, 0, 0.4);
}

.chart-meta {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.chart-stars {
  overflow: hidden;
  font-size: clamp(18px, 5.6vw, 30px);
  line-height: 1;
}

.error {
  border-color: #e3aaa5;
  background: #fff7f6;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 9px 12px;
  font: inherit;
  font-weight: 800;
}

.shop-hero {
  border: 2px solid #9ad67a;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 15px;
}

.shop-hero-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: stretch;
  margin-top: 12px;
}

.shop-title {
  min-width: 0;
  display: flex;
  align-items: center;
  font-size: 25px;
  line-height: 1.08;
  font-weight: 800;
}

.shop-rank {
  min-width: 58px;
  border: 1px solid var(--line);
  background: #f6fbf6;
  padding: 7px 9px;
  text-align: center;
}

.shop-rank strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.shop-rank span {
  color: var(--muted);
  font-size: 12px;
}

.shop-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.shop-rating-wide {
  margin-top: 13px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
}

.shop-rating-value {
  min-width: 0;
  justify-self: stretch;
  text-align: center;
  font-size: clamp(24px, 7.2vw, 34px);
  line-height: 1;
  font-weight: 900;
  color: var(--text);
}

.shop-metric {
  border: 1px solid var(--line);
  background: #fbfefb;
  padding: 10px;
}

.goal-list {
  display: grid;
  gap: 9px;
}

.goal-card {
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
}

.goal-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.goal-title {
  font-weight: 800;
}

.goal-value {
  font-weight: 800;
  white-space: nowrap;
}

.goal-note {
  margin-top: 7px;
  color: var(--muted);
  font-size: 15px;
}

.goal-note .stars {
  display: inline-block;
  margin-bottom: 3px;
  font-size: 24px;
}

.goal-up {
  color: var(--green);
  font-size: 1.45em;
  font-weight: 900;
  white-space: nowrap;
}

.goal-card .bar-track {
  height: 16px;
}

.level-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(31, 37, 32, 0.38);
  transform: translateX(-1px);
}

@media (min-width: 680px) {
  .app-shell {
    padding-top: 22px;
  }

  .hero-kpis,
  .shop-summary {
    grid-template-columns: repeat(4, 1fr);
  }
}
