:root {
  color-scheme: light;
  --bg: #f6f1ec;
  --panel: #1f2a26;
  --panel-soft: #2b3933;
  --card: #fffdfb;
  --ink: #1d2421;
  --muted: #6d746f;
  --line: #e5ddd6;
  --accent: #b58d72;
  --accent-dark: #8c6954;
  --success: #2f6b4f;
  --danger: #9a3d3d;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.hidden { display: none !important; }

.loading-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1rem;
  color: var(--muted);
}
.loading-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--panel);
  color: white;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.8rem;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(420px, 1.1fr);
}

.brand-panel {
  background: linear-gradient(145deg, var(--panel), var(--panel-soft));
  color: #f7f1ec;
  padding: clamp(2rem, 5vw, 5rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 3rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
}

.brand-panel h1,
.card h2,
.dashboard h1,
.dashboard h2 {
  font-family: "Playfair Display", Georgia, serif;
  margin: 0;
}

.brand-panel h1 {
  font-size: clamp(2.5rem, 5vw, 4.8rem);
  line-height: 0.98;
  max-width: 10ch;
}

.intro {
  max-width: 36rem;
  color: #d8ddd9;
  line-height: 1.7;
  font-size: 1.05rem;
}

.trust-card {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  max-width: 32rem;
}
.trust-card p { margin: 0; line-height: 1.5; color: #e8ece9; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #9fc4ad; margin-top: .4rem; flex: 0 0 auto; }

.form-panel { display: grid; place-items: center; padding: 2rem; }
.card {
  width: min(100%, 640px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  box-shadow: 0 24px 70px rgba(59, 43, 34, 0.10);
  padding: clamp(1.5rem, 4vw, 3rem);
}
.card-head { margin-bottom: 1.5rem; }
.card h2 { font-size: clamp(2rem, 4vw, 3rem); color: var(--ink); }
.card-head > p:last-child { margin: .6rem 0 0; color: var(--muted); }
form { display: grid; gap: 1rem; }
label { display: grid; gap: .45rem; font-size: .92rem; font-weight: 600; }
.optional { color: var(--muted); font-weight: 400; }
input {
  width: 100%; border: 1px solid var(--line); border-radius: .8rem; background: white;
  color: var(--ink); padding: .9rem 1rem; font: inherit; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(181,141,114,.13); }
button {
  border: 0; border-radius: .9rem; padding: 1rem 1.1rem; font: inherit; font-weight: 700;
  cursor: pointer; color: white; background: var(--accent-dark); transition: transform .1s ease, opacity .15s ease;
}
button:hover { transform: translateY(-1px); }
button:disabled { opacity: .6; cursor: wait; transform: none; }
button.secondary { background: #e9e0d8; color: var(--ink); }
.message { min-height: 1.25rem; font-size: .9rem; line-height: 1.45; color: var(--muted); }
.message.success { color: var(--success); }
.message.error { color: var(--danger); }
.divider { display: flex; align-items: center; gap: 1rem; margin: 1.8rem 0; color: var(--muted); font-size: .82rem; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }

.dashboard {
  min-height: 100vh;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .65rem .2rem 1.25rem;
}
.topbar h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); }
.ghost-button {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: .8rem 1rem;
  box-shadow: 0 8px 25px rgba(59,43,34,.05);
}
.welcome-card {
  background: linear-gradient(135deg, var(--panel), var(--panel-soft));
  color: white;
  border-radius: 1.6rem;
  padding: clamp(1.5rem, 4vw, 2.8rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 20px 55px rgba(31,42,38,.16);
}
.welcome-card h2 { font-size: clamp(2rem, 5vw, 3.4rem); }
.welcome-card p:last-child { color: #d9dfdc; margin: .65rem 0 0; }
.role-pill {
  padding: .65rem .95rem;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  text-transform: capitalize;
  font-weight: 700;
  white-space: nowrap;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1rem 0 2rem;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  padding: 1.25rem;
  box-shadow: 0 12px 35px rgba(59,43,34,.05);
}
.stat-card span { color: var(--muted); font-weight: 600; }
.stat-card strong { display: block; font-family: "Playfair Display", Georgia, serif; font-size: 2.4rem; margin: .35rem 0; }
.stat-card small { color: var(--muted); }
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.5rem .15rem 1rem;
}
.section-head h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.section-head > p { margin: 0; color: var(--muted); max-width: 30rem; text-align: right; }
.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.tool-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  padding: 1.15rem;
}
.tool-card.active-card { border-color: #d3b49f; box-shadow: 0 10px 30px rgba(181,141,114,.09); }
.tool-icon {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: #eee4dc; color: var(--accent-dark); font-family: "Playfair Display", Georgia, serif; font-size: 1.15rem;
}
.tool-card h3 { margin: 0 0 .2rem; font-size: 1rem; }
.tool-card p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.4; }
.status-chip { border-radius: 999px; padding: .4rem .65rem; background: #e7f0ea; color: var(--success); font-size: .75rem; font-weight: 700; }
.muted-chip { background: #eeeae6; color: var(--muted); }
.dashboard-message { margin-top: 1rem; }

@media (max-width: 850px) {
  .shell { grid-template-columns: 1fr; }
  .brand-panel { min-height: auto; padding: 2rem; }
  .brand-panel h1 { max-width: 14ch; font-size: clamp(2.2rem, 10vw, 3.6rem); }
  .trust-card { display: none; }
  .form-panel { padding: 1rem; }
  .card { border-radius: 1.1rem; padding: 1.35rem; }
  .dashboard { width: min(100% - 1rem, 1180px); padding-top: .5rem; }
  .welcome-card { align-items: flex-start; flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr 1fr 1fr; gap: .55rem; }
  .stat-card { padding: .9rem; }
  .stat-card strong { font-size: 2rem; }
  .stat-card small { display: none; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .section-head > p { text-align: left; }
  .tool-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .topbar h1 { font-size: 1.5rem; }
  .ghost-button { padding: .65rem .8rem; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .stat-card strong { grid-row: 1 / 3; grid-column: 2; margin: 0; }
  .tool-card { grid-template-columns: auto 1fr; }
  .status-chip { grid-column: 2; width: max-content; }
}

/* Clients */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tool-button {
  width: 100%;
  color: var(--ink);
  text-align: left;
  font-weight: inherit;
  cursor: pointer;
}
.tool-button:hover { transform: translateY(-1px); }

.topbar-left {
  display: flex;
  align-items: center;
  gap: .85rem;
}
.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 1.35rem;
  box-shadow: 0 8px 22px rgba(59,43,34,.05);
}

.client-hero {
  background: linear-gradient(135deg, var(--panel), var(--panel-soft));
  color: white;
  border-radius: 1.6rem;
  padding: clamp(1.4rem, 4vw, 2.5rem);
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: center;
  box-shadow: 0 20px 55px rgba(31,42,38,.16);
}
.client-hero h2 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  margin: 0;
}
.client-hero p:last-child {
  max-width: 44rem;
  margin: .65rem 0 0;
  color: #d9dfdc;
  line-height: 1.55;
}
.client-total {
  min-width: 110px;
  display: grid;
  place-items: center;
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14);
}
.client-total strong {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 2.5rem;
  line-height: 1;
}
.client-total span { margin-top: .3rem; color: #d9dfdc; font-size: .82rem; }

.client-controls {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
}
.search-field { flex: 1; }
.search-field input { background: var(--card); }

.client-form-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  box-shadow: 0 18px 50px rgba(59,43,34,.08);
  padding: clamp(1.2rem, 3vw, 2rem);
  margin: 1rem 0;
}
.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.3rem;
}
.panel-head h2 {
  font-family: "Playfair Display", Georgia, serif;
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
}
.form-grid {
  display: grid;
  gap: 1rem;
}
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.full-span { grid-column: 1 / -1; }
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: white;
  color: var(--ink);
  padding: .9rem 1rem;
  font: inherit;
  resize: vertical;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(181,141,114,.13); }
.subsection-title {
  margin: 1.6rem 0 .9rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.subsection-title h3 { margin: 0 0 .25rem; }
.subsection-title p { margin: 0; color: var(--muted); font-size: .88rem; }
.check-row {
  margin-top: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: .8rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: #faf6f2;
  cursor: pointer;
}
.check-row input {
  width: 18px;
  height: 18px;
  margin-top: .1rem;
  flex: 0 0 auto;
  accent-color: var(--accent-dark);
}
.check-row span { display: grid; gap: .2rem; }
.check-row small { color: var(--muted); font-weight: 400; line-height: 1.35; }
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  margin-top: 1.25rem;
}
.form-actions button { min-width: 130px; }

.clients-list-section { margin-top: 1rem; }
.clients-list { display: grid; gap: .7rem; }
.client-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  text-align: left;
  box-shadow: 0 8px 24px rgba(59,43,34,.035);
}
.client-row:hover {
  transform: translateY(-1px);
  border-color: #d3b49f;
  box-shadow: 0 12px 30px rgba(181,141,114,.08);
}
.client-avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #eee4dc;
  color: var(--accent-dark);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1rem;
}
.client-main { min-width: 0; display: grid; gap: .25rem; }
.client-main strong { font-size: 1rem; overflow-wrap: anywhere; }
.client-main small { color: var(--muted); font-weight: 400; overflow-wrap: anywhere; }
.client-meta { display: grid; justify-items: end; gap: .35rem; }
.client-meta small { color: var(--muted); font-weight: 400; }
.open-label { color: var(--accent-dark); font-size: .8rem; font-weight: 700; }
.list-state,
.empty-state {
  background: var(--card);
  border: 1px dashed #d7ccc4;
  border-radius: 1.2rem;
  padding: 2.2rem 1.25rem;
  text-align: center;
  color: var(--muted);
}
.empty-state h3 { color: var(--ink); margin: .7rem 0 .35rem; }
.empty-state p { margin: 0 auto 1.1rem; max-width: 28rem; }
.empty-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  border-radius: 16px;
  background: #eee4dc;
  color: var(--accent-dark);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.25rem;
}
.compact-empty { padding: 1.5rem 1rem; }
.compact-empty h3 { margin-top: 0; }

