/* ══════════════════════════════════════════════════════════════
   SELLRITHM PHARMACY POS — Design System
   Font: Plus Jakarta Sans (body) + Syne (headings)
   Theme: Deep Navy / Electric Blue / White
   ══════════════════════════════════════════════════════════════ */

/* ── VARIABLES ──────────────────────────────────────────────── */
@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700;800&display=swap");

:root {
    /* Brand */
    --navy: #0b1437;
    --navy-mid: #142156;
    --navy-light: #1e3a8a;
    --blue: #2563eb;
    --blue-light: #3b82f6;
    --blue-pale: #eff6ff;
    --blue-glow: rgba(37, 99, 235, 0.18);

    /* Ink */
    --ink: #0f172a;
    --ink-mid: #1e293b;
    --ink-soft: #475569;
    --muted: #94a3b8;
    --muted-light: #cbd5e1;

    /* Surfaces */
    --bg: #f0f4ff;
    --surface: #ffffff;
    --surface-2: #f8faff;
    --surface-3: #eef2ff;
    --border: rgba(30, 58, 138, 0.1);
    --border-mid: rgba(30, 58, 138, 0.15);
    --border-str: rgba(30, 58, 138, 0.22);

    /* Status */
    --green: #10b981;
    --green-bg: #ecfdf5;
    --amber: #f59e0b;
    --amber-bg: #fffbeb;
    --red: #ef4444;
    --red-bg: #fef2f2;
    --purple: #7c3aed;
    --purple-bg: #f3f0ff;

    /* Layout */
    --sidebar-w: 238px;
    --topbar-h: 62px;

    /* Shape */
    --r-lg: 20px;
    --r-md: 14px;
    --r-sm: 10px;
    --r-xs: 7px;

    /* Shadow */
    --shadow-xs: 0 1px 4px rgba(15, 23, 42, 0.06);
    --shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.12);
    --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.18);
}

/* ── RESET ──────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "DM Sans", sans-serif;
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── APP SHELL ──────────────────────────────────────────────── */
.app {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: var(--surface);
    border-radius: 28px;
    border: 3px solid rgba(30, 58, 138, 0.2);
    box-shadow:
        0 28px 80px rgba(15, 23, 42, 0.22),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

/* ── SIDEBAR ────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--navy);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
    z-index: 20;
    overflow: hidden;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(
            ellipse 120% 40% at 50% 0%,
            rgba(59, 130, 246, 0.2) 0%,
            transparent 65%
        ),
        radial-gradient(
            ellipse 80% 30% at 50% 100%,
            rgba(37, 99, 235, 0.1) 0%,
            transparent 60%
        ),
        linear-gradient(180deg, #142156 0%, #0b1437 100%);
}
.sidebar > * {
    position: relative;
    z-index: 1;
}

/* Collapse toggle */
.sidebar-toggle-btn {
    position: absolute;
    top: 50%;
    right: -14px;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border-str);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-soft);
    transition: all 0.2s;
    z-index: 30;
    box-shadow: var(--shadow-sm);
}
.sidebar-toggle-btn:hover {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}
.sidebar.collapsed {
    width: 68px;
}
.sidebar.collapsed .brand-text,
.sidebar.collapsed .brand-badge,
.sidebar.collapsed .user-info,
.sidebar.collapsed .status-dot-wrap,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .logout-label {
    display: none;
}
.sidebar.collapsed .nav-item {
    padding: 10px 0;
    justify-content: center;
}
.sidebar.collapsed .sidebar-toggle-btn svg {
    transform: rotate(180deg);
}
.sidebar.collapsed .brand {
    padding: 18px 14px;
    gap: 0;
}
.sidebar.collapsed .sidebar-user {
    padding: 12px 0;
    justify-content: center;
}
.sidebar.collapsed .logout-btn {
    padding: 10px 0;
    justify-content: center;
}

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 20px 18px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.brand-logo {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
}
.brand-name {
    font-family: "DM Sans", sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.3px;
    line-height: 1;
}
.brand-sub {
    font-size: 9.5px;
    color: rgba(255, 255, 255, 0.28);
    margin-top: 2px;
    font-weight: 500;
}
.brand-badge {
    margin-left: auto;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.8px;
    background: linear-gradient(135deg, #2563eb, #1e3a8a);
    color: #fff;
    padding: 2px 7px;
    border-radius: 20px;
    flex-shrink: 0;
}

/* User block */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin: 0 10px 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--r-sm);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1e3a8a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.3),
        0 0 0 2px rgba(255, 255, 255, 0.08);
}
.uname {
    font-size: 12.5px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.2;
}
.urole {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.28);
    font-weight: 500;
    margin-top: 1px;
}
.status-dot-wrap {
    margin-left: auto;
}
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow:
        0 0 0 2px rgba(34, 197, 94, 0.25),
        0 0 8px rgba(34, 197, 94, 0.5);
    animation: pulse-green 2s ease-in-out infinite;
}
@keyframes pulse-green {
    0%,
    100% {
        box-shadow:
            0 0 0 2px rgba(34, 197, 94, 0.25),
            0 0 8px rgba(34, 197, 94, 0.5);
    }
    50% {
        box-shadow:
            0 0 0 4px rgba(34, 197, 94, 0.12),
            0 0 14px rgba(34, 197, 94, 0.6);
    }
}

/* Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 0 8px;
}
.sidebar-nav::-webkit-scrollbar {
    width: 0;
}

.nav-label {
    font-size: 8.5px;
    font-weight: 800;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.18);
    padding: 16px 18px 5px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8.5px 18px;
    margin: 1px 8px;
    color: rgba(255, 255, 255, 0.38);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border-radius: var(--r-sm);
    transition: all 0.16s ease;
    position: relative;
    border: none;
    background: none;
    font-family: "DM Sans", sans-serif;
    width: calc(100% - 16px);
}
.nav-item:hover {
    color: rgba(255, 255, 255, 0.78);
    background: rgba(255, 255, 255, 0.06);
}
.nav-item.active {
    color: #fff;
    background: rgba(59, 130, 246, 0.18);
    font-weight: 700;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.3) inset;
}
.nav-item.active::before {
    content: "
            ";
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--blue-light);
    border-radius: 0 3px 3px 0;
}
.nav-icon {
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.75;
}
.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
    opacity: 1;
}
.nav-badge {
    margin-left: auto;
    background: var(--red);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    padding: 1.5px 6px;
    border-radius: 20px;
    min-width: 18px;
    text-align: center;
}

/* Sidebar bottom */
.sidebar-bottom {
    padding: 10px 8px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 18px;
    border-radius: var(--r-sm);
    color: rgba(255, 255, 255, 0.38);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    border: none;
    font-family: "DM Sans", sans-serif;
    transition: all 0.18s;
}
.logout-btn:hover {
    color: #fff;
    background: rgba(239, 68, 68, 0.15);
}
.logout-btn .nav-icon {
    opacity: 0.6;
}
.logout-btn:hover .nav-icon {
    opacity: 1;
}

/* Mobile backdrop */
.mobile-sidebar-backdrop {
    display: none;
}

/* ── MAIN AREA ──────────────────────────────────────────────── */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ── TOPBAR ─────────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 24px;
    flex-shrink: 0;
    box-shadow:
        0 1px 0 var(--border),
        var(--shadow-xs);
}
.topbar-title {
    font-family: "DM Sans", sans-serif;
    font-size: 17px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.4px;
    white-space: nowrap;
}
.topbar-sep {
    width: 1px;
    height: 22px;
    background: var(--border-str);
    flex-shrink: 0;
}
.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Search */
.search-wrap {
    flex: 1;
    max-width: 400px;
    height: 38px;
    background: var(--surface-2);
    border: 1.5px solid var(--border-mid);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 13px;
    transition: all 0.2s;
}
.search-wrap:focus-within {
    border-color: var(--blue-light);
    background: #fff;
    box-shadow: 0 0 0 3px var(--blue-glow);
}
.search-wrap input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: 13px;
    color: var(--ink);
}
.search-wrap input::placeholder {
    color: var(--muted);
}
.search-wrap svg {
    color: var(--muted);
    flex-shrink: 0;
}

