:root {
    --sidebar-width: 280px;
    --primary-color: #0d9488;
    --primary-hover: #0f766e;
    --accent-teal: #14967f;
    --sidebar-bg: #06233a;
    --sidebar-bg-2: #08304d;
    --sidebar-text: rgba(255, 255, 255, 0.9);
    --sidebar-muted: rgba(148, 183, 210, 0.65);
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active: #14967f;
    --body-bg: #eef2f6;
    --card-bg: #ffffff;
    --text-color: #0f172a;
    --text-muted: #64748b;
    --border-soft: rgba(15, 23, 42, 0.08);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.04);
    --radius: 0.75rem;
    --font: "Plus Jakarta Sans", "Segoe UI", sans-serif;
}

[data-theme="dark"] {
    --body-bg: #0b1220;
    --card-bg: #142033;
    --text-color: #e2e8f0;
    --text-muted: #94a3b8;
    --border-soft: rgba(255, 255, 255, 0.08);
    --sidebar-bg: #041825;
    --sidebar-bg-2: #062033;
}

* { box-sizing: border-box; }

body {
    background: var(--body-bg);
    color: var(--text-color);
    font-family: var(--font);
    font-size: 0.95rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
    color: var(--sidebar-text);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.18);
    border-radius: 999px;
}

.sidebar-header {
    padding: 1.35rem 1.25rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 0.35rem;
}

.sidebar-brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 30% 30%, #38bdf8, #0369a1 55%, #0c4a6e);
    color: #fff;
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: -0.02em;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18), 0 8px 18px rgba(0, 0, 0, 0.25);
}

.sidebar-brand-text { min-width: 0; }
.sidebar-title {
    display: block;
    color: #fff;
    font-weight: 700;
    font-size: 1.02rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-tagline {
    display: block;
    margin-top: 0.15rem;
    color: var(--sidebar-muted);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.sidebar-menu { padding: 0.55rem 0.75rem 1.75rem; }

.sidebar-section { margin-bottom: 0.55rem; }

.sidebar-section-title {
    padding: 0.85rem 0.85rem 0.4rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sidebar-muted);
}

.sidebar-nav { list-style: none; padding: 0; margin: 0; }

.sidebar-item-main {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 0;
}

.sidebar-item-main .bi {
    font-size: 1.08rem;
    width: 1.2rem;
    text-align: center;
    opacity: 0.92;
}

.sidebar-nav > li > a.sidebar-link,
.sidebar-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.72rem 0.9rem;
    margin: 0.12rem 0;
    color: var(--sidebar-text);
    text-decoration: none;
    background: transparent;
    border: 0;
    border-radius: 0.7rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
    font-size: 0.94rem;
    font-weight: 550;
    font-family: inherit;
}

.sidebar-nav > li > a.sidebar-link:hover,
.sidebar-group-toggle:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav > li > a.sidebar-link.active,
.sidebar-group-toggle.active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: 0 8px 18px rgba(20, 150, 127, 0.28);
}

