:root {
  color-scheme: light;
  --ink: #171513;
  --muted: #6f6864;
  --line: #e7ded8;
  --paper: #faf7f3;
  --card: #fffdfa;
  --blush-soft: #f3e6e1;
  --sage: #71877d;
  --sage-soft: #e9efeb;
  --taupe: #8b6f62;
  --coffee: #4d403a;
  --graphite: #252725;
  --gold: #b99b68;
  --shadow: 0 18px 50px rgba(44, 35, 31, 0.1);
  --shadow-soft: 0 10px 28px rgba(44, 35, 31, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #f7f3ef 0%, #f1eee9 50%, #f8f5f1 100%),
    repeating-linear-gradient(90deg, rgba(37, 39, 37, 0.02) 0 1px, transparent 1px 84px);
}

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

button {
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--graphite), #4a433f);
  color: #fff;
  padding: 11px 18px;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(37, 39, 37, 0.18);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(37, 39, 37, 0.22);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.96);
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(113, 135, 125, 0.7);
  box-shadow: 0 0 0 3px rgba(113, 135, 125, 0.12);
}

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

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 56px;
}

.hero {
  min-height: 260px;
  display: grid;
  grid-template-columns: 1fr 260px;
  align-items: center;
  gap: 28px;
  padding: 42px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(135deg, #252725 0%, #4d403a 54%, #796459 100%);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  right: 42px;
  bottom: 32px;
  width: 190px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(185, 155, 104, 0.78));
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  letter-spacing: 0;
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 60px);
  letter-spacing: 0;
}

.hero h1 {
  color: #fff;
}

h2 {
  margin: 0;
}

.sub {
  max-width: 640px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 18px;
  line-height: 1.75;
}

.hero-card {
  min-height: 180px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

.hero-card strong {
  font-size: 54px;
  color: #fff;
}

.hero-card span,
.hero-card small {
  color: rgba(255, 255, 255, 0.78);
}

.login-panel,
.app-panel {
  margin-top: 24px;
  border: 1px solid rgba(231, 222, 216, 0.9);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.9);
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-panel {
  width: min(460px, 100%);
  display: grid;
  gap: 16px;
}

label {
  color: var(--muted);
  display: grid;
  gap: 8px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.hidden {
  display: none;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 253, 249, 0.96), rgba(243, 230, 225, 0.72));
  box-shadow: var(--shadow-soft);
}

.admin-topbar > div {
  display: grid;
  gap: 3px;
}

.admin-topbar .eyebrow {
  margin: 0;
  color: var(--taupe);
  font-size: 12px;
}

.admin-topbar strong {
  font-size: 18px;
}

.admin-topbar small {
  color: var(--muted);
}

.ghost {
  background: rgba(255, 253, 249, 0.92);
  color: var(--coffee);
  border: 1px solid var(--line);
  box-shadow: none;
}

.ghost.danger {
  color: #8f3f35;
  border-color: rgba(143, 63, 53, 0.28);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.tabs button {
  background: rgba(255, 253, 249, 0.92);
  color: var(--coffee);
  border: 1px solid var(--line);
  box-shadow: none;
}

.tabs button.active {
  background: var(--graphite);
  color: #fff;
  border-color: transparent;
}

.tab-page {
  display: none;
  padding-top: 22px;
}

.tab-page.active {
  display: block;
}

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

.stats article,
.item-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.96);
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.stats span,
.item-card span {
  color: var(--muted);
}

.stats strong {
  display: block;
  margin-top: 10px;
  font-size: 38px;
}

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

.inline-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
  gap: 10px;
}

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

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

.publish-form textarea {
  min-height: 180px;
}

.wide-field,
.publish-form .check-row,
.form-actions,
.doctor-fields {
  grid-column: 1 / -1;
}

.doctor-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blush-soft), var(--sage-soft));
}

.doctor-fields.hidden,
.preview-doctor.hidden,
.hidden {
  display: none;
}

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

.card-actions {
  display: grid;
  grid-template-columns: max-content minmax(220px, 1fr) max-content;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}

.card-actions button {
  min-height: 44px;
  white-space: nowrap;
}

.card-actions .transfer-select {
  min-height: 44px;
}

.customer-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 160px 160px;
  gap: 10px;
  width: min(720px, 100%);
}

.customer-line {
  display: grid;
  gap: 4px;
}

.customer-line strong {
  color: var(--ink);
}

.customer-advisor {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--sage);
  font-weight: 800;
}

.check-row {
  display: flex;
  grid-auto-flow: column;
  align-items: center;
  justify-content: start;
  gap: 8px;
  color: var(--muted);
}

.check-row input {
  width: auto;
}

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

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

.publish-preview {
  position: sticky;
  top: 18px;
}

.preview-phone {
  overflow: hidden;
  border: 8px solid #171715;
  border-radius: 34px;
  background: #f8f3ef;
  box-shadow: 0 24px 58px rgba(37, 31, 28, 0.18);
}

.preview-cover {
  height: 210px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--blush-soft), var(--sage-soft));
  background-position: center;
  background-size: cover;
  color: var(--taupe);
  font-size: 28px;
  font-weight: 800;
}

.preview-body {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.preview-body h3 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}

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

.preview-doctor {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blush-soft), var(--sage-soft));
}

.preview-doctor strong {
  color: var(--coffee);
}

.hairline {
  height: 1px;
  background: var(--line);
}

.item-card {
  display: grid;
  gap: 8px;
}

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

.badge {
  display: inline-flex;
  width: max-content;
  align-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--blush-soft), var(--sage-soft));
  color: #5e504a;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 800;
}

.danger {
  background: #9f5656;
}

.ghost {
  background: rgba(255, 253, 249, 0.92);
  color: var(--coffee);
  border: 1px solid var(--line);
  box-shadow: none;
}

@media (max-width: 860px) {
  .hero,
  .stats,
  .publish-layout,
  .publish-form,
  .doctor-fields,
  .customer-filters,
  .inline-form,
  .grid-list {
    grid-template-columns: 1fr;
  }

  .publish-preview {
    position: static;
  }

  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

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