/* ============================================================
   HIMS clinical shell — herbal green HIS (not a blue NHS clone)
   ============================================================ */
:root {
    --cs-green: #3f6f52;
    --cs-green-deep: #345c44;
    --cs-green-ink: #24382c;
    --cs-text: #1c2420;
    --cs-muted: #5a635e;
    --cs-line: #dde2de;
    --cs-wash: #f3f5f4;
    --cs-paper: #ffffff;
    --cs-bar: #ffffff;
    --cs-nav: #f7f8f7;
    --cs-field: #ffffff;
    --cs-danger: #a33b3b;
    --cs-bmi-under: #4d5f6d;
    --cs-bmi-ok: #4a7c59;
    --cs-bmi-over: #8a6424;
    --cs-bmi-obese: #9a4a40;
    --cs-focus: rgba(74, 124, 89, 0.22);
    --cs-radius: 8px;
    --cs-max: 1260px;
    --cs-type: system-ui, "Segoe UI", "Source Sans 3", "Source Sans Pro", "Noto Sans", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--cs-type);
    font-size: 15px;
    line-height: 1.5;
    color: var(--cs-text);
    background: var(--cs-wash);
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--cs-green-ink);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--cs-green);
    outline-offset: 2px;
}

h1, h2, h3, h4 {
    color: var(--cs-green-ink);
    font-weight: 600;
    line-height: 1.25;
}

h1 {
    font-size: 1.45rem; /* ~23px */
    margin: 0 0 0.4rem;
}

h2 {
    font-size: 1.15rem;
    margin: 0 0 0.5rem;
}

h3 {
    font-size: 1.05rem;
    margin: 0 0 0.4rem;
}

p {
    margin: 0 0 0.75rem;
}

.cs-muted,
.muted {
    color: var(--cs-muted);
    font-size: 13px;
}

.cs-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Shell: top bar + nav ---------- */
.cs-shell {
    background: var(--cs-bar);
    color: var(--cs-text);
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid var(--cs-line);
    box-shadow: none;
    border-top: 3px solid var(--cs-green);
}

.cs-lapse {
    margin: 0;
    padding: 10px 20px;
    background: #fdecea;
    color: #8a1f11;
    font-size: 14px;
    border-top: 1px solid #f0c9c4;
}

.cs-lapse a {
    color: #6b1810;
    font-weight: 600;
}

.cs-top.headerband,
.cs-top {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 56px;
    padding: 6px 20px;
    background: var(--cs-bar);
    color: var(--cs-text);
}

.cs-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.cs-brand img,
.cs-top img.hims-logo {
    height: 64px;
    width: auto;
    max-width: min(400px, 62vw);
    object-fit: contain;
    flex-shrink: 0;
    display: block;
    border: 0;
}

