/* ============================================================
   Karobar - Application Styles
   Simple Business. Better Control.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --sidebar-bg: #1a1d2e;
    --sidebar-text: #a0a3b5;
    --sidebar-text-active: #ffffff;
    --sidebar-width: 250px;

    --primary: #6c5ce7;
    --primary-hover: #5b4cdb;
    --primary-light: #efeafd;
    --primary-gradient: linear-gradient(135deg, #6c5ce7 0%, #5e4ce8 100%);

    --success: #10b981;
    --success-hover: #0ea371;
    --success-light: #d1fae5;

    --teal: #20c997;
    --teal-hover: #1ba87e;

    --warning: #fd7e14;
    --warning-light: #fff3e0;
    --warning-orange: #f59e0b;

    --danger: #dc3545;
    --danger-hover: #c82333;
    --danger-light: #fee2e2;

    --info: #3b82f6;
    --info-light: #dbeafe;

    --background: #f4f6f9;
    --surface: #ffffff;
    --border: #e8ecf1;
    --border-light: #eef0f5;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-dark: #0f172a;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-pill: 50px;

    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04);
    --shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 40px rgba(15, 23, 42, 0.12);

    --topbar-height: 68px;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ---------- Reset / Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 15px;
}

body {
    margin: 0;
    font-family: var(--font);
    background: var(--background);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
}

/* ---------- App Shell ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    transition: transform 0.25s ease;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Sidebar brand */
.sidebar-brand {
    padding: 1.15rem 1.1rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.sidebar-brand-text {
    min-width: 0;
}

.sidebar-brand-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.sidebar-brand-meta {
    font-size: 0.72rem;
    color: #7a7e93;
    margin-top: 2px;
}

/* Sidebar nav */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
    list-style: none;
    margin: 0;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.95rem;
    color: var(--sidebar-text);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.2rem;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
    opacity: 0.85;
}

.sidebar-nav .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-nav .nav-link.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(108, 92, 231, 0.4);
}

.sidebar-nav .nav-link.active i {
    opacity: 1;
}

/* Sidebar promo */
.sidebar-promo {
    margin: 0.75rem;
    padding: 0.9rem;
    background: #0d3d32;
    border-radius: 12px;
    color: #b8e6d8;
    font-size: 0.72rem;
    line-height: 1.45;
}

.sidebar-promo .promo-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #fff;
    font-weight: 600;
    font-size: 0.78rem;
    margin-bottom: 0.35rem;
}

.sidebar-promo .promo-title i {
    color: #25d366;
    font-size: 1rem;
}

/* ---------- Topbar ---------- */
.app-topbar {
    height: var(--topbar-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-toggle {
    display: none;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.4rem;
    padding: 0.35rem;
    line-height: 1;
}

.topbar-search {
    flex: 1;
    max-width: 520px;
    position: relative;
}

.topbar-search .form-control {
    height: 42px;
    padding-left: 2.5rem;
    padding-right: 5rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: #f1f3f8;
    font-size: 0.85rem;
    box-shadow: none;
}

.topbar-search .form-control:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.12);
}

.topbar-search .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
}

.topbar-search .search-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    height: 30px;
    padding: 0 0.85rem;
    border: none;
    border-radius: var(--radius-pill);
    background: #e2e6ef;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    flex-shrink: 0;
}

