/* ============================================================
   Woowtech Smart Space Solution — Tool Borrow Portal
   Brand Design System CSS

   Primary Theme: Odoo Purple (#714B67)
   Brand Identity: #6183FC (Woowtech Blue)
   Typography: Outfit (body), system fallbacks
   Color Ratio: White 50% / Gray 20% / Deep Gray 10% /
                Purple 10% / Accent 5% / Black 5%
   ============================================================ */

/* --- Google Fonts Import --- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
    /* Brand Primary — follows odoo_color_customizer if installed */
    --tb-primary: var(--custom-primary, #714B67);
    --tb-primary-dark: var(--custom-primary-active, #5a3c52);
    --tb-primary-light: var(--custom-primary-hover, #8e6584);
    --tb-primary-lighter: var(--custom-primary-light, #f3edf2);

    /* Text-safe brand color: used for links/titles on white background.
       Uses the darkest brand shade so bright primary colors stay readable. */
    --tb-primary-text: var(--custom-primary-active, #5a3c52);

    /* Woowtech Identity */
    --tb-brand-blue: #6183FC;

    /* Neutral Palette */
    --tb-white: #FFFFFF;
    --tb-bg-light: #EFF1F5;
    --tb-gray: #646262;
    --tb-deep-gray: #212121;
    --tb-black: #000000;

    /* Accent Colors */
    --tb-cyan: #7BDBE0;
    --tb-yellow: #F8D158;
    --tb-sky-blue: #65C2E0;
    --tb-royal-blue: #6791DE;
    --tb-green: #8CD37F;
    --tb-brown: #B17148;
    --tb-sand: #F1C692;
    --tb-orange: #E66D3E;
    --tb-coral: #F45D6D;
    --tb-lavender: #C09FE0;

    /* Semantic Status Colors */
    --tb-status-available: #8CD37F;
    --tb-status-available-bg: #f0f9ee;
    --tb-status-borrowed: #F8D158;
    --tb-status-borrowed-bg: #fef9eb;
    --tb-status-maintenance: #E66D3E;
    --tb-status-maintenance-bg: #fdf0eb;
    --tb-status-pending: #65C2E0;
    --tb-status-pending-bg: #edf8fb;
    --tb-status-approved: #6183FC;
    --tb-status-approved-bg: #eef2ff;
    --tb-status-rejected: #F45D6D;
    --tb-status-rejected-bg: #feeef0;
    --tb-status-returned: #C09FE0;
    --tb-status-returned-bg: #f6f1fb;
    --tb-status-draft: #646262;
    --tb-status-draft-bg: #f0f0f0;

    /* Spacing */
    --tb-space-xs: 4px;
    --tb-space-sm: 8px;
    --tb-space-md: 16px;
    --tb-space-lg: 24px;
    --tb-space-xl: 32px;
    --tb-space-2xl: 48px;

    /* Border Radius */
    --tb-radius-sm: 6px;
    --tb-radius-md: 10px;
    --tb-radius-lg: 16px;
    --tb-radius-xl: 20px;
    --tb-radius-full: 50px;

    /* Shadows — use neutral tones for cross-theme compatibility */
    --tb-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --tb-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --tb-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.10);
    --tb-shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.14);

    /* Transitions */
    --tb-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --tb-transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Base Typography --- */
.tb-portal-page,
.tb-portal-page * {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* --- Portal Page Wrapper --- */
.tb-portal-page {
    background: var(--tb-bg-light);
    min-height: 100vh;
}

/* --- Hamburger Menu Override (basic three-line ☰) --- */
.o_main_navbar .navbar-toggler .oi,
.o_main_navbar .navbar-toggler .fa,
.o_main_navbar .navbar-toggler .mdi,
.o_main_navbar .navbar-toggler [class*="oi-"],
.o_main_navbar button.navbar-toggler .oi {
    font-size: 0 !important;
    line-height: 0;
    display: block;
    width: 22px;
    height: 18px;
    position: relative;
}

.o_main_navbar .navbar-toggler .oi::before,
.o_main_navbar .navbar-toggler .fa::before,
.o_main_navbar .navbar-toggler .mdi::before,
.o_main_navbar .navbar-toggler [class*="oi-"]::before {
    content: '' !important;
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    position: absolute;
    top: 0;
    left: 0;
    box-shadow: 0 8px 0 currentColor, 0 16px 0 currentColor;
}

/* --- Page Header --- */
.tb-page-header {
    background: var(--tb-primary);
    padding: var(--tb-space-xl) 0;
    margin: calc(-1 * var(--tb-space-md)) calc(-1 * var(--tb-space-md)) var(--tb-space-xl);
    border-radius: 0 0 var(--tb-radius-xl) var(--tb-radius-xl);
    color: var(--tb-white);
    position: relative;
    overflow: hidden;
}

.tb-page-header h2 {
    font-weight: 600;
    font-size: 1.75rem;
    margin: 0;
    position: relative;
    z-index: 1;
}

.tb-page-header p {
    opacity: 0.85;
    margin: var(--tb-space-xs) 0 0;
    font-weight: 300;
    position: relative;
    z-index: 1;
}

.tb-page-header .tb-header-icon {
    font-size: 2.5rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

/* --- Portal Home Cards --- */
.o_portal_icon .mdi {
    font-size: 2.5rem;
    color: var(--tb-primary-text) !important;
    transition: var(--tb-transition);
}

.o_portal_index_card a:hover .o_portal_icon .mdi {
    color: var(--tb-primary) !important;
    transform: scale(1.1);
}

.o_portal_index_card a {
    border: 1px solid transparent;
    transition: var(--tb-transition) !important;
}

.o_portal_index_card a:hover {
    border-color: var(--tb-primary-lighter) !important;
    box-shadow: var(--tb-shadow-md) !important;
    background: var(--tb-white) !important;
}

/* --- Tool Cards Grid --- */
.tb-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--tb-space-lg);
}

.tb-tool-card {
    background: var(--tb-white);
    border-radius: var(--tb-radius-lg);
    border: 1px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: var(--tb-transition);
    display: flex;
    flex-direction: column;
    position: relative;
}

.tb-tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--tb-shadow-lg);
    border-color: var(--tb-primary-lighter);
}

.tb-tool-card-header {
    padding: var(--tb-space-lg);
    padding-bottom: var(--tb-space-md);
    display: flex;
    align-items: flex-start;
    gap: var(--tb-space-md);
}

.tb-tool-card-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--tb-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--tb-primary-lighter);
    color: var(--tb-primary-text);
    font-size: 1.5rem;
}

