:root {
    --ink: #1f2328;
    --muted: #69707a;
    --line: #e8dde4;
    --gold: #c3922e;
    --gold-soft: #fff6df;
    --rose: #8e315b;
    --mint: #dff3ea;
    --panel: #fffdf9;
    --sidebar: #221a20;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #f7f3ee;
    color: var(--ink);
    font-family: Inter, Segoe UI, system-ui, -apple-system, sans-serif;
}

.app-shell {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: #20171d;
    color: #fff;
    padding: 22px 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(242, 199, 91, .48) rgba(255, 255, 255, .06);
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, .05);
    border-radius: 999px;
}

.sidebar::-webkit-scrollbar-thumb {
    border: 2px solid #20171d;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(248, 215, 125, .72), rgba(195, 146, 46, .48));
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(248, 215, 125, .9), rgba(195, 146, 46, .66));
}

.sidebar-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    color: #fff;
    text-decoration: none;
    padding: 8px 10px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    margin-bottom: 12px;
}

.brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8d77d, #c3922e);
    color: #3b2510;
    overflow: hidden;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand strong,
.brand small {
    display: block;
    line-height: 1.2;
}

.brand small {
    color: #dccfba;
    font-size: 12px;
    margin-top: 3px;
}

.sidebar-close,
.mobile-menu-toggle {
    display: none;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: #2a2028;
}

.sidebar-close {
    width: 38px;
    height: 38px;
    place-items: center;
    flex: 0 0 38px;
}

.mobile-menu-toggle {
    width: 42px;
    height: 42px;
    place-items: center;
    flex: 0 0 42px;
    color: #fff;
    border-color: #8e315b;
    background: #8e315b;
}

.sidebar-backdrop {
    display: none;
}

.sidebar-search {
    position: relative;
    margin: 0 0 12px;
}

.sidebar-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    color: #cfbfae;
    font-size: 13px;
    transform: translateY(-50%);
    pointer-events: none;
}

.sidebar-search input {
    width: 100%;
    min-height: 40px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 10px;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    padding: 8px 12px 8px 36px;
    font-weight: 650;
    outline: 0;
}

.sidebar-search input::placeholder {
    color: #c8b9ab;
}

.sidebar-search input:focus {
    border-color: rgba(242, 199, 91, .72);
    box-shadow: 0 0 0 .18rem rgba(242, 199, 91, .16);
}

.sidebar-search-empty {
    margin: 8px 8px 12px;
    color: #dccfba;
    font-size: 13px;
    font-weight: 700;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-group {
    margin-top: 10px;
}

.nav-group-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 34px;
    margin: 0 0 2px;
    padding: 7px 10px;
    color: #fff7e3;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.2;
}

.nav-group.account-group {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, .14);
}

.nav-group-title i {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    flex: 0 0 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .08);
    color: #f5d889;
    font-size: 13px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #eaded0;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 2px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, .08);
}

.nav-link.active {
    color: #271810;
    background: #f2c75b;
    box-shadow: inset 3px 0 0 #fff4cf;
}

.nav-link-primary {
    min-height: 42px;
    margin-bottom: 8px;
    color: #fff;
    background: rgba(255, 255, 255, .08);
    font-size: 15px;
}

.nav-link-child {
    position: relative;
    min-height: 32px;
    margin-left: 24px;
    padding-left: 26px;
    font-size: 14px;
    color: #d8cabb;
}

.nav-link-child::before {
    content: "";
    position: absolute;
    left: 8px;
    top: -4px;
    bottom: 50%;
    width: 10px;
    border-left: 1px solid rgba(245, 216, 137, .28);
    border-bottom: 1px solid rgba(245, 216, 137, .28);
    border-bottom-left-radius: 7px;
}

.nav-link-child.active::before {
    border-color: rgba(39, 24, 16, .42);
}

.nav-link i {
    width: 20px;
    text-align: center;
    flex: 0 0 20px;
    font-size: 14px;
}

.nav-link-child i {
    color: #cfbfae;
    font-size: 12px;
}

.nav-link-child.active i {
    color: #271810;
}

.nav-link span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.main-content {
    padding: 28px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.topbar h1 {
    margin: 0;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 0;
}

.topbar-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.eyebrow {
    color: var(--rose);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 700;
}

.stat-card,
.content-card {
    background: rgba(255, 255, 255, .9);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 18px 45px rgba(55, 42, 30, .08);
}

.stat-card {
    padding: 18px;
    min-height: 126px;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -26px;
    top: -30px;
    width: 90px;
    height: 90px;
    background: var(--gold-soft);
    border-radius: 50%;
}

.stat-card .icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--mint);
    color: #1d6b51;
    margin-bottom: 14px;
}

.stat-card h3 {
    font-size: 28px;
    margin: 0;
    font-weight: 850;
}

.stat-card p {
    margin: 0;
    color: var(--muted);
    font-weight: 650;
}

