/* BPM Therapy admin — built from the Figma design. Plain CSS, no build step. */
:root {
    --green: #1f9d36;
    --green-600: #178a2d;
    --green-dark: #015c03;
    --green-soft: #e8f6eb;
    --green-softer: #f2faf3;
    --gradient: linear-gradient(90deg, #4cbf33 0%, #015c03 100%);
    --bg: #edf7ef;
    --card: #ffffff;
    --border: #e6e9ee;
    --border-soft: #f0f2f5;
    --text: #0f172a;
    --text-2: #334155;
    --muted: #64748b;
    --faint: #94a3b8;
    --link: #4f46e5;
    --blue: #3b82f6;
    --amber: #f59e0b;
    --red: #ef4444;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 2px 10px rgba(16, 94, 30, .06);
    --shadow-lg: 0 10px 30px rgba(1, 92, 3, .08);
    --sidebar-w: 256px;
    --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-head: 'Plus Jakarta Sans', var(--font);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; color: var(--text); }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.ic { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Shell ── */
.shell { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: #fff;
    border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 40;
    transition: transform .2s ease;
}
.brand { display: flex; justify-content: center; padding: 22px 20px 18px; }
.brand img { width: 92px; height: 92px; border-radius: 50%; box-shadow: 0 4px 14px rgba(1, 92, 3, .16); }
.brand-name { font-family: var(--font-head); font-weight: 700; color: var(--green-dark); font-size: 15px; line-height: 1.2; }
.brand-tag { font-size: 11px; color: #d97706; font-weight: 500; }
.nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 14px 12px 6px; }
.nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
    color: #475569; font-weight: 500;
}
.nav a:hover { background: var(--green-softer); color: var(--green); }
.nav a.active { background: var(--gradient); color: #fff; box-shadow: 0 4px 12px rgba(31, 157, 54, .22); }
.nav a .count { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--green-soft); color: var(--green); padding: 1px 8px; border-radius: 99px; }
.nav a.active .count { background: rgba(255, 255, 255, .22); color: #fff; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border-soft); }
.sidebar-foot button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; background: none; border-radius: var(--radius-sm); color: #475569; font-weight: 500; cursor: pointer; }
.sidebar-foot button:hover { background: #fef2f2; color: var(--red); }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30; height: 68px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 16px; padding: 0 28px;
}
.menu-btn { display: none; border: 0; background: none; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--text-2); }
.search { position: relative; flex: 1; max-width: 420px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { width: 100%; height: 40px; border: 1px solid var(--border); background: #f8fafc; border-radius: var(--radius-sm); padding: 0 14px 0 38px; outline: none; }
.search input:focus { border-color: var(--green); background: #fff; box-shadow: 0 0 0 3px rgba(31, 157, 54, .12); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.bell { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--text-2); }
.bell:hover { background: var(--green-softer); color: var(--green); }
.bell-dot { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.me { display: flex; align-items: center; gap: 10px; }
.me-name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.me-role { font-size: 11.5px; color: var(--muted); }
.content { padding: 28px; flex: 1; width: 100%; max-width: 1440px; }
.backdrop { display: none; }

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .shell.nav-open .sidebar { transform: none; }
    .shell.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 35; }
    .main { margin-left: 0; }
    .menu-btn { display: inline-flex; }
    .topbar { padding: 0 16px; }
    .content { padding: 20px 16px; }
    .me-text { display: none; }
}

/* ── Page header ── */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 12px; }
.page-sub { color: var(--muted); margin-top: 4px; }
.back { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: 10px; color: var(--text-2); }
.back:hover { background: #fff; }
.back svg { width: 22px; height: 22px; }
.crumbs { font-size: 12.5px; color: var(--faint); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.crumbs a:hover { color: var(--green); }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px;
    border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 600; cursor: pointer; white-space: nowrap; font-size: 14px;
}
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 6px 16px rgba(31, 157, 54, .22); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--green); }
.btn-outline:hover { background: var(--green-softer); }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { background: #f8fafc; }
.btn-lg { height: 50px; font-size: 15px; padding: 0 26px; }
.btn-block { width: 100%; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.link { color: var(--link); font-weight: 500; font-size: 13px; display: inline-flex; align-items: center; gap: 2px; }
.link:hover { text-decoration: underline; }
.link-green { color: var(--green); }

/* ── Cards ── */
.card { background: var(--card); border: 1px solid #e3eee6; border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; gap: 12px; }
.card-title { font-size: 15.5px; font-weight: 700; }
.section-title { font-size: 16px; font-weight: 700; margin: 26px 0 12px; display: flex; align-items: center; justify-content: space-between; }
.section-title:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.split-wide { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ── Stat cards ── */
.stat { display: flex; align-items: center; justify-content: space-between; padding: 20px; }
.stat-label { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 700; font-family: var(--font-head); line-height: 1.1; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; }
.stat-icon svg { width: 22px; height: 22px; }
.tint-indigo { background: #eef2ff; color: #6366f1; }
.tint-blue { background: #eff6ff; color: var(--blue); }
.tint-green { background: #ecfdf5; color: #10b981; }
.tint-amber { background: #fef9e7; color: var(--amber); }
.tint-red { background: #fef2f2; color: var(--red); }
.tint-gray { background: #f1f5f9; color: var(--muted); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); background: #f9fafb; padding: 12px 16px; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
.tbl td { padding: 16px; color: var(--muted); border-bottom: 1px solid var(--border-soft); }
.tbl th:first-child, .tbl td:first-child { padding-left: 20px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #fafcfa; }
.tbl .strong { color: var(--text); font-weight: 600; }
.tbl a.row-link { display: inline-flex; align-items: center; gap: 10px; color: var(--text-2); }
.empty { padding: 40px 20px; text-align: center; color: var(--faint); }
.empty svg { width: 34px; height: 34px; margin-bottom: 8px; color: #cbd5e1; }

/* ── Avatars & badges ── */
.av { display: inline-grid; place-items: center; border-radius: 50%; width: 28px; height: 28px; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.av-md { width: 40px; height: 40px; font-size: 14px; }
.av-lg { width: 64px; height: 64px; font-size: 22px; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--green-soft); }
.av-rose { background: #fee2e2; color: #e11d48; }
.av-blue { background: #dbeafe; color: #2563eb; }
.av-green { background: #dcfce7; color: #16a34a; }
.av-amber { background: #fef3c7; color: #d97706; }
.av-indigo { background: #e0e7ff; color: #4f46e5; }
.av-gray { background: #f1f5f9; color: #475569; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-green { background: #e7f6ea; color: #15803d; }
.badge-amber { background: #fff4e5; color: #ea7a0c; }
.badge-blue { background: #e8f0fe; color: #2563eb; }
.badge-gray { background: #f1f5f9; color: #64748b; }
.badge-red { background: #fef2f2; color: #dc2626; }
.badge-outline { background: #fff; border: 1px solid currentColor; }

/* ── Filters (pills) ── */
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { padding: 8px 16px; border-radius: 99px; background: #fff; border: 1px solid var(--border); font-weight: 500; color: var(--text-2); font-size: 13.5px; }
.pill:hover { border-color: var(--green); color: var(--green); }
.pill.active { background: var(--gradient); color: #fff; border-color: transparent; }

/* ── Client list rows ── */
.client-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border-soft); }
.client-row:last-child { border-bottom: 0; }
.client-row:hover { background: #fafcfa; }
.client-name { font-weight: 600; color: var(--text); }
.client-id { font-size: 12.5px; color: var(--faint); margin-top: 2px; }
.client-meta { margin-left: auto; display: flex; align-items: center; gap: 24px; color: var(--muted); font-size: 13px; }
.client-meta .col { min-width: 120px; }
.client-meta .col small { display: block; color: var(--faint); font-size: 11.5px; }
.chev { color: var(--faint); }
@media (max-width: 900px) { .client-meta .col { display: none; } }

/* ── Profile header ── */
.profile { display: flex; align-items: center; gap: 16px; padding: 18px 20px; }
.profile-name { font-size: 18px; font-weight: 700; font-family: var(--font-head); }
.profile-sub { color: var(--muted); font-size: 13px; margin: 2px 0 6px; }
.profile-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 720px) { .profile { flex-wrap: wrap; } .profile-actions { margin-left: 0; width: 100%; } }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 20px 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 12px 16px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--green); }
.tab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 600; }

/* ── Timeline ── */
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: #dbe7f5; }
.tl-item { position: relative; padding-bottom: 22px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: -30px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.tl-dot::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.tl-dot.ring { border: 2px solid var(--green); }
.tl-dot.amber::after { background: var(--amber); } .tl-dot.amber.ring { border-color: var(--amber); }
.tl-dot.blue::after { background: var(--blue); } .tl-dot.blue.ring { border-color: var(--blue); }
.tl-dot.gray::after { background: #cbd5e1; }
.tl-date { font-size: 12px; color: var(--faint); font-weight: 500; }
.tl-title { font-weight: 700; font-size: 15px; margin: 2px 0; }
.tl-text { color: var(--muted); font-size: 13.5px; }
.tl-tag { margin-left: 8px; vertical-align: middle; }

/* ── Info rows / list items ── */
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; color: var(--text); text-align: right; }
.item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.item + .item { border-top: 1px solid var(--border-soft); }
.item-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: #f1f5f9; color: var(--muted); flex-shrink: 0; }
.item-title { font-weight: 600; color: var(--text); }
.item-sub { font-size: 12.5px; color: var(--faint); margin-top: 2px; }
.item-end { margin-left: auto; text-align: right; font-weight: 500; color: var(--text-2); }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); }
.checklist svg { color: var(--green); margin-top: 1px; }

/* ── Approved banner ── */
.banner { display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; border-radius: var(--radius); border: 1px solid #bfe6c8; background: var(--green-softer); }
.banner-icon { width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.banner-icon svg { width: 16px; height: 16px; stroke-width: 3; }
.banner.amber { border-color: #fde3b0; background: #fffaf0; }
.banner.amber .banner-icon { background: var(--amber); }
.banner-title { font-weight: 700; font-family: var(--font-head); font-size: 15px; }
.banner-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ── Rich content (plan / notes HTML) ── */
.prose { color: var(--text-2); line-height: 1.65; font-size: 14px; }
.prose h1, .prose h2, .prose h3 { font-size: 15px; margin: 18px 0 8px; }
.prose ul, .prose ol { padding-left: 20px; margin: 8px 0; }
.prose p { margin: 8px 0; }

/* ── Forms ── */
.form-card { padding: 24px; }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.field label, .label { font-weight: 500; color: var(--text-2); font-size: 13.5px; }
.field .req { color: var(--red); }
.input, .select, .textarea {
    width: 100%; height: 46px; border: 1px solid #e3eee6; border-radius: 12px; background: #fff;
    padding: 0 14px; outline: none; box-shadow: 0 2px 8px rgba(16, 94, 30, .06); transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 104px; padding: 12px 14px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31, 157, 54, .12); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.hint { font-size: 12px; color: var(--faint); }
.counter { font-size: 12px; color: var(--faint); text-align: right; margin-top: -2px; }
.error { font-size: 12.5px; color: var(--red); }
.has-error .input, .has-error .select, .has-error .textarea { border-color: #fca5a5; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.input-icon { position: relative; }
.input-icon .input { padding-right: 44px; }
.input-icon button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); padding: 6px; cursor: pointer; border-radius: 8px; }

/* Choice cards (follow-up status) */
.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice > span { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; cursor: pointer; font-weight: 500; color: var(--text-2); font-size: 13.5px; }
.choice .ci { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid currentColor; }
.choice .ci svg { width: 15px; height: 15px; }
.choice.up .ci { color: var(--green); } .choice.flat .ci { color: var(--muted); } .choice.down .ci { color: var(--red); }
.choice input:checked + span { border: 2px solid var(--green); background: var(--green-softer); color: var(--green); }
.choice.up input:checked + span .ci { background: var(--green); color: #fff; border-color: var(--green); }
.choice.flat input:checked + span .ci { background: var(--muted); color: #fff; }
.choice.down input:checked + span { border-color: var(--red); background: #fef2f2; color: var(--red); }
.choice.down input:checked + span .ci { background: var(--red); color: #fff; }

.rating-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.rating-row .select { width: 140px; height: 40px; }

.checks { display: flex; flex-direction: column; gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text-2); }
.check input { width: 18px; height: 18px; accent-color: var(--green); }

/* Upload drop zone */
.drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; border: 2px dashed #6cc47d; background: var(--green-softer); border-radius: var(--radius); padding: 34px 20px; cursor: pointer; transition: background .15s; }
.drop:hover, .drop.drag { background: #e3f4e7; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop svg { width: 40px; height: 40px; color: var(--blue); }
.drop strong { color: var(--text); }
.drop small { color: var(--faint); }
.drop .file-name { margin-top: 6px; color: var(--green); font-weight: 600; }

/* ── Chart ── */
.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; justify-content: center; gap: 18px; font-size: 12.5px; color: var(--text-2); margin-bottom: 4px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }

/* ── Flash ── */
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-weight: 500; }
.flash-success { background: #e7f6ea; color: #15803d; border: 1px solid #bfe6c8; }
.flash-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* ── Pagination ── */
.pager { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-top: 1px solid var(--border-soft); color: var(--muted); font-size: 13px; }
.pager-links { display: flex; gap: 6px; }

/* ── Login ── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 50% -10%, #dff2e3 0%, #eef7ef 45%, #f4f9f5 100%); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 22px; padding: 36px 32px 28px; box-shadow: var(--shadow-lg); border: 1px solid #e3efe5; }
.auth-logo { display: block; width: 112px; height: 112px; margin: 0 auto 10px; border-radius: 50%; box-shadow: 0 6px 18px rgba(1, 92, 3, .15); }
.auth-title { text-align: center; font-size: 22px; font-weight: 700; margin-top: 6px; }
.auth-sub { text-align: center; color: var(--muted); margin: 4px 0 26px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 22px; }
.auth-foot a { color: var(--green-dark); font-weight: 700; }
.remember { display: flex; align-items: center; justify-content: space-between; margin: -4px 0 18px; font-size: 13px; }

/* ── Client table (desktop design) ── */
.table-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; flex-wrap: wrap; }
.table-tools .search { max-width: 340px; }
.table-tools .search input { background: #f8fbf8; }
.tbl .num { color: var(--faint); width: 40px; }
.tbl .person { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; }
.tbl .person small { display: block; font-weight: 400; color: var(--faint); font-size: 12px; }
.tbl tbody tr { cursor: pointer; }
.pages { display: flex; gap: 6px; }
.pages a, .pages span { min-width: 32px; height: 32px; padding: 0 8px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); background: #fff; font-weight: 600; font-size: 13px; color: var(--text-2); }
.pages a:hover { border-color: var(--green); color: var(--green); }
.pages .current { background: var(--gradient); color: #fff; border-color: transparent; }
.pages .disabled { color: #cbd5e1; }
.tbl.nowrap td { white-space: nowrap; }

/* ── Role picker & switch (user form) ── */
.role-option { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; background: #fff; }
.role-option:hover { border-color: #b7dfc0; }
.role-option input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--green); flex-shrink: 0; }
.role-option strong { display: block; color: var(--text); font-weight: 600; }
.role-option small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; line-height: 1.45; }
.role-option:has(input:checked) { border: 2px solid var(--green); background: var(--green-softer); padding: 11px 13px; }
.switch { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.switch input[type=checkbox] { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { width: 42px; height: 24px; border-radius: 99px; background: #cbd5e1; position: relative; flex-shrink: 0; transition: background .15s; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:disabled + .switch-track { opacity: .55; }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgba(31, 157, 54, .25); }
.switch strong { display: block; font-weight: 600; }
.switch small { display: block; color: var(--muted); font-size: 12.5px; }

/* ── Word-like documents (editor + viewer) ── */
.doc-shell { background: #e8eeea; border: 1px solid #dbe5de; border-radius: var(--radius); padding: 18px; }
.doc-paper-head, .doc-sheet-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.doc-paper-head { background: #fff; border-radius: 10px 10px 0 0; padding: 18px 24px; border-bottom: 2px solid var(--green); max-width: 210mm; margin: 0 auto; }
.doc-type { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--green); }
.doc-title, .doc-sheet-title { font-family: var(--font-head); font-size: 20px; font-weight: 700; color: var(--text); margin: 2px 0 0; }
.doc-meta { display: grid; grid-template-columns: repeat(2, auto); gap: 4px 18px; margin: 0; font-size: 12px; }
.doc-meta dt { color: var(--faint); }
.doc-meta dd { margin: 0; color: var(--text-2); font-weight: 600; }
.doc-shell .jodit-container { max-width: 210mm; margin: 0 auto; border: 0 !important; border-radius: 0 0 10px 10px !important; overflow: hidden; }
.doc-shell .jodit-toolbar__box { background: #f8faf9 !important; border-bottom: 1px solid var(--border) !important; }
.doc-shell .jodit-workplace { background: #fff; }
.doc-page, .doc-shell .jodit-wysiwyg { padding: 18mm 20mm !important; font-family: 'Calibri', 'Carlito', var(--font); font-size: 11pt; line-height: 1.5; color: #1f2937; }
.doc-source { display: none; width: 100%; min-height: 360px; }
.doc-page table, .doc-body table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.doc-page td, .doc-page th, .doc-body td, .doc-body th { border: 1px solid #cbd5e1; padding: 6px 8px; vertical-align: top; text-align: left; }
.doc-page h1, .doc-body h1 { font-size: 18pt; } .doc-page h2, .doc-body h2 { font-size: 14pt; color: #14532d; } .doc-page h3, .doc-body h3 { font-size: 12pt; }

.doc-viewer { background: #e8eeea; border: 1px solid #dbe5de; border-radius: var(--radius); padding: 22px 16px; }
.doc-sheet { position: relative; background: #fff; max-width: 210mm; min-height: 240mm; margin: 0 auto; padding: 16mm 18mm; box-shadow: 0 6px 24px rgba(15, 23, 42, .10); border-radius: 4px; overflow: hidden; }
.doc-sheet-head { border-bottom: 2px solid var(--green); padding-bottom: 12px; margin-bottom: 16px; }
.doc-body { font-family: 'Calibri', 'Carlito', var(--font); font-size: 11pt; line-height: 1.55; color: #1f2937; overflow-wrap: anywhere; }
.doc-body p { margin: 0 0 8px; }
.doc-watermark { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-24deg); font-size: 64px; font-weight: 800; color: rgba(217, 119, 6, .10); pointer-events: none; white-space: nowrap; letter-spacing: .1em; }
.doc-files { margin-top: 18px; border-top: 1px dashed var(--border); padding-top: 14px; }
.file-preview { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #f8fafc; margin-top: 10px; }
.file-preview iframe { width: 100%; height: 640px; border: 0; display: block; background: #fff; }
.file-preview img { display: block; max-width: 100%; margin: 0 auto; }
.file-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--border); font-size: 13px; }

.meta-list { margin: 0; }
.meta-list .kv { padding: 7px 0; border-bottom: 1px solid var(--border-soft); }
.meta-list .kv:last-child { border-bottom: 0; }
.lock { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 13px; }
.lock-open { background: #ecfdf3; color: #166534; border: 1px solid #bbf7d0; }
.lock-closed { background: #f1f5f9; color: #475569; border: 1px solid var(--border); }
.lock-void { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.type-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.type-clinical_note { background: #eef2ff; color: #4338ca; }
.type-clinical_finding { background: #e0f2fe; color: #0369a1; }
.type-report { background: #ecfdf5; color: #047857; }
.type-prescription { background: #fff7ed; color: #c2410c; }
.type-addendum { background: #f5f3ff; color: #6d28d9; }
.voided { opacity: .65; }
.voided .item-title { text-decoration: line-through; }
.diff-box { max-height: 360px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: #fff; }

@media print {
    .sidebar, .topbar, .page-head, .no-print, .tabs, .flash, .backdrop { display: none !important; }
    .main { margin: 0 !important; }
    .content { padding: 0 !important; }
    body, .doc-viewer { background: #fff !important; }
    .doc-viewer { border: 0; padding: 0; }
    .doc-sheet { box-shadow: none; max-width: none; min-height: 0; padding: 0; }
    .split { display: block !important; }
}

/* ── Client header (desktop design) ── */
.client-head { display: flex; align-items: center; gap: 18px; padding: 22px 24px; }
.client-photo { width: 56px; height: 56px; border-radius: 50%; background: #f1f5f9; border: 1px solid var(--border); display: grid; place-items: center; color: #94a3b8; flex-shrink: 0; }
.client-photo svg { width: 26px; height: 26px; fill: #94a3b8; stroke: none; }
.client-head-main { flex: 1; min-width: 0; }
.client-head-name { font-family: var(--font-head); font-size: 19px; font-weight: 700; color: var(--text); }
.client-head-id { color: var(--green); font-size: 14px; font-weight: 700; margin-right: 4px; letter-spacing: .02em; }
.client-head-facts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; color: var(--muted); font-size: 13px; }
.client-head-facts > span + span:not(.badge) { padding-left: 8px; border-left: 1px solid var(--border); }
.client-head-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.client-head-review { padding-left: 24px; border-left: 1px solid var(--border); min-width: 130px; }
.client-head-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.client-head-date { font-weight: 700; color: var(--text); margin-top: 6px; }
@media (max-width: 720px) { .client-head { flex-wrap: wrap; } .client-head-review { border-left: 0; padding-left: 0; width: 100%; } }

/* ── Prescription upload (desktop design) ── */
.rx-card { padding: 24px; }
.rx-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.rx-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 8px; }
@media (max-width: 860px) { .rx-grid { grid-template-columns: 1fr; } }
.rx-drop { min-height: 280px; border: 2px dashed #22a33a; background: #fafcfb; gap: 8px; }
.rx-drop-icon { width: 48px; height: 48px; border-radius: 10px; background: #e7f6ea; display: grid; place-items: center; color: var(--green); margin-bottom: 6px; }
.rx-drop-icon svg { width: 24px; height: 24px; color: var(--green); }
.rx-drop strong { font-size: 14.5px; }
.rx-drop-sub { font-size: 13px; color: var(--muted); }
.rx-drop .link-green { color: var(--green); font-weight: 500; }
.rx-drop:focus-within { outline: 3px solid rgba(31, 157, 54, .25); outline-offset: 2px; }
.rx-preview { position: relative; min-height: 280px; border-radius: 12px; background: #f4ede2; border: 1px solid #e8dfcf; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.rx-preview img { display: block; max-width: 100%; max-height: 520px; object-fit: contain; }
.rx-preview iframe { width: 100%; height: 520px; border: 0; background: #fff; }
.rx-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; color: #a8957a; font-size: 13px; text-align: center; padding: 20px; }
.rx-empty svg { width: 32px; height: 32px; }
.rx-clear { position: absolute; top: 12px; right: 12px; z-index: 2; width: 26px; height: 26px; border-radius: 6px; border: 0; background: #334155; color: #fff; display: grid; place-items: center; cursor: pointer; }
.rx-clear svg { width: 15px; height: 15px; }
.rx-clear:hover { background: #0f172a; }
.rx-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.btn-soft { background: #dcfce7; border-color: #86efac; color: #15803d; }
.btn-soft:hover { background: #bbf7d0; }
[hidden] { display: none !important; }
