:root {
    --green: #0f7c4a;
    --green-dark: #0b5a36;
    --gray-900: #0f1720;
    --gray-800: #1e293b;
    --gray-700: #44505f;
    --gray-600: #64748b;
    --gray-500: #94a3b8;
    --gray-400: #a0adb8;
    --gray-300: #cbd5e1;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50:  #f8fafc;
    --white: #ffffff;
    --shadow: 0 14px 40px rgba(15, 23, 32, 0.08);
    --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--gray-900);
    background: #f1f5f9;
    height: 100vh;
    overflow: hidden;
}

html { height: 100%; }

.intro-gate {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: #ffffff;
    color: var(--gray-900);
    z-index: 40;
    overflow: hidden;
}

.intro-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(700px at 18% 22%, rgba(15,124,74,0.08), transparent 55%),
        radial-gradient(600px at 80% 18%, rgba(15,124,74,0.06), transparent 60%),
        linear-gradient(180deg, rgba(15,124,74,0.03), transparent 40%);
}

.intro-noise {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 120 120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.04'/%3E%3C/svg%3E");
    opacity: 0.35;
    mix-blend-mode: multiply;
    pointer-events: none;
}

.intro-content { position: relative; z-index: 1; }


.intro-card {
    background: #ffffff;
    border: 1px solid var(--gray-200);
    box-shadow: 0 24px 70px rgba(15, 23, 32, 0.14);
    border-radius: 18px;
    padding: 28px;
    max-width: 820px;
    margin: 0 auto;
    animation: portalBounce 0.9s cubic-bezier(0.22, 1.4, 0.36, 1) both;
}

.intro-layout {
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);
    gap: 24px;
    align-items: center;
}

.intro-visual {
    background: linear-gradient(135deg, rgba(15,124,74,0.08), rgba(15,124,74,0.02));
    border: 1px solid rgba(15,124,74,0.12);
    border-radius: 16px;
    padding: 18px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

.intro-visual svg { width: 100%; height: auto; display: block; }

.intro-card h1 { font-size: 26px; margin: 0 0 6px; text-align: left; }

.intro-sub { color: var(--gray-700); margin: 0 0 14px; }

.intro-form { display: grid; gap: 14px; }

.field { display: grid; }

.field input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    background: var(--gray-100);
    color: var(--gray-900);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field input:focus {
    border-color: var(--green);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(15,124,74,0.12);
}

.intro-submit { width: 100%; font-size: 15px; }

@media (max-width: 820px) {
    .intro-layout { grid-template-columns: 1fr; }
    .intro-card { padding: 24px; }
    .intro-card h1 { text-align: center; }
    .intro-sub { text-align: center; }
}



a { color: inherit; text-decoration: none; }

/* ── APP LAYOUT ────────────────────────────────────── */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: #f1f5f9;
}

/* ── SIDEBAR ────────────────────────────────────────── */
.sidebar {
    width: 68px;
    flex-shrink: 0;
    background: #1a2332;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    gap: 0;
    position: relative;
    z-index: 20;
    transition: width 0.25s ease;
    overflow: hidden;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px 0 12px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    width: 100%;
    flex-shrink: 0;
}

.sidebar-logo {
    width: 38px; height: 38px;
    background: var(--green);
    border-radius: 10px;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform .15s;
}
.sidebar-logo:hover { transform: scale(1.06); }

.sidebar-logo svg { width: 22px; height: 22px; }

.sidebar-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: #2e3f57;
    border: 2px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.85);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    display: grid;
    place-items: center;
    cursor: pointer;
    overflow: hidden;
    transition: width .2s, height .2s;
}
.sidebar-avatar--admin {
    width: 42px; height: 42px;
    border-color: rgba(74,222,128,0.35);
    background: transparent;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 0;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }

.sidebar-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 0;
}
.sidebar-group + .sidebar-group {
    border-top: 1px solid rgba(255,255,255,0.05);
    margin-top: 2px;
    padding-top: 6px;
}
.sidebar-group-label {
    display: none;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,0.2);
    padding: 2px 12px;
    width: 100%;
    text-align: center;
}

.sidebar-btn {
    position: relative;
    width: 44px; height: 44px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: rgba(255,255,255,0.45);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.18s, color 0.18s;
    flex-shrink: 0;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-label {
    display: none;
    font-size: 12px;
    font-weight: 500;
}

.sidebar-btn svg { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-btn:hover {
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.85);
}

.sidebar-btn.active {
    background: rgba(15,124,74,0.18);
    color: #4ade80;
}

.sidebar-badge {
    position: absolute;
    top: 6px; right: 6px;
    min-width: 16px; height: 16px;
    background: var(--green);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    border-radius: 999px;
    display: grid;
    place-items: center;
    padding: 0 4px;
}

.sidebar-bottom {
    padding: 12px 0;
    border-top: 1px solid rgba(255,255,255,0.07);
    width: 100%;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logout { color: rgba(255,255,255,0.3); }
.sidebar-logout:hover { color: #f87171; background: rgba(248,113,113,0.1); }

/* ── MAIN AREA ───────────────────────────────────────── */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ── TOPBAR ─────────────────────────────────────────── */
.topbar {
    background: #ffffff;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
    z-index: 10;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 24px;
    height: 60px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-hamburger {
    display: none !important;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px; height: 32px;
    border: none; background: none; cursor: pointer; padding: 4px;
    border-radius: 6px;
    transition: background 0.15s;
}

.topbar-hamburger:hover { background: var(--gray-100); }

.topbar-hamburger span {
    display: block;
    height: 2px;
    background: var(--gray-600);
    border-radius: 2px;
    transition: transform 0.2s;
}

.topbar-titles { display: flex; flex-direction: column; }

.topbar-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.topbar-sub {
    font-size: 11px;
    color: var(--gray-400);
    font-weight: 500;
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

/* ── Notification bell ─────────────────────────────── */
.notif-bell-wrap { position: relative; }

.notif-bell-btn {
    position: relative;
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 1.5px solid var(--gray-200);
    background: var(--gray-100);
    color: var(--gray-600);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.18s, border-color 0.18s, color 0.18s;
    outline: none;
}
.notif-bell-btn:hover { background: #fff; border-color: var(--green); color: var(--green); }
.notif-bell-btn.has-notif { border-color: #ef4444; color: #ef4444; background: #fff5f5; }

.notif-bell-icon {
    width: 18px; height: 18px;
    display: block;
}
.notif-bell-btn.has-notif .notif-bell-icon {
    animation: bell-ring 0.7s ease infinite;
    transform-origin: top center;
}
@keyframes bell-ring {
    0%   { transform: rotate(0deg); }
    10%  { transform: rotate(14deg); }
    20%  { transform: rotate(-12deg); }
    30%  { transform: rotate(10deg); }
    40%  { transform: rotate(-8deg); }
    50%  { transform: rotate(5deg); }
    60%  { transform: rotate(-3deg); }
    70%  { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}

.notif-badge {
    position: absolute;
    top: 4px; right: 4px;
    min-width: 17px; height: 17px;
    background: #ef4444;
    color: #fff;
    font-size: 9.5px;
    font-weight: 800;
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(239,68,68,0.4);
    animation: badge-pop 0.3s cubic-bezier(0.175,0.885,0.32,1.4);
    pointer-events: none;
}
@keyframes badge-pop {
    0%   { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Notification dropdown panel */
.notif-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 310px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(15,23,32,0.16);
    z-index: 500;
    overflow: hidden;
}
.notif-panel-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px 10px;
    border-bottom: 1.5px solid #f1f5f9;
}
.notif-panel-title {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
}
.notif-clear-btn {
    border: none;
    background: none;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--green);
    cursor: pointer;
    padding: 0;
}
.notif-clear-btn:hover { color: var(--green-dark); text-decoration: underline; }
.notif-panel-list {
    max-height: 320px;
    overflow-y: auto;
}
.notif-empty {
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
    padding: 24px 16px;
}
.notif-item {
    display: flex;
    gap: 10px;
    padding: 11px 16px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.12s;
}
.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #f0fdf4; }
.notif-item-dot {
    flex-shrink: 0;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--green);
    margin-top: 4px;
}
.notif-item.read .notif-item-dot { background: #e5e7eb; }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-text { font-size: 12.5px; color: #1e293b; line-height: 1.4; }
.notif-item-time { font-size: 10.5px; color: #9ca3af; margin-top: 2px; }

/* ── Notifications full page ── */
.notif-page-list { display: flex; flex-direction: column; gap: 6px; margin-top: 20px; }
.notif-page-empty {
    text-align: center;
    color: #94a3b8;
    padding: 60px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.notif-page-empty p { font-size: 14px; font-weight: 600; }
.notif-page-item {
    display: flex;
    gap: 14px;
    padding: 16px 20px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .12s, background .12s;
}
.notif-page-item:hover { border-color: #c7d2fe; }
.notif-page-item--read { opacity: .55; }
.notif-page-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #6366f1;
    flex-shrink: 0;
    margin-top: 5px;
}
.notif-page-item--read .notif-page-dot { background: #cbd5e1; }
.notif-page-body { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.notif-page-text { font-size: 13px; font-weight: 700; color: #0f172a; }
.notif-page-time { font-size: 11px; color: #94a3b8; }
.notif-page-meds { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.notif-page-med-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    background: #f0fdf4;
    color: #065f46;
    border: 1px solid #bbf7d0;
}

/* ── MAIN CONTENT ───────────────────────────────────── */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px 28px 48px;
}

.catalog-section { padding-bottom: 40px; }

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 22px;
}

.page-header-left { display: flex; flex-direction: column; gap: 4px; }

.eyebrow {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--green);
    font-weight: 800;
}

h1 { font-size: 22px; font-weight: 800; color: var(--gray-900); letter-spacing: -0.02em; }


.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; }

.filter-pills button {
    border: 1px solid var(--gray-200);
    background: var(--white);
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-900);
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.filter-pills button.active {
    border-color: var(--green);
    color: var(--green);
    background: rgba(15, 124, 74, 0.08);
}

/* ── PRODUCT CARDS ───────────────────────────────────── */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.product-card {
    background: #ffffff;
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(15,23,32,0.06);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(15,23,32,0.11);
}

/* Visual / image area */
.pc-visual {
    position: relative;
    height: 140px;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    flex-shrink: 0;
}

.pc-visual-inner {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

.pc-visual-inner.has-svg svg {
    width: 100%;
    height: 100%;
    display: block;
}

.pc-visual-inner.no-img {
    background: linear-gradient(135deg, rgba(15,124,74,0.1), rgba(15,124,74,0.04));
    display: flex;
    align-items: center;
    justify-content: center;
}

.pc-visual-inner.no-img::after {
    content: '💊';
    font-size: 36px;
    opacity: 0.4;
}

/* Category chip over the image */
.pc-category {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(15,124,74,0.15);
    color: var(--green-dark);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 999px;
}

/* Body */
.pc-body {
    padding: 14px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.pc-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.3;
    letter-spacing: -0.01em;
}

/* Meta row */
.pc-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pc-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--gray-400);
    font-weight: 500;
}

.pc-meta-item svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    color: var(--gray-400);
}

/* Footer: price + button */
.pc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--gray-100);
}

.pc-price {
    font-size: 18px;
    font-weight: 800;
    color: var(--green);
    letter-spacing: -0.02em;
}

.pc-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
    white-space: nowrap;
    flex-shrink: 0;
}

.pc-btn svg {
    width: 14px;
    height: 14px;
}

.pc-btn:hover {
    background: var(--green-dark);
    transform: scale(1.04);
}

.pc-btn:active { transform: scale(0.97); }

@keyframes pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.18); }
    100% { transform: scale(1); }
}

.badge-pulse { animation: pulse 0.35s ease; }

@keyframes bag-pop {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.22) translateY(-3px); }
    60%  { transform: scale(0.94) translateY(1px); }
    100% { transform: scale(1) translateY(0); }
}

.bag-pop { animation: bag-pop 0.38s cubic-bezier(0.22, 1, 0.36, 1); }

.footer { display: none; }

@media (max-width: 900px) {
    .sidebar { width: 56px; }
    .main-content { padding: 18px 16px 0; }
}

/* ══════════════════════════════════════════════════════════
   SECTION SWITCHING
══════════════════════════════════════════════════════════ */
.content-section {
    display: none;
    padding-bottom: 48px;
    animation: sectionIn 0.22s ease both;
}
.content-section.active { display: block; }

@keyframes sectionIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════
   SHARED: ADD NEW BUTTON
══════════════════════════════════════════════════════════ */
.btn-add-new {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
    white-space: nowrap;
    flex-shrink: 0;
}
.btn-add-new svg { width: 16px; height: 16px; }
.btn-add-new:hover { background: var(--green-dark); transform: scale(1.02); }

.btn-add-new-sm {
    margin-top: 12px;
    padding: 9px 20px;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 9px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-add-new-sm:hover { background: var(--green-dark); }

/* ══════════════════════════════════════════════════════════
   DASHBOARD SECTION
══════════════════════════════════════════════════════════ */
/* ── Greeting + date ── */
.dash-date-badge {
    font-size: 12px;
    color: var(--gray-600);
    background: var(--gray-100, #f3f4f6);
    border-radius: 8px;
    padding: 5px 12px;
    font-weight: 600;
    align-self: center;
    white-space: nowrap;
}
.dash-greeting-line {
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 22px;
    margin-top: -4px;
}
.dash-greeting-line strong { color: var(--gray-900); }

/* ── Stat cards ── */
.dash-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.dash-stat-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(15,23,32,0.05);
    transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
}
.dash-stat-card--link {
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    width: 100%;
    border: 1px solid var(--gray-200);
}
.dash-stat-card--link:hover {
    box-shadow: 0 6px 20px rgba(15,23,32,0.09);
    transform: translateY(-2px);
    border-color: var(--green);
}
.dash-stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.dash-stat-icon svg { width: 22px; height: 22px; }
.dash-stat-icon--blue   { background: rgba(59,130,246,0.12); color: #3b82f6; }
.dash-stat-icon--green  { background: rgba(15,124,74,0.12);  color: var(--green); }
.dash-stat-icon--purple { background: rgba(124,58,237,0.12); color: #7c3aed; }
.dash-stat-icon--orange { background: rgba(245,158,11,0.12); color: #f59e0b; }
.dash-stat-num {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.1;
    letter-spacing: -0.03em;
}
.dash-stat-label {
    display: block;
    font-size: 12px;
    color: var(--gray-700);
    font-weight: 500;
    margin-top: 2px;
}
.dash-stat-hint {
    display: block;
    font-size: 11px;
    color: var(--green);
    font-weight: 700;
    margin-top: 4px;
    opacity: 0;
    transition: opacity 0.18s;
}
.dash-stat-card--link:hover .dash-stat-hint { opacity: 1; }

.dash-section-title {
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--green);
    font-weight: 800;
    margin-bottom: 14px;
}

/* ── Acciones rápidas strip (fila completa) ── */
.dash-actions-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.dash-actions-strip .dash-action-card-h {
    padding: 14px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}
.dash-actions-strip .dash-action-text-h { width: 100%; }
.dash-actions-strip .dash-action-title-h { font-size: 14px; }
.dash-actions-strip .dash-action-desc-h { font-size: 12px; }
.dash-actions-strip .dash-action-arrow { display: none; }

/* ── Panels row ── */
.dash-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: stretch;
}
.dash-panels--3col {
    grid-template-columns: 2fr 1fr 1fr;
}
@media (max-width: 1100px) { .dash-panels--3col { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px)  { .dash-panels--3col { grid-template-columns: 1fr; } }
.dash-panel {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(15,23,32,0.05);
}
.dash-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.dash-panel-header .dash-section-title { margin-bottom: 0; }
.dash-panel-link {
    font-size: 12px;
    color: var(--green);
    background: none;
    border: none;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.15s;
}
.dash-panel-link:hover { opacity: 0.65; }

/* Recent patients */
.dash-recent-empty {
    text-align: center;
    color: var(--gray-400);
    font-size: 13px;
    padding: 28px 0;
}
.dash-recent-list { display: flex; flex-direction: column; gap: 6px; }
.dash-recent-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 10px;
    background: #f8f9fa;
    transition: background 0.15s;
}
.dash-recent-row:hover { background: #f0f2f5; }
.dash-recent-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(15,124,74,0.1);
    color: var(--green);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
}
.dash-recent-info { flex: 1; min-width: 0; }
.dash-recent-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-recent-meta { font-size: 11px; color: var(--gray-600); margin-top: 1px; }
.dash-recent-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    flex-shrink: 0;
}
.dash-recent-badge--active   { background: rgba(15,124,74,0.1); color: var(--green); }
.dash-recent-badge--inactive { background: rgba(107,114,128,0.12); color: #6b7280; }
.dash-new-patient-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 14px;
    width: 100%;
    padding: 9px 14px;
    border: 1px dashed var(--gray-300);
    border-radius: 10px;
    background: none;
    color: var(--gray-600);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.18s, color 0.18s, background 0.18s;
    justify-content: center;
}
.dash-new-patient-btn:hover {
    border-color: var(--green);
    color: var(--green);
    background: rgba(15,124,74,0.04);
}

/* Catalog breakdown */
.dash-cat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.dash-cat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
    width: 76px;
    flex-shrink: 0;
}
.dash-cat-bar-wrap {
    flex: 1;
    height: 6px;
    background: #f0f2f5;
    border-radius: 10px;
    overflow: hidden;
}
.dash-cat-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.7s ease;
}
.dash-cat-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-900);
    width: 22px;
    text-align: right;
    flex-shrink: 0;
}
.dash-catalog-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    margin-top: 6px;
    border-top: 1px solid var(--gray-200);
    font-size: 12px;
    color: var(--gray-600);
}
.dash-catalog-total strong { color: var(--gray-900); font-size: 14px; font-weight: 800; }

/* Quick action cards (horizontal) */
.dash-action-col { display: flex; flex-direction: column; gap: 8px; }
.dash-action-card-h {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 11px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: border-color 0.18s, background 0.18s;
    box-shadow: 0 1px 3px rgba(15,23,32,0.04);
}
.dash-action-card-h:hover {
    border-color: var(--green);
    background: rgba(15,124,74,0.04);
}
.dash-action-icon-h {
    width: 36px; height: 36px;
    border-radius: 9px;
    background: rgba(15,124,74,0.08);
    color: var(--green);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.dash-action-icon-h svg { width: 18px; height: 18px; }
.dash-action-text-h { flex: 1; }
.dash-action-title-h {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-900);
}
.dash-action-card-h:hover .dash-action-title-h { color: var(--green); }
.dash-action-desc-h {
    display: block;
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 1px;
}
.dash-action-arrow {
    font-size: 18px;
    color: var(--gray-300);
    flex-shrink: 0;
    line-height: 1;
}

/* ══════════════════════════════════════════════════════════
   PATIENTS SECTION
══════════════════════════════════════════════════════════ */
.pts-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.pts-stat {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 14px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 90px;
    box-shadow: 0 1px 4px rgba(15,23,32,0.05);
}
.pts-stat--green { border-color: rgba(15,124,74,0.3); background: rgba(15,124,74,0.04); }
.pts-stat--gray  { border-color: var(--gray-200); }

.pts-stat-num {
    font-size: 24px;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.03em;
}
.pts-stat--green .pts-stat-num { color: var(--green); }

.pts-stat-lbl {
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Table toolbar */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.table-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 9px 14px;
    flex: 1;
    max-width: 340px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.table-search-bar:focus-within {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(15,124,74,0.1);
}
.table-search-bar svg { width: 16px; height: 16px; color: var(--gray-400); flex-shrink: 0; }
.table-search-bar input {
    border: none; background: none;
    font-family: inherit; font-size: 13px; font-weight: 500;
    color: var(--gray-900); outline: none; width: 100%;
}
.table-search-bar input::placeholder { color: var(--gray-400); }

.table-toolbar-right { display: flex; align-items: center; gap: 8px; }

.filter-select {
    border: 1px solid var(--gray-200);
    border-radius: 9px;
    background: #fff;
    padding: 9px 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-900);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}
.filter-select:focus { border-color: var(--green); }

/* Table wrapper */
.table-wrap {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(15,23,32,0.05);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead {
    background: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    padding: 12px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--gray-700);
    white-space: nowrap;
}
.data-table .th-actions { width: 90px; }

.data-table td {
    padding: 13px 14px;
    color: var(--gray-900);
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr {
    transition: background 0.14s;
    cursor: default;
}
.data-table tbody tr:hover { background: rgba(15,124,74,0.03); }

.data-table .td-id {
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-400);
}

.data-table .td-name {
    font-weight: 700;
    color: var(--gray-900);
}

/* Status badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
}
.badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.badge--active   { background: rgba(15,124,74,0.12); color: var(--green); }
.badge--inactive { background: rgba(148,163,184,0.18); color: var(--gray-700); }

/* Table action buttons */
.td-actions { display: flex; gap: 6px; }

