:root,
html[data-theme="light"] {
  color-scheme: light;
  --background: #f7f5f0;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-secondary: #f5f3ee;
  --text-primary: #151712;
  --text-secondary: #4e554b;
  --text-muted: #7a8177;
  --border: #e7e2d8;
  --border-strong: #d7d0c3;
  --accent: #176b4c;
  --accent-hover: #10563d;
  --accent-soft: #edf7f1;
  --success: #1f7a4d;
  --warning: #a16207;
  --danger: #b42318;
  --overlay: rgba(17, 24, 39, 0.48);
  --shadow-color: rgba(21, 23, 18, 0.08);
  --shadow-color-strong: rgba(21, 23, 18, 0.14);
  --hover: color-mix(in srgb, var(--accent) 8%, var(--surface));
  --active: color-mix(in srgb, var(--accent) 14%, var(--surface));
  --focus: color-mix(in srgb, var(--accent) 32%, transparent);
  --input-background: #ffffff;
  --dropdown-background: #ffffff;
  --hero-surface: color-mix(in srgb, var(--surface) 78%, var(--surface-inset));
  --hero-accent: color-mix(in srgb, var(--accent) 12%, transparent);
  --category-surface: color-mix(in srgb, var(--surface) 86%, var(--surface-inset));
  --category-hover: color-mix(in srgb, var(--accent) 9%, var(--surface));
  --placeholder-surface: color-mix(in srgb, var(--accent-soft) 58%, var(--surface-inset));
  --placeholder-mark: var(--accent);
  --section-divider: color-mix(in srgb, var(--border) 78%, transparent);
  --catalog-shell: color-mix(in srgb, var(--surface) 82%, var(--surface-inset));
  --catalog-sidebar-surface: color-mix(in srgb, var(--surface) 88%, var(--surface-inset));
  --catalog-card-surface: color-mix(in srgb, var(--surface) 94%, var(--surface-inset));
  --catalog-media-surface: color-mix(in srgb, var(--accent-soft) 52%, var(--surface-inset));
  --detail-surface: color-mix(in srgb, var(--surface) 90%, var(--surface-inset));
  --detail-panel-surface: color-mix(in srgb, var(--surface) 96%, var(--surface-inset));
  --detail-media-surface: color-mix(in srgb, var(--accent-soft) 46%, var(--surface-inset));
  --detail-divider: color-mix(in srgb, var(--border) 82%, transparent);
  --detail-meta-surface: color-mix(in srgb, var(--surface-secondary) 78%, var(--surface));
  --profile-surface: color-mix(in srgb, var(--surface) 88%, var(--surface-inset));
  --profile-section-surface: color-mix(in srgb, var(--surface) 94%, var(--surface-inset));
  --profile-input-surface: var(--input-background);
  --profile-divider: color-mix(in srgb, var(--border) 82%, transparent);
  --profile-status-surface: color-mix(in srgb, var(--surface-secondary) 82%, var(--surface));
  --profile-action-surface: color-mix(in srgb, var(--accent-soft) 44%, var(--surface));
  --chat-surface: #fffdf9;
  --chat-sidebar-surface: #ffffff;
  --chat-message-in: #ffffff;
  --chat-message-out: #e7f4ec;
  --chat-composer: rgba(255, 255, 255, 0.94);
  --chat-divider: color-mix(in srgb, var(--border) 72%, transparent);
  --page-bg: #f7f5f0;
  --surface-primary: var(--surface);
  --surface-inset: #fbfaf7;
  --brand-green: var(--accent);
  --brand-green-hover: var(--accent-hover);
  --brand-green-soft: var(--accent-soft);
  --focus-ring: var(--focus);
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, "Noto Sans", sans-serif;
  --font-heading: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, "Noto Sans", sans-serif;
  --tracking-tight: -0.025em;
  --tracking-normal: -0.01em;
  --leading-tight: 1.08;
  --leading-heading: 1.16;
  --leading-body: 1.55;
  --radius: 10px;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-pill: 999px;
  --shadow-xs: 0 1px 2px rgba(21, 23, 18, 0.04);
  --shadow-sm: 0 1px 2px rgba(21, 23, 18, 0.04), 0 8px 18px rgba(21, 23, 18, 0.045);
  --shadow: 0 1px 2px rgba(21, 23, 18, 0.05), 0 14px 34px rgba(21, 23, 18, 0.07);
  --shadow-md: 0 10px 32px var(--shadow-color);
  --shadow-hover: 0 18px 42px rgba(21, 23, 18, 0.1);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --ease: 180ms cubic-bezier(0.2, 0, 0, 1);
  --ease-out: 220ms cubic-bezier(0.16, 1, 0.3, 1);
  --bg: var(--background);
  --surface-soft: var(--surface-secondary);
  --text: var(--text-primary);
  --muted: var(--text-muted);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --brand: var(--brand-green);
  --brand-strong: var(--brand-green-hover);
  --brand-soft: var(--brand-green-soft);
  --gold: var(--warning);
  --red: var(--danger);
  --content: 1180px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --background: #101410;
  --surface: #171d18;
  --surface-elevated: #1f271f;
  --surface-secondary: #141a15;
  --text-primary: #f3f6ef;
  --text-secondary: #c5cebf;
  --text-muted: #8f9a89;
  --border: #2d372d;
  --border-strong: #425041;
  --accent: #55c58f;
  --accent-hover: #78d9aa;
  --accent-soft: #173225;
  --success: #54c58b;
  --warning: #f0b84b;
  --danger: #ff7a6e;
  --overlay: rgba(0, 0, 0, 0.62);
  --shadow-color: rgba(0, 0, 0, 0.34);
  --shadow-color-strong: rgba(0, 0, 0, 0.48);
  --hover: color-mix(in srgb, var(--accent) 10%, var(--surface));
  --active: color-mix(in srgb, var(--accent) 16%, var(--surface));
  --focus: color-mix(in srgb, var(--accent) 45%, transparent);
  --input-background: #151c16;
  --dropdown-background: #1c241d;
  --hero-surface: color-mix(in srgb, var(--surface) 72%, var(--surface-elevated));
  --hero-accent: color-mix(in srgb, var(--accent) 13%, transparent);
  --category-surface: color-mix(in srgb, var(--surface-secondary) 76%, var(--surface));
  --category-hover: color-mix(in srgb, var(--accent) 12%, var(--surface));
  --placeholder-surface: color-mix(in srgb, var(--accent-soft) 48%, var(--surface-secondary));
  --placeholder-mark: color-mix(in srgb, var(--accent) 82%, var(--text-secondary));
  --section-divider: color-mix(in srgb, var(--border) 82%, transparent);
  --catalog-shell: color-mix(in srgb, var(--surface-secondary) 72%, var(--surface));
  --catalog-sidebar-surface: color-mix(in srgb, var(--surface) 72%, var(--surface-elevated));
  --catalog-card-surface: color-mix(in srgb, var(--surface) 78%, var(--surface-elevated));
  --catalog-media-surface: color-mix(in srgb, var(--accent-soft) 42%, var(--surface-secondary));
  --detail-surface: color-mix(in srgb, var(--surface) 74%, var(--surface-elevated));
  --detail-panel-surface: color-mix(in srgb, var(--surface) 82%, var(--surface-elevated));
  --detail-media-surface: color-mix(in srgb, var(--accent-soft) 38%, var(--surface-secondary));
  --detail-divider: color-mix(in srgb, var(--border) 86%, transparent);
  --detail-meta-surface: color-mix(in srgb, var(--surface-secondary) 76%, var(--surface));
  --profile-surface: color-mix(in srgb, var(--surface) 74%, var(--surface-elevated));
  --profile-section-surface: color-mix(in srgb, var(--surface) 82%, var(--surface-elevated));
  --profile-input-surface: var(--input-background);
  --profile-divider: color-mix(in srgb, var(--border) 86%, transparent);
  --profile-status-surface: color-mix(in srgb, var(--surface-secondary) 76%, var(--surface));
  --profile-action-surface: color-mix(in srgb, var(--accent-soft) 36%, var(--surface));
  --chat-surface: #101711;
  --chat-sidebar-surface: #171f18;
  --chat-message-in: #202920;
  --chat-message-out: #193424;
  --chat-composer: rgba(23, 31, 24, 0.96);
  --chat-divider: color-mix(in srgb, var(--border) 76%, transparent);
  --page-bg: var(--background);
  --surface-primary: var(--surface);
  --surface-inset: #111712;
  --brand-green: var(--accent);
  --brand-green-hover: var(--accent-hover);
  --brand-green-soft: var(--accent-soft);
  --focus-ring: var(--focus);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.22);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.24), 0 8px 18px rgba(0, 0, 0, 0.22);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.26), 0 14px 34px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 10px 32px var(--shadow-color);
  --shadow-hover: 0 18px 42px rgba(0, 0, 0, 0.36);
  --bg: var(--background);
  --surface-soft: var(--surface-secondary);
  --text: var(--text-primary);
  --muted: var(--text-muted);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --brand: var(--brand-green);
  --brand-strong: var(--brand-green-hover);
  --brand-soft: var(--brand-green-soft);
  --gold: var(--warning);
  --red: var(--danger);
}

/* Production admin console */
.admin-app-body {
  min-height: 100vh;
  margin: 0;
  color: #111827;
  background: #f8f9fa;
}

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

.admin-login-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 28px;
  align-items: center;
  min-height: 100vh;
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
}

.admin-login-copy h1 {
  max-width: 620px;
  margin: 18px 0 10px;
  color: #111827;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
}

.admin-login-copy p {
  max-width: 560px;
  color: #6b7280;
}

.admin-login-card {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.admin-login-card button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-weight: 700;
}

.admin-console {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid #e5e7eb;
  background: #fff;
  z-index: 30;
}

.admin-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
}

.admin-drawer-close,
.admin-menu-button,
.admin-modal-close {
  display: none;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.admin-nav {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.admin-nav button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text-secondary);
  background: transparent;
  text-align: left;
  font-weight: 650;
}

.admin-nav button:hover,
.admin-nav button.active {
  color: #0f5132;
  background: color-mix(in srgb, var(--brand) 12%, #fff);
}

.admin-planned {
  display: grid;
  gap: 6px;
  margin: 12px;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  padding: 12px;
  color: #6b7280;
  font-size: 0.88rem;
}

.admin-main {
  min-width: 0;
  padding: 18px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  margin-bottom: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
}

.admin-topbar h1 {
  margin: 0;
  font-size: 1.35rem;
}

.admin-topbar-actions,
.admin-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.admin-content {
  display: none;
}

.admin-content.active {
  display: grid;
  gap: 16px;
}

.admin-status-line {
  min-height: 22px;
  color: #6b7280;
  font-size: 0.9rem;
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.admin-kpi-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-kpi,
.admin-panel-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.admin-kpi {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.admin-kpi span,
.admin-kpi small,
.admin-mini-list span,
.admin-file-list span,
.admin-detail-grid span {
  color: #6b7280;
  font-size: 0.84rem;
}

.admin-kpi strong {
  color: #111827;
  font-size: 1.35rem;
}

.admin-grid-two,
.admin-grid-three,
.admin-grid-four {
  display: grid;
  gap: 16px;
}

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

.admin-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-grid-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-panel-card {
  min-width: 0;
  padding: 14px;
}

.admin-panel-card h2,
.admin-file-list h3 {
  margin: 0 0 12px;
  color: #111827;
  font-size: 1rem;
}

.admin-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-chart,
.admin-mini-list,
.admin-file-list {
  display: grid;
  gap: 8px;
}

.admin-bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(120px, 2fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.admin-bar-row b {
  display: block;
  height: 9px;
  border-radius: 999px;
  background: var(--brand);
}

.admin-bar-row strong {
  min-width: 44px;
  text-align: right;
}

.admin-mini-list article,
.admin-file-list article {
  display: grid;
  gap: 4px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  background: #f9fafb;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.admin-toolbar input,
.admin-toolbar select {
  min-height: 40px;
  min-width: 190px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0 10px;
}

.admin-table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.admin-data-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

.admin-data-table th,
.admin-data-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
}

.admin-data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #6b7280;
  background: #f8f9fa;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.admin-data-table tr:hover td {
  background: #f9fafb;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.78rem;
}

.admin-badge.good {
  color: #0f5132;
  background: #dcfce7;
}

.admin-badge.warn {
  color: #92400e;
  background: #fef3c7;
}

.admin-link-button,
.admin-danger,
.secondary-button {
  min-height: 40px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  font-weight: 650;
}

.admin-link-button {
  color: #0f5132;
}

.admin-danger {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fff;
}

.admin-danger:disabled,
.admin-link-button:disabled {
  opacity: 0.55;
}

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: #6b7280;
}

.admin-pagination button {
  min-height: 38px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.admin-thumb {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-size: 0.8rem;
  font-weight: 800;
}

.admin-thumb img,
.admin-large-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-large-photo {
  width: min(100%, 420px);
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f3f4f6;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 24, 39, 0.45);
}

.admin-modal.hidden {
  display: none;
}

.admin-modal-card {
  position: relative;
  width: min(860px, 100%);
  max-height: min(86vh, 900px);
  overflow: auto;
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

.admin-modal-close {
  position: sticky;
  top: 0;
  display: grid;
  margin-left: auto;
}

.admin-detail {
  display: grid;
  gap: 14px;
}

.admin-detail h2 {
  margin: 0;
}

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

.admin-detail-grid div {
  display: grid;
  gap: 4px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  background: #f9fafb;
}

.admin-skeleton {
  min-height: 42px;
  border-radius: 8px;
  background: linear-gradient(90deg, #f3f4f6, #e5e7eb, #f3f4f6);
  background-size: 200% 100%;
  animation: admin-skeleton 1.2s infinite linear;
}

@keyframes admin-skeleton {
  to { background-position: -200% 0; }
}

.admin-error-state {
  display: grid;
  gap: 8px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 12px;
  color: #991b1b;
  background: #fff1f2;
}

.admin-drawer-backdrop {
  display: none;
}

@media (max-width: 1280px) {
  .admin-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-grid-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .admin-login-view,
  .admin-console,
  .admin-grid-two,
  .admin-grid-three,
  .admin-grid-four,
  .admin-detail-grid {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-102%);
    width: min(300px, 88vw);
    transition: transform 0.2s ease;
  }

  .admin-sidebar.open {
    transform: translateX(0);
  }

  .admin-drawer-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(17, 24, 39, 0.38);
  }

  .admin-drawer-close,
  .admin-menu-button {
    display: grid;
    place-items: center;
  }

  .admin-main {
    padding: 10px;
  }

  .admin-topbar {
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .admin-login-view {
    width: min(100% - 20px, 420px);
    padding: 18px 0;
  }

  .admin-topbar,
  .admin-topbar-actions,
  .admin-section-head,
  .admin-toolbar,
  .admin-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-kpi-grid,
  .admin-kpi-grid.compact {
    grid-template-columns: 1fr;
  }

  .admin-toolbar input,
  .admin-toolbar select,
  .admin-topbar-actions button,
  .admin-pagination button {
    width: 100%;
    min-height: 44px;
  }

  .admin-data-table {
    min-width: 760px;
  }

  .admin-bar-row {
    grid-template-columns: 1fr;
  }

  .admin-bar-row strong {
    text-align: left;
  }
}

* {
  box-sizing: border-box;
}

html {
  max-width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-normal);
}

body.mobile-nav-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.app,
.admin-shell {
  width: min(var(--content), calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar,
.admin-header {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  background: var(--surface);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 850;
  font-size: 1.08rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  color: #ffffff;
  background: var(--brand);
  font-size: 0.82rem;
  font-weight: 900;
}

.main-nav,
.header-actions,
.lang-switch,
.form-actions,
.admin-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.main-nav {
  justify-content: center;
}

.header-actions,
.admin-actions {
  justify-content: flex-end;
}

.mobile-menu-trigger {
  display: none;
}

.nav-button,
.nav-link,
.quick-type,
.lang-button,
.secondary-button,
.auth-link,
.admin-link-button,
.admin-danger {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  color: var(--muted);
  background: var(--surface);
  font-weight: 800;
}

.nav-button,
.nav-link,
.auth-link,
.call-button,
.message-button,
.whatsapp-button,
.secondary-button,
.profile-form button[type="submit"],
.auth-card button,
.google-auth-button {
  touch-action: manipulation;
}

.nav-button:hover,
.nav-link:hover,
.quick-type:hover,
.auth-link:hover,
.secondary-button:hover,
.admin-link-button:hover {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--surface-soft);
}

.nav-button.active,
.nav-link.active,
.quick-type.active,
.lang-button.active,
.auth-link,
.call-button,
.profile-form button[type="submit"],
.auth-card button {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

.nav-link,
.auth-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.nav-link.has-unread::after {
  content: attr(data-unread);
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  padding: 0 5px;
  color: #fff;
  background: var(--red);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
}

.auth-link {
  white-space: nowrap;
}

.lang-switch {
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.lang-button {
  min-width: 42px;
  padding: 0 10px;
}

.account-menu {
  position: relative;
}

.account-trigger {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--brand);
  border-radius: 50%;
  color: #fff;
  background: var(--brand);
}

.account-trigger > .business-unread-dot,
.business-profile-link > .business-unread-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  z-index: 2;
  display: block;
  width: 10px;
  min-width: 10px;
  height: 10px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  padding: 0;
  background: var(--red);
  box-shadow: none;
}

.account-trigger > .business-unread-dot.hidden,
.business-profile-link > .business-unread-dot.hidden {
  display: none;
}

.business-profile-link {
  position: relative;
}

.account-trigger > span,
.account-summary-avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background-color: var(--brand);
  background-position: center;
  background-size: cover;
  font-weight: 900;
}

.account-trigger > span {
  width: 100%;
  height: 100%;
}

.account-trigger .has-photo,
.account-summary-avatar.has-photo {
  color: transparent;
}

.subscriber-icon {
  background-image: none !important;
}

.subscriber-icon::before {
  content: "";
  width: 56%;
  height: 56%;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Zm0 2c-4.42 0-8 2.24-8 5v1h16v-1c0-2.76-3.58-5-8-5Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Zm0 2c-4.42 0-8 2.24-8 5v1h16v-1c0-2.76-3.58-5-8-5Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.account-dropdown {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 10px);
  right: 0;
  left: auto;
  width: min(280px, calc(100vw - 24px));
  min-width: min(220px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.account-dropdown-compact {
  width: min(220px, calc(100vw - 24px));
  min-width: min(220px, calc(100vw - 24px));
}

.account-summary {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.account-summary-avatar {
  width: 48px;
  height: 48px;
  color: #fff;
}

.account-summary > div:last-child {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.account-summary strong,
.account-summary span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-summary span {
  color: var(--muted);
  font-size: 0.9rem;
}

.account-dropdown > a,
.account-dropdown > button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  background: transparent;
  font-weight: 800;
  text-align: left;
  text-decoration: none;
}

.account-dropdown > button {
  color: var(--red);
}

.account-dropdown > a:hover,
.account-dropdown > button:hover {
  background: var(--surface-soft);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

html[data-initial-view] .view {
  display: none;
}

html[data-initial-view="home"] #homeView,
html[data-initial-view="search"] #searchView,
html[data-initial-view="stores"] #storesView,
html[data-initial-view="chat"] #chatView {
  display: block;
}

html[data-initial-view="chat"] .site-footer {
  display: none;
}

.home-catalog,
.home-intro,
.hero,
.finder,
.auth-page,
.profile-form,
.admin-login,
.admin-dashboard,
.chat-layout {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.home-catalog,
.home-intro,
.hero,
.auth-page {
  margin-top: 14px;
  padding: clamp(22px, 4vw, 44px);
}

.home-catalog {
  min-height: 560px;
}

.home-intro {
  display: grid;
  gap: 22px;
}

.home-intro-copy {
  max-width: 860px;
}

.home-intro-copy h1 {
  max-width: 820px;
  margin-bottom: 16px;
  font-size: clamp(2rem, 4.8vw, 4rem);
}

.home-intro-copy p:last-child,
.home-intro-note {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.65;
}

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

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

.home-intro-grid > div {
  display: grid;
  gap: 8px;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface-soft);
}

.home-intro-grid strong {
  color: var(--brand-strong);
  font-size: 1.02rem;
}

.home-intro-grid span {
  color: var(--muted);
  line-height: 1.5;
}

.home-catalog-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.home-catalog-header h1 {
  max-width: 760px;
  margin: 0;
}

.home-lead {
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.6;
}

.trust-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.trust-strip > div {
  display: grid;
  gap: 6px;
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface-soft);
}

.trust-strip strong {
  color: var(--brand-strong);
  font-size: 1rem;
}

.trust-strip span {
  color: var(--muted);
  line-height: 1.45;
}

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

.quick-category-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface);
  text-align: left;
  font-weight: 850;
}

.quick-category-button:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.quick-category-button b {
  display: grid;
  place-items: center;
  min-width: 30px;
  min-height: 26px;
  border-radius: 999px;
  color: #fff;
  background: var(--brand);
  font-size: 0.78rem;
}

/* Premium home entry screen. Scoped to / homeView only. */
#homeView .home-intro {
  position: relative;
  overflow: hidden;
  gap: clamp(18px, 2.3vw, 28px);
  margin-top: 16px;
  border-color: var(--section-divider);
  border-radius: var(--radius-xl);
  padding: clamp(20px, 3.2vw, 38px);
  background:
    radial-gradient(circle at 88% 8%, var(--hero-accent), transparent 34%),
    linear-gradient(135deg, var(--hero-surface), color-mix(in srgb, var(--surface-inset) 88%, var(--background)));
  box-shadow: var(--shadow-sm);
}

#homeView .home-intro-copy {
  display: grid;
  max-width: 820px;
  gap: 12px;
}

