/* ==========================================================================
   Vedhatech Leads — theme built from the logo colours
   Navy  #001F5D  (primary: sidebar, headings, buttons)
   Amber #FBB001  (accent: active items, highlights, calls to action)
   ========================================================================== */

:root {
    --vt-navy: #001F5D;
    --vt-navy-700: #0A2C74;
    --vt-navy-900: #00153F;
    --vt-amber: #FBB001;
    --vt-amber-600: #E09D00;
    --vt-amber-soft: #FFF6DC;
    --vt-bg: #F3F5FA;
    --vt-surface: #FFFFFF;
    --vt-border: #E3E7F0;
    --vt-text: #1C2740;
    --vt-muted: #6B7690;
    --vt-sidebar-width: 260px;
    --vt-topbar-height: 64px;
    --vt-radius: 14px;
    --vt-shadow: 0 1px 2px rgba(0, 31, 93, .05), 0 6px 20px rgba(0, 31, 93, .06);

    --bs-primary: var(--vt-navy);
    --bs-primary-rgb: 0, 31, 93;
    --bs-body-color: var(--vt-text);
    --bs-link-color: var(--vt-navy);
    --bs-link-color-rgb: 0, 31, 93;
    --bs-link-hover-color: var(--vt-navy-700);
    --bs-link-hover-color-rgb: 10, 44, 116;
    --bs-border-color: var(--vt-border);
    --bs-secondary-color: var(--vt-muted);
    --bs-font-sans-serif: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

html { -webkit-text-size-adjust: 100%; }

body {
    background: var(--vt-bg);
    color: var(--vt-text);
    font-size: .95rem;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 { color: var(--vt-navy); font-weight: 700; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.text-navy { color: var(--vt-navy) !important; }
.text-amber { color: var(--vt-amber-600) !important; }
.text-muted { color: var(--vt-muted) !important; }
.fw-600 { font-weight: 600; }

/* ---------- Buttons ---------- */
.btn { border-radius: 10px; font-weight: 600; text-decoration: none !important; }
.btn-primary {
    --bs-btn-bg: var(--vt-navy);
    --bs-btn-border-color: var(--vt-navy);
    --bs-btn-hover-bg: var(--vt-navy-700);
    --bs-btn-hover-border-color: var(--vt-navy-700);
    --bs-btn-active-bg: var(--vt-navy-900);
    --bs-btn-active-border-color: var(--vt-navy-900);
    --bs-btn-disabled-bg: var(--vt-navy);
    --bs-btn-disabled-border-color: var(--vt-navy);
    --bs-btn-focus-shadow-rgb: 251, 176, 1;
}
.btn-accent {
    --bs-btn-color: var(--vt-navy);
    --bs-btn-bg: var(--vt-amber);
    --bs-btn-border-color: var(--vt-amber);
    --bs-btn-hover-color: var(--vt-navy);
    --bs-btn-hover-bg: var(--vt-amber-600);
    --bs-btn-hover-border-color: var(--vt-amber-600);
    --bs-btn-active-color: var(--vt-navy);
    --bs-btn-active-bg: var(--vt-amber-600);
    --bs-btn-active-border-color: var(--vt-amber-600);
    --bs-btn-focus-shadow-rgb: 0, 31, 93;
}
.btn-outline-primary {
    --bs-btn-color: var(--vt-navy);
    --bs-btn-border-color: var(--vt-navy);
    --bs-btn-hover-bg: var(--vt-navy);
    --bs-btn-hover-border-color: var(--vt-navy);
    --bs-btn-active-bg: var(--vt-navy);
    --bs-btn-active-border-color: var(--vt-navy);
    --bs-btn-focus-shadow-rgb: 251, 176, 1;
}
.btn-light { --bs-btn-bg: #EEF1F7; --bs-btn-border-color: #EEF1F7; --bs-btn-hover-bg: #E1E6F0; --bs-btn-hover-border-color: #E1E6F0; }
.btn-icon {
    width: 36px; height: 36px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px;
}

/* ---------- Forms ---------- */
.form-label { font-weight: 600; color: var(--vt-navy); margin-bottom: .35rem; font-size: .875rem; }
.form-control, .form-select { border-radius: 10px; border-color: #D5DBE8; min-height: 42px; }
textarea.form-control { min-height: 96px; }
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: var(--vt-amber);
    box-shadow: 0 0 0 .2rem rgba(251, 176, 1, .25);
}
.form-check-input:checked { background-color: var(--vt-navy); border-color: var(--vt-navy); }
.form-control-color { min-height: 42px; width: 64px; padding: .3rem; }
.input-group-text { background: #F6F8FC; border-color: #D5DBE8; color: var(--vt-muted); border-radius: 10px; }
.required::after { content: " *"; color: #DC3545; }

/* ---------- App shell ---------- */
.sidebar { --bs-offcanvas-width: 280px; --bs-offcanvas-bg: var(--vt-navy); border: 0 !important; }
.sidebar-inner {
    display: flex; flex-direction: column;
    height: 100%; width: 100%;
    background: linear-gradient(180deg, var(--vt-navy) 0%, var(--vt-navy-900) 100%);
    color: #fff;
}
.sidebar-brand {
    background: #fff;
    padding: .9rem 1rem;
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    border-bottom: 4px solid var(--vt-amber);
    min-height: var(--vt-topbar-height);
}
.sidebar-brand img { width: 100%; max-width: 200px; height: auto; display: block; }
.sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: 1rem .75rem; }
.sidebar-label {
    font-size: .7rem; letter-spacing: .08em; text-transform: uppercase;
    color: rgba(255, 255, 255, .5); padding: 0 .75rem; margin: .25rem 0 .5rem;
}
.sidebar-link {
    display: flex; align-items: center; gap: .75rem;
    padding: .7rem .85rem; margin-bottom: .2rem;
    border-radius: 10px;
    color: rgba(255, 255, 255, .82); font-weight: 600;
    text-decoration: none !important;
    transition: background-color .15s ease, color .15s ease;
}
.sidebar-link i { font-size: 1.1rem; width: 1.25rem; text-align: center; }
.sidebar-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar-link.active { background: var(--vt-amber); color: var(--vt-navy); box-shadow: 0 4px 12px rgba(0, 0, 0, .18); }
.sidebar-foot {
    padding: .85rem 1rem; border-top: 1px solid rgba(255, 255, 255, .1);
    display: flex; align-items: center; gap: .65rem; min-width: 0;
}
.sidebar-foot .name { font-weight: 600; line-height: 1.2; }
.sidebar-foot .role { font-size: .75rem; color: rgba(255, 255, 255, .6); }

.avatar {
    flex: 0 0 auto;
    width: 38px; height: 38px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--vt-amber); color: var(--vt-navy);
    font-weight: 700; font-size: .85rem;
}
.avatar-navy { background: var(--vt-navy); color: #fff; }
.avatar-sm { width: 32px; height: 32px; font-size: .75rem; }

.app-main { min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    position: sticky; top: 0; z-index: 1020;
    height: var(--vt-topbar-height);
    background: var(--vt-surface);
    border-bottom: 1px solid var(--vt-border);
    display: flex; align-items: center; gap: .75rem;
    padding: 0 1rem;
}
.topbar-title { font-size: 1.1rem; font-weight: 700; color: var(--vt-navy); margin: 0; min-width: 0; }
.topbar .dropdown-toggle { text-decoration: none !important; color: var(--vt-text); }
.topbar .dropdown-toggle::after { margin-left: .5rem; }
.app-content { flex: 1 1 auto; padding: 1.25rem 1rem 2rem; width: 100%; max-width: 1500px; margin: 0 auto; }
.app-footer { padding: 1rem; text-align: center; font-size: .8rem; color: var(--vt-muted); }

@media (min-width: 992px) {
    .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: var(--vt-sidebar-width); z-index: 1030; }
    .app-main { margin-left: var(--vt-sidebar-width); }
    .topbar { padding: 0 1.75rem; }
    .app-content { padding: 1.75rem 1.75rem 2.5rem; }
}

/* ---------- Page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.4rem; margin: 0; }
.page-head p { margin: .15rem 0 0; color: var(--vt-muted); }

/* ---------- Cards ---------- */
.card { border: 1px solid var(--vt-border); border-radius: var(--vt-radius); box-shadow: var(--vt-shadow); }
.card-header {
    background: transparent; border-bottom: 1px solid var(--vt-border);
    padding: .9rem 1.15rem; font-weight: 700; color: var(--vt-navy);
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
.card-header:first-child { border-radius: var(--vt-radius) var(--vt-radius) 0 0; }
.card-body { padding: 1.15rem; }
.card-footer { background: transparent; border-top: 1px solid var(--vt-border); padding: .85rem 1.15rem; }

.stat-card { position: relative; overflow: hidden; height: 100%; }
.stat-card .card-body { display: flex; align-items: center; gap: .9rem; }
.stat-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--vt-amber); }
.stat-icon {
    flex: 0 0 auto; width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 31, 93, .08); color: var(--vt-navy); font-size: 1.35rem;
}
.stat-card.is-accent .stat-icon { background: var(--vt-amber-soft); color: var(--vt-amber-600); }
.stat-value { font-size: 1.65rem; font-weight: 800; color: var(--vt-navy); line-height: 1.1; }
.stat-label { color: var(--vt-muted); font-size: .82rem; font-weight: 600; }

.breakdown-row + .breakdown-row { margin-top: .9rem; }
.breakdown-row .progress { height: 8px; border-radius: 99px; background: #EDF0F6; }
.breakdown-row .progress-bar { border-radius: 99px; background: var(--vt-navy); }

/* ---------- Badges ---------- */
.badge { font-weight: 600; letter-spacing: .01em; border-radius: 99px; padding: .4em .75em; }
.badge-soft { background: rgba(0, 31, 93, .08); color: var(--vt-navy); }
.badge-amber { background: var(--vt-amber-soft); color: #7A5600; }
.badge-success-soft { background: #E3F5EC; color: #146C43; }
.badge-muted { background: #EEF1F7; color: var(--vt-muted); }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; vertical-align: middle; }
.table > thead > tr > th {
    background: #F6F8FC; color: var(--vt-muted);
    font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
    border-bottom: 1px solid var(--vt-border); padding: .75rem 1rem; white-space: nowrap;
}
.table > tbody > tr > td { padding: .8rem 1rem; border-color: var(--vt-border); }
.table > tbody > tr:last-child > td { border-bottom: 0; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #FAFBFE; }
.cell-actions { white-space: nowrap; text-align: right; }
.cell-actions form { display: inline; }

/* On phones every table row becomes a small card with "label: value" lines. */
@media (max-width: 767.98px) {
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { padding: .85rem 1rem; border-bottom: 1px solid var(--vt-border); }
    .table-stack tr:last-child { border-bottom: 0; }
    .table-stack > tbody > tr > td {
        display: flex; justify-content: space-between; align-items: center; gap: 1rem;
        padding: .25rem 0; border: 0; text-align: right;
        overflow-wrap: anywhere;
    }
    .table-stack td::before {
        content: attr(data-label);
        flex: 0 0 auto; text-align: left;
        color: var(--vt-muted); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    }
    .table-stack td.cell-primary { display: block; text-align: left; padding-bottom: .4rem; font-size: 1.02rem; }
    .table-stack td.cell-primary::before, .table-stack td.cell-actions::before, .table-stack td.cell-empty::before { content: none; }
    .table-stack td.cell-actions { justify-content: flex-end; padding-top: .6rem; gap: .4rem; }
    .table-stack td.cell-empty { display: block; text-align: center; }
}

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--vt-muted); }
.empty-state i { font-size: 2.5rem; color: #C3CBDD; display: block; margin-bottom: .5rem; }

/* ---------- Pagination ---------- */
.pagination { --bs-pagination-color: var(--vt-navy); --bs-pagination-hover-color: var(--vt-navy); --bs-pagination-active-bg: var(--vt-navy); --bs-pagination-active-border-color: var(--vt-navy); --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgba(251, 176, 1, .25); margin-bottom: 0; flex-wrap: wrap; }
.page-link { text-decoration: none !important; }

/* ---------- Lead details & notes ---------- */
.detail-list { margin: 0; }
.detail-list dt { color: var(--vt-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.detail-list dd { margin-bottom: 1rem; font-weight: 600; overflow-wrap: anywhere; }
.detail-list dd:last-child { margin-bottom: 0; }

.note-list { list-style: none; margin: 0; padding: 0; }
.note-item { position: relative; padding: 0 0 1.25rem 2.9rem; }
.note-item::before { content: ""; position: absolute; left: 15px; top: 34px; bottom: 0; width: 2px; background: var(--vt-border); }
.note-item:last-child { padding-bottom: 0; }
.note-item:last-child::before { display: none; }
.note-item .avatar { position: absolute; left: 0; top: 0; }
.note-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .6rem; font-size: .82rem; color: var(--vt-muted); }
.note-meta strong { color: var(--vt-navy); font-size: .9rem; }
.note-body { margin-top: .3rem; background: #F6F8FC; border: 1px solid var(--vt-border); border-radius: 12px; padding: .7rem .9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-delete { border: 0; background: none; padding: 0; color: var(--vt-muted); font-size: .82rem; }
.note-delete:hover { color: #DC3545; }

/* ---------- Module picker (user form) ---------- */
.module-option { position: relative; display: block; height: 100%; }
.module-option input { position: absolute; opacity: 0; inset: 0; }
.module-option .module-box {
    display: flex; align-items: center; gap: .7rem; height: 100%;
    border: 2px solid var(--vt-border); border-radius: 12px; padding: .75rem .9rem;
    background: #fff; cursor: pointer; font-weight: 600; color: var(--vt-text);
    transition: border-color .15s ease, background-color .15s ease;
}
.module-option .module-box i.module-icon { font-size: 1.25rem; color: var(--vt-navy); }
.module-option .module-box .check { margin-left: auto; color: #C3CBDD; font-size: 1.15rem; }
.module-option input:checked + .module-box { border-color: var(--vt-amber); background: var(--vt-amber-soft); }
.module-option input:checked + .module-box .check { color: var(--vt-amber-600); }
.module-option input:focus-visible + .module-box { box-shadow: 0 0 0 .2rem rgba(251, 176, 1, .35); }
.module-option input:disabled + .module-box { opacity: .6; cursor: not-allowed; }

.color-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .1); vertical-align: -2px; }

/* ---------- Alerts & modals ---------- */
.alert { border-radius: 12px; border: 0; display: flex; align-items: flex-start; gap: .6rem; }
.alert-success { background: #E3F5EC; color: #0F5132; }
.alert-danger { background: #FCE8EA; color: #842029; }
.alert .btn-close { margin-left: auto; padding: .35rem; position: static; }
.modal-content { border: 0; border-radius: var(--vt-radius); }
.modal-header { border-bottom: 1px solid var(--vt-border); }
.modal-footer { border-top: 1px solid var(--vt-border); }
.modal-title { font-size: 1.1rem; }

/* ---------- Guest (login / error) pages ---------- */
.guest-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 1.25rem;
    background:
        radial-gradient(900px 500px at 100% 0%, rgba(251, 176, 1, .22), transparent 60%),
        linear-gradient(135deg, var(--vt-navy) 0%, var(--vt-navy-900) 100%);
}
.guest-card {
    width: 100%; max-width: 440px; background: #fff;
    border-radius: 18px; overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
    border-top: 5px solid var(--vt-amber);
}
.guest-card .guest-logo { padding: 1.75rem 1.75rem .5rem; text-align: center; }
.guest-card .guest-logo img { width: 100%; max-width: 300px; height: auto; }
.guest-card .guest-inner { padding: 1rem 1.75rem 1.75rem; }
.guest-foot { color: rgba(255, 255, 255, .65); font-size: .8rem; text-align: center; margin-top: 1rem; }
.error-code { font-size: 4rem; font-weight: 800; color: var(--vt-amber); line-height: 1; }

@media (max-width: 575.98px) {
    body { font-size: .93rem; }
    .page-head h1 { font-size: 1.2rem; }
    .page-head .btn { flex: 1 1 auto; }
    .stat-value { font-size: 1.35rem; }
    .stat-icon { width: 40px; height: 40px; font-size: 1.1rem; }
    .stat-card .card-body { padding: .9rem; gap: .65rem; }
    .guest-card .guest-inner { padding: 1rem 1.25rem 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