.tb-tool-card-info {
    flex: 1;
    min-width: 0;
}

.tb-tool-card-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--tb-deep-gray);
    margin: 0 0 var(--tb-space-xs);
    line-height: 1.3;
}

.tb-tool-card-title a {
    color: inherit;
    text-decoration: none;
    transition: var(--tb-transition-fast);
}

.tb-tool-card-title a:hover {
    color: var(--tb-primary-text);
}

.tb-tool-card-code {
    font-size: 0.8rem;
    color: var(--tb-gray);
    font-weight: 400;
    letter-spacing: 0.02em;
}

.tb-tool-card-body {
    padding: 0 var(--tb-space-lg) var(--tb-space-md);
    flex: 1;
}

.tb-tool-card-category {
    display: inline-flex;
    align-items: center;
    gap: var(--tb-space-xs);
    font-size: 0.8rem;
    color: var(--tb-gray);
    background: var(--tb-bg-light);
    padding: 3px 10px;
    border-radius: var(--tb-radius-full);
}

.tb-tool-card-footer {
    padding: var(--tb-space-md) var(--tb-space-lg);
    border-top: 1px solid var(--tb-bg-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* --- Status Badges --- */
.tb-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: var(--tb-radius-full);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.5;
}

.tb-badge::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tb-badge-available {
    background: var(--tb-status-available-bg);
    color: #3d7a2e;
}
.tb-badge-available::before { background: var(--tb-status-available); }

.tb-badge-borrowed {
    background: var(--tb-status-borrowed-bg);
    color: #8a6d1b;
}
.tb-badge-borrowed::before { background: var(--tb-status-borrowed); }

.tb-badge-maintenance {
    background: var(--tb-status-maintenance-bg);
    color: #a14520;
}
.tb-badge-maintenance::before { background: var(--tb-status-maintenance); }

.tb-badge-pending {
    background: var(--tb-status-pending-bg);
    color: #2a7a92;
}
.tb-badge-pending::before { background: var(--tb-status-pending); }

.tb-badge-approved {
    background: var(--tb-status-approved-bg);
    color: #3a56b8;
}
.tb-badge-approved::before { background: var(--tb-status-approved); }

.tb-badge-rejected {
    background: var(--tb-status-rejected-bg);
    color: #b83040;
}
.tb-badge-rejected::before { background: var(--tb-status-rejected); }

.tb-badge-returned {
    background: var(--tb-status-returned-bg);
    color: #6b4d8e;
}
.tb-badge-returned::before { background: var(--tb-status-returned); }

.tb-badge-draft {
    background: var(--tb-status-draft-bg);
    color: var(--tb-gray);
}
.tb-badge-draft::before { background: var(--tb-status-draft); }

/* --- View Detail Link --- */
.tb-view-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--tb-primary-text);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--tb-transition-fast);
}

