/* ==========================================================================
   Hi-ZONE — Modern admin theme layer
   --------------------------------------------------------------------------
   This file ONLY restyles existing markup/classes. It adds no new HTML and
   changes no application logic, so the existing flow is untouched. It is
   loaded AFTER main.css so these rules win the cascade.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Palette tuned to the Hi-ZONE logo: bright sky-blue + orange accent */
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --primary: #0a84c0;       /* logo "Hi" blue (lighter than the old navy) */
    --primary-600: #036d9f;   /* hover / mid */
    --primary-700: #02567d;   /* deepest, for the sidebar gradient foot */
    --primary-soft: #e4f3fb;  /* light tint for badges / hover backgrounds */
    --accent: #f39200;        /* logo orange (the dot on the "i") */
    --success: #16a34a;
    --danger: #e11d48;
    --ink: #1f2733;
    --muted: #6b7891;
    --line: #e7ecf3;
    --bg: #f5f7fb;
    --card-shadow: 0 1px 3px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
    --card-shadow-hover: 0 4px 12px rgba(16, 24, 40, .08), 0 16px 40px rgba(16, 24, 40, .10);
}

body {
    background-color: var(--bg) !important;
    color: var(--ink) !important;
    /* Inter is imported above + lives in --font, but was never applied. Apply it
       app-wide for a cleaner, more professional look. */
    font-family: var(--font) !important;
    font-size: 14px;     /* 13.5 was a touch cramped; 14 reads cleaner */
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
/* Bootstrap sets its own font-family on these — make them inherit Inter too. */
.form-control, .form-select, .btn, table, input, select, textarea,
.select2-container, .select2-dropdown, .modal, .card {
    font-family: var(--font) !important;
}

/* --------------------------------------------------------------------------
   Topbar
   -------------------------------------------------------------------------- */
.header {
    background: #fff;
    box-shadow: 0 1px 0 var(--line), 0 2px 12px rgba(16, 24, 40, .04);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.add-sale-btn,
.add-purchase-btn {
    border: 1px solid var(--primary) !important;
    color: var(--primary) !important;
    border-radius: 10px !important;
    font-weight: 600;
    transition: all .18s ease;
}
.add-sale-btn:hover,
.add-purchase-btn:hover {
    background: var(--primary) !important;
    color: #fff !important;
    box-shadow: 0 6px 16px rgba(19, 102, 214, .25);
}

.notification-svg,
.profile-svg,
.nav-icon {
    color: var(--primary);
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.offcanvas,
.sidebar {
    background: linear-gradient(185deg, var(--primary) 0%, var(--primary-700) 100%) !important;
    border-right: 0;
}

.offcanvas .offcanvas-body {
    padding-top: .5rem;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, .85) !important;
    border-radius: 12px;
    padding: 10px 14px !important;
    margin: 3px 10px !important;
    font-weight: 500;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}

.navbar-nav .nav-link .menu-icon,
.navbar-nav .nav-link i {
    margin-right: 10px;
    font-size: 1.05rem;
    opacity: .95;
}

.navbar-nav .nav-link:hover {
    color: #fff !important;
    background-color: rgba(255, 255, 255, .14) !important;
    border-radius: 12px;
    transform: translateX(2px);
}

.navbar-nav .nav-link.active {
    color: var(--primary) !important;
    background-color: #fff !important;
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
    border: 1px solid var(--line) !important;
    border-radius: 16px !important;
    box-shadow: var(--card-shadow) !important;
    background: #fff;
    transition: box-shadow .2s ease, transform .2s ease;
}

.dashboard .card {
    padding: 18px 20px;
    min-height: 120px;
}
.dashboard .card:hover {
    box-shadow: var(--card-shadow-hover) !important;
    transform: translateY(-3px);
}

/* Stat-card icon tile */
.dashboard .card .dashboard-icon {
    width: 46px;
    height: 46px;
    padding: 10px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary) !important;
    fill: var(--primary);
    margin-bottom: 12px;
}

.dashboard .card .card-info h5 {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--ink);
    margin: 0;
}
.dashboard .card .card-info p {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin: 2px 0 0;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table {
    border-collapse: separate;
    border-spacing: 0;
    color: var(--ink);
}
.table thead th {
    background: #f3f6fc !important;
    color: var(--muted) !important;
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--line) !important;
    padding: 12px 14px;
    white-space: nowrap;
}
.table tbody td {
    padding: 12px 14px;
    border-top: 1px solid var(--line);
    vertical-align: middle;
}
.table tbody tr {
    transition: background .14s ease;
}
.table tbody tr:hover {
    background: #f7faff;
}

