:root {
  --cream: #f8f2ea;
  --cream-strong: #fffdf9;
  --rose: #d97b8d;
  --rose-dark: #a75b6c;
  --teal: #2d5d5b;
  --teal-soft: #7ca8a0;
  --ink: #233536;
  --border: rgba(35, 53, 54, 0.12);
  --shadow: 0 18px 45px rgba(35, 53, 54, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--cream) 0%, var(--cream-strong) 100%);
  line-height: 1.6;
}

body.auth-locked main {
  min-height: calc(100vh - 72px);
  display: grid;
  place-items: center;
}

body.auth-locked .hero {
  grid-template-columns: 1fr;
  width: min(100%, 560px);
  padding-top: 2.6rem;
  padding-bottom: 2.6rem;
}

body.auth-locked .hero-copy,
body.auth-locked #dashboardSection,
body.auth-locked .footer {
  display: none !important;
}

body.auth-locked .hero-card {
  max-width: 520px;
  margin: 0 auto;
}

@media (min-width: 901px) {
  html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  width: 100%;
  background: #a26737;
  border-bottom: 1px solid rgba(35, 53, 54, 0.08);
  padding-top: env(safe-area-inset-top, 0px);
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1.5rem 0.6rem;
  max-width: 1200px;
  margin: 0 auto;
}

.brand {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 0.35rem;
  font-weight: 800;
  color: var(--cream-strong);
  letter-spacing: 0.04em;
  text-align: center;
}

.brand-title {
  font-size: 1.1rem;
}

.brand-separator {
  color: rgba(255, 253, 249, 0.8);
  font-weight: 700;
}

.brand-subtitle {
  font-size: 0.9rem;
  color: rgba(255, 253, 249, 0.92);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 700px) {
  .brand {
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
  }

  .brand-separator {
    display: none;
  }

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

.topnav {
  display: flex;
  gap: 1rem;
  color: var(--ink);
  font-weight: 600;
  align-items: center;
}

.search-nav-button {
  width: 2.45rem;
  height: 2.45rem;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 0;
  line-height: 1;
}

.search-nav-button[hidden] {
  display: none !important;
}

.search-nav-button::before {
  content: "";
  display: block;
  width: 1.05rem;
  height: 1.05rem;
  transform: translateX(-2px);
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232d5d5b' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.4 15.4 21 21'/%3E%3C/svg%3E");
}

.settings-hero {
  display: flex;
  justify-content: center;
  padding: 1rem 0 0;
}

.settings-date-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.settings-actions {
  justify-content: flex-start;
}

.toggle-demo {
  border: 1px solid var(--border);
  background: white;
  color: var(--teal);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#logoutButton {
  color: var(--rose-dark);
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3.5rem;
  align-items: center;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--rose-dark);
  margin-bottom: 0.4rem;
}

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  margin: 0 0 0.7rem;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--teal);
}

.hero-text,
.section-heading p,
.feature-card p,
.panel p,
.footer p,
.hint,
.status-message,
.bookly-status {
  color: rgba(35, 53, 54, 0.8);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.1rem;
}

.bookly-status {
  margin: 0.75rem 0 0.9rem;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  background: rgba(45, 93, 91, 0.08);
  color: var(--teal);
  font-size: 0.95rem;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1.15rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  background: var(--rose);
  color: white;
  box-shadow: var(--shadow);
}

.button.secondary {
  background: white;
  color: var(--teal);
  border: 1px solid var(--border);
}

.button.full {
  width: 100%;
}

#openSetupButton {
  margin-top: 0.7rem;
}

.hero-points {
  list-style: none;
  padding: 0;
  margin: 1.2rem 0 0;
  display: grid;
  gap: 0.55rem;
}

.hero-points li::before {
  content: "•";
  color: var(--rose);
  margin-right: 0.5rem;
}

.hero-card,
.card-form,
.panel,
.feature-card {
  background: rgba(255, 253, 249, 0.95);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.card-form {
  padding: 1.4rem;
}

.card-form input,
.card-form textarea {
  width: 100%;
  padding: 0.8rem 0.95rem;
  margin: 0.45rem 0 0.95rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  background: white;
}

.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.35rem 1.5rem 0.9rem;
}