.btn-pill {
    border-radius: var(--radius-pill) !important;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.5rem 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.btn-primary-karobar {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-primary-karobar:hover,
.btn-primary-karobar:focus {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
}

.btn-success-karobar {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.btn-success-karobar:hover,
.btn-success-karobar:focus {
    background: var(--success-hover);
    border-color: var(--success-hover);
    color: #fff;
}

.btn-teal-karobar {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff;
}

.btn-teal-karobar:hover {
    background: var(--teal-hover);
    border-color: var(--teal-hover);
    color: #fff;
}

.btn-ghost-pill {
    background: #eef1f8;
    border: 1px solid #e0e5f0;
    color: var(--text-secondary);
    border-radius: var(--radius-pill) !important;
    font-weight: 500;
    font-size: 0.82rem;
    padding: 0.5rem 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-ghost-pill:hover {
    background: #e4e8f2;
    color: var(--text-primary);
}

.btn-outline-primary-karobar {
    background: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary);
    border-radius: var(--radius) !important;
    font-weight: 600;
    font-size: 0.82rem;
}

.btn-outline-primary-karobar:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.btn-navy {
    background: #1e293b;
    border-color: #1e293b;
    color: #fff;
    border-radius: var(--radius) !important;
    font-weight: 600;
}

.btn-navy:hover {
    background: #0f172a;
    color: #fff;
}

.btn-orange {
    background: var(--warning);
    border-color: var(--warning);
    color: #fff;
}

.btn-orange:hover {
    background: #e86f0a;
    color: #fff;
}

/* ---------- Page Content ---------- */
.app-content {
    padding: 1.25rem 1.5rem 2rem;
    flex: 1;
}

.page-header-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.35rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.15rem;
    box-shadow: var(--shadow-sm);
}

.page-header-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.page-header-icon.purple {
    background: var(--primary-light);
    color: var(--primary);
}

.page-header-icon.green {
    background: var(--success-light);
    color: var(--success);
}

.page-header-icon.orange {
    background: #fff0e0;
    color: var(--warning);
}

.page-header-icon.blue {
    background: var(--info-light);
    color: var(--info);
}

.page-header-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    line-height: 1.3;
}

.page-header-sub {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0.15rem 0 0;
}

.page-header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ---------- Cards ---------- */
.k-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.15rem;
}

.k-card.disabled {
    pointer-events: none;
    opacity: 0.6;
}

.k-card-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

.k-card-header.no-border {
    border-bottom: none;
    padding-bottom: 0;
}

.k-card-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.k-card-subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin: 0.15rem 0 0;
}

.k-card-body {
    padding: 1.15rem 1.25rem;
}

.k-card-body.pt-2 {
    padding-top: 0.75rem;
}