.tb-view-link:hover {
    color: var(--tb-primary);
    gap: 10px;
}

.tb-view-link .mdi {
    font-size: 1.1rem;
    transition: var(--tb-transition-fast);
}

/* --- Detail Page --- */
.tb-detail-card {
    background: var(--tb-white);
    border-radius: var(--tb-radius-lg);
    border: 1px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
    box-shadow: var(--tb-shadow-sm);
}

.tb-detail-header {
    background: var(--tb-primary);
    padding: var(--tb-space-xl) var(--tb-space-xl);
    color: var(--tb-white);
    position: relative;
    overflow: hidden;
}

.tb-detail-header h3 {
    font-weight: 600;
    font-size: 1.5rem;
    margin: 0 0 var(--tb-space-sm);
    position: relative;
    z-index: 1;
}

.tb-detail-header .tb-code-tag {
    background: rgba(255, 255, 255, 0.15);
    color: var(--tb-white);
    padding: 3px 12px;
    border-radius: var(--tb-radius-full);
    font-size: 0.8rem;
    font-weight: 400;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(4px);
}

.tb-detail-body {
    padding: var(--tb-space-xl);
}

/* --- Info Grid --- */
.tb-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--tb-space-md);
    margin-bottom: var(--tb-space-xl);
}

.tb-info-item {
    padding: var(--tb-space-md);
    background: var(--tb-bg-light);
    border-radius: var(--tb-radius-md);
    display: flex;
    align-items: center;
    gap: var(--tb-space-md);
}

.tb-info-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--tb-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tb-white);
    color: var(--tb-primary-text);
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: var(--tb-shadow-sm);
}