.sidebar-chevron {
    font-size: 0.75rem;
    opacity: 0.7;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.sidebar-group.open .sidebar-chevron { transform: rotate(180deg); }

.sidebar-submenu {
    list-style: none;
    padding: 0.1rem 0 0.35rem;
    margin: 0;
}

.sidebar-submenu a {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.9rem 0.55rem 2.55rem;
    margin: 0.08rem 0;
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    font-size: 0.88rem;
    border-radius: 0.65rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-submenu a:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-submenu a.active {
    background: rgba(20, 150, 127, 0.28);
    color: #fff;
}

.sidebar-submenu a .bi {
    font-size: 0.95rem;
    width: 1rem;
    text-align: center;
}

/* ── Main ── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    background:
        radial-gradient(1200px 400px at 100% -10%, rgba(13, 148, 136, 0.08), transparent 60%),
        var(--body-bg);
}

.navbar-top {
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(10px);
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-soft);
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 64px;
}

[data-theme="dark"] .navbar-top {
    background: rgba(20, 32, 51, 0.9);
}

.navbar-top .btn-outline-secondary {
    border-color: var(--border-soft);
    color: var(--text-muted);
}

.navbar-top .btn-link {
    color: var(--text-color);
    font-weight: 600;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(13, 148, 136, 0.08);
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.user-chip .bi { color: var(--primary-color); font-size: 1.15rem; }

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius);
}

.card.p-3, .card.p-4 { border-radius: var(--radius); }

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.stat-card { border-left: 4px solid var(--primary-color); }
.stat-card.danger { border-left-color: #dc3545; }
.stat-card.warning { border-left-color: #f59e0b; }
.stat-card.success { border-left-color: #16a34a; }
.stat-card.info { border-left-color: #0ea5e9; }

.table { --bs-table-bg: transparent; }
.table th {
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom-width: 1px;
}

.table-hover > tbody > tr:hover {
    --bs-table-hover-bg: rgba(13, 148, 136, 0.05);
}

.badge.bg-success { background: #14967f !important; }

.auth-body {
    background:
        radial-gradient(900px 420px at 8% 12%, rgba(20, 150, 127, 0.28), transparent 55%),
        linear-gradient(145deg, #041825 0%, #06233a 45%, #0a4a5c 100%);
    min-height: 100vh;
    font-family: var(--font);
}

.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.25rem;
}

.auth-shell {
    width: 100%;
    max-width: 980px;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.35rem;
    overflow: hidden;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.35);
}

.auth-brand-panel {
    padding: 2.4rem 2rem;
    background:
        linear-gradient(160deg, rgba(6, 35, 58, 0.95), rgba(8, 70, 90, 0.88)),
        radial-gradient(500px 240px at 90% 10%, rgba(20, 150, 127, 0.35), transparent 60%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
}

.auth-mark { width: 58px; height: 58px; font-size: 1.15rem; }
.auth-logo-img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 16px;
    background: rgba(255,255,255,0.95);
    padding: 6px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}
.auth-brand-name {
    margin: 1rem 0 0.35rem;
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}
.auth-brand-tagline {
    margin: 0;
    color: rgba(186, 230, 220, 0.88);
    font-size: 0.95rem;
}
.auth-highlights {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.7rem;
}
.auth-highlights li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: rgba(255,255,255,0.88);
    font-weight: 550;
    font-size: 0.92rem;
}
.auth-highlights .bi { color: #5eead4; }

.auth-form-panel {
    background: #f4f7fb;
    padding: 1.6rem 1.5rem 1.75rem;
}

.auth-card-modern {
    background: #fff;
    border-radius: 1.1rem;
    padding: 1.6rem 1.5rem 1.75rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(15, 23, 42, 0.06);
    width: 100%;
    max-width: none;
}

.auth-demo-box {
    background: #fff;
    border: 1px dashed rgba(20, 150, 127, 0.35);
    border-radius: 1rem;
    padding: 0.85rem;
}

.auth-demo-title {
    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #14967f;
    margin-bottom: 0.55rem;
}

.auth-demo-user {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #f8fafc;
    border-radius: 0.75rem;
    padding: 0.65rem 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.auth-demo-user:hover {
    border-color: rgba(20, 150, 127, 0.45);
    background: rgba(20, 150, 127, 0.06);
}

.auth-demo-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(20, 150, 127, 0.12);
    color: #14967f;
    flex-shrink: 0;
}

.auth-demo-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    font-size: 0.82rem;
    line-height: 1.25;
}

.auth-demo-fill {
    font-size: 0.75rem;
    font-weight: 700;
    color: #14967f;
}

.sidebar-logo-img {
    width: 46px;
    height: 46px;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
    padding: 3px;
    flex-shrink: 0;
}

.settings-logo-preview {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: #fff;
    padding: 4px;
}

@media (max-width: 860px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand-panel { padding: 1.6rem 1.35rem 1.25rem; }
    .auth-highlights { display: none; }
}

/* keep legacy auth-card usable */
.auth-card {
    background: #fff;
    border-radius: 1.15rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.pos-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 1rem;
    height: calc(100vh - 120px);
}

.pos-products { overflow-y: auto; }

.pos-cart {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-sm);
}

.pos-cart-items { flex: 1; overflow-y: auto; }

.product-search-item {
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.4rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.product-search-item:last-child { border-bottom: none; }
.product-search-item:hover,
.product-search-item.active { background: rgba(13, 148, 136, 0.12); }

.product-search-dropdown {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.12);
    max-height: 280px;
    overflow-y: auto;
    margin-top: 2px;
}

.purchase-search-float {
    position: fixed;
    z-index: 2000;
    display: none;
}
.purchase-search-float.is-open { display: block; }
.purchase-search-float .product-search-dropdown { margin-top: 0; }

.rx-product-results {
    position: absolute;
    z-index: 30;
    left: 0;
    right: 0;
    top: 100%;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.rx-product-item {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.rx-product-item:hover { background: rgba(13, 148, 136, 0.08); }
.rx-product-item:last-child { border-bottom: none; }

h4, .h4 {
    font-weight: 750;
    letter-spacing: -0.02em;
}

.form-control, .form-select {
    border-radius: 0.55rem;
    border-color: rgba(15, 23, 42, 0.12);
}

.form-control:focus, .form-select:focus {
    border-color: rgba(13, 148, 136, 0.55);
    box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.15);
}

.btn {
    border-radius: 0.55rem;
    font-weight: 600;
}

.alert {
    border: 0;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
}

/* ── Dashboard ── */
.dash-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.15rem 1.25rem;
    border-radius: 1rem;
    background:
        linear-gradient(135deg, rgba(6, 35, 58, 0.96), rgba(8, 70, 90, 0.92)),
        radial-gradient(600px 200px at 90% 0%, rgba(20, 150, 127, 0.45), transparent 55%);
    color: #fff;
    box-shadow: 0 12px 30px rgba(6, 35, 58, 0.18);
}

.dash-hero h4 {
    color: #fff;
    font-weight: 750;
    letter-spacing: -0.02em;
}

.dash-hero .text-muted { color: rgba(226, 240, 250, 0.78) !important; }

.dash-eyebrow {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(148, 220, 205, 0.9);
    margin: 0;
}

.dash-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.dash-quick-actions .btn-outline-secondary {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.dash-quick-actions .btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.28);
    color: #fff;
}