/* Clock */
.clock-block {
    text-align: right;
}
.clock-time {
    font-size: 15px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -1px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.clock-date {
    font-size: 10px;
    color: var(--muted);
    margin-top: 1px;
    font-weight: 500;
}

/* Buttons */
.tbtn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 37px;
    padding: 0 14px;
    border-radius: var(--r-xs);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.18s;
    white-space: nowrap;
}
.tbtn-primary {
    background: linear-gradient(135deg, #2563eb, #1e3a8a);
    color: #fff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}
.tbtn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.4);
}
.tbtn-ghost {
    background: var(--surface-2);
    color: var(--ink-mid);
    border: 1.5px solid var(--border-mid);
}
.tbtn-ghost:hover {
    background: var(--surface-3);
    border-color: var(--border-str);
}
.tbtn-danger {
    background: var(--red-bg);
    color: var(--red);
    border: 1.5px solid rgba(239, 68, 68, 0.2);
}
.tbtn-danger:hover {
    background: var(--red);
    color: #fff;
}
.mobile-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: var(--r-xs);
    background: transparent;
    border: 1.5px solid var(--border-mid);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--ink-soft);
}

/* ── PAGE CONTENT ───────────────────────────────────────────── */
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 26px;
    background: var(--bg);
}
.page-content::-webkit-scrollbar {
    width: 4px;
}
.page-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.09);
    border-radius: 4px;
}

/* Page header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-heading {
    font-family: "DM Sans", sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.6px;
}
.page-sub {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
    font-weight: 500;
}
.page-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* Flash messages */
.flash {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 16px;
    border-radius: var(--r-sm);
    margin-bottom: 18px;
    font-size: 13.5px;
    font-weight: 600;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
.flash-success {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid rgba(16, 185, 129, 0.18);
}
.flash-error {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.18);
}

/* ── STAT CARDS ─────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow-xs);
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--blue), var(--blue-light));
    opacity: 0;
    transition: opacity 0.2s;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.stat-card:hover::before {
    opacity: 1;
}
.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--r-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}
.stat-icon-blue {
    background: var(--blue-pale);
    color: var(--blue);
}
.stat-icon-green {
    background: var(--green-bg);
    color: var(--green);
}
.stat-icon-amber {
    background: var(--amber-bg);
    color: var(--amber);
}
.stat-icon-red {
    background: var(--red-bg);
    color: var(--red);
}
.stat-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 6px;
}
.stat-value {
    font-family: "DM Sans", sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -1px;
    line-height: 1;
}
.stat-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
}
.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    margin-top: 8px;
}
.trend-up {
    background: var(--green-bg);
    color: var(--green);
}
.trend-down {
    background: var(--red-bg);
    color: var(--red);
}

/* ── TABLE CARD ─────────────────────────────────────────────── */
.table-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}
.table-card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.table-card-title {
    font-family: "DM Sans", sans-serif;
    font-size: 15px;
    font-weight: 800;
    color: var(--ink);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    background: var(--surface-2);
    padding: 11px 18px;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 13px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    color: var(--ink-soft);
    vertical-align: middle;
}
.data-table tr:last-child td {
    border-bottom: none;
}
.data-table tbody tr:hover {
    background: var(--surface-2);
}

/* Product cell in tables */
.prod-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}
.prod-img {
    width: 42px;
    height: 42px;
    border-radius: var(--r-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--surface-3);
    border: 1.5px solid var(--border);
}
.prod-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.prod-img-svg {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}
.prod-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.2px;
}
.prod-sku {
    font-size: 11px;
    color: var(--muted);
    margin-top: 1px;
    font-weight: 500;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}
.badge-green {
    background: var(--green-bg);
    color: var(--green);
}
.badge-amber {
    background: var(--amber-bg);
    color: var(--amber);
}
.badge-red {
    background: var(--red-bg);
    color: var(--red);
}
.badge-blue {
    background: var(--blue-pale);
    color: var(--blue);
}
.badge-purple {
    background: var(--purple-bg);
    color: var(--purple);
}
.badge-gray {
    background: var(--surface-3);
    color: var(--muted);
}

.stock-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    gap: 4px;
}
.stock-ok {
    background: var(--green-bg);
    color: var(--green);
}
.stock-low {
    background: var(--amber-bg);
    color: var(--amber);
}
.stock-out {
    background: var(--red-bg);
    color: var(--red);
}

/* Action buttons */
.act-btn {
    width: 31px;
    height: 31px;
    border-radius: var(--r-xs);
    border: 1.5px solid var(--border-str);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-soft);
    transition: all 0.16s;
}
.act-btn:hover {
    background: var(--blue-pale);
    border-color: var(--blue-light);
    color: var(--blue);
}
.act-btn.danger:hover {
    background: var(--red-bg);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--red);
}

/* ── FORMS ──────────────────────────────────────────────────── */
.form-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-lg);
    padding: 26px;
    box-shadow: var(--shadow-xs);
}
.form-section-title {
    font-family: "DM Sans", sans-serif;
    font-size: 14px;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 18px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-full {
    grid-column: 1/-1;
}
.form-label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-control {
    border: 1.5px solid var(--border-str);
    background: var(--surface-2);
    border-radius: var(--r-sm);
    padding: 10px 13px;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--ink);
    transition: all 0.18s;
    outline: none;
    width: 100%;
}
.form-control:focus {
    border-color: var(--blue-light);
    background: #fff;
    box-shadow: 0 0 0 3px var(--blue-glow);
}
.form-control.is-error {
    border-color: var(--red);
}
.form-error {
    font-size: 11.5px;
    color: var(--red);
    font-weight: 600;
}
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}
.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

/* ── MODAL ──────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.open {
    display: flex;
}
.modal {
    background: var(--surface);
    border-radius: 22px;
    padding: 28px;
    max-width: 520px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(10px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}
.modal-title {
    font-family: "DM Sans", sans-serif;
    font-size: 18px;
    font-weight: 800;
    color: var(--ink);
}
.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--r-xs);
    border: 1.5px solid var(--border-str);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: all 0.18s;
}
.modal-close:hover {
    background: var(--red-bg);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--red);
}

/* ═══════════════════════════════════════════════════════════════
   POS LAYOUT
   ═══════════════════════════════════════════════════════════════ */
.pos-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Category tab bar */
.cat-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    overflow-x: auto;
    flex-shrink: 0;
    height: 48px;
    scrollbar-width: none;
}
.cat-bar::-webkit-scrollbar {
    display: none;
}
.cat-tab {
    height: 100%;
    padding: 0 16px;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--muted);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 2.5px solid transparent;
    margin-bottom: -1px;
    transition: all 0.18s;
}
.cat-tab:hover {
    color: var(--ink-soft);
}
.cat-tab.active {
    color: var(--blue);
    font-weight: 800;
    border-bottom-color: var(--blue);
    background: var(--blue-pale);
    border-radius: var(--r-xs) var(--r-xs) 0 0;
}

/* Product grid */
.products-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.products-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: var(--bg);
}
.products-scroll::-webkit-scrollbar {
    width: 4px;
}
.products-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.09);
    border-radius: 4px;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 14px;
}

.product-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    box-shadow: var(--shadow-xs);
}
.product-card:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: var(--shadow-md);
    border-color: var(--blue-light);
}
.product-card:active {
    transform: translateY(-2px) scale(1);
}

