/* ============================================================
   PHYSIO PULSE — Design System v2
   White · Compact · Apple-inspired
   ============================================================ */

/* ============ RESET ============ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-tap-highlight-color: transparent;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; transition: all 0.15s ease; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }

/* ============ TOKENS ============ */
:root {
    /* Brand */
    --primary:      #0CC0DF;
    --primary-dark: #0097B2;
    --primary-soft: rgba(12, 192, 223, 0.08);
    --primary-tint: rgba(12, 192, 223, 0.12);

    /* Semantic */
    --success:      #10B981;
    --warning:      #F59E0B;
    --danger:       #EF4444;
    --info:         #3B82F6;

    /* Surface */
    --bg:       #FAFAFA;
    --bg-2:     #F5F5F7;
    --card:     #FFFFFF;
    --sidebar:  #FFFFFF;

    /* Text */
    --text:     #1D1D1F;
    --text-2:   #6E6E73;
    --text-3:   #A1A1A6;

    /* Lines */
    --line:     #E8E8ED;
    --line-2:   #F2F2F5;

    /* Effects — Apple uses very subtle shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);

    --gradient: linear-gradient(135deg, #0CC0DF 0%, #0097B2 100%);

    --r-xs: 8px;
    --r-sm: 10px;
    --r:    12px;
    --r-lg: 16px;

    --sidebar-w: 232px;
    --header-h:  60px;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --dur:  0.15s;
}

/* ============================================================
   AUTH / LOGIN
   ============================================================ */
.auth-body {
    background: linear-gradient(135deg, #F5F5F7 0%, #E8F6FA 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-wrap { width: 100%; max-width: 400px; }
.auth-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px 32px 28px;
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.04),
        0 20px 50px rgba(0, 0, 0, 0.06);
}
.auth-brand { text-align: center; margin-bottom: 28px; }
.auth-logo-wrap {
    width: 56px; height: 56px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    border-radius: 16px;
}
.auth-logo { width: 36px; height: 36px; object-fit: contain; }
.auth-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
}
.auth-title .accent {
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.auth-subtitle {
    font-size: 12.5px;
    color: var(--text-2);
    margin-top: 4px;
    font-weight: 500;
}
.auth-alert {
    background: rgba(239, 68, 68, 0.06);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: var(--r);
    padding: 10px 14px;
    font-size: 12.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    font-weight: 500;
}
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}
.auth-input-wrap {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r);
    transition: all var(--dur) var(--ease);
}
.auth-input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(12, 192, 223, 0.12);
}
.auth-input-wrap > i {
    padding-left: 14px;
    color: var(--text-3);
    font-size: 13px;
    transition: color var(--dur) var(--ease);
}
.auth-input-wrap:focus-within > i { color: var(--primary); }
.auth-input-wrap input {
    flex: 1;
    padding: 12px 14px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 13.5px;
    color: var(--text);
    font-weight: 500;
}
.auth-input-wrap input::placeholder { color: var(--text-3); font-weight: 400; }
.pw-toggle {
    padding: 0 14px;
    color: var(--text-3);
    font-size: 13px;
    transition: color var(--dur) var(--ease);
}
.pw-toggle:hover { color: var(--primary); }
.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    background: var(--gradient);
    color: #fff;
    border-radius: var(--r);
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.1px;
    box-shadow: 0 4px 12px rgba(12, 192, 223, 0.25);
    transition: all var(--dur) var(--ease);
    margin-top: 4px;
}
.auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(12, 192, 223, 0.35);
}
.auth-btn i { font-size: 12px; transition: transform var(--dur) var(--ease); }
.auth-btn:hover i { transform: translateX(2px); }
.auth-footer {
    text-align: center;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line-2);
}
.auth-footer > p:first-child {
    font-size: 10.5px;
    color: var(--text-3);
    font-weight: 500;
}
.auth-credit {
    font-size: 10.5px;
    color: var(--text-3);
    margin-top: 6px;
}
.auth-credit a { color: var(--primary-dark); font-weight: 600; }

