:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f6f3ef;
  --panel: #fffdf9;
  --ink: #211f1c;
  --muted: #726b61;
  --line: #ded8cf;
  --accent: #0f766e;
  --accent-dark: #0a5e58;
  --accent-soft: #dcefed;
  --rose: #a24157;
  --gold: #9a6a19;
  --shadow: 0 22px 55px rgba(42, 35, 25, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.06), transparent 260px),
    var(--bg);
  color: var(--ink);
}

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

.app-shell {
  min-height: 100vh;
  padding: 28px;
}

.workbench {
  width: min(1380px, 100%);
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.client-tools {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.auth-locked {
  overflow: hidden;
}

.auth-locked .workbench {
  filter: blur(2px);
  opacity: 0.48;
  pointer-events: none;
  user-select: none;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 760;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 1rem;
  margin-bottom: 0;
}

.health-pill,
.section-heading span,
.meta-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  padding: 7px 11px;
  font-size: 0.84rem;
  white-space: nowrap;
}

.search-panel,
.access-panel,
.admin-actions,
.stat-card,
.directory-card,
.result-card {
  background: rgba(255, 253, 249, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.admin-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-dark);
  padding: 7px 12px;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 760;
  white-space: nowrap;
}

.topbar-button {
  cursor: pointer;
}

.admin-link:hover {
  border-color: var(--accent);
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(33, 31, 28, 0.38);
}

.auth-modal[hidden] {
  display: none;
}

.auth-dialog {
  width: min(560px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  display: grid;
  gap: 14px;
  background: rgba(255, 253, 249, 0.98);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(33, 31, 28, 0.24);
  padding: 22px;
}

.auth-dialog .access-form,
.auth-dialog .secondary-form {
  grid-template-columns: 1fr;
}

.auth-dialog .primary-button,
.auth-dialog .link-button {
  width: 100%;
  min-height: 46px;
}

.auth-dialog p {
  color: var(--muted);
  margin: 0;
  font-size: 0.92rem;
}

.access-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  padding: 18px;
}

.access-panel[hidden] {
  display: none;
}

.access-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr)) max-content;
  gap: 12px;
  align-items: end;
}

.account-forms {
  display: grid;
  gap: 14px;
}

.access-copy {
  display: grid;
  gap: 4px;
}

.secondary-form {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  grid-template-columns: repeat(3, minmax(160px, 1fr)) max-content;
}

.access-panel p {
  color: var(--muted);
  margin: 0;
  font-size: 0.92rem;
}

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

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

.field label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 690;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid #cfc7bc;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 94px;
  resize: vertical;
  padding: 14px 15px;
  font-size: 1.05rem;
  line-height: 1.4;
}

