:root {
  color-scheme: light;
  --ink: #24180b;
  --muted: #7a6040;
  --line: #f0d79b;
  --paper: #fff7df;
  --panel: #ffffff;
  --brand: #f5b400;
  --brand-dark: #9a5800;
  --accent: #ff7a1a;
  --soft: #fff0ba;
  --danger: #ba3d17;
  --gold-deep: #c77a00;
  --gold-light: #fff3b0;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 214, 82, 0.52), transparent 32%),
    radial-gradient(circle at 88% 12%, rgba(255, 122, 26, 0.22), transparent 28%),
    var(--paper);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(154, 88, 0, 0.18);
}

.admin-shell {
  width: min(100%, 960px);
}

.card-profile {
  position: relative;
  padding: 0 20px 22px;
  overflow: hidden;
}

.cover {
  position: relative;
  height: 236px;
  margin: 0 -20px;
  background: #f5b400;
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(80, 45, 0, 0.02), rgba(83, 47, 0, 0.42)),
    linear-gradient(90deg, rgba(255, 184, 0, 0.42), rgba(255, 255, 255, 0.04));
}

.hero-brand {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 54px;
  color: #fff8d7;
  text-shadow: 0 3px 16px rgba(64, 36, 0, 0.4);
}

.hero-brand span {
  display: block;
  font-size: 28px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
}

.hero-brand small {
  display: block;
  margin-top: 8px;
  color: rgba(255, 247, 210, 0.9);
  font-size: 12px;
  font-weight: 700;
}

.profile-head {
  position: relative;
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  align-items: end;
  margin-top: -38px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 4px solid #fff;
  border-radius: 18px;
  background: linear-gradient(135deg, #ffef76, #ffb000 45%, #ff7a1a);
  color: #452600;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0;
  box-shadow: 0 16px 32px rgba(181, 105, 0, 0.32);
}

.avatar-mark {
  overflow: hidden;
}

.avatar-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.company-name {
  margin: 0 0 4px;
  color: #fff8da;
  font-size: 13px;
  font-weight: 700;
  text-shadow: 0 2px 10px rgba(64, 36, 0, 0.36);
}

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

h1 {
  margin-bottom: 3px;
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0;
}

.role {
  margin: 0;
  color: #6e4d20;
  font-size: 14px;
  line-height: 1.45;
}

.intro {
  margin: 18px 0;
  color: #4b3515;
  font-size: 15px;
  line-height: 1.7;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.action {
  min-width: 0;
  min-height: 70px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  border: 1px solid #f0c85a;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdf5, #fff4c8);
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  box-shadow: 0 10px 22px rgba(198, 122, 0, 0.12);
}

.action:active {
  transform: translateY(1px);
}

.action-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffcf34, #ff8a1d);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px;
  background: rgba(255, 250, 230, 0.96);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.tab {
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab.is-active {
  background: linear-gradient(135deg, #ffcb26, #ff7a1a);
  color: #3d2300;
  box-shadow: 0 8px 18px rgba(198, 122, 0, 0.2);
}

.panel {
  display: none;
  padding: 24px 20px 32px;
}

.panel.is-active {
  display: block;
}

.admin-hero {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 28px 24px 24px;
  background:
    linear-gradient(135deg, rgba(255, 207, 36, 0.94), rgba(255, 122, 26, 0.88)),
    #f5b400;
  color: #3d2300;
}

.admin-hero h1 {
  margin-bottom: 10px;
  font-size: 34px;
}

.admin-hero p:last-child {
  margin-bottom: 0;
  color: #5f3700;
  line-height: 1.65;
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(95, 55, 0, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  color: #3d2300;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.admin-panel {
  display: block;
  padding: 24px;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.admin-summary article {
  min-height: 86px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fff4c8);
  box-shadow: 0 14px 30px rgba(198, 122, 0, 0.08);
}

.admin-summary span,
.owner-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 10px;
  padding: 0 9px;
  border-radius: 999px;
  background: #fff0ba;
  color: #9a5800;
  font-size: 12px;
  font-weight: 900;
}

.admin-summary strong {
  display: block;
  color: #3d2300;
  font-size: 15px;
  line-height: 1.45;
}

.admin-entry-grid {
  align-items: stretch;
}

.admin-entry-card {
  display: block;
  min-height: 156px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fff4c8);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 14px 30px rgba(198, 122, 0, 0.08);
}

.admin-entry-card.company-owned,
.admin-entry-card.personal-owned {
  border-left-width: 5px;
}

.admin-entry-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.admin-entry-card:hover {
  transform: translateY(-1px);
}

.section-head {
  margin-bottom: 16px;
}

.eyebrow {
  margin-bottom: 6px;
  color: #d46d00;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 6px;
  font-size: 16px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.metrics div,
.stat-box,
.feature-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fff9e8);
}

.metrics div {
  padding: 14px 10px;
  box-shadow: 0 12px 24px rgba(198, 122, 0, 0.08);
}

.metrics strong {
  display: block;
  color: #b86500;
  font-size: 22px;
  line-height: 1.1;
}

.metrics span,
.stat-box span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.body-copy,
.feature-grid p,
.product-card p,
.qr-dialog p {
  color: var(--muted);
  line-height: 1.7;
}

.scope-grid,
.feature-grid {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.scope-grid {
  grid-template-columns: repeat(2, 1fr);
}

.scope-grid article {
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdf4, #fff1bd);
  box-shadow: 0 12px 24px rgba(198, 122, 0, 0.08);
}

.scope-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.scope-grid strong {
  display: block;
  color: #9a5800;
  font-size: 14px;
  line-height: 1.45;
}

.feature-grid article {
  padding: 16px;
  box-shadow: 0 12px 24px rgba(198, 122, 0, 0.08);
}

.trust-section-head {
  margin-top: 24px;
}

.trust-list {
  display: grid;
  gap: 12px;
}

.trust-card,
.trust-empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fff8df);
  box-shadow: 0 14px 30px rgba(198, 122, 0, 0.1);
}

.trust-card {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 14px;
  align-items: center;
  padding: 10px;
}

.trust-card img,
.trust-image-fallback {
  width: 116px;
  height: 92px;
  border-radius: 8px;
  object-fit: cover;
}

.trust-image-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ffef76, #ffb000 45%, #ff7a1a);
  color: #452600;
  font-weight: 900;
}