/* ---------- Forms ---------- */
.form-label-caps {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-label-caps .req {
    color: var(--danger);
}

.form-control,
.form-select {
    border-radius: var(--radius);
    border-color: #dce1ea;
    font-size: 0.9rem;
    min-height: 42px;
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.12);
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* Segmented toggles */
.seg-toggle {
    display: inline-flex;
    background: #f1f3f8;
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}

.seg-toggle .seg-btn {
    border: none;
    background: transparent;
    padding: 0.4rem 0.9rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.seg-toggle .seg-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(108, 92, 231, 0.3);
}

.seg-toggle.seg-success .seg-btn.active {
    background: var(--success);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.seg-toggle.seg-dark .seg-btn.active {
    background: #1e293b;
    box-shadow: none;
}

.seg-toggle.seg-pills {
    background: transparent;
    padding: 0;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.seg-toggle.seg-pills .seg-btn {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 0.4rem 0.95rem;
}

.seg-toggle.seg-pills .seg-btn.active {
    background: #1e293b;
    border-color: #1e293b;
    color: #fff;
}

.seg-toggle.seg-year .seg-btn.active {
    background: var(--info);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

/* Customer stats strip */
.stats-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    background: #f8f9fc;
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    margin-top: 0.85rem;
}

.stats-strip .stat-item .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.stats-strip .stat-item .stat-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
}

.stats-strip .stat-value.text-danger-soft {
    color: #e11d48;
}

.stats-strip .stat-value.text-success-soft {
    color: var(--success);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    opacity: 0.35;
    display: block;
    margin-bottom: 0.75rem;
}

.empty-state p {
    margin: 0;
    font-size: 0.88rem;
    max-width: 360px;
    margin-inline: auto;
}

/* ---------- Select2 ---------- */
.select2-container {
    width: 100% !important;
    font-family: var(--font);
}

select.select2-hidden-accessible {
    min-height: 0;
}

.select2-container .select2-selection--single,
.select2-container .select2-selection--multiple {
    outline: none;
}

.select2-container--default .select2-selection--single {
    display: flex;
    align-items: center;
    min-height: 42px;
    height: auto;
    padding: 0 2.35rem 0 0.85rem;
    background-color: var(--surface);
    border: 1px solid #dce1ea;
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 0;
    line-height: 1.5;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--text-muted);
}

.select2-container--default .select2-selection--single .select2-selection__clear {
    float: none;
    margin-left: auto;
    margin-right: 0.15rem;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1;
}

.select2-container--default .select2-selection--single .select2-selection__clear:hover {
    color: var(--text-primary);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    top: 0;
    right: 0;
    width: 2.25rem;
    height: 100%;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    display: none;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow {
    transform: scaleY(-1);
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--multiple {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.12);
}

.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

.select2-container--default.select2-container--disabled .select2-selection--single,
.select2-container--default.select2-container--disabled .select2-selection--multiple {
    background-color: #f8f9fc;
    cursor: not-allowed;
    box-shadow: none;
}

.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__rendered {
    color: var(--text-muted);
}

select.is-invalid + .select2-container .select2-selection,
.was-validated select:invalid + .select2-container .select2-selection {
    border-color: var(--danger);
}

select.is-invalid + .select2-container.select2-container--focus .select2-selection,
select.is-invalid + .select2-container.select2-container--open .select2-selection,
.was-validated select:invalid + .select2-container.select2-container--focus .select2-selection,
.was-validated select:invalid + .select2-container.select2-container--open .select2-selection {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.12);
}

.select2-container--default .select2-selection--multiple {
    min-height: 42px;
    padding: 4px 8px;
    background-color: var(--surface);
    border: 1px solid #dce1ea;
    border-radius: var(--radius);
    cursor: text;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    padding: 0;
    margin: 0;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    margin: 0;
    padding: 0.18rem 0.5rem 0.18rem 0.4rem;
    background: var(--primary-light);
    border: none;
    border-radius: 6px;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: var(--primary);
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1;
    margin: 0 0.15rem 0 0;
    padding: 0;
    border-radius: 4px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    background: transparent;
    color: var(--primary-hover);
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__display {
    cursor: default;
}

.select2-container--default .select2-selection--multiple .select2-selection__placeholder {
    margin: 0;
    padding: 0.2rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.select2-container--default .select2-selection--multiple .select2-selection__clear {
    margin-top: 0;
    margin-right: 0.15rem;
    color: var(--text-muted);
    font-weight: 500;
}

.select2-container .select2-search--inline .select2-search__field {
    margin: 0;
    padding: 0.2rem 0;
    font-family: var(--font);
    font-size: 0.9rem;
    color: var(--text-primary);
}

.select2-container .select2-search--inline .select2-search__field::placeholder {
    color: var(--text-muted);
}

.select2-dropdown {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    z-index: 1080;
}

.select2-container--open .select2-dropdown--below {
    margin-top: 4px;
    border-top: 1px solid var(--border);
}

.select2-container--open .select2-dropdown--above {
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.select2-search--dropdown {
    padding: 0.65rem 0.65rem 0.35rem;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    width: 100%;
    padding: 0.45rem 0.75rem;
    border: 1px solid #dce1ea;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.85rem;
    color: var(--text-primary);
    outline: none;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.12);
}

.select2-container--default .select2-search--dropdown .select2-search__field::placeholder {
    color: var(--text-muted);
}

.select2-results > .select2-results__options {
    padding: 0.3rem;
    max-height: 260px;
}

.select2-container--default .select2-results__option {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.select2-container--default .select2-results__option--disabled {
    color: var(--text-muted);
}

.select2-container--default .select2-results__option[aria-selected='true'] {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable,
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--primary);
    color: #fff;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable[aria-selected='true'] {
    background: var(--primary);
    color: #fff;
}

.select2-container--default .select2-results__group {
    padding: 0.55rem 0.75rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.select2-results__message {
    padding: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.select2-container--default .select2-results__option .select2-results__option {
    padding-left: 1.15rem;
}

.select2-container--open {
    z-index: 1080;
}

.modal .select2-container {
    z-index: 1;
}

/* ---------- Bill Summary ---------- */
.bill-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.65rem;
    font-size: 0.9rem;
}

.bill-summary-row .label {
    color: var(--text-secondary);
}

.bill-summary-row .value {
    font-weight: 600;
}

.net-bill-bar {
    background: #ecfdf5;
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.85rem 0;
}

.net-bill-bar .label {
    font-weight: 600;
    color: var(--text-dark);
}

.net-bill-bar .value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--success);
}

.outstanding-box {
    background: #fff7ed;
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.outstanding-box .row-line {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.outstanding-box .row-line:last-child {
    margin-bottom: 0;
}

.outstanding-box .amt {
    font-weight: 700;
    color: var(--warning);
}

.input-with-btn {
    position: relative;
}

.input-with-btn .form-control {
    padding-right: 6.5rem;
}

.input-with-btn .inner-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    height: 32px;
    padding: 0 0.75rem;
    border: none;
    border-radius: 7px;
    background: var(--teal);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

.payment-mode-group {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
}

.payment-mode-group .mode-btn {
    border: 1.5px solid var(--border);
    background: #fff;
    border-radius: 8px;
    padding: 0.55rem 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: center;
}

.payment-mode-group .mode-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-save-print {
    width: 100%;
    height: 48px;
    border-radius: var(--radius) !important;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-link-secondary {
    display: block;
    text-align: center;
    margin-top: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    background: none;
    border: none;
    width: 100%;
}

.btn-link-secondary:hover {
    color: var(--primary);
}

/* ---------- Tables ---------- */
.table-wrap {
    overflow-x: auto;
}

.k-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
}

.k-table thead th {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: transparent;
}

.k-table tbody td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.88rem;
    vertical-align: middle;
    color: var(--text-primary);
}

.k-table tbody tr:last-child td {
    border-bottom: none;
}

.k-table .link-id {
    color: var(--info);
    font-weight: 600;
}

.k-table .fw-name {
    font-weight: 600;
    color: var(--text-dark);
}

.badge-status {
    display: inline-block;
    padding: 0.28rem 0.7rem;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-status.active,
.badge-status.settled,
.badge-status.paid {
    background: #d1fae5;
    color: #059669;
}

.badge-status.partial {
    background: #ffedd5;
    color: #c2410c;
}

.badge-status.cancelled {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-type {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 600;
}

.badge-type.wholesale {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-type.retail {
    background: var(--info-light);
    color: var(--info);
}

.code-chip {
    display: inline-block;
    background: #fff0e0;
    color: #c2410c;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
}

.action-btns {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
}

.action-btn:hover {
    background: #f8f9fc;
}

.action-btn.print {
    color: var(--info);
    border-color: #bfdbfe;
}

.action-btn.challan {
    color: var(--warning);
    border-color: #fed7aa;
}

.action-btn.danger {
    color: var(--danger);
    border-color: #fecaca;
}

.action-btn.edit {
    color: var(--info);
}

.btn-correct-stock {
    border: 1.5px solid #fbbf24;
    background: #fffbeb;
    color: #b45309;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border-radius: 7px;
}

.low-stock-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: #fee2e2;
    color: #dc2626;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-pill);
}

.text-amt-green {
    color: var(--success);
    font-weight: 700;
}

.text-amt-orange {
    color: var(--warning);
    font-weight: 700;
}

.text-amt-blue {
    color: var(--info);
    font-weight: 600;
}

/* ---------- Dashboard ---------- */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.25rem;
    height: 100%;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.stat-card.accent-danger {
    border-left: 4px solid var(--danger);
}

.stat-card.accent-warning {
    border-left: 4px solid var(--warning-orange);
}

.stat-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-card-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.35rem;
}

.stat-card-value {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.2;
}

.stat-card-value.danger {
    color: var(--danger);
}

.stat-card-value.warning {
    color: var(--warning-orange);
}

.stat-card-foot {
    font-size: 0.78rem;
    margin-top: 0.4rem;
    color: var(--text-muted);
}

.stat-card-foot.success {
    color: var(--success);
}

.stat-card-foot.danger {
    color: var(--danger);
}

.stat-card-foot.warning {
    color: var(--warning-orange);
}

.stat-icon-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.stat-icon-circle.purple {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-icon-circle.green {
    background: var(--success-light);
    color: var(--success);
}

.stat-icon-circle.red {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-icon-circle.orange {
    background: #ffedd5;
    color: var(--warning-orange);
}

.action-hero {
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    color: #fff;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    min-height: 140px;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
}

.action-hero:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: #fff;
}

.action-hero.purple {
    background: linear-gradient(135deg, #6c5ce7, #5e4ce8);
}

.action-hero.green {
    background: linear-gradient(135deg, #10b981, #059669);
}

.action-hero.blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.action-hero .hero-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    opacity: 0.85;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.action-hero .hero-title {
    font-size: 1.35rem;
    font-weight: 800;
    margin: 0.5rem 0 0.25rem;
}

.action-hero .hero-sub {
    font-size: 0.82rem;
    opacity: 0.85;
    margin: 0;
}

.action-hero .hero-plus {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #fff;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.action-hero .hero-icon-br {
    position: absolute;
    right: 1.25rem;
    bottom: 1.1rem;
    font-size: 2.2rem;
    opacity: 0.35;
}

.section-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.quick-reg-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: inherit;
    height: 100%;
    transition: box-shadow 0.15s;
}

.quick-reg-card:hover {
    box-shadow: var(--shadow);
    color: inherit;
}

.quick-reg-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.quick-reg-icon.purple {
    background: var(--primary-light);
    color: var(--primary);
}

.quick-reg-icon.orange {
    background: #fff0e0;
    color: var(--warning);
}

.quick-reg-icon.blue {
    background: var(--info-light);
    color: var(--info);
}

.quick-reg-icon.green {
    background: var(--success-light);
    color: var(--success);
}

.quick-reg-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.quick-reg-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.list-item-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--border-light);
}

.list-item-row:last-child {
    border-bottom: none;
}

.list-item-row .item-main {
    flex: 1;
    min-width: 0;
}

.list-item-row .item-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-dark);
}

.list-item-row .item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.list-item-row .item-amt {
    font-weight: 700;
    font-size: 0.95rem;
}

.due-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fee2e2;
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    flex-shrink: 0;
}

.btn-remind {
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* ---------- Customers ---------- */
.filter-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.9rem 1.15rem;
    margin-bottom: 1.15rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.filter-bar .filter-search {
    flex: 1;
    min-width: 220px;
    position: relative;
}

.filter-bar .filter-search .form-control {
    padding-left: 2.4rem;
    border-radius: var(--radius-pill);
    background: #f8f9fc;
}

.filter-bar .filter-search i {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.customer-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.15rem;
    height: 100%;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: ease-in 0.2s all;
}

.customer-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.customer-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.65rem;
}

.customer-card-id {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.customer-card-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.45rem;
}

.customer-meta-line {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.customer-meta-line i {
    color: var(--primary);
    margin-top: 2px;
    flex-shrink: 0;
}

.customer-meta-line i.bi-geo-alt {
    color: var(--text-muted);
}

.pending-box {
    background: #fff7ed;
    border-radius: var(--radius);
    padding: 0.75rem 0.9rem;
    margin: 0.85rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.pending-box.settled {
    background: #ecfdf5;
}

.pending-box .pending-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.pending-box .pending-amt {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-dark);
}

.pending-box.settled .pending-amt {
    color: var(--success);
}

.btn-wa {
    background: #25d366;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.customer-history {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.85rem;
}

.customer-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-light);
}