input,
select {
  height: 44px;
  padding: 0 12px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.form-row {
  display: grid;
  grid-template-columns: minmax(180px, 240px) max-content;
  align-items: end;
  gap: 14px;
}

.primary-button {
  height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  font-weight: 760;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.primary-button:disabled {
  cursor: progress;
  opacity: 0.64;
}

.button-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.examples {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.examples button {
  border: 1px solid #cfc7bc;
  background: #fff;
  border-radius: 999px;
  color: #3e3932;
  cursor: pointer;
  padding: 7px 11px;
  font-size: 0.9rem;
}

.examples button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.status-line {
  border: 1px solid rgba(15, 118, 110, 0.26);
  background: var(--accent-soft);
  border-radius: 8px;
  color: var(--accent-dark);
  margin-bottom: 16px;
  padding: 12px 14px;
  font-weight: 720;
}

.chat-panel {
  min-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.86);
  box-shadow: var(--shadow);
}

.chat-heading {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
}

.chat-heading h1 {
  font-size: 1.35rem;
}

.chat-count {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 7px 11px;
  font-size: 0.84rem;
  font-weight: 760;
}

.chat-messages {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 16px;
  min-height: 56vh;
  max-height: calc(100vh - 245px);
  overflow: auto;
  padding: 20px;
}

.message {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.user-message {
  flex-direction: row-reverse;
}

.avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--accent-dark);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 840;
}

.user-message .avatar {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.message-content {
  max-width: min(760px, calc(100% - 48px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
  line-height: 1.45;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.user-message .message-content {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.assistant-message .message-content {
  width: min(820px, calc(100vw - 120px));
}

.typing-dots {
  display: flex;
  gap: 5px;
  margin-top: 10px;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.32;
  animation: typingPulse 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.16s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes typingPulse {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.28;
  }
  40% {
    transform: translateY(-3px);
    opacity: 0.75;
  }
}

.chat-result-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.chat-result-list .result-card {
  box-shadow: none;
  background: #fffdf9;
}

.chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.96);
  padding: 14px;
}

.chat-composer textarea {
  min-height: 48px;
  max-height: 180px;
  resize: none;
  padding: 12px 13px;
  font-size: 1rem;
}

.send-button {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 840;
}

.send-button:hover {
  background: var(--accent-dark);
}

.send-button:disabled {
  cursor: progress;
  opacity: 0.64;
}

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

.result-column,
.side-column {
  display: grid;
  gap: 12px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
}

.section-note {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 2px 0 0;
}

.results-list,
.contacts-list,
.salon-list,
.progress-log {
  display: grid;
  gap: 10px;
}

.empty-state {
  border: 1px dashed #c9c0b4;
  border-radius: 8px;
  color: var(--muted);
  padding: 22px;
  background: rgba(255, 255, 255, 0.42);
}

.result-card {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.result-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.slot {
  display: grid;
  gap: 2px;
}

.slot strong {
  font-size: 1.65rem;
  line-height: 1;
}

.slot span {
  color: var(--muted);
  font-weight: 680;
}

.service-title {
  margin: 0;
  font-size: 1.16rem;
  line-height: 1.25;
}

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

.detail {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fff;
  min-width: 0;
}

.detail span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.detail strong {
  overflow-wrap: anywhere;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.link-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent-dark);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  text-decoration: none;
  font-weight: 720;
}

.link-button:hover {
  border-color: var(--accent);
}

.link-button.danger-button {
  border-color: #cf8d9b;
  color: var(--rose);
}

.link-button.danger-button:hover {
  border-color: var(--rose);
}

.directory-card {
  padding: 14px;
}

.progress-log {
  max-height: 620px;
  overflow: auto;
}

.progress-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #3e3932;
  padding: 10px 11px;
  font-size: 0.9rem;
  line-height: 1.35;
}

.client-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 5px 9px;
  font-size: 0.78rem;
  font-weight: 780;
}

.client-status.active {
  border-color: rgba(15, 118, 110, 0.34);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.client-status.disabled {
  border-color: #cf8d9b;
  background: #fff2f4;
  color: var(--rose);
}

.client-status.expired {
  border-color: rgba(154, 106, 25, 0.42);
  background: #fff7e8;
  color: var(--gold);
}

.client-payment {
  min-width: 230px;
}

.client-payment label {
  display: grid;
  gap: 5px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 720;
}

.client-payment input[type="date"],
.client-payment input[type="number"] {
  height: 36px;
}

.mini-check {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: var(--ink) !important;
}

.mini-check input {
  width: 18px;
  height: 18px;
}

.client-actions {
  display: grid;
  gap: 8px;
  min-width: 128px;
}

.salon-item,
.contact-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 11px;
}

.salon-item h3,
.contact-item h3 {
  font-size: 0.96rem;
  margin-bottom: 4px;
}

.salon-item p,
.contact-item p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
  margin-bottom: 0;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.service-meta-pill {
  border: 1px solid rgba(15, 118, 110, 0.38);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 8px 13px;
  font-size: 0.96rem;
  font-weight: 840;
  white-space: nowrap;
}

.price-pill {
  background: #fff5dc;
  border-color: #c99a3d;
  color: #7b5010;
}

.slot-options {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 12px;
}

.slot-options > span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 780;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.slot-options ol {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.slot-options li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 6px;
  background: #f7fbfa;
  color: var(--ink);
  padding: 9px 10px;
}

.slot-options li strong {
  font-size: 1.08rem;
}

.slot-options li span {
  color: var(--muted);
  font-weight: 700;
}

.badge {
  border-radius: 999px;
  background: #efe9df;
  color: #50483e;
  padding: 4px 7px;
  font-size: 0.76rem;
  font-weight: 700;
}

.badge.live {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.badge.warn {
  background: #f8e3e8;
  color: var(--rose);
}

.warning-box {
  border: 1px solid #ead4a7;
  background: #fff5dc;
  color: var(--gold);
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 12px 14px;
  font-weight: 690;
}

.warning-box[hidden] {
  display: none;
}

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

.admin-dashboard[hidden] {
  display: none;
}

.admin-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.admin-actions h2 {
  font-size: 1.3rem;
}

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

.stat-card {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.stat-card span,
.stat-card small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 720;
}

.stat-card strong {
  font-size: 1.55rem;
  line-height: 1;
}

.admin-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

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

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 0.9rem;
}

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

.admin-table th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.admin-table small {
  color: var(--rose);
}

.profile-form,
.profile-import,
.client-create-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
  align-items: end;
}

.client-create-form {
  grid-template-columns: repeat(4, minmax(0, 1fr)) max-content;
}

.profile-import {
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) max-content;
  margin-bottom: 12px;
}