#homeView .home-intro-copy h1 {
  max-width: 760px;
  margin: 0;
  color: var(--text-primary);
  font-size: clamp(2rem, 4.1vw, 3.6rem);
  line-height: 1.04;
}

#homeView .home-intro-copy p:last-child {
  max-width: 660px;
  font-size: clamp(1rem, 0.45vw + 0.92rem, 1.12rem);
  line-height: 1.58;
}

#homeView .home-market-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#homeView .home-entry-card {
  position: relative;
  display: grid;
  min-height: 176px;
  overflow: hidden;
  border: 1px solid var(--section-divider);
  border-radius: var(--radius-xl);
  padding: 18px;
  color: inherit;
  background: var(--surface);
  text-decoration: none;
  transition:
    background-color var(--ease),
    border-color var(--ease),
    box-shadow var(--ease),
    transform var(--ease);
}

#homeView .home-entry-card::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 72px;
  height: 72px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: 22px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent),
    repeating-linear-gradient(135deg, transparent 0 9px, color-mix(in srgb, var(--accent) 8%, transparent) 9px 10px);
  opacity: 0.92;
}

#homeView .home-entry-card:hover {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border-strong));
  background: var(--category-hover);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

#homeView .home-entry-card:active {
  transform: translateY(0);
}

#homeView .home-entry-kicker {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 680;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

#homeView .home-entry-card strong {
  max-width: 360px;
  margin-top: 12px;
  color: var(--text-primary);
  font-size: clamp(1.32rem, 1vw + 1rem, 1.82rem);
  line-height: 1.08;
}

#homeView .home-entry-card > span:last-of-type {
  max-width: 380px;
  margin-top: 8px;
  color: var(--text-secondary);
  line-height: 1.48;
}

#homeView .home-entry-card em {
  position: absolute;
  right: 18px;
  top: 16px;
  color: color-mix(in srgb, var(--brand) 56%, var(--text-muted));
  font-style: normal;
  font-size: 0.82rem;
  font-weight: 760;
}

#homeView .home-entry-master {
  background:
    linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--accent-soft) 46%, var(--surface)));
}

#homeView .home-entry-store {
  background:
    linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--warning) 10%, var(--surface)));
}

#homeView .home-quick-area,
#homeView .home-preview-section,
#homeView .home-trust-note {
  border: 1px solid var(--section-divider);
  border-radius: var(--radius-xl);
  background: color-mix(in srgb, var(--surface) 86%, var(--surface-inset));
}

#homeView > .home-quick-area,
#homeView > .home-preview-grid,
#homeView > .home-trust-note {
  margin-top: 12px;
}

#homeView .home-quick-area,
#homeView .home-preview-section {
  padding: 16px;
}

#homeView .home-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

#homeView .home-section-head h2 {
  margin: 2px 0 0;
  font-size: clamp(1.12rem, 1vw + 0.88rem, 1.45rem);
  line-height: 1.15;
}

#homeView .home-section-head a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--section-divider);
  border-radius: var(--radius-pill);
  padding: 0 13px;
  color: var(--accent);
  background: var(--category-surface);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 660;
  white-space: nowrap;
}

#homeView .home-section-head a:hover {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
  background: var(--category-hover);
}

#homeView .quick-categories {
  margin: 0;
}

#homeView .quick-category-button {
  min-height: 54px;
  border-color: var(--section-divider);
  border-radius: var(--radius-lg);
  background: var(--category-surface);
  font-weight: 650;
}

#homeView .quick-category-button:hover,
#homeView .quick-category-button:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
  background: var(--category-hover);
}

#homeView .quick-category-button b {
  color: var(--placeholder-mark);
  background: var(--placeholder-surface);
}

#homeView .home-preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

#homeView .home-preview-list {
  display: grid;
  gap: 10px;
}

#homeView .home-preview-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 92px;
  border: 1px solid var(--section-divider);
  border-radius: var(--radius-lg);
  padding: 8px;
  color: inherit;
  background: var(--surface);
  text-decoration: none;
  transition:
    border-color var(--ease),
    box-shadow var(--ease),
    transform var(--ease);
}

#homeView .home-preview-card:hover {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--border-strong));
  background: var(--category-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

#homeView .home-preview-media {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  overflow: hidden;
  border-radius: var(--radius-md);
  color: var(--placeholder-mark);
  background: var(--placeholder-surface);
  font-weight: 760;
  letter-spacing: 0.02em;
}

#homeView .home-preview-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#homeView .home-preview-body {
  display: grid;
  min-width: 0;
  gap: 5px;
}

#homeView .home-preview-body strong,
#homeView .home-preview-body span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#homeView .home-preview-body strong {
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.25;
}

#homeView .home-preview-body span {
  color: var(--text-muted);
  font-size: 0.88rem;
}

#homeView .home-preview-empty {
  min-height: 92px;
}

#homeView .home-trust-note {
  display: grid;
  grid-template-columns: minmax(180px, 0.55fr) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 16px;
}

#homeView .home-trust-note h2 {
  margin: 0;
  font-size: clamp(1.08rem, 0.8vw + 0.9rem, 1.35rem);
}

#homeView .home-trust-note ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

#homeView .home-trust-note li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 64px;
  border-right: 1px solid var(--section-divider);
  padding: 4px 14px;
  background: transparent;
}

#homeView .home-trust-note li:first-child {
  padding-left: 0;
}

#homeView .home-trust-note li:last-child {
  border-right: 0;
  padding-right: 0;
}

#homeView .home-trust-note li span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  color: var(--placeholder-mark);
  background: var(--placeholder-surface);
  font-size: 0.84rem;
  font-weight: 760;
}

#homeView .home-trust-note li div {
  display: grid;
  gap: 4px;
}

#homeView .home-trust-note li strong {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 640;
  line-height: 1.25;
}

#homeView .home-trust-note li p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

#homeView .home-intro-grid[aria-hidden="true"] {
  display: none;
}

html[data-theme="dark"] #homeView .home-intro {
  box-shadow: var(--shadow);
}

html[data-theme="dark"] #homeView .home-entry-master,
html[data-theme="dark"] #homeView .home-entry-store {
  background:
    radial-gradient(circle at 88% 18%, var(--hero-accent), transparent 38%),
    linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--surface-elevated) 76%, var(--surface-secondary)));
}

html[data-theme="dark"] #homeView .home-quick-area,
html[data-theme="dark"] #homeView .home-preview-section,
html[data-theme="dark"] #homeView .home-trust-note {
  background: color-mix(in srgb, var(--surface-secondary) 70%, var(--surface));
}

html[data-theme="dark"] #homeView .home-preview-card,
html[data-theme="dark"] #homeView .quick-category-button {
  background: color-mix(in srgb, var(--surface) 82%, var(--surface-elevated));
}

@media (max-width: 900px) {
  #homeView .home-preview-grid,
  #homeView .home-trust-note {
    grid-template-columns: 1fr;
  }

  #homeView .home-trust-note ol {
    grid-template-columns: 1fr;
  }

  #homeView .home-trust-note li,
  #homeView .home-trust-note li:first-child,
  #homeView .home-trust-note li:last-child {
    border-right: 0;
    border-bottom: 1px solid var(--section-divider);
    padding: 10px 0;
  }

  #homeView .home-trust-note li:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 768px) {
  #homeView .home-intro {
    gap: 16px;
    margin-top: 12px;
    padding: 16px;
    border-radius: var(--radius-lg);
  }

  #homeView .home-intro-copy {
    gap: 9px;
  }

  #homeView .home-intro-copy h1 {
    font-size: clamp(1.68rem, 8.2vw, 2.3rem);
    line-height: 1.07;
  }

  #homeView .home-intro-copy p:last-child {
    font-size: 0.98rem;
    line-height: 1.48;
  }

  #homeView .home-market-panel {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  #homeView .home-entry-card {
    min-height: 142px;
    padding: 15px;
    border-radius: var(--radius-lg);
  }

  #homeView .home-entry-card::after {
    right: 12px;
    bottom: 12px;
    width: 52px;
    height: 52px;
    border-radius: 16px;
  }

  #homeView .home-entry-card strong {
    max-width: calc(100% - 56px);
    margin-top: 8px;
    font-size: clamp(1.25rem, 5vw, 1.55rem);
  }

  #homeView .home-entry-card > span:last-of-type {
    max-width: calc(100% - 56px);
    font-size: 0.94rem;
    line-height: 1.4;
  }

  #homeView .home-quick-area,
  #homeView .home-preview-section,
  #homeView .home-trust-note {
    border-radius: var(--radius-lg);
    padding: 13px;
  }

  #homeView .home-section-head {
    align-items: start;
    margin-bottom: 12px;
  }

  #homeView .home-section-head a {
    min-height: 44px;
    padding-inline: 12px;
    font-size: 0.84rem;
  }

  #homeView .quick-categories {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(168px, 72%);
    grid-template-columns: none;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding-bottom: 2px;
    scroll-snap-type: x proximity;
  }

  #homeView .quick-category-button {
    min-height: 52px;
    scroll-snap-align: start;
  }

  #homeView .home-preview-card {
    grid-template-columns: 68px minmax(0, 1fr);
    min-height: 84px;
    border-radius: var(--radius-md);
  }

  #homeView .home-preview-media {
    width: 68px;
    height: 68px;
  }

  #homeView .home-trust-note {
    gap: 12px;
  }

  #homeView .home-trust-note li {
    min-height: 46px;
  }
}

@media (max-width: 380px) {
  #homeView .home-section-head {
    display: grid;
  }

  #homeView .home-section-head a {
    justify-self: start;
  }

  #homeView .quick-categories {
    grid-auto-columns: minmax(150px, 82%);
  }
}

@media (max-width: 340px) {
  #homeView .home-entry-card strong,
  #homeView .home-entry-card > span:last-of-type {
    max-width: 100%;
  }

  #homeView .home-entry-card::after {
    opacity: 0.28;
  }
}

.hero,
.auth-page,
.admin-login {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 28px;
  align-items: center;
}

.hero-photo,
.tool-card {
  display: none;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1,
h2,
h3 {
  color: var(--text-primary);
  font-family: var(--font-heading);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 {
  max-width: 760px;
  margin-bottom: 14px;
  font-size: clamp(2rem, 4.2vw, 3.75rem);
  line-height: var(--leading-tight);
  font-weight: 720;
}

h2 {
  font-size: clamp(1.35rem, 2.3vw, 2rem);
  line-height: var(--leading-heading);
  font-weight: 680;
}

h3 {
  font-size: clamp(1.02rem, 1.2vw, 1.2rem);
  line-height: 1.24;
  font-weight: 660;
}

.hero-copy p:last-child,
.auth-copy p:last-child,
.admin-login p {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.65;
}

.finder,
.account-layout {
  margin-top: 14px;
}

.finder {
  padding: 16px;
}

.search-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.category-sidebar {
  position: sticky;
  top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.category-sidebar > strong {
  display: block;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.category-list {
  display: grid;
}

.category-group {
  display: grid;
}

.category-group-title {
  display: block;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  color: var(--brand-strong);
  background: var(--surface-soft);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.category-list-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 9px 12px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-weight: 760;
}

.category-list-button:last-child {
  border-bottom: 0;
}

.category-list-button:hover,
.category-list-button.active {
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.category-list-button b {
  display: grid;
  place-items: center;
  min-width: 28px;
  min-height: 24px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 0.78rem;
}

.category-list-button.active b {
  color: #fff;
  background: var(--brand);
}

.search-results {
  min-width: 0;
}

.result-summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 52px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface-soft);
}

.result-summary strong {
  color: var(--brand-strong);
  font-size: 1.45rem;
  line-height: 1;
}

.result-summary span,
.file-field small {
  color: var(--muted);
  font-size: 0.9rem;
}

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

#randomCatalog {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.master-card {
  contain: content;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease;
}

.master-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.work-photo {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--surface-soft);
  color: var(--brand);
  font-size: 2.4rem;
  font-weight: 900;
}

.work-photo-icon {
  font-size: clamp(3rem, 9vw, 5.2rem);
}

.work-photo::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: var(--line);
}

.work-photo img,
.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.master-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.master-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.master-title-name-only {
  grid-template-columns: minmax(0, 1fr);
}

.master-title h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1.06rem;
}

.badge,
.admin-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--brand-strong);
  background: var(--brand-soft);
  font-size: 0.78rem;
  font-weight: 850;
}

.badge {
  max-width: 128px;
  overflow-wrap: anywhere;
}

.master-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.master-type,
.master-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: var(--surface-soft);
  font-size: 0.9rem;
  font-weight: 800;
}

.master-type {
  color: var(--brand-strong);
}

.master-group {
  color: var(--muted);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.gallery div {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius);
  color: #fff;
  background: var(--surface-soft);
  font-size: 1.25rem;
  font-weight: 900;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.contact-actions.single-action {
  display: grid;
  grid-template-columns: 1fr;
}

.call-button,
.message-button,
.whatsapp-button,
.profile-form button[type="submit"],
.auth-card button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 850;
}

  .master-card .call-button,
  .master-card .message-button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    padding: 0 8px;
    font-size: 0.9rem;
    line-height: 1.15;
    white-space: nowrap;
}

.call-button,
.profile-form button[type="submit"],
.auth-card button {
  border: 1px solid var(--brand);
}

.message-button {
  border: 1px solid var(--line-strong);
  color: var(--brand-strong);
  background: var(--surface);
}

.whatsapp-button {
  border: 1px solid #1f9d55;
  color: #fff;
  background: #1f9d55;
}

.message-button:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.whatsapp-button:hover {
  border-color: #168646;
  background: #168646;
}

.detail-app {
  padding-bottom: 44px;
}

.detail-back-button {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  color: var(--brand-strong);
  background: var(--surface);
  font-weight: 650;
}