.prod-stock-badge {
    position: absolute;
    top: 9px;
    right: 9px;
    z-index: 2;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    color: rgba(255, 255, 255, 0.9);
    font-size: 9.5px;
    font-weight: 700;
    padding: 2.5px 8px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 3px;
}
.prod-stock-badge.low {
    background: rgba(239, 68, 68, 0.85);
}
.prod-stock-badge.out {
    background: rgba(239, 68, 68, 0.95);
}

/* Product image: real photo via <img> with SVG fallback */
.prod-thumb {
    width: 100%;
    aspect-ratio: 1.1;
    position: relative;
    overflow: hidden;
    background: var(--surface-3);
}
.prod-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}
.prod-card:hover .prod-thumb img {
    transform: scale(1.06);
}
.prod-thumb-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f4ff, #e8efff);
    color: var(--blue-light);
}
.prod-thumb-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 38%;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.35), transparent);
}

.prod-body {
    padding: 10px 12px 12px;
}
.prod-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.2px;
}
.prod-category {
    font-size: 10.5px;
    color: var(--muted);
    margin-top: 2px;
    font-weight: 500;
    margin-bottom: 10px;
}
.prod-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.prod-price {
    font-family: "DM Sans", sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: var(--blue);
    letter-spacing: -0.5px;
}
.add-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #2563eb, #1e3a8a);
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
    line-height: 1;
}
.add-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}

/* Empty state */
.empty-state {
    grid-column: 1/-1;
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}
.empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--surface-3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: var(--muted);
}

/* ── CART PANEL ─────────────────────────────────────────────── */
.cart-panel {
    width: 336px;
    background: var(--surface);
    flex-shrink: 0;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.05);
}
.cart-head {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fff 0%, var(--surface-2) 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cart-order-no {
    font-family: "DM Sans", sans-serif;
    font-size: 20px;
    font-weight: 800;
    color: var(--blue);
    letter-spacing: -0.5px;
}
.cart-order-lbl {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted);
    margin-bottom: 2px;
}
.cart-cust-row {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 4px;
}
.cart-cust-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
}
.cart-cust-btn {
    padding: 4px 10px;
    border-radius: 7px;
    border: 1.5px solid var(--border-str);
    background: transparent;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-soft);
    cursor: pointer;
    transition: all 0.18s;
}
.cart-cust-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.cart-items-wrap {
    flex: 1;
    min-height: 0;      /* critical: allows flex child to shrink below content size */
    overflow-y: auto;
    padding: 12px;
    background: var(--bg);
}
.cart-items-wrap::-webkit-scrollbar {
    width: 3px;
}
.cart-items-wrap::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.07);
    border-radius: 3px;
}

.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: var(--muted);
    padding: 20px;
}
.cart-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--surface-3);
    display: flex;
    align-items: center;
    justify-content: center;
}
.cart-empty-title {
    font-size: 14px;
    font-weight: 700;
}
.cart-empty-sub {
    font-size: 12px;
    text-align: center;
    line-height: 1.5;
    opacity: 0.7;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 11px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    margin-bottom: 8px;
    transition: all 0.16s;
}
.cart-item:last-child {
    margin-bottom: 0;
}
.cart-item:hover {
    border-color: var(--border-str);
    box-shadow: var(--shadow-xs);
}
.ci-thumb {
    width: 42px;
    height: 42px;
    border-radius: var(--r-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--surface-3);
    border: 1px solid var(--border);
}
.ci-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.ci-thumb-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blue-light);
}
.ci-info {
    flex: 1;
    min-width: 0;
}
.ci-name {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ci-price {
    font-size: 11.5px;
    color: var(--blue);
    font-weight: 800;
    margin-top: 2px;
}
.ci-each {
    font-size: 10.5px;
    color: var(--muted);
}
.qty-ctrl {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}
.qty-btn {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    border: 1.5px solid var(--border-str);
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    color: var(--ink-mid);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.16s;
    line-height: 1;
    font-weight: 600;
    font-family: inherit;
}
.qty-btn:hover {
    background: var(--blue);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}
.qty-num {
    font-size: 14px;
    font-weight: 800;
    color: var(--ink);
    width: 22px;
    text-align: center;
    letter-spacing: -0.3px;
}

/* Cart footer */
.cart-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.discount-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px;
}
.discount-lbl {
    font-size: 12.5px;
    color: var(--muted);
    flex: 1;
    font-weight: 500;
}
.discount-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--surface-2);
    border: 1.5px solid var(--border-str);
    border-radius: var(--r-xs);
    padding: 5px 9px;
}
.discount-wrap input {
    width: 44px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    color: var(--ink);
    text-align: right;
    outline: none;
}
.discount-pct {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
}

.totals-block {
    padding: 12px 14px;
    background: var(--surface-2);
    border-radius: var(--r-sm);
    border: 1.5px solid var(--border);
    margin-bottom: 12px;
}
.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12.5px;
    margin-bottom: 7px;
}
.total-row:last-child {
    margin-bottom: 0;
}
.total-row .lbl {
    color: var(--muted);
    font-weight: 500;
}
.total-row .val {
    color: var(--ink);
    font-weight: 700;
}
.total-row.grand {
    padding-top: 10px;
    border-top: 1.5px solid var(--border-str);
    margin-top: 8px;
    font-size: 14px;
}
.total-row.grand .lbl {
    color: var(--ink);
    font-weight: 800;
    font-size: 13px;
}
.total-row.grand .val {
    font-family: "DM Sans", sans-serif;
    font-size: 19px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.5px;
}

/* Payment methods */
.pay-methods {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    margin-bottom: 12px;
}
.pay-btn {
    height: 36px;
    border-radius: var(--r-xs);
    border: 1.5px solid var(--border-str);
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.16s;
}
.pay-btn:hover {
    border-color: var(--blue-light);
    color: var(--blue);
    background: var(--blue-pale);
}
.pay-btn.active {
    border-color: var(--blue);
    background: var(--blue-pale);
    color: var(--blue);
    box-shadow: 0 0 0 2px var(--blue-glow);
}

.btn-charge {
    width: 100%;
    height: 50px;
    border-radius: var(--r-sm);
    border: none;
    background: linear-gradient(135deg, #2563eb, #1e3a8a);
    color: #fff;
    font-family: "DM Sans", sans-serif;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: -0.3px;
    transition: all 0.2s;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.32);
}
.btn-charge:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(37, 99, 235, 0.42);
}