.section-heading {
  margin-bottom: 0.75rem;
}

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

.feature-card {
  padding: 1.2rem;
}

.dashboard-section {
  padding-top: 0.05rem;
  padding-bottom: 2rem;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 1rem;
}

.panel {
  padding: 1.2rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.45rem;
}

.planning-toolbar {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 0.85rem;
  min-width: max-content;
}

.planning-toggle {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.planning-toggle-button {
  border: 1px solid rgba(45, 93, 91, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: var(--teal);
  border-radius: 999px;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(35, 53, 54, 0.08);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.planning-toggle-button:hover {
  transform: translateY(-1px);
  border-color: rgba(217, 123, 141, 0.35);
  box-shadow: 0 12px 28px rgba(35, 53, 54, 0.12);
}

.planning-week-label {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
  color: rgba(35, 53, 54, 0.68);
  margin: 0 0 0.2rem;
  white-space: nowrap;
}

.planning-week-label strong {
  font-size: 1.08rem;
  line-height: 1.15;
  font-weight: 800;
  color: var(--teal);
}

.planning-week-label span {
  font-size: 0.92rem;
  line-height: 1.2;
  font-weight: 400;
}

.panel-header > div {
  display: grid;
  gap: 0.1rem;
}

.chip {
  background: rgba(45, 93, 91, 0.1);
  color: var(--teal);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

#appointmentCount {
  margin-top: 0.45rem;
}

.chip.accent {
  background: rgba(217, 123, 141, 0.16);
  color: var(--rose-dark);
}

.client-list {
  display: grid;
  gap: 0.7rem;
}

.client-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  background: var(--cream-strong);
  cursor: pointer;
  display: grid;
  gap: 0.3rem;
}

.client-card-topline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.client-date-pill {
  white-space: nowrap;
  border-radius: 999px;
  background: rgba(45, 93, 91, 0.08);
  color: var(--teal);
  padding: 0.2rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 700;
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: 16px;
  padding: 1rem;
  text-align: center;
  color: rgba(35, 53, 54, 0.65);
  background: rgba(255, 255, 255, 0.5);
}

.client-card.active {
  border-color: var(--rose);
  background: rgba(217, 123, 141, 0.1);
}

.client-card:hover {
  border-color: var(--rose);
}

.detail-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.medical-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1rem;
  background: rgba(248, 242, 234, 0.55);
}

.medical-card.is-collapsed {
  cursor: pointer;
  transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.medical-card.is-collapsed:hover {
  border-color: rgba(217, 123, 141, 0.55);
  background: rgba(248, 242, 234, 0.82);
  transform: translateY(-1px);
}

.client-contact {
  margin: 0 0 0.35rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  column-gap: clamp(1.5rem, 5vw, 4rem);
  align-items: start;
  color: rgba(35, 53, 54, 0.8);
  font-weight: 400;
  line-height: 1.3;
}

.client-contact-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#clientName {
  margin-bottom: 0;
}

.dossier-button {
  flex: 0 0 auto;
}

.dossier-button-icon {
  display: none;
}

@media (max-width: 560px) {
  .detail-panel > .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .dossier-button {
    width: 100%;
  }
}

.client-contact strong,
.client-contact span,
.client-contact a {
  font-weight: 400;
}

.client-contact a {
  color: var(--teal);
  text-decoration: none;
}

.medical-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
  gap: 0.55rem;
  min-height: 1rem;
  padding-top: 6px;
}

.medical-card-toggle {
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: inherit;
  text-align: left;
  line-height: 1;
}

.medical-card-toggle h4 {
  margin: 0;
  color: var(--teal);
  font-size: 1rem;
  font-weight: 700;
}