/* ============================================================
   ADMIN LAYOUT — LIGHT + COMPACT
   ============================================================ */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

/* ---------- Sidebar (LIGHT) ---------- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    transition: transform 0.25s var(--ease);
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 18px 16px;
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
    letter-spacing: -0.3px;
    border-bottom: 1px solid var(--line-2);
}
.sidebar-brand img {
    width: 28px; height: 28px;
    border-radius: 8px;
    object-fit: cover;
}
.sidebar-brand .accent { color: var(--primary-dark); }

.sidebar-nav {
    flex: 1;
    padding: 10px 10px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    transition: all var(--dur) var(--ease);
    margin-bottom: 1px;
    position: relative;
}
.nav-item i {
    width: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-3);
    transition: color var(--dur) var(--ease);
}
.nav-item:hover {
    background: var(--bg-2);
    color: var(--text);
}
.nav-item:hover i { color: var(--text-2); }
.nav-item.active {
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 600;
}
.nav-item.active i { color: var(--primary-dark); }
.nav-item.active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-divider {
    height: 1px;
    background: var(--line-2);
    margin: 10px 10px;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--line-2);
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-2);
}
.doctor-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.doctor-mini .avatar {
    width: 32px; height: 32px;
    border-radius: 9px;
    background: var(--gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}
.doctor-mini .meta { min-width: 0; flex: 1; }
.doctor-mini .name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.doctor-mini .clinic {
    font-size: 10px;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.logout-btn {
    width: 30px; height: 30px;
    border-radius: 8px;
    background: transparent;
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    transition: all var(--dur) var(--ease);
}
.logout-btn:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
}

/* ---------- Main ---------- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.topbar {
    height: var(--header-h);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 50;
}
.menu-toggle {
    display: none;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    align-items: center;
    justify-content: center;
    transition: background var(--dur) var(--ease);
}
.menu-toggle:hover { background: var(--bg-2); }
.page-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.3px;
    flex: 1;
    color: var(--text);
}
.topbar-right .today {
    font-size: 12px;
    color: var(--text-2);
    font-weight: 500;
    padding: 5px 10px;
    background: var(--bg-2);
    border-radius: 8px;
}
.content {
    padding: 20px 24px 60px;
}
@media (min-width: 1100px) {
    .content { max-width: 1320px; }
}

/* ============================================================
   KPI CARDS — Compact
   ============================================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.kpi-card {
    background: var(--card);
    border-radius: var(--r-lg);
    padding: 16px;
    display: flex;
    gap: 12px;
    border: 1px solid var(--line);
    transition: all var(--dur) var(--ease);
}
.kpi-card:hover {
    border-color: var(--primary);
    box-shadow: 0 1px 3px rgba(12, 192, 223, 0.08);
}
.kpi-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}
.kpi-primary .kpi-icon { background: var(--primary-soft); color: var(--primary-dark); }
.kpi-info    .kpi-icon { background: rgba(59, 130, 246, 0.08); color: var(--info); }
.kpi-success .kpi-icon { background: rgba(16, 185, 129, 0.08); color: var(--success); }
.kpi-warning .kpi-icon { background: rgba(245, 158, 11, 0.08); color: var(--warning); }

.kpi-body { flex: 1; min-width: 0; }
.kpi-label {
    font-size: 11px;
    color: var(--text-2);
    font-weight: 500;
    margin-bottom: 2px;
}
.kpi-value {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.6px;
    line-height: 1.1;
    color: var(--text);
    margin-bottom: 4px;
}
.kpi-sub { font-size: 11px; color: var(--text-2); font-weight: 500; }
.kpi-sub a { color: var(--primary-dark); font-weight: 600; }

/* ============================================================
   REVENUE STRIP — Compact
   ============================================================ */
