/* ============================================================
   Solar CRM — ERP theme  (ForLogicx School-ERP style)
   White sidebar · steel-navy primary · soft dotted pills
   Base: Bootstrap 5 · this file is the full design system
   ============================================================ */
:root {
    --brand: #1d4e7a;            /* steel navy */
    --brand-2: #2f6aa3;
    --brand-dark: #163a5c;
    --brand-rgb: 29, 78, 122;
    --brand-soft: #eaf1f8;

    --ink: #1a2332;              /* headings */
    --body: #4b5563;            /* slate-600 */
    --muted: #94a3b8;           /* slate-400 */
    --line: #e7eaf0;            /* borders */
    --line-2: #eef1f6;
    --bg: #f4f6fa;              /* app background */
    --card: #ffffff;

    --side-bg: #ffffff;          /* WHITE sidebar */
    --side-ink: #475160;
    --side-icon: #7c8699;
    --side-muted: #9aa3b2;
    --side-active-bg: rgba(29, 78, 122, .09);

    --ok: #12b76a; --ok-rgb: 18,183,106; --ok-soft: #e9f9f1;
    --warn: #f79009; --warn-rgb: 247,144,9; --warn-soft: #fef3e2;
    --bad: #f04438; --bad-rgb: 240,68,56; --bad-soft: #fdecea;
    --info: #0ba5ec; --info-rgb: 11,165,236; --info-soft: #e7f6fd;
    --sec: #64748b; --sec-rgb: 100,116,139; --sec-soft: #eef1f5;

    --radius: 12px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(16,24,40,.05);
    --shadow-md: 0 4px 18px rgba(16,24,40,.09);
    --sidebar-w: 256px;
    --bs-primary: #1d4e7a;
    --bs-primary-rgb: 29, 78, 122;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--body);
    font-size: .89rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