.zygomel-lockup {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1a4a32;
    flex-shrink: 0;
    text-decoration: none;
}
.zygomel-lockup .mark {
    width: 40px;
    height: auto;
    display: block;
    flex: 0 0 auto;
}
.zygomel-lockup .mark path:not([fill="none"]) { fill: currentColor; }
.zygomel-lockup .mark path[stroke] { stroke: currentColor; }
.zygomel-lockup .names {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.zygomel-lockup .word {
    font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
    font-weight: 500;
    font-size: 26px;
    line-height: 1;
    letter-spacing: -0.03em;
    color: inherit;
    white-space: nowrap;
    padding-bottom: 0.18em;
}
.zygomel-lockup .tag {
    display: block;
    font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
    font-weight: 500;
    font-size: 9px;
    line-height: 1;
    color: #2a5c42;
    white-space: nowrap;
    transform-origin: left center;
}
.zygomel-lockup-compact .mark { width: 32px; }
.zygomel-lockup-compact .word { font-size: 22px; }
.zygomel-lockup-compact .tag { font-size: 8px; }
html.cs-dark .zygomel-lockup { color: #e4f3ea; }
html.cs-dark .zygomel-lockup .tag { color: #c5ddd0; }

html.cs-dark .cs-brand img,
html.cs-dark .cs-top img.hims-logo,
html.cs-dark .cs-auth-bar img {
    filter: invert(1) hue-rotate(180deg) brightness(1.08) contrast(1.12);
    mix-blend-mode: screen;
    background: transparent;
}

.cs-clinic {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cs-clinic strong {
    font-size: 15px;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cs-clinic span {
    font-size: 12px;
    opacity: 0.85;
    font-weight: 400;
}

.cs-top-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.cs-search {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cs-search label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--cs-muted);
    white-space: nowrap;
    opacity: 1;
}

.cs-search input[type="search"] {
    width: 260px;
    min-height: 34px;
    margin: 0;
    padding: 6px 10px;
    border: 1px solid var(--cs-line);
    background: var(--cs-paper);
    color: var(--cs-text);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.cs-search input[type="search"]::placeholder {
    color: #8a918c;
}
.cs-search-go,
.cs-list-filter-go {
    min-height: 34px;
    padding: 4px 11px;
    border: 1px solid var(--cs-line);
    background: var(--cs-paper);
    color: var(--cs-green-ink);
    border-radius: 4px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.cs-search-go:hover,
.cs-list-filter-go:hover {
    background: var(--cs-wash);
}

.cs-user {
    font-size: 13px;
    color: var(--cs-muted);
    white-space: nowrap;
}

.cs-signout,
a.logout-btn {
    color: var(--cs-green-ink) !important;
    background: transparent !important;
    border: 1px solid var(--cs-line);
    padding: 6px 12px !important;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px !important;
    font-weight: 550 !important;
    box-shadow: none !important;
}

.cs-signout:hover,
a.logout-btn:hover {
    background: var(--cs-wash) !important;
}

.cs-theme-toggle {
    color: var(--cs-green-ink);
    background: var(--cs-nav);
    border: 1px solid var(--cs-line);
    padding: 6px 12px;
    border-radius: 4px;
    font: inherit;
    font-size: 13px;
    font-weight: 550;
    cursor: pointer;
    white-space: nowrap;
}
.cs-theme-toggle:hover {
    background: var(--cs-wash);
}
.cs-theme-toggle[aria-pressed="true"] {
    background: var(--cs-field);
}

.cs-support-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 8px;
    color: #c41e1e;
    border: 2px solid #c41e1e;
    background: #fff5f5;
    text-decoration: none !important;
    box-sizing: border-box;
}
.cs-support-bell svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}
.cs-support-count {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 99px;
    background: #c41e1e;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
    box-sizing: border-box;
}
.cs-support-home {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 0;
    font-weight: 650;
}
.cs-support-home a {
    color: #c41e1e;
}

.cs-nav-toggle {
    display: none;
    background: transparent;
    color: var(--cs-text);
    border: 1px solid var(--cs-line);
    border-radius: 4px;
    min-height: 36px;
    padding: 6px 12px;
    font: inherit;
    cursor: pointer;
}

.cs-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0;
    padding: 0 12px;
    background: var(--cs-nav);
    border-top: 1px solid var(--cs-line);
}

.cs-nav a,
.cs-nav summary {
    color: var(--cs-green-ink);
    text-decoration: none;
    font-size: 13px;
    font-weight: 550;
    padding: 10px 14px;
    border-radius: 0;
    cursor: pointer;
    list-style: none;
    border-bottom: 2px solid transparent;
}

.cs-nav a[aria-current="page"] {
    color: var(--cs-green);
    border-bottom-color: var(--cs-green);
    background: transparent;
}

.cs-nav a:hover,
.cs-nav summary:hover {
    background: rgba(63, 111, 82, 0.06);
}

.cs-nav details {
    position: relative;
}

.cs-nav summary::-webkit-details-marker {
    display: none;
}

.cs-admin-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    max-height: calc(100vh - 8rem);
    max-height: min(70vh, calc(100dvh - 8rem));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: var(--cs-paper);
    color: var(--cs-text);
    border: 1px solid var(--cs-line);
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(31, 42, 36, 0.12);
    padding: 6px 0;
    z-index: 50;
}

.cs-admin-menu a {
    display: block;
    color: var(--cs-text);
    padding: 8px 14px;
    border-radius: 0;
    font-size: 14px;
}

.cs-admin-menu a:hover {
    background: var(--cs-wash);
    color: var(--cs-green-ink);
}

.edu-student-banner {
    font-family: var(--cs-type);
}

/* ---------- Work surface ---------- */
.cs-wrap,
.pdcontainer,
.container-PDASH {
    max-width: var(--cs-max);
    margin: 0 auto;
    padding: 20px 24px 48px;
}

body > .container {
    max-width: var(--cs-max);
    margin: 16px auto 40px;
    padding: 20px 24px;
    background: var(--cs-paper);
    border: 1px solid var(--cs-line);
    border-radius: 4px;
    box-shadow: none;
}

.pdcontainer .section,
.section {
    box-shadow: none !important;
    border: 1px solid var(--cs-line);
    border-radius: 4px;
}

table {
    border-collapse: collapse;
}
table th {
    font-size: 12px;
    font-weight: 650;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--cs-muted);
    background: var(--cs-nav) !important;
    border-bottom: 1px solid var(--cs-line);
    white-space: nowrap;
}
table td {
    border-bottom: 1px solid var(--cs-line);
}

.cs-page-title {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.cs-backrow {
    max-width: var(--cs-max, 1280px);
    margin: 0 auto;
    padding: 8px 24px 0;
}

.cs-back {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    color: var(--cs-green, #4a7c59);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.cs-back:hover,
.cs-back:focus {
    border-bottom-color: var(--cs-green, #4a7c59);
}

.cs-panel,
.section {
    background: var(--cs-paper);
    border: 1px solid var(--cs-line);
    border-radius: var(--cs-radius);
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: none;
}

.cs-legal {
    max-width: var(--cs-max);
    margin: 0 auto 16px;
    padding: 12px 16px;
    background: var(--cs-paper);
    border: 1px solid var(--cs-line);
    border-radius: var(--cs-radius);
    color: var(--cs-muted);
    font-size: 13px;
}

/* Home: compact lists, not marketing tiles */
.cs-home-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 16px;
}

.cs-link-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cs-link-list li {
    border-bottom: 1px solid var(--cs-line);
}

.cs-link-list li:last-child {
    border-bottom: 0;
}

.cs-link-list a {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 2px;
    text-decoration: none;
    color: var(--cs-text);
    font-size: 15px;
}

.cs-link-list a:hover {
    color: var(--cs-green);
}

.cs-link-list span {
    color: var(--cs-muted);
    font-size: 13px;
}

.cs-appt-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cs-appt-list li {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: 10px;
    align-items: baseline;
    padding: 8px 0;
    border-bottom: 1px solid var(--cs-line);
    font-size: 15px;
}

.cs-appt-list time {
    font-variant-numeric: tabular-nums;
    color: var(--cs-green-ink);
    font-weight: 600;
}

.cs-empty {
    padding: 20px 8px;
    color: var(--cs-muted);
    font-size: 14px;
    text-align: left;
}

/* ---------- Buttons ---------- */
.cs-btn,
.lux-btn,
.btn-modern,
.patient-btn,
.header-btn,
.btn,
button.btn,
a.btn,
a.header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 4px 12px;
    background: var(--cs-green);
    color: #fff;
    border: 1px solid var(--cs-green);
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-decoration: none;
    cursor: pointer;
    transform: none;
    box-shadow: none;
}

.cs-btn:hover,
.lux-btn:hover,
.btn-modern:hover,
.patient-btn:hover,
.header-btn:hover,
.btn:hover {
    background: var(--cs-green-deep);
    transform: none;
}

.cs-btn-sec,
.cs-toolbar a,
a.cs-btn-sec {
    background: transparent;
    color: var(--cs-green-ink);
    border: 1px solid var(--cs-line);
}

.cs-btn-sec:hover,
.cs-toolbar a:hover {
    background: var(--cs-wash);
    color: var(--cs-green-ink);
}

.cs-btn-danger,
.close-btn,
.delete-btn,
button.close-btn {
    background: transparent !important;
    color: var(--cs-danger) !important;
    border: 1px solid #e3c4c4 !important;
}

.cs-text-action,
a.cs-text-action,
.actions-cell a,
.actions-cell button,
td a.view-btn,
a.view-btn {
    display: inline;
    background: none !important;
    color: var(--cs-green-ink) !important;
    border: 0 !important;
    padding: 0 8px 0 0 !important;
    min-height: 0;
    font-size: 14px !important;
    font-weight: 550;
    text-decoration: underline;
    box-shadow: none;
    white-space: nowrap;
}

.actions-cell button {
    font-family: inherit;
    cursor: pointer;
}

.visit-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
}
.video-consult { display: contents; }
a.btn.video-join-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    min-width: 96px;
    padding: 4px 10px !important;
    margin: 0;
    background: var(--cs-green) !important;
    color: #fff !important;
    border: 1px solid var(--cs-green) !important;
    border-radius: 4px;
    text-decoration: none !important;
    font-size: 12px !important;
    font-weight: 500;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.video-meta,
.video-join-wait {
    font-size: 12px;
    color: var(--cs-muted);
}

.orange-btn,
a.orange-btn,
button.orange-btn {
    background: transparent !important;
    color: var(--cs-green-ink) !important;
    border: 1px solid var(--cs-line) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    letter-spacing: 0.03em;
    padding: 4px 11px !important;
    border-radius: 4px;
    text-decoration: none;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
}

.orange-btn:hover,
.orange-btn.active {
    background: var(--cs-wash) !important;
    border-color: var(--cs-green) !important;
}

.book-btn {
    background: var(--cs-green) !important;
    color: #fff !important;
}

.blend-btn,
a.blend-btn {
    background: transparent !important;
    color: var(--cs-green-ink) !important;
    border: 1px solid var(--cs-line) !important;
    font-weight: 550 !important;
}

/* ---------- Forms ---------- */
label,
.lux-label,
.patient-label,
.label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--cs-green-ink);
    margin: 10px 0 4px;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
select,
textarea,
.lux-input,
.lux-select,
.lux-textarea {
    width: 100%;
    max-width: 100%;
    min-height: 42px;
    padding: 8px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--cs-line);
    border-radius: 6px;
    background: var(--cs-field);
    color: var(--cs-text);
    font-family: inherit;
    font-size: 15px;
}