.revenue-strip {
    background: var(--card);
    border-radius: var(--r-lg);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 24px;
    border: 1px solid var(--line);
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.rev-item { flex: 1; min-width: 120px; }
.rev-label {
    font-size: 10.5px;
    color: var(--text-2);
    font-weight: 500;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.rev-value {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text);
}
.rev-value.success { color: var(--success); }
.rev-value.warning { color: var(--warning); }
.rev-value.danger  { color: var(--danger); }
.rev-divider { width: 1px; height: 32px; background: var(--line); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--card);
    border-radius: var(--r-lg);
    border: 1px solid var(--line);
    overflow: hidden;
}
.card-header {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line-2);
}
.card-header h3 {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.1px;
    color: var(--text);
}
.card-header h3 i { color: var(--text-2); font-size: 12px; }
.link-small {
    font-size: 11.5px;
    color: var(--primary-dark);
    font-weight: 600;
}
.link-small:hover { text-decoration: underline; }

/* ============================================================
   CHARTS
   ============================================================ */
.chart-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.chart-card { padding: 18px; }
.chart-wrap { height: 220px; position: relative; margin-top: 4px; }

/* ============================================================
   TWO COLUMN
   ============================================================ */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

/* ============================================================
   LISTS
   ============================================================ */
.list { padding: 2px 0; }
.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--line-2);
    transition: background var(--dur) var(--ease);
}
.list-item:last-child { border-bottom: none; }
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover { background: var(--bg-2); }

.li-time {
    text-align: center;
    background: var(--primary-soft);
    border-radius: 8px;
    padding: 5px 8px;
    min-width: 54px;
    flex-shrink: 0;
}
.li-time strong {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1.1;
}
.li-time span {
    font-size: 9px;
    color: var(--primary-dark);
    font-weight: 600;
    letter-spacing: 0.3px;
    opacity: 0.7;
}
.li-avatar {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}
.li-body { flex: 1; min-width: 0; }
.li-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.1px;
}
.li-sub {
    font-size: 11px;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
.li-right { flex-shrink: 0; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.2px;
    text-transform: capitalize;
}
.badge-success { background: rgba(16, 185, 129, 0.1); color: #047857; }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: #92400E; }
.badge-danger  { background: rgba(239, 68, 68, 0.1);  color: #B91C1C; }
.badge-info    { background: rgba(59, 130, 246, 0.1); color: #1D4ED8; }
.badge-muted   { background: var(--bg-2); color: var(--text-2); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--r);
    font-size: 12.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    margin-bottom: 16px;
}
.alert-warning {
    background: rgba(245, 158, 11, 0.06);
    color: #92400E;
    border: 1px solid rgba(245, 158, 11, 0.2);
}
.alert-warning a { color: var(--warning); font-weight: 600; }
.alert-danger {
    background: rgba(239, 68, 68, 0.06);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.15);
}
.alert-success {
    background: rgba(16, 185, 129, 0.06);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-2);
}
.empty-state.small { padding: 28px 20px; }
.empty-state i {
    font-size: 28px;
    color: var(--line);
    margin-bottom: 10px;
    display: block;
}
.empty-state p { font-size: 12.5px; font-weight: 500; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.1px;
    transition: all var(--dur) var(--ease);
    cursor: pointer;
    white-space: nowrap;
}
.btn-primary {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 2px 8px rgba(12, 192, 223, 0.25);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(12, 192, 223, 0.35);
}
.btn-secondary {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--line);
}
.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary-dark);
}
.btn-ghost {
    background: transparent;
    color: var(--text-2);
}
.btn-ghost:hover { background: var(--bg-2); color: var(--text); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 11.5px; }
.btn-lg { padding: 11px 20px; font-size: 13.5px; }

/* ============================================================
   PHASE 2 — PATIENTS
   ============================================================ */

/* ===== Stats strip ===== */
.patients-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.pstat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 14px 16px;
    transition: all var(--dur) var(--ease);
    cursor: pointer;
}
.pstat:hover {
    border-color: var(--primary);
}
.pstat.active {
    border-color: var(--primary);
    background: var(--primary-soft);
}
.pstat-label {
    font-size: 11px;
    color: var(--text-2);
    font-weight: 500;
    margin-bottom: 4px;
}
.pstat-value {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
}