.dash-section-label {
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.dash-kpi {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.05rem 1.15rem;
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-radius: 0.95rem;
    box-shadow: var(--shadow-sm);
    min-height: 104px;
    position: relative;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.dash-kpi::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-color);
}

.dash-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.dash-kpi.is-alert::before { background: #f59e0b; }

.dash-kpi-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 650;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.dash-kpi-value {
    display: block;
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--text-color);
}

.dash-kpi-meta {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.78rem;
    font-weight: 600;
}

.dash-kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 1.25rem;
}

.dash-kpi-icon.teal { background: rgba(20, 150, 127, 0.12); color: #14967f; }
.dash-kpi-icon.blue { background: rgba(14, 165, 233, 0.12); color: #0284c7; }
.dash-kpi-icon.green { background: rgba(22, 163, 74, 0.12); color: #16a34a; }
.dash-kpi-icon.amber { background: rgba(245, 158, 11, 0.14); color: #d97706; }
.dash-kpi-icon.rose { background: rgba(244, 63, 94, 0.12); color: #e11d48; }

.dash-panel {
    border-radius: 1rem;
}

.dash-panel h6 {
    font-weight: 750;
    letter-spacing: -0.01em;
}

.dash-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border-soft);
}

.dash-list-item:last-child { border-bottom: 0; }

.dash-list-name {
    font-weight: 600;
    font-size: 0.92rem;
}

.dash-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
}

.dash-empty .bi {
    font-size: 1.8rem;
    color: #14967f;
    display: block;
    margin-bottom: 0.4rem;
}

/* ── Reports hub ── */
.report-card {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 1.1rem 1.15rem;
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-radius: 0.95rem;
    box-shadow: var(--shadow-sm);
    min-height: 118px;
    height: 100%;
    color: var(--text-color);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

a.dash-kpi {
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
a.dash-kpi:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.09);
    border-color: rgba(20, 150, 127, 0.35);
    color: inherit;
}

.report-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.09);
    border-color: rgba(20, 150, 127, 0.35);
    color: var(--text-color);
}

.report-card .dash-kpi-icon {
    flex-shrink: 0;
}

.report-card-body { min-width: 0; flex: 1; }

.report-card-title {
    margin: 0 0 0.35rem;
    font-weight: 750;
    font-size: 0.98rem;
    letter-spacing: -0.01em;
    color: var(--text-color);
}

.report-card-desc {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.report-card-arrow {
    color: var(--text-muted);
    opacity: 0.45;
    margin-top: 0.2rem;
    flex-shrink: 0;
    transition: transform 0.18s ease, opacity 0.18s ease, color 0.18s ease;
}

.report-card:hover .report-card-arrow {
    opacity: 1;
    color: #14967f;
    transform: translateX(3px);
}

@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); box-shadow: 12px 0 40px rgba(0,0,0,0.3); }
    .main-content { margin-left: 0; }
    .pos-container { grid-template-columns: 1fr; height: auto; }
}