.wide-field {
  grid-column: span 2;
}

.profile-import textarea {
  min-height: 78px;
  font-size: 0.95rem;
}

.check-field {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 720;
}

.check-field input {
  width: 18px;
  height: 18px;
}

@media (max-width: 980px) {
  .results-grid {
    grid-template-columns: 1fr;
  }

  .side-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 12px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    margin-bottom: 8px;
  }

  .admin-link {
    text-align: center;
  }

  .health-pill {
    display: block;
    width: 100%;
    max-width: 100%;
    white-space: normal;
    text-align: center;
    overflow-wrap: anywhere;
  }

  .search-panel {
    padding: 14px;
  }

  .chat-panel {
    min-height: calc(100vh - 92px);
  }

  .chat-heading {
    align-items: flex-start;
    padding: 13px;
  }

  .chat-messages {
    max-height: calc(100vh - 235px);
    min-height: 52vh;
    padding: 13px;
  }

  .message-content,
  .assistant-message .message-content {
    width: auto;
    max-width: calc(100vw - 76px);
  }

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

  .send-button {
    width: 46px;
    height: 46px;
  }

  .access-panel,
  .admin-actions {
    padding: 14px;
  }

  .access-form,
  .admin-actions,
  .stats-grid,
  .profile-form,
  .profile-import,
  .client-create-form {
    grid-template-columns: 1fr;
  }

  .wide-field {
    grid-column: auto;
  }

  .admin-actions {
    display: grid;
  }

  textarea {
    min-height: 132px;
    padding: 12px;
    font-size: 1rem;
  }

  .status-line {
    padding: 11px 12px;
    font-size: 0.94rem;
  }

  .form-row,
  .detail-grid,
  .side-column {
    grid-template-columns: 1fr;
  }

  .primary-button {
    width: 100%;
    height: 52px;
  }

  .result-top {
    flex-direction: column;
    gap: 10px;
  }

  .result-card {
    padding: 13px;
  }

  .service-title {
    font-size: 1.04rem;
  }

  .slot {
    width: 100%;
  }

  .slot strong {
    font-size: 2rem;
  }

  .slot span {
    font-size: 0.96rem;
  }

  .badges {
    gap: 8px;
  }

  .service-meta-pill {
    flex: 1 1 120px;
    text-align: center;
  }

  .slot-options {
    padding: 10px;
  }

  .slot-options li {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

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

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