/* ===== Toolbar ===== */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.toolbar-search {
    flex: 1;
    min-width: 260px;
    position: relative;
    display: flex;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    transition: all var(--dur) var(--ease);
}
.toolbar-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(12, 192, 223, 0.1);
}
.toolbar-search > i.fa-search {
    padding-left: 14px;
    color: var(--text-3);
    font-size: 13px;
}
.toolbar-search input {
    flex: 1;
    padding: 9px 12px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
}
.toolbar-search input::placeholder { color: var(--text-3); font-weight: 400; }
.toolbar-clear {
    padding: 6px 12px;
    color: var(--text-3);
    transition: color var(--dur) var(--ease);
}
.toolbar-clear:hover { color: var(--danger); }

.toolbar-sort {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 0 12px;
}
.toolbar-sort label {
    font-size: 11.5px;
    color: var(--text-2);
    font-weight: 500;
}
.toolbar-sort select {
    border: none;
    outline: none;
    background: transparent;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text);
    padding: 9px 0;
    cursor: pointer;
    font-family: inherit;
}

.toolbar-dates {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 0 12px;
}
.toolbar-dates > i { color: var(--text-3); font-size: 12px; }
.toolbar-dates input[type="date"] {
    border: none;
    outline: none;
    background: transparent;
    font-size: 12px;
    font-family: inherit;
    font-weight: 500;
    color: var(--text);
    padding: 9px 0;
    cursor: pointer;
}
.toolbar-dates > span {
    font-size: 11px;
    color: var(--text-2);
    font-weight: 500;
}
.toolbar-apply {
    padding: 6px 12px;
    background: var(--gradient);
    color: #fff;
    border-radius: 7px;
    font-size: 11.5px;
    font-weight: 600;
    margin: 5px 0;
    cursor: pointer;
}

/* ===== Patient Grid ===== */
.patient-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}
.patient-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all var(--dur) var(--ease);
}
.patient-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(12, 192, 223, 0.08);
    transform: translateY(-1px);
}
.pc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.pc-avatar {
    width: 36px; height: 36px;
    border-radius: 9px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}
.pc-body { flex: 1; }
.pc-name {
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.1px;
    color: var(--text);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pc-meta {
    font-size: 11.5px;
    color: var(--text-2);
    font-weight: 500;
}
.pc-concern {
    font-size: 11px;
    color: var(--text-2);
    margin-top: 6px;
    padding: 5px 8px;
    background: var(--bg-2);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pc-concern i { color: var(--primary-dark); font-size: 9px; flex-shrink: 0; }
.pc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--line-2);
    font-size: 11.5px;
    color: var(--text-2);
    font-weight: 500;
}
.pc-footer span { display: flex; align-items: center; gap: 5px; }
.pc-footer .muted { color: var(--text-3); font-style: italic; }
.pc-arrow {
    color: var(--text-3);
    font-size: 10px;
    transition: all var(--dur) var(--ease);
}
.patient-card:hover .pc-arrow {
    color: var(--primary);
    transform: translateX(2px);
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 10px;
}
.page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    transition: all var(--dur) var(--ease);
    cursor: pointer;
}
.page-btn:hover:not(.active):not(.disabled) {
    border-color: var(--primary);
    color: var(--primary-dark);
}
.page-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.page-btn.disabled { opacity: 0.4; cursor: not-allowed; }
.page-dots { padding: 0 4px; color: var(--text-3); font-weight: 600; }
.pagination-info {
    text-align: center;
    font-size: 11.5px;
    color: var(--text-2);
    margin-bottom: 16px;
}

/* ============================================================
   PATIENT DETAIL
   ============================================================ */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-2);
    margin-bottom: 14px;
}
.back-link:hover { color: var(--primary-dark); }
.back-link i { font-size: 11px; transition: transform var(--dur) var(--ease); }
.back-link:hover i { transform: translateX(-2px); }