textarea,
.lux-textarea {
    min-height: 96px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
.lux-input:focus,
.lux-select:focus,
.lux-textarea:focus {
    border-color: var(--cs-green);
    background: var(--cs-field);
    box-shadow: 0 0 0 3px var(--cs-focus);
    outline: none;
}

/* ---------- Tables ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--cs-paper);
    margin-top: 8px;
    box-shadow: none;
    border-radius: 0;
}

.cs-table-wrap {
    overflow-x: auto;
    margin: 8px -20px -18px;
}

.cs-table-wrap table {
    margin: 0;
}

.cs-table-wrap th:first-child,
.cs-table-wrap td:first-child {
    padding-left: 20px;
}

.cs-table-wrap th:last-child,
.cs-table-wrap td:last-child {
    padding-right: 20px;
}

th, td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--cs-line);
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

th {
    background: #f0f4f1;
    color: var(--cs-green-ink);
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

/* ---------- Patient banner ---------- */
.cs-banner {
    background: var(--cs-paper);
    border: 1px solid var(--cs-line);
    border-radius: 4px;
    padding: 14px 16px 10px;
    margin-bottom: 12px;
    border-left: 3px solid var(--cs-green);
}

.cs-banner-id {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 20px;
    align-items: baseline;
}

.cs-banner-id h1 {
    margin: 0;
    font-size: 1.4rem;
}

.cs-banner-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    font-size: 14px;
    color: var(--cs-muted);
    margin-top: 4px;
}

