:root {
  --ink: #151922;
  --muted: #657084;
  --line: #dfe4ea;
  --surface: #ffffff;
  --canvas: #f4f6f8;
  --green: #147a50;
  --green-soft: #e7f5ee;
  --amber: #a75f00;
  --amber-soft: #fff3da;
  --red: #b42318;
  --red-soft: #fff0ed;
  --blue: #2458d3;
  --blue-soft: #edf3ff;
  --shadow: 0 18px 50px rgba(21, 25, 34, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

a:hover {
  text-decoration: underline;
}

.admin-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 44px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  min-width: 210px;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.brand-text {
  display: grid;
  line-height: 1.15;
}

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

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.nav a:hover,
.nav a.is-active {
  background: var(--blue-soft);
  color: var(--blue);
  text-decoration: none;
}

.admin-main {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 30px 0 54px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.page-head h1 {
  margin: 4px 0 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.head-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}

.button:hover {
  border-color: #b7c2cf;
  text-decoration: none;
}

.button-primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.button-primary:hover {
  border-color: #1b45ab;
}

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

.inline-form {
  margin: 0;
}

.table-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.table-action-form {
  margin: 0;
}

.link-button {
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

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

.notice {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid #b7dfca;
  border-radius: 8px;
  background: var(--green-soft);
  color: #0f5f3e;
  font-weight: 650;
}

.notice-danger {
  border-color: #ffc7bf;
  background: var(--red-soft);
  color: var(--red);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  min-height: 118px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat-card span,
.stat-card small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.stat-card strong {
  display: block;
  margin-top: 12px;
  font-size: 36px;
  line-height: 1;
}

.stat-card .stat-text {
  font-size: 24px;
  line-height: 1.18;
}

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

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

.split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel + .panel {
  margin-top: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  background: #fafbfc;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  overflow-wrap: anywhere;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill-ok {
  background: var(--green-soft);
  color: var(--green);
}

.pill-danger {
  background: var(--red-soft);
  color: var(--red);
}

.form-panel {
  display: grid;
  gap: 14px;
  padding-bottom: 18px;
}

.form-panel .panel-head {
  margin-bottom: 2px;
}

label {
  display: grid;
  gap: 7px;
  padding: 0 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.muted-text {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid #cbd3dd;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid #dce7ff;
  border-color: var(--blue);
}

.form-panel .button {
  margin: 2px 18px 0;
}

.inline-settings-form {
  display: grid;
  grid-template-columns: minmax(180px, 260px) auto;
  gap: 12px;
  align-items: end;
  padding: 18px;
}

.inline-settings-form label {
  padding: 0;
}

code {
  padding: 2px 5px;
  border-radius: 6px;
  background: #eef1f4;
  color: #243047;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.api-list {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.api-list code {
  display: block;
  padding: 12px;
  border: 1px solid var(--line);
  background: #f9fafb;
}

.qr-panel {
  margin-bottom: 18px;
}

.batch-settings {
  margin-bottom: 18px;
}

.print-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 22px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.print-status strong {
  flex: 0 0 auto;
  font-weight: 850;
}

.print-status span {
  color: var(--muted);
  font-weight: 650;
}

.print-status-ok {
  border-color: #b7dfca;
  background: var(--green-soft);
}

.print-status-ok strong {
  color: var(--green);
}

.print-status-danger {
  border-color: #ffc7bf;
  background: var(--red-soft);
}

.print-status-danger strong {
  color: var(--red);
}

.qr-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  padding: 22px;
}

.qr-preview {
  width: 240px;
  max-width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-meta {
  min-width: 0;
}

.verify-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(20, 122, 80, 0.12), transparent 34%),
    linear-gradient(145deg, #f6f8fb 0%, #eef2f6 100%);
}

.verify-shell {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 100vh;
  padding: 24px;
}

.verify-card {
  width: min(620px, 100%);
  padding: clamp(22px, 5vw, 38px);
  border: 1px solid var(--line);
  border-top: 7px solid var(--green);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 80px rgba(21, 25, 34, 0.12);
}

.profile-card {
  margin-top: 16px;
  border-top-color: var(--blue);
}

.optional-location-card {
  margin-top: 16px;
  border-top-color: var(--amber);
}

.location-card form {
  margin-top: 4px;
}

.location-card .button {
  width: 100%;
}

.location-message,
.location-privacy {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.55;
}

.location-message:empty {
  display: none;
}

.location-privacy {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.shop-entry {
  position: relative;
  display: block;
  width: min(620px, 100%);
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(21, 25, 34, 0.12);
}

.shop-entry:hover {
  text-decoration: none;
}

.shop-entry img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.shop-entry span {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(21, 25, 34, 0.18);
}

.public-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.optional-location-card h2,
.profile-card h2 {
  margin: 7px 0 10px;
  font-size: 24px;
  line-height: 1.15;
}

.public-form {
  display: grid;
  gap: 14px;
}

.public-form label {
  padding: 0;
}

.checkbox-row {
  display: flex;
  grid-template-columns: none;
  gap: 10px;
  align-items: flex-start;
  color: var(--ink);
  font-weight: 650;
  line-height: 1.5;
}

.checkbox-row input {
  width: auto;
  min-height: auto;
  margin-top: 4px;
  flex: 0 0 auto;
}

.verify-warning {
  border-top-color: var(--amber);
}

.verify-danger,
.verify-invalid {
  border-top-color: var(--red);
}

.verify-topline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.verify-card h1 {
  margin: 7px 0 12px;
  font-size: clamp(30px, 8vw, 54px);
  line-height: 1;
}

.verify-copy {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.product-block {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 20px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.product-block img {
  width: 112px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.product-block > dl:only-child {
  grid-column: 1 / -1;
}

dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

dl div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
}

dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

dd {
  margin: 0;
  font-weight: 750;
  overflow-wrap: anywhere;
}

@media (max-width: 860px) {
  .topbar,
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand {
    min-width: 0;
  }

  .stat-grid,
  .split-grid {
    grid-template-columns: 1fr;
  }

  .admin-main {
    width: min(100vw - 24px, 720px);
    padding-top: 22px;
  }
}

@media (max-width: 520px) {
  .nav {
    width: 100%;
  }

  .nav a {
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
  }

  .head-actions {
    width: 100%;
  }

  .head-actions .button {
    flex: 1 1 100%;
  }

  .product-block {
    grid-template-columns: 1fr;
  }

  .qr-layout {
    grid-template-columns: 1fr;
  }

  .print-status {
    align-items: flex-start;
    flex-direction: column;
    margin-inline: 18px;
  }

  dl div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
