/* AIM Healthcare CRM: modern admin theme on Bootstrap 5.3 */
:root {
    --aim: #0b6e7f;
    --aim-dark: #08505d;
    --aim-soft: #e6f4f6;
    --side-bg: #0c2f3a;
    --side-bg-2: #0f3d4a;
    --side-text: #b9d3d9;
    --side-w: 260px;
    --top-h: 64px;
    --page-bg: #f3f6f9;
    --radius: .85rem;
    --bs-primary: var(--aim);
    --bs-primary-rgb: 11, 110, 127;
    --bs-link-color: var(--aim);
    --bs-link-color-rgb: 11, 110, 127;
    --bs-link-hover-color: var(--aim-dark);
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
body { background: var(--page-bg); font-size: .9rem; color: #1f2d3d; }

/* ---------- buttons ---------- */
.btn-primary { --bs-btn-bg: var(--aim); --bs-btn-border-color: var(--aim); --bs-btn-hover-bg: var(--aim-dark); --bs-btn-hover-border-color: var(--aim-dark);
               --bs-btn-active-bg: var(--aim-dark); --bs-btn-active-border-color: var(--aim-dark); --bs-btn-disabled-bg: var(--aim); --bs-btn-disabled-border-color: var(--aim); }
.btn-outline-primary { --bs-btn-color: var(--aim); --bs-btn-border-color: var(--aim); --bs-btn-hover-bg: var(--aim); --bs-btn-hover-border-color: var(--aim);
                       --bs-btn-active-bg: var(--aim); --bs-btn-active-border-color: var(--aim); }
.btn { border-radius: .55rem; font-weight: 500; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; padding: 0; border-radius: .5rem;
            color: #5b6b7b; background: transparent; border: 0; }
.btn-icon:hover { background: var(--aim-soft); color: var(--aim); }
.text-bg-primary { background-color: var(--aim) !important; }
.nav-pills .nav-link.active { background: var(--aim); }
.nav-pills .nav-link { color: #4a5a6a; border-radius: .5rem; font-size: .85rem; }
.form-control, .form-select { border-radius: .55rem; border-color: #dbe3ea; }
.form-control:focus, .form-select:focus { border-color: var(--aim); box-shadow: 0 0 0 .2rem rgba(11,110,127,.15); }
.form-check-input:checked { background-color: var(--aim); border-color: var(--aim); }
.progress { height: .45rem; background: #e7edf2; }
.progress-bar { background: linear-gradient(90deg, #12a3b8, var(--aim)); }
.overdue { color: #c0392b; font-weight: 600; }

/* ---------- app shell ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: linear-gradient(180deg, var(--side-bg), var(--side-bg-2));
           color: var(--side-text); display: flex; flex-direction: column; z-index: 1040; transition: transform .2s ease, width .2s ease; }
.brand { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.25rem; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand:hover { color: #fff; }
.brand-mark { width: 2.35rem; height: 2.35rem; border-radius: .7rem; display: inline-flex; align-items: center; justify-content: center;
              background: linear-gradient(135deg, #19b5c9, var(--aim)); color: #fff; font-size: 1.2rem; flex-shrink: 0; }
.brand-mark.lg { width: 3.5rem; height: 3.5rem; font-size: 1.8rem; border-radius: 1rem; }
.brand-text { font-weight: 700; line-height: 1.1; }
.brand-text small { display: block; font-weight: 400; font-size: .72rem; color: var(--side-text); }
.side-nav { flex: 1; overflow-y: auto; padding: .75rem .75rem 1rem; }
.side-group { text-transform: uppercase; letter-spacing: .08em; font-size: .68rem; font-weight: 600; color: #7fa3ad; padding: 1rem .75rem .4rem; }
.side-group i { margin-right: .4rem; }
.side-link { display: flex; align-items: center; gap: .75rem; padding: .55rem .75rem; margin: .1rem 0; border-radius: .6rem;
             color: var(--side-text); text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.side-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.side-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-link.active { background: linear-gradient(90deg, rgba(25,181,201,.25), rgba(25,181,201,.08)); color: #fff; box-shadow: inset 3px 0 0 #19b5c9; }
.side-foot { padding: .75rem 1.25rem; color: #6f939d; border-top: 1px solid rgba(255,255,255,.06); }

.main { min-height: 100vh; }
.app .main { margin-left: var(--side-w); transition: margin .2s ease; }
.topbar { position: sticky; top: 0; z-index: 1030; height: var(--top-h); display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem;
          background: rgba(255,255,255,.9); backdrop-filter: blur(8px); border-bottom: 1px solid #e5ebf0; }
.topbar-title { font-weight: 600; font-size: 1rem; }
.user-chip { display: flex; align-items: center; gap: .6rem; border: 0; padding: .25rem .5rem; }
.user-chip:hover { background: var(--aim-soft); }
.avatar { width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--aim-soft); color: var(--aim); font-weight: 700; font-size: .8rem;
          display: inline-flex; align-items: center; justify-content: center; }
.content { padding: 1.5rem; }

/* collapsed (desktop) */
.sidebar-collapsed .sidebar { width: 76px; }
.sidebar-collapsed .sidebar .brand-text, .sidebar-collapsed .sidebar .side-link span, .sidebar-collapsed .sidebar .side-group,
.sidebar-collapsed .sidebar .side-foot { display: none; }
.sidebar-collapsed .sidebar .side-link { justify-content: center; }
.sidebar-collapsed .main { margin-left: 76px; }
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .app .main { margin-left: 0; }
    .sidebar-open .sidebar { transform: none; }
    .sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(12,47,58,.45); z-index: 1035; }
    .content { padding: 1rem; }
    .topbar { padding: 0 1rem; }
}

/* ---------- cards and page header ---------- */
.card { border: 1px solid #e7edf2; border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; border-bottom: 1px solid #eef2f6; font-weight: 600; padding: .9rem 1.1rem; border-radius: var(--radius) var(--radius) 0 0 !important; }
.card-footer { background: #fafcfd; border-top: 1px solid #eef2f6; }
.page-title, .page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; gap: 1rem; flex-wrap: wrap; }
.page-title h1, .page-head h1 { font-size: 1.4rem; font-weight: 700; margin: 0; }
.page-title h1 i, .page-head h1 i { color: var(--aim); margin-right: .35rem; }
.kpi { position: relative; overflow: hidden; }
.kpi .value { font-size: 1.6rem; font-weight: 700; }
.kpi .label { color: #6b7b8b; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.kpi .label i { color: var(--aim); background: var(--aim-soft); border-radius: .5rem; padding: .25rem .35rem; margin-right: .35rem; }
a .kpi { transition: transform .15s, box-shadow .15s; }
a:hover .kpi { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(16,24,40,.08); }
dl.meta dt { font-weight: 500; color: #6b7b8b; font-size: .78rem; }
dl.meta dd { margin-bottom: .6rem; }

/* ---------- tables ---------- */
.table { --bs-table-hover-bg: #f5fafb; }
.table td, .table th { vertical-align: middle; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7b8b; font-weight: 600; background: #f8fafc; border-bottom-width: 1px; white-space: nowrap; }
.dt-container { padding: .9rem 1rem; }
.dt-container .dt-search input { border-radius: .55rem; min-width: 240px; }
.dt-container .dt-length select { border-radius: .55rem; }
.dt-container .pagination .page-link { border-radius: .45rem; margin: 0 .1rem; color: var(--aim); }
.dt-container .pagination .active > .page-link { background: var(--aim); border-color: var(--aim); color: #fff; }
.dt-container table.dataTable { margin-top: .5rem !important; margin-bottom: .5rem !important; }
.dt-processing { border-radius: .6rem; box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .9rem 1rem 0; }
.filter-bar .form-select, .filter-bar .form-control { width: auto; min-width: 170px; }
.badge { font-weight: 500; padding: .35em .65em; }

/* ---------- permissions ---------- */
.perm-table .perm-group td { background: #f1f6f8; font-weight: 600; color: var(--aim-dark); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.perm-table .form-check-input { width: 1.15em; height: 1.15em; cursor: pointer; }

/* ---------- empty / auth ---------- */
.empty-state { text-align: center; padding: 4rem 1rem; }
.empty-icon { font-size: 3rem; }
.auth { background: var(--page-bg); }
.auth .content { padding: 0; }
.auth-wrap { display: flex; min-height: 100vh; }
.auth-side { flex: 1; background: radial-gradient(circle at 20% 20%, #138a9b, var(--side-bg) 70%); color: #fff; align-items: center; justify-content: center; padding: 3rem; }
.auth-side > div { max-width: 420px; }
.auth-form { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card { width: 100%; max-width: 420px; box-shadow: 0 10px 30px rgba(16,24,40,.08); }

/* ---------- page header (forms and details) ---------- */
.page-icon { width: 3rem; height: 3rem; border-radius: .9rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
             background: linear-gradient(135deg, #19b5c9, var(--aim)); color: #fff; font-size: 1.35rem; box-shadow: 0 6px 16px rgba(11,110,127,.25); }
.crumbs { font-size: .76rem; color: #7b8a99; margin-bottom: .15rem; }
.crumbs a { color: #7b8a99; text-decoration: none; }
.crumbs a:hover { color: var(--aim); }
.crumbs i { font-size: .65rem; margin: 0 .3rem; }
.btn-soft { background: #fff; border: 1px solid #dbe3ea; color: #3c4b5a; }
.btn-soft:hover { background: var(--aim-soft); border-color: #c4dfe3; color: var(--aim); }

/* ---------- form pages ---------- */
.form-card { overflow: hidden; }
.form-card > .card-header { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.25rem; }
.form-card > .card-header .sec-icon { width: 2.1rem; height: 2.1rem; border-radius: .6rem; background: var(--aim-soft); color: var(--aim);
             display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.form-card > .card-header .sec-title { font-weight: 600; line-height: 1.2; }
.form-card > .card-header .sec-sub { display: block; font-weight: 400; font-size: .76rem; color: #7b8a99; }
.form-card > .card-body { padding: 1.25rem; }
.form-label { font-weight: 500; font-size: .8rem; color: #42515f; margin-bottom: .3rem; }
.form-label.required::after { content: " *"; color: #d9534f; }
.form-control, .form-select { padding: .5rem .75rem; min-height: 2.5rem; background-color: #fff; }
.form-control::placeholder { color: #a7b3be; }
.form-control-sm, .form-select-sm { min-height: 2rem; padding: .3rem .6rem; }
.input-group-text { background: #f6f9fb; border-color: #dbe3ea; color: #6b7b8b; border-radius: .55rem; }
.input-group > .form-control, .input-group > .form-select { min-width: 0; }
.field-validation-error, .text-danger.small { display: block; margin-top: .25rem; font-size: .76rem; }
.input-validation-error { border-color: #e4606d !important; background-image: none; }
.input-validation-error:focus { box-shadow: 0 0 0 .2rem rgba(228,96,109,.15) !important; }
.validation-summary-errors { border-radius: .7rem; border: 0; background: #fdecee; color: #a12a37; }
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }
.validation-summary-valid { display: none; }
.form-text { font-size: .74rem; color: #8494a3; }
.form-switch-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; border: 1px solid #e3eaf0; border-radius: .7rem; background: #fafcfd; }
.form-switch-card .form-check-input { width: 2.6em; height: 1.4em; margin: 0; cursor: pointer; }
.form-switch-card .title { font-weight: 500; }
.form-switch-card .hint { font-size: .74rem; color: #8494a3; }
.line-table { margin: 0; }
.line-table thead th { background: #f8fafc; }
.line-table td { padding: .45rem .5rem; }
.line-table tbody tr:hover { background: #fbfdfe; }
.line-no { width: 2.5rem; color: #9aa8b5; font-weight: 600; text-align: center; }
.choice-card { border: 1px solid #e3eaf0; border-radius: .75rem; padding: .9rem 1rem; background: #fff; transition: border-color .15s, box-shadow .15s, background .15s; }
.choice-card:hover { border-color: #c4dfe3; }
.choice-card.is-selected { border-color: var(--aim); background: #f5fbfc; box-shadow: 0 0 0 .2rem rgba(11,110,127,.08); }
.choice-card .choice-head { display: flex; align-items: center; gap: .6rem; }
.choice-card .choice-head .form-check-input { width: 1.2em; height: 1.2em; margin: 0; cursor: pointer; }
.choice-card .choice-head label { font-weight: 600; cursor: pointer; }
.choice-card .choice-body { margin-top: .75rem; }
.choice-card:not(.is-selected) .choice-body { opacity: .55; }
.side-tips { font-size: .8rem; color: #5b6b7b; }
.side-tips li { margin-bottom: .55rem; display: flex; gap: .5rem; }
.side-tips li i { color: var(--aim); margin-top: .1rem; }
.sticky-side { position: sticky; top: calc(var(--top-h) + 1rem); }
.summary-row { display: flex; justify-content: space-between; padding: .35rem 0; font-size: .85rem; }
.summary-row.total { border-top: 1px dashed #d5dee6; margin-top: .35rem; padding-top: .6rem; font-weight: 700; font-size: 1rem; color: var(--aim-dark); }
.form-actions { position: sticky; bottom: 0; z-index: 10; display: flex; justify-content: flex-end; align-items: center; gap: .5rem;
                margin: 1.25rem -1.5rem -1.5rem; padding: .85rem 1.5rem; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
                border-top: 1px solid #e5ebf0; }
.form-actions .hint { margin-right: auto; font-size: .76rem; color: #8494a3; }
.form-actions .btn { min-width: 7rem; }
@media (max-width: 991.98px) { .form-actions { margin: 1rem -1rem -1rem; padding: .75rem 1rem; } .sticky-side { position: static; } }

/* ---------- details pages ---------- */
.nav-tabs { border-bottom: 1px solid #e3eaf0; gap: .25rem; }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: #5b6b7b; font-weight: 500; padding: .6rem .9rem; border-radius: 0; }
.nav-tabs .nav-link:hover { color: var(--aim); border-bottom-color: #c4dfe3; }
.nav-tabs .nav-link.active { color: var(--aim); border-bottom-color: var(--aim); background: transparent; }
.card > h2.h6, .card > .h6:first-child { font-weight: 600; color: #26394a; display: flex; align-items: center; gap: .45rem; }
dl.meta dt { text-transform: uppercase; letter-spacing: .04em; font-size: .68rem; font-weight: 600; color: #8494a3; }
dl.meta dd { font-weight: 500; }
.list-group-item { border-color: #eef2f6; }

/* ---------- dashboard ---------- */
.hero { position: relative; overflow: hidden; border-radius: 1.1rem; padding: 1.6rem 1.75rem; margin-bottom: 1.25rem; color: #fff;
        background: radial-gradient(circle at 85% 20%, rgba(25,181,201,.55), transparent 45%), linear-gradient(120deg, #0c2f3a 0%, #0b6e7f 100%);
        box-shadow: 0 10px 30px rgba(11,110,127,.2); }
.hero::after { content: ""; position: absolute; right: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%; border: 40px solid rgba(255,255,255,.05); }
.hero h1 { font-size: 1.55rem; font-weight: 700; margin: 0 0 .25rem; }
.hero p { color: #cfe7ec; margin: 0; }
.hero .hero-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; position: relative; z-index: 1; }
.hero .chip { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .75rem; border-radius: 2rem; background: rgba(255,255,255,.12);
              color: #fff; font-size: .78rem; font-weight: 500; text-decoration: none; border: 1px solid rgba(255,255,255,.15); }
.hero .chip:hover { background: rgba(255,255,255,.2); color: #fff; }
.hero .chip.warn { background: rgba(255,170,80,.22); border-color: rgba(255,190,120,.4); }
.hero-actions { position: relative; z-index: 1; }
.hero-actions .btn { background: #fff; color: var(--aim-dark); border: 0; }
.hero-actions .btn:hover { background: #e6f4f6; }
.stat { display: block; height: 100%; padding: 1.1rem 1.15rem; border-radius: 1rem; background: #fff; border: 1px solid #e7edf2; color: inherit; text-decoration: none;
        box-shadow: 0 1px 2px rgba(16,24,40,.04); transition: transform .15s, box-shadow .15s; position: relative; overflow: hidden; }
a.stat:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(16,24,40,.08); color: inherit; }
.stat .stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.stat .stat-icon { width: 2.6rem; height: 2.6rem; border-radius: .8rem; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.stat .stat-label { font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: #7b8a99; }
.stat .stat-value { font-size: 1.65rem; font-weight: 700; line-height: 1.1; color: #17293a; }
.stat .stat-value.money { font-size: 1.3rem; }
.stat .stat-foot { font-size: .76rem; color: #7b8a99; margin-top: .35rem; }
.stat .stat-foot.bad { color: #c0392b; font-weight: 600; }
.stat .stat-arrow { color: #b5c2cd; font-size: .9rem; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--tone, var(--aim)); }
.tone-teal   { --tone: #0b9fb3; } .tone-teal .stat-icon   { background: #e3f6f8; color: #0b8798; }
.tone-blue   { --tone: #3b7ddd; } .tone-blue .stat-icon   { background: #e8f0fc; color: #2f6fd0; }
.tone-violet { --tone: #7c5cd6; } .tone-violet .stat-icon { background: #efeafb; color: #6a4bc9; }
.tone-amber  { --tone: #e39a1c; } .tone-amber .stat-icon  { background: #fdf3e1; color: #c27f08; }
.tone-green  { --tone: #23a26d; } .tone-green .stat-icon  { background: #e3f5ec; color: #1a8a5b; }
.tone-rose   { --tone: #e0506a; } .tone-rose .stat-icon   { background: #fce8ec; color: #c93a55; }
.tone-slate  { --tone: #5b6b7b; } .tone-slate .stat-icon  { background: #eef2f6; color: #4a5a6a; }
.tone-cyan   { --tone: #1aa7c9; } .tone-cyan .stat-icon   { background: #e2f5fa; color: #128fae; }
.panel { flex: none; }
.btn-soft.active, .btn-soft:active { background: var(--aim) !important; border-color: var(--aim) !important; color: #fff !important; }
.panel > .card-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.panel > .card-header .ttl { display: flex; align-items: center; gap: .55rem; }
.panel > .card-header .ttl i { color: var(--aim); background: var(--aim-soft); border-radius: .5rem; padding: .3rem .4rem; font-size: .9rem; }
.panel > .card-header .ttl small { display: block; font-weight: 400; color: #8494a3; font-size: .72rem; }
.panel > .card-header a.more { font-size: .76rem; font-weight: 500; text-decoration: none; }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: .75rem; padding: .7rem 1.1rem; border-bottom: 1px solid #f0f3f6; }
.feed li:last-child { border-bottom: 0; }
.feed .dot { width: 2.1rem; height: 2.1rem; border-radius: .65rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--aim-soft); color: var(--aim); }
.feed .dot.bad { background: #fce8ec; color: #c93a55; }
.feed .dot.warn { background: #fdf3e1; color: #c27f08; }
.feed .f-main { flex: 1; min-width: 0; }
.feed .f-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed .f-sub { font-size: .75rem; color: #8494a3; }
.feed .f-when { font-size: .74rem; white-space: nowrap; color: #7b8a99; text-align: right; }
.feed-empty { padding: 2rem 1rem; text-align: center; color: #8494a3; font-size: .82rem; }
.feed-empty i { display: block; font-size: 1.8rem; color: #b9d3d9; margin-bottom: .35rem; }
.proj-row td { padding-top: .65rem; padding-bottom: .65rem; }
.proj-row .progress { height: .4rem; }
.pill { display: inline-block; padding: .2rem .55rem; border-radius: 2rem; font-size: .7rem; font-weight: 600; background: #eef2f6; color: #4a5a6a; }
.pill.late { background: #fce8ec; color: #c93a55; }
.donut-legend { list-style: none; padding: 0; margin: .75rem 0 0; font-size: .78rem; }
.donut-legend li { display: flex; align-items: center; justify-content: space-between; padding: .25rem 0; }
.donut-legend .sw { width: .7rem; height: .7rem; border-radius: .2rem; display: inline-block; margin-right: .45rem; }

/* ---------- website admin ---------- */
.html-toolbar { display: flex; flex-wrap: wrap; gap: .3rem; }
.html-toolbar .btn { width: 2.1rem; padding: .25rem 0; }
.page-preview { min-height: 22rem; background: #fff; }
.page-preview h2 { font-size: 1.4rem; font-weight: 700; margin-top: 1rem; }
.page-preview h3 { font-size: 1.15rem; font-weight: 600; margin-top: 1rem; }
.serp { border: 1px solid #e3eaf0; border-radius: .7rem; padding: .8rem 1rem; background: #fff; }
.serp-url { font-size: .74rem; color: #3c7d4b; word-break: break-all; }
.serp-title { color: #1a0dab; font-size: 1rem; line-height: 1.3; margin: .15rem 0; }
.serp-desc { font-size: .78rem; color: #4d5156; }
.menu-tree { list-style: none; margin: 0; padding: 0; }
.menu-tree li { display: flex; align-items: center; gap: .75rem; padding: .7rem 1.1rem; border-bottom: 1px solid #f0f3f6; }
.menu-tree li:last-child { border-bottom: 0; }
.menu-tree li.child { padding-left: 2.6rem; background: #fbfdfe; }
.menu-tree li.inactive { opacity: .55; }
.menu-tree .order { width: 2.2rem; height: 1.6rem; border-radius: .45rem; background: #eef2f6; color: #5b6b7b; font-size: .72rem; font-weight: 700;
                    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.min-w-0 { min-width: 0; }
.seg { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg .btn-check:checked + .btn { background: var(--aim); border-color: var(--aim); color: #fff; }
.svc-admin .svc-icon { width: 2.8rem; height: 2.8rem; border-radius: .8rem; background: var(--aim-soft); color: var(--aim); font-size: 1.3rem;
                       display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.svc-admin.muted { opacity: .6; }

/* =====================================================================
   Premium layer: list pages, detail pages, badges, avatars, timeline
   ===================================================================== */
:root { --ink: #17293a; --muted: #7b8a99; --line: #e7edf2; --shadow-md: 0 8px 24px rgba(16,24,40,.06); }

/* page header */
.ph-main { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.page-head h1, .page-title h1 { letter-spacing: -.01em; color: var(--ink); }
.page-sub { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.page-title .btn-group .btn, .page-head .btn-group .btn { font-size: .78rem; }

/* list cards */
.list-card { overflow: hidden; box-shadow: var(--shadow-md); }
.list-card > .card-body { padding: 0; }
.list-card .filter-bar, .card .filter-bar { padding: .85rem 1rem; border-bottom: 1px solid #eef2f6; background: linear-gradient(180deg,#fff,#fbfdfe); margin: 0; }
.filter-bar .dt-search { margin: 0 auto 0 0; order: -1; }
.filter-bar > .bi-funnel { margin-left: auto; }
.list-card .dt-layout-table > div { display: block !important; overflow-x: auto; }
.list-card .table tbody td .progress { min-width: 5rem; }
td > .ent-txt > .ent-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-width: 13rem; max-width: 21rem; }
.filter-bar .dt-search label { display: none; }
.search-box { position: relative; display: inline-flex; align-items: center; }
.search-box > i { position: absolute; left: .75rem; color: #9aa8b5; pointer-events: none; font-size: .85rem; }
.search-box input.form-control { padding-left: 2.1rem; min-width: 280px; margin: 0 !important; background: #f6f9fb; border-color: #e3eaf0; }
.search-box input.form-control:focus { background: #fff; }
.filter-bar .form-select { background-color: #fff; font-size: .82rem; }
.list-card .dt-container { padding: 0; }
.list-card .dt-container > .row { margin: 0; padding: .6rem 1rem; }
.list-card .dt-container > .row:has(table) { padding: 0; }
.list-card .dt-container > .row:has(table) > div { padding: 0; }
.list-card .dt-container > .row:last-child { border-top: 1px solid #eef2f6; background: #fbfdfe; font-size: .8rem; color: var(--muted); }
.list-card table.dataTable { margin: 0 !important; }
.list-card .table { font-size: .84rem; }
.list-card .table > :not(caption) > * > * { padding: .65rem .8rem; }
.list-card .table > :not(caption) > * > *:first-child { padding-left: 1.1rem; }
.list-card .table > :not(caption) > * > *:last-child { padding-right: 1.1rem; }
.list-card .table thead th { background: #f8fafc; border-bottom: 1px solid #e7edf2; color: #6b7b8b; }
.list-card .table tbody tr { transition: background .12s; }
.list-card .table tbody tr:last-child td { border-bottom: 0; }
.list-card .table tbody tr.row-link { cursor: pointer; }
.list-card .table tbody tr:hover td { background: #f5fafb; }
.list-card .table tbody td:last-child .btn-icon { opacity: .55; transition: opacity .12s; }
.list-card .table tbody tr:hover td:last-child .btn-icon { opacity: 1; }
.dt-container .dt-length select { margin-right: .35rem; }
.dt-container .pagination { margin: 0; }
.dt-container .pagination .page-link { border: 0; min-width: 2rem; text-align: center; font-size: .8rem; }
.dt-container .pagination .disabled > .page-link { background: transparent; }

/* empty state inside tables */
.dt-none { padding: 2.25rem 1rem; text-align: center; color: var(--muted); font-size: .82rem; }
.dt-none > span:last-child { display: block; }
.dt-none .dt-empty-ic { width: 3.4rem; height: 3.4rem; border-radius: 1rem; margin: 0 auto .7rem; display: flex; align-items: center; justify-content: center;
                         background: var(--aim-soft); color: var(--aim); font-size: 1.5rem; }
.dt-none b { display: block; color: var(--ink); font-size: .9rem; margin-bottom: .15rem; }
td.dt-empty, td.dataTables_empty { background: #fff !important; }

/* avatars and people */
.av { width: 2.25rem; height: 2.25rem; border-radius: .7rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
      font-weight: 700; font-size: .78rem; letter-spacing: .02em; background: var(--av-bg); color: var(--av-fg); }
.av-sm { width: 1.7rem; height: 1.7rem; border-radius: 50%; font-size: .64rem; }
.av-icon { font-size: 1rem; }
.av-0 { --av-bg: #e3f6f8; --av-fg: #0b8798; } .av-1 { --av-bg: #e8f0fc; --av-fg: #2f6fd0; }
.av-2 { --av-bg: #efeafb; --av-fg: #6a4bc9; } .av-3 { --av-bg: #fdf3e1; --av-fg: #b0720a; }
.av-4 { --av-bg: #e3f5ec; --av-fg: #1a8a5b; } .av-5 { --av-bg: #fce8ec; --av-fg: #c93a55; }
.av-6 { --av-bg: #e6eef3; --av-fg: #3d5466; } .av-7 { --av-bg: #fff0e6; --av-fg: #c45d16; }
.ent { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.ent > div { min-width: 0; }
.ent-name { display: block; font-weight: 600; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22rem; }
.ent-name:hover { color: var(--aim); }
.ent-sub { display: block; font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22rem; }
.person { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; color: #34475a; }
.ttl-cell a { font-weight: 600; color: var(--ink); text-decoration: none; }
.ttl-cell a:hover { color: var(--aim); }
.ttl-cell .ent-sub { max-width: 19rem; }
.info-row a, .dh-facts a, .tl a { text-decoration: none; }
.info-row a:hover { text-decoration: underline; }

/* chips, counts, priority, numbers */
.code-chip { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .74rem; font-weight: 600;
             padding: .18rem .5rem; border-radius: .4rem; background: #f1f5f8; color: #3d5466; border: 1px solid #e3eaf0; white-space: nowrap; text-decoration: none; }
a.code-chip:hover, .code-chip.link:hover { background: var(--aim-soft); color: var(--aim); border-color: #c4dfe3; }
.count { display: inline-flex; min-width: 1.8rem; height: 1.5rem; padding: 0 .45rem; align-items: center; justify-content: center; border-radius: 2rem; font-size: .74rem; font-weight: 700; }
.count.blue { background: #e8f0fc; color: #2f6fd0; } .count.teal { background: #e3f6f8; color: #0b8798; }
.count.violet { background: #efeafb; color: #6a4bc9; } .count.amber { background: #fdf3e1; color: #b0720a; }
.count.zero { background: #f3f6f9; color: #a7b3be; }
.prio { display: inline-flex; align-items: center; gap: .25rem; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.prio.high { color: #c93a55; } .prio.med { color: #b0720a; } .prio.low { color: #6b7b8b; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* soft status badges with a dot */
.badge.bg-primary, .badge.bg-secondary, .badge.bg-success, .badge.bg-danger, .badge.bg-warning, .badge.bg-info, .badge.bg-dark, .badge.bg-light,
.badge.text-bg-primary, .badge.text-bg-secondary, .badge.text-bg-success, .badge.text-bg-danger, .badge.text-bg-warning, .badge.text-bg-info, .badge.text-bg-dark, .badge.text-bg-light {
    display: inline-flex; align-items: center; gap: .35rem; border-radius: 2rem; font-weight: 600; font-size: .7rem; padding: .3em .7em; border: 1px solid transparent; }
.badge.bg-primary::before, .badge.bg-secondary::before, .badge.bg-success::before, .badge.bg-danger::before, .badge.bg-warning::before, .badge.bg-info::before, .badge.bg-dark::before,
.badge.text-bg-primary::before, .badge.text-bg-secondary::before, .badge.text-bg-success::before, .badge.text-bg-danger::before, .badge.text-bg-warning::before, .badge.text-bg-info::before, .badge.text-bg-dark::before {
    content: ""; width: .42rem; height: .42rem; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.bg-primary, .badge.text-bg-primary { background: #e3f6f8 !important; color: #0b7584 !important; border-color: #c9ebf0; }
.badge.bg-secondary, .badge.text-bg-secondary { background: #eef2f6 !important; color: #4a5a6a !important; border-color: #e1e8ee; }
.badge.bg-success, .badge.text-bg-success { background: #e3f5ec !important; color: #187a50 !important; border-color: #c9ebd9; }
.badge.bg-danger, .badge.text-bg-danger { background: #fce8ec !important; color: #b8324b !important; border-color: #f7cfd7; }
.badge.bg-warning, .badge.text-bg-warning { background: #fdf3e1 !important; color: #9c6406 !important; border-color: #f6e2bb; }
.badge.bg-info, .badge.text-bg-info { background: #e8f0fc !important; color: #2a63bb !important; border-color: #d3e1f8; }
.badge.bg-dark, .badge.text-bg-dark { background: #e6eaef !important; color: #26394a !important; border-color: #d6dde4; }
.badge.bg-light, .badge.text-bg-light { background: #f6f9fb !important; color: #4a5a6a !important; border-color: #e3eaf0; }
.nav-link .badge, .side-link .badge { padding: .15em .5em; }
.nav-link .badge::before { display: none; }

/* detail hero */
.detail-hero { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 1.1rem; margin-bottom: 1.25rem; overflow: hidden; box-shadow: var(--shadow-md); }
.dh-band { height: 74px; background: radial-gradient(circle at 88% 0%, rgba(25,181,201,.55), transparent 50%), linear-gradient(120deg, #0c2f3a 0%, #0b6e7f 70%, #138a9b 100%); position: relative; }
.dh-band::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.12) 1px, transparent 1px); background-size: 16px 16px; mask-image: linear-gradient(90deg, transparent, #000); }
.dh-body { display: flex; align-items: flex-start; gap: 1.1rem; padding: 0 1.4rem 1.15rem; margin-top: -34px; position: relative; flex-wrap: wrap; }
.dh-avatar, .dh-icon { width: 4.6rem; height: 4.6rem; border-radius: 1.15rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
                       border: 4px solid #fff; box-shadow: 0 8px 20px rgba(16,24,40,.12); }
.dh-avatar { background: var(--av-bg); color: var(--av-fg); font-size: 1.45rem; font-weight: 800; }
.dh-icon { background: linear-gradient(135deg, #19b5c9, var(--aim)); color: #fff; font-size: 1.8rem; }
.dh-main { flex: 1; min-width: 240px; padding-top: 38px; }
.dh-main .crumbs { margin-bottom: .2rem; }
.dh-title { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.dh-title h1 { font-size: 1.4rem; line-height: 1.25; font-weight: 700; margin: 0; color: var(--ink); letter-spacing: -.01em; }
.dh-facts { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; margin: .45rem 0 0; padding: 0; font-size: .8rem; color: #5b6b7b; }
.dh-facts li { display: inline-flex; align-items: center; gap: .35rem; }
.dh-facts i { color: #9aa8b5; }
.dh-facts a { color: #3d5466; text-decoration: none; } .dh-facts a:hover { color: var(--aim); }
.dh-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; align-self: flex-end; padding-bottom: .15rem; }
.dh-actions .form-select { width: auto; }
.dh-actions form { margin: 0; }
@media (max-width: 767.98px) { .dh-body { padding: 0 1rem 1rem; } .dh-actions { width: 100%; } }

/* key figures strip */
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .85rem; margin-bottom: 1.25rem; }
.kfig { background: #fff; border: 1px solid var(--line); border-radius: .95rem; padding: .9rem 1rem; display: flex; align-items: center; gap: .8rem; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.kfig .k-ic { width: 2.5rem; height: 2.5rem; border-radius: .75rem; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; background: var(--aim-soft); color: var(--aim); }
.kfig .k-val { font-size: 1.2rem; font-weight: 700; color: var(--ink); line-height: 1.15; font-variant-numeric: tabular-nums; }
.kfig .k-lbl { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.kfig.tone-teal .k-ic { background: #e3f6f8; color: #0b8798; } .kfig.tone-blue .k-ic { background: #e8f0fc; color: #2f6fd0; }
.kfig.tone-violet .k-ic { background: #efeafb; color: #6a4bc9; } .kfig.tone-amber .k-ic { background: #fdf3e1; color: #c27f08; }
.kfig.tone-green .k-ic { background: #e3f5ec; color: #1a8a5b; } .kfig.tone-rose .k-ic { background: #fce8ec; color: #c93a55; }

/* info cards */
.card > h2.h6, .card > .card-body > h2.h6:first-child { margin: 0; padding: .95rem 1.1rem; border-bottom: 1px solid #eef2f6; font-size: .9rem; }
.card > .card-body > h2.h6:first-child { margin: -1rem -1rem 1rem; }
.card > h2.h6 > i:first-child, .card > .card-body > h2.h6:first-child > i:first-child, .card-header > i:first-child {
    width: 1.9rem; height: 1.9rem; border-radius: .55rem; background: var(--aim-soft); color: var(--aim); display: inline-flex; align-items: center; justify-content: center; font-size: .9rem; margin-right: .1rem; }
.card-header { display: flex; align-items: center; gap: .5rem; }
.card-header > .ms-auto, .card-header > .float-end { margin-left: auto; }
dl.meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .9rem 1.25rem; margin: 0; }
dl.meta > div { min-width: 0; }
dl.meta dd { margin: .15rem 0 0; color: var(--ink); word-break: break-word; }
dl.meta.row { display: flex; }
.info-row { display: flex; align-items: flex-start; gap: .75rem; padding: .6rem 0; border-bottom: 1px dashed #eef2f6; }
.info-row:last-child { border-bottom: 0; }
.info-row > i { color: #9aa8b5; margin-top: .1rem; }
.info-row .lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; color: #8494a3; }
.card .table thead th { background: #f8fafc; }
.card > .table-responsive > .table, .card > .table { margin-bottom: 0; }
.card > .table-responsive > .table > :not(caption) > * > *:first-child, .card > .table > :not(caption) > * > *:first-child { padding-left: 1.1rem; }
.card > .table-responsive > .table > :not(caption) > * > *:last-child, .card > .table > :not(caption) > * > *:last-child { padding-right: 1.1rem; }

/* activity timeline */
.tl { list-style: none; margin: 0; padding: .5rem 1.1rem 1rem; position: relative; }
.tl > li { position: relative; padding: .7rem 0 .7rem 2.6rem; }
.tl > li::before { content: ""; position: absolute; left: .95rem; top: 0; bottom: 0; width: 2px; background: #eef2f6; }
.tl > li:first-child::before { top: 1.2rem; } .tl > li:last-child::before { bottom: calc(100% - 1.2rem); }
.tl > li:only-child::before { display: none; }
.tl .tl-dot { position: absolute; left: 0; top: .55rem; width: 2rem; height: 2rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
              background: var(--aim-soft); color: var(--aim); font-size: .85rem; border: 3px solid #fff; box-shadow: 0 0 0 1px #e3eaf0; z-index: 1; }
.tl .tl-dot.blue { background: #e8f0fc; color: #2f6fd0; } .tl .tl-dot.violet { background: #efeafb; color: #6a4bc9; }
.tl .tl-dot.amber { background: #fdf3e1; color: #c27f08; } .tl .tl-dot.green { background: #e3f5ec; color: #1a8a5b; }
.tl .tl-dot.rose { background: #fce8ec; color: #c93a55; }
.tl .tl-head { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.tl .tl-title { font-weight: 600; color: var(--ink); }
.tl .tl-when { font-size: .74rem; color: var(--muted); white-space: nowrap; }
.tl .tl-body { font-size: .82rem; color: #4a5a6a; margin-top: .2rem; white-space: pre-line; }
.tl .tl-meta { font-size: .74rem; color: var(--muted); margin-top: .25rem; display: flex; gap: .75rem; flex-wrap: wrap; }

/* tabs inside a card */
.card > .nav-tabs, .tab-card > .nav-tabs { padding: 0 .75rem; background: #fbfdfe; border-radius: var(--radius) var(--radius) 0 0; }
.nav-tabs .nav-link .count, .nav-tabs .nav-link .badge { margin-left: .35rem; }

/* list groups used as mini lists on detail pages */
.card .list-group-flush > .list-group-item { padding: .7rem 1.1rem; }
.card .list-group-flush > .list-group-item-action:hover { background: #f5fafb; }

/* forms: section headings inside a card, subtle focus ring */
.form-section-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: #8494a3; margin: 1.25rem 0 .75rem;
                      display: flex; align-items: center; gap: .6rem; }
.form-section-title::after { content: ""; flex: 1; height: 1px; background: #eef2f6; }
.form-card { box-shadow: var(--shadow-md); }
.form-card + .form-card { margin-top: 1rem; }
.form-card > .card-header { background: linear-gradient(180deg, #fff, #fbfdfe); }
.form-control:hover:not(:focus), .form-select:hover:not(:focus) { border-color: #c9d5de; }
textarea.form-control { min-height: 5.5rem; }
.form-actions { box-shadow: 0 -6px 18px rgba(16,24,40,.04); }

/* tooltip */
.tooltip { --bs-tooltip-bg: #17293a; --bs-tooltip-font-size: .74rem; }

/* stage stepper */
.stepper-card { padding: 1rem 1.25rem; overflow-x: auto; }
.stepper { list-style: none; display: flex; margin: 0; padding: 0; min-width: 640px; counter-reset: st; }
.stepper li { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; text-align: center; gap: .4rem; }
.stepper li::before { content: ""; position: absolute; top: 1rem; left: -50%; width: 100%; height: 3px; background: #e7edf2; z-index: 0; }
.stepper li:first-child::before { display: none; }
.stepper li.done::before, .stepper li.current::before { background: linear-gradient(90deg, #19b5c9, var(--aim)); }
.stepper .st-dot { position: relative; z-index: 1; width: 2.1rem; height: 2.1rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
                   background: #fff; border: 2px solid #dbe3ea; color: #8494a3; font-weight: 700; font-size: .8rem; }
.stepper .st-lbl { font-size: .74rem; font-weight: 600; color: #8494a3; }
.stepper li.done .st-dot { background: var(--aim); border-color: var(--aim); color: #fff; }
.stepper li.done .st-lbl { color: #3d5466; }
.stepper li.current .st-dot { background: #fff; border-color: var(--aim); color: var(--aim); box-shadow: 0 0 0 5px rgba(11,110,127,.12); }
.stepper li.current .st-lbl { color: var(--aim); }
.stepper li.lost .st-dot { border-color: #c93a55; color: #c93a55; box-shadow: 0 0 0 5px rgba(201,58,85,.12); }
.stepper li.lost .st-lbl { color: #c93a55; }
.stepper li.lost::before { background: #f3c6cf; }

/* card.p-3 with a heading: heading becomes a header bar */
.card.p-3 > h2.h6:first-child { margin: -1rem -1rem 1rem; }
.card.p-3 > .table-responsive:last-child, .card.p-3 > table:last-child { margin-bottom: -.25rem; }
.card.border-warning { border-color: #f6d58e !important; box-shadow: 0 0 0 3px rgba(227,154,28,.08); }
.card.border-warning > h2.h6 { background: #fffaf0; border-radius: var(--radius) var(--radius) 0 0; }
.tabs-card { background: #fff; border: 1px solid var(--line); border-radius: .9rem; padding: 0 .5rem; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.tabs-card .nav-link { padding: .8rem .9rem; display: inline-flex; align-items: center; gap: .15rem; }
.kfig .progress { height: .35rem; }
.table tfoot td { border-bottom: 0; }
.invoice-sheet dl.row dt { color: #8494a3; font-weight: 600; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
@media print { .sidebar, .topbar, .dh-actions, .dh-band, .kpi-strip, .col-lg-4 { display: none !important; } .app .main { margin: 0; } .col-lg-8 { width: 100%; } }

.av.tl-type { width: 1.7rem; height: 1.7rem; font-size: .8rem; }
.av.tl-type.blue { --av-bg: #e8f0fc; --av-fg: #2f6fd0; } .av.tl-type.violet { --av-bg: #efeafb; --av-fg: #6a4bc9; }
.av.tl-type.amber { --av-bg: #fdf3e1; --av-fg: #c27f08; } .av.tl-type.green { --av-bg: #e3f5ec; --av-fg: #1a8a5b; }
.av.tl-type.rose { --av-bg: #fce8ec; --av-fg: #c93a55; } .av.tl-type:not(.blue):not(.violet):not(.amber):not(.green):not(.rose) { --av-bg: var(--aim-soft); --av-fg: var(--aim); }

.list-card .person { white-space: normal; max-width: 13rem; line-height: 1.25; }
.list-card .person > .av { align-self: center; }
.table a:not(.btn):not(.code-chip) { text-decoration: none; }
.table a:not(.btn):not(.code-chip):hover { text-decoration: underline; }
.filter-bar .form-switch .form-check-input { cursor: pointer; }
@media (max-width: 575.98px) {
    .kpi-strip { grid-template-columns: 1fr; gap: .6rem; }
    .kfig .k-val { font-size: 1.05rem; }
    .dh-title h1 { font-size: 1.15rem; }
    .dh-avatar, .dh-icon { width: 3.8rem; height: 3.8rem; font-size: 1.4rem; }
    .dh-main { padding-top: .25rem; flex-basis: 100%; }
    .search-box, .search-box input.form-control { width: 100%; min-width: 0; }
    .filter-bar .dt-search { flex-basis: 100%; }
    .ph-main .page-icon { width: 2.6rem; height: 2.6rem; font-size: 1.15rem; }
}
