/* BrilliantNexa ERP — small additions on top of Tabler */
:root {
    --tblr-font-sans-serif: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --bn-brand: #206bc4;
}

/* Brand in sidebar */
.brand-link { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; }
.brand-mark {
    width: 2rem; height: 2rem; border-radius: .5rem; display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #206bc4, #4299e1); color: #fff; font-weight: 700; font-size: 1rem;
}
.brand-text { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 12rem; }
.brand-text small { opacity: .6; font-weight: 500; margin-left: .15rem; }
.navbar-vertical .dropdown-item { display: flex; align-items: center; }

/* Auth pages */
.auth-page { min-height: 100vh; display: flex; align-items: center; background:
    radial-gradient(1200px 600px at 10% -10%, rgba(32,107,196,.12), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(66,153,225,.10), transparent 60%), var(--tblr-bg-surface-secondary); }
.auth-brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.25rem; color: var(--tblr-body-color); text-decoration: none; }
.auth-brand .brand-mark { width: 2.5rem; height: 2.5rem; font-size: 1.2rem; }

/* Stat tiles */
.stat-icon { width: 2.75rem; height: 2.75rem; border-radius: .6rem; display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem; }

/* Notes */
.note-card { border-top-width: 3px; height: 100%; }
.note-card .note-body { white-space: pre-wrap; word-break: break-word; max-height: 11rem; overflow: hidden; position: relative; }
.note-card .note-body::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2rem; background: linear-gradient(transparent, var(--tblr-bg-surface)); }
.note-default { border-top-color: var(--tblr-border-color); }
.note-blue    { border-top-color: var(--tblr-blue); }
.note-green   { border-top-color: var(--tblr-green); }
.note-yellow  { border-top-color: var(--tblr-yellow); }
.note-red     { border-top-color: var(--tblr-red); }
.note-purple  { border-top-color: var(--tblr-purple); }
.color-dot { width: .8rem; height: .8rem; border-radius: 50%; display: inline-block; border: 1px solid var(--tblr-border-color); }

/* Permission matrix */
.perm-table th, .perm-table td { vertical-align: middle; }
.perm-table td.perm-cell { text-align: center; width: 7.5rem; }
.perm-table .group-row td { background: var(--tblr-bg-surface-secondary); font-weight: 600; text-transform: uppercase; font-size: .75rem; letter-spacing: .04em; color: var(--tblr-secondary); }
.perm-table thead th { position: sticky; top: 0; z-index: 2; background: var(--tblr-bg-surface); }
.perm-table .form-check-input { margin: 0; float: none; }
.perm-table tr.row-off td:first-child { opacity: .6; }

/* Activity */
.duration-bar { height: .4rem; border-radius: 1rem; background: var(--tblr-primary); min-width: 2px; }
.timeline-time { width: 5.5rem; flex-shrink: 0; }
.table td.text-truncate { max-width: 22rem; }

/* Password generator */
.pw-output { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.15rem; letter-spacing: .02em; word-break: break-all; }
.pw-strength .progress-bar { transition: width .2s ease; }

/* Small helpers */
.min-w-0 { min-width: 0; }
.cursor-pointer { cursor: pointer; }
@media print { .page-header .btn-list, .navbar, .footer { display: none !important; } }

/* ---------- CRM: pipeline board ---------- */
.lead-board { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: .5rem; align-items: flex-start; }
.lead-col { flex: 0 0 15.5rem; background: var(--tblr-bg-surface-secondary); border-radius: .5rem; padding: .5rem; }
.lead-col-head { display: flex; align-items: center; padding: .35rem .5rem; border-top: 3px solid; border-radius: .25rem; background: var(--tblr-bg-surface); margin-bottom: .35rem; }
.lead-col-body { min-height: 4rem; max-height: 70vh; overflow-y: auto; border-radius: .35rem; transition: background .15s; }
.lead-col-body.drop-hover { background: rgba(32,107,196,.08); outline: 2px dashed var(--tblr-primary); }
.lead-card[draggable="true"] { cursor: grab; }
.lead-card.dragging { opacity: .45; }