.tbl-btn {
    width: 32px; height: 32px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: #fff;
    color: var(--gray-700);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.tbl-btn svg { width: 14px; height: 14px; }
.tbl-btn:hover { border-color: var(--green); color: var(--green); background: rgba(15,124,74,0.06); }
.tbl-btn--red:hover { border-color: #f87171; color: #ef4444; background: rgba(248,113,113,0.08); }
.tbl-btn--green { color: var(--green); }
.tbl-btn--green:hover { border-color: var(--green); color: #fff; background: var(--green); }
/* Plan table action buttons */
.tbl-btn-open, .tbl-btn-del {
    width: 32px; height: 32px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: #fff;
    color: var(--gray-700);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.tbl-btn-open:hover { border-color: var(--green); color: var(--green); background: rgba(15,124,74,0.06); }
.tbl-btn-del:hover  { border-color: #f87171; color: #ef4444; background: rgba(248,113,113,0.08); }

/* Programs catalog table: icon action buttons */
.tbl-icon-btn {
    width: 30px; height: 30px;
    border: 1px solid var(--gray-200);
    border-radius: 7px;
    background: #fff;
    color: var(--gray-500);
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.tbl-icon-btn + .tbl-icon-btn { margin-left: 4px; }
.tbl-btn-view:hover   { border-color: #3182ce; color: #3182ce; background: rgba(49,130,206,0.07); }
.tbl-btn-edit:hover   { border-color: var(--green); color: var(--green); background: rgba(15,124,74,0.06); }
.tbl-btn-assign:hover { border-color: #9f7aea; color: #9f7aea; background: rgba(159,122,234,0.07); }
.tbl-btn-del:hover    { border-color: #f87171; color: #ef4444; background: rgba(248,113,113,0.08); }

/* Orders table: icon action buttons */
.icon-btn {
    width: 30px; height: 30px;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.icon-btn + .icon-btn { margin-left: 4px; }
.icon-btn:hover       { border-color: #94a3b8; color: #1e293b; background: #f8fafc; }
.icon-btn--del:hover  { border-color: #f87171; color: #ef4444; background: rgba(248,113,113,0.08); }

/* Programs catalog table: division badge + revenue */
.prog-div-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid currentColor;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}
.prog-rev-badge {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    color: var(--green);
}
.td-num  { color: var(--gray-400); font-size: 12px; width: 36px; }
.td-center { text-align: center; }
.td-actions { text-align: right; white-space: nowrap; padding-right: 12px; }
.th-num  { width: 36px; }
.th-center { text-align: center; }
.th-actions { width: 80px; }
td.th-actions { display: flex; flex-direction: row; align-items: center; gap: 4px; justify-content: flex-start; padding-left: 8px; }

/* ══════════════════════════════════════════════════════════
   PROGRAM CATALOG INTERIOR (cpi-*)
══════════════════════════════════════════════════════════ */
#programCatalogInterior { padding-top: 4px; }

.cpi-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
}
.cpi-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--green);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    padding: 0;
    transition: opacity 0.15s;
}
.cpi-back-btn:hover { opacity: 0.75; }
.cpi-breadcrumb-sep { color: var(--gray-300); font-size: 15px; }
.cpi-breadcrumb-name { font-size: 13.5px; font-weight: 600; color: var(--gray-600); }

.cpi-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}
.cpi-header-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cpi-prog-name {
    font-size: 22px;
    font-weight: 800;
    color: var(--gray-900);
    margin: 0;
}
.cpi-div-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 14px;
    border-radius: 20px;
    border: 1px solid currentColor;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.cpi-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.cpi-edit-btn:hover { border-color: var(--green); color: var(--green); background: rgba(15,124,74,0.05); }

.cpi-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    align-items: start;
}
.cpi-body--single { grid-template-columns: 1fr; }

.cpi-panel {
    background: #fff;
    border: 1px solid var(--gray-100);
    border-radius: 14px;
    overflow: hidden;
}
.cpi-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--gray-100);
}
.cpi-panel-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0;
}
.cpi-med-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-400);
    background: var(--gray-50);
    padding: 2px 10px;
    border-radius: 30px;
}
.cpi-expand-btn {
    width: 30px; height: 30px;
    border: 1px solid var(--gray-200);
    border-radius: 7px;
    background: #fff;
    color: var(--gray-500);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: border-color 0.15s, color 0.15s;
}
.cpi-expand-btn:hover { border-color: var(--green); color: var(--green); }

/* Med rows */
.cpi-med-row {
    display: flex;
    align-items: stretch;
    gap: 0;
    border-bottom: 1px solid var(--gray-50);
    transition: background 0.12s;
}
.cpi-med-row:last-child { border-bottom: none; }
.cpi-med-row:hover { background: var(--gray-50); }

.cpi-med-color-bar {
    width: 4px;
    flex-shrink: 0;
    border-radius: 0;
}
.cpi-med-main {
    flex: 1;
    padding: 14px 16px;
    min-width: 0;
}
.cpi-med-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 5px;
}
.cpi-med-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--gray-500);
}
.cpi-med-brand  { font-weight: 500; }
.cpi-med-dot    { color: var(--gray-300); }
.cpi-med-cat-badge {
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.cpi-med-qty, .cpi-med-uom { font-size: 11.5px; color: var(--gray-400); }

.cpi-med-prices {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 16px;
    flex-shrink: 0;
}
.cpi-price-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 10px;
    min-width: 62px;
}
.cpi-price-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}
.cpi-price-val {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--gray-800);
}
.cpi-price-item--rev { background: rgba(15,124,74,0.05); border-radius: 8px; }
.cpi-rev-val { color: var(--green); }

.cpi-meds-empty {
    padding: 28px 20px;
    text-align: center;
    font-size: 13px;
    color: var(--gray-400);
}

.cpi-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}
.cpi-summary-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--gray-600);
}
.cpi-summary-revenue {
    font-size: 16px;
    font-weight: 800;
    color: var(--green);
}

/* Notes panel */
.cpi-notes-textarea {
    width: 100%;
    min-height: 160px;
    resize: vertical;
    border: none;
    outline: none;
    padding: 14px 20px;
    font-family: inherit;
    font-size: 13px;
    color: var(--gray-700);
    background: transparent;
    box-sizing: border-box;
    line-height: 1.6;
}
.cpi-notes-footer {
    padding: 10px 20px 14px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: flex-end;
}
.cpi-save-notes-btn {
    padding: 7px 18px;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.cpi-dur-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: var(--green);
    font-size: 11.5px;
    font-weight: 700;
}
.prog-dur-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 8px;
    border-radius: 20px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: var(--green);
    font-size: 11px;
    font-weight: 600;
    vertical-align: middle;
}


/* Empty state */
.table-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--gray-400);
    text-align: center;
}
.table-empty svg { opacity: 0.35; margin-bottom: 14px; }
.table-empty p { font-size: 14px; font-weight: 500; margin-bottom: 2px; }

/* ══════════════════════════════════════════════════════════
   PLANS SECTION — coming soon placeholder
══════════════════════════════════════════════════════════ */
.coming-soon-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    padding: 80px 40px;
    text-align: center;
    color: var(--gray-400);
}
.coming-soon-placeholder svg { opacity: 0.3; margin-bottom: 20px; }
.coming-soon-placeholder h3 {
    font-size: 18px;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 10px;
}
.coming-soon-placeholder p {
    font-size: 14px;
    color: var(--gray-700);
    max-width: 420px;
    line-height: 1.6;
}

/* ══════════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 32, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}
.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal-box {
    background: #fff;
    border-radius: 18px;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 24px 70px rgba(15,23,32,0.22);
    animation: modalIn 0.25s cubic-bezier(0.22,1,0.36,1) both;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
@keyframes modalIn {
    from { transform: scale(0.93) translateY(14px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 24px 24px 0;
}
.modal-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.02em;
    margin: 0 0 4px;
}
.modal-sub {
    font-size: 13px;
    color: var(--gray-700);
    margin: 0;
}
.modal-close {
    width: 34px; height: 34px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: #fff;
    color: var(--gray-700);
    cursor: pointer;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: border-color 0.15s, color 0.15s;
}
.modal-close svg { width: 16px; height: 16px; }
.modal-close:hover { border-color: #f87171; color: #ef4444; }

.modal-form { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; flex: 1; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }

.form-group { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.form-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-700);
    letter-spacing: 0.02em;
}

.form-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--gray-200);
    border-radius: 9px;
    background: var(--gray-100);
    padding: 10px 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-900);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.form-input:hover {
    border-color: #94a3b8;
}
.form-input:focus {
    border-color: var(--green);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(15,124,74,0.1);
}
textarea.form-input { resize: vertical; min-height: 80px; }

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--gray-100);
    margin-top: 4px;
}

.btn-cancel {
    padding: 10px 18px;
    border: 1px solid var(--gray-200);
    border-radius: 9px;
    background: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-700);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.btn-cancel:hover { background: var(--gray-100); border-color: var(--gray-400); }

.btn-save {
    padding: 10px 22px;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 9px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
}
.btn-save:hover { background: var(--green-dark); transform: scale(1.02); }

.btn-delete {
    padding: 10px 18px;
    background: #fff;
    color: #ef4444;
    border: 1px solid #fecdd3;
    border-radius: 9px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.btn-delete:hover { background: #fef2f2; border-color: #fca5a5; }

@media (max-width: 1000px) {
    .dash-actions-strip { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .dash-stats { grid-template-columns: 1fr 1fr; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 10px 10px; }
}

/* ══════════════════════════════════════════════════════════
   PLAN FOLDER CARDS (Windows Explorer style)
══════════════════════════════════════════════════════════ */
.plans-folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 16px;
    padding: 8px 0 20px;
}