/* ---------- Payments ---------- */
.balance-highlight {
    background: #fff7ed;
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.15rem;
}

.balance-highlight .bal-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.balance-highlight .bal-amt {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-dark);
}

.pending-customer-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border-light);
}

.pending-customer-item:last-child {
    border-bottom: none;
}

.pending-customer-item .pc-info {
    flex: 1;
    min-width: 0;
}

.pending-customer-item .pc-name {
    font-weight: 600;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.pending-customer-item .pc-phone {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.pending-customer-item .pc-due {
    text-align: right;
}

.pending-customer-item .pc-due-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.03em;
}

.pending-customer-item .pc-due-amt {
    font-weight: 800;
    font-size: 0.95rem;
}

.pending-list {
    max-height: 320px;
    overflow-y: auto;
}

/* ---------- Stock ---------- */
.category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.category-pills .cat-btn {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: var(--radius-pill);
    padding: 0.35rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
}

.category-pills .cat-btn.active {
    background: #1e293b;
    border-color: #1e293b;
    color: #fff;
}

.article-name-cell .an-title {
    font-weight: 600;
    color: var(--text-dark);
}

.article-name-cell .an-brand {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stock-info-box {
    background: #e9e9e6;
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    margin-bottom: 1rem;
}

.stock-info-box .si-name {
    font-weight: 700;
    color: var(--text-dark);
}

.stock-info-box .si-stock {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ---------- Reports ---------- */
.report-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.15rem;
    height: 100%;
    box-shadow: var(--shadow-sm);
}

.report-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.report-stat-value {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-dark);
}

.report-stat-value.orange {
    color: var(--warning);
}

.report-stat-value.blue {
    color: #1e3a5f;
}

.report-stat-value.red {
    color: var(--danger);
}

.report-stat-foot {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.45rem;
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.report-stat-foot.orange {
    color: var(--warning);
}

.report-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.15rem;
    flex-wrap: wrap;
}

.report-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.15rem;
    border-radius: 10px;
    border: 1.5px solid transparent;
    background: transparent;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.report-tab:hover {
    color: var(--text-primary);
}

.report-tab.active {
    background: #fff;
    border-color: #cbd5e1;
    color: var(--text-dark);
    box-shadow: var(--shadow-sm);
}

.report-tab.active.purple-underline {
    border: none;
    border-radius: 0;
    border-bottom: 3px solid var(--primary);
    color: var(--primary);
    background: transparent;
    box-shadow: none;
    padding-bottom: 0.5rem;
}

.report-panel {
    display: none;
}

.report-panel.active {
    display: block;
}

/* ---------- Settings ---------- */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-pill);
}