/* ── RECEIPT MODAL ──────────────────────────────────────────── */
.receipt-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s;
}
.receipt-overlay.open {
    opacity: 1;
    pointer-events: all;
}
.receipt-modal {
    background: var(--surface);
    border-radius: 24px;
    padding: 36px;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    text-align: center;
    transform: scale(0.9) translateY(12px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.receipt-overlay.open .receipt-modal {
    transform: scale(1) translateY(0);
}
.receipt-icon {
    width: 72px;
    height: 72px;
    background: var(--green-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    color: var(--green);
}
.receipt-title {
    font-family: "DM Sans", sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 4px;
}
.receipt-sub {
    font-size: 13.5px;
    color: var(--muted);
    font-weight: 500;
    margin-bottom: 20px;
}
.receipt-amount {
    font-family: "DM Sans", sans-serif;
    font-size: 46px;
    font-weight: 800;
    color: var(--blue);
    letter-spacing: -2px;
    margin-bottom: 6px;
}
.receipt-meta {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 28px;
}
.receipt-btns {
    display: flex;
    gap: 10px;
}
.receipt-btn {
    flex: 1;
    height: 46px;
    border-radius: var(--r-md);
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    transition: all 0.18s;
}
.receipt-btn-outline {
    background: var(--surface-2);
    border: 1.5px solid var(--border-str);
    color: var(--ink-mid);
}
.receipt-btn-primary {
    background: linear-gradient(135deg, #2563eb, #1e3a8a);
    color: #fff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

/* ── DASHBOARD SPECIFICS ────────────────────────────────────── */
.hero-banner {
    position: relative;
    border-radius: var(--r-lg);
    overflow: hidden;
    height: 180px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}
.hero-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(11, 20, 55, 0.85),
        rgba(37, 99, 235, 0.5)
    );
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 24px;
}
.hero-title {
    font-family: "DM Sans", sans-serif;
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.7px;
}
.hero-sub {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.68);
    margin-top: 4px;
}
.hero-cta {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    padding: 10px 20px;
    border-radius: var(--r-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.hero-cta:hover {
    background: rgba(255, 255, 255, 0.25);
}

.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.dash-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}
.dash-card-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.dash-card-title {
    font-family: "DM Sans", sans-serif;
    font-size: 14.5px;
    font-weight: 800;
    color: var(--ink);
}
.dash-card-body {
    padding: 18px 20px;
}

/* ── LOGIN ──────────────────────────────────────────────────── */
.login-shell {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, #0b1437 0%, #1e3a8a 100%);
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 26px;
    padding: 44px 40px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.3);
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 900px) {
    .dash-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 768px) {
    .app {
        border-radius: 0;
        border: none;
        height: 100svh;
    }
    .mobile-menu-btn {
        display: flex;
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .mobile-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.5);
        z-index: 99;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
    }
    .sidebar.mobile-open ~ .mobile-sidebar-backdrop {
        opacity: 1;
        pointer-events: all;
    }
    .sidebar-toggle-btn {
        display: none;
    }
    .page-content {
        padding: 16px;
    }
    .pos-layout {
        flex-direction: column;
    }
    .cart-panel {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
        max-height: 48vh;
    }
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}


/* ══════════════════════════════════════════════════════════════
   AI INTELLIGENCE COMPONENTS v3 — PharmChossy Design System
   ══════════════════════════════════════════════════════════════ */

/* ─── Panel Shell ────────────────────────────────────────────── */
.ai-panel {
    position: relative;
    background: var(--surface);
    border-radius: var(--r-lg);
    margin-bottom: 16px;
    overflow: visible;  /* card itself visible so body expands in flow */
    box-shadow:
        0 0 0 1.5px rgba(37,99,235,0.18),
        0 4px 24px rgba(37,99,235,0.08),
        var(--shadow-xs);
}

/* Animated shimmer line at top */
.ai-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        var(--blue) 0%,
        #818cf8 40%,
        var(--blue-light) 70%,
        var(--blue) 100%);
    background-size: 200% 100%;
    animation: ai-shimmer 3s linear infinite;
    z-index: 2;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
}
@keyframes ai-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ─── Header ─────────────────────────────────────────────────── */
.ai-panel-hd {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 18px 13px 16px;
    background: linear-gradient(135deg,
        rgba(37,99,235,0.04) 0%,
        rgba(99,102,241,0.03) 100%);
    border: none;
    border-bottom: 1px solid rgba(37,99,235,0.1);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.18s;
    position: relative;
    z-index: 1;
}
.ai-panel-hd:hover {
    background: linear-gradient(135deg,
        rgba(37,99,235,0.07) 0%,
        rgba(99,102,241,0.05) 100%);
}
/* When CLOSED hide the bottom border */
.ai-panel:not(.ai-open) .ai-panel-hd {
    border-bottom-color: transparent;
}

.ai-panel-hd-left {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

/* AI spark icon badge */
.ai-panel-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(37,99,235,0.35);
}

.ai-panel-label {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.ai-panel-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.1px;
    white-space: nowrap;
}
.ai-panel-sub {
    font-size: 10.5px;
    color: var(--muted);
    font-weight: 500;
    margin-top: 1px;
}

/* Badge pills in header */
.ai-badges {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}
.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 21px;
    padding: 0 8px;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.1px;
}
.ai-badge--red    { background: var(--red-bg);    color: var(--red);    border: 1px solid rgba(239,68,68,0.2);    }
.ai-badge--green  { background: var(--green-bg);  color: var(--green);  border: 1px solid rgba(16,185,129,0.2);  }
.ai-badge--amber  { background: var(--amber-bg);  color: var(--amber);  border: 1px solid rgba(245,158,11,0.2);  }
.ai-badge--blue   { background: var(--blue-pale); color: var(--blue);   border: 1px solid rgba(37,99,235,0.15);  }

/* Chevron toggle */
.ai-panel-chevron {
    display: flex;
    align-items: center;
    color: var(--muted);
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1),
                color 0.18s;
}
.ai-panel:not(.ai-open) .ai-panel-chevron {
    transform: rotate(0deg);
}
.ai-panel.ai-open .ai-panel-chevron {
    transform: rotate(180deg);
    color: var(--blue);
}

/* ─── Body ───────────────────────────────────────────────────── */
.ai-panel-body {
    display: none;
    overflow: hidden;
    border-top: 1px solid rgba(37,99,235,0.1);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.ai-panel.ai-open .ai-panel-body {
    display: block;
    animation: ai-body-in 0.22s ease;
}
@keyframes ai-body-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ai-panel-body-inner {
    padding: 12px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ─── Alert / insight rows ───────────────────────────────────── */
.ai-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    font-size: 12.5px;
    line-height: 1.55;
    transition: transform 0.15s;
}
.ai-row:hover {
    transform: translateX(2px);
}
.ai-row--alert {
    background: rgba(239,68,68,0.05);
    border: 1px solid rgba(239,68,68,0.15);
}
.ai-row--insight {
    background: rgba(37,99,235,0.04);
    border: 1px solid rgba(37,99,235,0.1);
}

.ai-row-dot {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}
.ai-row-dot--red   { background: rgba(239,68,68,0.12);  color: var(--red);   }
.ai-row-dot--blue  { background: rgba(37,99,235,0.1);   color: var(--blue);  }
.ai-row-dot--green { background: rgba(16,185,129,0.12); color: var(--green); }
.ai-row-dot--amber { background: rgba(245,158,11,0.12); color: var(--amber); }

.ai-row-text {
    flex: 1;
    color: var(--ink-soft);
    font-weight: 500;
}
.ai-row--alert .ai-row-text { color: #7f1d1d; }

/* ─── Score bar (dashboard) ──────────────────────────────────── */
.ai-score-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--surface-2);
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    margin-bottom: 4px;
}
.ai-score-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.ai-score-bar-wrap {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.ai-score-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.6s ease;
}
.ai-score-bar-fill--green { background: linear-gradient(90deg,#10b981,#34d399); }
.ai-score-bar-fill--amber { background: linear-gradient(90deg,#f59e0b,#fbbf24); }
.ai-score-bar-fill--red   { background: linear-gradient(90deg,#ef4444,#f87171); }
.ai-score-num {
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

/* ─── Restock table panel ────────────────────────────────────── */
.ai-restock-panel {
    background: var(--surface);
    border-radius: var(--r-lg);
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow:
        0 0 0 1.5px rgba(245,158,11,0.2),
        0 4px 20px rgba(245,158,11,0.07),
        var(--shadow-xs);
    position: relative;
}
.ai-restock-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, #f59e0b, #fbbf24, #f59e0b);
    background-size: 200% 100%;
    animation: ai-shimmer 3s linear infinite;
    z-index: 2;
}
.ai-restock-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: linear-gradient(135deg,rgba(245,158,11,0.06),rgba(251,191,36,0.03));
    border-bottom: 1px solid rgba(245,158,11,0.15);
}
.ai-restock-hd-left {
    display: flex;
    align-items: center;
    gap: 9px;
}
.ai-restock-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: 9px;
    background: linear-gradient(135deg,#f59e0b,#d97706);
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(245,158,11,0.35);
}
.ai-restock-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--ink);
}
.ai-restock-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px; height: 22px;
    padding: 0 7px;
    background: linear-gradient(135deg,#f59e0b,#d97706);
    color: #fff;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
}

/* Urgency pills */
.urgency-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}
.urgency-pill--critical { background:var(--red-bg);    color:var(--red);    border:1px solid rgba(239,68,68,0.2);    }
.urgency-pill--high     { background:var(--amber-bg);  color:var(--amber);  border:1px solid rgba(245,158,11,0.2);   }
.urgency-pill--medium   { background:var(--blue-pale); color:var(--blue);   border:1px solid rgba(37,99,235,0.15);   }

/* ─── Customer AI profile card ───────────────────────────────── */
.ai-patient-card {
    background: var(--surface);
    border-radius: var(--r-lg);
    margin-bottom: 18px;
    overflow: hidden;
    box-shadow:
        0 0 0 1.5px rgba(37,99,235,0.15),
        0 8px 28px rgba(37,99,235,0.08);
    position: relative;
}
.ai-patient-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, #2563eb, #818cf8, #2563eb);
    background-size: 200% 100%;
    animation: ai-shimmer 3s linear infinite;
    z-index: 2;
}

/* Header strip */
.ai-patient-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px 12px;
    background: linear-gradient(135deg,
        rgba(37,99,235,0.05) 0%,
        rgba(99,102,241,0.04) 100%);
    border-bottom: 1px solid rgba(37,99,235,0.1);
    position: relative;
    z-index: 1;
}
.ai-patient-icon {
    width: 32px; height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    box-shadow: 0 3px 10px rgba(37,99,235,0.35);
    flex-shrink: 0;
}
.ai-patient-header-text {
    flex: 1;
}
.ai-patient-header-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--ink);
}
.ai-patient-header-sub {
    font-size: 10.5px;
    color: var(--muted);
    margin-top: 1px;
}