.tb-info-label {
    font-size: 0.75rem;
    color: var(--tb-gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
    margin-bottom: 2px;
}

.tb-info-value {
    font-size: 0.95rem;
    color: var(--tb-deep-gray);
    font-weight: 500;
}

.tb-info-value a {
    color: var(--tb-primary-text);
    text-decoration: none;
}

.tb-info-value a:hover {
    text-decoration: underline;
}

/* --- Borrow Alert --- */
.tb-borrower-alert {
    display: flex;
    align-items: center;
    gap: var(--tb-space-md);
    padding: var(--tb-space-md) var(--tb-space-lg);
    background: var(--tb-status-borrowed-bg);
    border-radius: var(--tb-radius-md);
    border-left: 4px solid var(--tb-status-borrowed);
    margin-bottom: var(--tb-space-xl);
}

.tb-borrower-alert .mdi {
    font-size: 1.5rem;
    color: #8a6d1b;
}

.tb-borrower-alert-text {
    font-size: 0.9rem;
    color: #8a6d1b;
}

.tb-borrower-alert-text strong {
    font-weight: 600;
}

/* --- Request Form --- */
.tb-request-form {
    background: var(--tb-bg-light);
    border-radius: var(--tb-radius-lg);
    padding: var(--tb-space-xl);
    border: 2px dashed rgba(0, 0, 0, 0.10);
    margin-top: var(--tb-space-xl);
}

.tb-request-form h5 {
    font-weight: 600;
    color: var(--tb-deep-gray);
    margin-bottom: var(--tb-space-md);
    display: flex;
    align-items: center;
    gap: var(--tb-space-sm);
}

.tb-request-form h5 .mdi {
    color: var(--tb-primary-text);
    font-size: 1.4rem;
}

.tb-request-form textarea {
    border: 1px solid rgba(0, 0, 0, 0.10);
    border-radius: var(--tb-radius-md);
    padding: var(--tb-space-md);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    transition: var(--tb-transition);
    resize: vertical;
    min-height: 100px;
}

.tb-request-form textarea:focus {
    border-color: var(--tb-primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
    outline: none;
}

/* --- Primary Button --- */
.tb-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: var(--tb-space-sm);
    background: var(--tb-primary);
    color: var(--tb-white) !important;
    border: none;
    padding: 10px 24px;
    border-radius: var(--tb-radius-full);
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--tb-transition);
    text-decoration: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.tb-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    color: var(--tb-white) !important;
}

.tb-btn-primary:active {
    transform: translateY(0);
}

.tb-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: var(--tb-space-sm);
    background: var(--tb-white);
    color: var(--tb-gray) !important;
    border: 1px solid rgba(100, 98, 98, 0.2);
    padding: 10px 24px;
    border-radius: var(--tb-radius-full);
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--tb-transition);
    text-decoration: none !important;
}

.tb-btn-secondary:hover {
    background: var(--tb-bg-light);
    color: var(--tb-deep-gray) !important;
    border-color: rgba(100, 98, 98, 0.3);
}

/* --- Loans Table --- */
.tb-loans-table {
    background: var(--tb-white);
    border-radius: var(--tb-radius-lg);
    border: 1px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
    box-shadow: var(--tb-shadow-sm);
}

.tb-loans-table table {
    margin: 0;
    border-collapse: collapse;
    width: 100%;
}

.tb-loans-table thead th {
    background: var(--tb-bg-light);
    padding: var(--tb-space-md) var(--tb-space-lg);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--tb-gray);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    white-space: nowrap;
}

.tb-loans-table tbody td {
    padding: var(--tb-space-md) var(--tb-space-lg);
    vertical-align: middle;
    border-bottom: 1px solid var(--tb-bg-light);
    font-size: 0.9rem;
    color: var(--tb-deep-gray);
}

.tb-loans-table tbody tr {
    transition: var(--tb-transition-fast);
}

.tb-loans-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

.tb-loans-table tbody tr:last-child td {
    border-bottom: none;
}

.tb-loan-tool-name {
    font-weight: 500;
    color: var(--tb-deep-gray);
}

.tb-loan-tool-name a {
    color: inherit;
    text-decoration: none;
}

.tb-loan-tool-name a:hover {
    color: var(--tb-primary-text);
}

.tb-loan-tool-code {
    font-size: 0.78rem;
    color: var(--tb-gray);
    margin-top: 2px;
}

.tb-loan-date {
    color: var(--tb-gray);
    font-size: 0.85rem;
    white-space: nowrap;
}

