:root {
    --sidebar-bg: #053f3a;
    --sidebar-bg-light: #0b4f49;
    --primary: #25d366;
    --primary-dark: #11b955;
    --surface: #ffffff;
    --surface-muted: #f6faf8;
    --text: #12312d;
    --muted: #72908a;
    --border: #e5efeb;
    --warning-bg: #fff2df;
    --warning-text: #c98200;
    --danger: #e55656;
}

html, body {
    min-height: 100%;
}

body {
    background: #f4f8f6;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overflow-x: hidden;
}

a {
    text-decoration: none;
}

.sidebar-shell {
    min-height: 100vh;
}

.sidebar {
    width: 265px;
    height: 100vh;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #03342f 100%);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1030;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto 1fr;
}

.sidebar-brand-wrap {
    position: sticky;
    top: 0;
    z-index: 5;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #03342f 100%);
}

.sidebar-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.menu-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
}

.menu-scroll::-webkit-scrollbar {
    width: 8px;
}

.menu-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .22);
    border-radius: 999px;
}

.sidebar-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,.1);
    background: linear-gradient(180deg, rgba(5,63,58,0) 0%, rgba(5,63,58,.82) 24%, rgba(5,63,58,1) 100%);
    position: relative;
    z-index: 1;
}

.brand {
    padding: 28px 24px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(180deg, #31e57e 0%, #17c25b 100%);
    color: #fff;
    font-weight: 700;
    margin-right: 12px;
}

.nav-pills .nav-link {
    color: rgba(255,255,255,.82);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-pills .nav-link.active,
.nav-pills .nav-link:hover {
    color: #fff;
    background: linear-gradient(90deg, #17c55c 0%, #2be671 100%);
    box-shadow: 0 10px 20px rgba(37, 211, 102, .22);
}

.main-area {
    padding: 28px;
    margin-left: 265px;
    width: calc(100% - 265px);
    min-width: 0;
}

.page-card,
.metric-card,
.inventory-card,
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(4, 59, 52, .05);
    min-width: 0;
}

.metric-card {
    padding: 20px;
}

.metric-label {
    color: var(--muted);
    font-size: .92rem;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.soft-alert {
    background: var(--warning-bg);
    color: var(--warning-text);
    border: 1px solid #f5ddb4;
    border-radius: 16px;
    padding: 16px 18px;
}

.inventory-card {
    padding: 18px;
    margin-bottom: 16px;
}

.medicine-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: #edf4f1;
    color: var(--sidebar-bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.pill-tag {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    background: #eef8f1;
    color: #0a7b33;
    font-size: .78rem;
    font-weight: 600;
}

.pill-tag.warning {
    background: #fff0dc;
    color: #c88000;
}

.pill-tag.danger {
    background: #ffe8e8;
    color: #ce3d3d;
}

.stock-pill {
    display: inline-block;
    background: #f4f8f7;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: .82rem;
    font-weight: 600;
    color: #30504a;
    margin: 4px 6px 0 0;
}

.text-success-soft { color: #10a857 !important; }
.text-danger-soft { color: var(--danger) !important; }
.text-muted-soft { color: var(--muted) !important; }

.btn-brand {
    background: linear-gradient(90deg, var(--primary) 0%, #39e576 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 11px 18px;
    font-weight: 600;
}

.btn-brand:hover {
    color: #fff;
    background: linear-gradient(90deg, var(--primary-dark) 0%, #2fd86b 100%);
}

.btn-soft {
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table thead th {
    color: var(--muted);
    font-weight: 600;
    border-bottom-width: 1px;
    white-space: nowrap;
}

.table td {
    word-break: break-word;
}

.form-control, .form-select {
    border-radius: 12px;
    border-color: var(--border);
    padding: .82rem .95rem;
}

.form-control:focus, .form-select:focus {
    border-color: #79d7a0;
    box-shadow: 0 0 0 .2rem rgba(37,211,102,.12);
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, rgba(37,211,102,.15), transparent 30%), #f4f8f6;
}

.login-card {
    width: min(430px, 92vw);
    border-radius: 28px;
    padding: 34px;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: 0 24px 60px rgba(4, 59, 52, .08);
}

.section-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.small-muted {
    font-size: .9rem;
    color: var(--muted);
}

.row > [class*='col-'] {
    min-width: 0;
}

.btn {
    white-space: nowrap;
}

.sticky-top {
    z-index: 10;
}

@media (max-width: 1199px) {
    .sticky-top {
        position: relative !important;
        top: auto !important;
    }
}

@media (max-width: 991px) {
    .sidebar {
        width: 100%;
        height: auto;
        min-height: auto;
        position: relative;
        display: block;
    }

    .sidebar-brand-wrap {
        position: relative;
    }

    .sidebar-body,
    .menu-scroll {
        min-height: auto;
        overflow: visible;
    }

    .sidebar-footer {
        background: transparent;
    }

    .main-area {
        padding: 18px;
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 767px) {
    .main-area {
        padding: 14px;
    }

    .page-card,
    .metric-card,
    .inventory-card,
    .form-card,
    .mini-card,
    .stat-strip {
        border-radius: 16px;
    }

    .metric-value {
        font-size: 1.45rem;
    }

    .brand {
        padding: 20px 16px 14px;
    }
}

.invoice-settings-hero {
    background: linear-gradient(135deg, #ffffff 0%, #f4fbf7 62%, #ebfaf2 100%);
}

.invoice-current-chip-wrap {
    min-width: min(100%, 250px);
}

.invoice-current-chip {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: #fff;
    box-shadow: 0 12px 24px rgba(4, 59, 52, .05);
}

.invoice-current-chip span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eefaf2;
    color: #0a8d48;
    font-weight: 700;
    font-size: .8rem;
}

.settings-stack {
    display: grid;
    gap: 16px;
}

.invoice-settings-note {
    padding: 16px 18px;
    border-radius: 16px;
    background: #f7fbf9;
    border: 1px solid var(--border);
}

.invoice-note-list {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--muted);
}

.invoice-note-list li + li {
    margin-top: 6px;
}

.invoice-help-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #eefaf2;
    color: #0a8d48;
    border: 1px solid #c9ebd5;
    font-weight: 700;
    font-size: .82rem;
}

.invoice-size-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.invoice-radio-card {
    display: block;
    min-width: 0;
}

.invoice-radio-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.invoice-radio-ui {
    display: block;
    height: 100%;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: #fff;
    padding: 18px;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
    box-shadow: 0 8px 22px rgba(4, 59, 52, .04);
    cursor: pointer;
}

.invoice-radio-card:hover .invoice-radio-ui {
    transform: translateY(-2px);
    box-shadow: 0 16px 28px rgba(4, 59, 52, .07);
}

.invoice-radio-input:checked + .invoice-radio-ui {
    border-color: #7fd8a3;
    background: linear-gradient(180deg, #ffffff 0%, #f3fbf7 100%);
    box-shadow: 0 18px 32px rgba(37, 211, 102, .12);
}

.invoice-card-top,
.invoice-card-foot {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.invoice-card-title {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
}

.invoice-card-sub,
.invoice-card-dimension,
.invoice-card-description {
    display: block;
}

.invoice-card-sub {
    margin-top: 4px;
    color: var(--muted);
    font-size: .88rem;
}

.invoice-size-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 8px 10px;
    border-radius: 999px;
    background: #f4f8f7;
    border: 1px solid var(--border);
    font-weight: 700;
    font-size: .82rem;
    color: #2e5c53;
}

.invoice-card-dimension {
    margin-top: 14px;
    font-weight: 600;
    color: #204942;
}

.invoice-card-description {
    margin-top: 8px;
    color: var(--muted);
    line-height: 1.55;
    min-height: 68px;
}

.invoice-preview-stage {
    margin-top: 14px;
    border-radius: 18px;
    padding: 18px;
    background: linear-gradient(180deg, #f8fcfa 0%, #eefaf2 100%);
    border: 1px dashed #cfe3db;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
}

.invoice-preview-stage.thermal {
    min-height: 170px;
}

.invoice-preview-sheet {
    display: block;
    width: min(100%, 108px);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f6faf8 100%);
    border: 1px solid #d9e8e3;
    box-shadow: inset 0 0 0 6px rgba(239, 248, 244, .9), 0 10px 20px rgba(4, 59, 52, .06);
    position: relative;
}

.invoice-preview-sheet::before,
.invoice-preview-sheet::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    border-radius: 999px;
    background: #dce9e4;
}

.invoice-preview-sheet::before {
    top: 16px;
    height: 10px;
}

.invoice-preview-sheet::after {
    top: 38px;
    height: 6px;
    box-shadow: 0 18px 0 0 #e3eeea, 0 36px 0 0 #e3eeea, 0 54px 0 0 #e3eeea;
}

.invoice-card-foot {
    margin-top: 14px;
    color: var(--muted);
    font-size: .83rem;
    line-height: 1.45;
}

.invoice-card-foot span:last-child {
    text-align: right;
}

@media (max-width: 991px) {
    .invoice-size-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .invoice-card-top,
    .invoice-card-foot {
        flex-direction: column;
    }

    .invoice-card-description {
        min-height: 0;
    }

    .invoice-current-chip-wrap {
        min-width: 0;
    }
}