.patient-header {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 14px;
    position: relative;
    overflow: hidden;
}
.patient-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient);
}
.ph-avatar {
    width: 56px; height: 56px;
    border-radius: 14px;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.ph-body { flex: 1; position: relative; z-index: 1; }
.ph-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.ph-top h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
}
.ph-meta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-2);
    font-weight: 500;
}
.ph-meta span { display: flex; align-items: center; gap: 5px; }
.ph-meta i { color: var(--text-3); font-size: 10px; }

/* ===== Patient KPIs ===== */
.patient-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}
.pk {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 12px 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    transition: all var(--dur) var(--ease);
}
.pk:hover { border-color: var(--primary); }
.pk-icon {
    width: 34px; height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.pk-primary { background: var(--primary-soft); color: var(--primary-dark); }
.pk-success { background: rgba(16, 185, 129, 0.08); color: var(--success); }
.pk-info    { background: rgba(59, 130, 246, 0.08); color: var(--info); }
.pk-warning { background: rgba(245, 158, 11, 0.08); color: var(--warning); }
.pk-body { flex: 1; min-width: 0; }
.pk-label {
    font-size: 10.5px;
    color: var(--text-2);
    font-weight: 500;
}
.pk-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
    margin-top: 2px;
}

/* ===== Patient Layout ===== */
.patient-layout {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 14px;
}
.patient-info-card { height: fit-content; }
.info-list { padding: 4px 0; }
.info-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 18px;
    border-bottom: 1px solid var(--line-2);
}
.info-row:last-child { border-bottom: none; }
.info-row > i {
    width: 28px; height: 28px;
    border-radius: 8px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}
.info-label {
    font-size: 10.5px;
    color: var(--text-2);
    font-weight: 500;
    margin-bottom: 2px;
}
.info-value {
    font-size: 12.5px;
    color: var(--text);
    font-weight: 500;
    line-height: 1.5;
    word-break: break-word;
}

/* ============================================================
   PHASE 3 — SESSIONS
   ============================================================ */
.session-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}
.session-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    transition: all var(--dur) var(--ease);
}
.session-card:hover {
    border-color: var(--primary);
    transform: translateX(2px);
}
.sc-date {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: var(--primary-soft);
    border: 1px solid rgba(12, 192, 223, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sc-day {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1;
    letter-spacing: -0.4px;
}
.sc-month {
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary-dark);
    margin-top: 2px;
    opacity: 0.85;
}
.sc-year {
    font-size: 8px;
    font-weight: 500;
    color: var(--text-3);
    letter-spacing: 0.3px;
}
.sc-body { flex: 1; min-width: 0; }
.sc-patient {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: -0.1px;
}
.sc-patient i { color: var(--text-3); font-size: 10px; }
.sc-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: var(--text-2);
    font-weight: 500;
    margin-bottom: 3px;
}
.sc-relative { color: var(--text-3); font-style: italic; }
.sc-notes {
    font-size: 11.5px;
    color: var(--text-2);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sc-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.sc-arrow {
    color: var(--text-3);
    font-size: 10px;
    transition: all var(--dur) var(--ease);
}
.session-card:hover .sc-arrow {
    color: var(--primary);
    transform: translateX(2px);
}

/* ============================================================
   SESSION DETAIL
   ============================================================ */
.session-header {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 20px;
    margin-bottom: 14px;
    display: flex;
    gap: 24px;
    align-items: center;
    position: relative;
    overflow: hidden;
}
.session-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient);
}