@media (max-width: 700px) {
  .clients-topbar { align-items: flex-start; }
  .clients-topbar > button { padding: .75rem .8rem; }
  .client-hero { align-items: flex-start; }
  .client-total { min-width: 82px; }
  .client-total strong { font-size: 2rem; }
  .two-col { grid-template-columns: 1fr; }
  .client-row { grid-template-columns: auto 1fr; }
  .client-meta { grid-column: 2; justify-items: start; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions button { width: 100%; }
}

@media (max-width: 480px) {
  .client-hero { flex-direction: column; }
  .client-total { width: 100%; grid-template-columns: auto auto; justify-content: center; gap: .5rem; }
  .client-total span { margin: 0; }
  .clients-topbar { gap: .65rem; }
  .topbar-left { min-width: 0; }
  .topbar-left h1 { overflow-wrap: anywhere; }
}

/* Client clinical profile */
.profile-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.1rem;
  align-items: center;
  background: linear-gradient(135deg, var(--panel), var(--panel-soft));
  color: white;
  border-radius: 1.6rem;
  padding: clamp(1.25rem, 4vw, 2.2rem);
  box-shadow: 0 20px 55px rgba(31,42,38,.16);
}
.profile-avatar {
  width: 68px; height: 68px; border-radius: 20px; display: grid; place-items: center;
  background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.17);
  font: 600 1.35rem "Playfair Display", Georgia, serif;
}
.profile-identity h2 { margin: .05rem 0 .3rem; font: 600 clamp(1.9rem,4vw,2.8rem) "Playfair Display", Georgia, serif; }
.profile-contact { color: #d9dfdc; font-size: .9rem; overflow-wrap: anywhere; }
.profile-badge { padding: .55rem .8rem; border-radius: 999px; background: rgba(255,255,255,.11); border: 1px solid rgba(255,255,255,.15); font-size: .78rem; font-weight: 700; }
.profile-tabs {
  margin: 1rem 0;
  display: flex; gap: .45rem; overflow-x: auto; padding: .15rem .05rem .4rem;
  scrollbar-width: thin;
}
.profile-tab {
  flex: 0 0 auto; min-width: auto; width: auto; padding: .7rem .9rem; border-radius: 999px;
  background: var(--card); color: var(--muted); border: 1px solid var(--line); box-shadow: none;
}
.profile-tab:hover { transform: none; border-color: #d3b49f; }
.profile-tab.active { background: var(--panel); color: white; border-color: var(--panel); }
.profile-panel { background: var(--card); border: 1px solid var(--line); border-radius: 1.3rem; padding: clamp(1rem,3vw,1.7rem); box-shadow: 0 12px 35px rgba(59,43,34,.045); }
.profile-info-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .75rem; }
.info-card { border: 1px solid var(--line); border-radius: 1rem; padding: 1rem; min-width: 0; }
.info-card span { display: block; color: var(--muted); font-size: .75rem; margin-bottom: .35rem; }
.info-card strong { display: block; overflow-wrap: anywhere; font-size: .92rem; }
.profile-detail-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .8rem; margin-top: .8rem; }
.record-card { border: 1px solid var(--line); border-radius: 1rem; padding: 1rem; background: #fffdfb; }
.record-copy { margin: .45rem 0 0; color: var(--ink); white-space: pre-line; line-height: 1.5; }
.record-list { display: grid; gap: .7rem; }
.record-row { display: grid; grid-template-columns: 1fr auto; gap: .8rem; align-items: center; padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; background: #fffdfb; }
.record-row h3 { margin: 0 0 .28rem; font-size: 1rem; }
.record-row p { margin: 0; color: var(--muted); font-size: .83rem; line-height: 1.45; }
.record-side { text-align: right; display: grid; gap: .35rem; justify-items: end; }
.record-status { display: inline-flex; padding: .28rem .55rem; border-radius: 999px; background: #f0ebe6; color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: capitalize; }
.record-status.good { background: #e6f2eb; color: #38684b; }
.record-status.warn { background: #fff2df; color: #94611e; }
.clinical-form select {
  width: 100%; border: 1px solid var(--line); border-radius: .8rem; background: white; color: var(--ink); padding: .9rem 1rem; font: inherit; outline: none;
}
.clinical-form select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(181,141,114,.13); }
.clinical-meta { margin-top: 1rem; color: var(--muted); font-size: .8rem; }
.photo-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .8rem; }
.photo-card { overflow: hidden; border: 1px solid var(--line); border-radius: 1rem; background: #fffdfb; }
.photo-card img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #eee8e2; }
.photo-card .photo-meta { padding: .8rem; }
.photo-card h3 { margin: 0 0 .22rem; font-size: .9rem; text-transform: capitalize; }
.photo-card p { margin: 0; color: var(--muted); font-size: .78rem; }
@media (max-width: 800px) {
  .profile-info-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .photo-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 560px) {
  .profile-hero { grid-template-columns: auto 1fr; }
  .profile-badge { grid-column: 1 / -1; justify-self: start; }
  .profile-info-grid, .profile-detail-grid { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: 1fr; }
  .record-row { grid-template-columns: 1fr; }
  .record-side { text-align: left; justify-items: start; }
}

/* Consultation workflow */
.consultation-head { align-items: center; }
.panel-actions { display: flex; gap: .55rem; flex-wrap: wrap; justify-content: flex-end; }
.panel-actions button { width: auto; min-width: 0; padding: .72rem .9rem; }
.consultation-editor {
  margin: 0 0 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: #fffaf6;
}
.compact-head { margin-bottom: 1rem; align-items: center; }
.compact-head h3 { margin: 0; font: 600 1.35rem "Playfair Display", Georgia, serif; }
.field-help { margin: -.25rem 0 .4rem; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.consultation-fields { display: grid; gap: .9rem; }
.consultation-question { padding: .9rem; border: 1px solid var(--line); border-radius: .9rem; background: white; }
.consultation-question label { margin: 0; }
.consultation-question select { width: 100%; border: 1px solid var(--line); border-radius: .8rem; padding: .85rem 1rem; background: white; font: inherit; }
.lock-banner { display: grid; gap: .15rem; margin-bottom: 1rem; padding: .85rem 1rem; border-radius: .9rem; background: #e8f2ec; color: #2f6046; border: 1px solid #cfe1d6; }
.lock-banner span { font-size: .8rem; line-height: 1.45; }
.signature-section { margin-top: 1.1rem; border-top: 1px solid var(--line); padding-top: .1rem; }
.signature-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .8rem; }
.signature-card { border: 1px solid var(--line); background: white; border-radius: 1rem; padding: .9rem; min-width: 0; }
.signature-card-head { display: flex; justify-content: space-between; gap: .6rem; margin-bottom: .65rem; }
.signature-card-head div { display: grid; gap: .15rem; }
.signature-card-head small { color: var(--muted); font-size: .75rem; }
.signature-canvas { display: block; width: 100%; height: 170px; border: 1px dashed #ccbbae; border-radius: .8rem; background: #fffdfb; touch-action: none; }
.signature-actions { display: flex; gap: .55rem; justify-content: flex-end; margin-top: .65rem; }
.small-button { width: auto; min-width: 0; padding: .65rem .75rem; border-radius: .7rem; font-size: .8rem; }
.signature-preview { display: block; width: 100%; height: 170px; object-fit: contain; border: 1px solid var(--line); border-radius: .8rem; background: #fffdfb; }
.record-button { width: 100%; text-align: left; color: var(--ink); background: transparent; padding: 0; border-radius: 0; }
.record-button:hover { transform: none; }
.record-row.clickable { cursor: pointer; transition: border-color .15s ease, transform .1s ease; }
.record-row.clickable:hover { border-color: #d3b49f; transform: translateY(-1px); }
@media (max-width: 760px) {
  .consultation-head { align-items: flex-start; }
  .panel-actions { width: 100%; justify-content: stretch; }
  .panel-actions button { flex: 1; }
  .signature-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .panel-actions { display: grid; grid-template-columns: 1fr; }
  .signature-actions { display: grid; grid-template-columns: 1fr; }
  .signature-actions button { width: 100%; }
}
.consultation-record-button { width: 100%; color: var(--ink); text-align: left; }


/* Treatment workflow */
.treatment-subsection { margin-top: 1rem; }
.product-grid { grid-template-columns: 2fr .75fr .8fr 1.4fr; }
.treatment-finish-actions { display: flex; gap: .7rem; justify-content: flex-end; flex-wrap: wrap; }
.treatment-finish-actions button { width: auto; min-width: 150px; }
.treatment-product-remove { color: var(--danger); background: #fff; border: 1px solid #e5caca; }
.treatment-product-remove:hover { background: #fff7f7; transform: none; }
.catalog-expired { color: var(--danger) !important; font-weight: 700; }
.locked-control { opacity: .7; }
@media (max-width: 900px) { .product-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 560px) {
  .product-grid { grid-template-columns: 1fr; }
  .treatment-finish-actions { display: grid; grid-template-columns: 1fr; }
  .treatment-finish-actions button { width: 100%; }
}

/* Secure clinical photo workflow */
.panel-copy { margin: .35rem 0 0; color: var(--muted); font-size: .88rem; line-height: 1.45; max-width: 44rem; }
.photo-upload-panel {
  margin: 0 0 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: #fffaf6;
}
.photo-upload-title { margin-top: 0; padding-top: 0; border-top: 0; }
.photo-upload-layout {
  display: grid;
  grid-template-columns: minmax(190px, .8fr) minmax(0, 1.5fr);
  gap: 1rem;
  align-items: start;
}
.photo-preview-wrap {
  min-height: 220px;
  border: 1px dashed #d7ccc4;
  border-radius: 1rem;
  overflow: hidden;
  background: #f6f0eb;
  display: grid;
  place-items: center;
}
.photo-preview-empty { color: var(--muted); font-size: .82rem; }
.photo-preview { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.field-help { display: block; margin-top: .35rem; color: var(--muted); font-size: .74rem; font-weight: 400; line-height: 1.35; }
.photo-card { position: relative; }
.photo-card-link { display: block; color: inherit; text-decoration: none; }
.photo-card-link:focus-visible { outline: 3px solid rgba(181,141,114,.35); outline-offset: -3px; }
.photo-meta-top { display: flex; justify-content: space-between; gap: .55rem; align-items: start; }
.photo-meta h3 { margin-right: .4rem; }
.photo-treatment-name { margin-top: .28rem !important; }
.photo-actions { display: flex; gap: .45rem; margin-top: .65rem; }
.photo-actions button, .photo-actions a {
  width: auto;
  min-width: 0;
  padding: .5rem .65rem;
  border-radius: .7rem;
  font-size: .74rem;
}
.photo-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}
.photo-actions button { background: #f7f2ee; color: var(--muted); box-shadow: none; border: 1px solid var(--line); }
.photo-actions button:hover { transform: none; border-color: #d3b49f; color: var(--ink); }
.photo-upload-progress { margin-top: .55rem; color: var(--muted); font-size: .78rem; }

@media (max-width: 700px) {
  .photo-upload-layout { grid-template-columns: 1fr; }
  .photo-preview-wrap { min-height: 180px; }
}

/* Appointment diary workflow */
.appointment-hero { align-items: center; }
.appointment-controls { display: grid; grid-template-columns: minmax(0,1fr) minmax(160px,220px); gap: .7rem; }
.appointment-controls select {
  width: 100%; border: 1px solid var(--line); border-radius: .85rem; background: white; color: var(--ink); padding: .85rem 1rem; font: inherit; outline: none;
}
.appointment-controls select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(181,141,114,.13); }
.compact-check { margin: 0; align-self: end; min-height: 52px; }
.appointment-status-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .65rem; margin-top: .75rem; }
.appointment-status-actions button { width: auto; min-width: 150px; }
.danger-button { background: #fff5f5; color: var(--danger); border: 1px solid #e8caca; box-shadow: none; }
.danger-button:hover { background: #fff0f0; transform: none; }
.appointment-cancellation { margin-top: .8rem; background: #fff9f3; }
.appointment-group-title {
  display: flex; justify-content: space-between; align-items: center; gap: .7rem; padding: .45rem .15rem .15rem; color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
}
.appointment-group-title strong { min-width: 1.7rem; height: 1.7rem; display: inline-grid; place-items: center; border-radius: 999px; background: #eee8e2; color: var(--ink); font-size: .72rem; }
.history-title { margin-top: .6rem; }
.appointment-row .record-button { display: grid; grid-template-columns: 1fr auto; gap: .8rem; align-items: center; }
.appointment-row .record-button > div:first-child { min-width: 0; }
@media (max-width: 700px) {
  .appointment-controls { grid-template-columns: 1fr; }
  .appointment-status-actions { display: grid; grid-template-columns: 1fr; }
  .appointment-status-actions button { width: 100%; }
}
@media (max-width: 560px) {
  .appointment-row .record-button { grid-template-columns: 1fr; }
}

/* Staff & clinic settings */
.staff-join-box {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #faf6f2;
  overflow: hidden;
}
.staff-join-box summary {
  cursor: pointer;
  padding: .9rem 1rem;
  font-weight: 700;
  color: var(--ink);
  list-style-position: inside;
}
.staff-join-box[open] summary { border-bottom: 1px solid var(--line); }
.staff-join-copy { padding: .8rem 1rem 0; }
.staff-join-copy p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.5; }
.staff-join-box form { padding: 1rem; }
.settings-hero { align-items: center; }
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.3fr);
  gap: 1rem;
  align-items: start;
}
.settings-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  padding: 1.15rem;
  box-shadow: 0 12px 35px rgba(59,43,34,.05);
}
.settings-card textarea,
.settings-card select,
#staff-invite-panel select,
.staff-role-select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: white;
  color: var(--ink);
  padding: .9rem 1rem;
  font: inherit;
  outline: none;
}
.settings-card textarea:focus,
.settings-card select:focus,
#staff-invite-panel select:focus,
.staff-role-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(181,141,114,.13);
}
.role-guide {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: .55rem;
  margin-bottom: .9rem;
}
.role-guide span {
  padding: .65rem .75rem;
  border-radius: .8rem;
  background: #f6f0eb;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.35;
}
.role-guide strong { color: var(--ink); }
.staff-list { display: grid; gap: .7rem; }
.staff-row {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  gap: .85rem;
  align-items: center;
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #fffdfb;
}
.staff-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #eee4dc;
  color: var(--accent-dark);
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 700;
}
.staff-main { min-width: 0; }
.staff-name-line { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.staff-name-line h3 { margin: 0; font-size: .95rem; }
.staff-name-line h3 small { color: var(--muted); font-size: .72rem; font-weight: 600; }
.staff-main > p { margin: .2rem 0 .55rem; color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }
.staff-role-control { width: min(100%, 210px); }
.staff-role-select { padding: .55rem .65rem; font-size: .78rem; }
.staff-role-text { display: inline-flex; padding: .35rem .55rem; border-radius: .65rem; background: #f3eee9; color: var(--ink); font-size: .76rem; font-weight: 700; }
.staff-row-actions { display: flex; justify-content: flex-end; }
.staff-row-actions .small-button { white-space: nowrap; }
.record-status.muted { background: #eeeae6; color: var(--muted); }
.compact-empty { padding: 1.2rem; }

@media (max-width: 900px) {
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .role-guide { grid-template-columns: 1fr; }
  .staff-row { grid-template-columns: auto 1fr; align-items: start; }
  .staff-row-actions { grid-column: 1 / -1; justify-content: stretch; }
  .staff-row-actions button { width: 100%; }
  .staff-role-control { width: 100%; }
}

/* Aftercare & communications */
.recipient-card {
  display: grid;
  gap: .28rem;
  align-content: center;
  min-height: 74px;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: #fffdfb;
}
.recipient-card span { color: var(--muted); font-size: .75rem; }
.recipient-card strong { overflow-wrap: anywhere; font-size: .9rem; }
.aftercare-template-list-title,
.comms-history-title { margin-top: 1rem; }
.comms-row { align-items: start; }
.message-body {
  margin-top: .55rem !important;
  color: var(--ink) !important;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.comms-actions { align-items: center; }
.comms-actions button { width: auto; }
@media (max-width: 700px) {
  .comms-actions { flex-direction: column-reverse; }
  .comms-actions button { width: 100%; }
}

/* Dashboard quick-access routing */
.client-destination-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid #d3b49f;
  border-radius: 1rem;
  background: #fbf5f0;
}
.client-destination-banner .eyebrow { margin-bottom: .2rem; }
.client-destination-banner strong { display: block; font-size: 1rem; color: var(--ink); }
.client-destination-banner p:last-child { margin: .25rem 0 0; color: var(--muted); font-size: .9rem; line-height: 1.4; }
.compact-button { width: auto; min-width: 0; padding: .7rem .9rem; white-space: nowrap; }

@media (max-width: 620px) {
  .client-destination-banner { align-items: flex-start; flex-direction: column; }
  .compact-button { width: 100%; }
}

/* Client alerts + unified timeline */
.client-alert-center {
  margin: 0 0 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #fffdfb;
  box-shadow: 0 10px 30px rgba(74, 49, 36, .05);
}
.alert-center-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: .75rem;
}
.alert-center-head h2 { margin: .08rem 0 0; font-size: 1.25rem; }
.alert-summary { display: grid; gap: .55rem; }
.client-alert {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: .7rem;
  align-items: center;
  padding: .72rem .8rem;
  border: 1px solid var(--line);
  border-radius: .85rem;
  background: #fff;
}
.client-alert-critical { border-color: #d9aaa4; background: #fff7f6; }
.client-alert-warning { border-color: #ddc39e; background: #fffaf1; }
.client-alert-info { border-color: #c6d4d0; background: #f8fbfa; }
.client-alert-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 800;
  background: #f2ebe6;
}
.client-alert-critical .client-alert-icon { background: #f4dcd8; color: #7d2922; }
.client-alert-warning .client-alert-icon { background: #f3e5c9; color: #6a4a13; }
.client-alert-info .client-alert-icon { background: #dfe9e6; color: #31544b; }
.client-alert-main { min-width: 0; }
.client-alert-main strong { display: block; font-size: .9rem; line-height: 1.4; overflow-wrap: anywhere; }
.client-alert-meta { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .2rem; color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; }
.alert-severity { font-weight: 800; color: var(--ink); }
.alert-resolve-button {
  width: auto;
  min-width: 0;
  padding: .55rem .7rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: .74rem;
}
.alert-empty { color: var(--muted); font-size: .84rem; padding: .4rem .1rem; }
.alert-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .8rem;
  margin-top: .9rem;
  padding-top: .9rem;
  border-top: 1px solid var(--line);
}
.alert-form .full-span { grid-column: 1 / -1; }

.timeline-head { align-items: flex-start; gap: 1rem; }
.timeline-tools { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; justify-content: flex-end; }
.timeline-tools select { width: auto; min-width: 150px; padding: .65rem .75rem; }
.timeline-list { position: relative; display: grid; gap: 0; margin-top: .35rem; }
.timeline-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: .7rem;
  position: relative;
  padding-bottom: .85rem;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 20px;
  bottom: -2px;
  width: 1px;
  background: var(--line);
}
.timeline-item:last-child::before { display: none; }
.timeline-marker {
  width: 12px;
  height: 12px;
  margin: .75rem auto 0;
  border: 3px solid #fffdfb;
  border-radius: 50%;
  background: #b88265;
  box-shadow: 0 0 0 1px #b88265;
  z-index: 1;
}
.timeline-appointment .timeline-marker { background: #6f8b82; box-shadow: 0 0 0 1px #6f8b82; }
.timeline-consultation .timeline-marker { background: #9879a5; box-shadow: 0 0 0 1px #9879a5; }
.timeline-treatment .timeline-marker { background: #9f705a; box-shadow: 0 0 0 1px #9f705a; }
.timeline-photo .timeline-marker { background: #7589a3; box-shadow: 0 0 0 1px #7589a3; }
.timeline-medical .timeline-marker, .timeline-alert .timeline-marker { background: #b06d63; box-shadow: 0 0 0 1px #b06d63; }
.timeline-card {
  padding: .75rem .85rem;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: #fffdfb;
}
.timeline-card h3 { margin: .18rem 0 .2rem; font-size: .92rem; }
.timeline-card p { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.timeline-meta { display: flex; justify-content: space-between; align-items: baseline; gap: .7rem; color: var(--muted); font-size: .68rem; }
.timeline-type { font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-dark); }
.timeline-meta time { text-align: right; }

@media (max-width: 620px) {
  .alert-center-head { align-items: flex-start; flex-direction: column; }
  .alert-center-head .compact-button { width: 100%; }
  .client-alert { grid-template-columns: 30px 1fr; align-items: start; }
  .alert-resolve-button { grid-column: 2; width: 100%; }
  .alert-form { grid-template-columns: 1fr; }
  .alert-form .full-span { grid-column: auto; }
  .timeline-head { flex-direction: column; }
  .timeline-tools { width: 100%; justify-content: stretch; }
  .timeline-tools select { flex: 1; min-width: 0; }
}

/* Enhanced appointment diary */
.appointment-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .8rem;
  margin: 1rem 0;
}
.appointment-stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  padding: 1rem;
  display: grid;
  gap: .15rem;
  box-shadow: 0 10px 30px rgba(59, 43, 34, .04);
}
.appointment-stat span { color: var(--muted); font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.appointment-stat strong { font-family: "Playfair Display", Georgia, serif; font-size: 2rem; line-height: 1; margin-top: .2rem; }
.appointment-stat small { color: var(--muted); font-size: .76rem; }

.appointment-diary-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .9rem;
  margin: 1rem 0 .8rem;
  flex-wrap: wrap;
}
.appointment-view-tabs {
  display: flex;
  gap: .35rem;
  padding: .3rem;
  border-radius: 1rem;
  background: #ece5df;
  overflow-x: auto;
  max-width: 100%;
}
.appointment-view-tab {
  width: auto;
  min-width: 0;
  padding: .62rem .9rem;
  border-radius: .75rem;
  background: transparent;
  color: var(--muted);
  border: 0;
  box-shadow: none;
  white-space: nowrap;
}
.appointment-view-tab:hover { transform: none; color: var(--ink); }
.appointment-view-tab.active { background: var(--panel); color: white; }
.appointment-day-nav { display: flex; align-items: center; gap: .45rem; }
.appointment-date-field { display: block; }
.appointment-date-field input {
  width: auto;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: white;
  padding: .6rem .75rem;
  color: var(--ink);
  font: inherit;
}
.diary-nav-button { width: 44px; min-width: 44px; padding: .65rem; }

.appointment-controls {
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(150px, .75fr));
}
.appointment-search-field { min-width: 0; }
.appointment-list-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: .2rem 0 .65rem;
}
.appointment-list-heading .eyebrow { margin-bottom: .2rem; }
.appointment-list-heading h3 { margin: 0; font-family: "Playfair Display", Georgia, serif; font-size: 1.45rem; }
.appointment-visible-count {
  border-radius: 999px;
  background: #eee8e2;
  color: var(--muted);
  padding: .45rem .7rem;
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
}

.appointment-diary-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  margin-bottom: .7rem;
  overflow: hidden;
}
.appointment-diary-main {
  display: grid;
  grid-template-columns: 95px minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}
.appointment-time-block { display: grid; gap: .18rem; }
.appointment-time-block strong { font-size: 1rem; }
.appointment-time-block small { color: var(--muted); font-size: .75rem; }
.appointment-diary-details { min-width: 0; }
.appointment-diary-details h3 { margin: 0 0 .28rem; font-size: 1rem; }
.appointment-diary-details p { margin: .12rem 0; color: var(--muted); font-size: .83rem; line-height: 1.4; }
.appointment-diary-status { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.appointment-deposit-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .36rem .55rem;
  background: #f3eee9;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 700;
  white-space: nowrap;
}
.appointment-deposit-chip.due { background: #fff4df; color: #7b5a21; }
.appointment-diary-actions {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
  padding: .7rem 1rem;
  border-top: 1px solid var(--line);
  background: #fcfaf8;
}
.appointment-diary-actions button {
  width: auto;
  min-width: 0;
  padding: .52rem .68rem;
  border-radius: .7rem;
  font-size: .75rem;
  box-shadow: none;
}
.appointment-diary-actions .secondary:hover { transform: none; }
.appointment-past-confirmed {
  border-left: 4px solid #c69b58;
}
.appointment-overdue-note { color: #8a6229 !important; font-weight: 700; }

@media (max-width: 900px) {
  .appointment-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .appointment-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .appointment-search-field { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .appointment-diary-toolbar { align-items: stretch; }
  .appointment-view-tabs { width: 100%; }
  .appointment-day-nav { width: 100%; }
  .appointment-date-field { flex: 1; }
  .appointment-date-field input { width: 100%; }
  .appointment-controls { grid-template-columns: 1fr 1fr; }
  .appointment-diary-main { grid-template-columns: 72px minmax(0, 1fr); gap: .75rem; }
  .appointment-diary-status { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 520px) {
  .appointment-overview { grid-template-columns: 1fr 1fr; gap: .55rem; }
  .appointment-stat { padding: .8rem; }
  .appointment-stat strong { font-size: 1.65rem; }
  .appointment-controls { grid-template-columns: 1fr; }
  .appointment-search-field { grid-column: auto; }
  .appointment-day-nav { flex-wrap: wrap; }
  .appointment-date-field { min-width: calc(100% - 98px); }
  #appointment-jump-today { width: 100%; }
  .appointment-diary-main { grid-template-columns: 64px minmax(0, 1fr); padding: .85rem; }
  .appointment-diary-actions { display: grid; grid-template-columns: repeat(2, 1fr); padding: .65rem .85rem; }
  .appointment-diary-actions button { width: 100%; }
}

/* Today dashboard command centre */
.dashboard-command-center {
  margin: 1rem 0 1.4rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  padding: 1rem;
  box-shadow: 0 14px 38px rgba(59, 43, 34, .05);
}
.dashboard-command-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.dashboard-command-head h2 { font-size: clamp(1.65rem, 4vw, 2.35rem); }
.dashboard-command-head p:last-child { margin: .4rem 0 0; color: var(--muted); line-height: 1.5; max-width: 46rem; }
.dashboard-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin: 1rem 0;
}
.dashboard-quick-actions button { width: auto; min-width: 0; padding: .72rem .9rem; }
.dashboard-today-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .65rem;
}
.dashboard-today-stats article {
  display: grid;
  gap: .15rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: .85rem;
  background: #fcfaf8;
  min-width: 0;
}
.dashboard-today-stats span { color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.dashboard-today-stats strong { font-family: "Playfair Display", Georgia, serif; font-size: 1.55rem; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-today-stats small { color: var(--muted); font-size: .7rem; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-today-columns {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: .8rem;
  margin-top: .8rem;
}
.dashboard-mini-panel {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #fffdfb;
  padding: .8rem;
  min-width: 0;
}
.dashboard-mini-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .7rem;
  margin-bottom: .55rem;
}
.dashboard-mini-head h3 { margin: 0; font-size: .95rem; }
.text-button {
  width: auto;
  min-width: 0;
  padding: .35rem .2rem;
  border-radius: .4rem;
  background: transparent;
  color: var(--accent-dark);
  box-shadow: none;
  font-size: .75rem;
}
.text-button:hover { transform: none; text-decoration: underline; }
.dashboard-today-list,
.dashboard-attention-list { display: grid; gap: .45rem; }
.dashboard-diary-item,
.dashboard-attention-item {
  width: 100%;
  display: grid;
  align-items: center;
  gap: .65rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  padding: .7rem;
  background: #fcfaf8;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}
.dashboard-diary-item { grid-template-columns: 54px minmax(0, 1fr) auto; }
.dashboard-attention-item { grid-template-columns: 9px minmax(0, 1fr) auto; }
.dashboard-diary-item:hover,
.dashboard-attention-item:hover { transform: none; border-color: #d6cbc2; }
.dashboard-diary-time { font-weight: 800; font-size: .83rem; }
.dashboard-diary-main,
.dashboard-attention-item > span:nth-child(2) { min-width: 0; display: grid; gap: .12rem; }
.dashboard-diary-main strong,
.dashboard-attention-item strong { font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-diary-main small,
.dashboard-attention-item small { color: var(--muted); font-size: .7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-diary-arrow { color: var(--muted); font-size: 1.15rem; }
.dashboard-attention-dot { width: 9px; height: 9px; border-radius: 50%; background: #8a9b94; }
.dashboard-attention-item.warning .dashboard-attention-dot { background: #c69b58; }
.dashboard-attention-item.critical .dashboard-attention-dot { background: #b15f59; }
.dashboard-attention-item.critical { border-color: #ead0cc; background: #fff9f8; }
.dashboard-empty-copy { margin: .25rem 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }

/* Monthly appointment calendar */
.appointment-calendar-panel {
  margin: .85rem 0;
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  background: var(--card);
  padding: .85rem;
  box-shadow: 0 12px 32px rgba(59, 43, 34, .04);
}
.appointment-calendar-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: .65rem;
  margin-bottom: .8rem;
}
.appointment-calendar-head > div { text-align: center; }
.appointment-calendar-head .eyebrow { margin-bottom: .18rem; }
.appointment-calendar-head h3 { margin: 0; font-family: "Playfair Display", Georgia, serif; font-size: 1.45rem; }
.appointment-calendar-weekdays,
.appointment-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.appointment-calendar-weekdays {
  border-bottom: 1px solid var(--line);
  padding-bottom: .35rem;
  margin-bottom: .35rem;
}
.appointment-calendar-weekdays span {
  text-align: center;
  color: var(--muted);
  font-size: .65rem;
  font-weight: 800;
  text-transform: uppercase;
}
.appointment-calendar-grid { gap: .25rem; }
.appointment-calendar-day {
  min-width: 0;
  min-height: 94px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: .32rem;
  padding: .4rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: #fffdfb;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}
.appointment-calendar-day:hover { transform: none; border-color: #cdbfb4; }
.appointment-calendar-day.outside-month { background: transparent; border-color: transparent; min-height: 94px; }
.appointment-calendar-day.is-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.appointment-calendar-day.is-selected { background: #f5eee8; }
.calendar-day-number { font-weight: 800; font-size: .75rem; }
.appointment-calendar-day.is-today .calendar-day-number {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel);
  color: white;
}
.calendar-events { display: grid; gap: .2rem; min-width: 0; }
.calendar-event {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .25rem;
  align-items: center;
  min-width: 0;
  padding: .23rem .28rem;
  border-radius: .42rem;
  background: #edf2ef;
  color: #355448;
  font-size: .58rem;
  line-height: 1.2;
}
.calendar-event-completed { background: #e8f3ed; color: #35644f; }
.calendar-event-cancelled,
.calendar-event-no_show { background: #f7e9e7; color: #874c47; }
.calendar-event-time { font-weight: 800; }
.calendar-event-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-more { color: var(--muted); font-size: .58rem; font-weight: 700; }
.appointment-calendar-help { margin: .6rem 0 0; text-align: center; color: var(--muted); font-size: .7rem; }

@media (max-width: 900px) {
  .dashboard-today-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-today-columns { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .dashboard-command-head { flex-direction: column; }
  .dashboard-command-head .compact-button { width: 100%; }
  .dashboard-quick-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .dashboard-quick-actions button { width: 100%; }
  .dashboard-quick-actions button:first-child { grid-column: 1 / -1; }
  .appointment-calendar-panel { padding: .6rem; }
  .appointment-calendar-grid { gap: .16rem; }
  .appointment-calendar-day,
  .appointment-calendar-day.outside-month { min-height: 70px; padding: .28rem; border-radius: .55rem; }
  .calendar-event { display: flex; min-width: 0; padding: .18rem .22rem; }
  .calendar-event-name { display: none; }
  .calendar-event-time { font-size: .55rem; }
}
@media (max-width: 460px) {
  .dashboard-today-stats { grid-template-columns: 1fr 1fr; gap: .5rem; }
  .dashboard-today-stats article { padding: .7rem; }
  .dashboard-today-stats strong { font-size: 1.3rem; }
  .appointment-calendar-weekdays span { font-size: .54rem; }
  .appointment-calendar-day,
  .appointment-calendar-day.outside-month { min-height: 59px; }
  .calendar-event { width: 7px; height: 7px; padding: 0; border-radius: 50%; background: #6f8b82; }
  .calendar-event-completed { background: #5f8b70; }
  .calendar-event-cancelled,
  .calendar-event-no_show { background: #b06d63; }
  .calendar-event-time,
  .calendar-event-name { display: none; }
  .calendar-events { display: flex; flex-wrap: wrap; gap: 3px; }
  .calendar-more { font-size: .5rem; }
}

/* Products & stock */
.stock-hero { align-items: center; }
.stock-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .8rem;
  margin: 1rem 0;
}
.stock-smart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.stock-smart-panel { min-width: 0; }
.stock-mini-list { display: grid; gap: .5rem; margin-top: .75rem; }
.stock-mini-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .7rem;
  padding: .75rem .8rem;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: #fffdfb;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}
.stock-mini-item:hover { transform: none; border-color: #d2c4b9; }
.stock-mini-item.warning { border-color: #ead9ba; background: #fffaf1; }
.stock-mini-item.critical { border-color: #e8c8c4; background: #fff8f7; }
.stock-mini-item span:first-child { min-width: 0; display: grid; gap: .15rem; }
.stock-mini-item strong { font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-mini-item small { color: var(--muted); font-size: .68rem; line-height: 1.35; }
.stock-mini-amount { font-size: .75rem; font-weight: 800; white-space: nowrap; }
.stock-controls { margin: 1rem 0; }
.stock-product-list { display: grid; gap: 1rem; }
.stock-product-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: var(--card);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.stock-product-card.stock-focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(181, 141, 114, .14); }
.stock-product-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.stock-product-head h3 { margin: 0; font-family: "Playfair Display", Georgia, serif; font-size: 1.45rem; }
.stock-product-head p:not(.eyebrow) { margin: .25rem 0 0; color: var(--muted); font-size: .78rem; }
.stock-status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: .35rem .65rem;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: #e8f2ec;
  color: #35644f;
  white-space: nowrap;
}
.stock-status-chip.warning { background: #f7eedf; color: #8a6633; }
.stock-status-chip.critical { background: #f7e7e5; color: #8b4944; }
.stock-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .55rem;
  margin: .9rem 0;
}
.stock-metrics > div {
  min-width: 0;
  padding: .65rem;
  border: 1px solid var(--line);
  border-radius: .85rem;
  background: #faf7f4;
  display: grid;
  gap: .1rem;
}
.stock-metrics span { color: var(--muted); font-size: .6rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.stock-metrics strong { font-family: "Playfair Display", Georgia, serif; font-size: 1.15rem; }
.stock-metrics small { color: var(--muted); font-size: .62rem; }
.stock-recommendation {
  display: grid;
  gap: .15rem;
  padding: .75rem .85rem;
  border-radius: .85rem;
  border: 1px solid #ead9ba;
  background: #fffaf1;
  margin: .8rem 0;
}
.stock-recommendation.critical { border-color: #e8c8c4; background: #fff8f7; }
.stock-recommendation strong { font-size: .78rem; }
.stock-recommendation span { color: var(--muted); font-size: .72rem; line-height: 1.45; }
.stock-supplier { margin: .7rem 0; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.stock-warning-line { margin: .7rem 0; padding: .65rem .75rem; border-radius: .8rem; background: #fff4e5; color: #7a5b2f; font-size: .7rem; line-height: 1.45; }
.stock-product-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }
.stock-batch-list { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.stock-batch-list .subsection-title h4 { margin: 0; font-size: .86rem; }
.stock-batch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .7rem;
  align-items: center;
  padding: .7rem 0;
  border-bottom: 1px solid #eee7e1;
}
.stock-batch-row:last-child { border-bottom: 0; }
.stock-batch-main { min-width: 0; display: grid; gap: .15rem; }
.stock-batch-main strong { font-size: .8rem; }
.stock-batch-main small { color: var(--muted); font-size: .67rem; line-height: 1.4; }
.stock-batch-side { display: flex; align-items: center; gap: .45rem; }
.stock-no-batches { margin: .5rem 0 0; color: var(--muted); font-size: .72rem; }

@media (max-width: 900px) {
  .stock-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stock-smart-grid { grid-template-columns: 1fr; }
  .stock-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .stock-product-head { flex-direction: column; }
  .stock-status-chip { align-self: flex-start; }
  .stock-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stock-batch-row { grid-template-columns: 1fr; }
  .stock-batch-side { justify-content: space-between; }
  .stock-mini-item { grid-template-columns: 1fr; }
  .stock-mini-amount { justify-self: start; }
}