.plan-folder-card {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px 14px 14px;
    cursor: pointer;
    position: relative;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
    text-align: center;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.plan-folder-card:hover {
    box-shadow: 0 8px 28px rgba(15,23,32,0.13);
    border-color: #FFD04B;
    transform: translateY(-3px);
}
.plan-folder-card--inactive { opacity: 0.65; }
.plan-folder-card--inactive:hover { border-color: #c8d0d9; }

.plan-folder-del-btn {
    position: absolute;
    top: 8px; right: 8px;
    width: 22px; height: 22px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
    transition: background 0.15s, color 0.15s;
    opacity: 0;
}
.plan-folder-card:hover .plan-folder-del-btn { opacity: 1; }
.plan-folder-del-btn:hover { background: #fee2e2; color: #ef4444; }

.plan-folder-icon { width: 72px; height: auto; display: block; }
.plan-folder-icon svg { width: 100%; height: auto; }

.plan-folder-name {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    margin-top: 6px;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.plan-folder-patient {
    font-size: 11.5px;
    color: #64748b;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plan-folder-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 2px;
}
.plan-folder-meds {
    font-size: 11px;
    color: #0f7c4a;
    font-weight: 600;
    background: rgba(15,124,74,0.08);
    padding: 2px 7px;
    border-radius: 20px;
}
.plan-folder-date { font-size: 10.5px; color: #9ca3af; }

.plan-folder-badge {
    position: absolute;
    top: 8px;
    left: 10px;
    font-size: 9.5px;
    font-weight: 700;
    border-radius: 20px;
    padding: 2px 8px;
    letter-spacing: 0.02em;
    pointer-events: none;
}

/* Open-interior button on folder card */
.plan-folder-open-btn {
    margin-top: 6px;
    width: 100%;
    padding: 6px 0;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 700;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: background 0.14s, border-color 0.14s, color 0.14s;
}
.plan-folder-open-btn:hover { background: #f0fdf4; border-color: #bbf7d0; color: var(--green); }

/* ══════════════════════════════════════════════════════════
   ADD-TO-PLAN MODAL  (catalog "Agregar" button)
══════════════════════════════════════════════════════════ */
.modal-box--narrow { max-width: 440px; }

.atp-tabs {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    margin: 0 0 12px;
    gap: 0;
}
.atp-tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.atp-tab:hover { color: #1e293b; }
.atp-tab--active { color: var(--green); border-bottom-color: var(--green); }

.atp-content { max-height: 300px; overflow-y: auto; }

.atp-list { display: flex; flex-direction: column; gap: 6px; }

.atp-empty {
    font-size: 13px;
    color: #9ca3af;
    text-align: center;
    padding: 24px 16px;
    background: #f8fafc;
    border-radius: 10px;
}

.atp-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    background: #fff;
}
.atp-item:hover {
    border-color: var(--green);
    background: rgba(15,124,74,0.04);
    box-shadow: 0 3px 10px rgba(15,124,74,0.1);
}
.atp-item-folder { width: 32px; height: auto; flex-shrink: 0; }
.atp-item-folder svg { width: 100%; height: auto; }

.atp-item-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green), #1aaa68);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.atp-item-info { flex: 1; min-width: 0; }
.atp-item-name { font-size: 13px; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atp-item-meta { font-size: 11px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atp-item-create-lbl { font-size: 11px; font-weight: 600; color: var(--green); background: rgba(15,124,74,0.08); padding: 3px 8px; border-radius: 20px; white-space: nowrap; }

/* ══════════════════════════════════════════════════════════
   PLAN MODAL — Medications list
══════════════════════════════════════════════════════════ */
.plan-meds-label {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 6px;
}
.plan-meds-hint { font-size: 11px; color: #94a3b8; }

.plan-meds-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px;
    background: #f8fafc;
}

.plan-meds-empty {
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
    padding: 14px;
}

.plan-med-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 7px 10px;
}
.plan-med-info { flex: 1; min-width: 0; }
.plan-med-name { font-size: 12px; font-weight: 600; color: #1e293b; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-med-cat  { font-size: 10.5px; color: #94a3b8; }

.plan-med-qty  { display: flex; align-items: center; gap: 5px; flex-shrink: 0; font-size: 13px; font-weight: 600; color: #1e293b; }
.plan-med-minus, .plan-med-plus {
    width: 22px; height: 22px;
    border-radius: 6px;
    border: 1.5px solid #e5e7eb;
    background: #f3f4f6;
    color: #374151;
    font-size: 14px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
    transition: background 0.12s, border-color 0.12s;
}
.plan-med-minus:hover, .plan-med-plus:hover { background: #e5e7eb; border-color: #d1d5db; }

.plan-med-remove {
    width: 22px; height: 22px;
    border: none; background: none;
    color: #cbd5e1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
}
.plan-med-remove:hover { background: #fee2e2; color: #ef4444; }

/* ══════════════════════════════════════════════════════════
   TOAST NOTIFICATION
══════════════════════════════════════════════════════════ */
#gfu-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1e293b;
    color: #fff;
    padding: 12px 22px;
    border-radius: 40px;
    font-size: 13.5px;
    font-weight: 600;
    box-shadow: 0 8px 28px rgba(15,23,32,0.22);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    z-index: 9999;
    white-space: nowrap;
}
#gfu-toast.toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
#gfu-toast.toast-error {
    background: #dc2626;
}

@media (max-width: 600px) {
    .plans-folder-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
}

/* ═══════════════════════════════════════════════════════
   PLANS SECTION — FIXES & HINTS
═══════════════════════════════════════════════════════ */
.plans-section { padding-bottom: 48px; }

.plans-dblclick-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: #94a3b8;
    margin: 0 0 12px;
}
.plans-dblclick-hint svg { flex-shrink: 0; }

.plan-folder-card { cursor: pointer; }
.plan-folder-card--selected {
    outline: 2.5px solid var(--green);
    outline-offset: 2px;
    box-shadow: 0 0 0 6px rgba(15,124,74,0.1);
}

/* ═══════════════════════════════════════════════════════
   PLAN INTERIOR
═══════════════════════════════════════════════════════ */
.plans-interior {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 48px;
    animation: piSlideIn 0.22s cubic-bezier(0.22,1,0.36,1) both;
}
@keyframes piSlideIn { from { opacity:0; transform:translateX(18px); } to { opacity:1; transform:none; } }

/* ── Middle breadcrumb (clickable) ── */
.pi-crumb-mid {
    background: none; border: none; padding: 0;
    font-size: 13px; font-weight: 600; color: var(--gray-700);
    cursor: pointer; font-family: inherit;
    transition: color 0.15s;
}
.pi-crumb-mid:hover { color: var(--green); text-decoration: underline; }

/* ══ Plan-Prog Interior (nivel 2 dentro de Planes) ══ */
.pip-header {
    gap: 14px;
    align-items: center;
}
.pip-header-fields {
    flex: 1;
    min-width: 0;
}
.pip-prog-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.pip-prog-name-base {
    font-size: 18px;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.02em;
    white-space: nowrap;
}
.pip-prog-name-suffix {
    font-size: 15px;
    font-weight: 600;
    color: #475569;
    background: transparent;
    border: none;
    border-bottom: 1.5px dashed #d1d5db;
    outline: none;
    padding: 2px 4px;
    min-width: 130px;
    flex: 1;
    letter-spacing: -0.01em;
}
.pip-prog-name-suffix:focus { border-bottom-color: var(--green); }
.pip-prog-name-suffix::placeholder { color: #9ca3af; font-weight: 400; }
.pip-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.pip-view-general-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 9px;
    background: #fff;
    color: #374151;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    font-family: inherit;
}
.pip-view-general-btn:hover {
    border-color: var(--green);
    color: var(--green);
    background: #f0fdf7;
}
.pip-body-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: start;
}

.pip-patients-hint {
    font-size: 12px;
    color: #9ca3af;
    margin: 0 0 10px;
    line-height: 1.5;
}
.pip-pat-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pip-pat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: #fff;
}
.pip-pat-row:hover { border-color: var(--green); background: #f0fdf7; }
.pip-pat-check {
    width: 16px; height: 16px; accent-color: var(--green); cursor: pointer; flex-shrink: 0;
}
.pip-pat-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green), #1aaa68);
    color: #fff; font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.pip-pat-name {
    font-size: 13px; font-weight: 600; color: #1e293b;
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pip-summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.pip-summary-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}
.pip-summary-lbl {
    font-size: 10.5px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.pip-summary-row > span:last-child {
    font-size: 12.5px;
    font-weight: 500;
    color: #374151;
    word-break: break-word;
}

/* ── Plan→Program Interior: Medications Panel ── */
.pp-meds-panel {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px;
}
.pp-meds-hint {
    font-size: 12px;
    color: #9ca3af;
    margin: 0 0 12px;
    line-height: 1.5;
}
.pp-meds-hint b { color: #059669; font-weight: 600; }
.pp-meds-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pp-med-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: #f8fafc;
    transition: border-color .15s;
}
.pp-med-item:hover { border-color: #cbd5e1; }
.pp-med-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.pp-med-name {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pp-med-meta {
    font-size: 11.5px;
    color: #64748b;
}
.pp-med-item-btns {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.pp-med-edit-btn,
.pp-med-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: all .15s;
}
.pp-med-edit-btn { color: #3b82f6; }
.pp-med-edit-btn:hover { background: #eff6ff; color: #2563eb; }
.pp-med-remove-btn { color: #94a3b8; }
.pp-med-remove-btn:hover { background: #fee2e2; color: #ef4444; }

/* ── Program Med Edit Modal ── */
.pp-med-edit-modal {
    background: #fff;
    border-radius: 18px;
    width: 520px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,.18);
}
.pp-med-edit-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid #e5e7eb;
}
.pp-med-edit-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.pp-med-edit-header h3 {
    flex: 1;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}
.pp-med-edit-body {
    padding: 18px 20px;
}
.pp-med-edit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}
.pp-med-edit-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.pp-med-edit-field > span {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pp-med-edit-field input,
.pp-med-edit-field textarea {
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    color: #1e293b;
    font-family: inherit;
    transition: border-color .15s;
    background: #fff;
}
.pp-med-edit-field input:focus,
.pp-med-edit-field textarea:focus {
    border-color: var(--green);
    outline: none;
}
.pp-med-edit-full { grid-column: 1 / -1; }
.pp-med-edit-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid #e5e7eb;
}

/* Breadcrumb */
.pi-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.pi-back-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    padding: 5px 11px 5px 9px;
    font-size: 12.5px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.pi-back-btn:hover { background: #f1f5f9; border-color: #cbd5e1; color: var(--green); }
.pi-sep-chevron { color: #d1d5db; }
.pi-crumb-current {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

/* Header card */
.pi-header-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 16px;
    padding: 20px 22px;
    box-shadow: 0 4px 18px rgba(15,23,32,0.07);
}
.pi-header-folder { flex-shrink: 0; }
.pi-header-folder svg { display: block; }
.pi-header-fields { flex: 1; min-width: 0; }
.pi-title-input {
    width: auto;
    min-width: 60px;
    max-width: 100%;
    font-size: 20px;
    font-weight: 800;
    color: #1e293b;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    outline: none;
    margin-bottom: 6px;
    font-family: inherit;
    padding: 0 0 3px 0;
    transition: border-color 0.15s;
    cursor: text;
    display: block;
}
.pi-title-input:hover { border-bottom-color: #e2e8f0; }
.pi-title-input:focus { border-bottom-color: var(--green); color: var(--green); }
.pi-header-meta-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.pi-status-select {
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 4px 10px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    outline: none;
}
.pi-date-label { font-size: 11px; color: #94a3b8; }
.pi-save-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 11px 22px;
}

/* Body grid */
.pi-body-grid {
    display: grid;
    grid-template-columns: 1fr 1.8fr 1fr;
    gap: 16px;
    align-items: start;
}
@media (max-width: 1100px) { .pi-body-grid { grid-template-columns: 1fr 1.6fr; } .pi-panel--notes { grid-column: 1/-1; } }
@media (max-width: 720px)  { .pi-body-grid { grid-template-columns: 1fr; } }

/* Panel card */
.pi-panel {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 200px;
}
.pi-panel--meds { min-height: 260px; }
.pi-panel--notes { min-height: 160px; }
.pi-panel-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1.5px solid #f1f5f9;
    padding-bottom: 10px;
}
.pi-panel-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    margin: 0;
}
.pi-panel-count {
    background: #f1f5f9;
    color: #64748b;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
}
.pi-panel-empty {
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
    padding: 20px 10px;
    border: 1.5px dashed #e5e7eb;
    border-radius: 10px;
}

/* Patient autocomplete */
.pi-autocomplete-wrap { position: relative; }
.pi-autocomplete-row {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #f8fafc;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    padding: 7px 10px;
    transition: border-color 0.15s;
}
.pi-autocomplete-row:focus-within { border-color: var(--green); background: #fff; }
.pi-autocomplete-row svg { color: #94a3b8; flex-shrink: 0; }
.pi-search-input {
    flex: 1;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 12.5px;
    color: #1e293b;
    outline: none;
}
.pi-search-input::placeholder { color: #94a3b8; }

.pi-suggestions-box {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(15,23,32,0.14);
    z-index: 100;
    overflow: hidden;
    max-height: 240px;
    overflow-y: auto;
}
.pi-sugg-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.12s;
}
.pi-sugg-item:hover { background: #f0fdf4; }
.pi-sugg-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green), #1aaa68);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.pi-sugg-info { flex: 1; min-width: 0; }
.pi-sugg-name  { font-size: 12.5px; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-sugg-meta  { font-size: 11px; color: #94a3b8; }
.pi-sugg-add   { font-size: 11px; font-weight: 600; color: var(--green); background: rgba(15,124,74,0.08); border-radius: 20px; padding: 2px 8px; white-space: nowrap; }
.pi-sugg-empty { font-size: 12px; color: #9ca3af; text-align: center; padding: 14px; }

/* Patients list */
.pi-patients-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
}
.pi-patient-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    background: #f8fafc;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
}
.pi-patient-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green), #1aaa68);
    color: #fff; font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.pi-patient-info { flex: 1; min-width: 0; }
.pi-patient-name { display: block; font-size: 12.5px; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-patient-id   { font-size: 10.5px; color: #94a3b8; }
.pi-patient-remove {
    width: 22px; height: 22px;
    border: none; background: none;
    color: #cbd5e1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; padding: 0; flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
}
.pi-patient-remove:hover { background: #fee2e2; color: #ef4444; }

/* Medications in interior */
.pi-meds-from-catalog {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: #94a3b8;
}
.pi-catalog-link {
    background: none;
    border: none;
    color: var(--green);
    font-weight: 700;
    font-family: inherit;
    font-size: 11.5px;
    cursor: pointer;
    padding: 0;
    transition: color 0.12s;
}
.pi-catalog-link:hover { color: var(--green-dark); }

/* Med search inside interior */
.pi-med-search-wrap { position: relative; }
.pi-med-search-row {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #f8fafc;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    padding: 7px 10px;
    transition: border-color 0.15s;
}
.pi-med-search-row:focus-within { border-color: var(--green); background: #fff; }
.pi-med-search-row svg { color: #94a3b8; flex-shrink: 0; }
.pi-med-search-input {
    flex: 1; border: none; background: none;
    font-family: inherit; font-size: 12.5px;
    color: #1e293b; outline: none;
}
.pi-med-search-input::placeholder { color: #94a3b8; }
.pi-med-sugg-box {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(15,23,32,0.14);
    z-index: 110;
    overflow: hidden;
    max-height: 220px;
    overflow-y: auto;
}
.pi-med-sugg-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; cursor: pointer;
    transition: background 0.12s;
}
.pi-med-sugg-item:hover { background: #f0fdf4; }
.pi-med-sugg-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pi-med-sugg-info { flex: 1; min-width: 0; }
.pi-med-sugg-name { font-size: 12.5px; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-med-sugg-cat { font-size: 10.5px; color: #94a3b8; }
.pi-med-sugg-add { font-size: 11px; font-weight: 600; color: var(--green); background: rgba(15,124,74,0.08); border-radius: 20px; padding: 2px 8px; white-space: nowrap; }
.pi-med-sugg-empty { font-size: 12px; color: #9ca3af; text-align: center; padding: 14px; }

/* View toggle button */
.pi-view-toggle {
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 8px;
    padding: 4px 9px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    display: flex; align-items: center; gap: 5px;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.pi-view-toggle.active { background: #f0fdf4; border-color: #bbf7d0; color: var(--green); }

/* Interior patient picker (inline, when 2+ patients) */
.pi-picker-overlay {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 8px 28px rgba(15,23,32,0.12);
}
.pi-picker-hdr { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pi-picker-back { border: none; background: none; cursor: pointer; color: var(--green); font-family: inherit; font-size: 12px; font-weight: 600; padding: 0; display: flex; align-items: center; gap: 3px; }
.pi-picker-back:hover { color: var(--green-dark); }
.pi-picker-title { font-size: 12.5px; font-weight: 700; color: #1e293b; }
.pi-picker-desc { font-size: 11.5px; color: #64748b; margin-bottom: 8px; }
.pi-picker-list { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; }
.pi-picker-patient {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 11px;
    background: #f8fafc;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.pi-picker-patient:hover { background: #f0fdf4; border-color: #bbf7d0; }
.pi-picker-avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--green), #1aaa68); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pi-picker-info { flex: 1; min-width: 0; }
.pi-picker-name { font-size: 12.5px; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-picker-id { font-size: 10.5px; color: #94a3b8; }

/* Meds group header ("por paciente" view) */
.pi-meds-group-hdr {
    font-size: 11px; font-weight: 700;
    color: var(--green);
    background: rgba(15,124,74,0.07);
    border-radius: 7px;
    padding: 4px 10px;
    margin-top: 4px;
    letter-spacing: 0.02em;
}

/* ATP patient picker step */
.atp-patient-picker { padding: 4px 0 8px; }
.atp-picker-step-hdr { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.atp-pkback { border: none; background: none; cursor: pointer; color: var(--green); font-family: inherit; font-size: 12px; font-weight: 600; padding: 0; display: flex; align-items: center; gap: 4px; }
.atp-pkback:hover { color: var(--green-dark); }
.atp-pk-title { font-size: 13px; font-weight: 700; color: #1e293b; }
.atp-pk-desc { font-size: 12px; color: #64748b; margin-bottom: 10px; }
.atp-pk-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; }
.atp-pk-patient {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.atp-pk-patient:hover { background: #f0fdf4; border-color: #bbf7d0; }
.atp-pk-avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--green), #1aaa68); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.atp-pk-info { flex: 1; min-width: 0; }
.atp-pk-name { font-size: 13px; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atp-pk-sub { font-size: 11px; color: #94a3b8; }
.pi-meds-table-hdr {
    display: flex;
    justify-content: space-between;
    font-size: 10.5px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0 4px;
}
.pi-meds-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    max-height: 360px;
    overflow-y: auto;
}
.pi-med-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 9px 11px;
}
.pi-med-color {
    width: 4px;
    height: 34px;
    border-radius: 4px;
    flex-shrink: 0;
}
.pi-med-info { flex: 1; min-width: 0; }
.pi-med-name { display: block; font-size: 12.5px; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-med-cat-row { display: flex; align-items: center; gap: 6px; margin-top: 2px; flex-wrap: wrap; }
.pi-med-cat  { font-size: 10.5px; color: #94a3b8; }
.pi-med-patient-tag {
    font-size: 9.5px; font-weight: 600;
    color: var(--green);
    background: rgba(15,124,74,0.09);
    border-radius: 20px;
    padding: 1px 7px;
    white-space: nowrap;
    display: flex; align-items: center; gap: 3px;
}
.pi-med-dosage {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}
.pi-dosage-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.pi-dosage-lbl { font-size: 9px; font-weight: 600; color: #94a3b8; text-transform: uppercase; }
.pi-dosage-input {
    width: 42px;
    text-align: center;
    border: 1.5px solid #e2e8f0;
    border-radius: 7px;
    padding: 4px 4px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    background: #fff;
    outline: none;
    transition: border-color 0.15s;
}
.pi-dosage-input::-webkit-outer-spin-button,
.pi-dosage-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pi-dosage-input:focus { border-color: var(--green); }
.pi-dosage-sep { font-size: 11px; font-weight: 700; color: #cbd5e1; }
.pi-dosage-sep--bottles { color: #e2e8f0; font-size: 16px; font-weight: 300; margin: 0 2px; }
.pi-dosage-badge {
    background: #f0fdf4;
    border: 1.5px solid #bbf7d0;
    border-radius: 20px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--green);
    white-space: nowrap;
    min-width: 52px;
    text-align: center;
}
.pi-med-remove {
    width: 22px; height: 22px;
    border: none; background: none;
    color: #cbd5e1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; padding: 0; flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
}
.pi-med-remove:hover { background: #fee2e2; color: #ef4444; }

/* Notes */
.pi-notes-textarea {
    flex: 1;
    width: 100%;
    min-height: 140px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    font-family: inherit;
    font-size: 12.5px;
    color: #374151;
    background: #f8fafc;
    outline: none;
    resize: vertical;
    transition: border-color 0.15s;
}
.pi-notes-textarea:focus { border-color: var(--green); background: #fff; }

/* ═══════════════════════════════════════════════════════
   ATP MODAL — redesigned
═══════════════════════════════════════════════════════ */
.modal-box--atp {
    max-width: 660px;
    padding: 0;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

/* Product card header */
.atp-product-card {
    position: relative;
    background: linear-gradient(135deg, #0b5a36 0%, #0f7c4a 60%, #1aaa68 100%);
    padding: 28px 28px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    overflow: hidden;
}
.atp-product-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 85% 50%, rgba(255,255,255,0.08), transparent 60%);
}
.atp-close-abs {
    position: absolute;
    top: 14px; right: 14px;
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.18);
    color: #fff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
    z-index: 2;
}
.atp-close-abs:hover { background: rgba(255,255,255,0.3); }
.atp-prod-left { flex: 1; min-width: 0; position: relative; z-index: 1; }
.atp-prod-category {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.9);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: 0.03em;
}
.atp-prod-name {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    margin: 0 0 4px;
    line-height: 1.2;
}
.atp-prod-indication {
    font-size: 12px;
    color: rgba(255,255,255,0.75);
    margin: 0 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.atp-prod-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.atp-prod-chip {
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.9);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
}
.atp-prod-chip--price { background: rgba(255,255,255,0.25); color: #fff; }
.atp-prod-icon {
    position: relative;
    z-index: 1;
    opacity: 0.6;
    flex-shrink: 0;
}

/* Body */
.atp-body-wrap { padding: 22px 24px 24px; overflow-y: auto; flex: 1; min-height: 0; }
.atp-body-question {
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    margin: 0 0 14px;
}

/* Big tab buttons */
.atp-bigtabs {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}
.atp-bigtab {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 13px 14px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.atp-bigtab:hover { border-color: #94a3b8; background: #fff; }
.atp-bigtab--active {
    border-color: var(--green);
    background: #f0fdf4;
    box-shadow: 0 0 0 4px rgba(15,124,74,0.08);
}
.atp-bigtab-icon { flex-shrink: 0; width: 40px; display: flex; align-items: center; justify-content: center; }
.atp-bigtab-lbl  { font-size: 13px; font-weight: 700; color: #1e293b; }
.atp-bigtab-sub  { font-size: 11px; color: #64748b; margin-top: 1px; }

/* List area */
.atp-list-area { max-height: 260px; overflow-y: auto; }
.atp-list { display: flex; flex-direction: column; gap: 7px; }
.atp-empty {
    font-size: 13px; color: #9ca3af; text-align: center; padding: 24px 16px;
    background: #f8fafc; border-radius: 10px;
}
.atp-item {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 13px;
    border: 1.5px solid #e5e7eb; border-radius: 11px;
    cursor: pointer; background: #fff;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.atp-item:hover { border-color: var(--green); background: #f0fdf4; box-shadow: 0 3px 12px rgba(15,124,74,0.1); }
.atp-item-folder { width: 36px; height: auto; flex-shrink: 0; }
.atp-item-folder svg { width: 100%; height: auto; }
.atp-item-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--green), #1aaa68);
    color: #fff; font-size: 12px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.atp-item-info { flex: 1; min-width: 0; }
.atp-item-name { font-size: 13px; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atp-item-meta { font-size: 11px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atp-item-create-lbl { font-size: 11px; font-weight: 600; color: var(--green); background: rgba(15,124,74,0.08); padding: 3px 8px; border-radius: 20px; white-space: nowrap; }

/* ══ Catalog search bar ══ */
.catalog-page-header { gap: 10px; }
.catalog-search-bar {
    display: flex; align-items: center; gap: 8px;
    background: #fff; border: 1.5px solid #e2e8f0;
    border-radius: 10px; padding: 8px 14px;
    flex: 1; max-width: 300px;
    transition: border-color 0.15s;
}
.catalog-search-bar:focus-within { border-color: var(--green); }
.catalog-search-bar svg { color: #9ca3af; flex-shrink: 0; }
.catalog-search-bar input {
    border: none; background: none; outline: none;
    font-family: inherit; font-size: 13px; color: #1e293b; width: 100%;
}
.catalog-search-bar input::placeholder { color: #9ca3af; }

/* ══ ATP mini search ══ */
.atp-search-mini {
    display: flex; align-items: center; gap: 8px;
    background: #f8fafc; border: 1.5px solid #e5e7eb;
    border-radius: 9px; padding: 7px 12px;
    margin-bottom: 8px;
    transition: border-color 0.15s;
}
.atp-search-mini:focus-within { border-color: var(--green); }
.atp-search-mini svg { color: #9ca3af; flex-shrink: 0; }
.atp-search-mini input {
    border: none; background: none; outline: none;
    font-family: inherit; font-size: 12.5px; color: #1e293b; width: 100%;
}
.atp-search-mini input::placeholder { color: #b0b8c4; }

/* ══ Patient table avatar ══ */
.th-avatar { width: 50px; }
.td-avatar  { width: 50px; padding-right: 4px; vertical-align: middle; }
.pt-avatar-circle {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--green), #1aaa68);
    color: #fff; font-size: 12px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; flex-shrink: 0;
}

/* ══ Patient profile ══ */
.profile-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 18px;
    align-items: stretch;
    margin-top: 16px;
}
.profile-left-card, .profile-right-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(15,23,32,0.05);
}
.profile-right-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.profile-avatar-wrap {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding-bottom: 18px; border-bottom: 1px solid #f1f5f9; margin-bottom: 16px;
}
.profile-avatar-circle {
    width: 90px; height: 90px; border-radius: 50%;
    background: linear-gradient(135deg, var(--green), #1aaa68);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; border: 3px solid #e2fff0;
}
.profile-avatar-initials { font-size: 28px; font-weight: 800; color: #fff; letter-spacing: -1px; }
.profile-avatar-edit-btn {
    font-size: 11px; font-weight: 600; color: var(--green);
    background: rgba(15,124,74,0.08); border: none;
    padding: 5px 14px; border-radius: 20px; cursor: pointer; font-family: inherit;
    transition: background 0.12s;
}
.profile-avatar-edit-btn:hover { background: rgba(15,124,74,0.15); }
.profile-patient-name {
    font-size: 17px; font-weight: 800; color: #1e293b;
    text-align: center; margin-bottom: 12px; line-height: 1.3;
}
.profile-info-list { display: flex; flex-direction: column; gap: 0; margin-bottom: 18px; }
.profile-info-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 9px 0; border-bottom: 1px solid #f1f5f9;
}
.profile-info-row:last-child { border-bottom: none; }
.profile-info-label { font-size: 11px; font-weight: 700; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.06em; flex-shrink: 0; }
.profile-info-value { font-size: 13px; font-weight: 600; color: #1e293b; text-align: right; word-break: break-word; max-width: 60%; }
.profile-right-title { font-size: 15px; font-weight: 800; color: #1e293b; margin-bottom: 0; flex-shrink: 0; }
.profile-hist-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}
.hist-paginator {
    display: flex;
    align-items: center;
    gap: 2px;
}
.hist-pag-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all .15s;
}
.hist-pag-btn:hover { border-color: #0f7c4a; color: #0f7c4a; background: #f0fdf4; }
.hist-pag-btn--active { background: #0f7c4a; color: #fff; border-color: #0f7c4a; }
.hist-pag-btn--active:hover { background: #0b5a36; }
.hist-pag-btn:disabled { opacity: .4; cursor: default; }
.hist-pag-dots { font-size: 12px; color: #94a3b8; padding: 0 2px; }
.profile-right-placeholder {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; padding: 52px 24px; text-align: center;
    color: #9ca3af; background: #f8fafc; border-radius: 12px;
    border: 1.5px dashed #e2e8f0;
}
.profile-right-placeholder p { font-size: 13px; font-weight: 500; max-width: 260px; line-height: 1.6; color: #94a3b8; }
@media (max-width: 900px) { .profile-layout { grid-template-columns: 1fr; } }

/* ══ Notes expand modal ══ */
#notesExpandModal { z-index: 200; } /* above other modals */
.modal-box--notes {
    max-width: 720px;
    width: 95%;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 72vh;
    max-height: 72vh;
    overflow: hidden;
}
.notes-modal-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    background: #fff;
    border-radius: 16px 16px 0 0;
}
.notes-modal-title {
    flex: 1;
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}
.notes-modal-close {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
}
.notes-modal-close:hover { background: #fee2e2; color: #dc2626; }
.notes-expand-textarea {
    flex: 1;
    width: 100%;
    min-height: 0;
    border: none;
    border-radius: 0;
    padding: 16px 22px;
    font-family: inherit;
    font-size: 13.5px;
    color: #374151;
    background: #fafbfc;
    outline: none;
    resize: none;
    line-height: 1.75;
    box-sizing: border-box;
}
.notes-expand-textarea:focus { background: #fff; }
.notes-modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
    border-radius: 0 0 16px 16px;
}
.notes-modal-cancel {
    font-size: 13px; font-weight: 600; color: #64748b;
    background: #f1f5f9; border: none;
    padding: 7px 16px; border-radius: 8px; cursor: pointer; font-family: inherit;
    transition: background 0.12s;
}
.notes-modal-cancel:hover { background: #e2e8f0; }
.notes-modal-save {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 700; color: #fff;
    background: var(--green); border: none;
    padding: 7px 18px; border-radius: 8px; cursor: pointer; font-family: inherit;
    transition: background 0.12s;
}
.notes-modal-save:hover { background: #0a6b40; }

/* ══ Notes expand button ══ */
.pi-notes-expand-btn {
    font-size: 11px; font-weight: 600; color: var(--green);
    background: rgba(15,124,74,0.07); border: none;
    padding: 3px 10px; border-radius: 14px; cursor: pointer; font-family: inherit;
    transition: background 0.12s; white-space: nowrap;
}
.pi-notes-expand-btn:hover { background: rgba(15,124,74,0.14); }

/* ══ Qty stepper in med row ══ */
.pi-qty-stepper {
    display: flex;
    align-items: center;
    border: 1.5px solid #e5e7eb;
    border-radius: 7px;
    overflow: hidden;
    height: 28px;
}
.pi-qty-btn {
    width: 24px; height: 100%;
    border: none; background: #f8fafc;
    color: #64748b; font-size: 15px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background 0.1s, color 0.1s;
    font-family: inherit; flex-shrink: 0;
    line-height: 1;
}
.pi-qty-btn:hover { background: #e2f5ea; color: var(--green); }
.pi-qty-val {
    min-width: 26px; text-align: center;
    font-size: 12px; font-weight: 700; color: #1e293b;
    padding: 0 3px;
    border-left: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
    height: 100%; display: flex; align-items: center; justify-content: center;
}

/* ══════════════════════════════════════════════════════════
   PROGRAMS SECTION
══════════════════════════════════════════════════════════ */

/* Division filter pills */
.prog-filter-pills {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.prog-pill {
    padding: 6px 16px; border-radius: 20px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc; color: #475569;
    font-size: 13px; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: all 0.13s;
}
.prog-pill:hover { background: rgba(15,124,74,0.06); border-color: var(--green); color: var(--green); }
/* .prog-pill--active: no persistent tint – hover shows green only */

/* Division accent pills (idle color hints) */
.prog-pill--cardio  { border-color: #fca5a5; }
.prog-pill--diabetes{ border-color: #93c5fd; }
.prog-pill--erge    { border-color: #fdba74; }
.prog-pill--womens  { border-color: #c4b5fd; }
.prog-pill--mens    { border-color: #6ee7b7; }
.prog-pill--cancer  { border-color: #fcd34d; }

.btn-new-prog {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s;
}
.btn-new-prog:hover { opacity: 0.88; }

/* ── Programs section toolbar (filter + search) ── */
.prog-section-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.prog-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.prog-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 11px;
    padding: 8px 14px;
    min-width: 200px;
    flex: 0 1 240px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: border-color 0.15s;
}
.prog-search-bar:focus-within { border-color: var(--green); }
.prog-search-bar input {
    border: none; outline: none;
    font-size: 13px; font-family: inherit;
    color: #374151; background: transparent; flex: 1;
}
.prog-search-bar svg { color: #94a3b8; flex-shrink: 0; }

/* ── form-label-row (label + action button on same line) ── */
.form-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.form-label-row > .form-label { margin-bottom: 0; }

/* Grid */
.prog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 16px;
    padding: 8px 0 20px;
}

/* Empty state */
.prog-empty-state {
    grid-column: 1 / -1;
    display: flex; flex-direction: column; align-items: center;
    gap: 12px; padding: 64px 24px;
    color: #94a3b8; font-size: 14px;
}
.prog-empty-cta {
    margin-top: 4px; padding: 9px 22px;
    background: var(--green); color: #fff;
    border: none; border-radius: 8px;
    font-size: 13px; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: background 0.13s;
}
.prog-empty-cta:hover { background: #0a6b3f; }

/* Program folder card (prog-grid) — uses plan-folder-card base + overrides below */
.prog-folder-card:hover { border-color: #94a3b8; }
.prog-folder-btn-row {
    display: flex; gap: 5px; width: 100%; margin-top: 4px;
}
.prog-folder-assign-btn {
    padding: 5px 8px; border-radius: 7px;
    background: var(--green); color: #fff;
    border: none; font-size: 11px; font-weight: 700;
    font-family: inherit; cursor: pointer;
    transition: background 0.13s; white-space: nowrap;
}
.prog-folder-assign-btn:hover { background: #0a6b3f; }
.prog-folder-open-btn { flex: 1; font-size: 11px; }
.prog-med-chip {
    font-size: 11.5px; font-weight: 600;
    padding: 3px 9px; border-radius: 10px;
    background: rgba(15,124,74,0.10); color: #0f7c4a;
    border: 1px solid rgba(15,124,74,0.20);
    display: inline-flex; align-items: center; gap: 4px;
}
.prog-med-chip--removable { padding-right: 6px; }
.prog-med-chip-rm {
    background: none; border: none; color: #0f7c4a;
    font-size: 14px; cursor: pointer; padding: 0; line-height: 1;
    opacity: 0.6; transition: opacity 0.1s;
}
.prog-med-chip-rm:hover { opacity: 1; }

.prog-card-footer {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 10px; margin-top: auto; padding-top: 6px;
    border-top: 1px solid rgba(0,0,0,0.06);
}
.prog-card-meta { display: flex; flex-direction: column; gap: 4px; }
.prog-meta-item {
    font-size: 12px; color: #64748b;
    display: flex; align-items: center; gap: 4px;
    font-weight: 500;
}
.prog-meta-price { color: var(--green); font-weight: 700; font-size: 13px; }
.prog-card-footer-right { display: flex; align-items: center; gap: 8px; }
.prog-assigned-badge {
    font-size: 11px; font-weight: 600; color: #7c3aed;
    background: #ede9fe; padding: 2px 8px; border-radius: 10px;
}
.prog-add-btn {
    padding: 6px 14px; border-radius: 7px;
    background: var(--green); color: #fff;
    border: none; font-size: 12px; font-weight: 700;
    font-family: inherit; cursor: pointer;
    transition: background 0.13s;
    white-space: nowrap;
}
.prog-add-btn:hover { background: #0a6b3f; }

/* ── Program modal: med search ── */
.prog-med-search-wrap { position: relative; margin-bottom: 8px; }
.prog-med-search-row {
    display: flex; align-items: center; gap: 8px;
    border: 1.5px solid #e2e8f0; border-radius: 8px;
    padding: 6px 10px; background: #f8fafc;
}
#progMedSearch {
    flex: 1; border: none; background: none;
    font-size: 13px; font-family: inherit; color: #1e293b; outline: none;
}
.prog-med-sugg-box {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    background: #fff; border: 1.5px solid #e2e8f0; border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.09); z-index: 200; overflow: hidden;
}
.prog-meds-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; }
.prog-no-meds { font-size: 12px; color: #94a3b8; padding: 4px 0; }

/* ══════════════════════════════════════════════════════════
   PLAN INTERIOR — Programs panel
══════════════════════════════════════════════════════════ */
.pi-prog-panel { /* kept for compatibility */
    background: #fff;
    border: 1.5px solid #e2e8f0; border-radius: 12px;
    padding: 14px 16px; margin-bottom: 16px;
}
/* New section replaces pi-prog-panel — no container box, just layout */
.pi-progs-section { background: none; border: none; padding: 0; margin-bottom: 0; }
.pi-prog-panel-hdr {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.pi-prog-panel-title {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 700; color: #1e293b; margin: 0;
}
.pi-prog-panel-actions { display: flex; align-items: center; gap: 10px; }
.pi-prog-assign-btn {
    padding: 5px 13px; border-radius: 7px;
    background: var(--green); color: #fff;
    border: none; font-size: 12px; font-weight: 700;
    font-family: inherit; cursor: pointer;
    transition: background 0.13s;
}
.pi-prog-assign-btn:hover { background: #0a6b3f; }
.pi-prog-chips-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* Programs folder grid inside plan interior */
.pi-progs-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.pi-progs-folder-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    gap: 12px !important;
    padding: 4px 0 !important;
}
.prog-plan-folder-card { cursor: pointer; }
.prog-plan-folder-card:hover { border-color: #94a3b8; }
.pi-prog-empty-chip { font-size: 12.5px; color: #94a3b8; }
.pi-prog-chip {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1.5px solid; border-radius: 20px;
    padding: 4px 10px 4px 6px;
    background: #fff; font-size: 12.5px; font-weight: 600; color: #1e293b;
    cursor: pointer; transition: background 0.13s, box-shadow 0.13s;
}
.pi-prog-chip:hover { background: #f1f5f9; box-shadow: 0 2px 6px rgba(15,23,32,0.09); }
.pi-prog-chip-div {
    width: 8px; height: 8px; border-radius: 50%;
    flex-shrink: 0;
}
.pi-prog-chip-name { color: #1e293b; }
.pi-prog-chip-rm {
    background: none; border: none; color: #94a3b8;
    font-size: 15px; cursor: pointer; padding: 0; line-height: 1;
    transition: color 0.1s;
}
.pi-prog-chip-rm:hover { color: #ef4444; }

/* Assign modal — dimmed item */
.atp-item--dimmed { opacity: 0.45; cursor: not-allowed; }
.atp-item-badge {
    font-size: 11px; font-weight: 600;
    background: #dcfce7; color: #15803d;
    padding: 2px 8px; border-radius: 10px; white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════
   PROGRAM INTERIOR
══════════════════════════════════════════════════════════ */
.programs-interior { animation: fadeIn 0.15s ease; }

/* ── Header card ── */
.prog-i-hdr-card {
    display: flex; align-items: center; gap: 16px;
    background: #fff; border: 1.5px solid #e2e8f0; border-radius: 14px;
    padding: 16px 20px; margin-bottom: 20px; flex-wrap: wrap;
}
.prog-i-div-strip {
    width: 6px; border-radius: 4px; align-self: stretch;
    flex-shrink: 0; min-height: 48px;
}
.prog-i-hdr-fields { flex: 1; min-width: 200px; }
.prog-i-hdr-meta-row {
    display: flex; align-items: center; gap: 10px;
    margin-top: 6px; flex-wrap: wrap;
}
.prog-i-div-select {
    font-family: inherit; font-size: 12.5px; font-weight: 500; color: var(--gray-900);
    border: 1px solid var(--gray-200); border-radius: 9px;
    padding: 7px 10px; background: var(--gray-100); outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    cursor: pointer;
}
.prog-i-div-select:focus {
    border-color: var(--green); background: #fff;
    box-shadow: 0 0 0 3px rgba(15,124,74,0.1);
}
/* Duration picker in program interior header */
.prog-i-dur-picker {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}
.prog-i-dur-num, .prog-i-dur-unit, .prog-i-dur-date {
    font-family: inherit; font-size: 12.5px; font-weight: 500; color: var(--gray-900);
    border: 1px solid var(--gray-200); border-radius: 9px;
    padding: 7px 10px; background: var(--gray-100); outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.prog-i-dur-num { width: 68px; }
.prog-i-dur-unit { cursor: pointer; }
.prog-i-dur-num:focus, .prog-i-dur-unit:focus, .prog-i-dur-date:focus {
    border-color: var(--green); background: #fff;
    box-shadow: 0 0 0 3px rgba(15,124,74,0.1);
}
/* Duration picker in program creation modal */
.prog-dur-picker {
    display: flex;
    gap: 8px;
    align-items: center;
}
.prog-dur-num { min-width: 0; max-width: 100px; }
.prog-dur-unit { flex: 1; cursor: pointer; }

.prog-i-hdr-stats { display: flex; gap: 20px; }
.prog-i-stat-item {
    display: flex; flex-direction: column; align-items: center; min-width: 52px;
}
.prog-i-stat-num { font-size: 22px; font-weight: 800; color: #1e293b; line-height: 1; }
.prog-i-stat-lbl {
    font-size: 10.5px; color: #94a3b8;
    text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px;
}

.prog-i-hdr-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.prog-i-total-badge {
    background: #f0fdf4; border: 1.5px solid #bbf7d0; border-radius: 9px;
    padding: 6px 14px; display: flex; flex-direction: column; align-items: center;
    white-space: nowrap;
}
.prog-i-total-label { font-size: 10px; font-weight: 700; color: #15803d; text-transform: uppercase; letter-spacing: 0.06em; }
.prog-i-total-num   { font-size: 16px; font-weight: 800; color: #0f7c4a; line-height: 1.2; }
.prog-i-delete-btn {
    padding: 7px 14px; border: 1.5px solid #fecdd3; background: #fff;
    color: #ef4444; border-radius: 8px; font-size: 12.5px; font-weight: 700;
    font-family: inherit; cursor: pointer; transition: all 0.13s;
}
.prog-i-delete-btn:hover { background: #fef2f2; }

/* ── Assign-program modal redesign ── */
.modal-box--assign {
    max-width: 520px;
    padding: 0;
    overflow: hidden;
}
.assign-modal-hdr {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 22px 18px;
    border-bottom: 1px solid #f1f5f9;
    background: linear-gradient(135deg, #f0fdf4, #fff);
}
.assign-modal-icon {
    width: 46px; height: 46px;
    background: #dcfce7;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: #0f7c4a;
    flex-shrink: 0;
}
.assign-modal-titles { flex: 1; min-width: 0; }
.assign-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 16px 6px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    transition: border-color 0.15s;
}
.assign-search-bar:focus-within { border-color: var(--green); background: #fff; }
.assign-search-bar svg { color: #94a3b8; flex-shrink: 0; }
.assign-search-bar input {
    border: none; outline: none;
    font-size: 13.5px; font-family: inherit;
    color: #374151; background: transparent; flex: 1;
}
.assign-modal-list {
    padding: 6px 12px 18px;
    max-height: 340px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.assign-modal-list .atp-item {
    border-radius: 11px;
    border: 1.5px solid #e2e8f0;
    padding: 10px 14px;
    background: #fff;
    cursor: pointer;
    display: flex; align-items: center; gap: 12px;
    transition: border-color 0.13s, background 0.13s;
}
.assign-modal-list .atp-item:hover:not(.atp-item--dimmed) {
    border-color: var(--green);
    background: #f0fdf4;
}
.assign-modal-list .atp-item.atp-item--dimmed { opacity: 0.5; cursor: default; }
.assign-modal-list .atp-empty { text-align: center; color: #94a3b8; font-size: 13px; padding: 24px 0; }

/* ── Confirm modal ── */
.modal-box--confirm {
    max-width: 370px;
    padding: 36px 28px 28px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.confirm-icon-wrap {
    width: 64px; height: 64px;
    background: #fef3c7;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.confirm-message {
    font-size: 15px; font-weight: 600;
    color: #1e293b; line-height: 1.55;
    margin: 0;
}
.confirm-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: center;
}
.confirm-actions .btn-cancel,
.confirm-actions .btn-delete { min-width: 110px; }

/* ══ Custom Select System ═════════════════════════════════════════════════════ */
/* Native selects hidden after JS init */
select[data-csel] { display: none !important; }

/* Wrap — replaces the space the select used to occupy */
.csel-wrap { display: inline-flex; position: relative; }
.form-group .csel-wrap { display: block; }

/* Trigger button — inherits original select classes for size/visual */
.csel-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    box-sizing: border-box;
    width: 100%;
    font-family: inherit;
    text-align: left;
    white-space: nowrap;
    /* strip native <button> chrome without killing class-provided border/bg/padding */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
.csel-text { flex: 1; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.csel-arrow {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    color: #64748b;
    transition: transform 0.18s;
}
.csel-wrap.open .csel-arrow { transform: rotate(180deg); }

/* Floating dropdown panel (appended to <body>, position:fixed) */
.csel-dropdown {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    box-shadow: 0 8px 28px rgba(15, 23, 32, 0.14);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 4px 0;
    animation: cselIn 0.14s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes cselIn {
    from { opacity: 0; transform: translateY(-5px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)  scale(1); }
}
.csel-option {
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Manrope', sans-serif;
    color: #1e293b;
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
}
.csel-option:hover  { background: #f1f5f9; }
.csel-option.selected { color: #0f7c4a; font-weight: 700; background: #f0fdf7; }
.csel-placeholder { color: #94a3b8; font-style: italic; cursor: default; }
.csel-placeholder:hover { background: none; }

/* ── Body grid: 3 columns × 2 rows ── */
.prog-i-body-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    align-items: start;
}
/* Meds panel in first slot, no special spanning needed; grid auto-places it in col 1 row 1 */
@media (max-width: 960px) {
    .prog-i-body-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
    .prog-i-body-grid { grid-template-columns: 1fr; }
}

/* ── Panel add button ── */
.pi-panel-add-btn {
    padding: 4px 10px; border-radius: 6px;
    border: 1.5px solid #e2e8f0; background: #fff;
    font-size: 12px; font-weight: 700; font-family: inherit;
    color: #64748b; cursor: pointer; transition: all 0.13s;
    white-space: nowrap;
}
.pi-panel-add-btn:hover { border-color: var(--green); color: var(--green); }

/* ── Inline add form ── */
.prog-i-add-form {
    background: #f8fafc; border: 1.5px solid #e2e8f0; border-radius: 10px;
    padding: 12px; margin-bottom: 8px;
    display: flex; flex-direction: column; gap: 8px;
}
.prog-i-add-input {
    font-family: inherit; font-size: 13px; color: #1e293b;
    border: 1.5px solid #e2e8f0; border-radius: 7px;
    padding: 7px 10px; background: #fff; outline: none;
    transition: border-color 0.13s;
}
.prog-i-add-input:focus { border-color: var(--green); }
.prog-i-add-textarea {
    font-family: inherit; font-size: 13px; color: #1e293b;
    border: 1.5px solid #e2e8f0; border-radius: 7px;
    padding: 7px 10px; background: #fff; outline: none;
    resize: vertical; transition: border-color 0.13s;
}
.prog-i-add-textarea:focus { border-color: var(--green); }
.prog-i-add-form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.prog-i-add-cancel {
    padding: 5px 12px; border-radius: 7px; border: 1.5px solid #e2e8f0;
    background: #fff; font-size: 12px; font-weight: 600; font-family: inherit;
    color: #64748b; cursor: pointer;
}
.prog-i-add-save {
    padding: 5px 14px; border-radius: 7px; border: none;
    background: var(--green); color: #fff;
    font-size: 12px; font-weight: 700; font-family: inherit;
    cursor: pointer; transition: background 0.13s;
}
.prog-i-add-save:hover { background: #0a6b3f; }

/* ── Shared item remove button ── */
.prog-i-item-rm {
    background: none; border: none; color: #94a3b8;
    font-size: 16px; cursor: pointer; padding: 0 2px; line-height: 1;
    transition: color 0.1s; flex-shrink: 0;
}
.prog-i-item-rm:hover { color: #ef4444; }

/* ── Interior list container ── */
.prog-i-list { display: flex; flex-direction: column; gap: 8px; }

/* ── Med rows in interior ── */
.prog-i-med-row {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 8px 0; border-bottom: 1px solid #f1f5f9;
}
.prog-i-med-row:last-child { border-bottom: none; }
.prog-i-med-main { flex: 1; }
.prog-i-med-name { font-size: 13px; font-weight: 700; color: #1e293b; }
.prog-i-med-dosage { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.prog-i-dosage-num {
    width: 52px; font-family: inherit; font-size: 12px;
    border: 1.5px solid #e2e8f0; border-radius: 6px;
    padding: 3px 6px; text-align: center; outline: none;
}
.prog-i-dosage-num:focus { border-color: var(--green); }
.prog-i-type-badge {
    display: inline-flex; align-items: center;
    padding: 2px 9px; border-radius: 20px;
    background: #e0f2fe; color: #0369a1;
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.02em; white-space: nowrap; flex-shrink: 0;
}
.prog-i-dosage-freq {
    flex: 1; min-width: 100px; font-family: inherit; font-size: 12px;
    border: 1.5px solid #e2e8f0; border-radius: 6px;
    padding: 3px 8px; outline: none; color: #475569;
}
.prog-i-dosage-freq:focus { border-color: var(--green); }

/* ── Stage items ── */
.prog-i-stage-item {
    background: #f8fafc; border: 1.5px solid #e2e8f0;
    border-radius: 9px; padding: 10px 12px;
}
.prog-i-stage-top {
    display: flex; align-items: center;
    justify-content: space-between; gap: 8px;
}
.prog-i-stage-left { display: flex; align-items: center; gap: 8px; }
.prog-i-stage-num {
    font-size: 10.5px; font-weight: 700; color: #94a3b8;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.prog-i-stage-name { font-size: 13px; font-weight: 700; color: #1e293b; }
.prog-i-stage-dur {
    font-size: 11.5px; color: #64748b; font-weight: 600;
    background: #e2e8f0; border-radius: 5px; padding: 2px 7px;
}
.prog-i-stage-desc {
    font-size: 12px; color: #64748b;
    margin: 6px 0 0; line-height: 1.5;
}

/* ── Simple items (objectives, contraindications) ── */
.prog-i-simple-item {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 7px 0; border-bottom: 1px solid #f1f5f9;
}
.prog-i-simple-item:last-child { border-bottom: none; }
.prog-i-simple-icon { flex-shrink: 0; margin-top: 1px; }
.prog-i-simple-text { flex: 1; font-size: 13px; color: #1e293b; line-height: 1.5; }

/* ── Lab items ── */
.prog-i-lab-item {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 7px 0; border-bottom: 1px solid #f1f5f9;
}
.prog-i-lab-item:last-child { border-bottom: none; }
.prog-i-lab-left { flex: 1; }
.prog-i-lab-name { font-size: 13px; font-weight: 600; color: #1e293b; display: block; }
.prog-i-lab-freq { font-size: 11.5px; color: #64748b; display: block; margin-top: 2px; }

/* ══════════════════════════════════════════════════════════
   PLANS TABLE REDESIGN — patient avatar, status badges, purchase badge
══════════════════════════════════════════════════════════ */

/* ── Plan state badges ──── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 11px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.badge-active   { background: rgba(15,124,74,0.11);  color: #0f7c4a; }
.badge-inactive { background: rgba(148,163,184,0.18); color: #64748b; }
.badge-draft    { background: rgba(245,158,11,0.13);  color: #b45309; }

/* ── Purchase status badge ── */
.purchase-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.purchase-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ps-comprado    { background: rgba(34,197,94,0.10);  color: #16a34a; }
.ps-no-comprado { background: rgba(239,68,68,0.10);  color: #dc2626; }
.ps-pagado      { background: rgba(99,102,241,0.10); color: #4f46e5; }
.ps-nunca       { background: rgba(148,163,184,0.14); color: #64748b; }

/* ── Patient cell (avatar + name + email) ── */
.plan-card-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.plan-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: box-shadow .15s, border-color .15s;
}
.plan-row:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    border-color: #d1d5db;
}
.plan-row-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    color: #fff;
    font-size: 11.5px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: .04em;
}
.plan-row-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.plan-row-name {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.plan-row-name em { font-style: italic; color: #9ca3af; font-weight: 500; }
.plan-row-meta {
    font-size: 11.5px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.plan-row-date {
    font-size: 11.5px;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
}
.plan-row-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.plan-row-btn {
    width: 30px; height: 30px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: border-color .15s, color .15s, background .15s;
}
.plan-row-btn--delete:hover { border-color: #ef4444; color: #ef4444; background: rgba(239,68,68,.06); }
.plan-row-btn--open:hover { border-color: var(--green); color: var(--green); background: rgba(15,124,74,.06); }

.plan-date-cell {
    font-size: 12.5px;
    color: #64748b;
    white-space: nowrap;
}

/* ── Edit button for plan rows ── */
.tbl-btn-edit {
    width: 32px; height: 32px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: #fff;
    color: var(--gray-700);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.tbl-btn-edit:hover { border-color: var(--green); color: var(--green); background: rgba(15,124,74,0.06); }

/* ── Smaller modal box (edit plan) ── */
.modal-box--sm { max-width: 440px; }

/* Split modal footer (left: danger action, right: cancel+save) */
.modal-footer--split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-100);
    margin-top: 4px;
}

/* Small danger button */
.btn-danger-sm {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    color: #ef4444;
    cursor: pointer;
    padding: 6px 4px;
    border-radius: 6px;
    transition: background 0.14s, color 0.14s;
}
.btn-danger-sm:hover { background: #fee2e2; color: #dc2626; }


/* 
   PLAN INTERIOR  New 2-column layout
    */

/* Layout grid */
.pi-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    align-items: start;
}

.pi-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}
/* All cards stack full-width in single column */

.pi-sidebar {
    position: sticky;
    top: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Title card */
.pi-title-section {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px 20px;
}

.pi-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pi-title-input {
    flex: 1;
    font-family: 'Manrope', sans-serif;
    font-size: 20px;
    font-weight: 800;
    color: #1e293b;
    border: none;
    outline: none;
    background: transparent;
    min-width: 0;
}

.pi-title-input::placeholder { color: #c4cdd6; }

.pi-save-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: 'Manrope', sans-serif;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.16s;
}
.pi-save-btn:hover { background: var(--green-dark); }

.pi-status-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.pi-status-select {
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border: 1.5px solid #e5e7eb;
    border-radius: 7px;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
}

.pi-date-label {
    font-size: 11.5px;
    color: #94a3b8;
}

/* Generic section card */
.pi-section {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    padding: 18px 20px;
}

.pi-section-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 10px;
}

.pi-section-title {
    font-size: 13.5px;
    font-weight: 800;
    color: #1e293b;
}

.pi-section-acts {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.pi-panel-count {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--green);
    border-radius: 10px;
    padding: 2px 7px;
    line-height: 1.4;
}

/* Notes / message area */
.pi-msg-clinic {
    font-size: 11.5px;
    color: #94a3b8;
    font-style: italic;
    margin-bottom: 10px;
}

.pi-notes-textarea {
    width: 100%;
    min-height: 90px;
    resize: vertical;
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    color: #334155;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.pi-notes-textarea:focus { border-color: var(--green); }

.pi-notes-expand-btn {
    background: none;
    border: none;
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--green);
    cursor: pointer;
    padding: 4px 0;
}
.pi-notes-expand-btn:hover { text-decoration: underline; }

/* Outline button variant */
.pi-btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: none;
    border: 1.5px solid var(--green);
    border-radius: 8px;
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--green);
    cursor: pointer;
    transition: background 0.15s;
}
.pi-btn-outline:hover { background: #f0fdf4; }

/* Med search inside section */
.pi-med-search-wrap { position: relative; margin-bottom: 14px; }

.pi-med-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    padding: 8px 12px;
    transition: border-color 0.15s;
}
.pi-med-search-row:focus-within { border-color: var(--green); background: #fff; }
.pi-med-search-row svg { flex-shrink: 0; color: #94a3b8; }

.pi-med-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    color: #1e293b;
    outline: none;
}
.pi-med-search-input::placeholder { color: #b0bec9; }

.pi-med-sugg-box {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    z-index: 90;
    max-height: 240px;
    overflow-y: auto;
}

/* Med suggestion item (from search) */
.pi-med-sugg-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.13s;
    border-radius: 8px;
}
.pi-med-sugg-item:hover { background: #f8fafc; }
.pi-med-sugg-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pi-med-sugg-info { flex: 1; min-width: 0; }
.pi-med-sugg-name { font-size: 13px; font-weight: 700; color: #1e293b; }
.pi-med-sugg-cat { font-size: 11px; color: #94a3b8; }
.pi-med-sugg-add { font-size: 12px; font-weight: 700; color: var(--green); flex-shrink: 0; }
.pi-med-sugg-empty { padding: 14px; font-size: 13px; color: #94a3b8; text-align: center; }

/* Med cards list */
.pi-meds-list { display: flex; flex-direction: column; gap: 10px; }

.pi-panel-empty {
    font-size: 13px;
    color: #94a3b8;
    padding: 20px 0;
    text-align: center;
}

/* Programs section inside plan */
.pi-progs-folder-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pi-prog-empty-chip {
    font-size: 12.5px;
    color: #94a3b8;
    padding: 8px 0;
}

/*  Med Card  */
.pi-med-card {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.15s;
}
.pi-med-card:hover { box-shadow: 0 3px 12px rgba(0,0,0,0.07); }

.pi-med-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px 12px;
    gap: 10px;
}

.pi-med-card-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.pi-med-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pi-med-name {
    font-size: 13.5px;
    font-weight: 800;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pi-med-meta {
    font-size: 11.5px;
    color: #64748b;
    margin-top: 2px;
}

.pi-med-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.14s, background 0.14s;
    flex-shrink: 0;
}
.pi-med-remove:hover { color: #ef4444; background: #fee2e2; }

.pi-med-card-fields {
    padding: 10px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid #f1f5f9;
}

.pi-med-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.pi-med-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pi-field-lbl {
    font-size: 10px;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.pi-field-select,
.pi-field-input {
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 7px;
    padding: 6px 8px;
    background: #f8fafc;
    color: #334155;
    width: 100%;
    outline: none;
    transition: border-color 0.14s;
    box-sizing: border-box;
}
.pi-field-select:focus,
.pi-field-input:focus { border-color: var(--green); background: #fff; }

.pi-med-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

.pi-med-footer-lbl {
    flex: 1;
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
}

.pi-med-item-total {
    font-size: 13px;
    font-weight: 800;
    color: #1e293b;
}

/* Qty stepper inside med card footer */
.pi-med-card-footer .pi-qty-stepper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pi-qty-stepper { display: flex; align-items: center; gap: 6px; }

.pi-qty-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1.5px solid #e5e7eb;
    background: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.14s, border-color 0.14s;
}
.pi-qty-btn:hover { background: var(--green); color: #fff; border-color: var(--green); }

.pi-qty-val {
    font-size: 13px;
    font-weight: 800;
    color: #1e293b;
    min-width: 18px;
    text-align: center;
}

/*  Summary Sidebar Card  */
.pi-summary-card {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pi-summary-title {
    font-size: 13.5px;
    font-weight: 800;
    color: #1e293b;
    margin: 0;
    padding-bottom: 12px;
    border-bottom: 1.5px solid #f1f5f9;
}

/* Patient selector */
.pi-pt-selector { position: relative; }

.pi-pt-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: #f8fafc;
}

.pi-pt-chip-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pi-pt-chip-name {
    flex: 1;
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pi-pt-chip-edit {
    width: 26px;
    height: 26px;
    border: none;
    background: none;
    cursor: pointer;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.13s, background 0.13s;
    flex-shrink: 0;
}
.pi-pt-chip-edit:hover { color: var(--green); background: #f0fdf4; }

.pi-pt-search-wrap { position: relative; }

.pi-autocomplete-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px 12px;
    transition: border-color 0.15s;
}
.pi-autocomplete-row:focus-within { border-color: var(--green); background: #fff; }
.pi-autocomplete-row svg { flex-shrink: 0; color: #94a3b8; }

.pi-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    color: #1e293b;
    outline: none;
}
.pi-search-input::placeholder { color: #b0bec9; }

.pi-suggestions-box {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    z-index: 90;
    max-height: 220px;
    overflow-y: auto;
}

.pi-sugg-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.12s;
}
.pi-sugg-item:hover { background: #f0fdf4; }

.pi-sugg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
    font-size: 10.5px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pi-sugg-info { flex: 1; min-width: 0; }
.pi-sugg-name { font-size: 12.5px; font-weight: 700; color: #1e293b; }
.pi-sugg-meta { font-size: 11px; color: #94a3b8; }
.pi-sugg-add { font-size: 11.5px; font-weight: 700; color: var(--green); flex-shrink: 0; }
.pi-sugg-empty { padding: 12px; font-size: 12.5px; color: #94a3b8; text-align: center; }

/* Price section */
.pi-price-section {
    display: flex;
    flex-direction: column;
}

.pi-price-title {
    font-size: 10.5px;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin: 0 0 10px;
}

.pi-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
    color: #475569;
    border-bottom: 1px solid #f1f5f9;
}

.pi-price-row--sub { font-weight: 700; color: #1e293b; }

.pi-shipping-input-wrap {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 13px;
    color: #475569;
}

.pi-shipping-input {
    width: 70px;
    border: 1.5px solid #e5e7eb;
    border-radius: 6px;
    padding: 3px 6px;
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    text-align: right;
    background: #f8fafc;
    outline: none;
    transition: border-color 0.14s;
}
.pi-shipping-input:focus { border-color: var(--green); }

.pi-shipping-toggle {
    background: none;
    border: none;
    font-family: 'Manrope', sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--green);
    cursor: pointer;
    padding: 6px 0 0;
    text-align: left;
    transition: opacity 0.14s;
}
.pi-shipping-toggle:hover { opacity: 0.75; }

/* Total row */
.pi-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0 0;
    border-top: 2px solid #e5e7eb;
}

.pi-total-lbl {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
}

.pi-total-row strong {
    font-size: 20px;
    font-weight: 800;
    color: #1e293b;
}

/* Checkout button */
.pi-checkout-btn {
    width: 100%;
    padding: 14px;
    background: #1e293b;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: 'Manrope', sans-serif;
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.16s, transform 0.1s;
}
.pi-checkout-btn:hover { background: #0f172a; transform: translateY(-1px); }
.pi-checkout-btn:active { transform: none; }

/* Download PDF button */
.pi-download-pdf-btn {
    width: 100%;
    padding: 12px;
    background: #fff;
    color: #1e293b;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-family: 'Manrope', sans-serif;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.16s, border-color 0.16s, transform 0.1s;
}
.pi-download-pdf-btn:hover { background: #f8fafc; border-color: #cbd5e1; transform: translateY(-1px); }
.pi-download-pdf-btn:active { transform: none; }

/* Notify note */
.pi-notify-note {
    font-size: 11px;
    color: #94a3b8;
    text-align: center;
    line-height: 1.5;
}

/*  Orders Section Empty State  */
.orders-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 80px 24px;
    text-align: center;
    color: #94a3b8;
}

.orders-empty h3 {
    font-size: 18px;
    font-weight: 800;
    color: #475569;
    margin: 0;
}

.orders-empty p {
    font-size: 14px;
    color: #94a3b8;
    margin: 0;
    line-height: 1.6;
}

/*  Responsive: collapse sidebar on narrow screens  */
@media (max-width: 960px) {
    .pi-layout {
        grid-template-columns: 1fr;
    }
    .pi-sidebar {
        position: static;
    }
}
@media (max-width: 660px) {
    .pi-plan-header-top { flex-direction: column; align-items: stretch; }
    .pi-plan-header-controls { justify-content: flex-end; }
}

/* ══════════════════════════════════════════════════════
   PLAN INTERIOR — MEDICATION COMPACT LIST
══════════════════════════════════════════════════════ */
.pi-med-item {
    border: 1.5px solid #e5e7eb;
    border-radius: 11px;
    overflow: hidden;
    background: #fff;
}
.pi-med-item-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
}
.pi-med-color-dot--sm {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}
.pi-med-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.pi-med-item-btns {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.pi-med-bottles-lbl {
    font-size: 11.5px;
    font-weight: 700;
    color: #64748b;
    background: #f1f5f9;
    padding: 3px 8px;
    border-radius: 6px;
}
.pi-med-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: 7px;
    background: #fff;
    font-family: 'Manrope', sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.pi-med-edit-btn:hover {
    border-color: var(--green);
    color: var(--green);
}
.pi-med-info-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: 7px;
    background: #fff;
    font-family: 'Manrope', sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.pi-med-info-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

/* Med Info Modal */
.med-info-modal {
    background: #fff;
    border-radius: 16px;
    width: 480px;
    max-width: 92vw;
    max-height: 85vh;
    box-shadow: 0 24px 48px rgba(0,0,0,.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.med-info-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid #f1f5f9;
}
.med-info-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.med-info-header h3 {
    flex: 1;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}
.med-info-close {
    background: none; border: none;
    font-size: 22px; color: #94a3b8;
    cursor: pointer; line-height: 1;
}
.med-info-close:hover { color: #ef4444; }
.med-info-body {
    padding: 16px 20px 20px;
    overflow-y: auto;
    flex: 1;
}
/* 2-col grid for short fields */
.med-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 16px;
}
.med-info-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}
.med-info-label {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.med-info-value {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}
/* Full-width long text fields */
.med-info-long-section {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.med-info-long-block {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    padding: 10px 12px;
}
.med-info-long-label {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .04em;
    display: block;
    margin-bottom: 4px;
}
.med-info-long-text {
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    line-height: 1.55;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}
@media (max-width: 500px) {
    .med-info-grid { grid-template-columns: 1fr; }
    .med-info-modal { width: 100%; }
}
.pi-med-edit-btn--active {
    background: var(--green);
    color: #fff !important;
    border-color: var(--green) !important;
}

/* Config panel (shown when editing) */
.pi-med-config {
    border-top: 1.5px solid #f1f5f9;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fafbfc;
}
.pi-med-cfg-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pi-med-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.pi-med-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.pi-med-cfg-footer {
    border-top: 1px solid #e5e7eb;
    padding-top: 10px;
}
.pi-cfg-stepper-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.pi-cfg-qty-lbl {
    font-size: 10.5px;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .06em;
    flex-shrink: 0;
}
.pi-qty-unit {
    font-size: 11.5px;
    color: #64748b;
    font-weight: 600;
}
.pi-cfg-subtotal {
    margin-left: auto;
    font-size: 13px;
    font-weight: 800;
    color: #1e293b;
}

/* Med notes within config panel */
.pi-med-notes-wrap {
    border-top: 1px solid #e5e7eb;
    padding-top: 10px;
}
.pi-med-notes-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.pi-med-notes-ta {
    width: 100%;
    box-sizing: border-box;
    font-family: 'Manrope', sans-serif;
    font-size: 12.5px;
    color: #334155;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 10px;
    resize: vertical;
    outline: none;
    transition: border-color .15s;
}
.pi-med-notes-ta:focus {
    border-color: var(--green);
}

/* ══════════════════════════════════════════════════════
   PLAN INTERIOR — PROGRAM SIMPLE LIST
══════════════════════════════════════════════════════ */
.pi-prog-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pi-prog-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
}
.pi-prog-list-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.pi-prog-list-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.pi-prog-list-name {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pi-prog-list-meta {
    font-size: 11.5px;
    color: #64748b;
}
.pi-prog-list-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 6px;
    flex-shrink: 0;
    transition: color .15s, background .15s;
}
.pi-prog-list-remove:hover {
    color: #ef4444;
    background: #fee2e2;
}
.pi-prog-list-manage-meds {
    background: none;
    border: 1.5px solid #d1d5db;
    cursor: pointer;
    color: #059669;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 8px;
    flex-shrink: 0;
    transition: all .15s;
}
.pi-prog-list-manage-meds:hover {
    color: #047857;
    border-color: #059669;
    background: #ecfdf5;
}

/* ── Program Accordion (inside plan interior) ── */
.pi-prog-accordion {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pi-prog-acc-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.pi-prog-acc-header:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}
.pi-prog-acc-name {
    flex: 1;
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pi-prog-acc-count {
    font-size: 11px;
    color: #64748b;
    flex-shrink: 0;
}
.pi-prog-acc-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    color: #64748b;
    display: flex;
    align-items: center;
    transition: transform .2s, color .15s;
}
.pi-prog-acc-toggle--open {
    transform: rotate(180deg);
    color: #059669;
}
.pi-prog-acc-body {
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 8px 0 10px 22px;
}
.pi-prog-acc-body--open {
    display: flex;
}
.pi-prog-acc-med {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    transition: border-color .15s;
}
.pi-prog-acc-med:hover {
    border-color: #cbd5e1;
}
.pi-prog-acc-med-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.pi-prog-acc-med-name {
    font-size: 12.5px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pi-prog-acc-med-meta {
    font-size: 11px;
    color: #64748b;
}
.pi-prog-acc-med-edit,
.pi-prog-acc-med-del {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    transition: all .15s;
    flex-shrink: 0;
}
.pi-prog-acc-med-edit { color: #3b82f6; }
.pi-prog-acc-med-edit:hover { background: #eff6ff; color: #2563eb; }
.pi-prog-acc-med-del { color: #94a3b8; }
.pi-prog-acc-med-del:hover { background: #fee2e2; color: #ef4444; }
.pi-prog-acc-add-med {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: 1.5px dashed #d1d5db;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11.5px;
    font-weight: 600;
    color: #059669;
    transition: all .15s;
    margin-top: 4px;
}
.pi-prog-acc-add-med:hover {
    border-color: #059669;
    background: #ecfdf5;
}
.pi-prog-acc-empty {
    font-size: 12px;
    color: #94a3b8;
    padding: 4px 0;
    font-style: italic;
}

/* ── Add Medication Picker Modal ── */
.pp-add-med-modal {
    width: 440px;
}
.pp-add-med-body {
    padding: 16px 20px;
    flex: 1;
    overflow-y: auto;
}
.pp-add-med-search {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
    outline: none;
    transition: border-color .15s;
}
.pp-add-med-search:focus {
    border-color: #059669;
}
.pp-add-med-results {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 360px;
    overflow-y: auto;
}
.pp-add-med-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all .15s;
}
.pp-add-med-item:hover {
    border-color: #059669;
    background: #ecfdf5;
}
.pp-add-med-item-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}
.pp-add-med-item-cat {
    font-size: 11px;
    color: #64748b;
}
.pp-add-med-item-price {
    font-size: 12px;
    font-weight: 600;
    color: #059669;
}
.pp-add-med-empty {
    font-size: 12.5px;
    color: #94a3b8;
    padding: 16px 0;
    text-align: center;
}
.pi-prog-empty-chip {
    font-size: 12.5px;
    color: #94a3b8;
    padding: 6px 0;
}

/* ============================================================
   PLAN INTERIOR — REDESIGNED LEFT SIDE
============================================================ */

/* ── Plan Header (patient + controls bar) ── */
.pi-plan-header {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
}
.pi-plan-header-top {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    flex-wrap: wrap;
}
.pi-plan-header-patient {
    flex: 1;
    min-width: 200px;
    position: relative;
}
.pi-plan-header-patient .pi-pt-chip {
    border: none;
    padding: 0;
    background: none;
}
.pi-plan-header-patient .pi-pt-search-wrap { margin: 0; }
.pi-plan-header-patient .pi-pt-hint {
    font-size: 11px;
    color: #94a3b8;
    margin: 6px 0 0;
}
.pi-plan-header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Generic section card */
.pi-card {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
}
.pi-card-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 18px;
    border-bottom: 1.5px solid #f1f5f9;
    background: #fafbfc;
}
.pi-card-hdr-left {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}
.pi-card-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}
.pi-card-icon--amber  { background: linear-gradient(135deg, #f59e0b, #d97706); }
.pi-card-icon--blue   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.pi-card-icon--green  { background: linear-gradient(135deg, var(--green), #0a5e3b); }
.pi-card-icon--indigo { background: linear-gradient(135deg, #6366f1, #4338ca); }

/* ── Plan interior: Patient section ── */
.pi-pt-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 14px;
}
.pi-pt-chip-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #6366f1;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}
.pi-pt-chip-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pi-pt-chip-name {
    font-size: 13.5px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pi-pt-chip-email {
    font-size: 11.5px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pi-pt-change-btn {
    flex-shrink: 0;
    background: none;
    border: 1.5px solid #6366f1;
    color: #6366f1;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 12px;
    cursor: pointer;
    transition: background .15s, color .15s;
    font-family: inherit;
}
.pi-pt-change-btn:hover { background: #6366f1; color: #fff; }
.pi-pt-search-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pi-pt-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 0 12px;
    transition: border-color .15s, background .15s;
}
.pi-pt-search-row:focus-within {
    border-color: #6366f1;
    background: #fff;
}
.pi-pt-search-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 13px;
    color: #1e293b;
    padding: 10px 0;
    font-family: inherit;
}
.pi-pt-search-input::placeholder { color: #94a3b8; }
.pi-pt-sugg-box {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    max-height: 220px;
    overflow-y: auto;
}
.pi-pt-hint {
    font-size: 11.5px;
    color: #94a3b8;
    margin: 0;
    text-align: center;
}

.pi-card-title {
    font-size: 13px;
    font-weight: 800;
    color: #1e293b;
}
.pi-card-body {
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.pi-card-body .pi-notes-textarea { margin: 0; }
.pi-card-body .pi-prog-list      { padding: 0; gap: 8px; }
.pi-card-body .pi-meds-list      { padding: 0; }
.pi-card-body .pi-med-search-wrap { margin-bottom: 0; }

/* ============================================================
   MED EDIT MODAL
============================================================ */
.med-edit-modal {
    max-width: 480px;
    width: 100%;
}
.med-edit-ttl-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}
.med-edit-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #94a3b8;
}
.med-edit-body {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.med-edit-type-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
}
.med-edit-days-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f0fdf4;
    border-radius: 8px;
    border: 1px solid #bbf7d0;
    font-size: 13px;
    font-weight: 600;
    color: #065f46;
}
.med-edit-days-row svg { color: #16a34a; flex-shrink: 0; }
.med-edit-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 0;
}
.med-edit-divider {
    border: none;
    border-top: 1.5px solid #f1f5f9;
    margin: 0;
}
.med-edit-qty-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
}
.med-edit-qty-lbl {
    font-size: 11px;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .06em;
    flex: 1;
}
.med-edit-subtotal {
    font-size: 16px;
    font-weight: 800;
    color: #1e293b;
    margin-left: auto;
}
.med-edit-notes-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.med-edit-notes-ta {
    min-height: 72px;
    resize: vertical;
}
.med-edit-body > .form-group {
    padding: 16px 0;
}
.med-edit-body > .form-group .form-label { font-size: 11px; }

/* Footer sits outside the scrollable body — give it its own padding */
.med-edit-modal .modal-footer {
    padding: 12px 24px 20px;
    margin-top: 0;
    flex-shrink: 0;
}

/* Make the qty stepper nicer inside the modal */
.med-edit-qty-row .pi-qty-stepper {
    display: flex;
    align-items: center;
    gap: 0;
    background: #f8fafc;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}
.med-edit-qty-row .pi-qty-btn {
    width: 34px;
    height: 34px;
    font-size: 18px;
    line-height: 1;
    background: none;
    border: none;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s;
}
.med-edit-qty-row .pi-qty-btn:hover { background: #e2e8f0; }
.med-edit-qty-row .pi-qty-val {
    min-width: 36px;
    text-align: center;
    font-size: 15px;
    font-weight: 800;
    color: #1e293b;
    border-left: 1.5px solid #e5e7eb;
    border-right: 1.5px solid #e5e7eb;
    padding: 4px 0;
}

/* ════════════════════════════════════════════════════════
   FREQUENCY NUMERIC INPUTS
════════════════════════════════════════════════════════ */
.freq-inputs-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.freq-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.freq-sub-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.freq-number-input {
    width: 80px !important;
    text-align: center;
}
.freq-input-sep {
    padding-bottom: 10px;
    font-size: 13px;
    color: #64748b;
    font-weight: 600;
}

/* ════════════════════════════════════════════════════════
   ORDERS SECTION
════════════════════════════════════════════════════════ */
.orders-subsection {
    margin-bottom: 32px;
}
.orders-subsec-hdr {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.orders-subsec-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.orders-subsec-icon--drop   { background: #e0f2fe; color: #0369a1; }
.orders-subsec-icon--refill { background: #d1fae5; color: #065f46; }
.orders-subsec-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    flex: 1;
}
.orders-subsec-count {
    background: #f1f5f9;
    color: #475569;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 10px;
}
/* Order shipping toggle badges */
.order-ship-badge,
.order-pay-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: filter .15s, transform .1s;
    white-space: nowrap;
    font-family: inherit;
    flex-shrink: 0;
}
.order-ship-badge:hover,
.order-pay-badge:hover { filter: brightness(.92); transform: scale(.97); }
/* Shipping states */
.order-ship-badge--enviado     { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.order-ship-badge--no_enviado  { background: #fef3c7; color: #92400e; border-color: #fde68a; }
/* Payment states */
.order-pay-badge--pagado       { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.order-pay-badge--no_pagado    { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

/* ── Orders Tab Bar (horizontal top) ── */
.orders-tabbar {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.orders-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 40px;
    cursor: pointer;
    transition: background .15s, border-color .15s, box-shadow .15s;
}
.orders-tab:hover { background: #f8fafc; border-color: #cbd5e1; }
.orders-tab--active {
    background: #f0f9ff;
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56,189,248,.12);
}
.orders-tab-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.orders-tab-icon--drop { background: #e0f2fe; color: #0369a1; }
.orders-tab-icon--cal  { background: #fef3c7; color: #b45309; }
.orders-tab-label {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}
.orders-tab--active .orders-tab-label { color: #0369a1; }
.orders-tab-count {
    background: #f1f5f9;
    color: #64748b;
    border-radius: 20px;
    padding: 2px 9px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid #e2e8f0;
}
.orders-tab--active .orders-tab-count {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #bae6fd;
}
.orders-pane { animation: pane-in .18s ease; }
@keyframes pane-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Dropshipping list ── */
.drop-searchbar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 16px;
    color: #94a3b8;
    max-width: 320px;
}
.drop-searchbar {
    flex: 1;
    border: none;
    outline: none;
    font-size: 13px;
    font-family: inherit;
    background: transparent;
    color: #0f172a;
}
.drop-list { display: flex; flex-direction: column; gap: 6px; }
.drop-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 16px;
    transition: box-shadow .15s, border-color .15s;
}
.drop-row:hover { box-shadow: 0 2px 12px rgba(0,0,0,.06); border-color: #d1d5db; }

/* Left group: ID badge + patient info stacked */
.drop-row-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
    flex: 1;
}
.drop-row-id {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #64748b;
    font-weight: 700;
    letter-spacing: .5px;
    flex-shrink: 0;
    background: #f1f5f9;
    border-radius: 6px;
    padding: 3px 7px;
    text-align: center;
}
.drop-row-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.drop-row-name { font-size: 13px; font-weight: 700; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drop-row-date { font-size: 11px; color: #94a3b8; }

/* Center group: status + tracking — pushed right next to total */
.drop-row-center {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}
.drop-row-plan { display: none; }

/* Right group: total + delete */
.drop-row-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.drop-row-total {
    font-size: 15px;
    font-weight: 900;
    color: #0f172a;
    letter-spacing: -.3px;
    min-width: 70px;
    text-align: right;
}

/* Tracking ID column inside drop-row — slightly compact */
.drop-row-tracking {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 130px;
    flex: 0 1 190px;
}
.drop-tracking-input {
    flex: 1;
    min-width: 0;
    border: 1.5px solid #e5e7eb;
    border-radius: 7px;
    padding: 6px 9px;
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    color: #1e293b;
    background: #f8fafc;
    outline: none;
    transition: border-color 0.15s;
}
.drop-tracking-input:focus  { border-color: #6366f1; background: #fff; }
.drop-tracking-input::placeholder { color: #c0cada; }
.drop-tracking-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 7px;
    background: #6366f1;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.drop-tracking-btn:hover { background: #4f46e5; }

.drop-no-results {
    text-align: center;
    padding: 32px;
    color: #94a3b8;
    font-size: 13px;
}

/* ── Calendar cell chips (text instead of dots) ── */
.cal-chip {
    border-radius: 5px;
    padding: 3px 5px;
    font-size: 10px;
    line-height: 1.35;
    display: flex;
    align-items: flex-start;
    gap: 4px;
    margin-top: 3px;
    overflow: hidden;
}
.cal-chip--expiry { background: #fffbeb; border: 1px solid #fde68a; }
.cal-chip--refill { background: #f0fdf4; border: 1px solid #bbf7d0; }
.cal-chip--multi  { background: #f1f5f9; border: 1px solid #e2e8f0; cursor: pointer; }
.cal-chip--multi:hover { background: #e2e8f0; }
.cal-chip-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
}
.cal-chip-dot--exp { background: #f59e0b; }
.cal-chip-dot--ref { background: #10b981; }
.cal-chip-lines { display: flex; flex-direction: column; min-width: 0; }
.cal-chip-plan { font-weight: 700; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip-pt   { color: #475569; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip-med  { color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip-more { color: #94a3b8; font-weight: 600; font-size: 9.5px; margin-top: 1px; }

/* ── Calendar Event Modal ── */
.cal-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.45);
    z-index: 9000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity .25s;
}
.cal-modal-overlay.cal-modal-visible { opacity: 1; }
.cal-modal {
    background: #fff;
    border-radius: 16px;
    width: min(480px, 94vw);
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0,0,0,.2);
    transform: scale(.85) translateY(20px);
    opacity: 0;
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .22s;
}
.cal-modal.cal-modal-card-in { transform: scale(1) translateY(0); opacity: 1; }
.cal-modal-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1.5px solid #f1f5f9;
    gap: 12px;
}
.cal-modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #0f172a;
    flex: 1;
    min-width: 0;
}
.cal-modal-title-wrap strong { text-transform: capitalize; }
.cal-modal-count {
    background: #f1f5f9;
    border-radius: 20px;
    padding: 2px 9px;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    white-space: nowrap;
}
.cal-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1.5px solid #e5e7eb;
    background: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    color: #475569;
    flex-shrink: 0;
    transition: background .12s;
}
.cal-modal-close:hover { background: #fee2e2; color: #ef4444; border-color: #fecaca; }
.cal-modal-body {
    overflow-y: auto;
    padding: 8px 0;
}
.cal-modal-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid #f8fafc;
}
.cal-modal-row:last-child { border-bottom: none; }
.cal-modal-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.cal-modal-patient { font-size: 13px; font-weight: 700; color: #0f172a; }
.cal-modal-plan   { font-size: 12px; color: #475569; font-weight: 600; }
.cal-modal-med    { font-size: 11px; color: #94a3b8; }
.cal-modal-type-badge {
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}
.cal-modal-type-badge--expiry { background: #fffbeb; color: #b45309; }
.cal-modal-type-badge--refill { background: #ecfdf5; color: #065f46; }

/* ── Pagination bar ── */
.pag-bar { margin-top: 12px; }
.pag-bar-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 0;
}
.pag-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1.5px solid #e5e7eb;
    background: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    color: #475569;
    transition: background .12s, border-color .12s;
    flex-shrink: 0;
}
.pag-btn:hover:not(:disabled) { background: #f1f5f9; border-color: #cbd5e1; }
.pag-btn:disabled { opacity: .35; cursor: default; }
.pag-info {
    font-size: 13px;
    color: #64748b;
    font-weight: 600;
    flex: 1;
    text-align: center;
}
.pag-show-all {
    padding: 6px 14px;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .12s, border-color .12s;
    white-space: nowrap;
}
.pag-show-all:hover { background: #f1f5f9; border-color: #cbd5e1; }
.pag-show-all.pag-active { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }

/* ── Calendar ── */
.cal-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.cal-nav-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1.5px solid #e5e7eb;
    background: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    color: #475569;
    transition: background .15s;
}
.cal-nav-btn:hover { background: #f1f5f9; }
.cal-nav-btn:disabled { opacity: .35; cursor: default; }
.cal-month-label {
    flex: 1;
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    text-align: center;
    text-transform: capitalize;
}
.cal-today-btn {
    padding: 6px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    font-family: inherit;
    transition: background .15s;
}
.cal-today-btn:hover { background: #f1f5f9; }
.cal-legend { display: flex; gap: 14px; margin-left: 8px; }
.cal-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: #64748b;
    font-weight: 500;
}
.cal-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.cal-grid--detail {
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
/* ── 12-month card overview ── */
.cal12-card {
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s, border-color .15s;
    aspect-ratio: 1;
    justify-content: center;
}
.cal12-card:hover { transform: scale(1.04); box-shadow: 0 6px 24px rgba(0,0,0,.08); border-color: #c7d2fe; }
.cal12-card--current { border-color: #3b82f6; background: #f0f7ff; }
.cal12-card-num { font-size: 28px; font-weight: 900; color: #1e293b; line-height: 1; }
.cal12-card-name { font-size: 13px; font-weight: 700; color: #475569; text-transform: capitalize; }
.cal12-card-plans { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; width: 100%; }
.cal12-plan-name {
    font-size: 11px; font-weight: 600; color: #0f7c4a; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; text-align: center;
    background: #ecfdf5; border-radius: 4px; padding: 2px 6px;
}
.cal12-plan-more { font-size: 10px; color: #94a3b8; text-align: center; }
.cal12-no-refills { font-size: 10px; color: #cbd5e1; text-align: center; font-weight: 500; }
.cal-day-hdr {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    padding: 6px 0;
}
.cal-cell {
    min-height: 72px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    padding: 6px;
    background: #fff;
    transition: border-color .12s, box-shadow .12s;
}
.cal-cell--has-events { cursor: pointer; }
.cal-cell--has-events:hover { border-color: #c7d2fe; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.cal-cell--today { border-color: #38bdf8; background: #f0f9ff; }
.cal-cell--past { background: #fafafa; }
.cal-cell--past .cal-day-num { color: #cbd5e1; }
.cal-cell--selected { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
.cal-cell--empty { border-color: transparent; background: transparent; }
.cal-cell--out-of-month { background: #f8fafc; border-color: #f1f5f9; }
.cal-cell--out-of-month .cal-day-num { color: #cbd5e1; font-weight: 500; }
.cal-day-num { font-size: 13px; font-weight: 700; color: #1e293b; }
.cal-dots { display: flex; gap: 3px; margin-top: 4px; flex-wrap: wrap; }
.cal-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cal-dot--expiry { background: #f59e0b; }
.cal-dot--refill { background: #10b981; }
.cal-ev-info { display: flex; align-items: center; gap: 4px; margin-top: 3px; overflow: hidden; }
.cal-ev-info .cal-chip-dot { flex-shrink: 0; }
.cal-ev-plan { font-size: 9px; font-weight: 700; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 70px; }
.cal-ev-med { font-size: 8px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60px; }
.cal-ev-more { font-size: 8px; color: #6366f1; font-weight: 600; margin-top: 1px; }
.cal-more { font-size: 9px; color: #94a3b8; font-weight: 700; margin-top: 2px; }
.cal-detail {
    display: none;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px 20px;
    margin-top: 16px;
}
.cal-detail-hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: #0f172a;
    font-size: 13px;
}
.cal-detail-count {
    margin-left: auto;
    background: #f1f5f9;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
}
.cal-detail-list { display: flex; flex-direction: column; }
.cal-detail-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}
.cal-detail-row:last-child { border-bottom: none; }
.cal-detail-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cal-det-patient { font-size: 13px; font-weight: 700; color: #0f172a; }
.cal-det-med { font-size: 11px; color: #64748b; }
.cal-det-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.cal-det-type { font-size: 10.5px; color: #94a3b8; font-weight: 600; }
.cal-det-days { font-size: 12px; font-weight: 700; color: #0f172a; }
.cal-det-urg--critical { color: #ef4444; }
.cal-det-urg--urgent   { color: #f59e0b; }
.cal-det-urg--soon     { color: #3b82f6; }

@media (max-width: 640px) {
    .orders-tabbar { gap: 6px; }
    .orders-tab { padding: 8px 14px; }
    .drop-row { gap: 8px; }
    .cal-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .cal-grid--detail { grid-template-columns: repeat(7, 1fr); gap: 4px; }
    .cal-cell { min-height: 52px; padding: 4px; }
}
/* Refill badges */
.refill-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}
.refill-badge--pending   { background: #fef3c7; color: #92400e; }
.refill-badge--contacted { background: #dbeafe; color: #1e40af; }
.refill-badge--done      { background: #d1fae5; color: #065f46; }
/* Refill days remaining */
.refill-days { font-weight: 700; color: #1e293b; }
.refill-days--warn   { color: #d97706; }
.refill-days--urgent { color: #dc2626; }

/* ── Med Duration Timeline Panel ── */
.orders-subsec-icon--tl { background: #ede9fe; color: #5b21b6; }
.refill-tl-hdr {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
}
.refill-tl-body {
    display: none;
    margin-top: 12px;
}
.refill-tl-body.open { display: block; }
.refill-tl-toggle-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #475569;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s, border-color .15s;
}
.refill-tl-toggle-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }
.refill-tl-toggle-btn.open #refillTlChevron { transform: rotate(180deg); }
/* Formula cell */
.tl-formula {
    font-size: 12px;
    color: #64748b;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
}
.tl-formula b { color: #1e293b; font-weight: 700; }
.tl-formula--na { font-family: inherit; font-style: italic; color: #94a3b8; }
/* Urgency badges */
.tl-urg {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}
.tl-urg--critical { background: #fee2e2; color: #991b1b; }
.tl-urg--urgent   { background: #ffedd5; color: #9a3412; }
.tl-urg--soon     { background: #fef3c7; color: #92400e; }
.tl-urg--near     { background: #dbeafe; color: #1e40af; }
.tl-urg--ok       { background: #d1fae5; color: #065f46; }
.tl-urg--na       { background: #f1f5f9; color: #64748b; }
/* Med summary cell */
.cell-meds-summary {
    font-size: 12.5px;
    color: #64748b;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cell-sub {
    font-size: 11.5px;
    color: #94a3b8;
}

/* ════════════════════════════════════════════════════════
   PATIENT PROFILE — HISTORY TABS
════════════════════════════════════════════════════════ */
/* Profile history rows are now rendered without tabs */
.profile-hist-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.profile-hist-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px 16px;
    color: #94a3b8;
    font-size: 13.5px;
    text-align: center;
}
/* History plan rows */
.hist-plan-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
    margin-bottom: 6px;
    background: #fafafa;
    gap: 8px;
}
.hist-plan-row:hover { background: #f1f5f9; }
.hist-plan-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}
.hist-plan-name {
    font-size: 13.5px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hist-plan-badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.hist-plan-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}
.hist-plan-badge--active    { background: #d1fae5; color: #065f46; }
.hist-plan-badge--inactive  { background: #f1f5f9; color: #64748b; }
.hist-plan-badge--draft     { background: #fef9c3; color: #854d0e; }
.hist-plan-badge--confirmed  { background: #bfdbfe; color: #1e40af; }
.hist-plan-badge--confirmado { background: #bfdbfe; color: #1e40af; }
.hist-plan-badge--pagado     { background: #ede9fe; color: #5b21b6; }
.hist-plan-badge--unpaid     { background: #fce7f3; color: #9d174d; }
.hist-plan-meta {
    font-size: 11px;
    color: #94a3b8;
}
.hist-plan-partial {
    margin-top: 6px;
}
.hist-plan-partial-bar {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 3px;
}
.hist-plan-partial-fill {
    height: 100%;
    background: linear-gradient(90deg, #0f7c4a, #22c55e);
    border-radius: 3px;
    transition: width .3s ease;
}
.hist-plan-partial-text {
    font-size: 10px;
    color: #64748b;
    font-weight: 600;
}
.hist-plan-total {
    font-size: 14px;
    font-weight: 800;
    color: #1e293b;
    white-space: nowrap;
    align-self: center;
}
.hist-grand-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-top: 2px solid #e5e7eb;
    margin-top: 8px;
    font-size: 14px;
    color: #475569;
    font-weight: 700;
}
.hist-grand-total strong {
    font-size: 16px;
    color: #1e293b;
}

/* ── Profile balance footer ── */
.profile-balance-footer {
    flex-shrink: 0;
    border-top: 2px solid #e5e7eb;
    margin-top: 16px;
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.profile-balance-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.profile-balance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}
.profile-balance-row span:last-child {
    font-weight: 700;
    color: #1e293b;
}
.profile-balance-total {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-top: 12px;
    border-top: 1.5px solid #f1f5f9;
}
.profile-balance-total-label {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    align-self: center;
}
.profile-balance-total-amount {
    font-size: 28px;
    font-weight: 900;
    color: #1e293b;
    letter-spacing: -0.5px;
    line-height: 1;
}

/* Balance paid/unpaid breakdown */
.profile-balance-separator {
    height: 1px;
    background: #e5e7eb;
    margin: 6px 0;
}
.profile-balance-row--paid span:last-child {
    color: #22c55e !important;
}
.profile-balance-row--unpaid span:last-child {
    color: #ef4444 !important;
}

/* Refill detail modal rows */
.refill-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
}
.refill-detail-row:hover { background: #f1f5f9; }
.refill-detail-med {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.refill-detail-name {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.refill-detail-plan {
    font-size: 11px;
    color: #94a3b8;
}
.refill-detail-days {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    margin-left: 12px;
}
.refill-detail-days-num {
    font-size: 18px;
    font-weight: 900;
    color: #f59e0b;
    line-height: 1;
}
.refill-detail-days-lbl {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 600;
}
}

/* ════════════════════════════════════════════════════════
   PATIENT AVATAR — DRAG & DROP UPLOAD
════════════════════════════════════════════════════════ */
#profileAvatarWrap {
    position: relative;
    cursor: pointer;
}
.profile-avatar-drop-hint {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(13,110,240,.82);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px;
    opacity: 0;
    transition: opacity .18s;
    pointer-events: none;
    border-radius: 50%;
}
.profile-avatar-drop-hint.visible { opacity: 1; }
#profileAvatarWrap.avatar-drag-over .profile-avatar-circle {
    outline: 3px dashed #0d6ef0;
    outline-offset: 3px;
}
/* ══════════════════════════════════════════════════════════
   TOPBAR LOGO
══════════════════════════════════════════════════════════ */
.topbar-logo {
    width: 38px;
    height: 38px;
    background: var(--green, #0f7c4a);
    border-radius: 10px;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
    border: none;
    transition: box-shadow 0.15s, transform 0.15s;
}
.topbar-logo:hover { box-shadow: 0 4px 14px rgba(15,124,74,.30); transform: scale(1.04); }
.topbar-logo svg { width: 22px; height: 22px; }

/* ══════════════════════════════════════════════════════════
   DASHBOARD KPI CARDS
══════════════════════════════════════════════════════════ */
.dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.dash-kpi-card {
    background: #fff;
    border-radius: 16px;
    border: 1.5px solid #e5e7eb;
    padding: 22px 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: box-shadow 0.2s, transform 0.15s;
}
.dash-kpi-card:hover { box-shadow: 0 6px 22px rgba(0,0,0,.08); transform: translateY(-2px); }
.dash-kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.dash-kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.dash-kpi-icon svg { width: 20px; height: 20px; }
.dash-kpi-num {
    font-size: 42px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -1px;
}
.dash-kpi-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500, #6b7280);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.dash-kpi-btns {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.dash-kpi-btn {
    flex: 1;
    min-width: 70px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1.5px solid #e5e7eb;
    background: transparent;
    font-size: 11.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    color: var(--gray-700, #374151);
    transition: background 0.13s, border-color 0.13s;
    white-space: nowrap;
}
.dash-kpi-btn:hover { background: #f3f4f6; border-color: #d1d5db; }
.dash-kpi-btn--add { background: var(--green, #0f7c4a); color: #fff; border-color: var(--green, #0f7c4a); }
.dash-kpi-btn--add:hover { background: #0a6139; border-color: #0a6139; }

/* colour themes */
.dash-kpi-card--blue .dash-kpi-icon  { background: #eff6ff; color: #2563eb; }
.dash-kpi-card--blue .dash-kpi-num   { color: #1d4ed8; }
.dash-kpi-card--purple .dash-kpi-icon { background: #f5f3ff; color: #7c3aed; }
.dash-kpi-card--purple .dash-kpi-num  { color: #6d28d9; }
.dash-kpi-card--orange .dash-kpi-icon { background: #fff7ed; color: #d97706; }
.dash-kpi-card--orange .dash-kpi-num  { color: #b45309; }
.dash-kpi-card--green .dash-kpi-icon  { background: #f0fdf4; color: #15803d; }
.dash-kpi-card--green .dash-kpi-num   { color: #166534; }
.dash-kpi-card--teal .dash-kpi-icon   { background: #f0fdfa; color: #0d9488; }
.dash-kpi-card--teal .dash-kpi-num    { color: #0f766e; }

/* responsive */
@media (max-width: 1200px) { .dash-kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px)  { .dash-kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px)  { .dash-kpi-grid { grid-template-columns: 1fr; } }

/* SVG bar chart in catalog panel */
.dash-bar-chart { width: 100%; overflow: visible; display: block; margin-top: 8px; }
.dash-bar-label { font-size: 11px; fill: var(--gray-500, #6b7280); font-family: inherit; }
.dash-bar-count { font-size: 11px; font-weight: 800; fill: var(--gray-800, #1f2937); font-family: inherit; }

.dash-panel--charts { padding: 0; overflow: hidden; }
.dash-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    height: 100%;
    min-height: 260px;
}
.dash-chart-cell {
    padding: 16px 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    min-height: 0;
}
.dash-chart-cell:nth-child(1),
.dash-chart-cell:nth-child(2) { border-bottom: 1px solid var(--gray-200, #e5e7eb); }
.dash-chart-cell:nth-child(1),
.dash-chart-cell:nth-child(3) { border-right:  1px solid var(--gray-200, #e5e7eb); }
.dash-chart-title {
    font-size: 9.5px;
    font-weight: 700;
    color: var(--gray-400, #9ca3af);
    text-transform: uppercase;
    letter-spacing: .07em;
    margin: 0;
    flex-shrink: 0;
}
.dash-chart-cell .dash-bar-chart { flex: 1; width: 100%; display: block; overflow: visible; }
.dash-chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    font-size: 11px;
    color: var(--gray-400, #9ca3af);
}
.dash-cmp-label { font-size: 10px; font-weight: 700; font-family: inherit; text-transform: uppercase; letter-spacing: .05em; }
.dash-cmp-num   { font-size: 12px; font-weight: 800; font-family: inherit; }
.dash-cmp-pct   { font-size: 10px; font-weight: 600; font-family: inherit; }
@media (max-width: 600px) { .dash-charts-grid { grid-template-columns: 1fr; min-height: unset; } }

/* ══════════════════════════════════════════════════════════
   REVENUE PANEL
══════════════════════════════════════════════════════════ */
.dash-panel--revenue {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 240px;
}
.dash-revenue-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}
.dash-revenue-left, .dash-revenue-right {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dash-revenue-label, .dash-revenue-avg-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--gray-400, #9ca3af);
}
.dash-revenue-total {
    font-size: 28px;
    font-weight: 900;
    color: #0f7c4a;
    letter-spacing: -0.5px;
}
.dash-revenue-avg {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-700, #374151);
}
.dash-live-badge {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 5px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    color: #15803d;
    flex-shrink: 0;
}
.dash-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #16a34a;
    animation: livePulse 1.4s ease-in-out infinite;
}
@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.75); }
}
.dash-revenue-tabs {
    display: flex;
    gap: 4px;
}
.dash-rev-tab {
    padding: 4px 10px;
    border-radius: 20px;
    border: 1.5px solid #e5e7eb;
    background: transparent;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    color: var(--gray-500, #6b7280);
    transition: background .13s, border-color .13s, color .13s;
}
.dash-rev-tab:hover { background: #f3f4f6; }
.dash-rev-tab.active { background: #0f7c4a; border-color: #0f7c4a; color: #fff; }
.dash-revenue-chart-wrap { flex: 1; min-height: 120px; }
.dash-revenue-chart-wrap svg { display: block; }
.dash-revenue-updated {
    font-size: 10px;
    color: var(--gray-400, #9ca3af);
    text-align: right;
}
.dash-rv-axis { font-size: 9px; font-family: inherit; fill: #9ca3af; }

/* ══════════════════════════════════════════════════════════
   SIDE PANELS (top products / pending plans)
══════════════════════════════════════════════════════════ */
.dash-panel--side { display: flex; flex-direction: column; }
.dash-side-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--gray-400, #9ca3af);
    text-align: center;
    padding: 16px 0;
}

/* Top products */
.dash-top-list { display: flex; flex-direction: column; gap: 10px; padding-top: 2px; }
.dash-top-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.dash-top-rank {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #f3f4f6;
    font-size: 10px;
    font-weight: 800;
    color: var(--gray-500, #6b7280);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.dash-top-info { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dash-top-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-800, #1f2937);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-top-bar-track {
    height: 4px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
}
.dash-top-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width .4s ease;
}
.dash-top-qty {
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-500, #6b7280);
    flex-shrink: 0;
}

/* Pending plans */
.dash-pending-list { display: flex; flex-direction: column; gap: 6px; padding-top: 2px; }
.dash-pending-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: #fff8f1;
    border: 1px solid #fed7aa;
    cursor: pointer;
    transition: background .13s;
}
.dash-pending-row:hover { background: #ffedd5; }
.dash-pending-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash-pending-plan {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-800, #1f2937);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-pending-pat {
    font-size: 10.5px;
    color: var(--gray-500, #6b7280);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-pending-amt {
    font-size: 13px;
    font-weight: 800;
    color: #d97706;
    flex-shrink: 0;
}
.dash-pending-more {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 7px 12px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    font-size: 11.5px;
    font-weight: 600;
    color: #c2410c;
    text-align: center;
    cursor: pointer;
    transition: background .15s;
}
.dash-pending-more:hover { background: #ffedd5; }

/* ══════════════════════════════════════════════════════════
   PROFILE SETTINGS PAGE
══════════════════════════════════════════════════════════ */
.profile-settings-wrap {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    max-width: 820px;
}
.ps-avatar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    width: 140px;
}
.ps-avatar-wrap {
    position: relative;
    cursor: pointer;
    width: 110px;
    height: 110px;
}
.ps-avatar-circle {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: #2e3f57;
    color: #fff;
    font-size: 32px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px solid #e5e7eb;
    transition: border-color 0.15s;
}
.ps-avatar-circle img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.ps-avatar-drop-hint {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(15,124,74,.82);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.3;
    opacity: 0;
    transition: opacity .18s;
    pointer-events: none;
}
.ps-avatar-wrap:hover .ps-avatar-drop-hint { opacity: 1; }
.ps-avatar-wrap.avatar-drag-over .ps-avatar-circle { outline: 3px dashed var(--green, #0f7c4a); outline-offset: 3px; }
.ps-avatar-wrap.avatar-drag-over .ps-avatar-drop-hint { opacity: 1; }
.ps-avatar-edit-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1.5px solid #d1d5db;
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    color: var(--gray-700, #374151);
    transition: background 0.13s;
}
.ps-avatar-edit-btn:hover { background: #f3f4f6; }
.ps-avatar-hint { font-size: 10.5px; color: var(--gray-400, #9ca3af); text-align: center; }
.ps-form { flex: 1; display: flex; flex-direction: column; gap: 16px; }
.ps-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ps-field { display: flex; flex-direction: column; gap: 5px; }
.ps-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-600, #4b5563);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.ps-label-opt { font-weight: 500; text-transform: none; }
.ps-input {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1.5px solid #d1d5db;
    font-size: 14px;
    font-family: inherit;
    color: var(--gray-900, #111827);
    background: #fff;
    transition: border-color 0.15s;
    outline: none;
}
.ps-input:focus { border-color: var(--green, #0f7c4a); }
.ps-form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

@media (max-width: 700px) {
    .profile-settings-wrap { flex-direction: column; align-items: center; }
    .ps-form-row { grid-template-columns: 1fr; }
    .ps-avatar-col { width: 100%; }
}

/* ══════════════════════════════════════════════════════════
   PROFILE — REDESIGNED SECTION (2-column like patient interior)
══════════════════════════════════════════════════════════ */

/* Layout: 1-col default, 2-col when admin panel is visible */
.prof-section-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    align-items: start;
    margin-top: 8px;
}
.prof-section-layout.prof-has-admin {
    grid-template-columns: 300px 1fr;
}

/* Worker-only: center the profile card on screen */
.prof-section-layout.prof-worker-centered {
    grid-template-columns: 1fr;
    max-width: 420px;
    margin: 40px auto 0;
}

/* ── Left: User card (reuses patient profile-left-card + ps-avatar-circle) ── */
.prof-user-card {
    text-align: center;
    padding: 28px 24px;
}

/* Override profile-avatar-circle for the user card (dark-blue bg instead of green) */
.prof-user-card .ps-avatar-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2e3f57, #1a2540);
    color: #fff;
    font-size: 30px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px solid #e2e8f0;
    margin: 0 auto;
}

/* Avatar wrap — tight container for circle + drop overlay */
.prof-user-avatar-wrap {
    position: relative;
    cursor: pointer;
    display: inline-block;
    margin-bottom: 10px;
}
.prof-user-avatar-wrap .ps-avatar-drop-hint {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(15,124,74,.82);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.3;
    opacity: 0;
    transition: opacity .18s;
    pointer-events: none;
}
.prof-user-avatar-wrap:hover .ps-avatar-drop-hint { opacity: 1; }
.prof-user-avatar-wrap.avatar-drag-over .ps-avatar-circle { outline: 3px dashed var(--green); outline-offset: 3px; }
.prof-user-avatar-wrap.avatar-drag-over .ps-avatar-drop-hint { opacity: 1; }

/* "Cambiar foto" button below avatar */
.prof-user-card .profile-avatar-edit-btn {
    display: block;
    margin: 0 auto 14px;
}

/* User name (reuses .profile-patient-name from patient interior) */
.prof-user-role-wrap {
    text-align: center;
    margin-bottom: 16px;
}

.prof-role-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.03em;
}
.prof-role-badge--admin  { background: rgba(99,102,241,0.12); color: #4f46e5; }
.prof-role-badge--worker { background: rgba(15,124,74,0.10);  color: var(--green); }

/* Edit profile button full-width */
.prof-user-edit-btn {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: center;
    margin-top: 6px;
    gap: 7px;
}

/* ── Right: Admin panel (workers list) ── */
.prof-admin-right {
    padding: 0 !important;
    overflow: hidden;
}

.prof-admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px 18px;
    border-bottom: 1.5px solid #f1f5f9;
    flex-wrap: wrap;
}

.prof-admin-title {
    font-size: 15px;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 4px;
}

.prof-admin-sub {
    font-size: 12.5px;
    color: #94a3b8;
    margin: 0;
}

.prof-workers-list {
    display: flex;
    flex-direction: column;
}

.prof-worker-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 24px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.12s;
}
.prof-worker-item:last-child { border-bottom: none; }
.prof-worker-item:hover { background: #f8fafc; }

.prof-worker-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2e3f57, #1a2540);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.prof-worker-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.prof-worker-name {
    font-size: 13.5px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prof-worker-meta {
    font-size: 11.5px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prof-worker-edit-btn {
    padding: 6px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    color: #374151;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.13s, border-color 0.13s;
}
.prof-worker-edit-btn:hover { background: var(--green); border-color: var(--green); color: #fff; }

/* Current password display in admin worker edit modal */
.wk-current-pw-display {
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 11px 14px;
    font-family: 'Courier New', monospace;
}
.wk-current-pw-text {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    letter-spacing: 0.04em;
}

.prof-empty-msg {
    padding: 28px;
    text-align: center;
    font-size: 13px;
    color: #94a3b8;
}

/* ── Profile / Worker edit modal ── */
.ps-form--modal {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 24px;
}

.ps-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 6px;
}

.btn-outline-gray {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    transition: background 0.13s;
}
.btn-outline-gray:hover { background: #f3f4f6; }

/* Profile-specific modal overlay (uses display:none/flex toggle via JS) */
#profileEditModal,
#workerEditModal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    backdrop-filter: blur(3px);
}
.modal-box--sm { max-width: 520px; }
.modal-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}
.modal-hdr h3 {
    font-size: 16px;
    font-weight: 800;
    color: #1e293b;
    margin: 0;
}
.modal-close-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    background: #f1f5f9;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.13s;
}
.modal-close-btn:hover { background: #e2e8f0; }

@media (max-width: 900px) {
    .prof-section-layout.prof-has-admin { grid-template-columns: 1fr; }
    .prof-admin-header { flex-direction: column; }
}

/* ══════════════════════════════════════════════════════════
   RECEIPT CARDS
══════════════════════════════════════════════════════════ */
.rec-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: box-shadow .18s, border-color .18s, transform .18s;
}
.rec-card:hover {
    border-color: #0f7c4a;
    box-shadow: 0 4px 16px rgba(15,124,74,.10);
    transform: translateY(-1px);
}
.rec-card-icon {
    flex-shrink: 0;
    width: 56px;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f7c4a 0%, #15a362 100%);
    color: #fff;
}
.rec-card-body {
    flex: 1;
    min-width: 0;
    padding: 14px 0;
}
.rec-card-top {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 6px;
}
.rec-card-folio {
    font-weight: 700;
    font-size: .93rem;
    color: #0f1720;
    letter-spacing: .3px;
}
.rec-card-patient {
    font-size: .82rem;
    font-weight: 500;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rec-card-bottom {
    display: flex;
    align-items: center;
    gap: 14px;
}
.rec-card-total {
    font-weight: 700;
    font-size: 1rem;
    color: #0f7c4a;
}
.rec-card-date {
    font-size: .78rem;
    font-weight: 500;
    color: #94a3b8;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 6px;
}
.rec-card-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    padding-right: 14px;
}
.rec-card--patient {
    margin-bottom: 8px;
}
.rec-card--patient .rec-card-icon {
    width: 46px;
}
.rec-card--patient .rec-card-body {
    padding: 10px 0;
}
.tbl-btn--red {
    color: #ef4444;
}
.tbl-btn--red:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* ── Folio field in plan interior ── */
.pi-folio-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 12px 0;
}
.pi-folio-label {
    font-size: .85rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}
.pi-folio-input {
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    font-size: .88rem;
    font-family: inherit;
    width: 160px;
    transition: border-color .15s;
}
.pi-folio-input:focus {
    outline: none;
    border-color: #0f7c4a;
    box-shadow: 0 0 0 2px rgba(15,124,74,.1);
}

/* ── Shipping badge in patient history ── */
.hist-plan-badge--enviado {
    background: #dcfce7;
    color: #166534;
}
.hist-plan-badge--no-enviado {
    background: #fef3c7;
    color: #92400e;
}

/* ═══════════════════════════════════════════════════════════
   INVENTORY / PURCHASES / RECEIPTS  — NEW MODULES
═══════════════════════════════════════════════════════════ */

/* ── Inventory table tweaks ── */
.inv-row--disabled td { opacity: 0.5; }
.inv-qty { font-weight: 700; font-variant-numeric: tabular-nums; }
.inv-qty--low { color: #ef4444; }
.inv-qty--ok { color: var(--green); }

/* ── Purchase detail modal ── */
.pur-detail { padding: 0; }

.pur-detail-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.pur-detail-title-group { display: flex; flex-direction: column; gap: 2px; }
.pur-detail-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--gray-900);
    margin: 0;
    letter-spacing: -0.02em;
}
.pur-detail-folio {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    font-variant-numeric: tabular-nums;
}
.pur-detail-badges { display: flex; gap: 6px; flex-wrap: wrap; padding-right: 4px; }
.pur-detail-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.pur-detail-badge--generada  { background: #dbeafe; color: #1e40af; }
.pur-detail-badge--pendiente { background: #fef3c7; color: #92400e; }
.pur-detail-badge--cancelada { background: #fee2e2; color: #991b1b; }
.pur-detail-badge--recibida  { background: #dcfce7; color: #166534; }
.pur-detail-badge--no_recibida { background: #f1f5f9; color: #64748b; }

.pur-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    padding: 16px;
    background: var(--gray-100);
    border-radius: 10px;
    margin-bottom: 20px;
}
.pur-detail-field { display: flex; flex-direction: column; gap: 3px; }
.pur-detail-field-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
}
.pur-detail-field-value {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--gray-900);
}

.pur-detail-table-wrap {
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
}
.pur-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.pur-detail-table thead th {
    text-align: left;
    padding: 10px 14px;
    background: var(--gray-100);
    color: var(--gray-600);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--gray-200);
}
.pur-detail-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}
.pur-detail-table tbody tr:last-child td { border-bottom: none; }
.pur-detail-td-product { font-weight: 600; color: var(--gray-900); }

.pur-detail-total {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 14px 4px 0;
    border-top: 2px solid var(--gray-200);
}
.pur-detail-total span {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pur-detail-total strong {
    font-size: 18px;
    font-weight: 800;
    color: var(--green);
}
/* Cancelled purchase rows — visible but struck through */
.pur-row--cancelled {
    background: #f9fafb;
}
.pur-row--cancelled td {
    opacity: 0.6;
    text-decoration: line-through;
    text-decoration-color: #94a3b8;
}
.pur-row--cancelled td .pur-status-toggle,
.pur-row--cancelled td .tbl-btn {
    text-decoration: none;
}
.pur-row--cancelled td .td-actions {
    text-decoration: none;
    opacity: 0.8;
}

/* ── Purchase badge ── */
.badge--pendiente { background: #fff7ed; color: #c2410c; }
.badge--recibida  { background: #f0fdf4; color: #16a34a; }
.badge--cancelada { background: #fef2f2; color: #dc2626; }
.badge--sin_recibir { background: var(--gray-100); color: var(--gray-600); }
.badge--parcial { background: #fffbeb; color: #d97706; }
.badge--completa { background: #f0fdf4; color: #16a34a; }

/* ── Receipt detail modal ── */
/* ── Receipt detail modal — redesign ── */
.rec-detail-receipt { padding: 0; }

.rec-detail-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}
.rec-detail-header h3 {
    font-size: 17px;
    font-weight: 800;
    color: var(--green);
    margin: 0;
    letter-spacing: -0.02em;
}
.rec-detail-subtitle {
    font-size: 12px;
    color: var(--gray-500);
    margin: 4px 0 0;
    font-weight: 500;
}

/* Info grid: 2 columns */
.rec-detail-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 24px;
    padding: 16px;
    background: var(--gray-100);
    border-radius: 10px;
    margin-bottom: 24px;
}
.rec-detail-info-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.rec-detail-info-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
}
.rec-detail-info-value {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--gray-900);
}

/* Table wrap */
.rec-detail-table-wrap {
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
}
.rec-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.rec-detail-table thead th {
    text-align: left;
    padding: 10px 14px;
    background: var(--gray-100);
    color: var(--gray-600);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--gray-200);
}
.rec-detail-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}
.rec-detail-table tbody tr:last-child td { border-bottom: none; }
.rec-detail-td-name { font-weight: 600; color: var(--gray-900); }

/* Totals section */
.rec-detail-totals {
    max-width: 240px;
    margin-left: auto;
    margin-right: 4px;
    padding-top: 12px;
    border-top: 2px solid var(--gray-200);
}
.rec-detail-total-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
    color: var(--gray-500);
    font-weight: 500;
}
.rec-detail-total-line span:last-child,
.rec-detail-total-line strong {
    color: var(--gray-700);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.rec-detail-total-line--grand {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--gray-200);
    font-size: 16px;
}
.rec-detail-total-line--grand span:first-child {
    font-weight: 700;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 13px;
}
.rec-detail-total-line--grand strong {
    font-size: 18px;
    font-weight: 800;
    color: var(--green);
}

/* ── Patient profile tabs ── */
.profile-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 16px; }
.profile-tab {
    flex: 1;
    padding: 10px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .15s, border-color .15s;
}
.profile-tab:hover { color: var(--gray-700); }
.profile-tab--active { color: var(--green); border-bottom-color: var(--green); }

/* ── Receipt patient row in profile ── */
.rec-patient-row { cursor: pointer; }
.rec-patient-row:hover { background: var(--gray-50); }

/* ── td-money helper ── */
.td-money { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ══════════════════════════════════════════════════════════
   INVENTORY TABLE STYLES
══════════════════════════════════════════════════════════ */
.inv-table th { font-size: .8rem; }
.th-right { text-align: right; }
.td-right { text-align: right; }
.td-name { font-weight: 600; color: #1e293b; }
.td-supplier { color: #64748b; font-size: .85rem; }
.inv-row--disabled { opacity: .5; }

.td-profit--pos { color: #16a34a; }
.td-profit--neg { color: #ef4444; }
.inv-pct { font-size: .72rem; color: #94a3b8; font-weight: 400; }

.inv-badge {
    display: inline-block;
    min-width: 36px;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: .82rem;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.inv-badge--high { background: #dcfce7; color: #166534; }
.inv-badge--med  { background: #fef3c7; color: #92400e; }
.inv-badge--low  { background: #fee2e2; color: #991b1b; }

.tbl-btn--primary { color: #0f7c4a; }
.tbl-btn--primary:hover { background: #f0fdf4; }

/* ══════════════════════════════════════════════════════════
   PURCHASE LIST — INLINE STATUS CONTROLS
══════════════════════════════════════════════════════════ */
.pur-inline-status {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.pur-status-toggle {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: .78rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background .15s, color .15s;
    font-family: inherit;
}
.pur-status-toggle--generada { background: #dbeafe; color: #1e40af; }
.pur-status-toggle--generada:hover { background: #bfdbfe; }
.pur-status-toggle--pendiente { background: #fef3c7; color: #92400e; }
.pur-status-toggle--pendiente:hover { background: #fde68a; }
.pur-status-toggle--cancelada { background: #fee2e2; color: #991b1b; cursor: default; }
.pur-status-toggle--recibida { background: #dcfce7; color: #166534; }
.pur-status-toggle--recibida:hover { background: #bbf7d0; }
.pur-status-toggle--no_recibida { background: #f1f5f9; color: #64748b; }
.pur-status-toggle--no_recibida:hover { background: #e2e8f0; }

.pur-recv-input {
    width: 52px;
    padding: 3px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    font-size: .82rem;
    font-family: inherit;
    text-align: center;
    font-variant-numeric: tabular-nums;
    transition: border-color .15s;
}
.pur-recv-input:focus {
    outline: none;
    border-color: #0f7c4a;
    box-shadow: 0 0 0 2px rgba(15,124,74,.1);
}
.pur-recv-pending { font-size: .75rem; color: #94a3b8; margin-left: 2px; }

/* ══════════════════════════════════════════════════════════
   PURCHASE MODAL — PRODUCT ITEM ROWS
══════════════════════════════════════════════════════════ */
.pur-item-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    margin-bottom: 8px;
    transition: border-color .2s, box-shadow .2s;
}
.pur-item-row:hover {
    border-color: #cbd5e1;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

/* ── Base input & select styles inside product rows ── */
.pur-item-row select,
.pur-item-row input[type="number"] {
    box-sizing: border-box;
    height: 40px;
    border: 1px solid var(--gray-200);
    border-radius: 9px;
    background: var(--gray-100);
    padding: 8px 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-900);
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
.pur-item-row select:hover,
.pur-item-row input[type="number"]:hover {
    border-color: #94a3b8;
}
.pur-item-row select:focus,
.pur-item-row input[type="number"]:focus {
    border-color: var(--green);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(15,124,74,.1);
}

/* ── Select dropdown custom arrow ── */
.pur-item-row select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 30px;
    cursor: pointer;
}

/* ── Column sizing ── */
.pur-item-product { flex: 2.5; min-width: 120px; }
.pur-item-qty { width: 80px; flex-shrink: 0; text-align: center; }
.pur-item-price { width: 100px; flex-shrink: 0; text-align: right; }

/* ── Remove button ── */
.pur-item-remove {
    width: 36px;
    height: 36px;
    border: 1px solid var(--gray-200);
    background: #fff;
    color: #cbd5e1;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color .15s, color .15s, background .15s;
}
.pur-item-remove:hover {
    border-color: #f87171;
    color: #ef4444;
    background: #fef2f2;
}

/* ══════════════════════════════════════════════════════════
   PET SYSTEM — Image-based pixel cat (admin only)
   Uses images/image_cat_main.png
══════════════════════════════════════════════════════════ */

/* ── Zone (lives in topbar-inner, between left & right) ── */
.pet-zone {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-end;
    height: 100%;
    position: relative;
    pointer-events: none;
    overflow: visible;
}

/* ── Pet wrapper (JS controls translateX + scaleX for direction) ── */
.pet-wrap {
    position: absolute;
    bottom: 4px;
    left: 0;
    width: 56px;
    height: 56px;
    cursor: pointer;
    pointer-events: auto;
    image-rendering: pixelated;
    transform-origin: center bottom;
    will-change: transform;
}

/* ── Cat image (now an <img> element) ── */
.pet-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    transition: opacity .18s ease;
}
.pet-img.pet-img--fading {
    opacity: 0;
}

/* ── Shadow under cat ── */
.pet-shadow {
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 6px;
    background: radial-gradient(ellipse, rgba(0,0,0,.18) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* ── ZZZ bubble (sleep state) ── */
.pet-zzz {
    position: absolute;
    top: -4px;
    right: -6px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: 900;
    color: #94a3b8;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    display: flex;
    gap: 1px;
}
.pet-zzz span:nth-child(1) { font-size: 9px; }
.pet-zzz span:nth-child(2) { font-size: 7px; }


/* ─────────────────────────────────────────────────────────
   ANIMATION STATES  (pixel-style = steps() easing)
───────────────────────────────────────────────────────── */

/* ▸ IDLE — gentle breathing bob */
.pet-state--idle .pet-img {
    animation: pet-idle 2s steps(4) infinite;
}
.pet-state--idle .pet-shadow {
    animation: pet-shadow-idle 2s steps(4) infinite;
}
@keyframes pet-idle {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-2px); }
}
@keyframes pet-shadow-idle {
    0%, 100% { width: 36px; opacity: 1; }
    50%      { width: 34px; opacity: .85; }
}

/* ▸ WALK — step bob with tilt (horizontal movement via JS) */
.pet-state--walk .pet-img {
    animation: pet-walk 0.45s steps(4) infinite;
}
.pet-state--walk .pet-shadow {
    animation: pet-shadow-walk 0.45s steps(4) infinite;
}
@keyframes pet-walk {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25%      { transform: translateY(-3px) rotate(-3deg); }
    50%      { transform: translateY(0) rotate(0deg); }
    75%      { transform: translateY(-3px) rotate(3deg); }
}
@keyframes pet-shadow-walk {
    0%, 100% { width: 36px; }
    25%, 75% { width: 30px; }
}

/* ▸ SLEEP — breathing scale + floating Zs */
.pet-state--sleep .pet-img {
    animation: pet-sleep 2s ease-in-out infinite;
    transform-origin: center bottom;
}
.pet-state--sleep .pet-zzz {
    opacity: 1;
    animation: pet-zzz-float 2.2s ease-in-out infinite;
}
.pet-state--sleep .pet-shadow {
    animation: pet-shadow-sleep 2s ease-in-out infinite;
}
@keyframes pet-sleep {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}
@keyframes pet-shadow-sleep {
    0%, 100% { width: 36px; }
    50%      { width: 38px; }
}
@keyframes pet-zzz-float {
    0%   { transform: translate(0, 0); opacity: 0; }
    15%  { opacity: 1; }
    50%  { transform: translate(4px, -10px); opacity: 0.7; }
    100% { transform: translate(8px, -18px); opacity: 0; }
}

/* ▸ PLAY — subtle wiggle (cat + yarn in single image) */
.pet-state--play .pet-img {
    animation: pet-play 0.8s steps(4) infinite;
}
@keyframes pet-play {
    0%, 100% { transform: rotate(0deg); }
    25%      { transform: rotate(2deg); }
    75%      { transform: rotate(-2deg); }
}

/* ▸ EAT — fast head bob (eating motion) */
.pet-state--eat .pet-img {
    animation: pet-eat 0.4s steps(3) infinite;
    transform-origin: center bottom;
}
.pet-state--eat .pet-shadow {
    animation: pet-shadow-eat 0.4s steps(3) infinite;
}
@keyframes pet-eat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(2px); }
}
@keyframes pet-shadow-eat {
    0%, 100% { width: 36px; }
    50%      { width: 38px; }
}

/* ▸ PET (click interaction) — happy bounce */
.pet-state--pet .pet-img {
    animation: pet-petted 0.35s ease-in-out infinite;
}
@keyframes pet-petted {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-3px); }
}

/* ─────────────────────────────────────────────────────────
   PET SELECTOR (avatar right-click toggle)
───────────────────────────────────────────────────────── */

.pet-selector-wrap {
    position: relative;
}

.pet-selector-panel {
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(-6px);
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    box-shadow: 0 8px 28px rgba(0,0,0,.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 999;
    white-space: nowrap;
}

.pet-selector-panel--open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0);
}

.pet-selector-title {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.45);
    margin-bottom: 2px;
}

.pet-selector-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pet-selector-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: rgba(255,255,255,.06);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform .15s, border-color .15s, background .15s;
    padding: 0;
}
.pet-selector-icon {
    width: 28px;
    height: 28px;
    image-rendering: pixelated;
    object-fit: contain;
}
.pet-selector-btn:hover {
    transform: scale(1.15);
    background: rgba(255,255,255,.12);
    border-color: rgba(255,255,255,.2);
}
.pet-selector-btn--active {
    border-color: #4ade80;
    background: rgba(74,222,128,.12);
}
.pet-selector-btn--active:hover {
    border-color: #4ade80;
}

/* ── Arrow pointer from panel to avatar ── */
.pet-selector-panel::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #1e293b;
}

/* ══════════════════════════════════════════════════════════
   STATEMENTS — Estados de cuenta
══════════════════════════════════════════════════════════ */
.stmt-list { display: flex; flex-direction: column; gap: 6px; }

.stmt-row {
    display: grid;
    grid-template-columns: 80px 1.4fr 110px 105px 110px 100px 100px 120px;
    align-items: center;
    gap: 0;
    padding: 12px 16px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    transition: box-shadow .18s ease, border-color .18s ease;
}
.stmt-row:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 10px rgba(15, 124, 74, .08);
}

.stmt-cell {
    font-size: 13px;
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stmt-cell--folio {
    font-weight: 700;
    color: var(--gray-900);
    font-size: 12px;
    font-family: 'Courier New', Courier, monospace;
}
.stmt-cell--patient {
    font-weight: 600;
    color: var(--gray-800);
}
.stmt-cell--total,
.stmt-cell--paid {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.stmt-cell--balance {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #e53e3e;
}
.stmt-cell--balance.stmt-paid { color: var(--primary); }

.stmt-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.stmt-status-badge--pagado {
    background: rgba(15, 124, 74, .1);
    color: #0f7c4a;
}
.stmt-status-badge--nopagado {
    background: rgba(229, 62, 62, .1);
    color: #e53e3e;
}

.stmt-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

/* Header row */
.stmt-header {
    display: grid;
    grid-template-columns: 80px 1.4fr 110px 105px 110px 100px 100px 120px;
    gap: 0;
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 4px;
}
.stmt-header > span,
.stmt-row > .stmt-cell,
.stmt-row > .stmt-actions {
    padding: 0 4px;
}

.stmt-export-btn {
    background: linear-gradient(135deg, #16a34a 0%, #0f7c4a 100%) !important;
}

@media (max-width: 900px) {
    .stmt-row, .stmt-header {
        grid-template-columns: 70px 1fr 90px 85px 95px 85px 85px 100px;
        font-size: 11px;
        padding: 10px 10px;
    }
}
@media (max-width: 720px) {
    .stmt-row, .stmt-header {
        grid-template-columns: 1fr 1fr;
        gap: 4px;
    }
    .stmt-header { display: none; }
    .stmt-row { padding: 12px; }
    .stmt-cell::before {
        content: attr(data-label);
        font-size: 10px;
        font-weight: 700;
        color: var(--gray-400);
        text-transform: uppercase;
        display: block;
        margin-bottom: 2px;
    }
    .stmt-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ── Payment modal ── */
.stmt-pay-modal {
    width: 520px;
    max-width: 95vw;
    max-height: 90vh;
    border-radius: 16px;
    background: var(--white);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
}
.stmt-pay-modal .modal-header {
    padding: 20px 24px 14px;
    border-bottom: none;
}
.stmt-pay-info-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 24px 8px;
    padding: 10px 14px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #166534;
    line-height: 1.35;
}
.stmt-pay-info-icon {
    flex-shrink: 0;
    color: #16a34a;
    display: flex;
    align-items: center;
}
.stmt-pay-body {
    padding: 16px 24px 8px;
    overflow-y: auto;
    flex: 1;
}
.stmt-pay-body .form-grid-2 {
    margin-bottom: 14px;
}
.stmt-pay-body .form-group {
    margin-bottom: 2px;
}
.stmt-pay-body .form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 5px;
    display: block;
}
.stmt-pay-body .form-input {
    font-size: 13px;
}
.stmt-pay-totals-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 10px 0 14px;
}
.stmt-pay-totals {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}
.stmt-pay-total-line {
    display: flex;
    align-items: center;
    gap: 16px;
}
.stmt-pay-total-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-align: right;
    min-width: 170px;
}
.stmt-pay-total-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-800);
    min-width: 90px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.stmt-pay-total-value--red {
    color: #e53e3e;
}
.stmt-pay-total-line--balance .stmt-pay-total-label {
    color: #e53e3e;
    font-weight: 700;
}
.stmt-pay-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
}
@media (max-width: 560px) {
    .stmt-pay-modal { width: 100%; }
    .stmt-pay-body { padding: 14px 16px 6px; }
    .stmt-pay-info-badge { margin: 0 16px 8px; }
    .stmt-pay-footer { padding: 14px 16px; }
}

/* ══════════════════════════════════════════════════════════
   MOBILE RESPONSIVE — Hamburger menu, mobile overlay, pet
══════════════════════════════════════════════════════════ */

/* ── Mobile menu overlay ── */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
}
.mobile-menu-overlay.open { display: block; }

.mobile-menu-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    animation: mmFadeIn 0.2s ease;
}
@keyframes mmFadeIn { from { opacity: 0; } to { opacity: 1; } }

.mobile-menu {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 300px;
    max-width: 85vw;
    background: #1a2332;
    display: flex;
    flex-direction: column;
    animation: mmSlideIn 0.25s cubic-bezier(0.22,1,0.36,1);
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
}
@keyframes mmSlideIn { from { transform: translateX(-100%); } to { transform: translateX(0); } }

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.mobile-menu-title {
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.01em;
}
.mobile-menu-close {
    width: 36px; height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    font-size: 22px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.15s;
}
.mobile-menu-close:hover { background: rgba(255,255,255,0.15); }

.mobile-menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.mobile-menu-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px 10px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.7);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.mobile-menu-btn svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}
.mobile-menu-btn:hover,
.mobile-menu-btn:active {
    background: rgba(15,124,74,0.18);
    color: #4ade80;
    border-color: rgba(15,124,74,0.3);
}
.mobile-menu-btn.mm-active {
    background: rgba(15,124,74,0.22);
    color: #4ade80;
    border-color: rgba(74,222,128,0.3);
}
.mobile-menu-btn--logout {
    grid-column: 1 / -1;
    flex-direction: row;
    padding: 14px;
    margin-top: 4px;
    border-color: rgba(248,113,113,0.15);
    color: rgba(248,113,113,0.7);
}
.mobile-menu-btn--logout:hover,
.mobile-menu-btn--logout:active {
    background: rgba(248,113,113,0.12);
    color: #f87171;
    border-color: rgba(248,113,113,0.3);
}

/* ── Pet: hide on phones, show on tablets+ ── */
@media (max-width: 768px) {
    .pet-zone { display: none !important; }
}

/* ── Mobile breakpoint: ≤768px ── */
@media (max-width: 768px) {
    .topbar-hamburger {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 36px; height: 36px;
        border: none; background: none; cursor: pointer; padding: 6px;
        border-radius: 8px;
        transition: background 0.15s;
        flex-shrink: 0;
    }
    .topbar-hamburger:hover { background: var(--gray-100); }
    .topbar-hamburger span {
        display: block; height: 2px;
        background: var(--gray-700); border-radius: 2px;
        transition: transform 0.2s, opacity 0.2s;
    }

    .sidebar { display: none; }

    .topbar-inner { padding: 0 14px; height: 54px; gap: 10px; }
    .topbar-name { font-size: 13px; }
    .topbar-sub { font-size: 10px; }
    .topbar-logo { width: 30px; height: 30px; min-width: 30px; border-radius: 8px; }
    .topbar-logo svg { width: 18px; height: 18px; }

    .main-content { padding: 14px 12px 0; }

    /* Page header responsive */
    .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .page-header h1 { font-size: 20px; }
    .page-header-right { width: 100%; }

    /* Tables: horizontal scroll */
    .data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Stat cards grid */
    .dash-stats { grid-template-columns: 1fr 1fr; gap: 8px; }

    /* Form grids */
    .form-grid-2,
    .form-grid-3 { grid-template-columns: 1fr; }

    /* Modal widths */
    .modal-form { width: 95vw; max-width: 95vw; }

    /* Patient cards */
    .pts-stat-grid { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
    .pts-stat-card { padding: 12px 10px; }

    /* Plans grid */
    .plans-grid { grid-template-columns: 1fr; }

    /* Notification panel */
    .notif-panel { width: 90vw; right: -40px; }

    /* Body allow scroll on mobile */
    body { overflow: auto; overflow-x: hidden; }
    .main-area { overflow: auto; }
    .main-content { overflow: visible; }
}

/* ── Smaller phones: ≤480px ── */
@media (max-width: 480px) {
    .topbar-inner { padding: 0 10px; }
    .main-content { padding: 10px 8px 0; }
    .dash-stats { grid-template-columns: 1fr; }
    .pts-stat-grid { grid-template-columns: 1fr; }
    .mobile-menu { width: 260px; }
    .mobile-menu-grid { gap: 6px; padding: 12px; }
    .mobile-menu-btn { padding: 14px 8px; font-size: 11px; }
    .mobile-menu-btn svg { width: 20px; height: 20px; }
    .page-header h1 { font-size: 18px; }
}