.audit-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.88rem;
}

.audit-row:last-child {
    border-bottom: none;
}

.audit-row .audit-time {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-backup {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius) !important;
    font-weight: 600;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.btn-outline-restore {
    background: #eff6ff;
    border: 1.5px solid #93c5fd;
    color: #1d4ed8;
}

.btn-outline-reset {
    background: #fef2f2;
    border: 1.5px solid #fca5a5;
    color: #dc2626;
}

/* ---------- Modals ---------- */
.modal-backdrop.show {
    opacity: 0.55;
}

.modal-content {
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-light);
    padding: 1.15rem 1.35rem;
}

.modal-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.modal-body {
    padding: 1.25rem 1.35rem;
}

.modal-footer {
    border-top: 1px solid var(--border-light);
    padding: 1rem 1.35rem;
}

.modal-footer .btn-cancel-text {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
}

.print-modal .modal-content {
    border-radius: 12px;
    overflow: hidden;
}

.print-modal-header {
    background: #1a1d2e;
    color: #fff;
    padding: 0.85rem 1.15rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.print-modal-header .pm-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.print-modal-header .pm-title i {
    color: #fbbf24;
}

.print-doc {
    background: #fff;
    padding: 1.75rem 2rem;
    color: #111;
    max-height: 70vh;
    overflow-y: auto;
}

.print-doc .shop-name {
    font-size: 1.15rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin: 0 0 0.25rem;
}

.print-doc .shop-meta {
    font-size: 0.8rem;
    color: #555;
    line-height: 1.45;
}

.print-doc .doc-badge {
    display: inline-block;
    background: #111;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.45rem 0.85rem;
    margin-bottom: 0.35rem;
}

.print-doc .doc-date {
    font-size: 0.8rem;
    color: #555;
    text-align: right;
}

.print-doc hr {
    border: none;
    border-top: 1.5px solid #222;
    margin: 1rem 0;
}

.print-doc .info-box {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.print-doc .info-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
}

.print-doc .info-name {
    font-weight: 700;
    font-size: 0.95rem;
}

.print-doc .info-line {
    font-size: 0.82rem;
    color: #444;
}

.print-doc .print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.15rem;
    font-size: 0.85rem;
}