.detail-page,
.detail-loading,
.detail-error,
.detail-section {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.detail-page {
  display: grid;
  gap: 14px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 16px;
  align-items: start;
}

.detail-main-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  border: 1px solid var(--detail-divider);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--detail-surface);
  box-shadow: var(--shadow-sm);
}

.detail-media {
  display: grid;
  gap: 10px;
  min-width: 0;
  max-width: 520px;
}

.detail-main-photo {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 420px;
  overflow: hidden;
  border: 1px solid var(--detail-divider);
  border-radius: var(--radius);
  color: var(--placeholder-mark);
  background: var(--detail-media-surface);
  font-size: clamp(2.4rem, 11vw, 6rem);
  font-weight: 800;
}

.detail-main-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--detail-media-surface);
}

.detail-photo-empty {
  min-height: 220px;
}

.detail-gallery-controls {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.detail-gallery-controls button {
  min-width: 48px;
  min-height: 44px;
  border: 1px solid var(--detail-divider);
  border-radius: var(--radius);
  color: var(--text-secondary);
  background: var(--detail-panel-surface);
  font-size: 1.4rem;
  line-height: 1;
}

.detail-gallery {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.detail-gallery button,
.detail-gallery-empty {
  aspect-ratio: 1;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--detail-divider);
  border-radius: var(--radius);
  padding: 0;
  background: var(--detail-media-surface);
}

.detail-gallery button.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
}

.detail-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-gallery-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  aspect-ratio: auto;
  min-height: 58px;
  padding: 10px;
  color: var(--text-muted);
  font-weight: 650;
}

.detail-summary {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.detail-summary h1 {
  margin: 0;
  color: var(--text-primary);
  font-size: clamp(2rem, 3.4vw, 3rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-tags span,
.detail-info-grid div,
.detail-info div {
  border: 1px solid var(--detail-divider);
  border-radius: var(--radius);
  background: var(--detail-meta-surface);
}

.detail-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  color: var(--accent);
  font-weight: 650;
}

.detail-description {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.65;
  white-space: pre-wrap;
}

.detail-contact-panel {
  position: sticky;
  top: 92px;
  min-width: 0;
}

.detail-contact-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--detail-divider);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--detail-panel-surface);
  box-shadow: var(--shadow-sm);
}

.detail-actions {
  display: grid;
  gap: 8px;
}

.detail-actions .call-button,
.detail-actions .message-button,
.detail-actions .whatsapp-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 14px;
  text-align: center;
}

.detail-message-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.detail-message-status.is-error {
  color: var(--danger, #b42318);
}

.detail-actions .message-button[aria-disabled="true"] {
  cursor: wait;
  opacity: 0.65;
  pointer-events: none;
}

.detail-info {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0;
}

.detail-info div,
.detail-info-grid div {
  display: grid;
  gap: 5px;
  padding: 11px;
}

.detail-info dt,
.detail-info-grid span {
  color: var(--text-muted);
  font-size: 0.84rem;
}

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

.detail-phone-list {
  display: grid;
  gap: 6px;
}

.detail-phone-list a,
.detail-info dd a {
  color: var(--accent);
  text-decoration: none;
}

.detail-section {
  border-color: var(--detail-divider);
  padding: 16px;
  background: var(--detail-surface);
}

.detail-section h2 {
  margin: 0 0 12px;
  color: var(--text-primary);
  font-size: 1.25rem;
}

.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.detail-info-grid strong {
  overflow-wrap: anywhere;
}

.detail-related {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 260px));
  justify-content: start;
}

.detail-loading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 18px;
  border-color: var(--detail-divider);
  padding: 16px;
  background: var(--detail-surface);
}

.detail-skeleton,
.detail-skeleton-media {
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface-secondary), var(--hover), var(--surface-secondary));
  background-size: 200% 100%;
  animation: admin-skeleton 1.2s infinite linear;
}

.detail-skeleton-media {
  aspect-ratio: 4 / 3;
}

.detail-skeleton-stack {
  display: grid;
  gap: 12px;
  align-content: start;
}

.detail-skeleton {
  min-height: 42px;
}

.detail-skeleton.short {
  width: 62%;
}

.detail-skeleton.tall {
  min-height: 180px;
}

.detail-error {
  display: grid;
  gap: 12px;
  border-color: color-mix(in srgb, var(--danger) 34%, var(--detail-divider));
  padding: 22px;
}

.detail-error h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
}

.detail-error p {
  margin: 0;
  color: var(--muted);
}

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

.detail-error-actions .secondary-button,
.detail-error-actions .message-button {
  min-height: 44px;
  padding: 0 14px;
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 28px;
  color: var(--muted);
  background: var(--surface-soft);
  text-align: center;
  line-height: 1.5;
}

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

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 5px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.auth-tab {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 850;
}

.auth-tab.active {
  color: #fff;
  background: var(--brand);
}

.auth-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
}

.google-auth-area {
  display: grid;
  justify-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
  background: var(--surface);
}

.google-auth-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(100%, 360px);
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
  font-weight: 850;
  text-decoration: none;
}

.google-auth-button:hover {
  border-color: var(--brand);
}

.google-auth-button.disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.google-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #4285f4;
  background: #fff;
  font-weight: 900;
}

.google-auth-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  text-align: center;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 0;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 750;
  text-align: center;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.phone-field {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.password-toggle,
.legacy-phone-toggle {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: var(--surface-soft);
  font-weight: 750;
}

.password-toggle {
  padding: 0 10px;
  font-size: 0.82rem;
}

.legacy-phone-toggle {
  border-color: transparent;
  background: transparent;
  color: var(--brand);
  text-align: center;
}

.auth-confirm-copy {
  display: grid;
  gap: 6px;
}

.auth-confirm-copy h2 {
  margin: 0;
  font-size: 1.3rem;
}

.auth-confirm-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.phone-fields-block {
  display: grid;
  gap: 10px;
  align-content: start;
}

.phone-fields-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.phone-fields-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.phone-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: stretch;
  min-width: 0;
}

.phone-field-row-single {
  grid-template-columns: minmax(0, 1fr);
}

.phone-field-row input,
.phone-field-row .field-error {
  grid-column: 1;
}

.phone-field-row-single .phone-remove-spacer {
  display: none;
}

.phone-field-row input {
  min-height: 46px;
  height: 46px;
}

.phone-field-row input,
.phone-remove-button,
.phone-remove-spacer,
.phone-fields-block,
.account-column,
.email-field input {
  box-sizing: border-box;
}

.phone-remove-button {
  grid-column: 2;
  width: 44px;
  min-width: 44px;
  height: 46px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.phone-remove-spacer {
  grid-column: 2;
  width: 44px;
  min-width: 44px;
  height: 46px;
}

.phone-fields-header .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  white-space: nowrap;
}

.phone-fields-header .secondary-button[disabled],
.phone-fields-header .secondary-button[aria-disabled="true"] {
  color: var(--muted);
  border-color: var(--line);
  background: var(--surface-soft);
  cursor: not-allowed;
  opacity: 0.72;
}

.account-whatsapp-field small {
  color: var(--muted);
  line-height: 1.45;
}

.field-hint,
.field-note,
.field-error {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.4;
}

.field-hint,
.field-note {
  color: var(--muted);
}

.field-error {
  color: var(--red);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 780;
}

select,
input,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  color: var(--text);
  background: var(--surface);
  outline: none;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--brand);
}

input[readonly] {
  cursor: not-allowed;
  color: var(--muted);
  background: var(--surface-soft);
}

textarea {
  min-height: 104px;
  resize: vertical;
}

.auth-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--red) 42%, var(--line));
  border-radius: var(--radius);
  color: var(--red);
  background: color-mix(in srgb, var(--red) 8%, var(--surface));
  font-size: 0.92rem;
  font-weight: 760;
}

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

.profile-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 14px;
  margin-top: 14px;
}

.account-email-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface);
}

.account-email-card input[readonly] {
  color: var(--text-secondary);
  background: var(--surface-secondary);
  cursor: default;
}

.profile-choice-card {
  display: grid;
  align-content: space-between;
  gap: 14px;
  min-height: 156px;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--text);
  background: var(--surface);
}

.profile-choice-card:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.profile-choice-card > div {
  display: grid;
  gap: 8px;
}

.profile-choice-copy {
  min-width: 0;
}

.profile-choice-card strong {
  color: var(--brand-strong);
  font-size: 1.25rem;
}

.profile-choice-card .profile-choice-title {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  color: inherit;
}

.business-unread-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  padding: 0 5px;
  color: #fff;
  background: var(--red);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
}

.business-unread-count.hidden {
  display: none;
}

.profile-choice-card span {
  color: var(--muted);
  line-height: 1.5;
}

.profile-choice-created {
  min-width: 0;
}

.profile-choice-identity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.profile-choice-avatar-slot {
  position: relative;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border: 1px solid var(--line);
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-secondary);
}

.profile-choice-avatar-image,
.profile-choice-avatar-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.profile-choice-avatar-image {
  position: absolute;
  inset: 0;
  object-fit: cover;
  background: var(--surface-secondary);
}

.profile-choice-avatar-fallback {
  color: var(--brand-strong);
  background: var(--surface-secondary);
  font-size: 1rem;
  font-weight: 900;
}

.profile-choice-avatar-fallback.has-initial::before {
  content: none;
}

.profile-choice-identity-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.profile-choice-identity-text strong {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  word-break: break-word;
}

.profile-choice-identity > .business-unread-count {
  align-self: start;
}

.profile-choice-status {
  justify-self: start;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--brand-strong);
  background: #ffffff;
  font-size: 0.84rem;
}

.profile-choice-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  min-height: 44px;
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  color: #ffffff;
  background: var(--brand);
  font-weight: 850;
  text-decoration: none;
}

.profile-choice-button:hover {
  border-color: var(--brand-strong);
  background: var(--brand-strong);
}

.profile-choice-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
}

.profile-choice-actions .profile-choice-button {
  flex: 1 1 150px;
  justify-self: auto;
  min-width: 0;
}

.profile-message-action {
  position: relative;
  display: flex;
  flex: 1 1 150px;
  min-width: 0;
}

.profile-message-action .profile-messages-button {
  flex: 1 1 auto;
  width: 100%;
}

.business-unread-button-count {
  position: absolute;
  top: -7px;
  right: -7px;
  border: 2px solid var(--surface);
}

html[data-theme="dark"] .account-trigger > .business-unread-dot,
html[data-theme="dark"] .business-profile-link > .business-unread-dot,
html[data-theme="dark"] .business-unread-button-count {
  border-color: var(--surface);
}

.profile-choice-actions .profile-messages-button {
  color: var(--brand-strong);
  border-color: var(--line);
  background: var(--surface);
}

.profile-choice-actions .profile-messages-button:hover {
  color: var(--brand-strong);
  border-color: var(--brand);
  background: var(--brand-soft);
}

.profile-form {
  padding: 18px;
}

.profile-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.form-title,
.wide-field,
.form-actions {
  grid-column: 1 / -1;
}

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

.account-column {
  display: grid;
  align-content: start;
  align-items: start;
  gap: 12px;
  min-width: 0;
}

.profile-back-link {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  color: var(--brand-strong);
  background: var(--surface);
  font-weight: 850;
  text-decoration: none;
}

.profile-back-link:hover,
.profile-back-link:focus-visible {
  border-color: var(--brand);
  background: var(--brand-soft);
  outline: none;
}

.profile-back-short {
  display: none;
}

.form-title h2,
.admin-title h1,
.admin-section h2 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 2.6vw, 2.15rem);
}

.form-actions {
  justify-content: start;
  flex-wrap: wrap;
}

.form-actions button {
  min-height: 44px;
  padding: 0 16px;
}

.secondary-button {
  color: var(--red);
  background: var(--surface);
}

.profile-settings-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px;
  background: var(--surface-soft);
}

.profile-settings-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 850;
  text-align: center;
  text-decoration: none;
}

.profile-settings-tab.active {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.profile-settings-panel {
  display: none;
}

.profile-settings-panel.active {
  display: grid;
  gap: 14px;
}

.master-switch {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface-soft);
}

.master-switch p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.profile-contact-summary {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #f8fbf9;
}

.profile-contact-summary > div {
  display: grid;
  gap: 4px;
}

.profile-contact-summary strong {
  color: var(--brand-strong);
  font-size: 1rem;
}

.profile-contact-summary span {
  color: var(--muted);
  line-height: 1.5;
}

.profile-contact-summary dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.profile-contact-summary dl > div {
  display: grid;
  grid-template-columns: minmax(110px, 0.35fr) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.profile-contact-summary dt {
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-contact-summary dd {
  margin: 0;
  color: var(--text);
  font-weight: 750;
}

.contact-edit-link {
  justify-self: start;
  color: var(--brand-strong);
  text-decoration: none;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 1rem;
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
}

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

.master-editor-section {
  display: grid;
  gap: 12px;
  min-width: 0;
  border-top: 1px solid var(--profile-divider, var(--line));
  padding: 18px 0 4px;
}

.profile-page #masterSettings .master-fields {
  grid-template-columns: minmax(0, 1fr);
}

.profile-page #storeSettings .master-fields {
  grid-template-columns: minmax(0, 1fr);
}

.master-publication-section {
  border: 1px solid var(--profile-divider, var(--line));
  border-radius: var(--radius-lg);
  padding: 16px;
  background: var(--profile-section-surface, var(--surface-soft));
}

.master-publication-section p {
  margin: 0;
  color: var(--text-secondary, var(--muted));
  line-height: 1.5;
}

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

.master-section-heading {
  color: var(--text-primary, var(--text));
  font-size: 1.05rem;
}

.master-phone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.master-phone-list {
  display: grid;
  gap: 10px;
}

.master-phone-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
  min-width: 0;
}

.master-phone-row:has(> input:only-child) {
  grid-template-columns: minmax(0, 1fr);
}

.master-whatsapp-field {
  max-width: 520px;
}

.master-photo-preview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.master-photo-item {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--profile-divider, var(--line));
  border-radius: 12px;
  aspect-ratio: 1;
  background: var(--profile-status-surface, var(--surface-soft));
}

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

.master-photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  min-height: 32px;
  border: 1px solid color-mix(in srgb, var(--danger, var(--red)) 35%, var(--line));
  border-radius: 999px;
  padding: 0;
  color: var(--danger, var(--red));
  background: var(--surface);
}

.master-editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--profile-divider, var(--line));
  padding-top: 18px;
}

.master-editor-actions > button,
.master-editor-actions > a {
  min-height: 46px;
}

.save-status {
  align-self: center;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.save-status.success {
  color: var(--brand-strong);
}

.save-status.error {
  color: var(--red);
}

.email-verification-row,
.phone-verification-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 40px;
}

.email-field {
  align-content: start;
  min-width: 0;
}

.email-field input {
  min-height: 46px;
  height: 46px;
}

.email-verification-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #f9fafb;
  color: #4b5563;
  font-size: 0.88rem;
  font-weight: 650;
}

.email-verification-badge[data-status="verified"] {
  border-color: #9ad7bd;
  background: #ecfdf5;
  color: #176b4d;
}

.email-verification-badge[data-status="unverified"] {
  border-color: #f5c26b;
  background: #fffbeb;
  color: #92400e;
}

.email-verify-button {
  min-height: 34px;
  padding: 7px 12px;
}

.email-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 24, 39, 0.48);
}

.email-modal.hidden {
  display: none;
}

.email-modal-card {
  position: relative;
  width: min(100%, 420px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-md);
}

.email-modal-card h2 {
  margin: 0 36px 8px 0;
  font-size: 1.3rem;
}

.email-modal-card p {
  margin: 0 0 16px;
  color: var(--muted);
}

.email-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
}

.code-field {
  display: grid;
  gap: 8px;
}

.code-field input {
  height: 56px;
  text-align: center;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0;
}

.email-modal-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 14px;
}

.email-modal-actions button {
  min-height: 42px;
}

.admin-email-cell {
  display: grid;
  justify-items: start;
  gap: 5px;
}

.section-heading {
  max-width: 620px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.3rem);
}

.footer-brand p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.site-footer {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
}

.footer-main {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1.2fr;
  gap: 28px;
  padding: 28px clamp(18px, 4vw, 42px);
}

.footer-brand {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.footer-brand p {
  max-width: 340px;
  margin-top: 6px;
}

.footer-column {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 12px;
}

.footer-column a,
.footer-column button,
.footer-bottom a {
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  text-decoration: none;
  font-weight: 760;
}

.footer-column a:hover,
.footer-column button:hover,
.footer-bottom a:hover {
  color: var(--text);
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.social-links a {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 16px clamp(18px, 4vw, 42px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-bottom div {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.legal-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  padding: 20px clamp(18px, 4vw, 42px);
  border-top: 1px solid var(--line);
  color: var(--text);
}

.legal-notes p {
  max-width: 540px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

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

.admin-header {
  display: flex;
  justify-content: space-between;
}

.admin-login {
  margin-top: 14px;
  padding: clamp(22px, 5vw, 56px);
}

.admin-dashboard {
  margin-top: 14px;
  padding: clamp(18px, 4vw, 34px);
}

.admin-title,
.admin-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.admin-title span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 760;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0;
}

.admin-stats article {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--surface-soft);
}

.admin-stats span,
.admin-stats small {
  color: var(--muted);
  font-weight: 760;
}

.admin-stats strong {
  color: var(--brand-strong);
  font-size: 1.8rem;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.admin-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 13px;
  color: var(--muted);
  background: transparent;
  font-weight: 850;
}

.admin-tabs button.active {
  color: #fff;
  background: var(--brand);
}

.admin-panel {
  display: none;
}

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

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.78fr);
  gap: 14px;
}

.admin-section {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface);
}