/* --- Status Timeline --- */
.tb-timeline {
    position: relative;
    padding: var(--tb-space-lg) 0;
}

.tb-timeline-item {
    display: flex;
    align-items: flex-start;
    gap: var(--tb-space-md);
    position: relative;
    padding-bottom: var(--tb-space-xl);
}

.tb-timeline-item:last-child {
    padding-bottom: 0;
}

.tb-timeline-item::before {
    content: '';
    position: absolute;
    left: 17px;
    top: 36px;
    bottom: 0;
    width: 2px;
    background: var(--tb-bg-light);
}

.tb-timeline-item:last-child::before {
    display: none;
}

.tb-timeline-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
    position: relative;
    z-index: 1;
}

.tb-timeline-dot-completed {
    background: var(--tb-status-available-bg);
    color: #3d7a2e;
}

.tb-timeline-dot-active {
    background: var(--tb-primary-lighter);
    color: var(--tb-primary-text);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.08);
}

.tb-timeline-dot-pending {
    background: var(--tb-bg-light);
    color: #b0b0b0;
}

.tb-timeline-dot-rejected {
    background: var(--tb-status-rejected-bg);
    color: #b83040;
}

.tb-timeline-content {
    flex: 1;
    padding-top: 6px;
}

.tb-timeline-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--tb-deep-gray);
    margin-bottom: 2px;
}

.tb-timeline-title-muted {
    color: #b0b0b0;
    font-weight: 500;
}

.tb-timeline-date {
    font-size: 0.78rem;
    color: var(--tb-gray);
}

.tb-timeline-item::before {
    background: var(--tb-bg-light);
}

.tb-timeline-item.tb-step-completed::before {
    background: var(--tb-status-available);
}

/* --- Notes Section --- */
.tb-notes-section {
    background: var(--tb-bg-light);
    border-radius: var(--tb-radius-md);
    padding: var(--tb-space-lg);
    margin-top: var(--tb-space-lg);
}

.tb-notes-section h5 {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--tb-deep-gray);
    margin-bottom: var(--tb-space-sm);
    display: flex;
    align-items: center;
    gap: var(--tb-space-sm);
}

.tb-notes-section h5 .mdi {
    color: var(--tb-primary-text);
}

.tb-notes-content {
    font-size: 0.9rem;
    color: var(--tb-gray);
    line-height: 1.7;
}

/* --- Empty State --- */
.tb-empty-state {
    text-align: center;
    padding: var(--tb-space-2xl) var(--tb-space-xl);
    background: var(--tb-white);
    border-radius: var(--tb-radius-lg);
    border: 2px dashed rgba(0, 0, 0, 0.08);
}

.tb-empty-state .mdi {
    font-size: 3.5rem;
    color: var(--tb-primary-lighter);
    margin-bottom: var(--tb-space-md);
    display: block;
}

.tb-empty-state p {
    color: var(--tb-gray);
    font-size: 1rem;
    margin-bottom: var(--tb-space-md);
}

.tb-empty-state a {
    color: var(--tb-primary-text);
    font-weight: 500;
}

/* --- Back Button --- */
.tb-back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--tb-space-sm);
    color: var(--tb-gray);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--tb-transition-fast);
    margin-top: var(--tb-space-lg);
}

.tb-back-link:hover {
    color: var(--tb-primary-text);
}

/* --- Pagination Override --- */
.tb-portal-page .pagination .page-link {
    border-radius: var(--tb-radius-sm);
    margin: 0 2px;
    color: var(--tb-primary-text);
    border-color: rgba(0, 0, 0, 0.10);
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
}

.tb-portal-page .pagination .page-item.active .page-link {
    background: var(--tb-primary);
    border-color: var(--tb-primary);
    color: var(--tb-white);
}

/* --- Mobile Cards (for loans on small screens) --- */
.tb-loan-cards {
    display: none;
}