/* KPI grid */
.ai-patient-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-bottom: 1px solid var(--border);
}
.ai-patient-kpi {
    padding: 14px 16px;
    position: relative;
}
.ai-patient-kpi + .ai-patient-kpi {
    border-left: 1px solid var(--border);
}
.ai-patient-kpi-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 5px;
}
.ai-patient-kpi-value {
    font-size: 18px;
    font-weight: 900;
    color: var(--ink);
    line-height: 1;
    letter-spacing: -0.5px;
}
.ai-patient-kpi-value--green { color: var(--green); }
.ai-patient-kpi-value--red   { color: var(--red);   }
.ai-patient-kpi-value--amber { color: var(--amber); }
.ai-patient-kpi-sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
}

/* Segment badge in KPI */
.ai-segment-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}
.ai-segment-vip      { background:linear-gradient(135deg,#fef3c7,#fde68a); color:#92400e; border:1px solid rgba(245,158,11,0.3); }
.ai-segment-loyal    { background:linear-gradient(135deg,#ede9fe,#ddd6fe); color:#5b21b6; border:1px solid rgba(124,58,237,0.25); }
.ai-segment-returning{ background:linear-gradient(135deg,#ecfdf5,#d1fae5); color:#065f46; border:1px solid rgba(16,185,129,0.2); }
.ai-segment-new      { background:var(--blue-pale); color:var(--blue); border:1px solid rgba(37,99,235,0.15); }

/* Churn risk bar */
.ai-churn-section {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.ai-churn-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 7px;
}
.ai-churn-label {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ai-churn-pct {
    font-size: 12px;
    font-weight: 800;
}
.ai-churn-track {
    height: 7px;
    background: var(--surface-3);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.ai-churn-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.7s cubic-bezier(0.4,0,0.2,1);
}
.ai-churn-fill--low    { background: linear-gradient(90deg,#10b981,#34d399); }
.ai-churn-fill--medium { background: linear-gradient(90deg,#f59e0b,#fbbf24); }
.ai-churn-fill--high   { background: linear-gradient(90deg,#ef4444,#f87171); }

/* Insight rows inside patient card */
.ai-patient-rows {
    padding: 10px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* ─── POS inline suggestions ──────────────────────────────────── */
.ai-pos-wrap {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.ai-pos-warning {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 11px;
    background: rgba(239,68,68,0.05);
    border: 1px solid rgba(239,68,68,0.18);
    border-radius: var(--r-sm);
    font-size: 12px;
    color: var(--ink-mid);
}
.ai-pos-discount {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 11px;
    background: rgba(16,185,129,0.05);
    border: 1px solid rgba(16,185,129,0.18);
    border-radius: var(--r-sm);
    font-size: 12px;
    color: var(--ink-mid);
}
.ai-pos-heading {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--blue);
    padding: 4px 0 2px;
}
.ai-pos-suggestion {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    font-size: 12px;
    color: var(--ink-soft);
    transition: background 0.15s, border-color 0.15s;
    cursor: default;
}
.ai-pos-suggestion:hover {
    background: var(--blue-pale);
    border-color: rgba(37,99,235,0.2);
}
.ai-pos-suggestion-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    border-radius: 7px;
    background: var(--blue-pale);
    color: var(--blue);
    flex-shrink: 0;
}
.ai-pos-suggestion-body { flex: 1; min-width: 0; }
.ai-pos-suggestion-name  { font-weight: 700; color: var(--ink); font-size: 12.5px; }
.ai-pos-suggestion-reason{ font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.ai-pos-price { font-weight: 800; color: var(--ink); font-size: 13px; white-space: nowrap; }

/* ══════════════════════════════════════════════════════════════
   AI PATIENT LIST PANEL (apl-*) — PharmChossy v3
   ══════════════════════════════════════════════════════════════ */

.apl-card {
    position: relative;
    background: var(--surface);
    border-radius: var(--r-lg);
    margin-bottom: 16px;
    overflow: visible;
    box-shadow:
        0 0 0 1.5px rgba(37,99,235,0.14),
        0 4px 20px rgba(37,99,235,0.07);
}

/* Shimmer top line */
.apl-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, #2563eb 0%, #818cf8 45%, #2563eb 100%);
    background-size: 200% 100%;
    animation: ai-shimmer 3s linear infinite;
    z-index: 3;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
}

/* ── Header ─────────────────────────────────────────────────── */
.apl-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s;
    position: relative;
    z-index: 1;
}
.apl-header:hover {
    background: rgba(37,99,235,0.03);
}

.apl-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* AI spark icon */
.apl-icon {
    width: 32px; height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(37,99,235,0.3);
}

.apl-title-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.apl-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--ink);
    white-space: nowrap;
    letter-spacing: -0.1px;
}
.apl-subtitle {
    font-size: 10.5px;
    color: var(--muted);
    font-weight: 500;
    white-space: nowrap;
}

/* ── KPI pill strip in header (always visible) ───────────────── */
.apl-kpi-strip {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    flex-wrap: wrap;
}

.apl-kpi-pill {
    display: flex;
    align-items: baseline;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    transition: background 0.15s;
}
.apl-kpi-pill--green { background: var(--green-bg);  border-color: rgba(16,185,129,0.2);  }
.apl-kpi-pill--red   { background: var(--red-bg);    border-color: rgba(239,68,68,0.2);   }
.apl-kpi-pill--blue  { background: var(--blue-pale); border-color: rgba(37,99,235,0.15);  }
.apl-kpi-pill--amber { background: var(--amber-bg);  border-color: rgba(245,158,11,0.2);  }

.apl-kpi-num {
    font-size: 13px;
    font-weight: 900;
    color: var(--ink);
    line-height: 1;
}
.apl-kpi-pill--green .apl-kpi-num { color: var(--green); }
.apl-kpi-pill--red   .apl-kpi-num { color: var(--red);   }
.apl-kpi-pill--blue  .apl-kpi-num { color: var(--blue);  }
.apl-kpi-pill--amber .apl-kpi-num { color: var(--amber); }

.apl-kpi-lbl {
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ── Right side controls ─────────────────────────────────────── */
.apl-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Red alert dot */
.apl-alert-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 0 2px rgba(239,68,68,0.25);
    animation: apl-pulse 2s ease-in-out infinite;
}
@keyframes apl-pulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(239,68,68,0.25); }
    50%       { box-shadow: 0 0 0 5px rgba(239,68,68,0.1); }
}

.apl-chevron {
    display: flex;
    align-items: center;
    color: var(--muted);
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1), color 0.18s;
}
.apl-open .apl-chevron {
    transform: rotate(180deg);
    color: var(--blue);
}

/* ── Collapsible body ────────────────────────────────────────── */
.apl-body {
    display: none;
    overflow: hidden;
    border-top: 1px solid transparent;
    border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.apl-open .apl-body {
    display: block;
    border-top-color: rgba(37,99,235,0.1);
    animation: ai-body-in 0.22s ease;
}

.apl-body-inner {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    background: linear-gradient(180deg,
        rgba(37,99,235,0.025) 0%,
        transparent 100%);
}

/* ── Body KPI grid ───────────────────────────────────────────── */
.apl-body-kpis {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.apl-body-kpi {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 10px 12px;
    text-align: center;
    transition: transform 0.15s, box-shadow 0.15s;
}
.apl-body-kpi:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.apl-body-kpi--green { background: var(--green-bg);  border-color: rgba(16,185,129,0.2);  }
.apl-body-kpi--red   { background: var(--red-bg);    border-color: rgba(239,68,68,0.2);   }
.apl-body-kpi--blue  { background: var(--blue-pale); border-color: rgba(37,99,235,0.15);  }
.apl-body-kpi--amber { background: var(--amber-bg);  border-color: rgba(245,158,11,0.2);  }

.apl-body-kpi-val {
    font-size: 22px;
    font-weight: 900;
    color: var(--ink);
    line-height: 1;
    letter-spacing: -0.5px;
}
.apl-body-kpi--green .apl-body-kpi-val { color: var(--green); }
.apl-body-kpi--red   .apl-body-kpi-val { color: var(--red);   }
.apl-body-kpi--blue  .apl-body-kpi-val { color: var(--blue);  }
.apl-body-kpi--amber .apl-body-kpi-val { color: var(--amber); }

.apl-body-kpi-lbl {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* ── Alert / insight rows in body ────────────────────────────── */
.apl-row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    font-size: 12.5px;
    line-height: 1.55;
    transition: transform 0.12s;
}
.apl-row:hover { transform: translateX(2px); }

.apl-row--alert {
    background: rgba(239,68,68,0.05);
    border: 1px solid rgba(239,68,68,0.15);
}
.apl-row--insight {
    background: rgba(37,99,235,0.04);
    border: 1px solid rgba(37,99,235,0.1);
}

.apl-row-dot {
    width: 22px; height: 22px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}
.apl-row-dot--red  { background: rgba(239,68,68,0.12);  color: var(--red);  }
.apl-row-dot--blue { background: rgba(37,99,235,0.1);   color: var(--blue); }

.apl-row-text {
    flex: 1;
    color: var(--ink-soft);
    font-weight: 500;
}
.apl-row--alert .apl-row-text { color: #7f1d1d; }

/* ══════════════════════════════════════════════════════════════
   SELLRITHM v3 — PREMIUM VISUAL UPGRADE
   More depth · Glass cards · Animated accents · Pro tables
   ══════════════════════════════════════════════════════════════ */

/* ── Enhanced Variables ──────────────────────────────────────── */
:root {
    --glass: rgba(255,255,255,0.72);
    --glass-border: rgba(255,255,255,0.5);
    --gradient-blue: linear-gradient(135deg,#2563eb 0%,#1d4ed8 50%,#1e40af 100%);
    --gradient-green: linear-gradient(135deg,#10b981 0%,#059669 100%);
    --gradient-amber: linear-gradient(135deg,#f59e0b 0%,#d97706 100%);
    --gradient-red: linear-gradient(135deg,#ef4444 0%,#dc2626 100%);
    --gradient-purple: linear-gradient(135deg,#7c3aed 0%,#6d28d9 100%);
    --gradient-surface: linear-gradient(135deg,#ffffff 0%,#f8faff 100%);
    --glow-blue: 0 8px 32px rgba(37,99,235,0.22);
    --glow-green: 0 8px 32px rgba(16,185,129,0.22);
    --glow-amber: 0 8px 32px rgba(245,158,11,0.22);
}

/* ── BODY — premium blue-tinted background ───────────────────── */
body {
    background: radial-gradient(ellipse 120% 80% at 10% 0%, rgba(37,99,235,0.06) 0%, transparent 60%),
                radial-gradient(ellipse 80% 60% at 90% 100%, rgba(124,58,237,0.04) 0%, transparent 60%),
                #eef2ff;
}

/* ── APP SHELL — premium border + glow ──────────────────────── */
.app {
    border: 2px solid rgba(37,99,235,0.18) !important;
    box-shadow:
        0 32px 100px rgba(11,20,55,0.28),
        0 0 0 1px rgba(255,255,255,0.6) inset,
        0 -1px 0 rgba(37,99,235,0.1) inset !important;
}

/* ── TOPBAR — frosted glass upgrade ─────────────────────────── */
.topbar {
    background: rgba(255,255,255,0.88) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-bottom: 1px solid rgba(37,99,235,0.1) !important;
    box-shadow: 0 1px 0 rgba(37,99,235,0.06), 0 4px 20px rgba(15,23,42,0.04) !important;
}

.topbar-title {
    font-size: 16px !important;
    font-weight: 900 !important;
    letter-spacing: -0.4px !important;
    background: linear-gradient(135deg, var(--ink) 0%, var(--navy-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── STAT CARDS — premium glass cards ───────────────────────── */
.stat-card {
    background: var(--gradient-surface) !important;
    border: 1.5px solid rgba(37,99,235,0.1) !important;
    border-radius: 18px !important;
    padding: 22px 24px !important;
    box-shadow: var(--shadow-xs), 0 0 0 1px rgba(255,255,255,0.8) inset !important;
    transition: all 0.24s cubic-bezier(0.4,0,0.2,1) !important;
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 80px;
    background: radial-gradient(circle, rgba(37,99,235,0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
.stat-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: var(--glow-blue), var(--shadow-sm), 0 0 0 1px rgba(37,99,235,0.15) !important;
    border-color: rgba(37,99,235,0.2) !important;
}
.stat-card::before {
    height: 3px !important;
    background: var(--gradient-blue) !important;
    opacity: 0;
    transition: opacity 0.24s;
}
.stat-card:hover::before { opacity: 1 !important; }

.stat-icon {
    width: 46px !important;
    height: 46px !important;
    border-radius: 13px !important;
    margin-bottom: 14px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
}
.stat-icon-blue  { background: linear-gradient(135deg,#eff6ff,#dbeafe) !important; color: var(--blue) !important; }
.stat-icon-green { background: linear-gradient(135deg,#ecfdf5,#d1fae5) !important; color: var(--green) !important; }
.stat-icon-amber { background: linear-gradient(135deg,#fffbeb,#fef3c7) !important; color: var(--amber) !important; }
.stat-icon-red   { background: linear-gradient(135deg,#fef2f2,#fee2e2) !important; color: var(--red) !important; }

.stat-value {
    font-size: 30px !important;
    font-weight: 900 !important;
    letter-spacing: -1.5px !important;
    background: linear-gradient(135deg, var(--ink) 0%, var(--ink-mid) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-label {
    font-size: 10.5px !important;
    letter-spacing: 0.9px !important;
    margin-bottom: 8px !important;
}

/* ── TABLE CARD — premium surface ────────────────────────────── */
.table-card {
    background: var(--surface) !important;
    border: 1.5px solid rgba(37,99,235,0.1) !important;
    border-radius: 18px !important;
    box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255,255,255,0.9) inset !important;
    overflow: hidden;
}

.data-table th {
    background: linear-gradient(180deg,#f8faff 0%,#f0f4ff 100%) !important;
    padding: 12px 20px !important;
    font-size: 10.5px !important;
    letter-spacing: 0.9px !important;
    color: var(--ink-soft) !important;
    border-bottom: 1.5px solid rgba(37,99,235,0.1) !important;
}
.data-table td {
    padding: 14px 20px !important;
    font-size: 13px !important;
    border-bottom: 1px solid rgba(37,99,235,0.06) !important;
}
.data-table tbody tr {
    transition: background 0.15s, transform 0.15s;
}
.data-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(37,99,235,0.03) 0%, rgba(37,99,235,0.01) 100%) !important;
}
.data-table tbody tr:last-child td { border-bottom: none !important; }

/* Row highlight stripe */
.data-table tbody tr:nth-child(even) {
    background: rgba(240,244,255,0.4);
}
.data-table tbody tr:nth-child(even):hover {
    background: linear-gradient(90deg, rgba(37,99,235,0.04) 0%, rgba(37,99,235,0.02) 100%) !important;
}

/* ── PROD CELL — enhanced medicine pill ─────────────────────── */
.prod-img {
    width: 44px !important;
    height: 44px !important;
    border-radius: 12px !important;
    border: 2px solid rgba(37,99,235,0.1) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
}
.prod-name {
    font-size: 13.5px !important;
    font-weight: 800 !important;
    color: var(--ink) !important;
}

/* ── BADGES — pill upgrade ───────────────────────────────────── */
.badge {
    font-size: 10.5px !important;
    font-weight: 800 !important;
    padding: 3px 10px 3px 8px !important;
    border-radius: 20px !important;
    letter-spacing: 0.1px !important;
}
.badge-green { border: 1px solid rgba(16,185,129,0.2) !important; }
.badge-red   { border: 1px solid rgba(239,68,68,0.2) !important; }
.badge-blue  { border: 1px solid rgba(37,99,235,0.15) !important; }
.badge-amber { border: 1px solid rgba(245,158,11,0.2) !important; }
.badge-purple{ border: 1px solid rgba(124,58,237,0.2) !important; }

/* ── ACTION BUTTONS — polished ───────────────────────────────── */
.act-btn {
    width: 32px !important;
    height: 32px !important;
    border-radius: 9px !important;
    border: 1.5px solid rgba(37,99,235,0.12) !important;
    background: var(--surface-2) !important;
    transition: all 0.18s cubic-bezier(0.4,0,0.2,1) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
}
.act-btn:hover {
    background: var(--blue-pale) !important;
    border-color: rgba(37,99,235,0.25) !important;
    color: var(--blue) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(37,99,235,0.16) !important;
}
.act-btn.danger:hover {
    background: var(--red-bg) !important;
    border-color: rgba(239,68,68,0.3) !important;
    color: var(--red) !important;
    box-shadow: 0 4px 12px rgba(239,68,68,0.16) !important;
}

/* ── BUTTONS — premium ───────────────────────────────────────── */
.tbtn-primary {
    background: var(--gradient-blue) !important;
    box-shadow: 0 4px 14px rgba(37,99,235,0.3) !important;
    border: none !important;
    transition: all 0.2s cubic-bezier(0.4,0,0.2,1) !important;
}
.tbtn-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 22px rgba(37,99,235,0.4) !important;
    background: linear-gradient(135deg,#1d4ed8 0%,#1e40af 100%) !important;
}
.tbtn-ghost {
    background: rgba(255,255,255,0.8) !important;
    border: 1.5px solid rgba(37,99,235,0.14) !important;
    backdrop-filter: blur(4px) !important;
    transition: all 0.18s !important;
}
.tbtn-ghost:hover {
    background: var(--blue-pale) !important;
    border-color: rgba(37,99,235,0.28) !important;
    color: var(--blue) !important;
}

/* ── SEARCH WRAP — polished ──────────────────────────────────── */
.search-wrap {
    background: var(--surface) !important;
    border: 1.5px solid rgba(37,99,235,0.14) !important;
    border-radius: 10px !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04) !important;
    transition: all 0.2s !important;
}
.search-wrap:focus-within {
    border-color: var(--blue) !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1), 0 2px 8px rgba(37,99,235,0.12) !important;
}

/* ── PAGE HEADER — title upgrade ─────────────────────────────── */
.page-heading {
    font-size: 22px !important;
    font-weight: 900 !important;
    letter-spacing: -0.6px !important;
    background: linear-gradient(135deg,var(--ink) 0%,var(--navy-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.page-sub {
    font-size: 13px !important;
    color: var(--muted) !important;
    margin-top: 3px !important;
    font-weight: 500 !important;
}

/* ── FLASH — premium notifications ──────────────────────────── */
.flash {
    border-radius: 12px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08) !important;
    border: none !important;
    font-weight: 600 !important;
}
.flash-success {
    background: linear-gradient(135deg,#ecfdf5,#d1fae5) !important;
    color: #065f46 !important;
    border-left: 4px solid var(--green) !important;
    box-shadow: 0 4px 16px rgba(16,185,129,0.12) !important;
}
.flash-error {
    background: linear-gradient(135deg,#fef2f2,#fee2e2) !important;
    color: #991b1b !important;
    border-left: 4px solid var(--red) !important;
    box-shadow: 0 4px 16px rgba(239,68,68,0.12) !important;
}

/* ── FORM CARD — elevated surface ────────────────────────────── */
.form-card {
    background: var(--gradient-surface) !important;
    border: 1.5px solid rgba(37,99,235,0.1) !important;
    border-radius: 18px !important;
    box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255,255,255,0.9) inset !important;
}
.form-control {
    background: var(--surface) !important;
    border: 1.5px solid rgba(37,99,235,0.14) !important;
    border-radius: 10px !important;
    transition: all 0.2s !important;
    font-size: 13.5px !important;
}
.form-control:focus {
    border-color: var(--blue) !important;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1) !important;
    background: #fff !important;
    outline: none !important;
}
.form-label {
    font-size: 11px !important;
    font-weight: 800 !important;
    color: var(--ink-soft) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.7px !important;
}

/* ── DASHBOARD — hero banner upgrade ────────────────────────── */
.hero-banner {
    border-radius: 20px !important;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: 0 12px 40px rgba(11,20,55,0.18) !important;
    position: relative;
}
.hero-banner img {
    height: 180px !important;
    object-fit: cover;
}
.hero-overlay {
    background: linear-gradient(135deg,rgba(11,20,55,0.88) 0%,rgba(37,99,235,0.65) 60%,rgba(124,58,237,0.4) 100%) !important;
}
.hero-title {
    font-size: 26px !important;
    font-weight: 900 !important;
    letter-spacing: -0.8px !important;
}
.hero-cta {
    background: rgba(255,255,255,0.15) !important;
    backdrop-filter: blur(10px) !important;
    border: 1.5px solid rgba(255,255,255,0.3) !important;
    border-radius: 12px !important;
    transition: all 0.2s !important;
}
.hero-cta:hover {
    background: rgba(255,255,255,0.25) !important;
    transform: translateY(-2px) !important;
}

/* ── DASH CARDS ──────────────────────────────────────────────── */
.dash-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 20px !important;
    margin-bottom: 24px !important;
}
.dash-card {
    background: var(--gradient-surface) !important;
    border: 1.5px solid rgba(37,99,235,0.1) !important;
    border-radius: 18px !important;
    box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255,255,255,0.9) inset !important;
    overflow: hidden;
}
.dash-card-head {
    padding: 18px 22px !important;
    border-bottom: 1px solid rgba(37,99,235,0.08) !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg,rgba(248,250,255,0.8) 0%,rgba(240,244,255,0.4) 100%) !important;
}
.dash-card-title {
    font-size: 13.5px !important;
    font-weight: 800 !important;
    color: var(--ink) !important;
    display: flex;
    align-items: center;
    gap: 7px;
}
.dash-card-body {
    padding: 18px 22px !important;
}

/* ── PAGE CONTENT — subtle grid bg ──────────────────────────── */
.page-content {
    background:
        radial-gradient(circle at 20% 20%, rgba(37,99,235,0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(124,58,237,0.02) 0%, transparent 50%),
        var(--bg) !important;
}

/* ── STOCK BADGES — richer ───────────────────────────────────── */
.stock-badge { font-weight: 800 !important; letter-spacing: 0.1px !important; }
.stock-ok  { border: 1px solid rgba(16,185,129,0.2) !important; }
.stock-low { border: 1px solid rgba(245,158,11,0.2) !important; }
.stock-out { border: 1px solid rgba(239,68,68,0.2) !important; }

/* ── SIDEBAR — additional polish ─────────────────────────────── */
.nav-item.active {
    box-shadow: inset 3px 0 0 var(--blue), 0 2px 12px rgba(37,99,235,0.18) !important;
}
.nav-item {
    transition: all 0.18s cubic-bezier(0.4,0,0.2,1) !important;
}

/* ── INVENTORY RESTOCK TABLE ────────────────────────────────── */
.ai-restock-panel .data-table tbody tr:hover {
    background: rgba(245,158,11,0.05) !important;
}

/* ── PAGINATION ──────────────────────────────────────────────── */
nav[aria-label] span[aria-current] span,
nav[aria-label] span[aria-current] {
    background: var(--gradient-blue) !important;
    color: #fff !important;
    border-color: var(--blue) !important;
    box-shadow: 0 4px 10px rgba(37,99,235,0.28) !important;
    border-radius: 8px !important;
}
nav[aria-label] a,
nav[aria-label] span:not([aria-current]) span {
    border-radius: 8px !important;
    border-color: rgba(37,99,235,0.15) !important;
    transition: all 0.16s !important;
}
nav[aria-label] a:hover {
    background: var(--blue-pale) !important;
    color: var(--blue) !important;
    border-color: rgba(37,99,235,0.3) !important;
}

/* ── CLOCK BLOCK ─────────────────────────────────────────────── */
.clock-time {
    background: linear-gradient(135deg,var(--ink),var(--navy-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── CATEGORY INDEX — tag swatches ──────────────────────────── */
.data-table tbody tr td:first-child > div {
    transition: transform 0.18s !important;
}
.data-table tbody tr:hover td:first-child > div {
    transform: translateX(3px) !important;
}

/* ── SUPPLIERS — company avatar ──────────────────────────────── */
.data-table td .sup-avatar {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg,var(--blue-pale),var(--surface-3));
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 900; color: var(--blue);
    flex-shrink: 0;
    border: 1.5px solid rgba(37,99,235,0.12);
}

/* ── REPORTS — payment method bars ──────────────────────────── */
.pay-bar-track {
    background: linear-gradient(90deg,rgba(37,99,235,0.06),rgba(37,99,235,0.02)) !important;
    border-radius: 8px !important;
}
.pay-bar-fill {
    background: var(--gradient-blue) !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(37,99,235,0.25) !important;
}

/* ── SETTINGS — section title ────────────────────────────────── */
.form-section-title {
    font-size: 15px !important;
    color: var(--ink) !important;
    padding-bottom: 14px !important;
    border-bottom: 2px solid rgba(37,99,235,0.1) !important;
    background: linear-gradient(135deg,var(--ink),var(--navy-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── SCROLL CUSTOMISATION ────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(37,99,235,0.2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(37,99,235,0.4); }

/* ── SELECTION ───────────────────────────────────────────────── */
::selection { background: rgba(37,99,235,0.18); color: var(--ink); }

/* ── KEYFRAMES ───────────────────────────────────────────────── */
@keyframes shimmer-move {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(200%); }
}
@keyframes float-up {
    0%   { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes count-up {
    0%   { opacity: 0; transform: translateY(6px) scale(0.96); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Animate stat values on load */
.stat-value { animation: count-up 0.5s cubic-bezier(0.4,0,0.2,1) both; }
.stat-card:nth-child(1) .stat-value { animation-delay: 0.05s; }
.stat-card:nth-child(2) .stat-value { animation-delay: 0.1s; }
.stat-card:nth-child(3) .stat-value { animation-delay: 0.15s; }
.stat-card:nth-child(4) .stat-value { animation-delay: 0.2s; }

/* Table rows animate in */
.data-table tbody tr {
    animation: float-up 0.3s ease both;
}
.data-table tbody tr:nth-child(1)  { animation-delay: 0.04s; }
.data-table tbody tr:nth-child(2)  { animation-delay: 0.07s; }
.data-table tbody tr:nth-child(3)  { animation-delay: 0.10s; }
.data-table tbody tr:nth-child(4)  { animation-delay: 0.13s; }
.data-table tbody tr:nth-child(5)  { animation-delay: 0.16s; }
.data-table tbody tr:nth-child(6)  { animation-delay: 0.19s; }
.data-table tbody tr:nth-child(7)  { animation-delay: 0.22s; }
.data-table tbody tr:nth-child(8)  { animation-delay: 0.25s; }
.data-table tbody tr:nth-child(9)  { animation-delay: 0.28s; }
.data-table tbody tr:nth-child(10) { animation-delay: 0.30s; }

/* ── TABLE CARD HEADER  ──────────────────────────────────────── */
.table-card-header {
    background: linear-gradient(180deg,#f8faff 0%,#f2f6ff 100%) !important;
    border-bottom: 1.5px solid rgba(37,99,235,0.1) !important;
    padding: 16px 22px !important;
}
.table-card-title {
    font-size: 14px !important;
    font-weight: 900 !important;
    letter-spacing: -0.2px !important;
}

/* ── FORM ACTIONS ────────────────────────────────────────────── */
.form-actions {
    padding-top: 18px !important;
    border-top: 1.5px solid rgba(37,99,235,0.08) !important;
    margin-top: 18px !important;
}

/* ── INPUT ICONS POLISH ──────────────────────────────────────── */
.search-wrap input {
    font-size: 13.5px !important;
    font-weight: 500 !important;
}
.search-wrap input::placeholder {
    color: var(--muted) !important;
    font-weight: 400 !important;
}

/* ── EMPTY STATES ────────────────────────────────────────────── */
.data-table td[colspan] {
    padding: 56px !important;
    text-align: center;
}
.data-table td[colspan] svg {
    margin: 0 auto 14px;
    display: block;
    opacity: 0.3;
}

/* ── PAGE CONTENT PADDING ────────────────────────────────────── */
.page-content {
    padding: 24px 28px !important;
}

/* ── CATEGORY TABLE — icon fix ───────────────────────────────── */
.cat-icon-swatch {
    width: 40px; height: 40px;
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1.5px solid rgba(37,99,235,0.12);
    background: var(--blue-pale);
    color: var(--blue);
    transition: transform 0.2s;
}
.data-table tbody tr:hover .cat-icon-swatch {
    transform: scale(1.08);
}

/* ── PATIENT AVATAR ──────────────────────────────────────────── */
.patient-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 900;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 2px solid rgba(255,255,255,0.8);
}

/* ── INVENTORY LOG TABLE ─────────────────────────────────────── */
.log-type-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 20px;
    font-size: 10.5px; font-weight: 800;
}
.log-type-sale     { background:var(--blue-pale); color:var(--blue); border:1px solid rgba(37,99,235,0.15); }
.log-type-purchase { background:var(--green-bg);  color:var(--green); border:1px solid rgba(16,185,129,0.2); }
.log-type-adjustment { background:var(--amber-bg);color:var(--amber); border:1px solid rgba(245,158,11,0.2); }

/* ── MOBILE RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .dash-grid  { grid-template-columns: 1fr !important; }
}
@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr !important; }
    .page-content { padding: 16px !important; }
}