/* Item-entry tables (rent / sales / services / quotation add+edit).
   These have many columns; `.table` forces width:100% which crushes the
   inputs (Amount/Total showed as half-width boxes and trailing columns were
   clipped). Give each field a usable min-width and let the table grow to its
   content so the `.table-responsive` wrapper scrolls horizontally instead. */
.form-table table,
#quotationItems {
    min-width: max-content;
}
.form-table td, .form-table th,
#quotationItems td, #quotationItems th {
    white-space: nowrap;
}
.form-table .form-control,
.form-table .form-select,
.form-table select,
#quotationItems .form-control,
#quotationItems select {
    min-width: 130px;
}
.form-table input[type="number"],
#quotationItems input[type="number"] {
    min-width: 120px;
}
.form-table input[type="date"] {
    min-width: 150px;
}
.form-table textarea {
    min-width: 170px;
    min-height: 38px;
}

/* DataTables search box */
.dataTables_filter input,
.search-input {
    border: 1px solid var(--line) !important;
    border-radius: 10px !important;
    padding: 8px 12px !important;
    outline: none;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
    border-radius: 10px;
    font-weight: 600;
    transition: all .18s ease;
}
.btn-primary,
.save-btn {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-600) 100%) !important;
    border-color: var(--primary-600) !important;
    color: #fff !important;
}
.btn-primary:hover,
.save-btn:hover {
    background: var(--primary-700) !important;
    box-shadow: 0 8px 20px rgba(19, 102, 214, .28);
    transform: translateY(-1px);
}
.btn-secondary,
.close-btn {
    border-radius: 10px;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-control,
.form-select {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: .92rem;
    color: var(--ink);
    transition: border-color .16s ease, box-shadow .16s ease;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(19, 102, 214, .15);
}
.form-group label,
.form-label {
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
}

/* --------------------------------------------------------------------------
   Modals
   -------------------------------------------------------------------------- */
.modal-content {
    border: 0;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(16, 24, 40, .22);
    overflow: hidden;
}
.modal-header {
    border-bottom: 1px solid var(--line);
}
.modal-footer {
    border-top: 1px solid var(--line);
}

/* --------------------------------------------------------------------------
   Login page (also includes header.php)
   -------------------------------------------------------------------------- */
.login-btn,
.login button,
.login .btn {
    border-radius: 10px !important;
    font-weight: 600;
}

/* Scrollbar polish */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #c7d2e3; border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: #aebccf; }

/* ==========================================================================
   v2 — Tables inside cards, sidebar submenus, dashboard polish
   (high-specificity overrides of main.css; markup/flow untouched)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tables inside .card  (remove the heavy blue lines/glow from main.css)
   -------------------------------------------------------------------------- */
.card table tr {
    box-shadow: none !important;
}
.card table thead {
    background-color: transparent !important;
}
.card table thead tr th {
    background: #f3f6fc !important;
    color: var(--muted) !important;
    border: 0 !important;
    border-bottom: 1px solid var(--line) !important;
    font-size: .76rem !important;
    font-weight: 600 !important;
    letter-spacing: .04em !important;
    text-transform: uppercase;
    padding: 12px 14px !important;
}
.card table thead tr th:first-child { border-top-left-radius: 10px; }
.card table thead tr th:last-child  { border-top-right-radius: 10px; }

.card table tbody tr td {
    border: 0 !important;
    border-bottom: 1px solid var(--line) !important;
    letter-spacing: normal !important;
    color: var(--ink);
    font-size: .9rem !important;
    padding: 12px 14px !important;
}
.card table tbody tr:hover td {
    background: #f7faff;
}

/* --------------------------------------------------------------------------
   Sidebar submenus (HR / Reports dropdowns) — make names clearly visible
   -------------------------------------------------------------------------- */
.offcanvas .dropdown-menu {
    background-color: rgba(255, 255, 255, .08) !important;
    border: 1px solid rgba(255, 255, 255, .12) !important;
    border-radius: 12px !important;
    margin: 2px 12px 8px !important;
    padding: 6px !important;
    width: auto;
}
.offcanvas .dropdown-item {
    color: rgba(255, 255, 255, .92) !important;
    margin: 2px 0 !important;
    padding: 9px 12px 9px 30px !important;
    border-radius: 8px;
    font-size: .88rem;
    font-weight: 500;
    white-space: normal;          /* allow long submenu names to wrap */
    line-height: 1.3;
}
.offcanvas .dropdown-item:hover {
    color: var(--primary) !important;
    background-color: #fff !important;
    border-radius: 8px;
}
/* Submenu bullet marker */
.offcanvas .dropdown .dropdown-menu a::before {
    height: .4rem !important;
    width: .4rem !important;
    border-radius: 50%;
    background: rgba(255, 255, 255, .7) !important;
    left: 12px !important;
}
.offcanvas .dropdown .dropdown-menu a:hover::before {
    width: .4rem !important;
    background: var(--primary) !important;
}
/* Parent toggle caret: clean white chevron on the right */
.offcanvas .dropdown-toggle::after {
    border: 0 !important;
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(255, 255, 255, .8) !important;
    border-bottom: 2px solid rgba(255, 255, 255, .8) !important;
    right: 14px !important;
    transform: rotate(45deg) !important;
    transition: transform .25s ease;
}
.offcanvas .dropdown-toggle.show::after,
.offcanvas .dropdown .show.dropdown-toggle::after {
    transform: rotate(-135deg) !important;
}

/* --------------------------------------------------------------------------
   Dashboard polish
   -------------------------------------------------------------------------- */
.main-section {
    padding: 22px 26px !important;
}

/* Stat cards: equal height, centered, consistent spacing */
.dashboard .card {
    margin: 0 !important;
    height: 100%;
    display: flex;
    align-items: center;
}
.dashboard > .row,
.dashboard .row {
    row-gap: 16px;
}
.dashboard .card-info {
    margin-left: 0 !important;
    padding: 0 !important;
}

/* Tinted stat-icon variations for a modern dashboard feel */
.dashboard > .row > [class*="col-"]:nth-child(1) .dashboard-icon { background: #e8f0fe; color: #1366d6 !important; fill: #1366d6; }
.dashboard > .row > [class*="col-"]:nth-child(2) .dashboard-icon { background: #e7f8ef; color: #16a34a !important; fill: #16a34a; }
.dashboard > .row > [class*="col-"]:nth-child(3) .dashboard-icon { background: #fff1e6; color: #ea7a1d !important; fill: #ea7a1d; }
.dashboard > .row > [class*="col-"]:nth-child(4) .dashboard-icon { background: #f1ecfe; color: #7c3aed !important; fill: #7c3aed; }
.dashboard > .row > [class*="col-"]:nth-child(5) .dashboard-icon { background: #fdeef3; color: #e11d48 !important; fill: #e11d48; }
.dashboard > .row > [class*="col-"]:nth-child(6) .dashboard-icon { background: #e6f6fb; color: #0891b2 !important; fill: #0891b2; }

/* Panel cards (Due Payments / Latest Services) */
.card_size {
    border-radius: 16px !important;
    overflow: hidden;
}
.card_size .card-header {
    background: #fff !important;
    border-bottom: 1px solid var(--line) !important;
    padding: 16px 20px !important;
}
.card_size .card-header .subtitle {
    font-weight: 700;
    color: var(--ink);
    font-size: 1.02rem;
    margin: 0;
}
.card_size .card_body {
    padding: 8px 14px 14px !important;
}

/* --------------------------------------------------------------------------
   DataTables controls (search / length / info / pagination) — modern styling
   -------------------------------------------------------------------------- */
.dataTables_wrapper .row {
    flex-wrap: wrap !important;        /* override main.css nowrap (breaks mobile) */
    align-items: center;
    row-gap: 8px;
}
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--line) !important;
    border-radius: 10px !important;
    padding: 8px 14px !important;
    min-width: 220px;
    margin-left: 8px !important;
}
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(19, 102, 214, .15) !important;
    outline: 0;
}
.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--line) !important;
    border-radius: 10px !important;
    padding: 6px 28px 6px 12px !important;
}
.dataTables_wrapper .dataTables_info {
    color: var(--muted);
    font-size: .85rem;
    padding-top: 12px !important;
}
/* Pagination */
.dataTables_wrapper .dataTables_paginate .pagination {
    margin: 10px 0 0;
    gap: 4px;
}
.dataTables_wrapper .pagination .page-link {
    border: 1px solid var(--line);
    border-radius: 8px !important;
    color: var(--ink);
    padding: 6px 12px;
    font-size: .85rem;
    transition: all .15s ease;
}
.dataTables_wrapper .pagination .page-link:hover {
    background: var(--primary-soft);
    border-color: var(--primary-soft);
    color: var(--primary);
}
.dataTables_wrapper .pagination .page-item.active .page-link {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}
.dataTables_wrapper .pagination .page-item.disabled .page-link {
    color: #b9c2d0;
    background: transparent;
}
/* Sort icon colour */
table.dataTable thead .sorting:before,
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
    opacity: .35;
}

/* --------------------------------------------------------------------------
   Responsive tables
   -------------------------------------------------------------------------- */
/* Make every table scroll horizontally inside its card instead of overflowing */
.table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}
.card-body.table-responsive,
.card_body .table-responsive {
    overflow-x: auto !important;
}