.medical-edit-button {
  border: 0;
  background: white;
  color: var(--teal);
  border-radius: 999px;
  width: 1.6rem;
  height: 1.6rem;
  cursor: pointer;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.medical-content {
  display: grid;
  gap: 0.8rem;
  padding-top: 0.35rem;
}

.medical-record {
  gap: 1rem;
}

.medical-record-section {
  display: grid;
  gap: 0.7rem;
  padding: 0.85rem;
  border: 1px solid rgba(45, 93, 91, 0.12);
  border-radius: 14px;
  background: rgba(255, 253, 249, 0.5);
}

.medical-record-section h5 {
  margin: 0;
  color: var(--rose-dark);
  font-size: 0.95rem;
}

.medical-overview-grid,
.medical-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.medical-field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.medical-field label {
  font-weight: 700;
  color: var(--teal);
}

.medical-field input,
.medical-field textarea,
.medical-field select {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  background: white;
}

.medical-field textarea {
  min-height: 80px;
  resize: vertical;
}

.medical-read-field {
  align-content: start;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(35, 53, 54, 0.08);
}

.medical-read-field .choice-value {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

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

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

.medical-form-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.medical-save-status {
  min-height: 1.25rem;
  margin: 0;
  color: var(--teal);
  font-size: 0.9rem;
}

.medical-save-status.is-error {
  color: var(--rose-dark);
}

.choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.choice-pill {
  border: 1px solid var(--border);
  background: white;
  color: var(--teal);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
}

.choice-pill.active {
  background: var(--rose);
  color: white;
  border-color: var(--rose);
}

.choice-value {
  color: var(--teal);
  font-weight: 400;
  line-height: 1.5;
}

.note-list {
  padding-left: 1rem;
  margin: 0 0 1rem;
}

.session-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1rem;
  margin-bottom: 0.9rem;
  background: rgba(248, 242, 234, 0.55);
}

.session-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.session-list {
  display: grid;
  gap: 0.6rem;
}

.session-item {
  border: 1px solid var(--border);
  border-left: 4px solid var(--rose);
  border-radius: 16px;
  background: white;
  display: grid;
  gap: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  overflow: hidden;
}

.session-item-trigger {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0.8rem 0.95rem;
  text-align: left;
  display: grid;
  gap: 0.25rem;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.session-item.is-expanded {
  border-color: rgba(217, 123, 141, 0.45);
}

.session-item-head {
  display: flex;
  gap: 0.8rem;
  align-items: baseline;
}

.session-item .session-photo {
  height: 88px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(217, 123, 141, 0.24), rgba(45, 93, 91, 0.16));
  border: 1px dashed rgba(45, 93, 91, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--teal);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.session-item:hover {
  border-color: var(--rose);
  transform: translateY(-1px);
}

.session-item-trigger:hover {
  background: rgba(248, 242, 234, 0.35);
}

.session-item strong {
  display: block;
  color: var(--teal);
}

.session-summary {
  color: rgba(35, 53, 54, 0.76);
}

.session-chevron {
  margin-left: auto;
  color: var(--rose-dark);
  font-weight: 700;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: transform 220ms ease;
}

.session-item-trigger[aria-expanded="true"] .session-chevron {
  transform: rotate(0deg);
}

.session-expand {
  border-top: 1px dashed var(--border);
  padding: 0.8rem 0.95rem 0.95rem;
  background: rgba(248, 242, 234, 0.45);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 280ms ease-in-out, opacity 220ms ease-in-out;
}

.session-expand .field-label {
  margin-top: 0.2rem;
}

.session-expand textarea {
  min-height: 84px;
  margin-bottom: 0.9rem;
}

.session-expand-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.25rem;
}

.session-tools-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.session-tools-header strong {
  color: var(--teal);
}

.session-tools-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  min-width: 0;
}