.admin-section + .admin-section {
  margin-top: 14px;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.admin-toolbar input,
.admin-toolbar select {
  min-width: min(260px, 100%);
  min-height: 42px;
}

.admin-table-wrap {
  overflow-x: auto;
  margin-top: 14px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.admin-table th {
  color: var(--muted);
  background: var(--surface-soft);
}

.admin-badge.good {
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.admin-badge.warn {
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 12%, var(--surface));
}

.admin-danger {
  border-color: color-mix(in srgb, var(--red) 45%, var(--line));
  color: var(--red);
  background: color-mix(in srgb, var(--red) 6%, var(--surface));
}

.admin-profile-list,
.admin-mini-list,
.admin-health-list,
.admin-category-list {
  display: grid;
  gap: 10px;
}

.admin-profile-list article {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface);
}

.admin-profile-photo {
  display: grid;
  place-items: center;
  width: 74px;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius);
  color: #fff;
  background: var(--brand);
  font-weight: 900;
}

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

.admin-profile-title,
.admin-health-row,
.admin-category-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-profile-list p,
.admin-mini-list p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.admin-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.admin-mini-list article,
.admin-category-row,
.admin-health-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-soft);
}

.admin-mini-list article {
  display: grid;
  gap: 5px;
}

.admin-mini-list span,
.admin-health-row strong,
.admin-category-row strong {
  color: var(--muted);
  font-weight: 850;
}

.chat-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  height: calc(100vh - 124px);
  min-height: 540px;
  margin-top: 14px;
  overflow: hidden;
}

.chat-list-open .chat-layout {
  grid-template-columns: 1fr;
}

.chat-list-open .chat-list-screen {
  border-right: 0;
}

.chat-list-screen {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  border-right: 1px solid var(--line);
}

.chat-screen-header,
.chat-recipient {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.chat-screen-header h1 {
  margin: 0;
  font-size: 1.35rem;
}

.chat-contacts {
  display: grid;
  align-content: start;
  align-items: start;
  grid-auto-rows: 76px;
  gap: 0;
  overflow-y: auto;
}

.chat-contact {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  height: 76px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.chat-contact:hover,
.chat-contact.active {
  background: var(--surface-soft);
}

.chat-contact-avatar,
.chat-recipient-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #fff;
  background: var(--brand);
  font-weight: 900;
}

.chat-contact-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.chat-contact-title,
.chat-contact-message {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-contact-title strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-contact-title time {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 760;
}

.chat-persona {
  flex: 0 0 auto;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--chat-divider));
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.25;
}

.profile-messages-chat {
  min-width: 0;
}

.profile-messages-chat .chat-layout {
  width: 100%;
  height: min(720px, calc(100dvh - 210px));
  margin: 0;
}

.profile-messages-badge {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  padding: 0 7px;
  color: #fff;
  background: var(--accent);
  font-size: 0.72rem;
  vertical-align: middle;
}

@media (max-width: 768px) {
  .profile-messages-chat .chat-layout {
    height: min(680px, calc(100dvh - 170px));
    min-height: 480px;
  }
}

.chat-contact small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-unread-badge {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  color: #fff;
  background: var(--red);
  font-size: 0.76rem;
  font-weight: 900;
}

.chat-empty {
  padding: 18px;
  color: var(--muted);
}

.chat-list-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 280px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.chat-list-empty strong {
  color: var(--text);
  font-size: 1.2rem;
}

.chat-list-empty span {
  max-width: 320px;
  line-height: 1.45;
}

.chat-main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  min-height: 0;
}

.chat-selection-empty {
  grid-template-rows: 1fr;
}

.chat-selection-empty .chat-recipient,
.chat-selection-empty .chat-compose {
  display: none;
}

.chat-conversation-pending {
  grid-template-rows: 1fr;
}

.chat-conversation-pending .chat-recipient,
.chat-conversation-pending .chat-compose {
  display: none;
}

.chat-conversation-state {
  display: grid;
  align-self: center;
  justify-self: center;
  justify-items: center;
  gap: 14px;
  width: min(380px, calc(100% - 32px));
  padding: 20px;
  color: var(--text-secondary);
  text-align: center;
}

.chat-conversation-state-error strong {
  color: var(--text-primary);
  line-height: 1.45;
}

.chat-conversation-state .secondary-button {
  min-height: 44px;
}

.chat-selection-state {
  display: grid;
  align-self: center;
  justify-self: center;
  gap: 8px;
  max-width: 360px;
  padding: 24px;
  color: var(--text-muted);
  text-align: center;
}

.chat-selection-state strong {
  color: var(--text-primary);
  font-size: 1.05rem;
}

.chat-recipient {
  display: grid;
  grid-template-columns: auto 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.chat-back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 10px;
  color: var(--brand-strong);
  background: var(--brand-soft);
  font-weight: 850;
}

.chat-recipient-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.chat-recipient-copy strong,
.chat-recipient-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-recipient-copy span {
  color: var(--muted);
  font-size: 0.88rem;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding: 18px;
  background: var(--surface-soft);
}

.chat-bubble {
  max-width: min(72%, 560px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--surface);
}

.chat-bubble.mine {
  align-self: flex-end;
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.chat-bubble.theirs {
  align-self: flex-start;
}

.chat-bubble p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-bubble small {
  display: block;
  margin-top: 5px;
  text-align: right;
  opacity: 0.72;
}

.chat-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(108px, auto);
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 14px;
}

.chat-compose textarea {
  min-height: 48px;
  max-height: 110px;
}

.chat-compose button {
  min-width: 108px;
  min-height: 48px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 16px;
  color: #fff;
  background: var(--brand);
  font-size: 0.95rem;
  font-weight: 850;
  white-space: nowrap;
}

@media (max-width: 1000px) {
  .catalog {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #randomCatalog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (max-width: 1024px) {
  .chat-layout {
    grid-template-columns: 1fr;
  }

  .chat-list-screen {
    border-right: 0;
  }
}

@media (max-width: 820px) {
  .hero,
  .auth-page,
  .account-layout,
  .account-columns,
  .profile-form,
  .master-fields,
  .admin-login,
  .admin-grid,
  .footer-main,
  .legal-notes {
    grid-template-columns: 1fr;
  }

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

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

  .profile-choice {
    grid-template-columns: 1fr;
  }

  .home-intro-grid {
    grid-template-columns: 1fr;
  }

  .category-sidebar {
    position: static;
  }

  .category-list {
    grid-template-columns: 1fr;
  }

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

  .chat-layout {
    grid-template-columns: 132px minmax(0, 1fr);
    height: calc(100vh - 150px);
  }

  .chat-screen-header {
    padding: 12px;
  }

  .chat-contact {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    padding: 10px;
  }

  .chat-contact-avatar {
    width: 34px;
    height: 34px;
  }
}

@media (max-width: 768px) {
  .topbar {
    position: relative;
    grid-template-columns: minmax(0, 1fr) auto auto;
    column-gap: 12px;
    row-gap: 10px;
    align-items: center;
    min-height: 60px;
    padding: 10px 12px;
    border-radius: 10px;
  }

  .brand {
    min-width: 0;
    gap: 8px;
  }

  .brand > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .mobile-menu-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 50px;
    height: 44px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    background: var(--surface);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  }

  .mobile-menu-trigger::before {
    content: "";
    flex: 0 0 15px;
    width: 15px;
    height: 15px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.75 5.5h12.5M3.75 10h12.5M3.75 14.5h12.5' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.75 5.5h12.5M3.75 10h12.5M3.75 14.5h12.5' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  .mobile-menu-trigger span {
    display: none;
  }

  .mobile-menu-trigger b {
    color: currentColor;
    font-size: 0.78rem;
    font-weight: 850;
    line-height: 1;
    white-space: nowrap;
  }

  .header-actions {
    display: contents;
  }

  .account-menu {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    margin-left: 2px;
  }

  .account-trigger {
    width: 44px;
    height: 44px;
  }

  .main-nav,
  .topbar .lang-switch,
  .topbar .theme-toggle,
  .topbar .auth-link {
    display: none;
  }

  .topbar.mobile-menu-open .main-nav {
    display: grid;
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    padding-top: 2px;
  }

  .topbar.mobile-menu-open .lang-switch,
  .topbar.mobile-menu-open .theme-toggle,
  .topbar.mobile-menu-open .auth-link:not(.hidden) {
    display: flex;
    grid-column: 1 / -1;
    width: 100%;
  }

  .topbar.mobile-menu-open .lang-switch {
    grid-row: 3;
    justify-content: center;
  }

  .topbar.mobile-menu-open .theme-toggle {
    grid-row: 4;
    justify-content: space-between;
    min-height: 44px;
    padding: 0 14px;
  }

  .topbar.mobile-menu-open .theme-toggle-text {
    display: inline;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 650;
  }

  .topbar.mobile-menu-open .auth-link:not(.hidden) {
    grid-row: 5;
  }

  .main-nav .nav-button,
  .main-nav .nav-link,
  .auth-link,
  .lang-button {
    min-height: 44px;
    border-radius: 10px;
    padding: 0 10px;
    white-space: normal;
    line-height: 1.15;
    text-align: center;
  }

  .main-nav .nav-button,
  .main-nav .nav-link {
    width: 100%;
  }

  .main-nav .nav-link.has-unread::after {
    top: 4px;
    right: 4px;
  }

  .lang-button {
    flex: 1 1 0;
  }

  .account-dropdown {
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    width: min(280px, calc(100vw - 24px));
    min-width: min(220px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    border-radius: 12px;
  }
}

@media (max-width: 560px) {
  .app,
  .admin-shell {
    width: min(100% - 18px, var(--content));
    padding: 9px 0 28px;
  }

  .home-catalog,
  .hero,
  .auth-page,
  .finder,
  .profile-form,
  .admin-login,
  .admin-dashboard {
    padding: 14px;
  }

  .home-catalog-header,
  .footer-bottom,
  .admin-header,
  .admin-title,
  .admin-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: clamp(1.85rem, 10vw, 2.6rem);
    line-height: 1.08;
  }

  .home-intro {
    gap: 16px;
    padding: 16px;
  }

  .home-intro-copy h1 {
    font-size: clamp(1.8rem, 9.5vw, 2.55rem);
    line-height: 1.08;
  }

  .home-intro-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .home-intro-actions .nav-button {
    min-width: 0;
    min-height: 44px;
    padding: 0 10px;
    white-space: normal;
    line-height: 1.15;
  }

  .profile-back-link {
    max-width: 100%;
  }

  .profile-back-full {
    display: none;
  }

  .profile-back-short {
    display: inline;
  }

  #randomCatalog,
  .admin-stats,
  .phone-field,
  .contact-actions,
  .quick-categories {
    grid-template-columns: 1fr;
  }

  .category-list {
    grid-template-columns: 1fr;
  }

  .category-list-button {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .admin-profile-list article {
    grid-template-columns: 1fr;
  }

  .admin-profile-photo {
    width: 100%;
    max-width: 120px;
  }

  .admin-toolbar,
  .admin-card-actions {
    justify-content: stretch;
  }

  .chat-bubble {
    max-width: 88%;
  }
}

@media (max-width: 379px) {
  .home-intro-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 340px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto auto;
    padding: 10px;
  }

  .brand {
    font-size: 1rem;
  }

  .topbar.mobile-menu-open .main-nav {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .app {
    width: min(100% - 24px, var(--content));
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-bottom: 24px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto auto;
    min-height: 58px;
    column-gap: 12px;
    row-gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
  }

  .brand {
    font-size: 1rem;
  }

  .mobile-menu-trigger {
    display: inline-flex;
    gap: 6px;
    min-width: 50px;
    height: 44px;
    padding: 0 9px;
    border-radius: 999px;
  }

  .mobile-menu-trigger span {
    display: none;
  }

  .mobile-menu-trigger b {
    color: var(--text);
    font-size: 0.78rem;
    line-height: 1;
    white-space: nowrap;
  }

  .main-nav {
    position: fixed;
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 900;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
    gap: 4px;
    max-width: 520px;
    margin: 0 auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    box-shadow: 0 10px 28px rgba(20, 35, 30, 0.15);
  }

  .topbar.mobile-menu-open .main-nav {
    position: fixed;
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
    width: auto;
    max-width: 520px;
    margin: 0 auto;
  }

  .main-nav .nav-button,
  .main-nav .nav-link {
    min-height: 50px;
    border: 0;
    border-radius: 12px;
    padding: 5px 4px;
    color: var(--muted);
    background: transparent;
    font-size: 0.84rem;
    font-weight: 850;
    line-height: 1.12;
  }

  .main-nav .nav-button.active,
  .main-nav .nav-link.active {
    color: #fff;
    background: var(--brand);
  }

  .topbar .lang-switch,
  .topbar .auth-link {
    display: none;
  }

  .topbar.mobile-menu-open .lang-switch,
  .topbar.mobile-menu-open .auth-link:not(.hidden) {
    display: flex;
    grid-column: 1 / -1;
    width: 100%;
  }

  .topbar.mobile-menu-open .lang-switch {
    justify-content: center;
    padding: 5px;
  }

  .topbar.mobile-menu-open .auth-link:not(.hidden) {
    min-height: 48px;
  }

  .account-dropdown {
    width: min(280px, calc(100vw - 24px));
  }

  .home-catalog,
  .home-intro,
  .hero,
  .finder,
  .auth-page,
  .profile-form,
  .chat-layout {
    margin-top: 12px;
    border-radius: 12px;
  }

  .home-intro,
  .hero,
  .auth-page,
  .finder,
  .profile-form {
    padding: 16px;
  }

  .home-intro {
    gap: 14px;
  }

  .home-intro-copy h1,
  h1 {
    max-width: 100%;
    margin-bottom: 10px;
    font-size: clamp(1.55rem, 7.2vw, 2rem);
    line-height: 1.12;
  }

  .home-intro-copy p:last-child,
  .home-intro-note,
  .hero-copy p:last-child,
  .auth-copy p:last-child {
    font-size: 1rem;
    line-height: 1.5;
  }

  .home-intro-grid,
  .home-intro-note,
  .hero-photo,
  .footer-brand,
  .legal-notes {
    display: none;
  }

  .home-intro-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .home-intro-actions .nav-button:first-child,
  .profile-form button[type="submit"],
  .auth-card button,
  .call-button {
    min-height: 50px;
    border-radius: 12px;
  }

  .home-intro-actions .nav-button:first-child {
    color: #fff;
    border-color: var(--brand);
    background: var(--brand);
  }

  .home-intro-actions .nav-button:last-child {
    min-height: 48px;
    border-color: var(--line-strong);
    color: var(--brand-strong);
    background: var(--surface);
  }

  .search-layout,
  .profile-form,
  .account-columns,
  .master-fields,
  .phone-field,
  .contact-actions,
  .footer-main,
  .footer-bottom {
    grid-template-columns: 1fr;
  }

  .phone-fields-header {
    align-items: stretch;
  }

  .phone-fields-header .secondary-button {
    width: 100%;
  }

  .account-column,
  .phone-fields-block,
  .account-email-column {
    gap: 12px;
  }

  .account-email-column {
    display: grid;
  }

  .email-field,
  .phone-fields-block {
    gap: 8px;
  }

  .email-field input,
  .phone-field-row input {
    min-height: 50px;
    height: 50px;
  }

  .account-whatsapp-field {
    border: 1px solid #b7ddcb;
    border-radius: 14px;
    padding: 12px;
    background: linear-gradient(180deg, #f4fbf7 0%, #ffffff 100%);
  }

  .account-whatsapp-field span {
    color: var(--brand-strong);
    font-size: 1rem;
  }

  .account-whatsapp-field input {
    border-color: #9dccb6;
    background: #ffffff;
  }

  .account-whatsapp-field small {
    display: block;
    color: #426252;
  }

  .category-sidebar {
    border-radius: 12px;
  }

  .category-sidebar > strong {
    padding: 12px;
    font-size: 1rem;
  }

  .category-list {
    max-height: 280px;
    overflow-y: auto;
  }

  .category-group-title {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 9px 12px;
    font-size: 0.86rem;
    text-transform: none;
  }

  .category-list-button {
    min-height: 48px;
    padding: 10px 12px;
    font-size: 0.98rem;
  }

  .result-summary {
    min-height: 44px;
    margin-bottom: 10px;
    padding: 10px 12px;
  }

  #randomCatalog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 10px;
  }

  label {
    gap: 6px;
    color: var(--text);
    font-size: 0.95rem;
  }

  select,
  input,
  textarea {
    min-height: 50px;
    border-radius: 12px;
    font-size: 1rem;
  }

  textarea {
    min-height: 112px;
  }

  .auth-box,
  .profile-choice-button,
  .master-switch {
    border-radius: 12px;
  }

  .auth-card,
  .google-auth-area {
    padding: 14px;
  }

  .auth-tab,
  .google-auth-button {
    min-height: 48px;
    border-radius: 10px;
  }

  .profile-choice {
    gap: 10px;
  }

  .profile-choice-button {
    min-height: auto;
    padding: 14px;
  }

  .profile-settings-tabs {
    border-radius: 12px;
  }

  .profile-settings-tab {
    min-height: 48px;
    border-radius: 10px;
  }

  .toggle-row {
    min-height: 48px;
    align-items: center;
  }

  .toggle-row input {
    width: 24px;
    min-height: 24px;
  }

  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .form-actions button {
    width: 100%;
    min-height: 50px;
    border-radius: 12px;
  }

  .secondary-button {
    color: var(--brand-strong);
    border-color: var(--line-strong);
  }

  .danger-button {
    margin-top: 8px;
    color: var(--red);
    border-color: color-mix(in srgb, var(--red) 45%, var(--line));
    background: color-mix(in srgb, var(--red) 6%, var(--surface));
  }

  .empty-state {
    padding: 18px;
    border-radius: 12px;
    font-size: 1rem;
  }

  .site-footer {
    margin-bottom: 0;
  }

  .footer-main,
  .footer-bottom {
    display: grid;
    gap: 12px;
    padding: 16px;
  }

  .footer-column {
    gap: 8px;
  }

  .footer-column a,
  .footer-column button,
  .footer-bottom a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .chat-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    height: calc(100dvh - 154px - env(safe-area-inset-bottom));
    min-height: 460px;
  }

  .chat-list-screen {
    min-height: 0;
    border-right: 0;
  }

  .chat-screen-header {
    padding: 12px;
  }

  .chat-screen-header .eyebrow {
    display: none;
  }

  .chat-screen-header h1 {
    font-size: 1.25rem;
  }

  .chat-contacts {
    display: grid;
    align-content: start;
    align-items: start;
    grid-auto-rows: 76px;
    gap: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 10px 10px;
  }

  .chat-contact {
    grid-template-columns: 48px minmax(0, 1fr);
    height: 76px;
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px;
    background: var(--surface);
  }

  .chat-contact-avatar,
  .chat-recipient-avatar {
    width: 48px;
    height: 48px;
  }

  .chat-main {
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: 0;
  }

  .chat-recipient {
    grid-template-columns: auto 42px minmax(0, 1fr);
    padding: 12px;
  }

  .chat-back-button {
    min-height: 42px;
    padding: 0 9px;
  }

  .chat-recipient-avatar {
    width: 42px;
    height: 42px;
  }

  .chat-messages {
    padding: 12px;
  }

  .chat-bubble {
    max-width: 86%;
    border-radius: 12px;
  }

  .chat-compose {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
    background: var(--surface);
  }

  .chat-compose textarea {
    min-height: 50px;
  }

  .chat-compose button {
    width: 100%;
    min-height: 50px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 850;
  }
}

@media (max-width: 360px) {
  .app {
    width: min(100% - 18px, var(--content));
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto auto;
    padding: 8px;
  }

  .mobile-menu-trigger {
    min-width: 48px;
    padding: 0 8px;
  }

  .main-nav .nav-button,
  .main-nav .nav-link {
    font-size: 0.78rem;
  }

  .master-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
}

/* Premium marketplace foundation: tokens first, component redesign later. */
body {
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--brand) 5%, transparent), transparent 34rem),
    linear-gradient(180deg, color-mix(in srgb, var(--surface-primary) 58%, transparent), transparent 26rem),
    var(--bg);
  font-family: var(--font-sans);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