/* ---------- CRM: lead stage stepper ---------- */
.lead-steps { display: flex; gap: 2px; overflow-x: auto; }
.lead-step { flex: 1 1 0; min-width: 6.5rem; margin: 0; }
.lead-step button {
    width: 100%; border: 0; padding: .5rem .75rem; font-size: .8rem; font-weight: 500; white-space: nowrap;
    background: var(--tblr-bg-surface-secondary); color: var(--tblr-secondary);
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
}
.lead-step:first-child button { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); border-radius: .35rem 0 0 .35rem; }
.lead-step button:not([disabled]):hover { background: var(--tblr-primary-lt); color: var(--tblr-primary); }
.lead-step.done button { background: var(--tblr-green-lt); color: var(--tblr-green); }
.lead-step.current button { background: var(--tblr-primary); color: #fff; }
.lead-step button[disabled] { cursor: default; }

/* ---------- Files ---------- */
.file-icon { width: 2.25rem; height: 2.25rem; border-radius: .4rem; display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; flex-shrink: 0; }

/* ---------- HR ---------- */
.att-cell { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 2.1rem; height: 2.3rem; border-radius: .3rem; font-size: .7rem; font-weight: 600; line-height: 1.1; }
.att-cell small { font-size: .6rem; font-weight: 400; opacity: .7; }
.att-grid { font-size: .75rem; }
.att-grid th, .att-grid td { padding: .25rem .2rem !important; text-align: center; white-space: nowrap; }
.att-grid th.emp, .att-grid td.emp { text-align: left; position: sticky; left: 0; background: var(--tblr-bg-surface); z-index: 1; min-width: 11rem; }
.att-grid td.code { min-width: 1.9rem; cursor: default; }
.att-grid td.code.editable { cursor: pointer; }
.att-grid td.code.editable:hover { outline: 2px solid var(--tblr-primary); outline-offset: -2px; }
.att-grid th.we { background: var(--tblr-bg-surface-secondary); }
.att-grid th.today, .att-grid td.today { box-shadow: inset 0 0 0 1px var(--tblr-primary); }
.punch-clock { font-size: 2.25rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.payslip { max-width: 60rem; margin: 0 auto; }
.payslip table td, .payslip table th { padding: .35rem .5rem; }
@media print {
    .page-header, .navbar, .footer, .btn, .alert, .no-print { display: none !important; }
    .page-wrapper { margin: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ccc !important; }
    body { background: #fff !important; }
}

/* ---------- Projects: Gantt ---------- */
.gantt { overflow-x: auto; font-size: .8rem; }
.gantt-head, .gantt-row { display: flex; align-items: center; min-width: 46rem; }
.gantt-row { border-top: 1px solid var(--tblr-border-color); min-height: 2rem; }
.gantt-label { flex: 0 0 14rem; padding: .25rem .5rem .25rem 0; }
.gantt-track { position: relative; flex: 1; height: 2rem; }
.gantt-head .gantt-track { height: 1.5rem; }
.gantt-week { position: absolute; top: 0; height: 100%; border-left: 1px solid var(--tblr-border-color); padding-left: .25rem; color: var(--tblr-secondary); white-space: nowrap; overflow: hidden; }
.gantt-bar { position: absolute; top: .45rem; height: 1.1rem; border-radius: .3rem; display: flex; align-items: center; padding: 0 .3rem; color: #fff; font-size: .65rem; text-decoration: none; overflow: hidden; }
.gantt-project .gantt-bar { opacity: .35; top: .6rem; height: .8rem; }
.gantt-milestone { position: absolute; top: .55rem; width: .9rem; height: .9rem; margin-left: -.45rem; transform: rotate(45deg); background: var(--tblr-orange); border-radius: 2px; }
.gantt-milestone.done { background: var(--tblr-green); }
.gantt-milestone.late { background: var(--tblr-red); }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--tblr-red); opacity: .6; pointer-events: none; }
.gantt-legend-today { display: inline-block; width: 2px; height: .8rem; background: var(--tblr-red); vertical-align: middle; }
.task-board .lead-col { flex-basis: 16rem; }
/* ---------- Documents ---------- */
.doc-card .doc-thumb { height: 7.5rem; display: flex; align-items: center; justify-content: center; background: var(--tblr-bg-surface-secondary); border-bottom: 1px solid var(--tblr-border-color); overflow: hidden; }
.doc-card .doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-card .doc-thumb i { font-size: 2.6rem; }
.cat-tree a { display: flex; align-items: center; padding: .3rem .5rem; border-radius: .3rem; color: inherit; text-decoration: none; }
.cat-tree a:hover { background: var(--tblr-bg-surface-secondary); }
.cat-tree a.active { background: var(--tblr-primary-lt); color: var(--tblr-primary); font-weight: 600; }
.cat-tree .sub a { padding-left: 1.6rem; font-size: .85rem; }
.tag-cloud a { text-decoration: none; }
.doc-preview { width: 100%; height: 70vh; border: 0; border-radius: .4rem; background: var(--tblr-bg-surface-secondary); }

/* ------------------------------------------------------------ Phase 5: Knowledge */
.kb-editor { min-height: 18rem; background: var(--tblr-bg-surface); }
.kb-editor .ql-editor { min-height: 18rem; font-size: .9375rem; }
.ql-toolbar.ql-snow, .ql-container.ql-snow { border-color: var(--tblr-border-color); }
.ql-toolbar.ql-snow { border-radius: var(--tblr-border-radius) var(--tblr-border-radius) 0 0; background: var(--tblr-bg-surface-secondary); }
.ql-container.ql-snow { border-radius: 0 0 var(--tblr-border-radius) var(--tblr-border-radius); }
.kb-body { font-size: .9375rem; line-height: 1.7; overflow-wrap: anywhere; }
.kb-body img { max-width: 100%; height: auto; border-radius: var(--tblr-border-radius); }
.kb-body h2, .kb-body h3, .kb-body h4 { margin-top: 1.4em; }
.kb-body blockquote { border-left: 3px solid var(--tblr-primary); padding: .25rem 1rem; color: var(--tblr-secondary); margin: 1rem 0; }
.kb-body pre { background: var(--tblr-bg-surface-secondary); padding: .75rem 1rem; border-radius: var(--tblr-border-radius); white-space: pre-wrap; }
.kb-body table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.kb-body td, .kb-body th { border: 1px solid var(--tblr-border-color); padding: .4rem .6rem; }
.kb-body .ql-align-center { text-align: center; } .kb-body .ql-align-right { text-align: right; } .kb-body .ql-align-justify { text-align: justify; }
.kb-body .ql-indent-1 { padding-left: 2em; } .kb-body .ql-indent-2 { padding-left: 4em; } .kb-body .ql-indent-3 { padding-left: 6em; }
.kb-featured { border-top: 3px solid var(--tblr-yellow); }

.quiz-opt { padding: .6rem .75rem .6rem 2.25rem; border: 1px solid var(--tblr-border-color); border-radius: var(--tblr-border-radius); margin-bottom: .5rem; cursor: pointer; }
.quiz-opt:hover { background: var(--tblr-bg-surface-secondary); }
.quiz-opt:has(input:checked) { border-color: var(--tblr-primary); background: rgba(var(--tblr-primary-rgb), .06); }
.quiz-timer { font-variant-numeric: tabular-nums; opacity: 1 !important; }

.weblink-card .avatar { flex-shrink: 0; }
.weblink-card:hover { border-color: var(--tblr-primary); }

.album-card { overflow: hidden; }
.album-cover { aspect-ratio: 4 / 3; background: var(--tblr-bg-surface-secondary); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.album-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.album-card:hover .album-cover img { transform: scale(1.04); }
.album-cover i { font-size: 2.5rem; color: var(--tblr-secondary); }
.album-cover-sm { aspect-ratio: 16 / 9; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .5rem; }
.gallery-grid-sm { grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); }
.gallery-tile { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: var(--tblr-border-radius); background: var(--tblr-bg-surface-secondary); }
.gallery-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.gallery-tile:hover img { transform: scale(1.05); }
.gallery-cover-badge { position: absolute; left: .4rem; top: .4rem; }
.gl-box.d-none { display: none !important; }
.gl-box { position: fixed; inset: 0; z-index: 1050; background: rgba(10, 12, 16, .94); display: flex; align-items: center; justify-content: center; outline: none; }
.gl-box img { max-width: 92vw; max-height: calc(100vh - 8rem); object-fit: contain; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.gl-btn { position: absolute; border: 0; background: rgba(255,255,255,.1); color: #fff; width: 3rem; height: 3rem; border-radius: 50%; font-size: 1.5rem; display: flex; align-items: center; justify-content: center; }
.gl-btn:hover { background: rgba(255,255,255,.22); }
.gl-close { top: 1rem; right: 1rem; } .gl-prev { left: 1rem; top: 50%; transform: translateY(-50%); } .gl-next { right: 1rem; top: 50%; transform: translateY(-50%); }
.gl-info { position: absolute; left: 0; right: 0; bottom: 0; padding: .75rem 1rem; color: #fff; display: flex; gap: 1rem; align-items: center; background: linear-gradient(transparent, rgba(0,0,0,.7)); }
.gl-info .btn { --tblr-btn-bg: rgba(255,255,255,.12); --tblr-btn-color: #fff; --tblr-btn-border-color: transparent; }
.email-snippet { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

@media print {
    .navbar, .page-header .btn-list, aside, .kb-body ~ *, form[action$="/ack"], form[action$="/helpful"] { display: none !important; }
}

/* ---- Notifications (Phase 6) */
.nb-bell .nb-count { position: absolute; top: -.1rem; right: -.45rem; font-size: .65rem; padding: .15rem .35rem; min-width: 1.1rem; }
.nb-bell .nb-count.d-none { display: none !important; }
.nb-menu { width: 22rem; max-width: calc(100vw - 1rem); padding: 0; }
.nb-menu .card { border: 0; margin: 0; }
.nb-unread { background: rgba(var(--tblr-primary-rgb, 32, 107, 196), .06); }
.geo-chip { font-size: .75rem; }

/* ---- Specialised dashboards & notification centre (v3) */
.dash-tabs { display: flex; flex-wrap: wrap; gap: .4rem; }
.nc-day { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--tblr-secondary); padding: .6rem 1rem .3rem; background: var(--tblr-bg-surface-secondary); }
.nc-check { width: 1.25rem; }

/* ---- Project page (v3) */
.pj-hero { border-top: 4px solid var(--pj); background: linear-gradient(135deg, color-mix(in srgb, var(--pj) 9%, var(--tblr-bg-surface)) 0%, var(--tblr-bg-surface) 55%); }
.pj-ring { width: 92px; height: 92px; }
.pj-ring circle { fill: none; stroke-width: 3.4; }
.pj-ring-bg { stroke: var(--tblr-border-color); }
.pj-ring-fg { stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dasharray .6s; }
.pj-ring text { font-size: .5rem; font-weight: 700; fill: var(--tblr-body-color); }
.pj-facts { display: flex; flex-wrap: wrap; gap: .4rem 1.6rem; }
.pj-facts > div { display: flex; flex-direction: column; min-width: 7rem; }
.pj-facts span { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--tblr-secondary); }
.pj-facts small { color: var(--tblr-secondary); font-size: .72rem; }
.pj-stat { border: 1px solid var(--tblr-border-color); border-radius: 8px; padding: .45rem .3rem; background: var(--tblr-bg-surface); }
.pj-stat b { display: block; font-size: 1.25rem; line-height: 1.2; }
.pj-stat span { font-size: .72rem; color: var(--tblr-secondary); }
.pj-stat.pj-bad b { color: var(--tblr-red); }
.pj-steps { position: relative; padding-left: .25rem; }
.pj-step { position: relative; padding: .55rem .6rem .55rem .2rem; border-left: 2px solid var(--tblr-border-color); margin-left: 1rem; padding-left: 1.4rem; }
.pj-step .pj-dot { position: absolute; left: -1.05rem; top: .5rem; border-radius: 50%; background: var(--tblr-bg-surface); }
.pj-step.is-done { border-left-color: var(--tblr-green); }
.pj-step.is-done .pj-dot { background: var(--tblr-green); color: #fff; border-color: var(--tblr-green); }
.pj-step.is-current { background: rgba(var(--tblr-primary-rgb, 32, 107, 196), .06); border-radius: 0 8px 8px 0; border-left-color: var(--tblr-primary); }
.pj-step.is-current .pj-dot { background: var(--tblr-primary); color: #fff; border-color: var(--tblr-primary); }
.pj-step.is-late .pj-dot { border-color: var(--tblr-red); color: var(--tblr-red); }
.pj-chip { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid var(--tblr-border-color); border-radius: 20px; padding: .2rem .7rem; font-size: .8rem; color: var(--tblr-body-color); background: var(--tblr-bg-surface); }
.pj-chip:hover { border-color: var(--tblr-primary); text-decoration: none; }
.pj-login { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .8rem; background: var(--tblr-bg-surface-secondary); border-radius: 6px; padding: .2rem .5rem; }
.pj-login code { background: transparent; padding: 0; }
.top-tasks .badge { font-size: .7rem; }
.md-item.is-done .md-title { text-decoration: line-through; color: var(--tblr-secondary); }

/* ---- Searchable pickers (Tom Select, matched to Tabler) */
.ts-wrapper .ts-control, .ts-wrapper.single.input-active .ts-control { background-color: var(--tblr-bg-forms, #fff); color: var(--tblr-body-color); }
.ts-wrapper.w-auto { min-width: 12rem; }
.ts-wrapper.multi .ts-control > .item { background: var(--tblr-primary-lt, #e9f0f9); color: var(--tblr-primary); border: 0; border-radius: 3px; }
.ts-dropdown { z-index: 1060; border-color: var(--tblr-border-color); background: var(--tblr-bg-surface); color: var(--tblr-body-color); }
.ts-dropdown .active { background: var(--tblr-primary-lt, #e9f0f9); color: var(--tblr-body-color); }

/* ---- Billing (Phase 7) */
.bdoc-wrap { overflow-x: auto; }
.bdoc-wrap .bdoc { min-width: 640px; }
.bl-table td { vertical-align: top; }
.bl-table .bl-desc { min-width: 14rem; }