.session-note-list {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.session-note {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid rgba(45, 93, 91, 0.14);
  border-radius: 12px;
  background: transparent;
}

.session-note p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.session-note small {
  display: block;
  margin-top: 0.25rem;
  color: rgba(35, 53, 54, 0.58);
}

.session-note-delete {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(217, 123, 141, 0.12);
  color: var(--rose-dark);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.session-note-delete:hover {
  background: rgba(217, 123, 141, 0.24);
}

.session-note-empty,
.session-note-error {
  margin: 0;
  color: rgba(35, 53, 54, 0.62);
  font-size: 0.92rem;
}

.session-note-error {
  color: var(--rose-dark);
  margin-bottom: 0.65rem;
}

.session-note-input {
  width: 100%;
  resize: vertical;
}

@media (max-width: 560px) {
  .session-tools-header {
    align-items: stretch;
    flex-direction: column;
  }

  .session-tools-header .button {
    width: 100%;
  }
}

.photo-section {
  margin-top: 0.9rem;
  display: none;
  gap: 0.6rem;
}

.button.primary.full[form="noteForm"] {
  margin-top: 0.8rem;
}

.photo-box {
  border: 1px dashed var(--border);
  border-radius: 20px;
  padding: 1rem;
  min-height: 90px;
  color: rgba(35, 53, 54, 0.7);
  background: linear-gradient(135deg, rgba(248, 242, 234, 0.9), rgba(255, 253, 249, 0.95));
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.photo-box:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(217, 123, 141, 0.2);
}

.photo-pill {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--rose-dark);
  font-weight: 600;
}

.session-photo-thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
}

.session-photo-thumb-button {
  width: 64px;
  height: 64px;
  padding: 0;
  overflow: hidden;
  border: 2px solid white;
  border-radius: 10px;
  background: rgba(45, 93, 91, 0.08);
  box-shadow: 0 0 0 1px var(--border);
  cursor: zoom-in;
}

.session-photo-thumb-button:hover {
  box-shadow: 0 0 0 2px var(--rose);
}

.session-photo-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-gallery {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}

.photo-gallery-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.7rem 0.8rem;
  background: rgba(248, 242, 234, 0.55);
  display: grid;
  gap: 0.35rem;
}

.photo-gallery-image {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(45, 93, 91, 0.06);
}

.photo-gallery-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.session-photo-delete {
  border: 0;
  background: transparent;
  color: var(--rose-dark);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
}

.photo-status {
  min-height: 1.35rem;
  margin: 0.45rem 0 0;
  color: var(--rose-dark);
  font-size: 0.9rem;
}

.photo-viewer {
  padding: 1rem;
  background: rgba(17, 28, 29, 0.86);
}

.photo-viewer-card {
  position: relative;
  width: min(100%, 1100px);
  max-height: calc(100vh - 2rem);
  display: grid;
  place-items: center;
  gap: 0.65rem;
}

.photo-viewer-card img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 5rem);
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.35);
}

.photo-viewer-card p {
  margin: 0;
  color: white;
  text-align: center;
}

.photo-viewer-close {
  position: absolute;
  z-index: 2;
  top: 0.6rem;
  right: 0.6rem;
  background: white;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.24);
}

.photo-viewer-delete {
  position: absolute;
  z-index: 2;
  top: 0.6rem;
  right: 3.7rem;
  background: white;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.24);
  font-size: 1rem;
}

.photo-viewer-delete:disabled {
  cursor: wait;
  opacity: 0.6;
}

.photo-gallery-thumb {
  height: 90px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(217, 123, 141, 0.24), rgba(45, 93, 91, 0.16));
  border: 1px dashed rgba(45, 93, 91, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--teal);
  font-weight: 700;
  font-size: 0.9rem;
}

.field-label {
  display: block;
  margin-bottom: 0.45rem;
  font-weight: 700;
  color: var(--teal);
}

textarea {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  font: inherit;
  background: white;
  resize: vertical;
  min-height: 96px;
  box-shadow: inset 0 1px 2px rgba(35, 53, 54, 0.04);
}