.cs-banner-meta strong {
    color: var(--cs-text);
    font-weight: 600;
}

.cs-alerts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.cs-alert {
    display: inline-block;
    background: #f8eeee;
    color: var(--cs-danger);
    border: 1px solid #e3c4c4;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
}

.cs-dl {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px 20px;
    margin: 12px 0 0;
}

.cs-dl div {
    min-width: 0;
}

.cs-dl dt {
    font-size: 12px;
    color: var(--cs-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cs-dl dd {
    margin: 0;
    font-size: 15px;
}

.cs-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 4px;
}

.cs-toolbar a,
.cs-toolbar button {
    min-height: 32px;
    padding: 4px 11px;
    background: transparent;
    color: var(--cs-green-ink);
    border: 1px solid var(--cs-line);
    border-radius: 4px;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-decoration: none;
    cursor: pointer;
}

.cs-toolbar a:hover,
.cs-toolbar button:hover {
    background: var(--cs-wash);
}

.cs-vitals {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--cs-line);
}

.cs-vitals-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 28px;
    margin: 0;
}

.cs-vital {
    min-width: 0;
}

.cs-vital dt {
    font-size: 12px;
    color: var(--cs-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cs-vital dd {
    margin: 0;
    font-size: 15px;
}

.cs-bmi-value {
    font-weight: 600;
    color: var(--cs-text);
    font-size: 15px;
}

.cs-bmi-cat {
    display: inline-block;
    margin-left: 8px;
    padding: 0 2px 0 7px;
    border-left: 3px solid var(--cs-bmi, var(--cs-line));
    color: var(--cs-bmi, var(--cs-text));
    font-size: 13px;
    font-weight: 600;
}

.cs-bmi--underweight { --cs-bmi: var(--cs-bmi-under); }
.cs-bmi--healthy { --cs-bmi: var(--cs-bmi-ok); }
.cs-bmi--overweight { --cs-bmi: var(--cs-bmi-over); }
.cs-bmi--obesity { --cs-bmi: var(--cs-bmi-obese); }

.cs-bmi-ref {
    margin-top: 10px;
    max-width: 360px;
}

.cs-bmi-scale {
    position: relative;
    height: 6px;
    background: var(--cs-line);
    border-radius: 3px;
}

.cs-bmi-marker {
    position: absolute;
    top: -4px;
    width: 2px;
    height: 14px;
    background: var(--cs-bmi, var(--cs-text));
    border-radius: 1px;
    transform: translateX(-50%);
}

.cs-bmi-ticks {
    position: relative;
    height: 16px;
    margin-top: 4px;
    font-size: 11px;
    color: var(--cs-muted);
}

.cs-bmi-ticks span {
    position: absolute;
    transform: translateX(-50%);
}

.cs-bmi-ticks span:first-child {
    transform: none;
}

.cs-bmi-ticks span:last-child {
    transform: translateX(-100%);
}

.cs-bmi-legend {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--cs-muted);
}

/* ---------- Auth (login / register) ---------- */
body.cs-auth {
    background:
        radial-gradient(1200px 600px at 50% 0%, #f7fbf8 0%, #eef4f0 55%, #e7eee9 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.cs-auth-bar {
    background: var(--cs-bar);
    color: var(--cs-text);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    min-height: 80px;
    border-bottom: 1px solid var(--cs-line);
    border-top: 3px solid var(--cs-green);
}

.cs-auth-bar img {
    height: 64px;
    width: auto;
    max-width: min(420px, 78vw);
    object-fit: contain;
    flex-shrink: 0;
    display: block;
}

.cs-auth-card {
    width: 100%;
    max-width: 400px;
    margin: 48px auto 24px;
    background: var(--cs-paper);
    border: 1px solid var(--cs-line);
    border-radius: 4px;
    padding: 28px 28px 24px;
    box-shadow: none;
}

.cs-auth-card.cs-auth-wide {
    max-width: 560px;
}

.cs-auth-card .cs-btn {
    width: 100%;
    margin-top: 16px;
}

.cs-auth-links {
    text-align: center;
    font-size: 14px;
    margin-top: 14px;
}

.cs-auth-links a {
    color: var(--cs-green-ink);
}

.cs-auth-stage {
    flex: 1;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 28px 20px 8px;
    box-sizing: border-box;
}

.cs-auth-stage .auth-split {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 400px);
    gap: 32px 40px;
    align-items: center;
}

.cs-auth-stage .auth-split.auth-split-wide {
    grid-template-columns: minmax(0, 0.85fr) minmax(320px, 1.15fr);
    align-items: start;
}

.cs-auth-stage .cs-auth-card {
    margin: 0;
    max-width: none;
}

.auth-welcome {
    position: relative;
    min-height: 280px;
    padding: 12px 8px 8px 0;
    overflow: hidden;
}

.auth-welcome-logo {
    position: absolute;
    right: 4%;
    top: 46%;
    transform: translateY(-50%);
    width: min(240px, 70%);
    opacity: 0.16;
    pointer-events: none;
    user-select: none;
}

.auth-welcome-copy {
    position: relative;
    z-index: 1;
    max-width: 36rem;
}

.auth-welcome h1 {
    margin: 0 0 8px;
    font-size: 1.7rem;
    font-weight: 650;
    color: var(--cs-green-ink);
    line-height: 1.25;
}

.auth-welcome .auth-lead {
    margin: 0 0 18px;
    font-size: 1.05rem;
    color: var(--cs-muted);
}

.auth-welcome hr {
    border: 0;
    border-top: 1px solid var(--cs-line);
    margin: 0 0 18px;
    max-width: 12rem;
}

.auth-welcome h2 {
    margin: 0 0 14px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--cs-green-ink);
}