.sh-patient {
    display: flex;
    gap: 14px;
    align-items: center;
    flex: 1;
    position: relative;
    z-index: 1;
}
.sh-avatar {
    width: 56px; height: 56px;
    border-radius: 14px;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.sh-patient-info { flex: 1; min-width: 0; }
.sh-name {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.4px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.sh-meta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-2);
    font-weight: 500;
    margin-bottom: 6px;
}
.sh-meta span { display: flex; align-items: center; gap: 5px; }
.sh-meta i { color: var(--text-3); font-size: 10px; }
.sh-link {
    font-size: 11.5px;
    color: var(--primary-dark);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.sh-link:hover { text-decoration: underline; }
.sh-link i { font-size: 9px; }

.sh-progress {
    min-width: 220px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 14px 16px;
    position: relative;
    z-index: 1;
}
.shp-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10.5px;
    font-weight: 500;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 8px;
}
.shp-label strong {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-dark);
    text-transform: none;
    letter-spacing: -0.2px;
}
.shp-bar {
    height: 6px;
    background: #E5E5EA;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 6px;
}
.shp-fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 20px;
    transition: width 0.5s var(--ease);
}
.shp-pct {
    text-align: right;
    font-size: 10.5px;
    color: var(--text-2);
    font-weight: 500;
}

/* ===== Assessments Section ===== */
.assessments-section {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-title i { color: var(--text-2); font-size: 13px; }
.section-count {
    font-size: 10.5px;
    color: var(--text-2);
    font-weight: 600;
    padding: 2px 8px;
    background: var(--bg-2);
    border-radius: 6px;
    letter-spacing: 0.2px;
}

.ag-label {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
    padding-left: 2px;
}

.ag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 8px;
}

.ag-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    transition: all var(--dur) var(--ease);
    position: relative;
}
.ag-card:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}
.ag-icon {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.ag-card.completed .ag-icon { background: rgba(16, 185, 129, 0.08); color: var(--success); }
.ag-card.pending .ag-icon   { background: rgba(245, 158, 11, 0.08);  color: var(--warning); }
.ag-card.skipped .ag-icon   { background: var(--bg-2); color: var(--text-3); }

.ag-body { flex: 1; min-width: 0; }
.ag-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.1px;
}
.ag-meta {
    font-size: 10.5px;
    color: var(--success);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}
.ag-meta i { font-size: 9px; }

.ag-arrow {
    color: var(--text-3);
    font-size: 9px;
    transition: all var(--dur) var(--ease);
    flex-shrink: 0;
}
.ag-card:hover .ag-arrow {
    color: var(--primary);
    transform: translateX(2px);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
    .chart-row { grid-template-columns: 1fr; }
    .two-col { grid-template-columns: 1fr; }
    .patient-kpis { grid-template-columns: repeat(2, 1fr); }
    .patient-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.08); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: flex; }
    .topbar { padding: 0 16px; }
    .content { padding: 16px; }
    .revenue-strip { flex-direction: column; align-items: stretch; gap: 12px; padding: 16px; }
    .rev-divider { display: none; }
    .patients-stats { grid-template-columns: repeat(2, 1fr); }
    .session-header { flex-direction: column; align-items: stretch; padding: 16px; }
    .sh-progress { min-width: 100%; }
    .toolbar-dates { width: 100%; flex-wrap: wrap; }
}
@media (max-width: 640px) {
    .content { padding: 12px; }
    .topbar { padding: 0 12px; }
    .page-title { font-size: 14px; }
    .topbar-right { display: none; }
    .kpi-grid { grid-template-columns: 1fr; }
    .kpi-value { font-size: 20px; }
    .rev-value { font-size: 16px; }
    .auth-card { padding: 28px 22px 22px; }
    .auth-title { font-size: 20px; }
    .patients-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
    .pstat { padding: 12px 14px; }
    .pstat-value { font-size: 18px; }
    .patient-grid { grid-template-columns: 1fr; }
    .patient-header { padding: 16px; flex-direction: column; text-align: center; }
    .ph-avatar { width: 48px; height: 48px; font-size: 20px; }
    .ph-top { justify-content: center; }
    .ph-top h1 { font-size: 17px; }
    .ph-meta { justify-content: center; }
    .patient-kpis { grid-template-columns: 1fr; }
    .toolbar { flex-direction: column; }
    .toolbar-search, .toolbar-sort, .toolbar-dates { width: 100%; }
    .info-row { padding: 10px 14px; }
    .session-card { padding: 10px 12px; gap: 10px; }
    .sc-date { width: 46px; height: 46px; }
    .sc-day { font-size: 15px; }
    .ag-grid { grid-template-columns: 1fr; }
    .sh-avatar { width: 48px; height: 48px; font-size: 18px; }
    .sh-name { font-size: 16px; }
}