.print-doc .print-table th {
    background: #f3f4f6;
    padding: 0.55rem 0.65rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid #e5e7eb;
}

.print-doc .print-table td {
    padding: 0.55rem 0.65rem;
    border: 1px solid #e5e7eb;
}

.print-doc .totals-block {
    text-align: right;
    font-size: 0.88rem;
}

.print-doc .totals-block .t-row {
    display: flex;
    justify-content: flex-end;
    gap: 2rem;
    margin-bottom: 0.3rem;
}

.print-doc .totals-block .t-val {
    min-width: 90px;
    font-weight: 600;
}

.print-doc .totals-block .t-net {
    font-weight: 800;
    font-size: 1rem;
}

.print-doc .totals-block .t-paid {
    color: #059669;
}

.print-doc .totals-block .t-due {
    color: #ea580c;
    font-weight: 800;
}

.print-doc .totals-block .t-disc {
    color: #059669;
}

.print-doc .doc-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.print-doc .thanks {
    font-size: 0.8rem;
    color: #666;
}

.print-doc .thanks small {
    display: block;
    color: #999;
    margin-top: 0.2rem;
}

.print-doc .signatory {
    text-align: center;
    min-width: 140px;
}

.print-doc .signatory .line {
    border-top: 1px solid #333;
    margin-bottom: 0.35rem;
    padding-top: 2rem;
}

