:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #111827;
  --muted: #667085;
  --line: rgba(17, 24, 39, 0.08);
  --blue: #007aff;
  --red: #ff3b30;
  --green: #24b47e;
  --shadow: 0 16px 38px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fbff, var(--bg));
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 22px;
}

.login-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card {
  width: min(430px, 100%);
  padding: 30px;
}

.brand-mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(145deg, #111827, #3b4658);
  color: white;
  font-size: 26px;
  font-weight: 800;
}

.eyebrow {
  margin: 18px 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: 36px;
  line-height: 1.08;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.copy,
.empty {
  color: var(--muted);
  line-height: 1.65;
}

.merchant-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 26px;
}

.topbar,
.panel-head,
.form-actions,
.card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar,
.panel-head {
  justify-content: space-between;
}

.panel {
  margin-bottom: 16px;
  padding: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stats-grid article {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  padding: 16px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
}

.stats-grid span,
.stats-grid em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.stats-grid strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 26px;
}

.form {
  display: grid;
  gap: 12px;
}

.form.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form label {
  display: grid;
  gap: 7px;
  color: #374151;
  font-size: 13px;
  font-weight: 740;
}

.upload-field,
.location-field {
  display: grid;
  gap: 8px;
  color: #374151;
  font-size: 13px;
  font-weight: 740;
}

.form .span-2,
.form-actions {
  grid-column: 1 / -1;
}

.form input,
.form textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  padding: 0 12px;
  background: white;
  color: #273244;
}

.form textarea {
  min-height: 90px;
  resize: vertical;
  padding: 10px 12px;
}

.primary,
.ghost {
  min-height: 44px;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 800;
  padding: 0 16px;
}

.primary {
  border: 0;
  background: var(--blue);
  color: white;
  box-shadow: 0 12px 26px rgba(0, 122, 255, 0.22);
}

.ghost {
  border: 1px solid var(--line);
  background: white;
  color: #273244;
}

.message {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
}

.message.ok {
  color: var(--green);
}

.file-input {
  display: none;
}

.logo-upload-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.logo-preview {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #eef6ff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-hint {
  min-height: 19px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.location-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.location-results {
  display: grid;
  max-height: 230px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
}

.location-option {
  border: 0;
  border-bottom: 1px solid var(--line);
  background: white;
  color: #273244;
  cursor: pointer;
  padding: 11px 12px;
  text-align: left;
}

.location-option:last-child {
  border-bottom: 0;
}

.location-option strong,
.location-option span {
  display: block;
}

.location-option strong {
  font-size: 14px;
}

.location-option span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.location-summary {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.full {
  width: 100%;
}

.audit-panel {
  border-color: rgba(255, 149, 0, 0.28);
  background: #fffaf2;
}

#auditBadge {
  border-radius: 999px;
  background: rgba(255, 149, 0, 0.13);
  color: #a05a00;
  font-size: 13px;
  font-weight: 800;
  padding: 6px 10px;
}

.menu-list,
.tag-list,
.group-list,
.highlight-list,
.feed-list {
  display: grid;
  gap: 10px;
}

.panel-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.menu-card,
.tag-card,
.group-card,
.highlight-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  padding: 10px;
}

.tag-card {
  grid-template-columns: minmax(0, 1fr) auto;
  background: #fff;
}

.menu-card img,
.group-card img,
.placeholder {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  background: #eef6ff;
}

.placeholder {
  display: grid;
  place-items: center;
  color: var(--blue);
  font-weight: 900;
}

.menu-card strong,
.tag-card strong,
.group-card strong,
.highlight-card strong,
.menu-card span,
.tag-card span,
.group-card span,
.group-card em,
.highlight-card span,
.menu-card p,
.feed-item strong,
.feed-item span {
  display: block;
}

.menu-card span,
.tag-card span,
.group-card span,
.group-card em,
.highlight-card span,
.menu-card p,
.feed-item p,
.feed-item span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.group-card em {
  align-self: center;
  border-radius: 999px;
  background: #e7f8f4;
  color: #07806b;
  font-style: normal;
  font-weight: 800;
  padding: 7px 10px;
}

.highlight-color {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 16px;
  color: #273244;
  font-size: 13px;
  font-weight: 900;
}

.menu-card p,
.feed-item p {
  margin: 4px 0;
}

.card-actions button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: #273244;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  padding: 0 10px;
}

.card-actions .danger {
  color: var(--red);
}

.inline-edit {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.inline-edit input {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #273244;
  font-size: 13px;
  padding: 8px 10px;
}

.inline-edit button {
  border: 1px solid rgba(0, 122, 255, 0.22);
  border-radius: 10px;
  background: #eef6ff;
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  padding: 0 11px;
}

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

.pager div {
  display: flex;
  gap: 8px;
}

.pager button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #273244;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  padding: 0 11px;
}

.pager button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.feed-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  padding: 14px;
}

.audit-steps {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.audit-step {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  color: var(--muted);
}

.audit-step > span {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border: 2px solid #d0d5dd;
  border-radius: 999px;
  background: white;
}

.audit-step.done > span {
  border-color: var(--green);
  background: var(--green);
}

.audit-step.danger > span {
  border-color: var(--red);
  background: var(--red);
}

.audit-step strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.audit-step p {
  margin: 3px 0 0;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .merchant-shell {
    padding: 18px 14px;
  }

  .topbar,
  .panel-head,
  .form-actions,
  .card-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats-grid,
  .form.two,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .menu-card,
  .tag-card,
  .group-card,
  .highlight-card {
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: flex-start;
  }

  .tag-card {
    grid-template-columns: 1fr;
  }

  .menu-card img,
  .group-card img,
  .highlight-color,
  .placeholder {
    width: 58px;
    height: 58px;
  }

  .group-card em,
  .card-actions {
    grid-column: 1 / -1;
  }

  .card-actions button,
  .pager button,
  .inline-edit button,
  .form-actions button,
  .topbar button,
  .location-search-row button {
    flex: 1;
    width: 100%;
  }

  .panel {
    padding: 16px;
  }

  .login-card {
    padding: 22px;
  }

  .stats-grid strong {
    font-size: 22px;
  }

  .location-search-row {
    grid-template-columns: 1fr;
  }

  .pager {
    align-items: stretch;
    flex-direction: column;
  }

  .inline-edit {
    flex-direction: column;
  }

  .logo-upload-row {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .logo-preview {
    width: 64px;
    height: 64px;
  }
}
