:root {
  color-scheme: light;
  --bg: #f7f8f6;
  --surface: #ffffff;
  --surface-soft: #f1f4f0;
  --text: #111716;
  --muted: #66716d;
  --line: #dfe5df;
  --line-strong: #c7d0c8;
  --brand: #176b4c;
  --brand-strong: #0f4d36;
  --brand-soft: #e6f2ec;
  --gold: #9a6a00;
  --red: #a63838;
  --shadow: 0 8px 24px rgba(20, 35, 30, 0.07);
  --radius: 8px;
  --content: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

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 color-mix(in srgb, var(--brand) 34%, transparent);
  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;
}

.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: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 > 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;
}

.account-dropdown {
  position: absolute;
  z-index: 30;
  top: calc(100% + 10px);
  right: 0;
  width: 280px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.account-dropdown-compact {
  width: 170px;
}

.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;
}

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

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

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

.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;
}

.hero,
.account-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 {
  max-width: 760px;
  margin-bottom: 14px;
  font-size: clamp(2.1rem, 5vw, 4.25rem);
  line-height: 1.02;
}

h2 {
  line-height: 1.12;
}

h3 {
  line-height: 1.2;
}

.hero-copy p:last-child,
.account-hero 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;
}

.account-status {
  display: grid;
  gap: 8px;
  align-content: center;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background: var(--surface-soft);
}

.account-status strong {
  color: var(--brand-strong);
  font-size: 1.55rem;
  line-height: 1.1;
}

.account-status span {
  color: var(--muted);
  line-height: 1.5;
}

.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: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

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

.call-button,
.message-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;
}

.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);
}

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

.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;
}

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

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

label:has(#legacyProfileCategory) {
  display: none;
}

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, 1.15fr) minmax(300px, 0.85fr);
  gap: 14px;
}

.profile-form,
.profile-preview {
  padding: 18px;
}

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

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

.form-title h2,
.preview-header 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);
}

.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;
}

.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;
}

.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);
}

.profile-preview {
  align-self: start;
  position: sticky;
  top: 16px;
}

.profile-preview .master-card {
  margin-top: 14px;
}

.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-sidebar {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  border-right: 1px solid var(--line);
}

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

.chat-sidebar-title h1 {
  margin: 0;
  font-size: 1.35rem;
}

.chat-contacts {
  overflow-y: auto;
}

.chat-contact {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  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 > span:first-child {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  background: var(--brand);
  font-weight: 900;
}

.chat-contact > span:last-child {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.chat-contact small {
  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-main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  min-height: 0;
}

.chat-recipient {
  display: grid;
  gap: 3px;
}

.chat-recipient 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) 48px;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 14px;
}

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

.chat-compose button {
  width: 48px;
  min-height: 48px;
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  background: var(--brand);
  font-size: 1.2rem;
}

@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: 820px) {
  .topbar,
  .hero,
  .auth-page,
  .account-hero,
  .account-layout,
  .profile-form,
  .master-fields,
  .admin-login,
  .admin-grid,
  .footer-main,
  .legal-notes {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: start;
  }

  .main-nav {
    justify-content: start;
    flex-wrap: wrap;
  }

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

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

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

  .category-sidebar,
  .profile-preview {
    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-sidebar-title {
    padding: 12px;
  }

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

  .chat-contact > span:first-child {
    width: 34px;
    height: 34px;
  }
}

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

  .home-catalog,
  .hero,
  .auth-page,
  .account-hero,
  .finder,
  .profile-form,
  .profile-preview,
  .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(2rem, 12vw, 3rem);
  }

  .catalog,
  #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%;
  }
}