.print-doc .signatory span {
    font-size: 0.78rem;
    font-weight: 600;
}

.confirm-modal-body {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.5rem 1.5rem 0.5rem;
}

.confirm-modal-body .warn-icon {
    font-size: 2.2rem;
    color: var(--danger);
    flex-shrink: 0;
    line-height: 1;
}

.confirm-modal-body h5 {
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.confirm-modal-body p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

/* Global Search Modal */
.search-modal .modal-dialog {
    max-width: 640px;
}

.search-modal .modal-content,
.search-panel {
    width: 100%;
    max-width: 640px;
    border-radius: 22px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
    color: #0f172a;
}

.search-modal-input-wrap {
    position: relative;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    background: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-modal-input-wrap .sm-icon {
    position: static;
    transform: none;
    color: var(--warning);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.search-modal-input-wrap .form-control {
    height: auto;
    padding: 0.35rem 0;
    border: none;
    border-radius: 0;
    font-size: 1.05rem;
    background: transparent !important;
    color: #0f172a;
    box-shadow: none;
    flex: 1;
    min-width: 0;
}

.search-modal-input-wrap .form-control:focus {
    border: none;
    box-shadow: none;
    background: transparent;
}

.search-modal-input-wrap .search-clear {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.15rem;
    padding: 0.15rem;
    line-height: 1;
    display: none;
    flex-shrink: 0;
}

.search-modal-input-wrap .search-clear.show {
    display: inline-flex;
}

.search-modal-input-wrap .esc-hint {
    position: static;
    transform: none;
    background: #eef2ff;
    color: #64748b;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.3rem 0.55rem;
    border-radius: 6px;
    border: 1px solid #e0e7ff;
    flex-shrink: 0;
}

.search-empty {
    text-align: center;
    padding: 3rem 1.5rem 2.5rem;
    color: var(--text-muted);
    background: transparent;
}

.search-empty i {
    font-size: 3.5rem;
    color: #93c5fd;
    opacity: 0.5;
    display: block;
    margin-bottom: 1rem;
}

.search-empty p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.search-empty small {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.8rem;
}

.search-results {
    display: block !important;
    background: transparent;
    max-height: min(62vh, 520px);
    overflow-y: auto;
    padding: 0.85rem 1.15rem 1.25rem;
}

.search-results.show {
    display: block !important;
    background: transparent;
}

.search-section {
    margin-bottom: 1.15rem;
}

.search-section:last-child {
    margin-bottom: 0;
}

.search-section-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.55rem;
}

.search-section-title i {
    font-size: 0.95rem;
}

.search-section-title.customers i {
    color: var(--primary);
}

.search-section-title.stock i {
    color: var(--warning);
}

.search-section-title.sales i {
    color: var(--success);
}

.search-section-title.payments i {
    color: var(--info);
}

.search-result-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    margin-bottom: 0.45rem;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s, border-color 0.12s;
}

.search-result-card:last-child {
    margin-bottom: 0;
}

.search-result-card:hover {
    background: #f8fafc;
    border-color: #d8dee8;
    color: inherit;
}

.search-result-card .sr-main {
    flex: 1;
    min-width: 0;
}

.search-result-card .sr-title-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-bottom: 0.2rem;
}

.search-result-card .sr-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.search-result-card .sr-id {
    font-weight: 700;
    font-size: 0.9rem;
}

.search-result-card .sr-id.green {
    color: var(--success);
}

.search-result-card .sr-id.blue {
    color: var(--info);
}

.search-result-card .sr-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.search-result-card .sr-right {
    text-align: right;
    flex-shrink: 0;
}

.search-result-card .sr-right-label {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-bottom: 0.1rem;
}

.search-result-card .sr-right-value {
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--text-dark);
}

.search-result-card .sr-right-value.orange {
    color: var(--warning);
}

.search-result-card .sr-right-value.red {
    color: var(--danger);
}

.search-result-card .sr-right-value.green {
    color: var(--success);
}

.search-result-card .sr-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-pill);
    font-size: 0.65rem;
    font-weight: 600;
    background: #e8edf5;
    color: #64748b;
}

.search-result-card .sr-code {
    display: inline-block;
    background: #fff0e0;
    color: #b45309;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.45rem;
    border-radius: 5px;
    margin-right: 0.35rem;
    vertical-align: middle;
}

