:root {
    --brand: #2e1a5c;
    --brand-2: #3d2577;
    --accent: #14a38b;
    --accent-soft: #d8f3ee;
    --bg: #f4f5fa;
    --border: #e4e6ef;
    --muted: #6c7385;
    --sidebar-w: 264px;
    --bs-primary: #14a38b;
    --bs-primary-rgb: 20, 163, 139;
    --bs-link-color: #0f7f6c;
    --bs-link-color-rgb: 15, 127, 108;
    --bs-link-hover-color: #0b5f51;
    --bs-font-sans-serif: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

body { background: var(--bg); font-size: .9rem; color: #1f2333; }

.btn-primary { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: #0f8a75; --bs-btn-hover-border-color: #0f8a75; --bs-btn-active-bg: #0c7563; --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent); }
.btn-outline-primary { --bs-btn-color: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--accent); --bs-btn-hover-border-color: var(--accent); --bs-btn-active-bg: var(--accent); }
.btn-brand { background: var(--brand); color: #fff; border: 0; }
.btn-brand:hover { background: var(--brand-2); color: #fff; }
.text-bg-primary, .bg-primary { background-color: var(--accent) !important; }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.page-link { color: var(--accent); }
.active > .page-link { background: var(--accent); border-color: var(--accent); }

/* ---------- Layout ---------- */
.app-sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
    background: linear-gradient(180deg, var(--brand) 0%, #24134a 100%); color: #d9d3ee;
    display: flex; flex-direction: column;
}
.app-sidebar .brand { padding: 18px 20px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.app-sidebar .brand .logo { width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 1.2rem; }
.app-sidebar .brand .title { font-weight: 700; color: #fff; line-height: 1.1; }
.app-sidebar .brand .sub { font-size: .72rem; color: #b5abd6; }
.app-sidebar .nav-scroll { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.app-sidebar .nav-scroll::-webkit-scrollbar { width: 6px; }
.app-sidebar .nav-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
.app-sidebar .section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #9187b8; padding: 14px 12px 6px; }
.app-sidebar a.nav-item, .app-sidebar button.nav-item {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border-radius: 8px;
    color: #ddd7f2; text-decoration: none; border: 0; background: none; text-align: left; font-size: .87rem;
}
.app-sidebar .nav-item i { font-size: 1.05rem; opacity: .9; }
.app-sidebar .nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.app-sidebar .nav-item.active { background: var(--accent-soft); color: var(--brand); font-weight: 600; }
.app-sidebar .nav-item .count { margin-left: auto; font-size: .72rem; color: #a69cc9; }
.app-sidebar .nav-item.active .count { color: var(--brand); }
.app-sidebar .sub-nav { padding-left: 14px; }
.app-sidebar .sub-nav .nav-item { padding: 5px 12px; font-size: .82rem; }
.app-sidebar .sub-nav .nav-item::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #7d72a8; flex: none; }
.app-sidebar .sub-nav .nav-item.active::before { background: var(--accent); }
.app-sidebar .nav-item .chev { margin-left: auto; transition: transform .2s; font-size: .75rem; }
.app-sidebar .nav-item[aria-expanded="true"] .chev { transform: rotate(180deg); }
.app-sidebar .create-wrap { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.app-sidebar .create-wrap .btn { background: #fff; color: var(--brand); font-weight: 600; }

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.app-topbar {
    position: sticky; top: 0; z-index: 1030; background: #fff; border-bottom: 1px solid var(--border);
    padding: 10px 24px; display: flex; align-items: center; gap: 16px;
}
.app-topbar .breadcrumb { margin: 0; font-size: .85rem; background: var(--bg); padding: 6px 12px; border-radius: 8px; }
.app-topbar .tag-search { max-width: 280px; }
.app-content { padding: 22px 24px 40px; flex: 1; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--brand); display: inline-grid; place-items: center; font-weight: 700; font-size: .8rem; }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); transition: transform .25s; }
    .app-sidebar.show { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
    .app-main { margin-left: 0; }
    .app-content { padding: 16px; }
    .app-topbar { padding: 10px 16px; }
}

/* ---------- Components ---------- */
.card { border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 1px 2px rgba(20,20,50,.03); }
.card-header { background: #fff; border-bottom: 1px solid var(--border); font-weight: 600; padding: 12px 16px; border-radius: 12px 12px 0 0 !important; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
.page-head h1 { font-size: 1.35rem; font-weight: 700; margin: 0; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.stat-card { padding: 16px 18px; }
.stat-card .label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .value { font-size: 1.6rem; font-weight: 700; }
.stat-card .icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; font-size: 1.2rem; }

.table-assets { margin: 0; }
.table-assets thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbfd; font-weight: 600; white-space: nowrap; border-bottom: 1px solid var(--border); }
.table-assets td { vertical-align: middle; }
.table-assets .thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--bg); display: grid; place-items: center; color: var(--muted); font-size: 1.2rem; }
.table-assets a.tag { font-weight: 600; text-decoration: none; }

.badge-dot { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.badge-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.filter-bar .form-select, .filter-bar .form-control { font-size: .85rem; }

/* Asset detail (Freshservice-like) */
.asset-hero { background: linear-gradient(135deg, #fff 0%, #f1eefb 100%); }
.asset-hero .hero-img { width: 120px; height: 120px; border-radius: 14px; object-fit: cover; background: #fff; border: 1px solid var(--border); display: grid; place-items: center; font-size: 3rem; color: var(--brand-2); }
.dl-grid { display: grid; grid-template-columns: minmax(150px, 38%) 1fr; row-gap: 10px; column-gap: 16px; margin: 0; }
.dl-grid dt { color: var(--muted); font-weight: 500; }
.dl-grid dd { margin: 0; word-break: break-word; }
.nav-tabs .nav-link { color: var(--muted); border: 0; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link.active { color: var(--accent); border-bottom-color: var(--accent); background: none; font-weight: 600; }

.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 18px 28px; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .dot { position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }

/* Category picker */
.cat-tile { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; color: inherit; text-decoration: none; transition: .15s; }
.cat-tile:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(20,163,139,.15); transform: translateY(-1px); }
.cat-tile .ic { width: 42px; height: 42px; border-radius: 10px; background: var(--accent-soft); color: var(--brand); display: grid; place-items: center; font-size: 1.3rem; flex: none; }

/* Custom field manager (Pipedrive-like) */
.field-row .type-ic { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); display: grid; place-items: center; color: var(--muted); font-size: .8rem; font-weight: 600; background: #fafbfd; }
.chip { display: inline-block; font-size: .68rem; font-weight: 600; letter-spacing: .04em; padding: 2px 8px; border-radius: 6px; background: #eef0f5; color: #555c70; text-transform: uppercase; }

.form-label { font-weight: 500; font-size: .83rem; margin-bottom: .3rem; }
.form-section-title { font-size: .78rem; font-weight: 700; color: var(--brand-2); text-transform: uppercase; letter-spacing: .06em; margin: 4px 0 12px; display: flex; align-items: center; gap: 8px; }
.form-section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.required::after { content: " *"; color: #dc3545; }

.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-wrap .art { background: linear-gradient(160deg, var(--brand) 0%, #24134a 60%, #0f6f60 100%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-wrap .form-side { display: grid; place-items: center; padding: 32px; background: #fff; }
@media (max-width: 860px) { .login-wrap { grid-template-columns: 1fr; } .login-wrap .art { display: none; } }

.bar { height: 8px; border-radius: 4px; background: #eceef4; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }

@media print {
    .app-sidebar, .app-topbar, .no-print { display: none !important; }
    .app-main { margin: 0; }
    body { background: #fff; }
}


/* Sidebar organization logo */
.app-sidebar .brand .logo {
    width: 42px;
    height: 42px;
    min-width: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 8px;
}

.app-sidebar .brand .sidebar-logo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Keep the logo compact when sidebar is collapsed */
@media (min-width: 992px) {
    body.sb-collapsed #sidebar .brand .logo {
        width: 42px;
        height: 42px;
        min-width: 42px;
    }
}


/* Bilingual text (@t): admin pages show English only */
.l-hi { display: none; }