.save-button {
  margin-top: 0.7rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(35, 53, 54, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.settings-modal {
  max-width: 1120px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
  min-height: 0;
  overflow: auto;
  padding-right: 0.2rem;
}

.settings-grid .feature-card:first-child {
  min-width: 0;
}

.modal-backdrop.is-hidden {
  display: none !important;
}

.modal-card {
  width: min(100%, 480px);
  background: white;
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 1.1rem;
}

.search-modal {
  max-height: min(680px, calc(100vh - 2rem));
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
}

.client-search-results {
  display: grid;
  gap: 0.55rem;
  overflow-y: auto;
  padding: 0.1rem;
}

.client-search-result {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem 0.85rem;
  background: var(--cream-strong);
  color: var(--ink);
  display: grid;
  gap: 0.15rem;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.client-search-result:hover {
  border-color: var(--rose);
  background: rgba(217, 123, 141, 0.08);
}

.client-search-result strong {
  color: var(--teal);
}

.client-search-result span,
.client-search-empty {
  color: rgba(35, 53, 54, 0.68);
  font-size: 0.92rem;
}

.client-search-empty {
  margin: 0.4rem 0;
}

.modal-card.settings-modal {
  width: min(94vw, 1120px);
  max-height: calc(100vh - 2rem);
  padding: 1rem;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
}

.settings-modal > .setup-notice {
  grid-row: 3;
}

.settings-modal > .settings-grid {
  grid-row: 4;
}

.settings-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.settings-tab {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 0.85rem;
  background: white;
  color: var(--teal);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.settings-tab.is-active {
  border-color: var(--rose);
  background: var(--rose);
  color: white;
}

.settings-tab-panel[hidden] {
  display: none !important;
}

.settings-modal .feature-card {
  padding: 1rem;
}

.settings-modal .feature-card > h3,
.settings-modal .feature-card > p {
  margin-top: 0;
  margin-bottom: 0.65rem;
}

.settings-modal .modal-input {
  padding: 0.58rem 0.7rem;
  margin-bottom: 0.55rem;
}

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

.settings-port-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.7fr) minmax(130px, 1fr);
  gap: 0.65rem;
}

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

#booklySettingsCard[hidden] + .security-settings-card {
  grid-column: 1 / -1;
}

.backup-settings-card {
  display: grid;
  gap: 0.9rem;
}

.backup-section {
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(248, 242, 234, 0.45);
}

.backup-section h4 {
  margin-bottom: 0.6rem;
  color: var(--teal);
}

.restore-section {
  border-color: rgba(217, 123, 141, 0.3);
}

.backup-warning {
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: rgba(217, 123, 141, 0.12);
  color: var(--rose-dark) !important;
  font-weight: 600;
}

.backup-confirm {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.25rem 0 0.8rem;
  color: var(--ink);
}

.backup-confirm input {
  margin-top: 0.3rem;
}

.backup-status {
  min-height: 1.4rem;
  margin: 0.55rem 0 0 !important;
  color: var(--teal) !important;
  font-size: 0.9rem;
}

.backup-status.is-error {
  color: var(--rose-dark) !important;
}

.logbook-settings-card {
  display: grid;
  gap: 0.75rem;
}

.logbook-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.logbook-header h3,
.logbook-header p {
  margin-top: 0;
}

.logbook-header p {
  margin-bottom: 0;
  color: rgba(35, 53, 54, 0.72);
}

.audit-log-list {
  display: grid;
  gap: 0.55rem;
}

.audit-log-entry {
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(248, 242, 234, 0.45);
}

.audit-log-entry-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
}

.audit-log-entry-main strong {
  color: var(--teal);
}

.audit-log-entry-main time {
  color: rgba(35, 53, 54, 0.62);
  font-size: 0.86rem;
  white-space: nowrap;
}

.audit-log-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.8rem;
  margin-top: 0.35rem;
  color: rgba(35, 53, 54, 0.68);
  font-size: 0.86rem;
}

.audit-log-empty {
  margin: 0;
  padding: 0.85rem;
  border-radius: 12px;
  background: rgba(248, 242, 234, 0.45);
  color: rgba(35, 53, 54, 0.68);
}

.setup-notice {
  margin: 0 0 0.7rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: #fff4d8;
  color: #725814;
  font-size: 0.9rem;
}

.setup-notice .field-label {
  margin-top: 0.4rem;
  margin-bottom: 0.2rem;
}

.setup-notice .modal-input {
  margin: 0;
  max-width: 420px;
  background: #fff;
}