/* Dashboard summary panels: give each table full width so dense tables fit,
   and let them scroll on narrow screens. (Layout only — no markup change.) */
@media (min-width: 992px) {
    .dashboard-sec .row > [class*="col-lg-6"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
}
.dashboard-sec .card_body .table.table-responsive {
    display: block;
    overflow-x: auto;
    width: 100%;
}

/* DataTables responsive expand icon colour */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* The old per-page custom search box is now redundant (and can fight
   DataTables' pagination), since DataTables provides its own search. Hide it. */
#searchCustomer {
    display: none !important;
}

/* ==========================================================================
   Compact form pages — tighter spacing & cleaner look on add/edit screens.
   CSS-only: no markup/flow change.
   ========================================================================== */
.main-section {
    padding-top: 14px !important;
    padding-bottom: 14px !important;
}
.main-section .title h5 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--ink);
    margin-bottom: 12px;
}
/* tighten the big white form card */
.main-section .card .card-body {
    padding: 18px 20px !important;
}
/* condense field rows so there's far less dead space */
.main-section .form-group {
    margin-bottom: 12px !important;
}
.main-section .form-group label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 4px;
    display: inline-block;
}
.main-section .form-control,
.main-section .form-select {
    padding: .42rem .7rem;
    font-size: .9rem;
    border-radius: 8px;
}
/* shrink the oversized vertical gaps from m-4 button wrappers */
.main-section .d-flex.justify-content-center .text-center.m-4 {
    margin: 10px 8px !important;
}