a,
input,
select,
textarea {
  transition:
    border-color var(--ease),
    background-color var(--ease),
    color var(--ease),
    box-shadow var(--ease),
    transform var(--ease);
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Premium app shell: public header only. */
.app > .topbar {
  position: sticky;
  top: max(10px, env(safe-area-inset-top));
  z-index: 850;
  grid-template-columns: auto minmax(260px, 1fr) auto;
  min-height: 60px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: var(--radius-xl);
  padding: 9px 12px;
  background: color-mix(in srgb, var(--surface-primary) 96%, var(--page-bg));
  box-shadow: var(--shadow-xs);
}

.app > .topbar .brand {
  min-width: 0;
  gap: 9px;
  font-size: 1rem;
  font-weight: 720;
  letter-spacing: var(--tracking-tight);
}

.app > .topbar .brand-mark {
  width: 34px;
  height: 34px;
  border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent);
  border-radius: 11px;
  color: var(--brand);
  background: var(--brand-soft);
  font-size: 0.72rem;
  font-weight: 780;
}

.app > .topbar .main-nav {
  justify-self: center;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 4px;
  background: var(--surface-inset);
}

.app > .topbar .nav-button,
.app > .topbar .nav-link,
.app > .topbar .auth-link,
.app > .topbar .lang-button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 0 12px;
  color: var(--text-secondary);
  background: transparent;
  font-size: 0.9rem;
  font-weight: 620;
  line-height: 1;
  white-space: nowrap;
}

.app > .topbar .nav-button:hover,
.app > .topbar .nav-link:hover,
.app > .topbar .auth-link:hover,
.app > .topbar .lang-button:hover {
  color: var(--text-primary);
  background: var(--surface-primary);
  box-shadow: var(--shadow-xs);
}

.app > .topbar .nav-button.active,
.app > .topbar .nav-link.active,
.app > .topbar .lang-button.active {
  color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 12%, transparent);
  background: color-mix(in srgb, var(--brand-soft) 72%, var(--surface-primary));
  box-shadow: none;
}

.app > .topbar .nav-button.active::after,
.app > .topbar .nav-link.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 16px;
  height: 2px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  transform: translateX(-50%);
}

.app > .topbar .nav-button {
  position: relative;
}

.app > .topbar .header-actions {
  gap: 8px;
  min-width: 0;
}

.app > .topbar .auth-link {
  border-color: var(--line);
  color: var(--brand);
  background: var(--surface-primary);
}

.app > .topbar .lang-switch {
  gap: 2px;
  min-height: 40px;
  border-color: var(--line);
  border-radius: var(--radius-pill);
  padding: 3px;
  background: var(--surface-inset);
}

.app > .topbar .lang-button {
  min-width: 38px;
  padding: 0 9px;
  font-size: 0.78rem;
}

.app > .topbar .theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 0;
  color: var(--text-secondary);
  background: var(--surface-inset);
  box-shadow: none;
  touch-action: manipulation;
}

.app > .topbar .theme-toggle:hover {
  color: var(--text-primary);
  border-color: var(--line-strong);
  background: var(--hover);
  box-shadow: var(--shadow-xs);
}

.app > .topbar .theme-toggle[aria-pressed="true"] {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 22%, var(--line));
  background: var(--active);
}

.theme-toggle-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle-icon-moon {
  fill: currentColor;
  stroke-width: 0;
}

.theme-toggle-icon-sun {
  display: none;
}

.theme-toggle[aria-pressed="true"] .theme-toggle-icon-moon {
  display: none;
}

.theme-toggle[aria-pressed="true"] .theme-toggle-icon-sun {
  display: block;
}

.theme-toggle-text {
  display: none;
}

.app > .topbar .account-trigger {
  width: 40px;
  height: 40px;
  border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line));
  color: #fff;
  background: linear-gradient(145deg, var(--brand), var(--brand-strong));
  box-shadow: var(--shadow-xs);
}

.app > .topbar .account-trigger:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.app > .topbar .account-dropdown {
  top: calc(100% + 12px);
  border-color: var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-elevated);
  box-shadow: var(--shadow-md);
}

.app > .topbar .account-dropdown > a,
.app > .topbar .account-dropdown > button {
  min-height: 42px;
  font-weight: 620;
}

.app > .topbar .account-dropdown > a:hover,
.app > .topbar .account-dropdown > button:hover {
  background: var(--surface-inset);
}

.app > .topbar .nav-link.has-unread::after {
  top: -5px;
  right: -5px;
  bottom: auto;
  left: auto;
  width: auto;
  min-width: 18px;
  height: 18px;
  border: 2px solid var(--surface-primary);
  color: #fff;
  background: var(--danger);
  font-size: 0.68rem;
  transform: none;
}

.topbar,
.admin-header,
.home-catalog,
.home-intro,
.hero,
.finder,
.auth-page,
.profile-form,
.admin-login,
.admin-dashboard,
.chat-layout,
.site-footer,
.auth-box,
.category-sidebar,
.master-card,
.profile-choice-button,
.master-switch,
.admin-section,
.admin-profile-list article,
.admin-mini-list article,
.admin-category-row,
.admin-health-row {
  border-color: var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.topbar,
.admin-header {
  min-height: 64px;
  padding: 12px 16px;
}

.brand {
  font-weight: 700;
  letter-spacing: 0;
}

.brand-mark {
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.nav-button,
.nav-link,
.quick-type,
.lang-button,
.secondary-button,
.auth-link,
.admin-link-button,
.admin-danger,
.call-button,
.message-button,
.profile-form button[type="submit"],
.auth-card button,
.google-auth-button,
.profile-settings-tab,
.auth-tab,
.chat-back-button,
.chat-compose button {
  border-radius: var(--radius-md);
  font-weight: 650;
  letter-spacing: 0;
}

.nav-button,
.nav-link,
.quick-type,
.lang-button,
.secondary-button,
.auth-link,
.admin-link-button,
.admin-danger {
  min-height: 38px;
  padding-inline: 12px;
}

.nav-button:hover,
.nav-link:hover,
.quick-type:hover,
.auth-link:hover,
.secondary-button:hover,
.admin-link-button:hover,
.message-button:hover,
.google-auth-button:hover,
.profile-settings-tab:hover,
.profile-choice-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-inset);
  box-shadow: var(--shadow-sm);
}

.nav-button.active,
.nav-link.active,
.quick-type.active,
.lang-button.active,
.auth-link,
.call-button,
.profile-form button[type="submit"],
.auth-card button,
.profile-settings-tab.active,
.chat-compose button {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.nav-button.active:hover,
.nav-link.active:hover,
.quick-type.active:hover,
.auth-link:hover,
.call-button:hover,
.profile-form button[type="submit"]:hover,
.auth-card button:hover,
.profile-settings-tab.active:hover,
.chat-compose button:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.lang-switch,
.auth-tabs,
.profile-settings-tabs,
.admin-tabs {
  border-radius: var(--radius-md);
  background: var(--surface-inset);
}

.account-trigger,
.account-trigger > span,
.account-summary-avatar,
.chat-contact-avatar,
.chat-recipient-avatar,
.admin-profile-photo {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.account-dropdown {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.account-dropdown > a,
.account-dropdown > button {
  font-weight: 600;
}

.home-catalog,
.home-intro,
.hero,
.auth-page {
  padding: clamp(20px, 3vw, 36px);
}

h1 {
  font-family: var(--font-heading);
  font-weight: 720;
  letter-spacing: var(--tracking-tight);
}

h2,
h3 {
  font-family: var(--font-heading);
  font-weight: 660;
  letter-spacing: var(--tracking-tight);
}

.eyebrow {
  color: var(--brand-strong);
  font-weight: 650;
}

.home-intro-copy p:last-child,
.home-intro-note,
.hero-copy p:last-child,
.auth-copy p:last-child,
.admin-login p,
.master-body p,
.footer-brand p,
.legal-notes p,
.master-switch p {
  color: var(--muted);
  font-weight: 400;
}

.home-intro-grid > div,
.trust-strip > div,
.result-summary,
.master-type,
.master-group,
.empty-state {
  border-radius: var(--radius-md);
  background: #f9fafb;
}

.quick-category-button,
.category-list-button,
.chat-contact {
  font-weight: 600;
}

.quick-category-button,
.category-list-button,
.chat-contact,
.master-card {
  transition:
    border-color var(--ease),
    background-color var(--ease),
    box-shadow var(--ease),
    transform var(--ease);
}

.master-card:hover,
.chat-contact:hover,
.chat-contact.active {
  border-color: var(--line-strong);
  background: #fff;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.master-body {
  padding: 12px;
}

/* Public catalog cards: one semantic link and one structure across breakpoints. */
.catalog {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
}

.catalog > .master-card {
  display: block;
  min-width: 0;
  min-height: 100%;
  border-radius: var(--radius-md);
}

.catalog-card-link {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.catalog-card-link:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 68%, transparent);
  outline-offset: 3px;
}

.catalog > .master-card .work-photo {
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--surface-soft);
}

.catalog > .master-card .work-photo-icon {
  font-size: clamp(1.55rem, 4.2vw, 2.45rem);
}

.catalog > .master-card .master-body {
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 7px;
  padding: 12px;
}

.catalog > .master-card .master-title {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.catalog > .master-card .master-title h3 {
  display: -webkit-box;
  min-height: 2.5em;
  overflow: hidden;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: clamp(0.95rem, 0.75vw + 0.76rem, 1.06rem);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.catalog > .master-card .master-type,
.catalog > .master-card .master-group {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.catalog > .master-card .master-type {
  display: -webkit-box;
  min-height: 2.45em;
  overflow: hidden;
  color: var(--muted);
  font-size: clamp(0.82rem, 0.48vw + 0.7rem, 0.9rem);
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.catalog > .master-card .master-group {
  position: relative;
  display: block;
  overflow: hidden;
  min-width: 0;
  padding-left: 1.15em;
  color: var(--muted);
  font-size: clamp(0.8rem, 0.45vw + 0.68rem, 0.88rem);
  font-weight: 500;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog > .master-card .master-group::before {
  content: "📍";
  position: absolute;
  left: 0;
  top: 0;
  font-size: 0.9em;
}

@media (hover: hover) and (pointer: fine) {
  .catalog > .master-card:hover {
    border-color: var(--line-strong);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
  }
}

@media (hover: none) {
  .catalog > .master-card:hover {
    border-color: var(--line);
    box-shadow: var(--shadow-sm);
    transform: none;
  }

  .catalog > .master-card:active {
    border-color: var(--line-strong);
    transform: translateY(1px);
  }
}

@media (max-width: 1100px) {
  .catalog {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .catalog {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .catalog {
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 340px) {
  .catalog {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app > .topbar {
    position: sticky;
    top: max(8px, env(safe-area-inset-top));
    grid-template-columns: minmax(0, 1fr) auto auto;
    min-height: 56px;
    column-gap: 10px;
    row-gap: 8px;
    padding: 7px 8px;
    border-radius: 16px;
  }

  .app > .topbar .brand {
    gap: 8px;
    font-size: 0.98rem;
  }

  .app > .topbar .brand-mark {
    width: 34px;
    height: 34px;
  }

  .app > .topbar .mobile-menu-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 62px;
    min-height: 44px;
    height: 44px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    background: var(--surface-inset);
    box-shadow: none;
  }

  .app > .topbar .mobile-menu-trigger::before {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
  }

  .app > .topbar .mobile-menu-trigger b {
    color: currentColor;
    font-size: 0.76rem;
    font-weight: 650;
  }

  .app > .topbar .account-menu {
    margin-left: 4px;
  }

  .app > .topbar .account-trigger {
    width: 44px;
    height: 44px;
  }

  .app > .topbar .main-nav {
    position: fixed;
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
    gap: 4px;
    width: auto;
    max-width: 520px;
    margin: 0 auto;
    padding: 5px;
    border-radius: 18px;
    background: var(--surface-elevated);
    box-shadow: var(--shadow-md);
    z-index: 900;
  }

  .app > .topbar .main-nav .nav-button,
  .app > .topbar .main-nav .nav-link {
    min-height: 48px;
    padding: 4px 5px;
    border-radius: 14px;
    font-size: 0.78rem;
    line-height: 1.1;
    white-space: nowrap;
  }

  .app > .topbar .main-nav .nav-button.active,
  .app > .topbar .main-nav .nav-link.active {
    color: var(--brand);
    background: var(--brand-soft);
  }

  .app > .topbar .main-nav .nav-button.active::after,
  .app > .topbar .main-nav .nav-link.active::after {
    display: none;
  }

  .app > .topbar .nav-link.has-unread::after {
    top: 3px;
    right: 3px;
    min-width: 18px;
    height: 18px;
  }

  .app > .topbar .theme-toggle {
    display: none;
  }

  .app > .topbar.mobile-menu-open .main-nav {
    display: grid;
  }

  .app > .topbar.mobile-menu-open .lang-switch,
  .app > .topbar.mobile-menu-open .theme-toggle,
  .app > .topbar.mobile-menu-open .auth-link:not(.hidden) {
    display: flex;
    grid-column: 1 / -1;
    width: 100%;
  }

  .app > .topbar.mobile-menu-open .theme-toggle {
    justify-content: space-between;
    padding: 0 14px;
  }

  .app > .topbar.mobile-menu-open .theme-toggle-text {
    display: inline;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 650;
  }
}

@media (max-width: 340px) {
  .app > .topbar .mobile-menu-trigger {
    min-width: 58px;
    gap: 4px;
    padding: 0 8px;
  }

  .app > .topbar .mobile-menu-trigger b {
    font-size: 0.74rem;
  }

  .app > .topbar .main-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .app > .topbar .main-nav:has(> #chatLink.hidden) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.badge,
.admin-badge {
  border-radius: var(--radius-sm);
  font-weight: 650;
}

.category-group-title {
  font-weight: 650;
}

.category-list-button b,
.quick-category-button b,
.chat-unread-badge,
.nav-link.has-unread::after {
  border-radius: var(--radius-sm);
  font-weight: 700;
}

label {
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 560;
  line-height: 1.35;
}

select,
input,
textarea {
  border-radius: var(--radius-md);
  background: var(--surface-primary);
  box-shadow: inset 0 1px 0 rgba(21, 23, 18, 0.025);
}

select::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

select:focus,
input:focus,
textarea:focus {
  border-color: color-mix(in srgb, var(--brand) 64%, var(--line));
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.auth-error,
.danger-button,
.admin-danger {
  border-radius: var(--radius-md);
}

/* Catalog marketplace system: /masters and /stores only. */
#searchView .finder,
#storesView .finder {
  border-color: var(--section-divider);
  border-radius: var(--radius-xl);
  padding: 16px;
  background: var(--catalog-shell);
  box-shadow: var(--shadow-sm);
}

#searchView .search-layout,
#storesView .search-layout {
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
}

.catalog-filter-toggle {
  display: none;
}

#searchView .category-sidebar,
#storesView .category-sidebar {
  top: 84px;
  max-height: calc(100dvh - 108px);
  overflow: auto;
  border: 1px solid var(--section-divider);
  border-radius: var(--radius-lg);
  background: var(--catalog-sidebar-surface);
  box-shadow: var(--shadow-xs);
}

#searchView .category-sidebar > strong,
#storesView .category-sidebar > strong {
  padding: 14px 14px 12px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--section-divider);
  font-size: 0.92rem;
  font-weight: 700;
}

#searchView .category-list,
#storesView .category-list {
  gap: 2px;
  padding: 8px;
}

#searchView .category-group,
#storesView .category-group {
  gap: 2px;
}

#searchView .category-group-title,
#storesView .category-group-title {
  margin: 7px 0 4px;
  border: 0;
  border-top: 1px solid var(--section-divider);
  padding: 10px 8px 5px;
  color: var(--text-muted);
  background: transparent;
  font-size: 0.72rem;
  letter-spacing: 0;
}

#searchView .category-list-button,
#storesView .category-list-button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 9px 8px 9px 10px;
  color: var(--text-secondary);
  background: transparent;
  font-weight: 620;
  line-height: 1.18;
}

#searchView .category-list-button:hover,
#storesView .category-list-button:hover {
  color: var(--text-primary);
  border-color: var(--section-divider);
  background: var(--category-hover);
}

#searchView .category-list-button.active,
#searchView .category-list-button[aria-current="true"],
#storesView .category-list-button.active,
#storesView .category-list-button[aria-current="true"] {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
  background: var(--active);
}

#searchView .category-list-button span,
#storesView .category-list-button span {
  min-width: 0;
  overflow-wrap: anywhere;
}