h1,h2,h3,h4,h5,h6 { color: var(--ink); font-weight: 700; }
::selection { background: rgba(var(--brand-rgb), .14); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #d2d8e2; border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: #b3bcca; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    position: fixed; inset: 0 auto 0 0; z-index: 1040;
    background: var(--side-bg);
    color: var(--side-ink);
    display: flex; flex-direction: column;
    border-right: 1px solid var(--line);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.brand {
    display: flex; align-items: center; gap: .65rem;
    padding: 1.1rem 1.25rem; position: relative;
    border-bottom: 1px solid var(--line);
}
.brand .logo {
    width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
    background: var(--brand); display: grid; place-items: center; color: #fff; font-size: 1.3rem;
    box-shadow: 0 4px 10px rgba(var(--brand-rgb), .3);
}
.brand .name { font-size: 1.05rem; font-weight: 800; color: var(--ink); letter-spacing: .1px; line-height: 1.15; }
.brand .name span { color: var(--brand); }
.brand .sub { font-size: .68rem; color: var(--muted); font-weight: 500; }

.side-scroll { flex: 1; overflow-y: auto; padding: .6rem .7rem 1.5rem; }
.side-scroll::-webkit-scrollbar { width: 6px; }
.side-scroll::-webkit-scrollbar-thumb { background: #e2e6ee; }
.nav-head {
    font-size: .66rem; text-transform: uppercase; letter-spacing: 1.1px;
    color: var(--side-muted); font-weight: 700; padding: 1rem .85rem .35rem;
}
.nav-link2 {
    display: flex; align-items: center; gap: .75rem;
    padding: .6rem .85rem; margin: .1rem 0; border-radius: 9px;
    color: var(--side-ink); font-weight: 500; font-size: .88rem;
    position: relative; transition: all .14s ease;
}
.nav-link2 i { font-size: 1.2rem; width: 22px; text-align: center; color: var(--side-icon); transition: color .14s; }
.nav-link2:hover { background: #f4f6fa; color: var(--ink); }
.nav-link2:hover i { color: var(--body); }
.nav-link2.active {
    background: var(--side-active-bg); color: var(--brand); font-weight: 600;
}
.nav-link2.active::before {
    content: ""; position: absolute; left: -.7rem; top: 50%; transform: translateY(-50%);
    width: 3px; height: 60%; background: var(--brand); border-radius: 0 3px 3px 0;
}
.nav-link2.active i { color: var(--brand); }
.nav-badge { margin-left: auto; background: var(--bad); color: #fff; font-size: .66rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; }

/* ---------- Main ---------- */
.app-main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: 60px; position: sticky; top: 0; z-index: 1030;
    background: #fff; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 1rem; padding: 0 1.4rem;
}
.topbar .menu-toggle { border: 0; background: transparent; font-size: 1.4rem; color: var(--body); cursor: pointer; display: none; }
.topbar .tb-page { font-weight: 700; color: var(--ink); font-size: 1rem; }
.topbar .spacer { flex: 1; }
.tb-search { position: relative; width: 320px; max-width: 36vw; }
.tb-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.05rem; }
.tb-search input { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 9px; background: #f7f8fb; padding: 0 .8rem 0 2.2rem; font-size: .85rem; color: var(--ink); outline: none; transition: all .15s; }
.tb-search input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .12); }
.tb-icon-btn { position: relative; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--body); display: grid; place-items: center; cursor: pointer; font-size: 1.15rem; }
.tb-icon-btn:hover { background: #f4f6fa; color: var(--brand); }
.tb-icon-btn .dot { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; background: var(--bad); color: #fff; border-radius: 8px; font-size: .62rem; font-weight: 700; display: grid; place-items: center; padding: 0 4px; border: 2px solid #fff; }

.app-content { padding: 1.5rem; flex: 1; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .5rem; margin-bottom: 1.25rem; }
.page-title { font-size: 1.45rem; font-weight: 800; margin: 0; }
.crumb { display: flex; align-items: center; gap: 0; font-size: .82rem; color: var(--muted); list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.crumb > a { color: var(--muted); } .crumb > a:hover { color: var(--brand); }
.crumb .breadcrumb-item { display: inline-flex; align-items: center; color: var(--muted); }
.crumb .breadcrumb-item::before { content: "/"; color: var(--muted); margin: 0 .45rem; opacity: .6; }
.crumb .breadcrumb-item a { color: var(--muted); }
.crumb .breadcrumb-item a:hover { color: var(--brand); }
.crumb .breadcrumb-item.active { color: var(--ink); font-weight: 600; }
.app-footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem 0 1.25rem; }

/* ---------- Cards ---------- */
.card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 1.25rem;
}
.card-header {
    background: transparent; border-bottom: 1px solid var(--line);
    padding: 1rem 1.3rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem;
}
.card-title, .card-header h5 { margin: 0; font-size: 1.02rem; font-weight: 700; color: var(--ink); }
.card-body { padding: 1.3rem; }
.card-footer { background: transparent; border-top: 1px solid var(--line); padding: .9rem 1.3rem; }

/* ---------- Buttons ---------- */
.btn { font-weight: 600; border-radius: 9px; padding: .5rem 1.05rem; font-size: .86rem; transition: all .15s ease; }
.btn-sm { padding: .35rem .75rem; font-size: .81rem; border-radius: 8px; }
.btn-primary { background: var(--brand); border: 1px solid var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color:#fff; }
.btn-light, .btn-secondary { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn-light:hover, .btn-secondary:hover { background: #f4f6fa; border-color: #d8dde6; color: var(--ink); }
.btn-outline-primary { border: 1px solid var(--brand); color: var(--brand); background: #fff; }
.btn-outline-primary:hover { background: var(--brand); color: #fff; }

/* soft "label" buttons + badges */
.btn-label-primary { background: var(--brand-soft); color: var(--brand); border: none; }
.btn-label-primary:hover { background: var(--brand); color: #fff; }
.btn-label-secondary { background: var(--sec-soft); color: #51607a; border: none; }
.btn-label-secondary:hover { background: var(--sec); color: #fff; }
.btn-label-success { background: var(--ok-soft); color: #0a9355; border: none; }
.btn-label-success:hover { background: var(--ok); color: #fff; }
.btn-label-danger { background: var(--bad-soft); color: #d92d20; border: none; }
.btn-label-danger:hover { background: var(--bad); color: #fff; }
.btn-label-info { background: var(--info-soft); color: #0086c9; border: none; }
.btn-label-info:hover { background: var(--info); color: #fff; }
.btn-text-primary { background: transparent; color: var(--brand); border: none; }
.btn-text-danger { background: transparent; color: var(--bad); border: none; }
.btn-text-info { background: transparent; color: var(--info); border: none; }
.btn-icon { width: 35px; height: 35px; padding: 0; display: inline-grid; place-items: center; }
.btn-icon.btn-sm { width: 31px; height: 31px; }

/* ---------- Badges (soft pills with leading dot) ---------- */
.badge { font-weight: 600; padding: .36em .7em; border-radius: 7px; font-size: .73rem; }
.badge.rounded-pill { border-radius: 30px; padding: .36em .75em .36em .65em; }
.badge.rounded-pill[class*="bg-label-"]::before {
    content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
    background: currentColor; margin-right: 5px; vertical-align: middle; margin-top: -1px;
}
.bg-primary { background: var(--brand) !important; }
.bg-label-primary { background: var(--brand-soft); color: var(--brand); }
.bg-label-success { background: var(--ok-soft); color: #0a9355; }
.bg-label-danger  { background: var(--bad-soft); color: #d92d20; }
.bg-label-warning { background: var(--warn-soft); color: #dc6803; }
.bg-label-info    { background: var(--info-soft); color: #0086c9; }
.bg-label-secondary { background: var(--sec-soft); color: #51607a; }
.text-primary { color: var(--brand) !important; }
.text-warning { color: var(--warn) !important; }
.text-success { color: var(--ok) !important; }
.text-danger { color: var(--bad) !important; }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; color: var(--ink); margin-bottom: .35rem; font-size: .83rem; }
.form-control, .form-select {
    border: 1px solid var(--line); border-radius: 9px; padding: .52rem .8rem;
    font-size: .87rem; color: var(--ink); background-color: #fff; transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .12); background:#fff;
}
.form-control::placeholder { color: #aab2c0; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-switch .form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .13); border-color: var(--brand); }
.input-group-text { background: #f4f6fa; border: 1px solid var(--line); color: var(--muted); border-radius: 9px; }

/* ---------- Tables ---------- */
.table { color: var(--body); margin: 0; }
.table > thead th {
    background: #f8fafc; color: var(--muted); font-weight: 700; font-size: .71rem;
    text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--line); padding: .8rem 1rem; white-space: nowrap;
}
.table > tbody > tr > td { padding: .82rem 1rem; border-top: 1px solid var(--line); vertical-align: middle; color: var(--ink); font-size: .86rem; }
.table-hover > tbody > tr:hover > td { background: #f7f9fc; }
.table-bordered, .table-bordered td, .table-bordered th { border: 1px solid var(--line); }

/* DataTables chrome */
.dataTables_wrapper .row { align-items: center; }
.dataTables_length select, .dataTables_filter input {
    border: 1px solid var(--line) !important; border-radius: 8px; padding: .4rem .7rem; outline: none; background:#f7f8fb;
}
.dataTables_filter input:focus, .dataTables_length select:focus { border-color: var(--brand) !important; box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .12); background:#fff; }
.dataTables_info { color: var(--muted); font-size: .82rem; }
.dataTables_paginate { padding-top: 4px; }
.pagination { display: flex; gap: 5px; align-items: center; margin: 0; }
.pagination .page-item .page-link {
    margin: 0; min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
    color: var(--body); border: 1px solid var(--line); border-radius: 8px !important; font-size: .82rem;
    padding: 0 11px; background: #fff; line-height: 1; transition: all .12s; font-weight: 500;
}
.pagination .page-item .page-link:hover { background: #f4f6fa; border-color: var(--brand); color: var(--brand); }
.pagination .page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .page-item.disabled .page-link { opacity: .5; color: var(--muted); background: #fff; }
.pagination .page-link:focus { box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .12); outline: none; }

/* ---------- Avatars ---------- */
.avatar { width: 40px; height: 40px; position: relative; display: inline-block; }
.avatar-initial { width: 100%; height: 100%; display: grid; place-items: center; font-weight: 700; border-radius: 50%; font-size: .82rem; }
.avatar-xl { width: 84px; height: 84px; }
.avatar-online::after { content:""; position:absolute; right:1px; bottom:1px; width:10px; height:10px; border-radius:50%; background:var(--ok); border:2px solid #fff; }

/* ---------- Dropdown / Modal ---------- */
.dropdown-menu { border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow-md); padding: .35rem; font-size: .86rem; }
.dropdown-item { border-radius: 8px; padding: .48rem .75rem; color: var(--body); }
.dropdown-item:hover { background: #f4f6fa; color: var(--brand); }
.dropdown-item.text-danger:hover { background: var(--bad-soft); color: var(--bad); }
.modal-content { border: none; border-radius: var(--radius); box-shadow: 0 20px 60px rgba(16,24,40,.2); }
.modal-header { border-bottom: 1px solid var(--line); padding: 1rem 1.3rem; }
.modal-footer { border-top: 1px solid var(--line); }

/* ---------- Stat cards (dashboard) — soft tinted icons ---------- */
.stat-card { display: flex; align-items: center; gap: 1rem; }
.stat-ico { width: 50px; height: 50px; border-radius: 12px; display: grid; place-items: center; font-size: 1.4rem; flex-shrink: 0; }
.stat-num { font-size: 1.55rem; font-weight: 800; color: var(--ink); line-height: 1.1; }
.stat-lbl { color: var(--muted); font-size: .82rem; }
.g-primary { background: var(--brand-soft); color: var(--brand); }
.g-accent  { background: var(--warn-soft); color: #dc6803; }
.g-success { background: var(--ok-soft); color: #0a9355; }
.g-info    { background: var(--info-soft); color: #0086c9; }
.g-danger  { background: var(--bad-soft); color: #d92d20; }

/* ---------- select2 polish ---------- */
.select2-container { max-width: 100%; }
.select2-container--default .select2-selection--single {
    height: 40px; border: 1px solid var(--line); border-radius: 9px; display: flex; align-items: center; background:#fff;
}
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: normal; color: var(--ink); padding-left: .8rem; font-size: .87rem; }
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: #aab2c0; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 38px; }
.select2-container--open .select2-selection--single,
.select2-container--focus .select2-selection--single { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .12); }
.select2-dropdown { border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow-md); }
.select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--brand); }
.select2-container--default .select2-results__option[aria-selected=true] { background: var(--brand-soft); color: var(--brand); }
.select2-search--dropdown .select2-search__field { border: 1px solid var(--line); border-radius: 8px; }
/* DataTables "Show entries" length menu — compact inline select2 (no search; dropdown = box width) */
.dataTables_length .select2-container { margin: 0 5px; vertical-align: middle; }
.dataTables_length .select2-container--default .select2-selection--single { height: 34px; }
.dataTables_length .select2-container--default .select2-selection--single .select2-selection__rendered { padding-right: 20px; }
.dataTables_length .select2-container--default .select2-selection--single .select2-selection__arrow { height: 32px; }
.dataTables_length label { display: inline-flex; align-items: center; }

/* ---------- flatpickr ---------- */
.flatpickr-calendar { border-radius: 11px; box-shadow: var(--shadow-md); border: 1px solid var(--line); }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: var(--brand); border-color: var(--brand); }
.flatpickr-day.today { border-color: var(--brand); }
.flatpickr-day:hover { background: var(--brand-soft); border-color: transparent; }
.flatpickr-months .flatpickr-month, .flatpickr-weekdays, span.flatpickr-weekday { color: var(--ink); fill: var(--ink); }
/* calendar icon inside date inputs */
input.flatpickr-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5' width='16' height='16' rx='2'/%3E%3Cline x1='16' y1='3' x2='16' y2='7'/%3E%3Cline x1='8' y1='3' x2='8' y2='7'/%3E%3Cline x1='4' y1='11' x2='20' y2='11'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    background-size: 17px 17px;
    padding-right: 38px;
    cursor: pointer;
}
/* flatpickr month dropdown + year — proper themed */
.flatpickr-current-month .flatpickr-monthDropdown-months {
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    font-size: 14px; font-weight: 600; color: var(--ink);
    background-color: transparent; border: 1px solid transparent; border-radius: 7px;
    padding: 4px 26px 4px 10px; margin: 0 2px; cursor: pointer; transition: background .12s, border-color .12s, box-shadow .12s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2346586B' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 7px center; background-size: 14px;
}
.flatpickr-current-month .flatpickr-monthDropdown-months:hover { background-color: var(--brand-soft); border-color: var(--line); }
.flatpickr-current-month .flatpickr-monthDropdown-months:focus { background-color: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .12); outline: none; }
.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month { background: #fff; color: var(--ink); font-weight: 500; }
.flatpickr-current-month input.cur-year { font-weight: 600; color: var(--ink); }
.flatpickr-current-month .numInputWrapper:hover { background: var(--brand-soft); border-radius: 6px; }
.flatpickr-current-month { display: inline-flex; align-items: center; gap: 2px; }

/* ---------- misc ---------- */
.text-muted { color: var(--muted) !important; }
.fw-medium { font-weight: 600; }
.cursor-pointer { cursor: pointer; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(16,24,40,.4); z-index: 1035; }
hr { border-color: var(--line); opacity: 1; }
.alert-danger { background: var(--bad-soft); border: 1px solid rgba(var(--bad-rgb), .25); color: #d92d20; border-radius: 10px; }
.alert-info { background: var(--info-soft); border: 1px solid rgba(var(--info-rgb), .25); color: #0086c9; border-radius: 10px; }

/* responsive */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); box-shadow: 4px 0 24px rgba(16,24,40,.12); }
    .sidebar.open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .topbar .menu-toggle { display: block; }
    .topbar .tb-search { width: 180px; }
    .sidebar-overlay.show { display: block; }
}