/* Section sub-headings inside a form (e.g. Permanent Address) */
.form-section-title {
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--primary-700);
    margin: 6px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
}

/* Delivery address repeatable rows */
.delivery-section {
    margin: 8px 0 16px;
    padding: 14px 16px;
    background: var(--primary-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
}
.delivery-section .form-section-title {
    border-bottom: none;
    margin: 0;
}
.delivery-row {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 10px;
}
.delivery-row .form-group {
    margin-bottom: 0 !important;
}
.delivery-row .remove_delivery_row {
    width: 100%;
}

/* ==========================================================================
   Refinement v3 — premium polish on the existing blue identity (CSS-only).
   Appended last so these win the cascade.
   ========================================================================== */

:root {
    --primary: #1462d8;
    --primary-600: #1056c0;
    --primary-700: #0b449b;
    --primary-soft: #eaf1fe;
    --ink: #1b2536;
    --muted: #6a778d;
    --line: #e8edf4;
    --bg: #f4f6fb;
    --radius: 12px;
    --card-shadow: 0 1px 2px rgba(16,24,40,.04), 0 6px 20px rgba(16,24,40,.06);
}

/* ---- Sidebar: cleaner active/hover, tighter rhythm ---- */
.offcanvas .nav-link.main-nav,
.sidebar .nav-link.main-nav,
.nav-link.main-nav {
    border-radius: 10px;
    margin: 2px 10px;
    padding: 9px 12px !important;
    font-weight: 500;
    transition: background .15s ease, color .15s ease;
}
.nav-link.main-nav:hover {
    background: rgba(255,255,255,.12) !important;
}
.nav-link.main-nav.active,
.nav-item .nav-link.main-nav[aria-current="page"]:focus {
    background: rgba(255,255,255,.16) !important;
    box-shadow: inset 3px 0 0 #fff;
}
.menu-icon { opacity: .95; }

/* ---- Topbar polish ---- */
.topbar, .navbar.topbar, header .navbar {
    box-shadow: 0 1px 0 var(--line);
}

/* ---- Cards: softer, with gentle hover lift ---- */
.card {
    border: 1px solid var(--line) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--card-shadow) !important;
}
.mainpage.card:hover,
.dashboard .card:hover { box-shadow: 0 4px 14px rgba(16,24,40,.08), 0 16px 36px rgba(16,24,40,.10) !important; }