#searchView .category-list-button b,
#storesView .category-list-button b {
  min-width: 30px;
  min-height: 24px;
  border: 1px solid var(--section-divider);
  color: var(--text-muted);
  background: var(--surface-secondary);
  font-size: 0.76rem;
  font-weight: 700;
}

#searchView .category-list-button.active b,
#searchView .category-list-button[aria-current="true"] b,
#storesView .category-list-button.active b,
#storesView .category-list-button[aria-current="true"] b {
  color: var(--placeholder-mark);
  border-color: color-mix(in srgb, var(--accent) 24%, var(--border));
  background: var(--placeholder-surface);
}

#searchView .result-summary,
#storesView .result-summary {
  min-height: 48px;
  margin-bottom: 14px;
  border: 1px solid var(--section-divider);
  border-radius: var(--radius-lg);
  padding: 10px 13px;
  background: color-mix(in srgb, var(--catalog-sidebar-surface) 72%, var(--surface));
  box-shadow: none;
}

#searchView .result-summary strong,
#storesView .result-summary strong {
  min-width: 1.5ch;
  color: var(--accent);
  font-size: 1.32rem;
  font-weight: 760;
}

#searchView .result-summary span,
#storesView .result-summary span {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

#searchView .catalog,
#storesView .catalog {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 260px));
  justify-content: start;
  align-items: stretch;
  gap: 14px;
}

#searchView .catalog > .master-card,
#storesView .catalog > .master-card {
  min-height: 100%;
  overflow: hidden;
  border: 1px solid var(--section-divider);
  border-radius: var(--radius-lg);
  background: var(--catalog-card-surface);
  box-shadow: var(--shadow-xs);
}

#searchView .catalog > .master-card:hover,
#storesView .catalog > .master-card:hover {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--border-strong));
  background: color-mix(in srgb, var(--catalog-card-surface) 76%, var(--category-hover));
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

#searchView .catalog-card-link,
#storesView .catalog-card-link {
  min-height: 100%;
}

#searchView .catalog-card-link:focus-visible,
#storesView .catalog-card-link:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

#searchView .catalog > .master-card .work-photo,
#storesView .catalog > .master-card .work-photo {
  aspect-ratio: 5 / 4;
  width: 100%;
  border-bottom: 1px solid var(--section-divider);
  background: var(--catalog-media-surface);
}

#searchView .catalog > .master-card .work-photo img,
#storesView .catalog > .master-card .work-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#searchView .catalog > .master-card .work-photo-icon,
#storesView .catalog > .master-card .work-photo-icon {
  display: grid;
  place-items: center;
  color: var(--placeholder-mark);
  font-size: clamp(1.45rem, 3.6vw, 2.05rem);
  font-weight: 780;
  letter-spacing: 0.02em;
}

#searchView .catalog > .master-card .master-body,
#storesView .catalog > .master-card .master-body {
  grid-template-rows: auto auto auto;
  min-height: 132px;
  gap: 8px;
  padding: 12px;
}

#searchView .catalog > .master-card .master-title h3,
#storesView .catalog > .master-card .master-title h3 {
  display: -webkit-box;
  min-height: 2.44em;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.22;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#searchView .catalog > .master-card .master-type,
#searchView .catalog > .master-card .master-group,
#storesView .catalog > .master-card .master-type,
#storesView .catalog > .master-card .master-group {
  display: -webkit-box;
  min-height: auto;
  margin: 0;
  overflow: hidden;
  color: var(--text-secondary);
  background: transparent;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#searchView .catalog > .master-card .master-group,
#storesView .catalog > .master-card .master-group {
  color: var(--text-muted);
  font-size: 0.86rem;
  -webkit-line-clamp: 1;
}

#searchView .catalog-state,
#storesView .catalog-state {
  grid-column: 1 / -1;
  min-height: 132px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 12px;
  border: 1px dashed var(--section-divider);
  background: color-mix(in srgb, var(--catalog-card-surface) 78%, var(--surface-secondary));
}

#searchView .catalog-state-error,
#storesView .catalog-state-error {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 34%, var(--border));
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
}

.catalog-reset-button {
  min-height: 44px;
}

.catalog-skeleton-card {
  display: grid;
  gap: 10px;
  padding: 0 0 12px;
}

.catalog-skeleton-media,
.catalog-skeleton-line {
  display: block;
  background: linear-gradient(90deg, var(--surface-secondary), color-mix(in srgb, var(--surface-elevated) 72%, var(--surface-secondary)), var(--surface-secondary));
  background-size: 200% 100%;
  animation: admin-skeleton 1.2s infinite linear;
}

.catalog-skeleton-media {
  aspect-ratio: 5 / 4;
  border-bottom: 1px solid var(--section-divider);
}

.catalog-skeleton-line {
  height: 12px;
  margin: 0 12px;
  border-radius: var(--radius-pill);
}

.catalog-skeleton-line.short {
  width: 58%;
}

@media (prefers-reduced-motion: reduce) {
  .catalog-skeleton-media,
  .catalog-skeleton-line {
    animation: none;
  }
}

@media (max-width: 900px) {
  #searchView .finder,
  #storesView .finder {
    padding: 12px;
  }

  #searchView .search-layout,
  #storesView .search-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .catalog-filter-toggle {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    margin-bottom: 10px;
    border: 1px solid var(--section-divider);
    border-radius: var(--radius-lg);
    padding: 9px 12px;
    color: var(--text-secondary);
    background: var(--catalog-sidebar-surface);
    text-align: left;
    font-weight: 650;
  }

  .catalog-filter-toggle b {
    min-width: 0;
    overflow: hidden;
    color: var(--accent);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .catalog-filter-toggle[aria-expanded="true"] {
    color: var(--text-primary);
    border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
    background: var(--active);
  }

  #searchView .category-sidebar,
  #storesView .category-sidebar {
    position: static;
    display: none;
    max-height: 300px;
    border-radius: var(--radius-lg);
  }

  #searchView .finder.filters-open .category-sidebar,
  #storesView .finder.filters-open .category-sidebar {
    display: block;
  }

  #searchView .catalog,
  #storesView .catalog {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 260px));
    justify-content: start;
  }
}

@media (max-width: 520px) {
  #searchView .catalog,
  #storesView .catalog {
    grid-template-columns: 1fr;
  }

  #searchView .catalog > .master-card .work-photo,
  #storesView .catalog > .master-card .work-photo {
    aspect-ratio: 16 / 10;
  }
}

html:not(.theme-ready) *,
html:not(.theme-ready) *::before,
html:not(.theme-ready) *::after {
  transition: none !important;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 7%, transparent), transparent 34rem),
    linear-gradient(180deg, color-mix(in srgb, var(--surface-elevated) 48%, transparent), transparent 28rem),
    var(--background);
}

.topbar,
.admin-header,
.home-catalog,
.home-intro,
.hero,
.finder,
.auth-page,
.profile-form,
.auth-box,
.category-sidebar,
.master-card,
.profile-choice-button,
.master-switch,
.admin-section,
.admin-profile-list article,
.admin-mini-list article,
.admin-category-row,
.admin-health-row,
.tool-card,
.quick-category-button,
.category-list-button,
.home-preview-card,
.home-entry-card,
.detail-section,
.detail-card,
.chat-layout,
.chat-main,
.chat-list-screen,
.chat-contact,
.site-footer,
.email-modal-card {
  color: var(--text-primary);
  border-color: var(--border);
}

.home-intro-grid > div,
.trust-strip > div,
.result-summary,
.master-type,
.master-group,
.empty-state,
.detail-loading,
.detail-error,
.detail-gallery-controls,
.chat-recipient,
.chat-compose,
.auth-tabs,
.profile-settings-tabs,
.phone-remove-button,
.email-verification-badge,
.google-auth-area {
  color: var(--text-secondary);
  border-color: var(--border);
  background: var(--surface-secondary);
}

.master-card:hover,
.chat-contact:hover,
.chat-contact.active,
.quick-category-button:hover,
.category-list-button:hover,
.category-list-button.active,
.profile-choice-button:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--hover);
  box-shadow: var(--shadow);
}

.app > .topbar,
.account-dropdown,
.email-modal-card {
  background: var(--dropdown-background);
}

.account-dropdown,
.account-dropdown > a,
.account-dropdown > button,
.account-summary {
  border-color: var(--border);
}

.account-dropdown > a:hover,
.account-dropdown > button:hover {
  color: var(--text-primary);
  background: var(--hover);
}

.nav-button,
.nav-link,
.quick-type,
.lang-button,
.secondary-button,
.auth-link,
.message-button,
.whatsapp-button,
.detail-back-button,
.detail-gallery button,
.profile-choice-button,
.profile-settings-tab,
.auth-tab,
.chat-back-button,
.google-auth-button,
.phone-remove-button {
  color: var(--text-secondary);
  border-color: var(--border);
  background: var(--surface);
}

.nav-button:hover,
.nav-link:hover,
.quick-type:hover,
.lang-button:hover,
.secondary-button:hover,
.auth-link:hover,
.message-button:hover,
.whatsapp-button:hover,
.detail-back-button:hover,
.detail-gallery button:hover,
.profile-settings-tab:hover,
.auth-tab:hover,
.chat-back-button:hover,
.google-auth-button:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--hover);
}

.nav-button.active,
.nav-link.active,
.quick-type.active,
.lang-button.active,
.profile-settings-tab.active,
.auth-tab.active,
.detail-gallery button.active {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 24%, var(--border));
  background: var(--active);
}

.call-button,
.profile-form button[type="submit"],
.auth-card button,
.chat-compose button,
.email-modal-actions button,
.email-verify-button {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.call-button:hover,
.profile-form button[type="submit"]:hover,
.auth-card button:hover,
.chat-compose button:hover,
.email-modal-actions button:hover,
.email-verify-button:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

select,
input,
textarea {
  color: var(--text-primary);
  border-color: var(--border);
  background: var(--input-background);
}

select:hover,
input:hover,
textarea:hover {
  border-color: var(--border-strong);
}

select::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

input[readonly],
input:disabled,
select:disabled,
textarea:disabled,
button:disabled,
[aria-disabled="true"] {
  color: var(--text-muted);
  border-color: var(--border);
  background: var(--surface-secondary);
  box-shadow: none;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
}

.badge,
.admin-badge,
.email-verification-badge,
.chat-unread-badge {
  border-color: var(--border);
  color: var(--text-secondary);
  background: var(--surface-secondary);
}

.badge.verified,
.admin-badge.good,
.email-verification-badge[data-status="verified"] {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 34%, var(--border));
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
}

.admin-badge.warn,
.email-verification-badge[data-status="unverified"] {
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 34%, var(--border));
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
}

.auth-error,
.danger-button,
.detail-error,
.admin-danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 38%, var(--border));
  background: color-mix(in srgb, var(--danger) 9%, var(--surface));
}

.email-modal,
.admin-modal {
  background: var(--overlay);
}

hr,
.separator,
.account-summary,
.footer-bottom,
.legal-notes,
.detail-info,
.admin-data-table th,
.admin-data-table td {
  border-color: var(--border);
}

.footer-column a,
.footer-column button,
.footer-bottom a {
  font-weight: 500;
}

.detail-hero,
.detail-section,
.detail-loading {
  border-color: var(--detail-divider);
  background: var(--detail-surface);
}

.detail-contact-card,
.detail-gallery-controls button {
  border-color: var(--detail-divider);
  background: var(--detail-panel-surface);
}

.detail-main-photo,
.detail-gallery button,
.detail-gallery-empty {
  border-color: var(--detail-divider);
  background: var(--detail-media-surface);
}

.detail-tags span,
.detail-info div,
.detail-info-grid div {
  border-color: var(--detail-divider);
  background: var(--detail-meta-surface);
}

.detail-error {
  border-color: color-mix(in srgb, var(--danger) 34%, var(--detail-divider));
  background: color-mix(in srgb, var(--danger) 8%, var(--detail-surface));
}

/* Profile settings workspace: /profile, /profile/master, /profile/store. */
.profile-page .account-layout {
  gap: 16px;
}

.profile-page .profile-form {
  border: 1px solid var(--profile-divider);
  border-radius: var(--radius-lg);
  background: var(--profile-surface);
  box-shadow: var(--shadow-sm);
}

.profile-page .form-title {
  display: grid;
  gap: 6px;
  padding-bottom: 4px;
}

.profile-page .form-title h2 {
  color: var(--text-primary);
  line-height: 1.12;
}

.profile-page label {
  color: var(--text-secondary);
}

.profile-page input,
.profile-page select,
.profile-page textarea {
  border-color: var(--profile-divider);
  background: var(--profile-input-surface);
}

.profile-page input:read-only,
.profile-page input:disabled,
.profile-page select:disabled,
.profile-page textarea:disabled {
  color: var(--text-muted);
  border-color: var(--profile-divider);
  background: var(--profile-status-surface);
}

.profile-page input:-webkit-autofill,
.profile-page textarea:-webkit-autofill,
.profile-page select:-webkit-autofill {
  -webkit-text-fill-color: var(--text-primary);
  box-shadow: 0 0 0 1000px var(--profile-input-surface) inset;
  caret-color: var(--text-primary);
}

.profile-page .account-column,
.profile-page .phone-fields-block,
.profile-page .account-email-column,
.profile-page .master-switch,
.profile-page .profile-contact-summary,
.profile-page .profile-settings-tabs {
  border-color: var(--profile-divider);
  background: var(--profile-section-surface);
}

.profile-page .account-column,
.profile-page .phone-fields-block,
.profile-page .account-email-column {
  border: 1px solid var(--profile-divider);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.profile-page .phone-fields-header > span,
.profile-page .profile-contact-summary strong,
.profile-page .account-whatsapp-field > span {
  color: var(--text-primary);
  font-weight: 760;
}

.profile-page .field-hint,
.profile-page .field-note,
.profile-page .profile-contact-summary span,
.profile-page .account-whatsapp-field small,
.profile-page .google-auth-note {
  color: var(--text-muted);
}

.profile-page .account-whatsapp-field {
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--profile-divider));
  border-radius: var(--radius-lg);
  padding: 12px;
  background: var(--profile-action-surface);
}

.profile-page .account-whatsapp-field input {
  border-color: color-mix(in srgb, var(--accent) 22%, var(--profile-divider));
  background: var(--profile-input-surface);
}

.profile-page .phone-field-row input {
  min-width: 0;
}

.profile-page .phone-remove-button {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 28%, var(--profile-divider));
  background: color-mix(in srgb, var(--danger) 7%, var(--profile-section-surface));
}

.profile-page .phone-remove-button:hover {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 48%, var(--profile-divider));
  background: color-mix(in srgb, var(--danger) 12%, var(--profile-section-surface));
}

.profile-page .email-verification-badge,
.profile-page .profile-choice-status {
  color: var(--text-secondary);
  border-color: var(--profile-divider);
  background: var(--profile-status-surface);
}

.profile-page .email-verification-badge[data-status="verified"],
.profile-page .email-verification-badge[data-status="google"] {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 34%, var(--profile-divider));
  background: color-mix(in srgb, var(--success) 11%, var(--profile-section-surface));
}

.profile-page .email-verification-badge[data-status="unverified"] {
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 38%, var(--profile-divider));
  background: color-mix(in srgb, var(--warning) 12%, var(--profile-section-surface));
}

.profile-page .profile-choice {
  margin-top: 8px;
}

.profile-page .profile-choice-card {
  min-height: 0;
  border-color: var(--profile-divider);
  border-radius: var(--radius-lg);
  background: var(--profile-section-surface);
  box-shadow: none;
}

.profile-page .account-email-card {
  border-color: var(--profile-divider);
  border-radius: var(--radius-lg);
  background: var(--profile-section-surface);
}

.profile-page .account-email-card input[readonly] {
  border-color: var(--profile-divider);
  background: var(--profile-status-surface);
}

.profile-page .profile-choice-card:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--profile-divider));
  background: var(--profile-action-surface);
  box-shadow: var(--shadow-xs);
}

.profile-page .profile-choice-card strong {
  color: var(--text-primary);
}

.profile-page .profile-choice-card span {
  color: var(--text-secondary);
}

.profile-page .profile-choice-avatar-slot {
  border-color: var(--profile-divider);
  background: var(--profile-status-surface);
}

.profile-page .profile-choice-avatar-fallback {
  color: var(--text-primary);
  background: var(--profile-status-surface);
}

.profile-page .profile-choice-button,
.profile-page .profile-back-link {
  min-height: 44px;
}

.profile-page .profile-choice-actions .profile-messages-button {
  color: var(--text-primary);
  border-color: var(--profile-divider);
  background: var(--profile-input-surface);
}

.profile-page .profile-choice-actions .profile-messages-button:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--profile-divider));
  background: var(--profile-action-surface);
}

.profile-page .profile-settings-tabs {
  border-radius: var(--radius-lg);
}