.auth-bullets {
    list-style: none;
    margin: 0;
    padding: 0;
}

.auth-bullets li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0 0 12px;
}

.auth-bullets svg {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    margin-top: 1px;
}

@media (max-width: 840px) {
    .cs-auth-stage .auth-split {
        grid-template-columns: 1fr;
    }
    .auth-welcome {
        min-height: 0;
        padding: 0 0 8px;
    }
    .auth-welcome-logo {
        width: 70%;
        opacity: 0.07;
    }
}

.cs-error,
.error,
.err {
    background: #f8eeee;
    border-left: 3px solid var(--cs-danger);
    padding: 10px 12px;
    margin-bottom: 14px;
    border-radius: 4px;
    color: var(--cs-danger);
    font-size: 14px;
}

.ok,
.success {
    background: #d5eadc;
    border-left: 3px solid var(--cs-green);
    padding: 10px 12px;
    margin-bottom: 14px;
    border-radius: 4px;
    color: var(--cs-green-ink);
    font-size: 14px;
}

.cs-footer,
.footerd,
div.footer {
    margin-top: auto;
    padding: 20px 16px 28px;
    text-align: center;
    color: var(--cs-muted);
    font-size: 13px;
    background: transparent;
}

.cs-footer p,
div.footer p {
    margin: 0;
}

/* ---------- Diary (appointments.php): dashboard type, own layout ---------- */
.overview-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
}

.overview-header h2 {
    margin: 0;
}

.overview-actions,
.top-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
}

.pdcontainer .section h2 {
    font-size: 1.15rem;
}

.calendar-nav strong {
    font-size: 15px;
    font-weight: 600;
    color: var(--cs-green-ink);
}

.cancel-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid #e3c4c4;
    background: #f8eeee;
    color: var(--cs-danger);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.cancel-icon {
    color: var(--cs-danger);
    font-weight: 600;
    margin-right: 4px;
}

