/* ══════════════════════════════════════════════════════════════════════
   Dragon ERP — Global Stylesheet  (Odoo-style layout)
   الـ layout الرئيسي في MainLayout.razor — هذا الملف للمكوّنات المشتركة
══════════════════════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body, #app {
    margin: 0; padding: 0;
    height: 100%; width: 100%;
    overflow: hidden;
}

body {
    font-family: var(--app-font-family);
    font-size: var(--app-font-size);
    font-weight: var(--app-font-weight);
    background: var(--app-bg);
    color: var(--text-primary);
    transition: background 0.25s, color 0.25s;
}

/* ══════════════════════════════════════════════════════════════════════
   CSS VARIABLES — Light Mode (default)
   Palette: DevExpress Blazing-inspired + SAP Fiori neutral
══════════════════════════════════════════════════════════════════════ */
:root {
    /* Brand */
    --brand: #0b5360; /* deep teal */
    --brand-light: #0f7180; /* primary action */
    --brand-hover: #083f49;
    --brand-accent: #c79a45; /* warm gold */
    --brand-accent-2: #34c38f; /* green success */
    --brand-danger: #f46a6a; /* coral danger */
    /* Surfaces */
    --app-bg: #f4f7f8;
    --surface: #ffffff;
    --surface-2: #edf3f4;
    --surface-3: #e2ecee;
    --border: #d2dfe2;
    --border-light: #e5edef;
    /* Text */
    --text-primary: #17323a;
    --text-secondary: #58707a;
    --text-muted: #80949b;
    --text-inverse: #ffffff;
    /* Topbar */
    --topbar-bg: #0b5360;
    --topbar-text: #ffffff;
    --topbar-height: 48px;
    /* Secbar (secondary nav under topbar) */
    --secbar-bg: #ffffff;
    --secbar-border: #d8dde6;
    --secbar-active: #0a5f7a;
    --secbar-height: 40px;
    /* Sidebar */
    --sidebar-bg: #0b5360;
    --sidebar-text: rgba(255,255,255,0.80);
    --sidebar-hover: rgba(255,255,255,0.10);
    /* Status colors */
    --color-success: #34c38f;
    --color-warning: #f5a623;
    --color-danger: #f46a6a;
    --color-info: #50a5f1;
    --color-purple: #0284c7;
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.14);
    /* Misc */
    --radius: 6px;
    --radius-lg: 10px;
    --transition: 0.2s ease;
    --app-font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    --app-font-size: 14px;
    --app-font-weight: 400;
}

/* ══════════════════════════════════════════════════════════════════════
   CSS VARIABLES — Dark Mode
   Palette: DevExpress Dark + Material Dark Surface
══════════════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
    /* Surfaces */
    --app-bg: #0f1923;
    --surface: #1a2535;
    --surface-2: #1f2d3d;
    --surface-3: #253548;
    --border: #2d3f52;
    --border-light: #243145;
    /* Text */
    --text-primary: #dde4ee;
    --text-secondary: #8fa3b8;
    --text-muted: #9aabba;
    --text-inverse: #0f1923;
    /* Topbar */
    --topbar-bg: #0a1929;
    --topbar-text: #dde4ee;
    /* Secbar */
    --secbar-bg: #1a2535;
    --secbar-border: #2d3f52;
    --secbar-active: #4fc3f7;
    /* Sidebar */
    --sidebar-bg: #0a1929;
    --sidebar-text: rgba(221,228,238,0.80);
    --sidebar-hover: rgba(79,195,247,0.12);
    /* Brand adjusted for dark */
    --brand: #1282a2;
    --brand-light: #4fc3f7;
    --brand-hover: #29b6f6;
    --brand-accent: #ffd54f;
    /* Status colors (lighter for dark bg) */
    --color-success: #66bb6a;
    --color-warning: #ffca28;
    --color-danger: #ef5350;
    --color-info: #42a5f5;
    --color-purple: #38bdf8;
    /* Shadows */
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.40);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.50);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.60);
}

/* Header visibility guard */
.odoo-shell .clean-topbar {
    background: var(--topbar-bg) !important;
    color: var(--topbar-text) !important;
}
.odoo-shell .clean-topbar * { color: var(--topbar-text); }
.odoo-shell .clean-search__input { color: var(--topbar-text) !important; }
.odoo-shell .clean-search__input::placeholder { color: rgba(255,255,255,.75) !important; }