.profile-page .profile-settings-tab.active {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 26%, var(--profile-divider));
  background: var(--active);
}

.profile-page .master-switch,
.profile-page .profile-contact-summary {
  border-radius: var(--radius-lg);
}

.profile-page .profile-messages-workspace {
  align-content: center;
  min-height: 240px;
}

.profile-page .profile-contact-summary dl > div {
  min-width: 0;
  border-top: 1px solid var(--profile-divider);
  padding-top: 8px;
}

.profile-page .profile-contact-summary dt {
  color: var(--text-muted);
}

.profile-page .profile-contact-summary dd {
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.profile-page .master-fields label,
.profile-page .file-field {
  min-width: 0;
}

.profile-page .file-field small,
.profile-page .email-field small {
  color: var(--text-muted);
}

.profile-page .form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--profile-divider);
  padding-top: 14px;
}

.profile-page .form-actions button {
  min-height: 46px;
}

.profile-page .save-status {
  min-height: 24px;
}

.profile-page .save-status.success {
  color: var(--success);
}

.profile-page .save-status.error,
.profile-page .field-error {
  color: var(--danger);
}

.auth-page .auth-box,
.auth-page .auth-card,
.auth-page .google-auth-area,
.email-modal-card {
  border-color: var(--profile-divider);
  background: var(--profile-section-surface);
}

.auth-page .auth-tabs {
  border-color: var(--profile-divider);
  background: var(--profile-status-surface);
}

.auth-page .google-auth-button {
  color: var(--text-primary);
  border-color: var(--profile-divider);
  background: var(--profile-input-surface);
}

.auth-page .google-mark,
.email-modal-close {
  border-color: var(--profile-divider);
  background: var(--profile-input-surface);
}

@media (max-width: 768px) {
  .profile-page .profile-form {
    gap: 12px;
    padding: 14px;
  }

  .profile-page .account-column,
  .profile-page .phone-fields-block,
  .profile-page .account-email-column,
  .profile-page .master-switch,
  .profile-page .profile-contact-summary,
  .profile-page .profile-choice-card {
    border-radius: 12px;
    padding: 12px;
  }

  .profile-page .account-whatsapp-field {
    border-color: color-mix(in srgb, var(--accent) 28%, var(--profile-divider));
    background: var(--profile-action-surface);
  }

  .profile-page .account-whatsapp-field span {
    color: var(--text-primary);
  }

  .profile-page .account-whatsapp-field input {
    border-color: color-mix(in srgb, var(--accent) 24%, var(--profile-divider));
    background: var(--profile-input-surface);
  }

  .profile-page .account-whatsapp-field small {
    color: var(--text-secondary);
  }

  .profile-page .profile-contact-summary dl > div {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .profile-page .profile-choice-button,
  .profile-page .profile-back-link,
  .profile-page .contact-edit-link {
    width: 100%;
  }

  .profile-page .profile-choice-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .profile-page .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .profile-page .save-status {
    text-align: center;
  }

  .master-editor-grid,
  .master-photo-preview {
    grid-template-columns: 1fr;
  }

  .master-photo-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .master-phone-header {
    align-items: stretch;
    flex-direction: column;
  }

  .master-phone-header .secondary-button,
  .master-editor-actions > button,
  .master-editor-actions > a {
    width: 100%;
  }

  .master-editor-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .topbar,
  .home-catalog,
  .home-intro,
  .hero,
  .finder,
  .auth-page,
  .profile-form,
  .chat-layout,
  .main-nav,
  .mobile-menu-trigger,
  .chat-contact,
  .chat-bubble,
  .chat-compose button {
    border-radius: var(--radius-lg);
  }

  .main-nav {
    box-shadow: var(--shadow-md);
  }
}

@media (max-width: 768px), (pointer: coarse) and (max-width: 900px) {
  body.chat-conversation-open {
    overflow: hidden;
    padding-bottom: 0;
  }

  body.chat-conversation-open .app {
    display: flex;
    flex-direction: column;
    height: var(--chat-viewport-height, 100dvh);
    min-height: 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  body.chat-conversation-open .chat-layout {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    height: auto;
    min-height: 0;
    margin-top: 10px;
    overflow: hidden;
  }

  body.chat-conversation-open .chat-main:not(.hidden) {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
  }

  body.chat-conversation-open .chat-recipient {
    flex-shrink: 0;
    grid-template-columns: auto 40px minmax(0, 1fr);
    gap: 8px;
    padding: 9px 10px;
  }

  body.chat-conversation-open .chat-back-button {
    min-height: 38px;
    padding: 0 8px;
  }

  body.chat-conversation-open .chat-recipient-avatar {
    width: 40px;
    height: 40px;
  }

  body.chat-conversation-open .chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px;
  }

  body.chat-conversation-open .chat-compose {
    flex-shrink: 0;
  }

  body.chat-keyboard-open .topbar,
  body.chat-keyboard-open .main-nav {
    display: none;
  }

  body.chat-keyboard-open .app > .topbar .main-nav {
    display: none;
  }

  body.chat-keyboard-open .app {
    width: 100%;
    padding: 0;
  }

  body.chat-keyboard-open .chat-layout {
    margin-top: 0;
    border-radius: 0;
  }

  body.chat-keyboard-open .chat-recipient {
    grid-template-columns: auto 34px minmax(0, 1fr);
    min-height: 48px;
    padding: 6px 8px;
  }

  body.chat-keyboard-open .chat-back-button {
    min-height: 34px;
    border-radius: 9px;
    font-size: 0.84rem;
  }

  body.chat-keyboard-open .chat-recipient-avatar {
    width: 34px;
    height: 34px;
    font-size: 0.86rem;
  }

  body.chat-keyboard-open .chat-recipient-copy {
    gap: 0;
  }

  body.chat-keyboard-open .chat-recipient-copy span {
    display: none;
  }

  body.chat-keyboard-open .chat-messages {
    padding: 8px;
  }

  body.chat-keyboard-open .chat-compose {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 6px;
    padding: 6px 8px max(6px, env(safe-area-inset-bottom));
    border-radius: 0;
  }

  body.chat-keyboard-open .chat-compose textarea {
    min-height: 42px;
    max-height: 72px;
    padding: 9px 10px;
    resize: none;
  }

  body.chat-keyboard-open .chat-compose button {
    display: grid;
    place-items: center;
    width: 44px;
    min-width: 44px;
    min-height: 42px;
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    font-size: 0;
  }

  body.chat-keyboard-open .chat-compose button::before {
    content: "➤";
    font-size: 1.05rem;
    line-height: 1;
  }
}

@media (max-width: 900px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .detail-hero,
  .detail-loading {
    grid-template-columns: 1fr;
  }

  .detail-contact-panel {
    position: static;
  }

  .detail-media {
    max-width: 560px;
  }

  .detail-main-photo {
    max-height: 360px;
  }

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

  .detail-related {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 260px));
  }
}

@media (max-width: 768px) {
  .detail-app {
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
  }

  .detail-back-button,
  .detail-hero,
  .detail-section,
  .detail-loading,
  .detail-error {
    margin-top: 12px;
    border-radius: var(--radius-lg);
  }

  .detail-hero,
  .detail-section,
  .detail-loading,
  .detail-error {
    padding: 12px;
  }

  .detail-summary {
    gap: 12px;
  }

  .detail-summary h1 {
    font-size: clamp(1.55rem, 7.2vw, 2.1rem);
    line-height: 1.12;
  }

  .detail-description {
    line-height: 1.5;
  }

  .detail-main-photo {
    aspect-ratio: 16 / 11;
    max-height: 280px;
    border-radius: var(--radius-lg);
  }

  .detail-gallery {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .detail-actions {
    grid-template-columns: 1fr;
  }

  .detail-actions .call-button,
  .detail-actions .message-button,
  .detail-actions .whatsapp-button {
    min-height: 48px;
    border-radius: var(--radius-lg);
  }

  .detail-info {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .detail-info-grid {
    grid-template-columns: 1fr;
  }

  .detail-related {
    grid-template-columns: 1fr;
  }

  .detail-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .detail-tags span {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 360px) {
  .detail-main-photo {
    min-height: 0;
    max-height: 240px;
  }

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

}

/* Final admin v1 overrides: keep the production console above legacy admin styles. */
body.admin-app-body {
  color: #111827;
  background: #f8f9fa;
}

body.admin-app-body .admin-console {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

body.admin-app-body .admin-console.hidden,
body.admin-app-body .admin-login-view.hidden {
  display: none;
}

body.admin-app-body .admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid #e5e7eb;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

body.admin-app-body .admin-main {
  min-width: 0;
  padding: 18px;
}

body.admin-app-body .admin-topbar,
body.admin-app-body .admin-panel-card,
body.admin-app-body .admin-kpi,
body.admin-app-body .admin-table-wrap,
body.admin-app-body .admin-toolbar {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}

body.admin-app-body .admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  margin-bottom: 16px;
  padding: 12px 14px;
}

body.admin-app-body .admin-content {
  display: none;
}

body.admin-app-body .admin-content.active {
  display: grid;
  gap: 16px;
}

body.admin-app-body .admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

body.admin-app-body .admin-kpi-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

body.admin-app-body .admin-grid-two,
body.admin-app-body .admin-grid-three,
body.admin-app-body .admin-grid-four {
  display: grid;
  gap: 16px;
}

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

body.admin-app-body .admin-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.admin-app-body .admin-grid-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

body.admin-app-body .admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px;
}

body.admin-app-body .admin-toolbar input,
body.admin-app-body .admin-toolbar select {
  min-width: 190px;
  min-height: 40px;
}

body.admin-app-body .admin-data-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

body.admin-app-body .admin-data-table th,
body.admin-app-body .admin-data-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
}

body.admin-app-body .admin-data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #6b7280;
  background: #f8f9fa;
  font-size: 0.78rem;
  text-transform: uppercase;
}

body.admin-app-body .admin-modal.hidden {
  display: none;
}

body.admin-app-body .admin-drawer-backdrop {
  display: none;
}

@media (max-width: 1280px) {
  body.admin-app-body .admin-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.admin-app-body .admin-grid-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  body.admin-app-body .admin-console,
  body.admin-app-body .admin-grid-two,
  body.admin-app-body .admin-grid-three,
  body.admin-app-body .admin-grid-four {
    grid-template-columns: 1fr;
  }

  body.admin-app-body .admin-sidebar {
    position: fixed;
    left: 0;
    z-index: 30;
    width: min(300px, 88vw);
    transform: translateX(-102%);
    transition: transform 0.2s ease;
  }

  body.admin-app-body .admin-sidebar.open {
    transform: translateX(0);
  }

  body.admin-app-body .admin-drawer-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(17, 24, 39, 0.38);
  }
}

@media (max-width: 640px) {
  body.admin-app-body .admin-kpi-grid,
  body.admin-app-body .admin-kpi-grid.compact {
    grid-template-columns: 1fr;
  }

  body.admin-app-body .admin-topbar,
  body.admin-app-body .admin-toolbar,
  body.admin-app-body .admin-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  body.admin-app-body .admin-toolbar input,
  body.admin-app-body .admin-toolbar select,
  body.admin-app-body .admin-topbar-actions button {
    width: 100%;
    min-height: 44px;
  }
}

/* Admin v2 scoped guard: keep the console independent from legacy public-page rules. */
body.admin-app-body {
  color-scheme: light;
  --background: #f8f9fa;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-secondary: #f9fafb;
  --surface-inset: #f8f9fa;
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --accent: #176b4c;
  --accent-hover: #10563d;
  --accent-soft: #edf7f1;
  --success: #1f7a4d;
  --warning: #a16207;
  --danger: #b42318;
  --overlay: rgba(17, 24, 39, 0.42);
  --shadow-color: rgba(17, 24, 39, 0.08);
  --shadow-color-strong: rgba(17, 24, 39, 0.18);
  --hover: #f3f4f6;
  --active: #edf7f1;
  --focus: color-mix(in srgb, var(--accent) 32%, transparent);
  --input-background: #ffffff;
  --dropdown-background: #ffffff;
  --page-bg: var(--background);
  --surface-primary: var(--surface);
  --brand-green: var(--accent);
  --brand-green-hover: var(--accent-hover);
  --brand-green-soft: var(--accent-soft);
  --focus-ring: var(--focus);
  --shadow-xs: 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04), 0 8px 18px rgba(17, 24, 39, 0.045);
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.05), 0 14px 34px rgba(17, 24, 39, 0.07);
  --shadow-md: 0 10px 32px var(--shadow-color);
  --shadow-hover: 0 18px 42px rgba(17, 24, 39, 0.1);
  --bg: var(--background);
  --surface-soft: var(--surface-secondary);
  --text: var(--text-primary);
  --muted: var(--text-muted);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --brand: var(--accent);
  --brand-strong: var(--accent-hover);
  --brand-soft: var(--accent-soft);
  --gold: var(--warning);
  --red: var(--danger);
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

body.admin-app-body .admin-app {
  min-height: 100vh;
}

body.admin-app-body .admin-login-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 28px;
  align-items: center;
  min-height: 100vh;
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

body.admin-app-body .admin-login-card {
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: 430px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

body.admin-app-body .admin-login-card label {
  display: grid;
  gap: 7px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 700;
}

body.admin-app-body .admin-login-card input,
body.admin-app-body .admin-toolbar input,
body.admin-app-body .admin-toolbar select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface);
  box-shadow: none;
}

body.admin-app-body .admin-login-card button,
body.admin-app-body .secondary-button,
body.admin-app-body .admin-link-button,
body.admin-app-body .admin-pagination button {
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: var(--surface);
  font-weight: 750;
  box-shadow: none;
}

body.admin-app-body .admin-login-card button {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
}

body.admin-app-body .admin-danger {
  min-height: 42px;
  border: 1px solid color-mix(in srgb, var(--danger) 38%, var(--line));
  border-radius: 8px;
  padding: 0 14px;
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  font-weight: 750;
  box-shadow: none;
}

body.admin-app-body .admin-console {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

body.admin-app-body .admin-console.hidden,
body.admin-app-body .admin-login-view.hidden,
body.admin-app-body .admin-modal.hidden {
  display: none;
}

body.admin-app-body .admin-sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
}

body.admin-app-body .admin-main {
  min-width: 0;
  padding: 18px;
}

body.admin-app-body .admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--surface);
  box-shadow: none;
}

body.admin-app-body .admin-content {
  display: none;
}

body.admin-app-body .admin-content.active {
  display: grid;
  gap: 16px;
}

body.admin-app-body .admin-panel-card,
body.admin-app-body .admin-kpi,
body.admin-app-body .admin-table-wrap,
body.admin-app-body .admin-toolbar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: none;
}

body.admin-app-body .admin-table-wrap {
  overflow-x: auto;
}

body.admin-app-body .admin-data-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

body.admin-app-body .admin-data-table th,
body.admin-app-body .admin-data-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
}

body.admin-app-body .admin-data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
}

body.admin-app-body .admin-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: var(--overlay);
}

body.admin-app-body .admin-modal-card {
  position: relative;
  width: min(920px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: var(--surface-elevated);
  box-shadow: var(--shadow-md);
}

body.admin-app-body .admin-drawer-backdrop {
  display: none;
}

@media (max-width: 900px) {
  body.admin-app-body .admin-login-view,
  body.admin-app-body .admin-console,
  body.admin-app-body .admin-grid-two,
  body.admin-app-body .admin-grid-three,
  body.admin-app-body .admin-grid-four {
    grid-template-columns: 1fr;
  }

  body.admin-app-body .admin-login-copy {
    display: none;
  }

  body.admin-app-body .admin-login-card {
    justify-self: center;
  }

  body.admin-app-body .admin-sidebar {
    position: fixed;
    left: 0;
    width: min(300px, 88vw);
    transform: translateX(-102%);
    transition: transform 0.2s ease;
  }

  body.admin-app-body .admin-sidebar.open {
    transform: translateX(0);
  }

  body.admin-app-body .admin-drawer-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: var(--overlay);
  }

  body.admin-app-body .admin-drawer-close,
  body.admin-app-body .admin-menu-button {
    display: inline-grid;
    place-items: center;
  }
}

@media (max-width: 640px) {
  body.admin-app-body .admin-main {
    padding: 12px;
  }

  body.admin-app-body .admin-topbar,
  body.admin-app-body .admin-topbar-actions,
  body.admin-app-body .admin-toolbar,
  body.admin-app-body .admin-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  body.admin-app-body .admin-topbar-actions button,
  body.admin-app-body .admin-pagination button {
    width: 100%;
  }
}

@media (max-width: 340px) {
  .catalog,
  #randomCatalog {
    grid-template-columns: 1fr;
  }
}

/* Premium chat */
body:has(> .app > .chat-layout),
body.embedded-chat-active {
  min-height: 100dvh;
  background: var(--background);
}

.chat-layout {
  grid-template-columns: 360px minmax(0, 1fr);
  height: min(760px, calc(100dvh - 112px));
  min-height: 560px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--chat-surface);
  box-shadow: var(--shadow-sm);
}

.chat-list-open .chat-layout {
  grid-template-columns: 360px minmax(0, 1fr);
}

.chat-list-screen {
  min-height: 0;
  border-right: 1px solid var(--chat-divider);
  background: var(--chat-sidebar-surface);
}

.chat-list-open .chat-list-screen {
  border-right: 1px solid var(--chat-divider);
}

.chat-screen-header,
.chat-recipient {
  min-height: 72px;
  border-bottom: 1px solid var(--chat-divider);
  padding: 12px 14px;
  background: var(--chat-sidebar-surface);
}

.chat-screen-header {
  display: flex;
  align-items: center;
}

.chat-screen-header .eyebrow {
  margin-bottom: 3px;
  font-size: 0.72rem;
}