.search-section-title.suppliers i {
    color: #d97706;
}

.search-section-title.purchases i {
    color: #ea580c;
}

.search-section-title.agents i {
    color: #7c3aed;
}

.search-section-title.payouts i {
    color: #0f766e;
}

.search-result-card .sr-id.orange {
    color: #ea580c;
}

.search-result-card .sr-company {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    border-radius: var(--radius-pill);
    font-size: 0.62rem;
    font-weight: 600;
    background: #eef2ff;
    color: #4f46e5;
}

.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 1055;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 8vh 1rem 2rem;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.38);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.search-overlay .search-modal {
    width: 100%;
    max-width: 640px;
}

.search-overlay .search-modal .modal-dialog {
    margin: 0;
    max-width: 100%;
    width: 100%;
}

.search-scope-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.85rem;
    background: transparent;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.search-scope-toggle {
    flex-shrink: 0;
}

.search-scope-toggle .seg-btn {
    padding: 0.32rem 0.75rem;
    font-size: 0.75rem;
}

.search-scope-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.search-loading {
    padding: 0.65rem 1.15rem 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ---------- Overlay for mobile sidebar ---------- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1035;
}

.sidebar-overlay.show {
    display: block;
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.show {
        transform: translateX(0);
    }

    .app-main {
        margin-left: 0;
    }

    .topbar-toggle {
        display: inline-flex;
    }

    .stats-strip {
        grid-template-columns: repeat(2, 1fr);
    }

    .payment-mode-group {
        grid-template-columns: repeat(2, 1fr);
    }

    .topbar-actions .btn-pill span.hide-sm,
    .topbar-actions .btn-ghost-pill span.hide-sm {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .app-content {
        padding: 1rem;
    }

    .page-header-card {
        flex-wrap: wrap;
    }

    .page-header-actions {
        width: 100%;
        margin-left: 0;
        margin-top: 0.5rem;
    }

    .stats-strip {
        grid-template-columns: 1fr 1fr;
    }

    .topbar-search {
        max-width: none;
    }

    .print-doc {
        padding: 1rem;
    }
}

@media print {
    .app-sidebar,
    .app-topbar,
    .print-modal-header,
    .sidebar-overlay {
        display: none !important;
    }

    .app-main {
        margin-left: 0 !important;
    }

    .modal {
        position: static !important;
    }

    .modal-dialog {
        max-width: 100% !important;
        margin: 0 !important;
    }

    .modal-backdrop {
        display: none !important;
    }

    .print-doc {
        max-height: none !important;
        overflow: visible !important;
    }
}

/* ---------- Auth / company picker / platform extras ---------- */
.auth-page {
    min-height: 100vh;
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-wrap {
    width: 100%;
    max-width: 420px;
}

.auth-wrap-wide {
    max-width: 720px;
}

.auth-brand h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-dark);
    margin: 0.75rem 0 0.25rem;
}

.auth-brand p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.9rem;
}

.auth-logo {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    box-shadow: 0 8px 24px rgba(108, 92, 231, 0.35);
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.5rem 1.5rem 1.25rem;
    box-shadow: var(--shadow-md);
}

.auth-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 1.15rem;
    color: var(--text-dark);
}

.auth-links {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.company-pick-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.35rem;
    height: 100%;
    box-shadow: var(--shadow-sm);
}

.company-pick-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-dark);
}

.company-pick-meta {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.35rem;
}

.statement-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.15rem;
}

.statement-summary .ss-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
}

.statement-summary .ss-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.statement-summary .ss-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-dark);
}

.statement-summary .ss-value.orange {
    color: var(--warning);
}

.platform-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.15rem;
    height: 100%;
}

.platform-stat .ps-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.platform-stat .ps-value {
    font-size: 1.5rem;
    font-weight: 800;
    margin-top: 0.25rem;
}

.badge-status.trial {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-status.suspended {
    background: #fee2e2;
    color: #dc2626;
}

.plan-price-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.35rem;
    height: 100%;
    box-shadow: var(--shadow-sm);
}

.plan-price-card .plan-name {
    font-weight: 700;
    font-size: 1.1rem;
}

.plan-price-card .plan-price {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0.5rem 0;
}

.plan-price-card ul {
    padding-left: 1.1rem;
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

@media (max-width: 767.98px) {
    .statement-summary {
        grid-template-columns: 1fr 1fr;
    }
}