/* Dark mode overrides for Bootstrap */
[data-theme="dark"] .card             { background: var(--surface); border-color: var(--border); color: var(--text-primary); }
[data-theme="dark"] .card-header      { background: var(--surface-2); border-color: var(--border); color: var(--text-primary); }
[data-theme="dark"] .card-body        { background: var(--surface); color: var(--text-primary); }
[data-theme="dark"] .table           { color: var(--text-primary); border-color: var(--border); }
[data-theme="dark"] .table-dark      { background: #1a1a2e; color: #e0e0e0; }
[data-theme="dark"] .table thead th  { background: #2d2d2d; color: #e0e0e0; border-color: var(--border); }
[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) { background: rgba(255,255,255,0.03); }
[data-theme="dark"] .table tbody tr:hover { background: #2a3040; }
[data-theme="dark"] .table-bordered  { border-color: var(--border) !important; }
[data-theme="dark"] .table-bordered td,
[data-theme="dark"] .table-bordered th { border-color: var(--border) !important; }
[data-theme="dark"] .modal-content   { background: var(--surface); color: var(--text-primary); border-color: var(--border); }
[data-theme="dark"] .modal-header, [data-theme="dark"] .modal-footer { border-color: var(--border); }

/* Restaurant cashier layout hardening */
.restaurant-pos.cashier-page-fix {
    min-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.restaurant-pos .pos-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
}

.restaurant-pos .pos-items {
    min-width: 0;
}

.restaurant-pos .pos-items-grid {
    min-height: 220px;
}

.restaurant-pos .pos-cart {
    width: 420px;
    max-width: 44vw;
    min-width: 340px;
    min-height: 0;
}

.restaurant-pos .pos-cart > .p-2.border-top.bg-white {
    position: sticky;
    bottom: 0;
    z-index: 3;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
}

.restaurant-pos .pos-item-btn {
    min-height: 148px;
}

.restaurant-pos .btn-cat {
    border-radius: 999px;
    font-weight: 600;
}

@media (max-width: 1200px) {
    .restaurant-pos .pos-cart {
        width: 360px;
        min-width: 320px;
    }
}

@media (max-width: 992px) {
    .restaurant-pos .pos-body {
        flex-direction: column;
    }
    .restaurant-pos .pos-cart {
        width: 100%;
        max-width: 100%;
        min-width: 100%;
    }
}
[data-theme="dark"] .form-control, [data-theme="dark"] .form-select {
    background: #1e2a3a; border-color: #3a4a5a;
    color: var(--text-primary);
}
[data-theme="dark"] .form-control:focus, [data-theme="dark"] .form-select:focus {
    background: #1e2a3a; border-color: #64b5f6;
    color: var(--text-primary); box-shadow: 0 0 0 0.2rem rgba(100,181,246,0.2);
}
[data-theme="dark"] .form-control::placeholder { color: var(--text-muted); }
[data-theme="dark"] .input-group-text { background: #2a3a4a; border-color: #3a4a5a; color: var(--text-secondary); }
[data-theme="dark"] .dropdown-menu   { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .dropdown-item   { color: var(--text-primary); }
[data-theme="dark"] .dropdown-item:hover { background: var(--surface-2); color: var(--text-primary); }
[data-theme="dark"] .dropdown-divider { border-color: var(--border); }
[data-theme="dark"] .acc-search-list { background-color: #1e2a3a !important; border-color: #3a4a5a !important; color: #e0e0e0 !important; }
[data-theme="dark"] .acc-search-item { color: #e0e0e0 !important; border-bottom-color: #2a3a4a !important; }
[data-theme="dark"] .acc-search-item:hover { background-color: #2a3d52 !important; color: #64b5f6 !important; }
[data-theme="dark"] .acc-search-empty { color: #90a4ae !important; }
[data-theme="dark"] .alert-info      { background: #0d2a3d; border-color: #1565a0; color: #90caf9; }
[data-theme="dark"] .alert-danger    { background: #3d1515; border-color: #7c2c2c; color: #ef9a9a; }
[data-theme="dark"] .alert-success   { background: #1a3a1a; border-color: #2d6e2d; color: #a5d6a7; }
[data-theme="dark"] .alert-warning   { background: #3a2e00; border-color: #7a6000; color: #ffe082; }
[data-theme="dark"] .alert-secondary { background: #2a2a2a; border-color: #444; color: #bbb; }
[data-theme="dark"] .badge.bg-light  { background: #3a3a3a !important; color: #e0e0e0 !important; }
[data-theme="dark"] .badge.bg-secondary { background: #4a4a4a !important; }

/* Executive Corporate Theme - Primary Buttons & Badges Overrides */
.bg-primary, .badge.bg-primary {
    background-color: #0284c7 !important;
    color: #ffffff !important;
}

.btn-primary {
    background-color: #0284c7 !important;
    border-color: #0284c7 !important;
    color: #ffffff !important;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: #0369a1 !important;
    border-color: #0369a1 !important;
    color: #ffffff !important;
}

.btn-outline-primary {
    color: #0284c7 !important;
    border-color: #0284c7 !important;
}
.btn-outline-primary:hover, .btn-outline-primary:active {
    background-color: #0284c7 !important;
    color: #ffffff !important;
}

/* Collaboration Chat Panel Theme Support */
.collaboration-chat-panel {
    background-color: var(--surface, #ffffff) !important;
    color: var(--text-primary, #1e293b) !important;
    border: 1px solid var(--border, #cbd5e1) !important;
}

.chat-modal-body {
    background-color: var(--app-bg, #f8fafc) !important;
    color: var(--text-primary, #1e293b) !important;
}

.chat-modal-surface {
    background-color: var(--surface, #ffffff) !important;
    color: var(--text-primary, #1e293b) !important;
    border-color: var(--border, #cbd5e1) !important;
}

.chat-modal-subsurface {
    background-color: var(--surface-2, #f1f5f9) !important;
    color: var(--text-primary, #1e293b) !important;
    border-color: var(--border, #cbd5e1) !important;
}

.chat-bubble-received {
    background-color: var(--surface, #ffffff) !important;
    color: var(--text-primary, #1e293b) !important;
    border: 1px solid var(--border, #cbd5e1) !important;
}

.chat-bubble-sender-title {
    color: #0284c7 !important;
}

[data-theme="dark"] .collaboration-chat-panel {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .chat-modal-body {
    background-color: #0b1120 !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .chat-modal-surface {
    background-color: #0f172a !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .chat-modal-subsurface {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .chat-bubble-received {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .chat-bubble-sender-title {
    color: #38bdf8 !important;
}

/* Bootstrap utility overrides */
[data-theme="dark"] .bg-white        { background: var(--surface) !important; }
[data-theme="dark"] .bg-light        { background: var(--surface-2) !important; }
[data-theme="dark"] .bg-dark         { background: #0d1b2a !important; }
[data-theme="dark"] .bg-secondary    { background: #444 !important; }
[data-theme="dark"] .text-dark       { color: var(--text-primary) !important; }
[data-theme="dark"] .text-muted      { color: var(--text-muted) !important; }
[data-theme="dark"] .border          { border-color: var(--border) !important; }
[data-theme="dark"] .border-bottom, [data-theme="dark"] .border-top,
[data-theme="dark"] .border-start, [data-theme="dark"] .border-end { border-color: var(--border) !important; }
[data-theme="dark"] .shadow-sm       { box-shadow: var(--shadow-sm) !important; }
/* Nav tabs / pills */
[data-theme="dark"] .nav-tabs        { border-color: var(--border); }
[data-theme="dark"] .nav-tabs .nav-link { color: var(--text-secondary); border-color: transparent; }
[data-theme="dark"] .nav-tabs .nav-link.active {
    background: var(--surface); border-color: var(--border) var(--border) var(--surface);
    color: var(--text-primary);
}
[data-theme="dark"] .nav-tabs .nav-link:hover { color: var(--text-primary); }
/* List group */
[data-theme="dark"] .list-group-item {
    background: var(--surface); border-color: var(--border); color: var(--text-primary);
}
[data-theme="dark"] .list-group-item:hover { background: var(--surface-2); }
[data-theme="dark"] .list-group-item.active { background: var(--brand-light); border-color: var(--brand-light); }
/* Breadcrumb */
[data-theme="dark"] .breadcrumb      { background: transparent; }
[data-theme="dark"] .breadcrumb-item.active { color: var(--text-secondary); }
[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }
/* Progress bar background track */
[data-theme="dark"] .progress        { background: #2a2a2a; }
/* Pagination */
[data-theme="dark"] .page-item .page-link {
    background: var(--surface); border-color: var(--border); color: var(--text-primary);
}
[data-theme="dark"] .page-item.active .page-link { background: var(--brand-light); border-color: var(--brand-light); }
[data-theme="dark"] .page-item.disabled .page-link { background: var(--surface-2); color: var(--text-muted); }
/* Custom POSS sections */
[data-theme="dark"] .odoo-secbar     { background: var(--secbar-bg); border-color: var(--secbar-border); }
[data-theme="dark"] .odoo-seclink    { color: var(--text-secondary); }
[data-theme="dark"] .odoo-seclink.active { color: var(--secbar-active); border-color: var(--secbar-active); }
[data-theme="dark"] .odoo-seclink:hover { color: var(--text-primary); }
[data-theme="dark"] .odoo-content    { background: var(--app-bg); }
[data-theme="dark"] .odoo-topbar     { background: var(--topbar-bg); }
[data-theme="dark"] .odoo-app-drawer { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .odoo-app-tile   { background: var(--surface-2); border-color: var(--border); color: var(--text-primary); }
[data-theme="dark"] .odoo-app-tile:hover { background: #2a3a4a; }
[data-theme="dark"] .odoo-user-dropdown { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .odoo-dditem     { color: var(--text-primary); }
[data-theme="dark"] .odoo-dditem:hover { background: var(--surface-2); }
[data-theme="dark"] .home-module-tile { background: var(--surface); border-color: var(--border); color: var(--text-primary); }
[data-theme="dark"] .home-module-label { color: var(--text-primary); }
[data-theme="dark"] .acc-node-header:hover { background: rgba(100,181,246,0.1); }
/* Dark Invoice table */
[data-theme="dark"] .invoice-table thead th { background: #1a2536; color: #e0e0e0; }
[data-theme="dark"] .invoice-table tbody tr:hover { background: #1e2d40; }
[data-theme="dark"] .invoice-table tbody td { color: var(--text-primary); border-color: var(--border); }
/* Dark sticky header fix */
[data-theme="dark"] .table-sticky thead th { background: #1a2536 !important; }

/* Theme contrast safety net for shared labels, fields and utility surfaces. */
.odoo-content :is(label, legend, .form-label, .form-text) { color: var(--text-primary); }
.odoo-content :is(.text-body, .text-body-secondary) { color: var(--text-secondary) !important; }
[data-theme="dark"] .text-black, [data-theme="dark"] .text-reset { color: var(--text-primary) !important; }
[data-theme="dark"] :is(.form-check-label, .form-control, .form-select, textarea, input, select, option) { color: var(--text-primary); }
[data-theme="dark"] :is(.form-control, .form-select, textarea, input, select) { background-color: var(--surface-2); border-color: var(--border); }
[data-theme="dark"] :is(.form-control, .form-select, textarea, input)::placeholder { color: var(--text-secondary); opacity: 1; }
[data-theme="light"] .bg-white.text-white,
[data-theme="light"] .bg-light.text-white,
[data-theme="light"] .card.text-white:not(.bg-primary):not(.bg-success):not(.bg-danger):not(.bg-dark),
[data-theme="light"] .card-body.text-white:not(.bg-primary):not(.bg-success):not(.bg-danger):not(.bg-dark) { color: var(--text-primary) !important; }
.theme-contrast-repaired { color: var(--theme-contrast-color) !important; }

/* ══════════════════════════════════════════════════════════════════════
   Content area full-width fix
══════════════════════════════════════════════════════════════════════ */
.odoo-content {
    width: 100%;
    max-width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 0.5rem 0.75rem;
}

.odoo-shell {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Invoice Layout (Full-height) ─────────────────────────────────── */
.invoice-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 90px); /* topbar(48) + secbar(40) + 2px */
    overflow: hidden;
}
.invoice-toolbar { flex-shrink: 0; }
.invoice-header  { flex-shrink: 0; }
.invoice-body {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.invoice-lines-scroll {
    flex: 1 1 0;
    overflow-y: auto;
    overflow-x: auto;
}
.invoice-table { width: 100%; border-collapse: collapse; }
.invoice-table thead th {
    position: sticky; top: 0; z-index: 2;
    background: #212529; color: #fff;
    font-size: 0.83rem; padding: 6px 8px;
}
.invoice-table tbody td { font-size: 0.83rem; padding: 4px 6px; vertical-align: middle; }
.invoice-table tbody tr:hover { background: #f8f9ff; }
[data-theme="dark"] .invoice-table tbody tr:hover { background: #2a2a2a; }
.invoice-footer { flex-shrink: 0; border-top: 2px solid var(--border); }

/* Sales invoice page must fit inside odoo-content scroll area */
.odoo-content .sales-invoice-page {
    height: calc(100vh - var(--topbar-height) - var(--secbar-height) - 22px);
    min-height: 0;
}
.odoo-content:has(.sales-invoice-page) {
    overflow: hidden !important;
}

/* Internal Chat page must fill the content area without horizontal overflow */
.odoo-content:has(.dragon-chat-page) {
    overflow: hidden !important;
    padding: 0 !important;
}
.odoo-content .dragon-chat-page {
    height: 100%;
    min-height: 0;
}
html, body {
    overflow-x: hidden;
}

/* ── Restaurant Cashier Full-height ───────────────────────────────── */
.cashier-page {
    display: flex;
    height: calc(100vh - 90px);
    overflow: hidden;
    gap: 0;
}
.cashier-menu-panel {
    flex: 1 1 0;
    overflow-y: auto;
    background: var(--surface-2);
    border-radius: var(--radius);
}
.cashier-order-panel {
    width: 340px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow: hidden;
}
.cashier-order-lines {
    flex: 1 1 0;
    overflow-y: auto;
}
.cashier-order-footer {
    flex-shrink: 0;
    border-top: 2px solid var(--border);
    padding: 0.75rem;
}

/* ── Cards ─────────────────────────────────────────────────────────── */
.poss-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}
.poss-card:hover { box-shadow: var(--shadow-md); }

/* ── Tables ─────────────────────────────────────────────────────────── */
.table-rtl { direction: rtl; }
.table-rtl th, .table-rtl td { text-align: right; }

/* ── Login Page ─────────────────────────────────────────────────────── */
.login-wrapper {
    width: 100%;
    height: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a5f7a 0%, #1282a2 60%, #0d6e87 100%);
    padding: 1rem;
}
.login-card {
    background: white;
    border-radius: 16px;
    padding: 2rem 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
/* backward compat */
.login-container {
    width: 100%; height: 100%; min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0a5f7a 0%, #1282a2 60%, #0d6e87 100%);
}

/* ── Dashboard Cards ─────────────────────────────────────────────────── */
.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s, box-shadow 0.18s;
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.kpi-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.kpi-value { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.kpi-label { font-size: 0.8rem; color: var(--text-secondary); }

/* ── Blazor Error UI ─────────────────────────────────────────────────── */
#blazor-error-ui {
    background: #fff3cd; bottom: 0; left: 0; right: 0;
    padding: 0.6rem 1.25rem;
    position: fixed; z-index: 9999;
    display: none;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.15);
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; left: 0.75rem; top: 0.5rem; }

/* Settings workspace (navigation + dashboard) */
.settings-workspace {
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    gap: 1rem;
    min-height: calc(100vh - 145px);
}

.settings-sidebar,
.settings-hero,
.settings-toolbar,
.settings-card,
.settings-action-card,
.settings-empty {
    background: #fff;
    border: 1px solid #d9e1ee;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.settings-sidebar {
    border-radius: 16px;
    padding: 0.85rem;
    overflow: auto;
    max-height: calc(100vh - 150px);
    position: sticky;
    top: 0.75rem;
}

.settings-sidebar__title {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-weight: 900;
    margin-bottom: 0.75rem;
    color: #22324a;
    font-size: 1.02rem;
}

.settings-search {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: #f8fafc;
    border: 1px solid #dce5f2;
    border-radius: 999px;
    padding: .48rem .7rem;
}

.settings-search input {
    border: 0;
    outline: 0;
    background: transparent;
    width: 100%;
    color: #16263d;
}

.settings-search--sidebar { margin-bottom: .85rem; }
.settings-search--main { flex: 1 1 420px; }

.settings-group {
    margin-bottom: 0.55rem;
    border-bottom: 1px solid #eef2f7;
    padding-bottom: .45rem;
}

.settings-group:last-child { border-bottom: 0; }

.settings-group__title {
    list-style: none;
    cursor: pointer;
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 0.35rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.settings-group__title::-webkit-details-marker { display: none; }

.settings-group__count {
    background: #eaf1fb;
    color: #31506f;
    min-width: 1.55rem;
    text-align: center;
    border-radius: 999px;
    padding: .05rem .35rem;
}

.settings-link,
.settings-card__item,
.settings-card__top,
.settings-action-card {
    text-decoration: none !important;
}

.settings-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.48rem 0.55rem;
    border-radius: 10px;
    color: #22324a !important;
}

.settings-link:hover,
.settings-link:focus {
    background: #eef5ff;
    color: #0f2640 !important;
    outline: none;
}

.settings-content { min-width: 0; }

.settings-hero {
    border-radius: 18px;
    padding: 1rem 1.1rem;
    margin-bottom: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.settings-eyebrow {
    color: #0f6b8c;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: .72rem;
    font-weight: 900;
    margin-bottom: .2rem;
}

.settings-hero__meta {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.settings-toolbar {
    border-radius: 16px;
    padding: .65rem;
    margin-bottom: .85rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
}

.settings-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin: 0 .1rem .85rem;
}

.settings-filter-chip {
    border: 1px solid #d8e4f3;
    background: #fff;
    color: #36506c;
    border-radius: 999px;
    padding: .42rem .7rem;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-weight: 800;
    transition: background .16s ease, color .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.settings-filter-chip:hover,
.settings-filter-chip:focus,
.settings-filter-chip.active {
    background: #e6f4ff;
    border-color: #9dccf1;
    color: #0a5f7a;
    box-shadow: 0 10px 24px rgba(10, 95, 122, .1);
    outline: none;
}

.settings-section-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .75rem;
    margin: .9rem .15rem .55rem;
    color: #1f2a44;
}

.settings-section-title span {
    font-weight: 900;
}

.settings-section-title small {
    color: #64748b;
}

.settings-quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: .65rem;
}

.settings-recent-links {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .85rem;
}

.settings-recent-links a {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #24364f !important;
    border-radius: 13px;
    padding: .5rem .7rem;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-weight: 800;
}

.settings-recent-links a:hover,
.settings-recent-links a:focus {
    background: #f2f7ff;
    border-color: #b3caef;
    outline: none;
}

.settings-action-card {
    border-radius: 16px;
    padding: .75rem;
    color: #1d2e45 !important;
    display: flex;
    align-items: center;
    gap: .7rem;
    min-height: 78px;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.settings-action-card:hover,
.settings-action-card:focus {
    transform: translateY(-2px);
    border-color: #b3caef;
    box-shadow: 0 16px 35px rgba(15, 23, 42, 0.09);
    outline: none;
}

.settings-action-card__icon,
.settings-card__icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, #e6f4ff, #f2f7ff);
    color: #0a5f7a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-action-card strong,
.settings-action-card small {
    display: block;
}

.settings-action-card small {
    color: #64748b;
    font-size: .78rem;
    margin-top: .12rem;
}

.settings-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
    gap: 0.8rem;
}

.settings-card {
    border-radius: 18px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: .65rem;
    min-height: 250px;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.settings-card:hover,
.settings-card:focus-within {
    transform: translateY(-3px);
    border-color: #b3caef;
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.1);
    outline: none;
}

.settings-card__top {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: .7rem;
    color: #1f2a44 !important;
}

.settings-card__title strong,
.settings-card__title small {
    display: block;
}

.settings-card__title strong {
    font-size: .98rem;
}

.settings-card__title small {
    color: #64748b;
    font-size: .78rem;
    margin-top: .12rem;
}

.settings-card__badge {
    border: 1px solid #d8e4f3;
    background: #f8fafc;
    color: #4b6178;
    border-radius: 999px;
    padding: .12rem .45rem;
    font-size: .72rem;
    font-weight: 800;
}

.settings-card p {
    color: #5a6b80;
    font-size: .86rem;
    margin: 0;
    min-height: 42px;
}

.settings-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #64748b;
    font-size: .8rem;
    border-top: 1px solid #eef2f7;
    padding-top: .55rem;
}

.settings-card__footer a {
    font-weight: 800;
}

.settings-card__items {
    display: grid;
    gap: 0.3rem;
}

.settings-card__item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: 9px;
    padding: 0.38rem 0.48rem;
    color: #24364f !important;
}

.settings-card__item:hover,
.settings-card__item:focus {
    background: #f2f7ff;
    color: #10263f !important;
    outline: none;
}

.settings-empty {
    border-radius: 18px;
    padding: 2rem;
    min-height: 230px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: .45rem;
    color: #64748b;
    text-align: center;
}

.settings-empty i {
    font-size: 2rem;
    color: #0a5f7a;
}

/* Module drawer styling hardening */
.odoo-app-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(13, 23, 37, 0.55);
    z-index: 2500;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 4.25rem 1rem 1rem;
}

.odoo-app-drawer {
    width: min(980px, 98vw);
    max-height: 82vh;
    overflow: auto;
    background: #fff;
    border: 1px solid #d9e1ee;
    border-radius: 12px;
    box-shadow: 0 25px 45px rgba(15,23,42,0.25);
}

.odoo-app-drawer__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid #e7edf6;
}

.odoo-close-button {
    border: 1px solid #d7e1ef;
    background: #fff;
    border-radius: 8px;
    width: 32px;
    height: 32px;
}

.odoo-app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.55rem;
    padding: 0.7rem;
}

.odoo-app-tile {
    border: 1px solid #d9e1ee;
    border-radius: 10px;
    background: #fff;
    min-height: 86px;
    padding: 0.6rem 0.55rem;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 0.35rem;
    color: #1f2a44;
}

.odoo-app-tile:hover {
    border-color: #b3caef;
    background: #f2f7ff;
}

.odoo-app-tile__icon i { font-size: 1.15rem; color: #0a5f7a; }
.odoo-app-tile__title { font-size: 0.84rem; font-weight: 700; text-align: center; }

[data-theme="dark"] .settings-sidebar,
[data-theme="dark"] .settings-hero,
[data-theme="dark"] .settings-toolbar,
[data-theme="dark"] .settings-card,
[data-theme="dark"] .settings-action-card,
[data-theme="dark"] .settings-filter-chip,
[data-theme="dark"] .settings-recent-links a,
[data-theme="dark"] .settings-empty {
    background: #1a2535;
    border-color: #2d3f52;
    box-shadow: 0 16px 35px rgba(0,0,0,.2);
}

[data-theme="dark"] .settings-sidebar__title,
[data-theme="dark"] .settings-section-title,
[data-theme="dark"] .settings-card__top,
[data-theme="dark"] .settings-action-card {
    color: #e6eef8 !important;
}

[data-theme="dark"] .settings-search,
[data-theme="dark"] .settings-card__badge {
    background: #111a27;
    border-color: #2d3f52;
}

[data-theme="dark"] .settings-search input {
    color: #e6eef8;
}

[data-theme="dark"] .settings-group {
    border-color: #2d3f52;
}

[data-theme="dark"] .settings-group__count {
    background: #24354a;
    color: #d7e4f4;
}

[data-theme="dark"] .settings-card p,
[data-theme="dark"] .settings-card__footer,
[data-theme="dark"] .settings-card__title small,
[data-theme="dark"] .settings-action-card small,
[data-theme="dark"] .settings-section-title small {
    color: #9fb0c6;
}

[data-theme="dark"] .settings-link,
[data-theme="dark"] .settings-card__item,
[data-theme="dark"] .settings-filter-chip,
[data-theme="dark"] .settings-recent-links a {
    color: #d7e4f4 !important;
}

[data-theme="dark"] .settings-link:hover,
[data-theme="dark"] .settings-card__item:hover,
[data-theme="dark"] .settings-filter-chip:hover,
[data-theme="dark"] .settings-filter-chip:focus,
[data-theme="dark"] .settings-filter-chip.active,
[data-theme="dark"] .settings-recent-links a:hover,
[data-theme="dark"] .settings-recent-links a:focus {
    background: #22344a;
    color: #ffffff !important;
}

[data-theme="dark"] .odoo-app-drawer {
    background: #1a2535;
    border-color: #2d3f52;
}

@media (max-width: 1100px) {
    .settings-workspace {
        grid-template-columns: 1fr;
    }

    .settings-sidebar {
        position: static;
        max-height: none;
    }
}

@media (max-width: 720px) {
    .settings-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .settings-toolbar {
        align-items: stretch;
    }

    .settings-search--main {
        flex-basis: 100%;
    }

    .settings-cards,
    .settings-quick-actions {
        grid-template-columns: 1fr;
    }
}

/* Header + module navigation (clean Odoo-style) */
.clean-topbar {
    min-height: 56px;
    background: var(--topbar-bg);
    color: var(--topbar-text);
    padding: .45rem .75rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: .65rem;
    border-bottom: 1px solid rgba(255,255,255,.12);
}

.clean-topbar__left,
.clean-topbar__center,
.clean-topbar__right {
    display: flex;
    align-items: center;
    gap: .55rem;
}
.clean-topbar a,
.clean-topbar button,
.clean-topbar span,
.clean-topbar i {
    color: var(--topbar-text) !important;
}

.clean-topbar .clean-icon-btn,
.clean-topbar .clean-apps-btn,
.clean-topbar .clean-user-chip {
    color: var(--topbar-text) !important;
}
.clean-topbar__center { justify-content: center; }
.clean-topbar__right { justify-content: flex-end; }

.clean-apps-btn,
.clean-icon-btn {
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(255,255,255,.10);
    color: #fff;
    border-radius: 8px;
    height: 34px;
    min-width: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: 0 .55rem;
    transition: .15s ease;
}

.clean-apps-btn:hover,
.clean-icon-btn:hover { background: rgba(255,255,255,.18); }

.clean-brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    line-height: 1.05;
}

.clean-brand__mark {
    width: 30px !important;
    height: 30px !important;
    max-width: 30px !important;
    max-height: 30px !important;
    border-radius: 8px;
    flex: 0 0 auto;
    object-fit: contain;
}

.clean-brand__title {
    color: #fff;
    font-weight: 800;
    font-size: .92rem;
    letter-spacing: .3px;
}

.clean-brand__subtitle {
    color: rgba(255,255,255,.86);
    font-size: .73rem;
}

.clean-search {
    width: min(580px, 100%);
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(255,255,255,.10);
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: 0 .65rem;
    height: 36px;
}

.clean-search i {
    color: rgba(255,255,255,.9);
    font-size: .84rem;
}

.clean-search__input {
    border: none;
    background: transparent;
    color: #fff;
    width: 100%;
    font-size: .88rem;
    outline: none;
}

.clean-search__input::placeholder {
    color: rgba(255,255,255,.78);
}

.clean-user-chip {
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(255,255,255,.10);
    color: #fff;
    border-radius: 999px;
    height: 34px;
    padding: 0 .65rem;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    text-decoration: none;
    transition: .15s ease;
}

.clean-user-chip:hover {
    background: rgba(255,255,255,.18);
    color: #fff;
}

.clean-module-nav {
    background: #f3f7fd;
    border-bottom: 1px solid #dfe6ef;
}

.clean-module-nav__items {
    display: flex;
    gap: .35rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding: .45rem .6rem;
}

.clean-module-nav__sep {
    flex: 0 0 auto;
    align-self: center;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: #7d8ea8;
    text-transform: uppercase;
    margin: 0 .15rem 0 .3rem;
    padding: 0 .45rem;
    border-inline-start: 1px solid #c9d5e6;
}

.clean-module-nav__items::-webkit-scrollbar {
    height: 8px;
}

.clean-module-nav__items::-webkit-scrollbar-thumb {
    background: #c7d3e3;
    border-radius: 8px;
}

.clean-module-link {
    color: #334766;
    text-decoration: none;
    border-radius: 7px;
    padding: .3rem .58rem;
    font-size: .88rem;
    line-height: 1.2;
    flex: 0 0 auto;
    border: 1px solid transparent;
}

.clean-module-nav a.clean-module-link,
.clean-module-nav a.clean-module-link:visited {
    text-decoration: none !important;
    color: #334766 !important;
}

.clean-module-nav a.clean-module-link:hover,
.clean-module-nav a.clean-module-link:focus,
.clean-module-nav a.clean-module-link:active {
    text-decoration: none !important;
    color: #1f2a44 !important;
}

.clean-module-link:hover {
    background: #eaf2ff;
    border-color: #c8d8f2;
    color: #1f2a44;
}

.clean-module-link.active {
    background: #dbe9ff;
    border-color: #b3caef;
    color: #1e40af;
    font-weight: 700;
}

[data-theme="dark"] .clean-module-nav {
    background: #162233;
    border-color: var(--border);
}

[data-theme="dark"] .clean-module-link {
    color: #b9c8db;
}

[data-theme="dark"] .clean-module-nav a.clean-module-link,
[data-theme="dark"] .clean-module-nav a.clean-module-link:visited {
    color: #b9c8db !important;
}

[data-theme="dark"] .clean-module-nav a.clean-module-link:hover,
[data-theme="dark"] .clean-module-nav a.clean-module-link:focus,
[data-theme="dark"] .clean-module-nav a.clean-module-link:active {
    color: #e6eef8 !important;
}

/* Settings module landing page cards */
.module-page {
    padding: 0.75rem;
}

.module-page-header {
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.8rem;
}

.module-page-header h3 {
    margin: 0;
    font-weight: 800;
}
    .module-page-header .btn,
    .module-page-header a,
    .module-page-header button {
        color: #ffffff !important;
    }

    .module-page-header .btn-outline-light {
        color: #ffffff !important;
        border-color: rgba(255,255,255,.75) !important;
    }
.module-menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0.6rem;
}

.module-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.6rem 0.7rem;
    border: 1px solid #d8e0eb;
    border-radius: 8px;
    background: #ffffff;
    color: #22324a !important;
    text-decoration: none !important;
    box-shadow: 0 1px 6px rgba(15, 23, 42, 0.05);
    transition: 0.15s ease;
}

.module-menu-item i {
    width: 18px;
    text-align: center;
    color: #0a5f7a;
}

.module-menu-item:hover {
    background: #eef5ff;
    border-color: #b8cdef;
    color: #132238 !important;
    text-decoration: none !important;
    transform: translateY(-1px);
}

[data-theme="dark"] .module-menu-item {
    background: #1a2535;
    border-color: #2d3f52;
    color: #dce6f3 !important;
}

[data-theme="dark"] .module-menu-item i {
    color: #7cc3ff;
}

[data-theme="dark"] .module-menu-item:hover {
    background: #22344a;
    border-color: #375372;
    color: #f1f6ff !important;
}

[data-theme="dark"] .clean-module-link:hover {
    background: #22344a;
    border-color: #2f4763;
    color: #e6eef8;
}

[data-theme="dark"] .clean-module-link.active {
    background: #29415d;
    border-color: #3c5b80;
    color: #9cc9ff;
}

@media (max-width: 980px) {
    .clean-topbar {
        grid-template-columns: 1fr;
        gap: .5rem;
    }

    .clean-topbar__center {
        justify-content: stretch;
    }

    .clean-search {
        width: 100%;
    }
}

/* Ultimate override guard for crowded header links */
.odoo-shell .clean-module-nav,
.odoo-shell .clean-module-nav__items,
.odoo-shell .clean-module-link {
    all: unset;
}

.odoo-shell .clean-module-nav {
    display: block;
    background: #f3f7fd;
    border-bottom: 1px solid #dfe6ef;
}

.odoo-shell .clean-module-nav__items {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    overflow-x: hidden;
    overflow-y: hidden;
    white-space: normal;
    flex-wrap: wrap;
    padding: 0.45rem 0.6rem;
}

.odoo-shell .clean-module-nav__items::-webkit-scrollbar {
    height: 8px;
}

.odoo-shell .clean-module-nav__items::-webkit-scrollbar-thumb {
    background: #c7d3e3;
    border-radius: 8px;
}

.odoo-shell .clean-module-nav__sep {
    flex: 0 0 auto;
    align-self: center;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: #7d8ea8;
    text-transform: uppercase;
    margin: 0 .15rem 0 .3rem;
    padding: 0 .45rem;
    border-inline-start: 1px solid #c9d5e6;
}

.odoo-shell .clean-module-link,
.odoo-shell .clean-module-link:visited {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    text-decoration: none !important;
    color: #334766 !important;
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 0.36rem 0.65rem;
    font-size: 0.88rem;
    line-height: 1.2;
    background: #fff;
    border-color: #d7e1ef;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.odoo-shell .clean-module-link:hover,
.odoo-shell .clean-module-link:focus,
.odoo-shell .clean-module-link:active {
    text-decoration: none !important;
    background: #eaf2ff;
    border-color: #c8d8f2;
    color: #1f2a44 !important;
}

.odoo-shell .clean-module-link.active {
    background: #dbe9ff;
    border-color: #b3caef;
    color: #1e40af !important;
    font-weight: 700;
}

.odoo-shell .clean-module-link--home {
    font-weight: 700;
}

@media (max-width: 980px) {
    .odoo-shell .clean-module-nav__items {
        overflow-x: auto;
        white-space: nowrap;
        flex-wrap: nowrap;
    }
}

[data-theme="dark"] .odoo-shell .clean-module-nav {
    background: #162233;
    border-color: var(--border);
}

[data-theme="dark"] .odoo-shell .clean-module-link,
[data-theme="dark"] .odoo-shell .clean-module-link:visited {
    color: #b9c8db !important;
}

[data-theme="dark"] .odoo-shell .clean-module-link:hover,
[data-theme="dark"] .odoo-shell .clean-module-link:focus,
[data-theme="dark"] .odoo-shell .clean-module-link:active {
    background: #22344a;
    border-color: #2f4763;
    color: #e6eef8 !important;
}

[data-theme="dark"] .odoo-shell .clean-module-link.active {
    background: #29415d;
    border-color: #3c5b80;
    color: #9cc9ff !important;
}

/* ─── Drogy Widget Styles ─────────────────────────────────────────────────── */
:root {
    --drogy-bg: #1e293b;
    --drogy-border: #334155;
    --drogy-primary: #0284c7;
    --drogy-text: #ffffff;
    --drogy-bubble-user: #0f172a;
    --drogy-bubble-system: #1e293b;
    --drogy-radius: 12px;
    --drogy-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] {
    --drogy-bg: #0f172a;
    --drogy-border: #334155;
    --drogy-primary: #0284c7;
    --drogy-text: #ffffff;
    --drogy-bubble-user: #1e293b;
    --drogy-bubble-system: #0f172a;
}

.drogy-widget-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 10000;
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.drogy-toggle-btn {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0f172a 0%, #0284c7 100%);
    border: 3px solid #38bdf8;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(2, 132, 199, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    padding: 0;
}

.drogy-toggle-btn:hover {
    transform: scale(1.08) rotate(5deg);
    box-shadow: 0 12px 28px rgba(2, 132, 199, 0.6);
}

.drogy-icon {
    font-size: 32px;
    line-height: 1;
}

.drogy-badge {
    position: absolute;
    bottom: -6px;
    background: #0284c7;
    color: #ffffff;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.drogy-chat-panel {
    width: 340px;
    height: 500px;
    background: var(--drogy-bg);
    border: 1px solid var(--drogy-border);
    border-radius: var(--drogy-radius);
    box-shadow: var(--drogy-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: drogy-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(8px);
}

@keyframes drogy-slide-in {
    from {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.drogy-chat-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffffff;
    border-bottom: 3px solid #0284c7;
}

.drogy-bot-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.drogy-icon-sm {
    font-size: 26px;
}

.drogy-bot-info h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.drogy-status {
    font-size: 10px;
    opacity: 0.85;
    display: block;
}

.drogy-close-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.drogy-close-btn:hover {
    opacity: 1;
}

.drogy-chat-history {
    flex-grow: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.05);
}

.drogy-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.45;
    word-wrap: break-word;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.drogy-bubble.user {
    align-self: flex-end;
    background-color: var(--drogy-bubble-user);
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.drogy-bubble.system {
    align-self: flex-start;
    background-color: var(--drogy-bubble-system);
    color: #f1f1f5;
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(255,255,255,0.05);
}

.drogy-bubble.system hr {
    margin: 8px 0;
    border-color: rgba(255,255,255,0.1);
}

.drogy-bubble.system code {
    background: rgba(0, 0, 0, 0.2);
    color: #ffd04b;
    padding: 1px 4px;
    border-radius: 4px;
    font-family: monospace;
}

.bubble-time {
    display: block;
    font-size: 9px;
    margin-top: 4px;
    opacity: 0.6;
    text-align: right;
}

.drogy-bubble.system .bubble-time {
    text-align: left;
}

/* Chat Input */
.drogy-chat-input-area {
    padding: 12px;
    display: flex;
    gap: 8px;
    background: var(--drogy-bg);
    border-top: 1px solid var(--drogy-border);
}

.drogy-chat-input {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--drogy-border);
    color: var(--drogy-text);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s ease;
}

.drogy-chat-input:focus {
    border-color: var(--drogy-primary);
}

.drogy-send-btn {
    background: var(--drogy-primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.drogy-send-btn:hover:not(:disabled) {
    background: #3c52e0;
}

.drogy-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Article Styles Inside Bubbles */
.drogy-article {
    text-align: right;
}

.drogy-article h4 {
    margin-top: 0;
    font-size: 14.5px;
    margin-bottom: 8px;
    font-weight: bold;
}

.drogy-article ul {
    padding-right: 20px;
    margin-bottom: 8px;
}

.drogy-article li {
    margin-bottom: 6px;
}

/* RTL Helpers */
.dir-rtl {
    direction: rtl;
}
.text-right {
    text-align: right;
}

/* Loading Shimmer animation */
.drogy-bubble.loading .skeleton-line {
    height: 10px;
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 6px;
    width: 90%;
}
        opacity: 1;
    }
}

.drogy-chat-header {
    background: linear-gradient(135deg, var(--drogy-primary), #758eff);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffffff;
    border-bottom: 1px solid var(--drogy-border);
}

.drogy-bot-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.drogy-icon-sm {
    font-size: 26px;
}

.drogy-bot-info h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.drogy-status {
    font-size: 10px;
    opacity: 0.85;
    display: block;
}

.drogy-close-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.drogy-close-btn:hover {
    opacity: 1;
}

.drogy-chat-history {
    flex-grow: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.05);
}

.drogy-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.45;
    word-wrap: break-word;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.drogy-bubble.user {
    align-self: flex-end;
    background-color: var(--drogy-bubble-user);
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.drogy-bubble.system {
    align-self: flex-start;
    background-color: var(--drogy-bubble-system);
    color: #f1f1f5;
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(255,255,255,0.05);
}

.drogy-bubble.system hr {
    margin: 8px 0;
    border-color: rgba(255,255,255,0.1);
}

.drogy-bubble.system code {
    background: rgba(0, 0, 0, 0.2);
    color: #ffd04b;
    padding: 1px 4px;
    border-radius: 4px;
    font-family: monospace;
}

.bubble-time {
    display: block;
    font-size: 9px;
    margin-top: 4px;
    opacity: 0.6;
    text-align: right;
}

.drogy-bubble.system .bubble-time {
    text-align: left;
}

/* Chat Input */
.drogy-chat-input-area {
    padding: 12px;
    display: flex;
    gap: 8px;
    background: var(--drogy-bg);
    border-top: 1px solid var(--drogy-border);
}

.drogy-chat-input {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--drogy-border);
    color: var(--drogy-text);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s ease;
}

.drogy-chat-input:focus {
    border-color: var(--drogy-primary);
}

.drogy-send-btn {
    background: var(--drogy-primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.drogy-send-btn:hover:not(:disabled) {
    background: #3c52e0;
}

.drogy-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Article Styles Inside Bubbles */
.drogy-article {
    text-align: right;
}

.drogy-article h4 {
    margin-top: 0;
    font-size: 14.5px;
    margin-bottom: 8px;
    font-weight: bold;
}

.drogy-article ul {
    padding-right: 20px;
    margin-bottom: 8px;
}

.drogy-article li {
    margin-bottom: 6px;
}

/* RTL Helpers */
.dir-rtl {
    direction: rtl;
}
.text-right {
    text-align: right;
}

/* Loading Shimmer animation */
.drogy-bubble.loading .skeleton-line {
    height: 10px;
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 6px;
    width: 90%;
}

.drogy-bubble.loading .skeleton-line.short {
    width: 60%;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Suggestions Panel & Buttons */
.drogy-suggestions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.12);
    border-top: 1px solid var(--drogy-border);
    max-height: 100px;
    overflow-y: auto;
}

.drogy-suggestions-title {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    width: 100%;
    margin-bottom: 2px;
    font-weight: 600;
}

.drogy-suggestion-btn {
    background: var(--drogy-bubble-system);
    color: var(--drogy-text);
    border: 1px solid var(--drogy-border);
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.drogy-suggestion-btn:hover {
    background: var(--drogy-primary);
    border-color: var(--drogy-primary);
    transform: translateY(-1px);
}

/* ??? Drogy Voice Button ???????????????????????????????????????????????????? */
.drogy-voice-btn {
    background: #1e293b;
    color: #fff;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

/* ── Unified invoice workspace ─────────────────────────────────────────
   The item table owns vertical scrolling.  Totals are part of the document
   flow, immediately following the table rather than being pushed to the
   bottom of the viewport when there are only a few lines. */
.invoice-workspace {
    /* The shell/navigation height varies with the active module and can be
       larger than 90px. A fixed viewport height clipped the item table. */
    height: auto;
    min-height: 0;
    overflow: visible;
    background: var(--app-bg);
    color: var(--text-primary);
}

.invoice-workspace .invoice-content {
    flex: 0 1 auto !important;
    min-height: 0;
    overflow: visible;
}

.invoice-workspace .invoice-lines-panel {
    display: flex;
    flex-direction: column;
    min-height: 220px;
    margin: 0;
}

.invoice-workspace .invoice-lines-scroll {
    min-height: 180px;
    /* Always leave a usable one-row input grid visible. Excess lines scroll
       inside this element, while totals remain immediately after it. */
    max-height: min(34rem, 52vh);
    overflow: auto !important;
    overscroll-behavior: contain;
}

.invoice-workspace .invoice-lines-scroll thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.invoice-workspace .invoice-summary,
.invoice-workspace .invoice-footer {
    flex: 0 0 auto;
    margin-top: 0 !important;
}

/* Purchase Return is the approved invoice template. All invoice types expose
   the same five structural regions through these classes: command bar, form,
   item grid, grid hint, and totals. Document-specific fields stay intact. */
.purchase-return-template .invoice-commandbar {
    min-height: 46px;
    padding: .5rem 1rem !important;
    background: #20262e !important;
    color: #fff;
    border-bottom: 1px solid #334155 !important;
}
.purchase-return-template .invoice-form-card,
.purchase-return-template .invoice-lines-panel,
.purchase-return-template .invoice-summary {
    border-color: var(--border) !important;
    border-radius: .5rem;
    box-shadow: var(--shadow-sm);
}
.purchase-return-template .invoice-form-card {
    color: var(--text-primary);
}
.purchase-return-template .invoice-lines-panel {
    background: var(--surface);
}
.purchase-return-template .invoice-summary {
    background: var(--surface) !important;
    color: var(--text-primary);
}
/* Keep the form, item grid and totals on exactly the same horizontal edges. */
.purchase-return-template .invoice-content {
    padding-inline: 1rem !important;
}
.purchase-return-template .invoice-form-card,
.purchase-return-template .invoice-lines-panel {
    width: 100%;
    box-sizing: border-box;
}
.purchase-return-template .invoice-summary {
    width: auto;
    box-sizing: border-box;
    margin: 0 1rem 1rem !important;
}
.purchase-return-template .invoice-lines-scroll > table > thead > tr,
.purchase-return-template .invoice-lines-scroll > table > thead {
    background: #20262e;
    color: #e2e8f0;
}
[data-theme="dark"] .purchase-return-template .invoice-commandbar,
[data-theme="dark"] .purchase-return-template .invoice-lines-scroll > table > thead > tr,
[data-theme="dark"] .purchase-return-template .invoice-lines-scroll > table > thead {
    background: #20262e;
    color: #e2e8f0;
}

/* The legacy sales invoice now uses the same surface, grid and summary rhythm
   as the purchase invoice/returns. */
.sales-invoice-page .invoice-toolbar,
.invoice-workspace > .bg-\[\#20262e\] {
    background: #20262e !important;
}
.sales-invoice-page .invoice-header,
.sales-invoice-page .invoice-footer {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text-primary);
}
.sales-invoice-page .invoice-header {
    margin: 1rem 1rem .5rem;
    padding: .75rem !important;
    border: 1px solid var(--border) !important;
    border-radius: .5rem;
    box-shadow: var(--shadow-sm);
}
.sales-invoice-page .invoice-body {
    padding: 0 1rem;
}
.sales-invoice-page .invoice-lines-panel {
    border: 1px solid var(--border);
    border-radius: .5rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.sales-invoice-page .invoice-table {
    margin: 0;
}
.sales-invoice-page .invoice-table thead th {
    background: #20262e;
    color: #e2e8f0;
    border-color: #334155;
}
.sales-invoice-page .invoice-footer {
    margin: 0 1rem 1rem;
    padding: .75rem !important;
    border: 1px solid var(--border) !important;
    border-radius: .5rem;
    box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .invoice-workspace .invoice-summary {
    background: var(--surface) !important;
    border-color: var(--border) !important;
}

/* Compact cards only in the purchasing operational work queue. */
.purchasing-work-queue > .card-header {
    padding: .625rem .875rem;
    font-size: .9rem;
}
.purchasing-work-queue > .card-body {
    padding: .75rem;
}
.purchasing-work-queue .purchasing-queue-card .card-body {
    min-height: 0;
    padding: .625rem .75rem;
}
.purchasing-work-queue .purchasing-queue-card .display-6 {
    font-size: 1.5rem;
    line-height: 1.15;
}
.purchasing-work-queue .purchasing-queue-card .text-muted.small {
    font-size: .78rem;
}

.drogy-voice-btn:hover:not(:disabled) {
    background: #0284c7;
    border-color: #0284c7;
    transform: scale(1.05);
}

.drogy-voice-btn.listening {
    background: #dc2626;
    border-color: #dc2626;
    animation: drogy-pulse 1.2s ease-in-out infinite;
}

.drogy-voice-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.drogy-listening-indicator {
    font-size: 0.8rem;
    animation: fadeIn 0.3s ease;
}

@keyframes drogy-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.5); }
    50%       { box-shadow: 0 0 0 8px rgba(220,38,38,0); }
}

.btn-xs {
    font-size: 0.7rem;
    padding: 1px 5px;
    line-height: 1.4;
    border-radius: 4px;
}

/* ??? Drogy Minimize & Header Actions ???????????????????????????????????????? */
.drogy-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.drogy-action-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.9rem;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.drogy-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.drogy-widget-container.minimized .drogy-chat-panel {
    height: auto !important;
    min-height: unset !important;
    max-height: 60px !important;
    overflow: hidden;
}

.drogy-widget-container.minimized .drogy-chat-header {
    border-bottom: none !important;
    border-radius: 12px;
}