.content-card {
    padding: 22px;
    margin-bottom: 22px;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.section-title h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

.section-subtitle {
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding: 20px 22px;
    border: 1px solid #dfd3da;
    border-radius: 14px;
    background:
        linear-gradient(135deg, rgba(255, 251, 244, .96), rgba(245, 250, 247, .96)),
        linear-gradient(90deg, rgba(142, 49, 91, .12), rgba(195, 146, 46, .14));
    box-shadow: 0 18px 45px rgba(55, 42, 30, .08);
}

.dashboard-hero h2 {
    margin: 0;
    color: #211820;
    font-size: 26px;
    font-weight: 850;
}

.dashboard-hero p:last-child {
    margin: 5px 0 0;
    color: #5f5660;
    font-weight: 650;
}

.dashboard-hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dashboard-layout-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .78);
}

.dashboard-layout-toolbar strong,
.dashboard-layout-toolbar span {
    display: block;
}

.dashboard-layout-toolbar strong {
    color: #201a1f;
    font-size: 15px;
    font-weight: 850;
}

.dashboard-layout-toolbar span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.dashboard-widget-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 22px;
    align-items: start;
}

.dashboard-widget {
    grid-column: span 4;
    margin-bottom: 0;
    min-width: 0;
    transition: border-color .18s ease, box-shadow .18s ease, opacity .18s ease, transform .18s ease;
}

.dashboard-widget-wide {
    grid-column: span 8;
}

.dashboard-widget-compact {
    grid-column: span 4;
}

.dashboard-widget-full {
    grid-column: 1 / -1;
}

.dashboard-widget-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.dashboard-drag-handle {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 34px;
    border: 1px solid #ded3db;
    border-radius: 9px;
    background: #fff;
    color: #6f626b;
    cursor: grab;
}

.dashboard-drag-handle:active {
    cursor: grabbing;
}

.dashboard-widget-dragging {
    opacity: .52;
    transform: scale(.99);
}

.dashboard-widget-over {
    border-color: #c3922e;
    box-shadow: 0 20px 52px rgba(195, 146, 46, .18);
}

.dashboard-kpi {
    border-left: 4px solid #1d6b51;
}

.dashboard-kpi-alt {
    border-left-color: #8e315b;
}

.dashboard-kpi-warm {
    border-left-color: #c3922e;
}

.dashboard-kpi-dark {
    border-left-color: #2a2028;
}

.dashboard-kpi small {
    display: block;
    margin-top: 10px;
    color: #6f626b;
    font-size: 12px;
    font-weight: 750;
}

.dashboard-balance {
    border-top: 4px solid #8e315b;
}

.dashboard-insight-card {
    border-top: 4px solid #c3922e;
}

.dashboard-reminder-card {
    border-top: 4px solid #1d6b51;
}

.dashboard-mini-title {
    margin: 0 0 10px;
    color: #2a2028;
    font-size: 15px;
    font-weight: 850;
}

.dashboard-metric-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.dashboard-metric-strip div {
    padding: 13px 15px;
    border-right: 1px solid var(--line);
}

.dashboard-metric-strip div:last-child {
    border-right: 0;
}

.dashboard-metric-strip span,
.dashboard-metric-strip strong {
    display: block;
}

.dashboard-metric-strip span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.dashboard-metric-strip strong {
    margin-top: 3px;
    color: #201a1f;
    font-size: 19px;
    font-weight: 850;
}

.form-label {
    font-weight: 750;
    color: #3d3640;
}

.form-control,
.form-select {
    border-color: #ded3db;
    border-radius: 10px;
    min-height: 42px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 .2rem rgba(195, 146, 46, .18);
}

.btn-primary {
    --bs-btn-bg: #8e315b;
    --bs-btn-border-color: #8e315b;
    --bs-btn-hover-bg: #75274a;
    --bs-btn-hover-border-color: #75274a;
    border-radius: 10px;
    font-weight: 750;
}

.btn-warning {
    border-radius: 10px;
    font-weight: 750;
}

.table {
    overflow: hidden;
    border-radius: 12px;
}

.table thead th {
    background: #2a2028;
    color: #fff;
    border: 0;
    font-size: 13px;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 20%, rgba(195, 146, 46, .28), transparent 28%),
        linear-gradient(135deg, #211820, #6f2c4b 55%, #c3922e);
}

.login-card {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1fr 420px;
    overflow: hidden;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .28);
}

.login-art {
    min-height: 560px;
    padding: 42px;
    color: #fff;
    background:
        linear-gradient(rgba(24, 18, 21, .52), rgba(24, 18, 21, .74)),
        url("https://images.unsplash.com/photo-1617038260897-41a1f14a8ca0?auto=format&fit=crop&w=1100&q=80") center/cover;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.login-art h1 {
    font-size: 44px;
    line-height: 1.02;
    font-weight: 850;
    margin-bottom: 12px;
}

.login-form {
    padding: 42px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mini-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--line);
}