.security-settings-card .bookly-status {
  display: inline-block;
  margin: 0.45rem 0.4rem 0.45rem 0;
  padding: 0.45rem 0.6rem;
  font-size: 0.86rem;
}

.modal-card.agenda-modal {
  width: min(96vw, 1160px);
  max-height: 92vh;
  padding: 1rem;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 0.5rem;
}

.agenda-help {
  margin: 0;
  color: rgba(35, 53, 54, 0.78);
  font-size: 0.95rem;
}

.agenda-fallback-actions {
  display: flex;
  justify-content: flex-start;
}

.agenda-frame-wrap {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  min-height: 70vh;
  background: #fff;
}

.agenda-frame-wrap iframe {
  width: 100%;
  height: 70vh;
  border: 0;
}

.modal-input {
  width: 100%;
  padding: 0.8rem 0.95rem;
  margin: 0 0 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  background: white;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.7rem;
}

.modal-close {
  border: 0;
  background: transparent;
  font-size: 1.35rem;
  cursor: pointer;
  color: var(--rose-dark);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
  margin-top: 0.8rem;
}

.note-form {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.note-form + .session-card {
  margin-top: 0.4rem;
}

.import-panel {
  margin-top: 0.15rem;
}

.import-results {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.import-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  background: var(--cream-strong);
}

.footer {
  width: 100%;
  margin: 0;
  padding: 1.45rem 1.5rem 1.3rem;
  text-align: center;
  background: #a26737;
  border-top: 0;
  color: #1d1713;
}

.footer p {
  margin: 0;
  color: #1d1713;
}

.footer-credit {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.96rem;
}

.footer-note {
  margin-top: 0.3rem !important;
  font-size: 0.76rem;
}

@media (max-width: 900px) {
  .hero,
  .dashboard-shell,
  .feature-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  body {
    background: #fff;
  }

  .topbar-inner {
    flex-direction: column;
    gap: 0.7rem;
    padding: 0.75rem 0.45rem;
  }

  .topnav {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0.4rem;
  }

  .toggle-demo {
    padding: 0.5rem 0.68rem;
    font-size: 0.88rem;
    white-space: nowrap;
  }

  .search-nav-button {
    width: 2.35rem;
    min-width: 2.35rem;
    height: 2.35rem;
    padding: 0;
  }

  .hero {
    padding-top: 1rem;
  }

  .section.dashboard-section {
    width: 100%;
    max-width: none;
    padding: 0.25rem 0.35rem 1rem;
  }

  .dashboard-section > .section-heading {
    display: none;
  }

  .dashboard-shell {
    gap: 0.55rem;
  }

  .planning-week-label span {
    font-size: 0.82rem;
  }

  .dashboard-shell > .panel {
    padding: 0.75rem;
    border-radius: 17px;
    box-shadow: 0 8px 24px rgba(35, 53, 54, 0.08);
  }

  .detail-panel {
    position: relative;
  }

  .detail-panel > .panel-header {
    min-height: 2.75rem;
    padding-right: 3rem;
    align-items: center;
    flex-direction: row;
  }

  .dossier-button {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    width: 2.55rem;
    height: 2.55rem;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
  }

  .dossier-button-label {
    display: none;
  }

  .dossier-button-icon {
    display: inline;
    font-size: 1.05rem;
    line-height: 1;
  }

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

  .medical-overview-grid,
  .medical-form-grid,
  .complaints-overview,
  .complaints-form-grid {
    grid-template-columns: 1fr;
  }

  .medical-record-section {
    padding: 0.7rem;
  }

  .client-contact {
    grid-template-columns: 1fr;
    row-gap: 0.35rem;
  }

  .modal-card.agenda-modal {
    width: 100%;
    max-height: 95vh;
  }

  .settings-field-grid {
    grid-template-columns: 1fr;
  }

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

  .logbook-header,
  .audit-log-entry-main {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.45rem;
  }

  .audit-log-entry-main time {
    white-space: normal;
  }

  .agenda-frame-wrap,
  .agenda-frame-wrap iframe {
    min-height: 74vh;
    height: 74vh;
  }
}