/* ============================================================
   PHASE 4 — INVOICES
   ============================================================ */

.invoice-table-wrap {
    overflow-x: auto;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
}

.invoice-table thead th {
    background: var(--bg-2);
    padding: 10px 16px;
    text-align: left;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}
.invoice-table thead th.text-right { text-align: right; }
.invoice-table thead th:first-child { padding-left: 20px; }
.invoice-table thead th:last-child  { padding-right: 20px; }

.invoice-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line-2);
    font-size: 12.5px;
    color: var(--text);
    vertical-align: middle;
}
.invoice-table tbody td:first-child { padding-left: 20px; }
.invoice-table tbody td:last-child  { padding-right: 20px; }
.invoice-table tbody tr:last-child td { border-bottom: none; }

.invoice-row {
    cursor: pointer;
    transition: background var(--dur) var(--ease);
}
.invoice-row:hover {
    background: var(--bg-2);
}
.invoice-row:hover .inv-arrow {
    color: var(--primary);
    transform: translateX(2px);
}

.text-right  { text-align: right; }
.text-center { text-align: center; }

.inv-num {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--primary-dark);
    letter-spacing: -0.1px;
}
.inv-num i {
    font-size: 12px;
    color: var(--primary);
}

.inv-patient {
    display: flex;
    align-items: center;
    gap: 10px;
}
.inv-avatar {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}
.inv-pname {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.1px;
}
.inv-pphone {
    font-size: 11px;
    color: var(--text-2);
    margin-top: 1px;
}

.inv-date {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text);
}
.inv-rel {
    font-size: 11px;
    color: var(--text-3);
    margin-top: 1px;
    font-style: italic;
}

.inv-mode {
    display: inline-block;
    padding: 3px 9px;
    background: var(--bg-2);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-2);
    text-transform: capitalize;
}

.inv-amt {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
}

.inv-arrow {
    color: var(--text-3);
    font-size: 11px;
    transition: all var(--dur) var(--ease);
}

/* Mobile: hide some columns */
@media (max-width: 800px) {
    .invoice-table thead th:nth-child(3),
    .invoice-table tbody td:nth-child(3),
    .invoice-table thead th:nth-child(4),
    .invoice-table tbody td:nth-child(4) {
        display: none;
    }
    .invoice-table thead th,
    .invoice-table tbody td {
        padding: 10px 12px;
    }
}

/* ============================================================
   PHASE 5A — APPOINTMENTS
   ============================================================ */

/* ===== Tabs ===== */
.appt-tabs {
    display: flex;
    gap: 4px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 4px;
    margin-bottom: 16px;
    overflow-x: auto;
    scrollbar-width: none;
}
.appt-tabs::-webkit-scrollbar { display: none; }

.appt-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-2);
    white-space: nowrap;
    transition: all var(--dur) var(--ease);
}
.appt-tab i { font-size: 11px; }
.appt-tab:hover { background: var(--bg-2); color: var(--text); }
.appt-tab.active {
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 600;
}

/* ===== Appointment Cards ===== */
.appt-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.appt-card {
    display: flex;
    align-items: stretch;
    gap: 16px;
    padding: 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    transition: all var(--dur) var(--ease);
    position: relative;
}
.appt-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(12, 192, 223, 0.08);
}
.appt-card.past { opacity: 0.85; }

.ac-time {
    width: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--primary-soft);
    border-radius: 12px;
    padding: 10px 6px;
}
.ac-hour {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--primary-dark);
    line-height: 1;
}
.ac-ampm {
    font-size: 10px;
    font-weight: 700;
    color: var(--primary-dark);
    opacity: 0.7;
    margin-top: 4px;
    letter-spacing: 0.4px;
}

.ac-line {
    width: 1px;
    background: var(--line-2);
    flex-shrink: 0;
}