tr.cancelled td,
.calendar-appt.cancelled {
    background: var(--cs-wash) !important;
    color: var(--cs-muted) !important;
    text-decoration: line-through;
    opacity: 0.8;
}

.prac-green,
.prac-blue,
.prac-purple,
.prac-orange,
.prac-default {
    font-weight: 600;
    font-size: 14px;
}

.prac-green { color: #2f6b45; }
.prac-blue { color: #3a5a73; }
.prac-purple { color: #5a4a6d; }
.prac-orange { color: #6d5a32; }
.prac-default { color: var(--cs-green-ink); }

.practitioner-A { border-left-color: #6d5a32 !important; }
.practitioner-B { border-left-color: #3a5a73 !important; }
.practitioner-C { border-left-color: #5a4a6d !important; }
.practitioner-D { border-left-color: #2f6b45 !important; }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(28, 36, 32, 0.45);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-box {
    background: var(--cs-paper);
    border: 1px solid var(--cs-line);
    border-radius: 8px;
    padding: 20px 22px;
    width: 420px;
    max-width: 92%;
    box-shadow: 0 8px 24px rgba(31, 42, 36, 0.12);
}

.modal-box h2 {
    font-size: 1.15rem;
}

.modal-box p {
    font-size: 15px;
    color: var(--cs-text);
}

.modal-box .cs-btn {
    margin-right: 8px;
}

/* ---------- Calendar readability ---------- */
.calendar-table th,
.calendar-table td {
    border: 1px solid var(--cs-line);
    vertical-align: top;
    font-size: 13px;
}

.calendar-table th {
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--cs-muted);
    background: var(--cs-nav) !important;
}

.calendar-day {
    width: 14.28%;
    min-height: 88px;
    padding: 8px !important;
    background: var(--cs-paper);
}

.calendar-day strong {
    display: block;
    margin-bottom: 6px;
    color: var(--cs-green-ink);
}

.calendar-appt {
    font-size: 12px !important;
    line-height: 1.35 !important;
    padding: 4px 6px !important;
    margin-bottom: 4px !important;
    background: var(--cs-nav);
    border-left: 3px solid var(--cs-green);
    color: var(--cs-text) !important;
    border-radius: 3px;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0 12px;
}

/* ---------- Index leftovers ---------- */
.welcome-card-role {
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 13px !important;
}

.index-header,
.header-PDASH,
.pdheader {
    display: none; /* chrome lives in .cs-shell */
}

.module-grid,
.index-grid {
    display: block;
}

.module-card,
.index-card {
    background: transparent;
    box-shadow: none;
    border: 0;
    border-radius: 0;
    padding: 0;
    transform: none;
}

.module-card:hover,
.index-card:hover {
    transform: none;
    box-shadow: none;
}

/* ---------- Modals ---------- */
.modal-box button,
.dashboard-btn {
    background: var(--cs-green);
    color: #fff;
}

.modal-box button:hover,
.dashboard-btn:hover {
    background: var(--cs-green-deep);
}

/* On-page list filter (patient search + A–Z). Not .cs-search — that is the header form, hidden on small screens. */
.cs-list-filter-bar {
    margin: 0 0 16px;
}
.cs-list-filter-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.cs-list-filter-search label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--cs-muted);
}
.cs-list-filter-search input[type="search"] {
    width: min(320px, 100%);
    min-height: 34px;
    margin: 0;
    padding: 6px 10px;
    border: 1px solid var(--cs-line);
    background: var(--cs-paper);
    color: var(--cs-text);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}
.cs-alpha {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin: 0 0 4px;
}
.cs-alpha-btn {
    min-width: 1.7rem;
    min-height: 1.7rem;
    padding: 0 5px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--cs-green-ink);
    border-radius: 4px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.cs-alpha-btn:hover {
    background: var(--cs-wash);
}
.cs-alpha-btn.is-current {
    border-color: var(--cs-green);
    background: var(--cs-nav);
}
.cs-alpha-btn.is-empty {
    opacity: 0.35;
    cursor: default;
}
.cs-list-filter-status {
    margin: 6px 0 0;
}
tr.is-filtered-out,
tr.is-preview-hidden {
    display: none;
}
.hide-cancelled tr.cancelled,
.hide-cancelled .calendar-appt.cancelled {
    display: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
    .cs-clinic span,
    .cs-search {
        display: none;
    }

    .cs-nav-toggle {
        display: inline-flex;
        align-items: center;
    }

    .cs-nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        padding-bottom: 12px;
    }

    .cs-nav.is-open {
        display: flex;
    }

    .cs-admin-menu {
        position: static;
        max-height: min(60vh, 24rem);
        box-shadow: none;
        border: 0;
        background: transparent;
    }

    .cs-admin-menu a {
        color: var(--cs-text);
        padding-left: 20px;
    }

    .cs-home-grid,
    .two-col,
    .patient-two-col {
        grid-template-columns: 1fr;
    }

    .cs-wrap,
    .pdcontainer,
    .container-PDASH,
    body > .container {
        padding: 16px 14px 36px;
    }

    .cs-auth-card {
        margin: 20px 14px;
        padding: 22px 18px;
    }

    .cs-appt-list li {
        grid-template-columns: 64px 1fr;
    }

    form .two {
        grid-template-columns: 1fr;
    }
}

.print-clinic {
    border-bottom: 2px solid var(--cs-green);
    padding: 0 0 10px;
    margin: 0 0 16px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--cs-muted);
}
.print-clinic-name {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--cs-green-ink);
    margin-bottom: 4px;
}

@media print {
    .cs-shell,
    .cs-nav-toggle,
    .cs-theme-toggle,
    .cs-support-bell,
    .cs-support-home,
    .cs-footer,
    .edu-student-banner {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .print-clinic {
        color: #333 !important;
        border-bottom-color: #4a7c59 !important;
    }

    .print-clinic-name {
        color: #4a7c59 !important;
        font-size: 14px !important;
        font-weight: 700 !important;
    }

    .print-clinic div {
        color: #333 !important;
        font-size: 10px !important;
    }
}

/* ---------- Site-wide dark / light ---------- */
html.cs-dark {
    color-scheme: dark;
    --cs-green: #7eb392;
    --cs-green-deep: #6a9d7d;
    --cs-green-ink: #d7eadc;
    --cs-text: #e8eeea;
    --cs-muted: #a9b4ae;
    --cs-line: #3d4a43;
    --cs-wash: #121816;
    --cs-paper: #1c2420;
    --cs-bar: #171e1b;
    --cs-nav: #141a17;
    --cs-field: #24302a;
    --cs-focus: rgba(126, 179, 146, 0.28);
}

html.cs-dark body {
    background: var(--cs-wash) !important;
    color: var(--cs-text) !important;
}

html.cs-dark .cs-shell,
html.cs-dark .cs-top,
html.cs-dark .cs-top.headerband {
    background: var(--cs-bar) !important;
    color: var(--cs-text);
    border-color: var(--cs-line);
}

html.cs-dark .cs-nav {
    background: var(--cs-nav) !important;
    border-color: var(--cs-line);
}

html.cs-dark .cs-nav a,
html.cs-dark .cs-nav summary {
    color: var(--cs-green-ink);
}

html.cs-dark .cs-nav a[aria-current="page"] {
    color: var(--cs-green);
    background: transparent;
}

html.cs-dark .print-clinic {
    border-bottom-color: var(--cs-green);
    color: var(--cs-muted);
}

html.cs-dark .print-clinic-name {
    color: var(--cs-green-ink);
}

html.cs-dark .cs-theme-toggle,
html.cs-dark .cs-nav-toggle {
    background: var(--cs-field) !important;
    color: var(--cs-text) !important;
    border-color: var(--cs-line) !important;
}

html.cs-dark .cs-support-bell {
    color: #ff9f1a !important;
    border-color: #ff9f1a !important;
    background: #3a2a12 !important;
}
html.cs-dark .cs-support-count {
    background: #ff9f1a !important;
    color: #1c1408 !important;
}
html.cs-dark .cs-support-home a {
    color: #ff9f1a;
}

html.cs-dark .cs-legal {
    background: var(--cs-paper) !important;
    color: var(--cs-muted) !important;
    border-color: var(--cs-line) !important;
}

html.cs-dark .cs-page-title h1,
html.cs-dark .cs-clinic strong,
html.cs-dark .cs-user {
    color: var(--cs-green-ink);
}

html.cs-dark input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="range"]):not([type="image"]),
html.cs-dark select,
html.cs-dark textarea,
html.cs-dark .lux-input,
html.cs-dark .lux-select,
html.cs-dark .lux-textarea {
    background: var(--cs-field) !important;
    color: var(--cs-text) !important;
    border-color: var(--cs-line) !important;
    caret-color: var(--cs-text);
}