@media (max-width: 767.98px) {
    .tb-loans-table .table-responsive {
        display: none;
    }

    .tb-loan-cards {
        display: flex;
        flex-direction: column;
        gap: var(--tb-space-md);
    }

    .tb-loan-card-item {
        background: var(--tb-white);
        border-radius: var(--tb-radius-md);
        border: 1px solid rgba(0, 0, 0, 0.06);
        padding: var(--tb-space-md);
        display: flex;
        align-items: center;
        gap: var(--tb-space-md);
        text-decoration: none;
        transition: var(--tb-transition);
    }

    .tb-loan-card-item:hover {
        box-shadow: var(--tb-shadow-md);
        border-color: var(--tb-primary-lighter);
    }

    .tb-loan-card-item-info {
        flex: 1;
        min-width: 0;
    }

    .tb-loan-card-item-tool {
        font-weight: 500;
        color: var(--tb-deep-gray);
        font-size: 0.9rem;
    }

    .tb-loan-card-item-meta {
        font-size: 0.78rem;
        color: var(--tb-gray);
        margin-top: 2px;
    }

    .tb-loan-card-item-arrow {
        color: var(--tb-gray);
        font-size: 1.2rem;
    }

    .tb-page-header {
        margin: calc(-1 * var(--tb-space-sm)) calc(-1 * var(--tb-space-sm)) var(--tb-space-lg);
        padding: var(--tb-space-lg) var(--tb-space-md);
    }

    .tb-page-header h2 {
        font-size: 1.35rem;
    }

    .tb-tools-grid {
        grid-template-columns: 1fr;
        gap: var(--tb-space-md);
    }

    .tb-info-grid {
        grid-template-columns: 1fr;
    }

    .tb-detail-header {
        padding: var(--tb-space-lg);
    }

    .tb-detail-body {
        padding: var(--tb-space-lg);
    }
}

/* --- Searchbar styling --- */
.tb-portal-page .o_portal_search_panel {
    background: var(--tb-white);
    border-radius: var(--tb-radius-lg);
    border: 1px solid rgba(0, 0, 0, 0.06);
    padding: var(--tb-space-md);
    margin-bottom: var(--tb-space-lg);
    box-shadow: var(--tb-shadow-sm);
}

/* --- Section Title --- */
.tb-section-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--tb-deep-gray);
    margin-bottom: var(--tb-space-lg);
    padding-bottom: var(--tb-space-sm);
    border-bottom: 2px solid var(--tb-primary-lighter);
    display: flex;
    align-items: center;
    gap: var(--tb-space-sm);
}

.tb-section-title .mdi {
    color: var(--tb-primary-text);
    font-size: 1.3rem;
}

/* --- Stats Counter (for home portal) --- */
.tb-counter {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--tb-primary-text);
    line-height: 1;
}

/* --- Portal Chatter / Message Section --- */
.tb-chatter-section {
    margin-top: var(--tb-space-xl);
}

.tb-chatter-section .tb-section-title {
    margin-bottom: var(--tb-space-md);
}