.chat-screen-header h1 {
  font-size: 1.18rem;
  line-height: 1.18;
}

.chat-contacts {
  grid-auto-rows: 76px;
  padding: 6px;
  scrollbar-gutter: stable;
}

.chat-contact {
  grid-template-columns: 46px minmax(0, 1fr);
  height: 76px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px;
  background: transparent;
  cursor: pointer;
}

.chat-contact:hover,
.chat-contact:focus-visible {
  border-color: var(--chat-divider);
  background: color-mix(in srgb, var(--accent) 7%, var(--chat-sidebar-surface));
  box-shadow: none;
  transform: none;
}

.chat-contact.active {
  border-color: color-mix(in srgb, var(--accent) 22%, var(--chat-divider));
  background: color-mix(in srgb, var(--accent) 13%, var(--chat-sidebar-surface));
  box-shadow: inset 3px 0 0 var(--accent);
  transform: none;
}

.chat-contact-avatar,
.chat-recipient-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #fff;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 88%, #ffffff), var(--accent-hover));
  font-size: 0.95rem;
  font-weight: 760;
}

.chat-contact-copy {
  gap: 4px;
}

.chat-contact-title strong {
  color: var(--text-primary);
  font-size: 0.94rem;
  font-weight: 720;
}

.chat-contact-title time {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 620;
}

.chat-contact small {
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 500;
}

.chat-unread-badge {
  min-width: 22px;
  height: 22px;
  border: 0;
  color: #fff;
  background: var(--accent);
  font-size: 0.72rem;
  font-weight: 760;
}

.chat-main {
  min-height: 0;
  background: var(--chat-surface);
}

.chat-recipient {
  grid-template-columns: auto 44px minmax(0, 1fr);
  gap: 10px;
  background: var(--chat-surface);
}

.chat-back-button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--surface) 86%, var(--chat-surface));
  font-weight: 650;
}

.chat-back-button:hover,
.chat-back-button:focus-visible {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--hover);
}

.chat-recipient-copy strong {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 720;
}

.chat-recipient-copy span {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.chat-messages {
  gap: 6px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 18px 18px 14px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--chat-surface) 94%, var(--background)), var(--chat-surface));
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-gutter: stable;
}

@media (hover: hover) and (pointer: fine) {
  .chat-messages {
    --chat-scrollbar-thumb: color-mix(in srgb, var(--text-muted) 82%, var(--chat-surface));
    scrollbar-width: auto;
  }

  .chat-messages:hover {
    --chat-scrollbar-thumb: var(--text-muted);
  }

  .chat-messages::-webkit-scrollbar {
    width: 12px;
  }

  .chat-messages::-webkit-scrollbar-track {
    background: transparent;
  }

  .chat-messages::-webkit-scrollbar-thumb {
    min-height: 44px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: var(--chat-scrollbar-thumb);
    background-clip: padding-box;
  }

  @supports (-moz-appearance: none) {
    .chat-messages {
      scrollbar-color: color-mix(in srgb, var(--text-muted) 82%, var(--chat-surface)) transparent;
    }
  }
}

.chat-messages:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.chat-bubble {
  max-width: min(68%, 600px);
  border: 1px solid var(--chat-divider);
  border-radius: 18px;
  padding: 9px 11px 7px;
  color: var(--text-primary);
  background: var(--chat-message-in);
  box-shadow: var(--shadow-xs);
}

.chat-bubble.theirs {
  align-self: flex-start;
  border-bottom-left-radius: 6px;
}

.chat-bubble.mine {
  align-self: flex-end;
  border-color: color-mix(in srgb, var(--accent) 18%, var(--chat-divider));
  border-bottom-right-radius: 6px;
  color: var(--text-primary);
  background: var(--chat-message-out);
}

.chat-bubble p {
  color: inherit;
  font-size: 0.95rem;
  line-height: 1.42;
}

.chat-bubble small {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.69rem;
  font-weight: 600;
  line-height: 1.1;
  opacity: 1;
}

.chat-date-separator {
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: 10px;
  margin: 10px 0 8px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 680;
  line-height: 1;
}

.chat-date-separator::before,
.chat-date-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--chat-divider);
}

.chat-compose {
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 10px;
  border-top: 1px solid var(--chat-divider);
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  background: var(--chat-composer);
  backdrop-filter: blur(14px);
}

.chat-compose textarea {
  min-height: 48px;
  max-height: 118px;
  border-radius: 8px;
  padding: 13px 14px;
  resize: none;
  line-height: 1.35;
}

.chat-compose textarea:focus {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  box-shadow: 0 0 0 3px var(--focus);
}

.chat-compose button {
  display: grid;
  place-items: center;
  min-width: 48px;
  width: 48px;
  min-height: 48px;
  border-radius: 8px;
  padding: 0;
  font-size: 0;
}

.chat-compose button::before {
  content: "";
  width: 18px;
  height: 18px;
  background: currentColor;
  clip-path: polygon(7% 6%, 96% 50%, 7% 94%, 18% 58%, 52% 50%, 18% 42%);
}

.chat-compose button:disabled {
  color: var(--text-muted);
  border-color: var(--border);
  background: var(--surface-secondary);
  cursor: not-allowed;
}

.chat-status,
.chat-list-empty {
  align-self: center;
  justify-self: center;
  width: min(360px, calc(100% - 32px));
  border: 1px solid var(--chat-divider);
  border-radius: 8px;
  padding: 18px;
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--surface) 88%, var(--chat-surface));
  text-align: center;
  box-shadow: var(--shadow-xs);
}

.chat-status-error {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 28%, var(--chat-divider));
  background: color-mix(in srgb, var(--danger) 7%, var(--chat-surface));
}

.chat-list-empty {
  min-height: 0;
  margin: 32px auto;
}

.chat-list-empty strong {
  font-size: 1rem;
}

.chat-contact-skeleton {
  pointer-events: none;
}

.chat-skeleton-avatar,
.chat-skeleton-line {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--surface-secondary), var(--surface), var(--surface-secondary));
  background-size: 220% 100%;
  animation: admin-skeleton 1.2s infinite linear;
}

.chat-skeleton-avatar {
  width: 44px;
  height: 44px;
}

.chat-skeleton-line {
  width: 100%;
  height: 12px;
}

.chat-skeleton-line.short {
  width: 56%;
}

.chat-bubble-skeleton {
  width: min(54%, 360px);
  min-height: 62px;
}

.chat-bubble-skeleton .chat-skeleton-line + .chat-skeleton-line {
  margin-top: 10px;
}

html[data-theme="dark"] .chat-layout {
  box-shadow: none;
}

html[data-theme="dark"] .chat-contact:hover,
html[data-theme="dark"] .chat-contact:focus-visible {
  background: color-mix(in srgb, var(--accent) 9%, var(--chat-sidebar-surface));
}

html[data-theme="dark"] .chat-bubble {
  box-shadow: none;
}

@media (max-width: 1024px) {
  .chat-layout,
  .chat-list-open .chat-layout {
    grid-template-columns: 1fr;
  }

  .chat-list-screen,
  .chat-list-open .chat-list-screen {
    border-right: 0;
  }
}

@media (max-width: 768px), (pointer: coarse) and (max-width: 900px) {
  body:has(> .app > .chat-layout),
  body.embedded-chat-active {
    overflow-x: hidden;
  }

  body.chat-conversation-open .app {
    height: var(--chat-viewport-height, 100dvh);
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  }

  body.chat-conversation-open .main-nav,
  body.chat-conversation-open .app > .topbar .main-nav {
    display: none;
  }

  body.chat-conversation-open .chat-layout {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    margin-top: 8px;
    border-radius: 8px;
    overflow: hidden;
  }

  body.chat-conversation-open .chat-main:not(.hidden) {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
  }

  body.chat-conversation-open .chat-recipient {
    min-height: 58px;
    grid-template-columns: auto 38px minmax(0, 1fr);
    padding: 8px;
  }

  body.chat-conversation-open .chat-back-button {
    min-height: 42px;
    min-width: 44px;
    padding: 0 10px;
  }

  body.chat-conversation-open .chat-recipient-avatar {
    width: 38px;
    height: 38px;
  }

  body.chat-conversation-open .chat-messages {
    padding: 10px 8px 8px;
  }

  body.chat-conversation-open .chat-bubble {
    max-width: min(86%, 560px);
  }

  body.chat-conversation-open .chat-compose {
    grid-template-columns: minmax(0, 1fr) 46px;
    flex-shrink: 0;
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  }

  body.chat-conversation-open .chat-compose textarea {
    min-height: 46px;
    max-height: 84px;
    padding: 12px;
  }

  body.chat-conversation-open .chat-compose button {
    width: 46px;
    min-width: 46px;
    min-height: 46px;
  }

  body.chat-keyboard-open .chat-layout {
    margin-top: 0;
    border-width: 0;
  }

  body.chat-keyboard-open .chat-recipient {
    min-height: 48px;
  }

  body.chat-keyboard-open .chat-messages {
    padding: 8px;
  }

  body.chat-keyboard-open .chat-compose button::before {
    content: "";
    font-size: 0;
  }
}

/* Embedded chat view uses the existing application shell. */
body.embedded-chat-active .site-footer {
  display: none;
}

#chatView,
#chatView .chat-layout,
#chatView .chat-main,
#chatView .chat-list-screen {
  min-height: 0;
}

#chatView.active {
  overflow: hidden;
}

@media (min-width: 769px) {
  #chatView .chat-layout {
    height: min(760px, calc(100dvh - 112px));
  }
}

@media (max-width: 768px), (pointer: coarse) and (max-width: 900px) {
  body.embedded-chat-active.chat-conversation-open #chatView.active {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
  }

  body.embedded-chat-active.chat-conversation-open #chatView .chat-layout {
    width: 100%;
  }
}

@media (max-width: 390px) {
  .chat-contacts {
    padding: 4px;
  }

  .chat-contact {
    grid-template-columns: 40px minmax(0, 1fr);
    height: 72px;
    padding: 8px;
  }

  .chat-contact-avatar {
    width: 40px;
    height: 40px;
  }

  .chat-bubble {
    max-width: 90%;
  }
}

@media (max-width: 340px) {
  body.chat-conversation-open .chat-recipient {
    grid-template-columns: auto 34px minmax(0, 1fr);
    gap: 7px;
  }

  body.chat-conversation-open .chat-back-button {
    padding: 0 8px;
    font-size: 0.82rem;
  }

  body.chat-conversation-open .chat-recipient-avatar {
    width: 34px;
    height: 34px;
  }
}

/* Conversation V2 local-hide action. */
.chat-recipient {
  grid-template-columns: auto 44px minmax(0, 1fr) auto;
}

.chat-hide-button {
  min-height: 40px;
  max-width: 230px;
  border: 1px solid color-mix(in srgb, #b42318 34%, var(--border));
  border-radius: 8px;
  padding: 8px 11px;
  color: #b42318;
  background: color-mix(in srgb, #b42318 5%, var(--surface));
  font-size: 0.78rem;
  font-weight: 680;
  line-height: 1.2;
  cursor: pointer;
}

.chat-hide-button:hover,
.chat-hide-button:focus-visible {
  border-color: color-mix(in srgb, #b42318 58%, var(--border));
  background: color-mix(in srgb, #b42318 10%, var(--surface));
}

.chat-hide-button:disabled {
  opacity: 0.58;
  cursor: wait;
}

html[data-theme="dark"] .chat-hide-button {
  color: #ffaaa2;
}

@media (max-width: 768px), (pointer: coarse) and (max-width: 900px) {
  body.chat-conversation-open .chat-recipient {
    grid-template-columns: auto 38px minmax(0, 1fr) 42px;
  }

  .chat-hide-button {
    position: relative;
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    overflow: hidden;
    padding: 0;
    color: transparent;
    font-size: 0;
  }

  .chat-hide-button::before {
    content: "×";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #b42318;
    font-size: 1.55rem;
    font-weight: 500;
  }

  html[data-theme="dark"] .chat-hide-button::before {
    color: #ffaaa2;
  }
}

@media (max-width: 340px) {
  body.chat-conversation-open .chat-recipient {
    grid-template-columns: auto 34px minmax(0, 1fr) 38px;
  }

  .chat-hide-button {
    width: 38px;
    min-width: 38px;
    min-height: 40px;
  }
}

/* Final public UI regression fixes */
.detail-info dd a,
.detail-phone-list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border-radius: var(--radius-sm);
}

@media (max-width: 768px) {
  body:not(.admin-app-body):not(.chat-conversation-open) .app {
    padding-bottom: calc(116px + env(safe-area-inset-bottom));
  }

  .app > .topbar .brand {
    min-height: 44px;
  }

  .app > .topbar .main-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .app > .topbar .main-nav:has(> #chatLink.hidden) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .app > .topbar .main-nav .nav-button,
  .app > .topbar .main-nav .nav-link {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  #homeView .quick-categories {
    grid-auto-columns: minmax(190px, 78%);
  }

  #homeView .quick-category-button {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  #homeView .quick-category-button span {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.18;
  }

}

@media (max-width: 360px) {
  .app > .topbar .main-nav {
    left: max(6px, env(safe-area-inset-left));
    right: max(6px, env(safe-area-inset-right));
    gap: 3px;
    padding: 4px;
  }

  .app > .topbar .main-nav .nav-button,
  .app > .topbar .main-nav .nav-link {
    padding-inline: 3px;
    font-size: 0.72rem;
  }

  #homeView .quick-categories {
    grid-auto-columns: minmax(174px, 84%);
  }
}

/* Marketplace auth shell with centered card */
.auth-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  justify-items: center;
  min-height: min(680px, calc(100dvh - 118px));
  margin-top: 16px;
  padding: clamp(28px, 6vh, 64px) clamp(16px, 3.2vw, 38px);
  border: 1px solid var(--section-divider);
  border-radius: var(--radius-xl);
  background: var(--profile-surface);
  box-shadow: var(--shadow-sm);
}

.auth-page .auth-box {
  width: min(420px, calc(100% - 32px));
  max-width: calc(100% - 32px);
  border: 1px solid var(--profile-divider);
  border-radius: var(--radius-lg);
  background: var(--profile-section-surface);
  box-shadow: var(--shadow-sm);
}

.auth-page .google-auth-area {
  padding: 18px;
}

.auth-page .auth-divider {
  border-color: var(--profile-divider);
  background: var(--profile-section-surface);
}

.auth-page .auth-divider::before,
.auth-page .auth-divider::after {
  background: var(--profile-divider);
}

.auth-page .auth-card {
  padding: 18px;
}

.auth-page .google-auth-button,
.auth-page .auth-tab,
.auth-page .auth-card input,
.auth-page .auth-card select,
.auth-page .password-toggle,
.auth-page .legacy-phone-toggle,
.auth-page .auth-card button {
  min-height: 44px;
}

.auth-page .auth-card input,
.auth-page .auth-card select {
  width: 100%;
}

@media (max-width: 560px) {
  .auth-page {
    min-height: calc(100dvh - 100px);
    margin-top: 12px;
    padding: 20px 16px calc(96px + env(safe-area-inset-bottom));
  }

  .auth-page .auth-box {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 360px) {
  .auth-page {
    padding-inline: 12px;
  }

  .auth-page .google-auth-area,
  .auth-page .auth-card {
    padding: 16px;
  }

  .auth-page .password-field {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Public header action order: account, theme, language */
.app > .topbar .header-actions .auth-link,
.app > .topbar .header-actions .account-menu {
  order: 1;
}

.app > .topbar .header-actions .theme-toggle {
  order: 2;
}

.app > .topbar .header-actions .lang-switch {
  order: 3;
}

@media (max-width: 768px) {
  .app > .topbar.mobile-menu-open .auth-link:not(.hidden) {
    grid-row: 3;
  }

  .app > .topbar.mobile-menu-open .theme-toggle {
    grid-row: 4;
  }

  .app > .topbar.mobile-menu-open .lang-switch {
    grid-row: 5;
  }
}

/* Auth UX polish */
.auth-page .auth-box {
  overflow: visible;
}

.auth-page .google-auth-area {
  gap: 6px;
  padding: 16px 18px 12px;
}

.auth-page .google-auth-note {
  font-size: 0.84rem;
  line-height: 1.35;
}

.auth-page .auth-divider {
  padding: 8px 18px 0;
}

.auth-page .auth-tabs {
  padding: 4px;
  background: color-mix(in srgb, var(--profile-status-surface) 78%, transparent);
}

.auth-page .auth-tab {
  min-height: 38px;
  border-radius: var(--radius-sm);
  font-weight: 720;
}

.auth-page .auth-tab.active {
  color: var(--brand);
  background: var(--profile-input-surface);
  box-shadow: var(--shadow-xs);
}

.auth-page .auth-card {
  gap: 11px;
  padding: 15px 18px 18px;
}

.auth-name-grid {
  display: grid;
  gap: 11px;
}

.auth-page .password-field {
  position: relative;
  display: block;
}

.auth-page .password-field input {
  padding-right: 88px;
}

.auth-page .password-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  min-height: 30px;
  height: 30px;
  padding: 0 8px;
  transform: translateY(-50%);
  border: 0;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 720;
}

.auth-page .password-toggle:hover,
.auth-page .password-toggle:focus-visible {
  color: var(--brand);
  background: var(--profile-status-surface);
}

.auth-page .legacy-phone-toggle {
  min-height: auto;
  justify-self: center;
  padding: 2px 0;
  border: 0;
  color: var(--text-secondary);
  background: transparent;
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-page .legacy-phone-toggle:hover,
.auth-page .legacy-phone-toggle:focus-visible {
  color: var(--brand);
  background: transparent;
}

@media (min-width: 768px) {
  .auth-name-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 360px) {
  .auth-page .auth-card {
    gap: 10px;
  }

  .auth-page .password-field input {
    padding-right: 78px;
  }
}