.ac-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ac-date {
    font-size: 11.5px;
    color: var(--text-2);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ac-date i { color: var(--text-3); font-size: 10px; }
.ac-rel {
    color: var(--text-3);
    font-style: italic;
    margin-left: 2px;
}

.ac-patient-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    padding: 4px 8px 4px 4px;
    border-radius: 10px;
    transition: background var(--dur) var(--ease);
}
.ac-patient-link:hover { background: var(--bg-2); }

.ac-avatar {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}
.ac-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.2px;
}
.ac-meta {
    font-size: 11.5px;
    color: var(--text-2);
    margin-top: 2px;
}

.ac-reason {
    font-size: 12.5px;
    color: var(--text-2);
    padding: 8px 12px;
    background: var(--bg-2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.5;
}
.ac-reason i { color: var(--primary-dark); font-size: 11px; flex-shrink: 0; }

.ac-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.ac-dur {
    font-size: 11.5px;
    color: var(--text-2);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.ac-dur i { color: var(--text-3); font-size: 10px; }

@media (max-width: 640px) {
    .appt-card { padding: 12px; gap: 12px; }
    .ac-time { width: 56px; padding: 8px 4px; }
    .ac-hour { font-size: 16px; }
    .ac-line { display: none; }
}

/* ============================================================
   PHASE 5A — CARE PLANS
   ============================================================ */
.careplan-group {
    margin-bottom: 20px;
}
.careplan-group:last-child { margin-bottom: 0; }

.cg-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-2);
    border-radius: var(--r) var(--r) 0 0;
    border: 1px solid var(--line);
    border-bottom: none;
}
.cg-patient {
    display: flex;
    align-items: center;
    gap: 10px;
}
.cg-avatar {
    width: 32px; height: 32px;
    border-radius: 9px;
    background: var(--gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}
.cg-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.1px;
}
.cg-name a:hover { color: var(--primary-dark); text-decoration: underline; }
.cg-meta {
    font-size: 11px;
    color: var(--text-2);
    margin-top: 1px;
}

.cg-list {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 0 0 var(--r) var(--r);
}

.cp-card {
    display: flex;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-2);
    transition: background var(--dur) var(--ease);
    position: relative;
}
.cp-card:last-child { border-bottom: none; }
.cp-card:hover { background: var(--bg-2); }

.cp-card.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--gradient);
    border-radius: 0 3px 3px 0;
}

.cp-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.cp-card.stopped .cp-icon {
    background: var(--bg-2);
    color: var(--text-3);
}

.cp-body { flex: 1; min-width: 0; }

.cp-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.1px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.cp-card.stopped .cp-name { color: var(--text-2); }

.cp-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 11.5px;
    color: var(--text-2);
    margin-bottom: 8px;
}
.cp-meta span { display: inline-flex; align-items: center; gap: 4px; }
.cp-meta i { color: var(--text-3); font-size: 10px; }

.cp-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.cp-stat {
    padding: 5px 10px;
    background: var(--bg-2);
    border-radius: 8px;
    min-width: 50px;
}
.cp-stat-l {
    font-size: 9.5px;
    color: var(--text-2);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 1px;
}
.cp-stat-v {
    font-size: 12px;
    color: var(--text);
    font-weight: 700;
}

.cp-notes {
    font-size: 11.5px;
    color: var(--text-2);
    font-style: italic;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.5;
    margin-top: 4px;
}
.cp-notes i { color: var(--text-3); font-size: 10px; flex-shrink: 0; margin-top: 2px; }

.cp-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}
.cp-video-btn {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all var(--dur) var(--ease);
}
.cp-video-btn:hover {
    background: var(--danger);
    color: #fff;
    transform: scale(1.05);
}
.cp-date {
    font-size: 10.5px;
    color: var(--text-3);
    font-style: italic;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .cp-card { padding: 12px; gap: 10px; }
    .cp-stats { gap: 6px; }
    .cp-stat { padding: 4px 8px; }
    .cp-right { gap: 6px; }
}