.tb-chatter-section .o_portal_chatter {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.tb-chatter-section .o_portal_chatter_composer {
    background: var(--tb-bg-light);
    border-radius: var(--tb-radius-md);
    padding: var(--tb-space-lg);
    border: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: var(--tb-space-lg);
}

.tb-chatter-section .o_portal_chatter_composer textarea {
    border: 1px solid rgba(0, 0, 0, 0.10);
    border-radius: var(--tb-radius-md);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    transition: var(--tb-transition);
}

.tb-chatter-section .o_portal_chatter_composer textarea:focus {
    border-color: var(--tb-primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.tb-chatter-section .o_portal_chatter_composer .btn-primary {
    background: var(--tb-primary);
    border-color: var(--tb-primary);
    border-radius: var(--tb-radius-full);
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
}

.tb-chatter-section .o_portal_chatter_composer .btn-primary:hover {
    background: var(--tb-primary-dark);
    border-color: var(--tb-primary-dark);
}

.tb-chatter-section .o_portal_chatter_message {
    border-bottom: 1px solid var(--tb-bg-light);
    padding: var(--tb-space-md) 0;
}

.tb-chatter-section .o_portal_chatter_message:last-child {
    border-bottom: none;
}

.tb-chatter-section .o_portal_chatter_avatar {
    border-radius: 50%;
}

.tb-chatter-section .o_portal_chatter_message_title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--tb-deep-gray);
}

/* ============================================================
   Color Customizer Overrides
   odoo_color_customizer sets broad link color with !important:
     #wrapwrap a:not(.btn):not(.nav-link):not(.dropdown-item)
       { color: <primary> !important; }        — specificity (1,3,1)
   Our portal_brand.css loads BEFORE the customizer CSS, so at
   equal specificity the customizer wins.  We use specificity (1,4,1)
   via #wrapwrap + 4 class selectors to guarantee our text-safe
   colors prevail regardless of source order.
   ============================================================ */
/* --- Title links: dark text on white  — specificity (1,4,1) --- */
#wrapwrap .tb-portal-page .tb-tool-card .tb-tool-card-info .tb-tool-card-title a,
#wrapwrap .tb-portal-page .tb-loans-table .table-responsive .tb-loan-tool-name a {
    color: var(--tb-deep-gray) !important;
}

#wrapwrap .tb-portal-page .tb-tool-card .tb-tool-card-info .tb-tool-card-title a:hover,
#wrapwrap .tb-portal-page .tb-loans-table .table-responsive .tb-loan-tool-name a:hover {
    color: var(--tb-primary-text) !important;
}

/* --- Accent links: darker brand shade  — specificity (1,4,1) --- */
#wrapwrap .tb-portal-page .tb-tool-card .tb-tool-card-footer .tb-view-link,
#wrapwrap .tb-portal-page .tb-loans-table .table-responsive a.tb-view-link,
#wrapwrap .tb-portal-page .tb-detail-card .tb-detail-body .tb-info-value a,
#wrapwrap .tb-portal-page .tb-detail-card .tb-detail-body .tb-empty-state a {
    color: var(--tb-primary-text) !important;
}

#wrapwrap .tb-portal-page .tb-tool-card .tb-tool-card-footer .tb-view-link:hover,
#wrapwrap .tb-portal-page .tb-loans-table .table-responsive a.tb-view-link:hover {
    color: var(--tb-primary) !important;
}

/* --- Back links: gray default, brand accent on hover --- */
#wrapwrap .o_portal_wrap .container .tb-portal-page a.tb-back-link {
    color: var(--tb-gray) !important;
}

#wrapwrap .o_portal_wrap .container .tb-portal-page a.tb-back-link:hover {
    color: var(--tb-primary-text) !important;
}

/* --- Pagination — specificity (1,4,1) --- */
#wrapwrap .tb-portal-page .pagination .page-item .page-link {
    color: var(--tb-primary-text) !important;
}

#wrapwrap .tb-portal-page .pagination .page-item.active .page-link {
    color: var(--tb-white) !important;
    background: var(--tb-primary) !important;
    border-color: var(--tb-primary) !important;
}

/* --- Portal home card text — specificity (1,4,1) --- */
#wrapwrap .o_portal_wrap .container .o_portal_my_home .o_portal_index_card a {
    color: inherit !important;
}

/* --- Breadcrumb links — covers both list and detail page layouts --- */
#wrapwrap main .o_portal_submenu.breadcrumb .breadcrumb-item a {
    color: var(--tb-primary-text) !important;
}

/* --- Mobile loan card links: the <a> IS the card element --- */
#wrapwrap .o_portal_wrap .tb-portal-page .tb-loan-cards a.tb-loan-card-item {
    color: inherit !important;
}