.trust-card span {
  display: block;
  margin-bottom: 5px;
  color: #b86500;
  font-size: 12px;
  font-weight: 900;
}

.trust-card h3,
.trust-empty h3 {
  margin-bottom: 6px;
}

.trust-card p,
.trust-empty p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.trust-empty {
  padding: 16px;
}

.product-list {
  display: grid;
  gap: 12px;
}

.product-card {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 14px;
  align-items: center;
  min-height: 118px;
  padding: 10px;
  border: 1px solid #f0d79b;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fff8df);
  box-shadow: 0 14px 30px rgba(198, 122, 0, 0.1);
}

.product-card img {
  width: 112px;
  height: 96px;
  border-radius: 8px;
  object-fit: cover;
}

.lead-form,
.admin-form {
  display: grid;
  gap: 14px;
}

.lead-form label,
.admin-form .field {
  display: grid;
  gap: 7px;
  color: #4b3515;
  font-size: 14px;
  font-weight: 700;
}

.lead-form input,
.lead-form textarea,
.admin-form input,
.admin-form textarea,
.admin-form select,
.field select {
  width: 100%;
  border: 1px solid #e7c36c;
  border-radius: 8px;
  padding: 12px 13px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.lead-form input:focus,
.lead-form textarea:focus,
.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus,
.field select:focus {
  border-color: #ff9f1a;
  box-shadow: 0 0 0 3px rgba(255, 178, 0, 0.22);
}

.form-block {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fff8df);
  box-shadow: 0 14px 30px rgba(198, 122, 0, 0.08);
}

.company-owned {
  border-left: 5px solid #ffbf00;
}

.personal-owned {
  border-left: 5px solid #ff7a1a;
}

.staff-owned {
  border-left: 5px solid #d6a100;
}

.form-block-head {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid #f3d99b;
}

.form-block-head h3 {
  margin-bottom: 0;
  color: #9a5800;
  font-size: 20px;
}

.form-block-head p {
  width: min(100%, 360px);
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.owner-badge {
  margin-bottom: 8px;
}

.owner-badge.personal {
  background: #ffe0bf;
  color: #b94d00;
}

.owner-badge.staff {
  background: #fff0ba;
  color: #7d5b00;
}

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

.field-wide {
  grid-column: 1 / -1;
}

.field span {
  color: #5c3a10;
  font-size: 13px;
  font-weight: 900;
}

.photo-upload {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px dashed #e1b04e;
  border-radius: 8px;
  background: #fffaf0;
}

.photo-preview {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  overflow: hidden;
  border: 3px solid #fff;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffef76, #ffb000 45%, #ff7a1a);
  color: #452600;
  font-size: 26px;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(181, 105, 0, 0.18);
}

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

.trust-photo-preview {
  width: 120px;
  height: 88px;
}

.photo-upload p {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.field-title {
  display: block;
  color: #5c3a10;
  font-size: 13px;
  font-weight: 900;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-right: 8px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffcf24, #ff7a1a);
  color: #3d2300;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.file-button input {
  display: none;
}

.compact-button {
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
}

.trust-editor {
  display: grid;
  gap: 14px;
}

.trust-admin-list {
  display: grid;
  gap: 8px;
}

.trust-admin-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #f0d79b;
  border-radius: 8px;
  background: #fffaf0;
}

.trust-admin-item strong {
  color: #3d2300;
}

.trust-admin-item span {
  grid-column: 1;
  color: var(--muted);
  font-size: 12px;
}

.trust-admin-item button {
  grid-row: 1 / span 2;
  grid-column: 2;
  min-height: 34px;
  border: 1px solid #e7c36c;
  border-radius: 8px;
  background: #fff9e8;
  color: #9a5800;
  font-weight: 800;
}

.admin-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 0 0;
}