.stock-image-preview {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.stock-image-preview img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.stock-image-preview.d-none {
    display: none !important;
}

.billing-section {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fffaf0;
    padding: 16px;
}

.addon-section {
    background: #f4fbf7;
}

.customer-section {
    background: #fbf8ff;
}

.quick-customer {
    border-top: 1px dashed #d8cadf;
    padding-top: 14px;
}

.customer-preview {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 10px;
    border: 1px solid #e4d9ea;
    border-radius: 12px;
    background: #fff;
    padding: 12px;
}

.customer-preview div {
    min-width: 0;
}

.customer-preview span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.customer-preview strong {
    display: block;
    overflow-wrap: anywhere;
    font-size: 14px;
}

.bill-line {
    border: 1px solid #eadfcd;
    border-radius: 12px;
    background: #fff;
    padding: 14px;
}

.readymade-line {
    border-color: #d6c4f0;
    background: #fdfbff;
}

.addon-line {
    border-color: #d1e8dc;
}

.bill-line-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.billing-total-panel {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    padding: 16px;
}

.mini-stat {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 14px 16px;
}

.mini-stat span,
.mini-stat strong {
    display: block;
}

.mini-stat span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.mini-stat strong {
    margin-top: 4px;
    font-size: 22px;
    font-weight: 850;
}

.dashboard-chart-box,
.dashboard-suggestions {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 14px 16px;
    min-height: 238px;
}

.dashboard-chart-box h3,
.dashboard-suggestions h3 {
    margin: 0 0 12px;
    color: #3d3640;
    font-size: 15px;
    font-weight: 850;
}

.dashboard-chart-canvas {
    position: relative;
    width: 100%;
    height: 176px;
}

.dashboard-chart-canvas canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.dashboard-suggestions ul {
    margin: 0;
    padding-left: 18px;
}

.dashboard-suggestions li {
    margin-bottom: 9px;
    color: #51464d;
    line-height: 1.35;
    font-weight: 650;
}

.dashboard-bill-list {
    display: grid;
    gap: 9px;
}

.dashboard-reminder-list {
    display: grid;
    gap: 9px;
}

.dashboard-bill-list a,
.dashboard-reminder-list a {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: #201a1f;
    background: #fff;
    text-decoration: none;
}

.dashboard-bill-list a:hover,
.dashboard-reminder-list a:hover {
    border-color: #c3922e;
    background: #fffaf0;
}

.dashboard-bill-list strong,
.dashboard-bill-list small,
.dashboard-reminder-list strong,
.dashboard-reminder-list small {
    display: block;
}

.dashboard-bill-list small,
.dashboard-reminder-list small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.dashboard-action-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
}

.dashboard-action-grid a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 43px;
    padding: 10px 12px;
    border: 1px solid #ded3db;
    border-radius: 10px;
    color: #2a2028;
    background: #fff;
    text-decoration: none;
    font-weight: 800;
}

.dashboard-action-grid a:hover {
    color: #fff;
    border-color: #8e315b;
    background: #8e315b;
}

.dashboard-action-grid i {
    width: 22px;
    text-align: center;
    color: #8e315b;
}

.dashboard-action-grid a:hover i {
    color: #fff;
}

@media (max-width: 992px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .sidebar {
        position: fixed;
        z-index: 1050;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(86vw, 330px);
        height: 100dvh;
        padding: 18px 14px;
        box-shadow: 24px 0 70px rgba(0, 0, 0, .32);
        transform: translateX(-105%);
        transition: transform .24s ease;
        overscroll-behavior: contain;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1040;
        display: block;
        background: rgba(24, 18, 21, .56);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }

    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-close,
    .mobile-menu-toggle {
        display: grid;
    }

    .brand {
        padding-bottom: 14px;
    }

    .brand strong {
        overflow-wrap: anywhere;
    }

    .sidebar-search {
        position: sticky;
        top: -18px;
        z-index: 2;
        margin: 0 -2px 12px;
        padding: 8px 2px;
        background: #20171d;
    }

    .main-content {
        padding: 14px;
    }

    .topbar {
        position: sticky;
        top: 0;
        z-index: 30;
        align-items: center;
        flex-wrap: wrap;
        margin: -14px -14px 18px;
        padding: 12px 14px;
        border-bottom: 1px solid var(--line);
        background: rgba(247, 243, 238, .96);
        backdrop-filter: blur(10px);
    }

    .topbar h1 {
        font-size: 22px;
        line-height: 1.15;
    }

    .topbar .eyebrow {
        font-size: 10px;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }

    .user-pill {
        min-width: 0;
        max-width: calc(100vw - 118px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar-actions .btn {
        flex: 0 0 auto;
    }

    .login-card {
        grid-template-columns: 1fr;
    }

    .login-art {
        min-height: 260px;
    }

    .billing-total-panel {
        grid-template-columns: 1fr;
    }

    .customer-preview {
        grid-template-columns: 1fr;
    }

    .dashboard-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-hero-actions {
        justify-content: flex-start;
    }

    .dashboard-layout-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-widget-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-widget,
    .dashboard-widget-wide,
    .dashboard-widget-compact,
    .dashboard-widget-full {
        grid-column: 1 / -1;
    }

    .dashboard-metric-strip {
        grid-template-columns: 1fr 1fr;
    }

    .dashboard-metric-strip div:nth-child(2) {
        border-right: 0;
    }
}