/* ---- Stat cards (dashboard) ---- */
.dashboard .card { transition: transform .15s ease, box-shadow .15s ease; }
.dashboard .card:hover { transform: translateY(-2px); }

/* ---- Tables: denser rows, crisp header ---- */
.card table thead th {
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--muted);
    font-weight: 700;
    border-bottom: 1px solid var(--line) !important;
}
.card table tbody td {
    padding-top: .6rem !important;
    padding-bottom: .6rem !important;
    vertical-align: middle;
    border-color: var(--line) !important;
}
.card table.table-striped tbody tr:nth-of-type(odd) { background: #fbfcfe; }
.card table tbody tr:hover { background: var(--primary-soft) !important; }

/* ---- Row action buttons: inline, compact, icon-sized ---- */
.action-btns { display: flex; gap: 6px; flex-wrap: nowrap; }
.action-btns .btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; padding: 0; border-radius: 8px; line-height: 1;
}

/* ---- Buttons: refined sizing/weight ---- */
.btn { border-radius: 9px; font-weight: 600; }
.btn-sm { border-radius: 8px; }
.add-btn {
    display: inline-flex; align-items: center; gap: 6px;
    border-radius: 9px; font-weight: 600;
}
/* Compact import trigger that sits next to the Add button */
.import-btn {
    display: inline-flex; align-items: center; gap: 6px;
    border-radius: 9px; font-weight: 600;
    color: var(--primary);
    background: #fff;
    border: 1px solid var(--primary);
}
.import-btn:hover { color: #fff; background: var(--primary); border-color: var(--primary); }

/* ---- Forms ---- */
.form-control, .form-select {
    border-radius: 9px;
    border-color: var(--line);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(20,98,216,.12);
}

/* ---- Modals ---- */
.modal-content { border: 0; border-radius: 14px; box-shadow: 0 24px 60px rgba(16,24,40,.22); }
.modal-header { border-bottom: 1px solid var(--line); }

/* ---- Import card + result banner ---- */
.import-card .card-body { padding: 14px 16px !important; }
.import-card .form-label { font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.import-result { border-radius: 10px; }

/* ---- Customer details page ---- */
.detail-card .card-header { background: #fff; border-bottom: 1px solid var(--line); font-weight: 600; }
.detail-photo {
    width: 160px; height: 160px; object-fit: cover;
    border-radius: 14px; border: 1px solid var(--line);
    background: #f3f6fb;
}
.detail-grid .col-md-6, .detail-grid .col-12 { padding-top: 8px; padding-bottom: 8px; }
.detail-grid .dl {
    display: block; font-size: .72rem; text-transform: uppercase;
    letter-spacing: .03em; color: var(--muted); font-weight: 700;
}
.detail-grid .dv { display: block; color: var(--ink); }
.delivery-card {
    border: 1px solid var(--line); border-radius: 10px;
    padding: 12px 14px; background: #fbfcfe; height: 100%;
}
.delivery-card .delivery-label { font-weight: 700; color: var(--primary-700); margin-bottom: 4px; }

/* ---- Login screen polish ---- */
body.login-page, .login-section, .login-wrapper { background: var(--bg); }
.login-section .card, .login-box, form.login-form {
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(16,24,40,.12);
}

/* ---- Tighten page header spacing app-wide ---- */
.main-section .title { margin-bottom: 14px; }
.main-section .title h5 { margin-bottom: 0; }

/* ==========================================================================
   Refinement v4 — kill the header gap + give every page a real title header.
   ========================================================================== */

/* The fixed topbar is 66px. Sit the content right under it (no grey band). */
.main-section {
    margin-top: 18px !important;
    padding: 18px 22px !important;
    background-color: var(--bg) !important;
}
@media (max-width: 479px) {
    .main-section { margin-top: 60px !important; padding: 12px !important; }
}

/* Page title becomes a clean white header card sitting above the content. */
.main-section .title {
    background: #fff !important;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 14px 18px !important;
    margin-bottom: 16px !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.main-section .title h5 {
    margin: 0 !important;
    margin-right: auto !important; /* push action buttons (Add + Import) together on the right */
    padding: 0 !important;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--ink);
}
/* keep the Add/Import buttons snug next to each other */
.main-section .title .add-btn,
.main-section .title .import-btn { margin-left: 8px !important; }

/* Make the first content card flush under the title (no stray top gap). */
.main-section .title + br { display: none; }
.main-section .card { margin-top: 0; }

/* ==========================================================================
   Refinement v5 — definitive sidebar legibility + a clearly bolder look.
   Appended last = wins the cascade. Resolves the washed-out active item and
   guarantees every menu label is high-contrast.
   ========================================================================== */

/* Richer, deeper sidebar so the change is obvious and text pops. */
.offcanvas, .sidebar {
    background: linear-gradient(195deg, #1aa0d8 0%, #0a84c0 50%, #02567d 100%) !important;
}

/* Every top-level + submenu label = full white, readable. */
.offcanvas .nav-link,
.navbar-nav .nav-link,
.offcanvas .dropdown-toggle,
.offcanvas .dropdown-item,
.navbar-nav .nav-link .menu-icon,
.navbar-nav .nav-link i {
    color: #ffffff !important;
    opacity: 1 !important;
}

/* Hover: subtle translucent panel, text stays white. */
.navbar-nav .nav-link:hover,
.offcanvas .nav-link:hover,
.offcanvas .dropdown-toggle:hover {
    background-color: rgba(255, 255, 255, .16) !important;
    color: #ffffff !important;
}

/* ACTIVE (current page): solid white pill + blue bold text + left accent.
   One unambiguous rule, beats the earlier conflicting ones. */
.navbar-nav .nav-link.active,
.navbar-nav .nav-link.main-nav.active,
.offcanvas .nav-link.active,
.offcanvas .dropdown-toggle.active,
.offcanvas .dropdown-item.active {
    background: #ffffff !important;
    color: #02567d !important;
    font-weight: 700 !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .18) !important;
}
.navbar-nav .nav-link.active .menu-icon,
.navbar-nav .nav-link.active i,
.offcanvas .nav-link.active .menu-icon {
    color: #02567d !important;
}

/* Submenu panel + items clearly visible; hover = white pill, blue text. */
.offcanvas .dropdown-menu {
    background-color: rgba(0, 0, 0, .16) !important;
    border: 1px solid rgba(255, 255, 255, .15) !important;
}
.offcanvas .dropdown-item:hover {
    background-color: #ffffff !important;
    color: #02567d !important;
}
.offcanvas .dropdown-item:hover::before { background: #02567d !important; }

/* Brand area divider for a more finished header. */
.header { border-bottom: 1px solid var(--line); }

/* ==========================================================================
   Refinement v6 (2026-06-16) — uniform add/edit form field alignment.
   The add/edit forms use a mix of label lengths; short labels are 1 line and
   long ones ("Rent Price(Per Day)", "Mode/Terms of Payment") wrap to 2, which
   pushed their inputs out of line and made each row look jagged. Reserving a
   fixed label height + consistent column spacing makes every field line up on
   a clean grid. CSS-only, no markup change.
   ========================================================================== */
.main-section .card form .row > [class*="col-"],
.modal .card form .row > [class*="col-"] { margin-bottom: 6px; }

.main-section .form-group,
.modal-body .form-group { margin-bottom: 14px; }

/* Reserve two lines for every field label so 1-line and 2-line labels both
   start their input at the same vertical position. */
.main-section .card form .form-group > label,
.modal-body .form-group > label {
    display: block;
    min-height: 2.3em;
    line-height: 1.15;
    margin-bottom: 5px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--ink);
}

/* Inputs fill their column and share one height so rows read as a grid. */
.main-section .card form .form-control,
.main-section .card form .form-select,
.modal-body .form-control,
.modal-body .form-select { width: 100%; }

/* Keep the rows aligned to the top even when a control is taller. */
.main-section .card form .row,
.modal-body .row { align-items: flex-start; }

/* Textareas shouldn't inherit the 2-line label reserve oddly; give breathing room. */
.main-section .card form textarea.form-control { min-height: 84px; }

/* ---- Customer full-history page ---- */
.hist-stat {
    display: flex; flex-direction: column; gap: 2px;
    padding: 10px 6px; border-radius: 12px; background: var(--primary-soft);
}
.hist-stat .hs-val { font-weight: 800; font-size: .95rem; color: var(--primary); }
.hist-stat .hs-lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.hist-stat.hs-ok  { background: #e7f7ee; }
.hist-stat.hs-ok  .hs-val { color: var(--success); }
.hist-stat.hs-due { background: #fdeaec; }
.hist-stat.hs-due .hs-val { color: var(--danger); }
#histTabs .nav-link { color: var(--muted); font-weight: 600; border: 0; }
#histTabs .nav-link.active { color: var(--primary); background: #fff; border: 1px solid var(--line); border-bottom-color: #fff; }

/* ==========================================================================
   Amount summary panel (rent/sales add) — professional invoice-style totals.
   Replaces the old offset-column + label-inside-input-group layout that
   misaligned the tax rows. CSS-only; markup uses .amount-summary > .as-line.
   ========================================================================== */
.amount-summary {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fbfdff;
    padding: 6px 14px;
    box-shadow: var(--card-shadow);
}
.amount-summary .as-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--line);
}
.amount-summary .as-line:last-child { border-bottom: 0; }
.amount-summary .as-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.amount-summary .as-label i { font-style: normal; color: var(--muted); }
/* small inline rate box (the GST %) */
.amount-summary .as-rate {
    width: 48px;
    text-align: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 1px 4px;
    font-size: .78rem;
    background: #fff;
}
/* the value field: ₹ prefix + input, right aligned, fixed width */
.amount-summary .as-field {
    display: flex;
    align-items: center;
    gap: 0;
    width: 170px;
    max-width: 55%;
}
.amount-summary .as-field .as-cur {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 30px; height: 36px;
    border: 1px solid var(--line); border-right: 0;
    border-radius: 8px 0 0 8px;
    background: #f3f6fc; color: var(--muted); font-weight: 600;
}
.amount-summary .as-field .form-control {
    height: 36px;
    border-radius: 0 8px 8px 0;
    text-align: right;
    font-weight: 600;
    padding: 6px 10px;
}
/* Grand total row stands out */
.amount-summary .as-grand .as-label { color: var(--ink); font-weight: 800; font-size: .9rem; }
.amount-summary .as-grand .form-control { color: var(--primary); font-weight: 800; background: var(--primary-soft); }
/* The v6 label-height reserve must NOT apply inside the summary panel. */
.main-section .card form .amount-summary .form-group > label { min-height: 0; }

/* ==========================================================================
   Select2 refinement (2026-06-18)
   The searchable dropdowns used raw defaults: clipped selection text, a stray
   horizontal/bottom scrollbar in the results, and text that didn't match the
   form controls. This block aligns Select2 with the app's form sizing + font.
   ========================================================================== */
.select2-container { width: 100% !important; }

/* The closed control: same height/border/feel as .form-select, text vertically centred */
.select2-container--bootstrap-5 .select2-selection,
.select2-container .select2-selection--single {
    min-height: calc(1.5em + .75rem + 2px);
    height: auto;
    padding: .375rem .75rem;
    border: 1px solid var(--line);
    border-radius: .5rem;
    display: flex;
    align-items: center;
    font-size: .9rem;
    color: var(--ink);
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered,
.select2-container .select2-selection__rendered {
    padding: 0;
    line-height: 1.5;
    color: var(--ink);
    /* one clean line — ellipsis instead of overflow/clip */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow,
.select2-container .select2-selection__arrow { height: 100%; top: 0; right: 6px; }

/* The open dropdown panel */
.select2-container--bootstrap-5 .select2-dropdown,
.select2-dropdown {
    border: 1px solid var(--line);
    border-radius: .5rem;
    box-shadow: 0 6px 24px rgba(16,24,40,.12);
    font-size: .9rem;
}
.select2-results__options {
    overflow-x: hidden !important;   /* kill the stray bottom/horizontal scrollbar */
    max-height: 260px;
}
.select2-container--bootstrap-5 .select2-results__option,
.select2-results__option {
    padding: 7px 12px;
    line-height: 1.4;
    white-space: normal;             /* wrap long option text rather than scroll */
    word-break: break-word;
    color: var(--ink);
}
.select2-container--bootstrap-5 .select2-results__option--highlighted,
.select2-results__option--highlighted[aria-selected] {
    background: var(--primary) !important;
    color: #fff !important;
}
/* search box inside the dropdown */
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field,
.select2-search--dropdown .select2-search__field {
    padding: .35rem .6rem;
    border: 1px solid var(--line);
    border-radius: .4rem;
    font-size: .9rem;
}
/* keep Select2 the right height when it sits in a Bootstrap modal */
.modal .select2-container { z-index: 1060; }