.secondary-button {
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid #e7c36c;
  border-radius: 8px;
  background: #fff9e8;
  color: #6e4d20;
  font-weight: 800;
}

.admin-section-head {
  margin-top: 28px;
}

.section-note {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.check-row {
  grid-template-columns: 18px 1fr;
  align-items: start;
  font-weight: 500;
}

.check-row input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
}

.primary-button {
  height: 48px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffcf24, #ff7a1a);
  color: #3d2300;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(255, 122, 26, 0.28);
}

.form-note {
  min-height: 22px;
  margin: 0;
  color: #9a5800;
  font-weight: 700;
}

.share-card-hint {
  display: grid;
  gap: 4px;
  margin: -4px 0 18px;
  padding: 12px 14px;
  border: 1px solid #f0d79b;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdf5, #fff1bd);
}

.share-card-hint span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.share-card-hint a,
.section-note a {
  color: #9a5800;
  font-weight: 800;
  text-decoration: none;
  word-break: break-all;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-box {
  padding: 16px;
}

.stat-box strong {
  display: block;
  margin-top: 8px;
  color: #b86500;
  font-size: 28px;
}

.lead-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.lead-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 460px;
  background: #fff;
}

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

.lead-table th {
  color: var(--muted);
  background: #fff0ba;
}

.staff-context {
  margin-bottom: 14px;
}

.employee-admin-list {
  display: grid;
  gap: 10px;
}

.employee-row {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fff8df);
  box-shadow: 0 12px 24px rgba(198, 122, 0, 0.08);
}

.employee-avatar {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffef76, #ffb000 45%, #ff7a1a);
  color: #452600;
  font-weight: 900;
}

.employee-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.employee-row strong,
.employee-row span,
.employee-row code {
  display: block;
}

.employee-row strong {
  color: #3d2300;
  font-size: 16px;
}

.employee-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.employee-row code {
  margin-top: 6px;
  color: #9a5800;
  font-size: 12px;
  white-space: normal;
  word-break: break-all;
}

.employee-row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.employee-row-actions button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #e7c36c;
  border-radius: 8px;
  background: #fff9e8;
  color: #9a5800;
  font-weight: 800;
}

.qr-dialog {
  width: min(88vw, 340px);
  border: 0;
  border-radius: 8px;
  padding: 24px;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(154, 88, 0, 0.28);
}

.qr-dialog::backdrop {
  background: rgba(78, 44, 0, 0.46);
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--soft);
  color: var(--ink);
  font-size: 22px;
}

.qr-code {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  width: 180px;
  height: 180px;
  margin: 16px auto;
  padding: 16px;
  border: 8px solid #fff;
  background: #fff5ca;
  box-shadow: inset 0 0 0 1px var(--line);
}

.qr-code span {
  background: #9a5800;
}

.qr-code span:nth-child(2n),
.qr-code span:nth-child(7),
.qr-code span:nth-child(13) {
  background: transparent;
}

@media (min-width: 860px) {
  body {
    padding: 32px;
  }

  .app-shell {
    border-radius: 18px;
    overflow: hidden;
  }
}

@media (max-width: 720px) {
  .admin-hero {
    display: grid;
    padding: 24px 20px;
  }

  .admin-hero h1 {
    font-size: 30px;
  }

  .admin-panel {
    padding: 20px;
  }

  .admin-summary,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .form-block-head {
    display: grid;
  }

  .form-block-head p {
    width: auto;
  }

  .admin-actions {
    display: grid;
  }

  .photo-upload {
    grid-template-columns: 1fr;
  }

  .employee-row {
    grid-template-columns: 48px 1fr;
  }

  .employee-avatar {
    width: 48px;
    height: 48px;
  }

  .employee-row-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 380px) {
  .quick-actions {
    grid-template-columns: repeat(3, 1fr);
  }

  .scope-grid {
    grid-template-columns: 1fr;
  }

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

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

  .product-card img {
    width: 100%;
    height: 150px;
  }
}