html.cs-dark input::placeholder,
html.cs-dark textarea::placeholder {
    color: var(--cs-muted) !important;
    opacity: 1;
}

html.cs-dark option {
    background: var(--cs-field);
    color: var(--cs-text);
}

html.cs-dark table {
    background: var(--cs-paper);
    color: var(--cs-text);
}

html.cs-dark th {
    background: #24302a;
    color: var(--cs-green-ink);
}

html.cs-dark td {
    color: var(--cs-text);
    border-color: var(--cs-line);
}

html.cs-dark tr:hover td {
    background: #2a3832 !important;
    color: var(--cs-text) !important;
}

html.cs-dark tr:hover th {
    background: #24302a !important;
    color: var(--cs-green-ink) !important;
}

html.cs-dark .cs-admin-menu {
    background: var(--cs-paper);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

html.cs-dark .container,
html.cs-dark .card,
html.cs-dark .section,
html.cs-dark .cs-panel,
html.cs-dark .cs-banner,
html.cs-dark .cs-auth-card,
html.cs-dark .cs-admin-menu,
html.cs-dark .tab-content,
html.cs-dark .description-box,
html.cs-dark .herb-item,
html.cs-dark .cardblend,
html.cs-dark .review-card,
html.cs-dark .review-banner,
html.cs-dark .review-gaps,
html.cs-dark .review-setup,
html.cs-dark .calendar-day {
    background: var(--cs-paper) !important;
    color: var(--cs-text);
    border-color: var(--cs-line);
}

html.cs-dark .section h3,
html.cs-dark .header,
html.cs-dark .header h2,
html.cs-dark .header p,
html.cs-dark .header-title {
    color: var(--cs-green-ink) !important;
}

html.cs-dark .cs-search input[type="search"]::placeholder {
    color: var(--cs-muted);
}

html.cs-dark .cs-alpha-btn {
    color: var(--cs-green-ink);
}
html.cs-dark .cs-alpha-btn:hover {
    background: #2a3832;
}
html.cs-dark .cs-alpha-btn.is-current {
    background: #24302a;
    border-color: var(--cs-green);
}

html.cs-dark .plan,
html.cs-dark .sku,
html.cs-dark .license-check,
html.cs-dark .billing-table,
html.cs-dark .billing-print {
    background: var(--cs-paper) !important;
    color: var(--cs-text) !important;
    border-color: var(--cs-line) !important;
}

html.cs-dark .plan.on,
html.cs-dark .sku.on {
    border-color: var(--cs-green) !important;
    box-shadow: 0 0 0 2px rgba(126, 179, 146, 0.28) !important;
}

html.cs-dark .hint,
html.cs-dark .license-check-off {
    color: var(--cs-muted) !important;
}

html.cs-dark .prefill,
html.cs-dark .bubble {
    background: var(--cs-paper) !important;
    color: var(--cs-text) !important;
    border-color: var(--cs-line) !important;
}

html.cs-dark .bubble.sales {
    background: #1a2820 !important;
    border-color: var(--cs-green) !important;
}

html.cs-dark .bubble header {
    color: var(--cs-muted) !important;
}

html.cs-dark .calendar-table td,
html.cs-dark .calendar-day {
    background: var(--cs-paper) !important;
    color: var(--cs-text);
    border-color: var(--cs-line);
}

html.cs-dark .calendar-appt {
    background: #24302a !important;
    color: var(--cs-text) !important;
    border-left-color: var(--cs-green);
}

html.cs-dark .calendar-appt.cancelled,
html.cs-dark tr.cancelled td {
    background: #2a2424 !important;
    color: var(--cs-muted) !important;
}

html.cs-dark .alpha-bar a,
html.cs-dark .pager a,
html.cs-dark .pager span,
html.cs-dark .tabs .tab,
html.cs-dark .tabs a.tab {
    background: var(--cs-field) !important;
    color: var(--cs-text) !important;
    border-color: var(--cs-line);
}

html.cs-dark .tabs .tab.active,
html.cs-dark .tabs a.tab.active {
    background: var(--cs-green) !important;
    color: #fff !important;
}

html.cs-dark .alpha-bar a.on,
html.cs-dark .pager a.on,
html.cs-dark .pager span.on {
    background: #6b3fa0 !important;
    color: #fff !important;
}

html.cs-dark .tea-tile,
html.cs-dark .tea-card,
html.cs-dark .ticket {
    background: var(--cs-field) !important;
    color: var(--cs-text) !important;
    box-shadow: none !important;
    border-color: var(--cs-line);
}

html.cs-dark .ok,
html.cs-dark .success,
html.cs-dark .billing-ok {
    background: #1e3328 !important;
    color: #d7eadc !important;
    border-left-color: #7eb392;
}

html.cs-dark .cs-error,
html.cs-dark .error,
html.cs-dark .err,
html.cs-dark .billing-err {
    background: #3a2828 !important;
    color: #e8b4b4 !important;
    border-left-color: #c47a7a;
}

html.cs-dark .billing-warn {
    background: #332b1c !important;
    color: #ead9b0 !important;
}

html.cs-dark .prac-green { color: #8fca9e !important; }
html.cs-dark .prac-blue { color: #8eb4cc !important; }
html.cs-dark .prac-purple { color: #b5a4c9 !important; }
html.cs-dark .prac-orange { color: #d4bc7a !important; }
html.cs-dark .prac-default { color: var(--cs-green-ink) !important; }
