:root {
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --ink: #111827;
    --muted: #667085;
    --line: #dbe3ef;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --danger: #b42318;
    --success: #027a48;
    --warning: #b54708;
    --teal: #0f766e;
    --violet: #6d28d9;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: Aptos, "Segoe UI", Inter, Arial, sans-serif; margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.app-shell { display: grid; grid-template-columns: 292px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, #111827 0%, #182033 100%); color: #fff; padding: 22px; }
.brand { align-items: center; display: flex; gap: 12px; margin-bottom: 28px; }
.brand-logo, .auth-logo { align-items: center; background: var(--brand); border-radius: 8px; display: inline-flex; height: 48px; justify-content: center; overflow: hidden; width: 48px; }
.brand-logo img, .auth-logo { height: 48px; object-fit: cover; width: 48px; }
.brand strong { display: block; font-size: 16px; font-weight: 700; }
.brand small { color: #a8b3c4; display: block; font-size: 12px; margin-top: 2px; }
.nav { display: grid; gap: 6px; }
.nav a { border-radius: 8px; color: #cbd5e1; font-weight: 600; padding: 11px 13px; }
.nav a.active, .nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.main { min-width: 0; padding: 24px; }
.topbar { align-items: center; background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 8px; display: flex; gap: 16px; justify-content: space-between; margin-bottom: 18px; padding: 16px 18px; }
.topbar h1 { font-size: 24px; font-weight: 700; margin: 0 0 4px; }
.topbar p { color: var(--muted); margin: 0; }
.top-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }
.filter-inline select, input, select, textarea { background: #fff; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); min-height: 42px; padding: 9px 11px; width: 100%; }
textarea { resize: vertical; }
label { color: #344054; display: grid; font-size: 13px; font-weight: 600; gap: 6px; }
.btn { align-items: center; border: 0; border-radius: 8px; cursor: pointer; display: inline-flex; font-weight: 700; justify-content: center; min-height: 42px; padding: 10px 14px; white-space: nowrap; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.secondary { background: #dbeafe; color: var(--brand-dark); }
.btn.ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn.danger { background: #fee4e2; color: var(--danger); }
.btn.full { width: 100%; }
.avatar { align-items: center; background: color-mix(in srgb, var(--brand) 16%, #fff); border-radius: 8px; color: var(--brand-dark); display: inline-flex; font-weight: 700; height: 30px; justify-content: center; width: 30px; }
.avatar.circle { border-radius: 999px; height: 34px; width: 34px; }
.user-menu { position: relative; }
.user-menu-toggle { align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; display: inline-flex; gap: 6px; min-height: 42px; padding: 4px 8px 4px 4px; }
.chevron { color: var(--muted); font-size: 15px; line-height: 1; }
.user-menu-panel { background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 18px 40px rgba(16, 24, 40, .16); display: none; min-width: 220px; padding: 8px; position: absolute; right: 0; top: calc(100% + 8px); z-index: 70; }
.user-menu.open .user-menu-panel { display: grid; }
.user-menu-panel a, .user-menu-action { background: transparent; border: 0; border-radius: 8px; color: var(--ink); cursor: pointer; display: block; font: inherit; padding: 10px; text-align: left; text-decoration: none; width: 100%; }
.user-menu-panel a:hover, .user-menu-action:hover { background: #f8fafc; }
.user-menu-head { border-bottom: 1px solid var(--line); display: grid; gap: 2px; margin-bottom: 6px; padding: 8px 10px 10px; }
.user-menu-head strong { font-size: 13px; font-weight: 700; }
.user-menu-head small { color: var(--muted); font-size: 12px; word-break: break-word; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 34px rgba(16, 24, 40, .07); padding: 18px; }
.hero-card { border-top: 4px solid var(--brand); }
.card h2, .card h3 { font-weight: 700; margin: 0 0 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 8px; padding: 16px; }
.kpi:nth-child(2) { border-left-color: var(--teal); }
.kpi:nth-child(3) { border-left-color: var(--violet); }
.kpi:nth-child(4) { border-left-color: #b54708; }
.kpi span { color: var(--muted); display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.kpi strong { display: block; font-size: 26px; font-weight: 700; margin-top: 8px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 12px; text-align: left; vertical-align: top; }
th { color: #475467; font-size: 12px; font-weight: 700; text-transform: uppercase; white-space: nowrap; }
td strong { font-weight: 700; }
td small { color: var(--muted); display: block; margin-top: 3px; }
.badge, .pill { border-radius: 999px; display: inline-flex; font-size: 12px; font-weight: 700; margin: 3px; padding: 5px 9px; }
.badge.in, .pill { background: #dcfae6; color: var(--success); }
.badge.out { background: #fee4e2; color: var(--danger); }
.badge.warn { background: #fef0c7; color: var(--warning); }
.badge.neutral { background: #eef2f6; color: #475467; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-actions { align-items: end; display: flex; gap: 8px; }
.inline-form { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }
.small-input { max-width: 190px; min-height: 38px; }
.alert { align-items: center; border-radius: 8px; display: flex; font-weight: 600; gap: 12px; justify-content: space-between; margin: 0 0 14px; padding: 12px 14px; }
.alert.success { background: #dcfae6; color: var(--success); }
.alert.error { background: #fee4e2; color: var(--danger); }
.alert-panel, .alert-list { display: grid; gap: 10px; margin-bottom: 16px; }
.notice { border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 8px; background: #fff; padding: 12px 14px; }
.notice strong { display: block; font-weight: 700; margin-bottom: 3px; }
.notice span { color: var(--muted); }
.notice.warning { border-left-color: var(--warning); }
.notice.danger { border-left-color: var(--danger); }
.auth-body { align-items: center; background: linear-gradient(135deg, #eef4ff, #f8fafc 48%, #eff6ff); display: flex; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 24px 70px rgba(16, 24, 40, .14); max-width: 430px; padding: 28px; width: 100%; }
.auth-card.wide { max-width: 620px; }
.auth-card h1 { font-weight: 700; margin: 12px 0 6px; }
.auth-card p { color: var(--muted); margin: 0 0 18px; }
.stack { display: grid; gap: 14px; }
.credential-grid { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 16px 0; }
.credential-grid div { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.credential-grid span, .credential-grid small { color: var(--muted); display: block; }
.credential-grid strong { display: block; font-size: 13px; font-weight: 700; margin: 6px 0; word-break: break-word; }
.toolbar { align-items: end; display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; margin-bottom: 14px; }
.toolbar form { align-items: end; display: flex; flex-wrap: wrap; gap: 10px; }
.toolbar label { min-width: 170px; }
.inline-edit { display: grid; gap: 6px; min-width: 260px; }
.low-stock { color: var(--danger); font-weight: 700; }
.muted { color: var(--muted); }
.chat-thread { display: grid; gap: 10px; max-height: 560px; overflow: auto; }
.chat-bubble { border: 1px solid var(--line); border-radius: 8px; max-width: 84%; padding: 12px; }
.chat-bubble p { margin: 6px 0; }
.chat-bubble small { color: var(--muted); }
.chat-bubble.from-super { background: #eff6ff; margin-left: auto; }
.chat-bubble.from-client { background: #f8fafc; }
.accordion { background: #fff; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 16px; overflow: clip; }
.accordion summary { cursor: pointer; font-size: 16px; font-weight: 700; list-style: none; padding: 16px 18px; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after { color: var(--muted); content: "+"; float: right; font-size: 20px; line-height: 1; }
.accordion[open] summary::after { content: "-"; }
.accordion-body { border-top: 1px solid var(--line); padding: 18px; }
.file-upload { align-items: center; display: flex; flex-wrap: wrap; gap: 10px; }
.file-upload input[type="file"] { max-width: 320px; }
.file-hint { color: var(--muted); font-size: 13px; margin: 0; }
.toast-region { display: grid; gap: 10px; max-width: min(420px, calc(100vw - 32px)); position: fixed; right: 18px; top: 18px; z-index: 80; }
.toast { align-items: center; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 8px; box-shadow: 0 18px 40px rgba(16, 24, 40, .18); display: flex; gap: 12px; justify-content: space-between; padding: 12px 14px; transition: opacity .22s ease, transform .22s ease; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.message { border-left-color: var(--brand); }
.toast.is-leaving { opacity: 0; transform: translateY(-6px); }
.status-line { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }
.action-stack { display: grid; gap: 8px; justify-items: start; }
@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .topbar { align-items: flex-start; flex-direction: column; }
    .grid.two, .grid.three, .grid.four, .form-grid, .credential-grid { grid-template-columns: 1fr; }
    .toolbar, .toolbar form { align-items: stretch; flex-direction: column; }
    .toolbar label, .btn { width: 100%; } .user-menu, .user-menu-toggle { width: 100%; } .user-menu-panel { left: 0; right: auto; }
}
input[type="checkbox"], input[type="radio"] { min-height: auto; padding: 0; width: auto; }
.link-button { background: transparent; border: 0; color: var(--brand-dark); cursor: pointer; font-weight: 700; padding: 0; text-align: left; }
.auth-contact { display: inline-flex; justify-content: center; margin-top: 16px; width: 100%; }
.modal { border: 0; border-radius: 8px; box-shadow: 0 28px 80px rgba(16, 24, 40, .28); max-width: min(520px, calc(100vw - 32px)); padding: 0; width: 100%; }
.modal::backdrop { background: rgba(15, 23, 42, .48); }
.modal-head { align-items: center; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; padding: 16px 18px; }
.modal-head h2 { font-size: 18px; font-weight: 700; margin: 0; }
.icon-button { align-items: center; background: #f8fafc; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; display: inline-flex; font-size: 22px; height: 34px; justify-content: center; line-height: 1; width: 34px; }
.contact-list { display: grid; gap: 10px; padding: 18px; }
.contact-list div { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 3px; padding: 12px; }
.contact-list span { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.contact-list a, .contact-list strong { color: var(--ink); font-weight: 700; }
.sale-lines input, .sale-lines select { min-width: 130px; }
.sale-lines td:first-child { min-width: 340px; }
.select2-lite { display: grid; gap: 6px; }
.select2-lite input[type="search"] { background: #f8fafc; padding-right: 40px; }
.invoice-options { align-items: end; display: grid; gap: 12px; grid-template-columns: 180px 180px minmax(220px, 1fr); }
.invoice-total-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 8px; justify-items: end; margin-left: auto; max-width: 360px; padding: 14px; }
.invoice-total-box span { align-items: center; display: flex; gap: 12px; justify-content: space-between; width: 100%; }
.invoice-total-box strong { font-size: 18px; }
.invoice-total-box small { color: var(--muted); }
@media (max-width: 980px) { .invoice-options { grid-template-columns: 1fr; } .invoice-total-box { max-width: none; width: 100%; } }
.chevron { border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--muted); display: inline-block; font-size: 0; height: 0; transition: transform .16s ease; width: 0; }
.user-menu.open .chevron { transform: rotate(180deg); }
.history-table { min-width: 920px; }
.history-table th, .history-table td { padding: 16px 12px; vertical-align: middle; white-space: nowrap; }
.history-table td small { white-space: nowrap; }
.history-table .badge { margin: 0; }
.history-actions { align-items: center; display: inline-flex; gap: 8px; }
.icon-form { display: inline-flex; margin: 0; }
.icon-btn { align-items: center; border: 1px solid transparent; border-radius: 8px; cursor: pointer; display: inline-flex; height: 40px; justify-content: center; padding: 0; width: 40px; }
.icon-btn svg { height: 18px; width: 18px; }
.icon-btn.info { background: #dbeafe; color: var(--brand-dark); }
.icon-btn.info:hover { background: #bfdbfe; }
.icon-btn.danger { background: #fee4e2; color: var(--danger); }
.icon-btn.danger:hover { background: #fecaca; }
.select2-lite { position: relative; }
.select2-lite select[data-sale-product], .select2-lite select[data-stock-product] { border: 0; height: 1px; min-height: 0; min-width: 0; opacity: 0; padding: 0; pointer-events: none; position: absolute; width: 1px; }
.select2-lite-list { background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 18px 40px rgba(16, 24, 40, .16); display: none; max-height: 280px; overflow: auto; padding: 6px; position: fixed; z-index: 220; }
.select2-lite-clear { align-items: center; background: #eef2f6; border: 0; border-radius: 999px; color: #667085; cursor: pointer; display: inline-flex; font-size: 14px; font-weight: 800; height: 24px; justify-content: center; line-height: 1; position: absolute; right: 9px; top: 9px; width: 24px; z-index: 2; }
.select2-lite-clear:hover { background: #fee4e2; color: var(--danger); }
.select2-lite-clear[hidden] { display: none; }
.select2-lite.open .select2-lite-list { display: grid; gap: 4px; }
.select2-lite-option { background: #fff; border: 0; border-radius: 8px; color: var(--ink); cursor: pointer; display: grid; gap: 3px; padding: 10px; text-align: left; width: 100%; }
.select2-lite-option:hover, .select2-lite-option.active { background: #eff6ff; color: var(--brand-dark); }
.select2-lite-option strong { display: block; font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select2-lite-option small, .select2-lite-empty { color: var(--muted); font-size: 12px; }
.select2-lite-empty { padding: 10px; }
.toast-close, .alert-close { align-items: center; background: transparent; border: 0; color: currentColor; cursor: pointer; display: inline-flex; font-size: 18px; font-weight: 700; height: 24px; justify-content: center; line-height: 1; opacity: .72; padding: 0; width: 24px; }
.toast-close:hover, .alert-close:hover { opacity: 1; }
.sale-lines input[readonly] { background: #f3f4f6; color: #475467; cursor: not-allowed; }
.sale-remove-line { margin-top: 1px; }
.icon-btn.neutral { background: #f8fafc; border-color: var(--line); color: var(--ink); }
.icon-btn.neutral:hover { background: #eef2f6; }
.icon-btn.warning { background: #fef0c7; color: var(--warning); }
.icon-btn.warning:hover { background: #fedf89; }
.sale-edit-banner { margin-bottom: 16px; }
.sale-detail-modal { max-width: min(980px, calc(100vw - 32px)); }
.sale-detail-body { display: grid; gap: 16px; padding: 18px; }
.detail-grid { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.detail-grid div { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 4px; padding: 12px; }
.detail-grid span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.detail-grid strong { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.detail-table, .revision-table { min-width: 760px; }
.detail-total { margin-left: auto; }
.sale-detail-body h3 { font-size: 16px; margin: 2px 0 0; }
@media (max-width: 980px) { .detail-grid { grid-template-columns: 1fr; } .sale-detail-modal .form-actions { align-items: stretch; flex-direction: column; } }
.professional-table { border-collapse: separate; border-spacing: 0; min-width: 980px; }
.professional-table th { background: #f8fafc; border-bottom: 1px solid var(--line); color: #344054; font-size: 11px; letter-spacing: 0; padding: 11px 12px; }
.professional-table td { font-size: 13px; padding: 12px; vertical-align: middle; }
.professional-table tbody tr:nth-child(even) { background: #fbfdff; }
.professional-table tbody tr:hover { background: #eff6ff; }
.report-table { min-width: 1280px; }
.report-head { align-items: center; display: flex; justify-content: space-between; margin-bottom: 12px; }
.report-head strong { display: block; font-size: 15px; }
.report-head span, .report-kpis small, .dashboard-summary small { color: var(--muted); display: block; margin-top: 4px; }
.dashboard-wide { width: 100%; }
.dashboard-summary { margin-bottom: 16px; }
.kpi small { color: var(--muted); display: block; font-size: 12px; margin-top: 4px; }
.top-sales-accordion { margin-top: 16px; }
.top-sales-controls { align-items: end; display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.top-sales-controls label { min-width: 190px; }
.top-sales-presets { align-items: center; display: inline-flex; gap: 8px; }
.top-sales-presets .btn.active { background: var(--brand); color: #fff; }
.top-sales-layout { align-items: start; display: grid; gap: 16px; grid-template-columns: minmax(320px, .9fr) minmax(520px, 1.1fr); }
.top-sales-chart { background: #fff; border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 10px; min-height: 260px; padding: 14px; }
.top-sales-bar-row { align-items: center; display: grid; gap: 10px; grid-template-columns: 40px minmax(130px, 190px) minmax(150px, 1fr) 112px; }
.top-sales-rank { color: var(--brand-dark); font-size: 12px; font-weight: 700; }
.top-sales-bar-name { min-width: 0; }
.top-sales-bar-name strong { display: block; font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-sales-bar-name small { color: var(--muted); display: block; font-size: 11px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-sales-bar-track { background: #eef2f6; border-radius: 999px; height: 12px; overflow: hidden; }
.top-sales-bar-fill { background: linear-gradient(90deg, var(--brand), var(--teal)); border-radius: 999px; height: 100%; min-width: 3px; transition: width .2s ease; }
.top-sales-bar-value { font-size: 12px; font-weight: 700; text-align: right; white-space: nowrap; }
.top-sales-table { min-width: 760px; }
.top-sales-empty { align-items: center; color: var(--muted); display: flex; justify-content: center; min-height: 210px; text-align: center; }
@media (max-width: 1180px) {
    .top-sales-layout { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .top-sales-bar-row { grid-template-columns: 36px minmax(0, 1fr); }
    .top-sales-bar-track, .top-sales-bar-value { grid-column: 2; }
    .top-sales-bar-value { text-align: left; }
}
.nav-group { display: grid; gap: 4px; }
.nav-parent { color: #cbd5e1; }
.nav-group.active > .nav-parent { background: rgba(255,255,255,.1); color: #fff; }
.nav-sub { border-left: 1px solid rgba(255,255,255,.16); display: grid; gap: 3px; margin: 0 0 4px 14px; padding-left: 10px; }
.nav-sub[hidden] { display: none; }
.nav-sub a { font-size: 13px; font-weight: 600; padding: 8px 10px; }
.notification-panel .notice { display: grid; gap: 4px; }
.notification-panel .link-button { margin-top: 3px; }
.report-access-body { padding: 18px; }
.report-access-modal .btn { width: 100%; }
.top-sales-page h2 { margin-top: 0; }
/* Modern polish pass */
:root {
    --bg: #f6f8fb;
    --surface: #ffffff;
    --line: #e1e7ef;
    --ink: #101828;
    --muted: #667085;
    --shadow-soft: 0 14px 32px rgba(16, 24, 40, .08);
    --shadow-float: 0 22px 48px rgba(16, 24, 40, .14);
}
body { background: #f6f8fb; font-size: 14px; line-height: 1.45; }
.sidebar { background: #111827; border-right: 1px solid rgba(255,255,255,.08); position: sticky; top: 0; height: 100vh; }
.brand { border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 20px; padding-bottom: 18px; }
.brand-logo, .auth-logo { box-shadow: 0 10px 22px rgba(37, 99, 235, .28); }
.nav { gap: 4px; }
.nav a, .nav-parent { border-radius: 8px; transition: background .16s ease, color .16s ease, transform .16s ease; }
.nav a:hover, .nav-parent:hover { transform: translateX(2px); }
.nav a.active, .nav-group.active > .nav-parent { background: rgba(255,255,255,.14); box-shadow: inset 3px 0 0 var(--brand); }
.main { padding: 28px; }
.topbar, .card, .accordion { box-shadow: var(--shadow-soft); }
.topbar { backdrop-filter: blur(10px); border-color: rgba(219, 227, 239, .86); }
.topbar h1 { font-size: 25px; letter-spacing: 0; }
.card, .accordion, .kpi, .notice, .modal, .auth-card { border-color: rgba(219, 227, 239, .92); }
.card h2, .card h3, .accordion summary { letter-spacing: 0; }
.kpi { box-shadow: 0 10px 24px rgba(16, 24, 40, .06); }
.kpi strong { font-size: 24px; letter-spacing: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); outline: 0; }
.btn { box-shadow: 0 8px 18px rgba(16, 24, 40, .08); transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.btn:hover { box-shadow: 0 12px 24px rgba(16, 24, 40, .12); transform: translateY(-1px); }
.btn.ghost { box-shadow: none; }
.table-wrap { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.table-wrap table { border-collapse: separate; border-spacing: 0; }
th { background: #f8fafc; color: #344054; font-size: 11px; letter-spacing: 0; }
td { vertical-align: middle; }
tbody tr:hover { background: #f9fbff; }
.history-table { min-width: 760px; }
.history-table th, .history-table td { padding: 15px 12px; }
.sale-lines { min-width: 760px; }
.sale-lines th, .sale-lines td { vertical-align: middle; }
.sale-lines input[readonly] { background: #f8fafc; border-style: dashed; }
.select2-lite input[type="search"] { background: #fff; padding-right: 40px; }
.invoice-total-box { background: #fbfcfe; box-shadow: inset 0 1px 0 rgba(255,255,255,.7); }
.modal { box-shadow: var(--shadow-float); }
.chat-bubble { box-shadow: 0 10px 22px rgba(16, 24, 40, .07); }
@media (max-width: 980px) {
    .sidebar { height: auto; position: static; }
    .main { padding: 18px; }
    .topbar, .card, .accordion { box-shadow: 0 8px 20px rgba(16, 24, 40, .07); }
}

.form-grid label.is-disabled { opacity: .58; }
.form-grid label.is-disabled input,
.form-grid label.is-disabled select,
.form-grid label.is-disabled textarea { background: #eef2f6; cursor: not-allowed; }

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b1120;
    --surface: #111827;
    --line: #273449;
    --ink: #e5e7eb;
    --muted: #9ca3af;
    --brand-dark: #93c5fd;
    --shadow-soft: 0 16px 34px rgba(0, 0, 0, .28);
    --shadow-float: 0 26px 58px rgba(0, 0, 0, .38);
}
html[data-theme="dark"] body,
html[data-theme="dark"] .main { background: #0b1120; color: var(--ink); }
html[data-theme="dark"] .sidebar { background: #020617; border-right-color: #1e293b; }
html[data-theme="dark"] .brand { border-bottom-color: #1e293b; }
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .card,
html[data-theme="dark"] .accordion,
html[data-theme="dark"] .kpi,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .user-menu-panel,
html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] .top-sales-chart { background: #111827; border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .user-menu-toggle,
html[data-theme="dark"] .btn.ghost,
html[data-theme="dark"] .icon-btn.neutral { background: #0f172a; border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .avatar { background: color-mix(in srgb, var(--brand) 20%, #0f172a); color: #dbeafe; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea { background: #0f172a; border-color: #334155; color: var(--ink); }
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #64748b; }
html[data-theme="dark"] th,
html[data-theme="dark"] .professional-table th { background: #0f172a; color: #cbd5e1; }
html[data-theme="dark"] td,
html[data-theme="dark"] th { border-bottom-color: var(--line); }
html[data-theme="dark"] tbody tr:hover,
html[data-theme="dark"] .professional-table tbody tr:hover { background: #172033; }
html[data-theme="dark"] .professional-table tbody tr:nth-child(even) { background: #121c2d; }
html[data-theme="dark"] .notice,
html[data-theme="dark"] .toast,
html[data-theme="dark"] .select2-lite-list,
html[data-theme="dark"] .select2-lite-option,
html[data-theme="dark"] .contact-list div,
html[data-theme="dark"] .credential-grid div,
html[data-theme="dark"] .detail-grid div,
html[data-theme="dark"] .invoice-total-box { background: #0f172a; border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .select2-lite-option:hover,
html[data-theme="dark"] .select2-lite-option.active { background: #1e3a5f; color: #dbeafe; }
html[data-theme="dark"] .select2-lite-clear { background: #263244; color: #cbd5e1; }
html[data-theme="dark"] .select2-lite-clear:hover { background: #4c1d1d; color: #fecaca; }
html[data-theme="dark"] .select2-lite input[type="search"],
html[data-theme="dark"] .sale-lines input[readonly],
html[data-theme="dark"] .form-grid label.is-disabled input,
html[data-theme="dark"] .form-grid label.is-disabled select,
html[data-theme="dark"] .form-grid label.is-disabled textarea { background: #172033; color: #94a3b8; }
html[data-theme="dark"] .user-menu-panel a:hover,
html[data-theme="dark"] .user-menu-action:hover,
html[data-theme="dark"] .credential-grid div,
html[data-theme="dark"] .chat-bubble.from-client { background: #172033; }
html[data-theme="dark"] .chat-bubble.from-super { background: #123456; }
html[data-theme="dark"] .badge.neutral { background: #263244; color: #cbd5e1; }
html[data-theme="dark"] .badge.in,
html[data-theme="dark"] .pill { background: #063f2b; color: #86efac; }
html[data-theme="dark"] .badge.warn { background: #4a3410; color: #fbbf24; }
html[data-theme="dark"] .badge.out,
html[data-theme="dark"] .btn.danger { background: #4c1d1d; color: #fecaca; }
html[data-theme="dark"] .auth-body { background: linear-gradient(135deg, #0b1120, #111827 52%, #172033); }
html[data-theme="dark"] .modal::backdrop { background: rgba(2, 6, 23, .72); }
.app-icon { flex: 0 0 auto; height: 18px; width: 18px; }
.nav a, .nav-parent { align-items: center; display: flex; gap: 10px; min-width: 0; position: relative; }
.nav .app-icon { opacity: .9; }
.nav-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge { align-items: center; background: #ef4444; border: 2px solid #111827; border-radius: 999px; color: #fff; display: inline-flex; flex: 0 0 auto; font-size: 10px; font-weight: 800; height: 20px; justify-content: center; min-width: 20px; padding: 0 5px; }
.user-menu-panel a, .user-menu-action { align-items: center; display: flex; gap: 10px; }
.user-menu-panel .app-icon, .user-menu-action .app-icon { color: var(--muted); height: 17px; width: 17px; }
.kpi { align-items: flex-start; display: flex; gap: 14px; justify-content: space-between; }
.kpi .kpi-icon { align-items: center; background: color-mix(in srgb, var(--brand) 13%, #fff); border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line)); border-radius: 8px; color: var(--brand-dark); display: inline-flex; height: 42px; justify-content: center; margin: 0; padding: 0; text-transform: none; width: 42px; }
.kpi .kpi-icon .app-icon { height: 21px; width: 21px; }
.kpi:nth-child(2) .kpi-icon { background: #ecfdf3; color: var(--teal); }
.kpi:nth-child(3) .kpi-icon { background: #f4f3ff; color: var(--violet); }
.kpi:nth-child(4) .kpi-icon { background: #fff7ed; color: #b54708; }
.kpi:nth-child(5) .kpi-icon { background: #eff6ff; color: var(--brand-dark); }
html[data-theme="dark"] .nav-badge { border-color: #020617; }
html[data-theme="dark"] .user-menu-panel .app-icon,
html[data-theme="dark"] .user-menu-action .app-icon { color: #94a3b8; }
html[data-theme="dark"] .kpi .kpi-icon { background: #172033; border-color: #334155; color: #bfdbfe; }
html[data-theme="dark"] .kpi:nth-child(2) .kpi-icon { background: #063f2b; color: #86efac; }
html[data-theme="dark"] .kpi:nth-child(3) .kpi-icon { background: #302255; color: #c4b5fd; }
html[data-theme="dark"] .kpi:nth-child(4) .kpi-icon { background: #4a3410; color: #fbbf24; }
html[data-theme="dark"] .kpi:nth-child(5) .kpi-icon { background: #102a43; color: #93c5fd; }
.chat-shell {
    display: grid;
    grid-template-rows: auto minmax(360px, calc(100vh - 330px)) auto;
    min-height: min(760px, calc(100vh - 150px));
    overflow: hidden;
    padding: 0;
}
.chat-head {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 16px 18px;
}
.chat-head h2 { margin: 0; }
.chat-head p { color: var(--muted); margin: 4px 0 0; }
.chat-switcher { margin: 0; min-width: min(320px, 100%); }
.chat-switcher label { gap: 5px; }
.chat-thread {
    align-content: start;
    background: linear-gradient(180deg, #f8fafc 0%, #f4f7fb 100%);
    display: grid;
    gap: 12px;
    max-height: none;
    overflow-y: auto;
    padding: 18px;
}
.chat-row {
    align-items: end;
    display: flex;
    gap: 9px;
    max-width: min(760px, 86%);
}
.chat-row.mine {
    flex-direction: row-reverse;
    justify-self: end;
}
.chat-row.other { justify-self: start; }
.chat-avatar {
    align-items: center;
    background: #e2e8f0;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #334155;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 800;
    height: 32px;
    justify-content: center;
    width: 32px;
}
.chat-bubble {
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(16, 24, 40, .08);
    max-width: none;
    padding: 10px 12px;
}
.chat-bubble.from-mine {
    background: var(--brand);
    border-color: color-mix(in srgb, var(--brand) 72%, #000);
    border-bottom-right-radius: 5px;
    color: #fff;
}
.chat-bubble.from-other {
    background: #fff;
    border-bottom-left-radius: 5px;
    color: var(--ink);
}
.chat-bubble strong {
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}
.chat-bubble p {
    line-height: 1.5;
    margin: 0;
    white-space: normal;
}
.chat-bubble small {
    color: inherit;
    display: block;
    font-size: 11px;
    margin-top: 6px;
    opacity: .72;
    text-align: right;
}
.chat-empty {
    align-self: center;
    color: var(--muted);
    display: grid;
    gap: 4px;
    justify-items: center;
    padding: 48px 16px;
    text-align: center;
}
.chat-empty strong { color: var(--ink); }
.chat-composer {
    align-items: end;
    background: var(--surface);
    border-top: 1px solid var(--line);
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 14px;
}
.chat-composer textarea {
    max-height: 132px;
    min-height: 46px;
    resize: none;
}
.chat-composer .btn { min-width: 118px; }
html[data-theme="dark"] .chat-thread { background: linear-gradient(180deg, #0b1120 0%, #111827 100%); }
html[data-theme="dark"] .chat-avatar { background: #1f2937; border-color: #334155; color: #cbd5e1; }
html[data-theme="dark"] .chat-bubble.from-other { background: #172033; border-color: #334155; color: var(--ink); }
html[data-theme="dark"] .chat-bubble.from-mine { background: var(--brand); color: #fff; }
html[data-theme="dark"] .chat-composer { background: #111827; border-color: var(--line); }
@media (max-width: 760px) {
    .chat-shell {
        grid-template-rows: auto minmax(320px, calc(100vh - 360px)) auto;
        min-height: calc(100vh - 120px);
    }
    .chat-head {
        align-items: stretch;
        flex-direction: column;
    }
    .chat-row { max-width: 96%; }
    .chat-composer { grid-template-columns: 1fr; }
    .chat-composer .btn { width: 100%; }
}
.card-title-with-icon,
.card h2:has(.app-icon),
.modal-head h2:has(.app-icon) {
    align-items: center;
    display: flex;
    gap: 10px;
}
.card-title-icon,
.card h2 .app-icon,
.modal-head h2 .app-icon,
.accordion summary .app-icon {
    align-items: center;
    background: color-mix(in srgb, var(--brand) 12%, #fff);
    border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line));
    border-radius: 8px;
    color: var(--brand-dark);
    height: 32px;
    padding: 7px;
    width: 32px;
}
.accordion summary {
    align-items: center;
    display: flex;
    gap: 10px;
}
.accordion summary span {
    flex: 1 1 auto;
}
.sales-kpis .kpi:nth-child(1) .kpi-icon { background: #eff6ff; color: var(--brand-dark); }
.sales-kpis .kpi:nth-child(2) .kpi-icon { background: #ecfdf3; color: var(--teal); }
.sales-kpis .kpi:nth-child(3) .kpi-icon { background: #fee4e2; color: var(--danger); }
html[data-theme="dark"] .card-title-icon,
html[data-theme="dark"] .card h2 .app-icon,
html[data-theme="dark"] .modal-head h2 .app-icon,
html[data-theme="dark"] .accordion summary .app-icon {
    background: #172033;
    border-color: #334155;
    color: #bfdbfe;
}
html[data-theme="dark"] .sales-kpis .kpi:nth-child(1) .kpi-icon { background: #102a43; color: #93c5fd; }
html[data-theme="dark"] .sales-kpis .kpi:nth-child(2) .kpi-icon { background: #063f2b; color: #86efac; }
html[data-theme="dark"] .sales-kpis .kpi:nth-child(3) .kpi-icon { background: #4c1d1d; color: #fecaca; }
.help-trigger { background: var(--surface); }
.help-modal { max-width: min(760px, calc(100vw - 32px)); }
.help-list { display: grid; gap: 12px; padding: 16px 18px 18px; }
.help-item { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 13px 14px; }
.help-item strong { color: var(--ink); display: block; margin-bottom: 5px; }
.help-item p { color: var(--muted); line-height: 1.5; margin: 0; }
.protected-locked-card { border-color: rgba(180, 35, 24, .28); max-width: 720px; }
html[data-theme="dark"] .help-item { background: #0f172a; border-color: var(--line); }
.sale-lines tr.sale-line-invalid td { background: #fff5f5; }
.sale-lines tr.sale-line-invalid input,
.sale-lines tr.sale-line-invalid .select2-lite input[type="search"] {
    background: #fff1f2;
    border-color: var(--danger);
    box-shadow: 0 0 0 2px rgba(180, 35, 24, .12);
    color: var(--danger);
}
.sale-line-error {
    color: var(--danger);
    display: block;
    font-size: 11px;
    font-weight: 700;
    margin-top: 5px;
    white-space: normal;
}
.btn:disabled,
.btn.is-disabled {
    cursor: not-allowed;
    opacity: .55;
}
html[data-theme="dark"] .sale-lines tr.sale-line-invalid td { background: #2a1114; }
html[data-theme="dark"] .sale-lines tr.sale-line-invalid input,
html[data-theme="dark"] .sale-lines tr.sale-line-invalid .select2-lite input[type="search"] {
    background: #3a1518;
    border-color: #fca5a5;
    color: #fecaca;
}
.nav-chevron {
    align-items: center;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 24px;
    height: 24px;
    justify-content: center;
    margin-left: auto;
    opacity: .72;
    transition: transform .16s ease, opacity .16s ease;
    width: 24px;
}
.nav-chevron::before {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    content: "";
    display: block;
}
.nav-chevron:focus-visible {
    outline: 2px solid rgba(255,255,255,.72);
    outline-offset: 2px;
}
.nav-parent:hover .nav-chevron,
.nav-group.open .nav-chevron,
.nav-group.active .nav-chevron { opacity: 1; }
.nav-group.open .nav-chevron { transform: rotate(180deg); }
.payment-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.permission-panel { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 8px; padding: 12px; }
.permission-panel strong { font-weight: 700; }
.enhanced-table-tools { align-items: center; display: flex; justify-content: flex-end; margin: 0 0 10px; }
.enhanced-table-tools input { max-width: 320px; min-height: 38px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable::after { color: var(--muted); content: "  -"; font-size: 10px; }
th.sortable[data-sort-direction="asc"]::after { content: "  ^"; }
th.sortable[data-sort-direction="desc"]::after { content: "  v"; }
.module-grid { display: grid; gap: 16px; grid-template-columns: minmax(280px, .85fr) minmax(0, 1.15fr); }
.mini-stat { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.mini-stat span { color: var(--muted); display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.mini-stat strong { display: block; font-size: 20px; margin-top: 4px; }
.backup-box { align-items: center; display: grid; gap: 10px; justify-items: start; }
html[data-theme="dark"] .permission-panel,
html[data-theme="dark"] .mini-stat { background: #0f172a; border-color: var(--line); }
@media (max-width: 980px) {
    .payment-grid, .module-grid { grid-template-columns: 1fr; }
    .enhanced-table-tools { justify-content: stretch; }
    .enhanced-table-tools input { max-width: none; }
}
.topbar-title { align-items: center; display: flex; gap: 12px; min-width: 0; }
.topbar-title > div { min-width: 0; }
.mobile-menu-toggle {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    cursor: pointer;
    display: none;
    flex: 0 0 auto;
    gap: 4px;
    height: 42px;
    justify-content: center;
    padding: 0;
    width: 42px;
}
.mobile-menu-toggle span {
    background: currentColor;
    border-radius: 999px;
    display: block;
    height: 2px;
    transition: opacity .16s ease, transform .16s ease;
    width: 18px;
}
.mobile-menu-toggle { flex-direction: column; }
.mobile-sidebar-backdrop {
    background: rgba(15, 23, 42, .54);
    display: none;
    inset: 0;
    opacity: 0;
    position: fixed;
    transition: opacity .18s ease;
    z-index: 88;
}
body.mobile-nav-open { overflow: hidden; }
body.mobile-nav-open .mobile-sidebar-backdrop { display: block; opacity: 1; }
body.mobile-nav-open .mobile-menu-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.mobile-nav-open .mobile-menu-toggle span:nth-child(2) { opacity: 0; }
body.mobile-nav-open .mobile-menu-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 980px) {
    .app-shell { display: block; min-height: 100vh; }
    .main { padding: 16px; }
    .sidebar {
        border-right: 1px solid rgba(255,255,255,.1);
        bottom: 0;
        box-shadow: 24px 0 48px rgba(15, 23, 42, .24);
        height: 100dvh;
        left: 0;
        max-width: 340px;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 18px;
        position: fixed;
        top: 0;
        transform: translateX(-105%);
        transition: transform .22s ease;
        width: min(86vw, 340px);
        z-index: 90;
    }
    body.mobile-nav-open .sidebar { transform: translateX(0); }
    .mobile-menu-toggle { display: inline-flex; }
    .topbar {
        align-items: center;
        flex-direction: row;
        gap: 12px;
        padding: 12px;
    }
    .topbar-title { flex: 1 1 auto; }
    .topbar-title h1 {
        font-size: 20px;
        line-height: 1.2;
        margin-bottom: 2px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .topbar-title p {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .top-actions {
        flex: 0 0 auto;
        gap: 6px;
        justify-content: flex-end;
    }
    .top-actions .filter-inline { display: none; }
    .help-trigger { display: inline-flex; }
    .user-menu, .user-menu-toggle { width: auto; }
    .user-menu-panel { left: auto; right: 0; }
    .brand { margin-bottom: 18px; padding-bottom: 14px; }
    .nav { gap: 5px; padding-bottom: 22px; }
    .nav a, .nav-parent { min-height: 42px; }
}

@media (max-width: 520px) {
    .main { padding: 12px; }
    .topbar { margin-bottom: 12px; }
    .topbar-title h1 { font-size: 18px; max-width: 56vw; }
    .topbar-title p { max-width: 56vw; }
    .top-actions { flex-wrap: nowrap; }
}

html[data-theme="dark"] .mobile-menu-toggle {
    background: #0f172a;
    border-color: var(--line);
    color: var(--ink);
}
/* Modern authentication */
.auth-modern { background:
    radial-gradient(circle at 50% 0%, rgba(20, 184, 166, .18), transparent 34%),
    radial-gradient(circle at 88% 18%, rgba(59, 130, 246, .12), transparent 28%),
    linear-gradient(135deg, #eef6f5 0%, #f8fafc 48%, #eef2ff 100%);
  padding: 28px; }
.auth-modern-card { border: 1px solid rgba(209, 224, 231, .9); border-radius: 14px; box-shadow: 0 28px 80px rgba(15, 23, 42, .14); max-width: 480px; overflow: hidden; padding: 36px 34px 30px; position: relative; text-align: center; }
.auth-modern-card::before { background: linear-gradient(90deg, #0f766e, #2563eb); content: ""; height: 4px; left: 0; position: absolute; right: 0; top: 0; }
.auth-logo-wrap { align-items: center; display: flex; justify-content: center; margin: 2px auto 18px; width: 100%; }
.auth-modern .auth-logo { background: #0f766e; border-radius: 20px; box-shadow: 0 18px 38px rgba(15, 118, 110, .24); display: block; flex: 0 0 auto; height: 76px; margin: 0 auto; object-fit: cover; width: 76px; }
.auth-eyebrow { color: #0f766e; display: inline-flex; font-size: 12px; font-weight: 800; letter-spacing: .08em; margin-bottom: 8px; text-transform: uppercase; }
.auth-modern-card h1 { background: linear-gradient(135deg, #072a46 0%, #0f766e 46%, #2563eb 100%); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 34px; font-weight: 900; line-height: 1.1; margin: 0 0 24px; text-shadow: 0 12px 30px rgba(15, 118, 110, .12); }
.auth-modern-card p { color: #526176; font-size: 15px; line-height: 1.55; margin: 0 auto 24px; max-width: 360px; }
.auth-form { gap: 14px; margin-top: 6px; text-align: left; }
.auth-form label { color: #1f2a3d; font-weight: 650; }
.auth-form input { background: #f8fbfd; border-color: #d7e2ec; min-height: 48px; }
.auth-form input:focus { background: #fff; border-color: #0f766e; box-shadow: 0 0 0 4px rgba(15, 118, 110, .12); outline: 0; }
.auth-modern .btn.primary.full { background: linear-gradient(135deg, #0f766e, #2563eb); border: 0; box-shadow: 0 16px 34px rgba(15, 118, 110, .2); min-height: 48px; }
.auth-modern .auth-contact { color: #0f766e; font-weight: 800; margin-top: 18px; }
.platform-brand-card .section-title { align-items: center; display: flex; gap: 18px; justify-content: space-between; margin-bottom: 18px; }
.platform-brand-card .section-title p { color: var(--muted); margin: 6px 0 0; }
.platform-brand-preview { align-items: center; display: flex; gap: 12px; justify-content: flex-end; min-width: 190px; }
.brand-logo-lg { border-radius: 14px; height: 58px; width: 58px; }
.brand-logo-lg img { height: 58px; object-fit: cover; width: 58px; }
html[data-theme="dark"] .auth-modern { background:
    radial-gradient(circle at 50% 0%, rgba(20, 184, 166, .16), transparent 34%),
    radial-gradient(circle at 88% 18%, rgba(59, 130, 246, .12), transparent 28%),
    linear-gradient(135deg, #08111f 0%, #0f172a 54%, #111827 100%); }
html[data-theme="dark"] .auth-modern-card h1 { background: linear-gradient(135deg, #e0f2fe 0%, #5eead4 50%, #93c5fd 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
html[data-theme="dark"] .auth-modern-card p { color: #b7c2d6; }
html[data-theme="dark"] .auth-form label { color: #dbe6f7; }
html[data-theme="dark"] .auth-form input { background: #111827; border-color: #263449; color: #e5edf7; }
@media (max-width: 640px) {
  .auth-modern { padding: 18px; }
  .auth-modern-card { border-radius: 12px; padding: 30px 22px 24px; }
  .auth-modern-card h1 { font-size: 28px; }
  .platform-brand-card .section-title { align-items: flex-start; flex-direction: column; }
  .platform-brand-preview { justify-content: flex-start; min-width: 0; }
}
/* Authentication contact modal */
.auth-contact-modal { border: 1px solid rgba(203, 220, 230, .95); border-radius: 16px; font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif; max-width: min(520px, calc(100vw - 32px)); overflow: hidden; }
.auth-contact-modal::before { background: linear-gradient(90deg, #0f766e, #2563eb); content: ""; height: 4px; left: 0; position: absolute; right: 0; top: 0; }
.auth-contact-modal svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.auth-contact-modal .modal-head { background: linear-gradient(180deg, #fbfdff, #fff); border-bottom: 1px solid rgba(216, 226, 236, .9); padding: 22px 22px 18px; position: relative; }
.auth-contact-modal .modal-head h2 { align-items: center; color: #172033; display: flex; font-size: 20px; font-weight: 650; gap: 10px; margin: 0; padding-right: 54px; }
.auth-modal-title-icon { align-items: center; background: #eef6ff; border: 1px solid #cfe1ff; border-radius: 10px; color: #2563eb; display: inline-flex; height: 34px; justify-content: center; width: 34px; }
.auth-modal-title-icon svg { height: 18px; width: 18px; }
.auth-contact-modal .modal-head .icon-button { background: #fff; border: 1px solid #d9e5ef; box-shadow: 0 10px 24px rgba(15, 23, 42, .1); color: #334155; height: 38px; padding: 0; position: absolute; right: 18px; top: 16px; width: 38px; }
.auth-contact-modal .modal-head .icon-button svg { height: 18px; width: 18px; }
.auth-contact-modal .modal-head .icon-button:hover { background: #fee2e2; border-color: #fecaca; color: #b91c1c; }
.auth-contact-modal .contact-list { background: #fff; gap: 12px; padding: 20px 22px 22px; }
.auth-contact-modal .contact-list div { align-items: center; background: linear-gradient(180deg, #f8fbfd, #f3f7fb); border: 1px solid #dce8f2; border-radius: 12px; column-gap: 12px; display: grid; grid-template-columns: 38px 1fr; padding: 14px 16px; }
.auth-contact-modal .contact-icon { align-items: center; background: #e8f7f4; border: 1px solid #c7ebe5; border-radius: 10px; color: #0f766e; display: inline-flex; grid-row: span 2; height: 38px; justify-content: center; width: 38px; }
.auth-contact-modal .contact-icon svg { height: 18px; width: 18px; }
.auth-contact-modal .contact-label { color: #0f766e; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.auth-contact-modal .contact-value { color: #223047; font-size: 15px; font-weight: 400; line-height: 1.35; overflow-wrap: anywhere; text-decoration: none; }
.auth-contact-modal a.contact-value:hover { color: #0f766e; text-decoration: underline; text-underline-offset: 3px; }
html[data-theme="dark"] .auth-contact-modal { border-color: #263449; }
html[data-theme="dark"] .auth-contact-modal .modal-head { background: linear-gradient(180deg, #111827, #0f172a); border-bottom-color: #263449; }
html[data-theme="dark"] .auth-contact-modal .modal-head h2 { color: #f8fafc; }
html[data-theme="dark"] .auth-modal-title-icon { background: #172554; border-color: #1d4ed8; color: #93c5fd; }
html[data-theme="dark"] .auth-contact-modal .modal-head .icon-button { background: #111827; border-color: #334155; color: #e5edf7; }
html[data-theme="dark"] .auth-contact-modal .contact-list { background: #0f172a; }
html[data-theme="dark"] .auth-contact-modal .contact-list div { background: linear-gradient(180deg, #111827, #0b1220); border-color: #263449; }
html[data-theme="dark"] .auth-contact-modal .contact-icon { background: rgba(20, 184, 166, .12); border-color: rgba(94, 234, 212, .25); color: #5eead4; }
html[data-theme="dark"] .auth-contact-modal .contact-value { color: #e5edf7; }
/* Authentication field icons and background image */
.auth-modern {
  background: #eaf4f6 url("../img/auth-bg.png") center center / cover no-repeat fixed;
  overflow: hidden;
  position: relative;
}
.auth-modern::before {
  background:
    linear-gradient(90deg, rgba(8, 47, 73, .66) 0%, rgba(29, 78, 216, .46) 50%, rgba(37, 99, 235, .34) 100%),
    radial-gradient(circle at 50% 8%, rgba(59, 130, 246, .28), transparent 36%);
  content: "";
  inset: 0;
  pointer-events: none;
  position: fixed;
}
.auth-modern-card {
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 1;
}
.auth-field-label { display: grid; gap: 7px; }
.auth-input-wrap { display: block; position: relative; }
.auth-input-wrap input { padding-left: 48px; width: 100%; }
.auth-input-icon {
  align-items: center;
  background: #eef7f6;
  border: 1px solid #d3e9e7;
  border-radius: 10px;
  color: #0f766e;
  display: inline-flex;
  height: 30px;
  justify-content: center;
  left: 12px;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
}
.auth-input-icon svg {
  fill: none;
  height: 16px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 16px;
}
.auth-input-wrap:focus-within .auth-input-icon {
  background: #e0f2fe;
  border-color: #bfdbfe;
  color: #2563eb;
}
html[data-theme="dark"] .auth-modern {
  background: #0b1220 url("../img/auth-bg.png") center center / cover no-repeat fixed;
}
html[data-theme="dark"] .auth-modern::before {
  background:
    linear-gradient(90deg, rgba(3, 7, 18, .92) 0%, rgba(15, 23, 42, .82) 48%, rgba(30, 64, 175, .58) 100%),
    radial-gradient(circle at 50% 8%, rgba(59, 130, 246, .22), transparent 36%);
}
html[data-theme="dark"] .auth-modern-card {
  background: rgba(15, 23, 42, .9);
}
html[data-theme="dark"] .auth-input-icon {
  background: rgba(20, 184, 166, .12);
  border-color: rgba(94, 234, 212, .24);
  color: #5eead4;
}
@media (max-width: 640px) {
  .auth-modern {
    background-attachment: scroll;
    background-position: 58% center;
  }
  .auth-modern::before {
    background: linear-gradient(180deg, rgba(8, 47, 73, .62), rgba(29, 78, 216, .42));
  }
}

/* ONISMA enterprise visual system */
:root {
  --onis-ink: #122033;
  --onis-muted: #5b6b81;
  --onis-blue-950: #071426;
  --onis-blue-900: #0b1b31;
  --onis-blue-800: #0f2f54;
  --onis-blue-700: #164e83;
  --onis-cyan: #28c7e8;
  --onis-teal: #13b8a6;
  --onis-glass: rgba(255, 255, 255, .92);
  --onis-glass-strong: rgba(255, 255, 255, .97);
  --onis-line: rgba(148, 184, 212, .46);
  --onis-shadow: 0 22px 54px rgba(7, 20, 38, .16);
  --onis-shadow-soft: 0 12px 30px rgba(7, 20, 38, .10);
}

body {
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

.app-shell {
  background: linear-gradient(135deg, #e8f3fb 0%, #f5f9fc 48%, #eaf2ff 100%);
  isolation: isolate;
  position: relative;
}

.app-shell::before {
  background:
    linear-gradient(115deg, rgba(232, 243, 251, .96) 0%, rgba(244, 249, 252, .88) 44%, rgba(219, 234, 254, .72) 100%),
    radial-gradient(circle at 18% 10%, rgba(40, 199, 232, .18), transparent 30%),
    radial-gradient(circle at 86% 20%, rgba(19, 184, 166, .14), transparent 28%);
  content: "";
  inset: 0;
  pointer-events: none;
  position: fixed;
  z-index: 0;
}

.sidebar,
.main {
  position: relative;
  z-index: 1;
}

.main {
  background:
    linear-gradient(180deg, rgba(236, 246, 255, .88), rgba(244, 249, 252, .82));
  min-height: 100vh;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(5, 18, 34, .96), rgba(8, 30, 55, .92));
  border-right: 1px solid rgba(125, 190, 232, .22);
  box-shadow: 18px 0 48px rgba(2, 8, 23, .28);
}

.brand {
  border-bottom: 1px solid rgba(148, 184, 212, .18);
  margin-bottom: 22px;
  padding-bottom: 18px;
}

.brand-logo {
  background: linear-gradient(135deg, #0f766e, #2563eb);
  border: 1px solid rgba(125, 211, 252, .34);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(37, 99, 235, .24);
}

.brand strong {
  color: #f8fbff;
  font-weight: 700;
  letter-spacing: 0;
}

.brand small {
  color: #9fb7ce;
}

.nav a,
.nav-parent {
  border: 1px solid transparent;
  color: #c8d7e8;
  font-weight: 600;
}

.nav a:hover,
.nav-parent:hover {
  background: rgba(40, 199, 232, .10);
  border-color: rgba(40, 199, 232, .18);
  color: #fff;
}

.nav a.active,
.nav-group.active > .nav-parent {
  background: linear-gradient(90deg, rgba(19, 184, 166, .22), rgba(37, 99, 235, .18));
  border-color: rgba(125, 211, 252, .30);
  box-shadow: inset 3px 0 0 #28c7e8, 0 10px 24px rgba(0, 0, 0, .16);
  color: #fff;
}

.nav-sub {
  border-left-color: rgba(125, 211, 252, .20);
}

.nav-badge {
  background: #28c7e8;
  border-color: rgba(5, 18, 34, .95);
  color: #061526;
}

.topbar,
.card,
.accordion,
.kpi,
.notice,
.modal,
.table-wrap,
.user-menu-panel,
.select2-lite-list,
.invoice-total-box {
  background: var(--onis-glass);
  backdrop-filter: blur(14px);
  border-color: var(--onis-line);
  box-shadow: var(--onis-shadow-soft);
}

.topbar,
.card,
.accordion,
.kpi,
.notice,
.table-wrap {
  border-radius: 8px;
}

.topbar {
  box-shadow: var(--onis-shadow);
}

.topbar h1 {
  background: linear-gradient(135deg, #082f49, #0f766e 48%, #2563eb);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 780;
}

.topbar p,
.muted,
td small,
.card small {
  color: var(--onis-muted);
}

.card,
.accordion {
  overflow: hidden;
}

.hero-card {
  border-top: 0;
  position: relative;
}

.hero-card::before,
.card::before,
.accordion::before {
  background: linear-gradient(90deg, #0f766e, #2563eb);
  content: "";
  display: block;
  height: 3px;
  margin: -18px -18px 15px;
}

.card h2,
.card h3,
.accordion summary {
  color: var(--onis-ink);
  font-weight: 700;
}

.card-title-icon,
.card h2 .app-icon,
.modal-head h2 .app-icon,
.accordion summary .app-icon {
  background: rgba(14, 165, 233, .10);
  border-color: rgba(14, 165, 233, .22);
  color: #0f76a8;
}

.kpi {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(236, 248, 255, .90));
  border-left: 0;
  position: relative;
}

.kpi::before {
  background: linear-gradient(180deg, #28c7e8, #0f766e);
  bottom: 12px;
  content: "";
  left: 0;
  position: absolute;
  top: 12px;
  width: 4px;
}

.kpi span {
  color: #526276;
  font-weight: 650;
}

.kpi strong {
  color: #0b2f55;
  font-weight: 760;
}

.kpi .kpi-icon {
  background: linear-gradient(135deg, rgba(40, 199, 232, .16), rgba(37, 99, 235, .12));
  border-color: rgba(40, 199, 232, .26);
  color: #0f76a8;
}

.btn.primary,
.top-sales-presets .btn.active {
  background: linear-gradient(135deg, #0f766e, #2563eb);
  box-shadow: 0 14px 28px rgba(37, 99, 235, .22);
}

.btn.secondary,
.icon-btn.info {
  background: rgba(219, 234, 254, .88);
  color: #1d4ed8;
}

.btn.ghost,
.icon-btn.neutral,
.user-menu-toggle {
  background: rgba(255, 255, 255, .82);
  border-color: var(--onis-line);
}

.filter-inline select,
input,
select,
textarea {
  background: rgba(255, 255, 255, .90);
  border-color: rgba(148, 184, 212, .56);
  border-radius: 8px;
}

.filter-inline select:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: #28c7e8;
  box-shadow: 0 0 0 4px rgba(40, 199, 232, .16);
  outline: 0;
}

label {
  color: #25364b;
  font-weight: 600;
}

.table-wrap {
  background: rgba(255, 255, 255, .86);
  overflow: auto;
}

th {
  background: linear-gradient(180deg, rgba(8, 47, 73, .96), rgba(12, 50, 88, .96));
  border-bottom: 0;
  color: #e8f7ff;
  font-weight: 650;
}

td {
  background: rgba(255, 255, 255, .72);
}

tbody tr:nth-child(even) td,
.professional-table tbody tr:nth-child(even) {
  background: rgba(239, 248, 255, .66);
}

tbody tr:hover td,
.professional-table tbody tr:hover {
  background: rgba(219, 242, 255, .86);
}

.professional-table th {
  background: linear-gradient(180deg, rgba(8, 47, 73, .96), rgba(12, 50, 88, .96));
  color: #e8f7ff;
}

.badge,
.pill {
  font-weight: 650;
}

.badge.in,
.pill {
  background: rgba(220, 252, 231, .95);
}

.badge.neutral {
  background: rgba(226, 235, 245, .86);
}

.notice {
  background: rgba(255, 255, 255, .88);
  border-left-color: #28c7e8;
}

.notice strong {
  color: #10243a;
}

.modal-head {
  background: linear-gradient(180deg, rgba(248, 252, 255, .98), rgba(238, 247, 252, .90));
}

.toast {
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(12px);
  border-color: var(--onis-line);
  box-shadow: var(--onis-shadow);
}

.chat-bubble,
.detail-grid div,
.credential-grid div,
.select2-lite-option,
.help-item {
  background: rgba(255, 255, 255, .78);
  border-color: var(--onis-line);
}

.chat-bubble.from-super {
  background: rgba(219, 234, 254, .82);
}

.chat-bubble.from-client {
  background: rgba(240, 253, 250, .78);
}

html[data-theme="dark"] .app-shell {
  background: linear-gradient(135deg, #020617 0%, #071426 58%, #0f2f54 100%);
}

html[data-theme="dark"] .app-shell::before {
  background:
    linear-gradient(115deg, rgba(2, 6, 23, .92) 0%, rgba(8, 21, 40, .86) 48%, rgba(30, 64, 175, .42) 100%),
    radial-gradient(circle at 18% 10%, rgba(40, 199, 232, .10), transparent 30%);
}

html[data-theme="dark"] .main {
  background: linear-gradient(180deg, rgba(3, 7, 18, .80), rgba(15, 23, 42, .84));
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .card,
html[data-theme="dark"] .accordion,
html[data-theme="dark"] .kpi,
html[data-theme="dark"] .notice,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] .user-menu-panel,
html[data-theme="dark"] .select2-lite-list,
html[data-theme="dark"] .invoice-total-box {
  background: rgba(15, 23, 42, .86);
  border-color: rgba(71, 117, 154, .48);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .28);
}

html[data-theme="dark"] .topbar h1 {
  background: linear-gradient(135deg, #e0f2fe, #5eead4 48%, #93c5fd);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

html[data-theme="dark"] .card h2,
html[data-theme="dark"] .card h3,
html[data-theme="dark"] .accordion summary,
html[data-theme="dark"] .notice strong {
  color: #f8fafc;
}

html[data-theme="dark"] td,
html[data-theme="dark"] tbody tr:nth-child(even) td,
html[data-theme="dark"] .professional-table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, .58);
}

html[data-theme="dark"] tbody tr:hover td,
html[data-theme="dark"] .professional-table tbody tr:hover {
  background: rgba(30, 64, 175, .28);
}

html[data-theme="dark"] .filter-inline select,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .btn.ghost,
html[data-theme="dark"] .icon-btn.neutral,
html[data-theme="dark"] .user-menu-toggle {
  background: rgba(15, 23, 42, .74);
  border-color: rgba(71, 117, 154, .52);
}

html[data-theme="dark"] .kpi::before {
  background: linear-gradient(180deg, #38bdf8, #5eead4);
}

html[data-theme="dark"] .kpi strong {
  color: #f8fafc;
}

html[data-theme="dark"] .kpi span,
html[data-theme="dark"] .topbar p,
html[data-theme="dark"] .muted,
html[data-theme="dark"] td small {
  color: #a9bbd1;
}

@media (max-width: 980px) {
  .app-shell {
    background-attachment: scroll;
  }

  .main {
    background: linear-gradient(180deg, rgba(236, 246, 255, .92), rgba(244, 249, 252, .88));
  }

  .sidebar {
    box-shadow: 18px 0 48px rgba(2, 8, 23, .36);
  }
}

@media print {
  .app-shell,
  .main {
    background: #fff !important;
  }

  .app-shell::before {
    display: none !important;
  }

  .topbar,
  .card,
  .accordion,
  .kpi,
  .table-wrap {
    box-shadow: none !important;
    backdrop-filter: none !important;
  }
}

/* ONISMA HUD card language */
.card,
.accordion,
.kpi,
.notice,
.invoice-total-box,
.detail-grid div,
.credential-grid div {
  background:
    linear-gradient(135deg, rgba(7, 23, 43, .92), rgba(13, 48, 82, .78) 54%, rgba(15, 69, 104, .70)),
    radial-gradient(circle at 18% 0%, rgba(40, 199, 232, .18), transparent 34%);
  border: 1px solid rgba(56, 189, 248, .38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .14),
    0 18px 44px rgba(3, 10, 22, .18),
    0 0 0 1px rgba(14, 165, 233, .06);
  color: #eaf6ff;
}

.card,
.accordion,
.kpi,
.notice {
  position: relative;
}

.card::before,
.accordion::before,
.hero-card::before {
  background: linear-gradient(90deg, rgba(40, 199, 232, .92), rgba(19, 184, 166, .82), rgba(37, 99, 235, .92));
  box-shadow: 0 0 18px rgba(40, 199, 232, .38);
  height: 2px;
}

.card h2,
.card h3,
.accordion summary,
.notice strong {
  color: #f8fbff;
  font-weight: 650;
}

.card p,
.card small,
.accordion p,
.notice span,
.detail-grid span,
.credential-grid span,
.credential-grid small,
.kpi small,
.report-head span,
.report-kpis small,
.dashboard-summary small {
  color: #b7cce0;
}

.card label,
.accordion label,
.notice label {
  color: #d8e9f8;
  font-weight: 560;
}

.card input,
.card select,
.card textarea,
.accordion input,
.accordion select,
.accordion textarea,
.notice input,
.notice select,
.notice textarea {
  background: rgba(246, 251, 255, .94);
  border-color: rgba(150, 190, 220, .64);
  color: #122033;
}

.card input:focus,
.card select:focus,
.card textarea:focus,
.accordion input:focus,
.accordion select:focus,
.accordion textarea:focus {
  background: #fff;
  border-color: #38bdf8;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, .18);
}

.kpi {
  background:
    linear-gradient(135deg, rgba(7, 23, 43, .94), rgba(12, 44, 76, .78)),
    radial-gradient(circle at 82% 18%, rgba(34, 197, 94, .18), transparent 30%);
  min-height: 124px;
  overflow: hidden;
}

.kpi::before {
  background: linear-gradient(180deg, #28c7e8, #22c55e);
  box-shadow: 0 0 16px rgba(40, 199, 232, .45);
  width: 3px;
}

.kpi span {
  color: #d8e9f8;
  font-weight: 640;
}

.kpi strong {
  color: #fff;
  font-size: 28px;
  font-weight: 720;
}

.kpi .kpi-icon,
.card-title-icon,
.card h2 .app-icon,
.modal-head h2 .app-icon,
.accordion summary .app-icon {
  background:
    linear-gradient(135deg, rgba(40, 199, 232, .22), rgba(37, 99, 235, .16));
  border: 1px solid rgba(56, 189, 248, .42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 0 22px rgba(40, 199, 232, .18);
  color: #38d9ff;
}

.table-wrap {
  background: rgba(4, 18, 34, .56);
  border-color: rgba(56, 189, 248, .32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 18px 38px rgba(3, 10, 22, .12);
}

.card .table-wrap,
.accordion .table-wrap {
  background: rgba(3, 13, 25, .40);
}

th,
.professional-table th {
  background: linear-gradient(180deg, rgba(6, 22, 41, .98), rgba(10, 42, 74, .96));
  color: #dff6ff;
  font-weight: 640;
}

td,
.professional-table td {
  background: rgba(255, 255, 255, .07);
  color: #eaf6ff;
}

tbody tr:nth-child(even) td,
.professional-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, .11);
}

tbody tr:hover td,
.professional-table tbody tr:hover {
  background: rgba(40, 199, 232, .16);
}

td small {
  color: #aec5da;
}

td strong,
.detail-grid strong,
.credential-grid strong {
  color: #fff;
  font-weight: 620;
}

.badge,
.pill {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22);
}

.badge.neutral {
  background: rgba(148, 163, 184, .22);
  color: #e2e8f0;
}

.card .btn.ghost,
.accordion .btn.ghost,
.notice .btn.ghost {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(56, 189, 248, .30);
  color: #eaf6ff;
}

.card .btn.secondary,
.accordion .btn.secondary,
.notice .btn.secondary {
  background: rgba(56, 189, 248, .16);
  color: #dff6ff;
}

.select2-lite-option {
  background: rgba(8, 30, 55, .96);
  color: #eaf6ff;
}

.select2-lite-option:hover,
.select2-lite-option.active {
  background: rgba(40, 199, 232, .18);
  color: #fff;
}

.select2-lite-option small,
.select2-lite-empty {
  color: #b7cce0;
}

.invoice-total-box {
  border-color: rgba(56, 189, 248, .34);
}

.invoice-total-box strong {
  color: #fff;
}

.alert-panel .notice {
  background:
    linear-gradient(135deg, rgba(7, 23, 43, .92), rgba(13, 48, 82, .78));
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .accordion,
html[data-theme="dark"] .kpi,
html[data-theme="dark"] .notice,
html[data-theme="dark"] .invoice-total-box,
html[data-theme="dark"] .detail-grid div,
html[data-theme="dark"] .credential-grid div {
  background:
    linear-gradient(135deg, rgba(3, 10, 22, .94), rgba(8, 30, 55, .86) 56%, rgba(12, 48, 78, .78)),
    radial-gradient(circle at 18% 0%, rgba(40, 199, 232, .14), transparent 34%);
  border-color: rgba(56, 189, 248, .34);
}

html[data-theme="dark"] .card input,
html[data-theme="dark"] .card select,
html[data-theme="dark"] .card textarea,
html[data-theme="dark"] .accordion input,
html[data-theme="dark"] .accordion select,
html[data-theme="dark"] .accordion textarea {
  background: rgba(15, 23, 42, .84);
  border-color: rgba(71, 117, 154, .58);
  color: #e5edf7;
}

@media (max-width: 980px) {
  .card,
  .accordion,
  .kpi,
  .notice {
    box-shadow: 0 12px 28px rgba(3, 10, 22, .16);
  }
}

@media print {
  .card,
  .accordion,
  .kpi,
  .notice,
  .table-wrap,
  .invoice-total-box,
  td,
  th {
    background: #fff !important;
    color: #111827 !important;
    box-shadow: none !important;
  }
}

/* ONISMA dark-mode HUD corrections */
@media (min-width: 981px) {
  .app-shell { align-items: stretch; }
  .app-shell > .sidebar {
    align-self: stretch;
    height: 100vh;
    min-height: 100vh;
    overflow-y: auto;
    position: sticky;
    top: 0;
  }
}

.topbar {
  overflow: visible;
  position: relative;
  z-index: 500;
}

.top-actions,
.user-menu {
  position: relative;
  z-index: 510;
}

.user-menu-panel {
  z-index: 5000;
}

html:not([data-theme="dark"]) .card,
html:not([data-theme="dark"]) .accordion,
html:not([data-theme="dark"]) .kpi,
html:not([data-theme="dark"]) .notice,
html:not([data-theme="dark"]) .invoice-total-box,
html:not([data-theme="dark"]) .detail-grid div,
html:not([data-theme="dark"]) .credential-grid div {
  background: rgba(255, 255, 255, .92);
  border-color: var(--onis-line);
  box-shadow: var(--onis-shadow-soft);
  color: var(--onis-ink);
}

html:not([data-theme="dark"]) .card h2,
html:not([data-theme="dark"]) .card h3,
html:not([data-theme="dark"]) .accordion summary,
html:not([data-theme="dark"]) .notice strong {
  color: var(--onis-ink);
}

html:not([data-theme="dark"]) .card p,
html:not([data-theme="dark"]) .card small,
html:not([data-theme="dark"]) .accordion p,
html:not([data-theme="dark"]) .notice span,
html:not([data-theme="dark"]) .detail-grid span,
html:not([data-theme="dark"]) .credential-grid span,
html:not([data-theme="dark"]) .credential-grid small,
html:not([data-theme="dark"]) .kpi small,
html:not([data-theme="dark"]) .report-head span,
html:not([data-theme="dark"]) .report-kpis small,
html:not([data-theme="dark"]) .dashboard-summary small,
html:not([data-theme="dark"]) td small {
  color: var(--onis-muted);
}

html:not([data-theme="dark"]) .card label,
html:not([data-theme="dark"]) .accordion label,
html:not([data-theme="dark"]) .notice label {
  color: #25364b;
  font-weight: 600;
}

html:not([data-theme="dark"]) .card input,
html:not([data-theme="dark"]) .card select,
html:not([data-theme="dark"]) .card textarea,
html:not([data-theme="dark"]) .accordion input,
html:not([data-theme="dark"]) .accordion select,
html:not([data-theme="dark"]) .accordion textarea,
html:not([data-theme="dark"]) .notice input,
html:not([data-theme="dark"]) .notice select,
html:not([data-theme="dark"]) .notice textarea {
  background: rgba(255, 255, 255, .94);
  border-color: rgba(148, 184, 212, .56);
  color: var(--onis-ink);
}

html:not([data-theme="dark"]) .kpi {
  background: linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(236, 248, 255, .90));
  min-height: auto;
  overflow: visible;
}

html:not([data-theme="dark"]) .kpi span {
  color: #526276;
}

html:not([data-theme="dark"]) .kpi strong {
  color: #0b2f55;
  font-size: 26px;
}

html:not([data-theme="dark"]) .kpi .kpi-icon,
html:not([data-theme="dark"]) .card-title-icon,
html:not([data-theme="dark"]) .card h2 .app-icon,
html:not([data-theme="dark"]) .modal-head h2 .app-icon,
html:not([data-theme="dark"]) .accordion summary .app-icon {
  background: rgba(14, 165, 233, .10);
  border-color: rgba(14, 165, 233, .22);
  box-shadow: none;
  color: #0f76a8;
}

html:not([data-theme="dark"]) .table-wrap {
  background: rgba(255, 255, 255, .86);
  border-color: var(--onis-line);
}

html:not([data-theme="dark"]) .card .table-wrap,
html:not([data-theme="dark"]) .accordion .table-wrap {
  background: rgba(255, 255, 255, .86);
}

html:not([data-theme="dark"]) td,
html:not([data-theme="dark"]) .professional-table td {
  background: rgba(255, 255, 255, .72);
  color: var(--onis-ink);
}

html:not([data-theme="dark"]) tbody tr:nth-child(even) td,
html:not([data-theme="dark"]) .professional-table tbody tr:nth-child(even) {
  background: rgba(239, 248, 255, .66);
}

html:not([data-theme="dark"]) tbody tr:hover td,
html:not([data-theme="dark"]) .professional-table tbody tr:hover {
  background: rgba(219, 242, 255, .86);
}

html:not([data-theme="dark"]) td strong,
html:not([data-theme="dark"]) .detail-grid strong,
html:not([data-theme="dark"]) .credential-grid strong,
html:not([data-theme="dark"]) .invoice-total-box strong {
  color: var(--onis-ink);
}

html:not([data-theme="dark"]) .badge.neutral {
  background: rgba(226, 235, 245, .86);
  color: #475467;
}

html:not([data-theme="dark"]) .card .btn.ghost,
html:not([data-theme="dark"]) .accordion .btn.ghost,
html:not([data-theme="dark"]) .notice .btn.ghost {
  background: rgba(255, 255, 255, .82);
  border-color: var(--onis-line);
  color: var(--onis-ink);
}

html:not([data-theme="dark"]) .card .btn.secondary,
html:not([data-theme="dark"]) .accordion .btn.secondary,
html:not([data-theme="dark"]) .notice .btn.secondary {
  background: rgba(219, 234, 254, .88);
  color: #1d4ed8;
}

html:not([data-theme="dark"]) .select2-lite-option {
  background: #fff;
  color: var(--onis-ink);
}

html:not([data-theme="dark"]) .select2-lite-option:hover,
html:not([data-theme="dark"]) .select2-lite-option.active {
  background: #eff6ff;
  color: var(--brand-dark);
}

html:not([data-theme="dark"]) .select2-lite-option small,
html:not([data-theme="dark"]) .select2-lite-empty {
  color: var(--onis-muted);
}

html[data-theme="dark"] .user-menu-panel {
  background: rgba(7, 23, 43, .98);
  border-color: rgba(56, 189, 248, .38);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .42);
}

/* ONISMA table pagination and product dropdown layering */
.enhanced-table-tools {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin: 0 0 10px;
  position: relative;
  z-index: 20;
}

.enhanced-table-search {
  flex: 1 1 260px;
  max-width: 360px;
  min-height: 38px;
}

.table-pagination {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.table-page-size {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  margin: 0 6px 0 0;
}

.table-page-size span,
.table-page-info {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.table-page-size select {
  min-height: 34px;
  padding: 5px 28px 5px 9px;
  width: auto;
}

.table-page-button {
  align-items: center;
  background: rgba(255, 255, 255, .86);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-weight: 750;
  height: 34px;
  justify-content: center;
  min-width: 34px;
  padding: 0 10px;
}

.table-page-button:hover:not(:disabled) {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, .24);
  color: var(--brand-dark);
}

.table-page-button:disabled {
  cursor: not-allowed;
  opacity: .42;
}

.select2-lite-list {
  z-index: 7000 !important;
}

.select2-lite.open,
.select2-lite:focus-within {
  z-index: 7001;
}

html[data-theme="dark"] .table-page-size span,
html[data-theme="dark"] .table-page-info {
  color: #b7cce0;
}

html[data-theme="dark"] .table-page-button {
  background: rgba(7, 23, 43, .92);
  border-color: rgba(56, 189, 248, .32);
  color: #eaf6ff;
}

html[data-theme="dark"] .table-page-button:hover:not(:disabled) {
  background: rgba(40, 199, 232, .16);
  color: #fff;
}

html[data-theme="dark"] .select2-lite-list {
  background: rgba(7, 23, 43, .98);
  border-color: rgba(56, 189, 248, .38);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .46);
}

@media (max-width: 640px) {
  .enhanced-table-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .enhanced-table-search {
    max-width: none;
    width: 100%;
  }

  .table-pagination {
    justify-content: space-between;
  }
}

/* ONISMA visual stabilization */
html:not([data-theme="dark"]) .app-shell {
  background: #edf4fb;
}

html:not([data-theme="dark"]) .app-shell::before {
  display: none;
}

html:not([data-theme="dark"]) .main {
  background: linear-gradient(180deg, #edf4fb 0%, #f6f9fc 46%, #eef5fb 100%);
}

html:not([data-theme="dark"]) .topbar,
html:not([data-theme="dark"]) .card,
html:not([data-theme="dark"]) .accordion,
html:not([data-theme="dark"]) .kpi,
html:not([data-theme="dark"]) .notice,
html:not([data-theme="dark"]) .modal,
html:not([data-theme="dark"]) .table-wrap,
html:not([data-theme="dark"]) .invoice-total-box,
html:not([data-theme="dark"]) .user-menu-panel {
  background: #fff;
  border-color: #d8e5ef;
  box-shadow: 0 12px 30px rgba(15, 35, 55, .08);
  color: #142033;
}

html:not([data-theme="dark"]) .card::before,
html:not([data-theme="dark"]) .accordion::before,
html:not([data-theme="dark"]) .hero-card::before {
  background: linear-gradient(90deg, #0f766e, #2563eb);
  box-shadow: none;
  height: 3px;
}

.chat-shell::before {
  display: none !important;
}

html:not([data-theme="dark"]) .chat-shell {
  background: #fff;
  grid-template-rows: auto minmax(360px, calc(100vh - 360px)) auto;
}

html:not([data-theme="dark"]) .chat-head {
  background: #fff;
  border-bottom-color: #d8e5ef;
}

html:not([data-theme="dark"]) .chat-thread {
  background: linear-gradient(180deg, #f8fbfe 0%, #eef5fb 100%);
}

html:not([data-theme="dark"]) .chat-bubble.from-mine {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #fff;
}

html:not([data-theme="dark"]) .chat-bubble.from-other {
  background: #fff;
  border-color: #d8e5ef;
  color: #142033;
}

html:not([data-theme="dark"]) .chat-composer {
  background: #fff;
  border-top-color: #d8e5ef;
}

html:not([data-theme="dark"]) th,
html:not([data-theme="dark"]) .professional-table th {
  background: #f2f7fb;
  color: #35465b;
}

html:not([data-theme="dark"]) td,
html:not([data-theme="dark"]) .professional-table td {
  background: #fff;
  color: #142033;
}

html:not([data-theme="dark"]) tbody tr:nth-child(even) td,
html:not([data-theme="dark"]) .professional-table tbody tr:nth-child(even) {
  background: #f8fbfe;
}

html:not([data-theme="dark"]) tbody tr:hover td,
html:not([data-theme="dark"]) .professional-table tbody tr:hover {
  background: #eef6ff;
}

html:not([data-theme="dark"]) .topbar h1 {
  background: none;
  color: #142033;
  -webkit-background-clip: initial;
  background-clip: initial;
}

html:not([data-theme="dark"]) .kpi {
  border-left: 4px solid var(--brand);
}

html:not([data-theme="dark"]) .kpi::before {
  display: none;
}

html:not([data-theme="dark"]) .kpi strong,
html:not([data-theme="dark"]) td strong,
html:not([data-theme="dark"]) .invoice-total-box strong {
  color: #142033;
}

html:not([data-theme="dark"]) .kpi span,
html:not([data-theme="dark"]) .topbar p,
html:not([data-theme="dark"]) .muted,
html:not([data-theme="dark"]) td small,
html:not([data-theme="dark"]) .chat-head p {
  color: #5d6e83;
}

html:not([data-theme="dark"]) .card label,
html:not([data-theme="dark"]) .accordion label,
html:not([data-theme="dark"]) label {
  color: #344154;
}

html:not([data-theme="dark"]) input,
html:not([data-theme="dark"]) select,
html:not([data-theme="dark"]) textarea {
  background: #fff;
  border-color: #d4e1ec;
  color: #142033;
}

html[data-theme="dark"] .main {
  background: linear-gradient(180deg, #071426 0%, #0b1b31 52%, #081827 100%);
}

html[data-theme="dark"] .topbar {
  background: rgba(7, 23, 43, .94);
  border-color: rgba(56, 189, 248, .24);
  color: #eaf6ff;
}

html[data-theme="dark"] .chat-shell {
  background:
    linear-gradient(135deg, rgba(7, 23, 43, .95), rgba(13, 48, 82, .84));
  grid-template-rows: auto minmax(360px, calc(100vh - 360px)) auto;
}

html[data-theme="dark"] .chat-head {
  background: rgba(7, 23, 43, .88);
  border-bottom-color: rgba(56, 189, 248, .28);
}

html[data-theme="dark"] .chat-head p {
  color: #a9bfd5;
}

html[data-theme="dark"] .chat-thread {
  background: rgba(3, 13, 25, .38);
}

html[data-theme="dark"] .chat-bubble.from-mine {
  background: #2563eb;
  border-color: #3b82f6;
  color: #fff;
}

html[data-theme="dark"] .chat-bubble.from-other {
  background: rgba(15, 36, 61, .96);
  border-color: rgba(56, 189, 248, .24);
  color: #eaf6ff;
}

html[data-theme="dark"] .chat-composer {
  background: rgba(7, 23, 43, .94);
  border-top-color: rgba(56, 189, 248, .26);
}

html[data-theme="dark"] th,
html[data-theme="dark"] .professional-table th {
  background: rgba(5, 18, 34, .98);
  color: #dff6ff;
}

html[data-theme="dark"] td,
html[data-theme="dark"] .professional-table td {
  color: #eaf6ff;
}

html[data-theme="dark"] .table-wrap {
  background: rgba(3, 13, 25, .46);
}

html[data-theme="dark"] .card-title-icon,
html[data-theme="dark"] .card h2 .app-icon,
html[data-theme="dark"] .modal-head h2 .app-icon,
html[data-theme="dark"] .accordion summary .app-icon {
  background: rgba(40, 199, 232, .12);
  border-color: rgba(56, 189, 248, .32);
  color: #38d9ff;
}

/* ONISMA dropdown and text contrast corrections */
.select2-lite-list {
  display: none;
  gap: 4px;
  max-height: min(360px, calc(100vh - 96px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  position: fixed;
  z-index: 20000 !important;
}

.select2-lite-list.is-open {
  display: grid;
}

.sale-lines td,
.sale-lines th {
  overflow: visible;
}

form[data-sale-form] > .table-wrap {
  overflow-x: auto;
  overflow-y: visible;
}

html:not([data-theme="dark"]) .select2-lite-list {
  background: #fff;
  border-color: #cddceb;
  box-shadow: 0 24px 60px rgba(15, 35, 55, .18);
}

html:not([data-theme="dark"]) .select2-lite-option strong {
  color: #142033;
}

html:not([data-theme="dark"]) .select2-lite-option small,
html:not([data-theme="dark"]) .select2-lite-empty {
  color: #526276;
}

html[data-theme="dark"] .chat-shell {
  color: #eaf6ff;
}

html[data-theme="dark"] .chat-head h2 {
  color: #f8fbff;
}

html[data-theme="dark"] .chat-head p,
html[data-theme="dark"] .chat-empty {
  color: #b7cce0;
}

html[data-theme="dark"] .chat-bubble,
html[data-theme="dark"] .chat-bubble strong,
html[data-theme="dark"] .chat-bubble p,
html[data-theme="dark"] .chat-bubble small {
  color: #eaf6ff;
}

html[data-theme="dark"] .chat-bubble.from-mine,
html[data-theme="dark"] .chat-bubble.from-mine strong,
html[data-theme="dark"] .chat-bubble.from-mine p,
html[data-theme="dark"] .chat-bubble.from-mine small {
  color: #fff;
}

html[data-theme="dark"] .chat-bubble.from-mine {
  background: linear-gradient(135deg, #0f766e, #2563eb);
  border-color: rgba(125, 211, 252, .42);
}

html[data-theme="dark"] .chat-bubble.from-other {
  background: rgba(9, 31, 55, .96);
  border-color: rgba(56, 189, 248, .30);
}

html[data-theme="dark"] .chat-avatar {
  background: rgba(125, 211, 252, .13);
  border-color: rgba(56, 189, 248, .30);
  color: #dff6ff;
}

html[data-theme="dark"] label,
html[data-theme="dark"] .card label,
html[data-theme="dark"] .accordion label,
html[data-theme="dark"] .notice label {
  color: #d7e8f7;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .card input,
html[data-theme="dark"] .card select,
html[data-theme="dark"] .card textarea,
html[data-theme="dark"] .accordion input,
html[data-theme="dark"] .accordion select,
html[data-theme="dark"] .accordion textarea {
  color: #f4fbff;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #9fb4ca;
  opacity: 1;
}

html[data-theme="dark"] .select2-lite-list {
  background: rgba(5, 18, 34, .98);
  border-color: rgba(56, 189, 248, .42);
  box-shadow: 0 28px 70px rgba(0, 0, 0, .48);
}

html[data-theme="dark"] .select2-lite-option {
  background: rgba(9, 31, 55, .98);
  color: #eaf6ff;
}

html[data-theme="dark"] .select2-lite-option strong {
  color: #f8fbff;
}

html[data-theme="dark"] .select2-lite-option small,
html[data-theme="dark"] .select2-lite-empty {
  color: #b7cce0;
}

html[data-theme="dark"] .select2-lite-option:hover,
html[data-theme="dark"] .select2-lite-option.active {
  background: rgba(40, 199, 232, .18);
  color: #fff;
}

/* ONISMA real chat experience */
.chat-shell.card {
  display: flex !important;
  flex-direction: column;
  height: min(760px, calc(100vh - 112px));
  min-height: 560px;
  overflow: hidden !important;
  padding: 0 !important;
}

.chat-shell::before {
  display: none !important;
}

.chat-head {
  align-items: center;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid #d8e5ef;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .9);
  flex: 0 0 auto;
  padding: 14px 18px;
}

.chat-head h2 {
  color: #102033;
  font-size: 20px;
  font-weight: 720;
  letter-spacing: 0;
  margin: 0;
}

.chat-head p {
  color: #60728a !important;
  font-size: 13px;
  margin: 3px 0 0;
}

.chat-thread {
  align-content: initial !important;
  background:
    radial-gradient(circle at 14px 14px, rgba(37, 99, 235, .055) 1px, transparent 1.5px),
    linear-gradient(180deg, #f5f9fd 0%, #eef5fb 100%) !important;
  background-size: 28px 28px, auto;
  display: flex !important;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 22px clamp(14px, 2.2vw, 30px);
  scroll-behavior: smooth;
}

.chat-date-separator {
  align-self: center;
  margin: 4px 0 8px;
}

.chat-date-separator span {
  background: rgba(255, 255, 255, .86);
  border: 1px solid #d8e5ef;
  border-radius: 999px;
  color: #60728a;
  display: inline-flex;
  font-size: 11px;
  font-weight: 650;
  padding: 5px 10px;
}

.chat-row {
  align-items: flex-end;
  display: flex;
  gap: 8px;
  max-width: min(68%, 620px);
  width: fit-content;
}

.chat-row.mine {
  flex-direction: row-reverse;
  justify-self: auto;
  margin-left: auto;
}

.chat-row.other {
  justify-self: auto;
  margin-right: auto;
}

.chat-row.mine .chat-avatar {
  display: none;
}

.chat-avatar {
  background: #dbeafe;
  border: 1px solid #c7d7eb;
  border-radius: 999px;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
  height: 32px;
  width: 32px;
}

.chat-bubble {
  border: 1px solid transparent;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(15, 35, 55, .10);
  max-width: 100% !important;
  overflow-wrap: anywhere;
  padding: 9px 12px 7px;
  position: relative;
  word-break: normal;
}

.chat-row.mine .chat-bubble {
  border-bottom-right-radius: 6px;
}

.chat-row.other .chat-bubble {
  border-bottom-left-radius: 6px;
}

.chat-bubble.from-mine {
  background: linear-gradient(135deg, #0f766e, #2563eb) !important;
  border-color: rgba(37, 99, 235, .18) !important;
  color: #fff !important;
}

.chat-bubble.from-other {
  background: #fff !important;
  border-color: #d8e5ef !important;
  color: #172033 !important;
}

.chat-bubble strong,
.chat-bubble p,
.chat-bubble small {
  color: inherit !important;
}

.chat-bubble strong {
  display: block;
  font-size: 12px;
  font-weight: 720;
  line-height: 1.2;
  margin: 0 0 4px;
}

.chat-bubble p {
  font-size: 14px;
  line-height: 1.48;
  margin: 0;
}

.chat-bubble small {
  display: block;
  font-size: 10.5px;
  line-height: 1;
  margin-top: 6px;
  opacity: .72;
  text-align: right;
}

.chat-bubble.from-mine small {
  opacity: .78;
}

.chat-empty {
  align-self: center;
  color: #60728a;
  margin: auto 0;
}

.chat-empty strong {
  color: #172033;
}

.chat-composer {
  align-items: end;
  background: rgba(255, 255, 255, .98) !important;
  border-top: 1px solid #d8e5ef !important;
  display: grid;
  flex: 0 0 auto;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px 14px;
}

.chat-input-wrap {
  min-width: 0;
}

.chat-composer textarea {
  background: #f8fbfe !important;
  border: 1px solid #cddceb !important;
  border-radius: 16px;
  color: #172033 !important;
  line-height: 1.35;
  max-height: 120px;
  min-height: 44px;
  padding: 11px 13px;
  resize: none;
}

.chat-composer textarea::placeholder {
  color: #7a8aa0;
  opacity: 1;
}

.chat-send-btn {
  align-items: center;
  background: linear-gradient(135deg, #0f766e, #2563eb);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 12px 24px rgba(37, 99, 235, .24);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  height: 44px;
  justify-content: center;
  padding: 0;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
  width: 44px;
}

.chat-send-btn svg {
  height: 20px;
  width: 20px;
}

.chat-send-btn span {
  clip: rect(0 0 0 0);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.chat-send-btn:hover:not(:disabled) {
  box-shadow: 0 16px 30px rgba(37, 99, 235, .28);
  transform: translateY(-1px);
}

.chat-send-btn:disabled {
  cursor: not-allowed;
  opacity: .48;
}

html[data-theme="dark"] .chat-shell.card {
  background:
    linear-gradient(135deg, rgba(3, 10, 22, .96), rgba(8, 30, 55, .88)),
    radial-gradient(circle at 14% 0%, rgba(40, 199, 232, .16), transparent 34%);
  border-color: rgba(56, 189, 248, .34);
}

html[data-theme="dark"] .chat-head {
  background: rgba(7, 23, 43, .94);
  border-bottom-color: rgba(56, 189, 248, .28);
}

html[data-theme="dark"] .chat-head h2 {
  color: #f8fbff;
}

html[data-theme="dark"] .chat-head p {
  color: #b7cce0 !important;
}

html[data-theme="dark"] .chat-thread {
  background:
    radial-gradient(circle at 14px 14px, rgba(125, 211, 252, .08) 1px, transparent 1.5px),
    linear-gradient(180deg, rgba(3, 13, 25, .60), rgba(8, 30, 55, .50)) !important;
  background-size: 28px 28px, auto;
}

html[data-theme="dark"] .chat-date-separator span {
  background: rgba(7, 23, 43, .92);
  border-color: rgba(56, 189, 248, .28);
  color: #b7cce0;
}

html[data-theme="dark"] .chat-avatar {
  background: rgba(125, 211, 252, .13);
  border-color: rgba(56, 189, 248, .30);
  color: #dff6ff;
}

html[data-theme="dark"] .chat-bubble.from-mine {
  background: linear-gradient(135deg, #0f766e, #2563eb) !important;
  border-color: rgba(125, 211, 252, .38) !important;
  color: #fff !important;
}

html[data-theme="dark"] .chat-bubble.from-other {
  background: rgba(9, 31, 55, .98) !important;
  border-color: rgba(56, 189, 248, .28) !important;
  color: #eaf6ff !important;
}

html[data-theme="dark"] .chat-empty,
html[data-theme="dark"] .chat-empty strong {
  color: #d7e8f7;
}

html[data-theme="dark"] .chat-composer {
  background: rgba(7, 23, 43, .96) !important;
  border-top-color: rgba(56, 189, 248, .28) !important;
}

html[data-theme="dark"] .chat-composer textarea {
  background: rgba(15, 23, 42, .92) !important;
  border-color: rgba(71, 117, 154, .58) !important;
  color: #f4fbff !important;
}

html[data-theme="dark"] .chat-composer textarea::placeholder {
  color: #9fb4ca;
}

@media (max-width: 760px) {
  .chat-shell.card {
    height: calc(100dvh - 98px);
    min-height: 480px;
  }

  .chat-head {
    align-items: stretch;
    flex-direction: column;
  }

  .chat-row {
    max-width: 86%;
  }

  .chat-thread {
    padding: 16px 12px;
  }

  .chat-composer {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

/* ONISMA super admin accordions */
.super-admin-accordion-stack {
  display: grid;
  gap: 16px;
}

.super-admin-accordion {
  margin-bottom: 0;
}

.super-admin-accordion summary {
  align-items: center;
  min-height: 62px;
}

.super-admin-accordion summary .accordion-title-text {
  flex: 1 1 auto;
  min-width: 0;
}

.accordion-summary-meta {
  align-items: center;
  background: rgba(219, 234, 254, .78);
  border: 1px solid rgba(37, 99, 235, .14);
  border-radius: 999px;
  color: #1d4ed8;
  display: inline-flex;
  flex: 0 0 auto !important;
  font-size: 12px;
  font-weight: 720;
  line-height: 1;
  margin-left: auto;
  padding: 7px 10px;
  white-space: nowrap;
}

.tenant-subscription-form {
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  min-width: 520px;
}

.tenant-subscription-form .btn {
  width: 100%;
}

.tenant-actions {
  align-items: stretch;
  display: grid;
  gap: 8px;
  min-width: 170px;
}

.tenant-actions form {
  margin: 0;
}

.tenant-actions .btn {
  width: 100%;
}

html[data-theme="dark"] .accordion-summary-meta {
  background: rgba(56, 189, 248, .16);
  border-color: rgba(56, 189, 248, .30);
  color: #dff6ff;
}

@media (max-width: 760px) {
  .super-admin-accordion summary {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .accordion-summary-meta {
    margin-left: 42px;
  }

  .tenant-subscription-form {
    grid-template-columns: 1fr;
    min-width: 260px;
  }
}

/* ONISMA mobile optimization pass */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

@media (max-width: 980px) {
  body {
    min-width: 0;
  }

  .app-shell {
    display: block !important;
    min-height: 100dvh;
    width: 100%;
  }

  .main {
    min-width: 0;
    padding: 12px;
    width: 100%;
  }

  .sidebar {
    border-radius: 0 16px 16px 0;
    height: 100dvh !important;
    max-width: 318px;
    padding: 16px 14px 20px;
    width: min(84vw, 318px);
    z-index: 3000;
  }

  .mobile-sidebar-backdrop {
    z-index: 2990;
  }

  .brand {
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 14px;
  }

  .brand-logo {
    border-radius: 10px;
    height: 44px;
    width: 44px;
  }

  .brand strong {
    font-size: 15px;
  }

  .brand small {
    font-size: 11px;
  }

  .nav {
    gap: 4px;
  }

  .nav a,
  .nav-parent {
    border-radius: 8px;
    min-height: 40px;
    padding: 10px 11px;
  }

  .nav-sub {
    margin-left: 12px;
    padding-left: 9px;
  }

  .topbar {
    align-items: center !important;
    border-radius: 10px;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px;
    position: sticky;
    top: 8px;
    z-index: 1100;
  }

  .topbar-title {
    flex: 1 1 auto;
    gap: 9px;
    min-width: 0;
  }

  .mobile-menu-toggle,
  .icon-btn,
  .user-menu-toggle {
    min-height: 38px;
  }

  .mobile-menu-toggle {
    border-radius: 9px;
    height: 38px;
    width: 38px;
  }

  .topbar-title h1 {
    font-size: 18px !important;
    line-height: 1.18;
    max-width: none !important;
    white-space: normal;
  }

  .topbar-title p {
    font-size: 12px;
    max-width: none !important;
  }

  .top-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .top-actions .filter-inline {
    display: none !important;
  }

  .user-menu-panel {
    max-width: calc(100vw - 24px);
    min-width: min(260px, calc(100vw - 24px));
    position: fixed;
    right: 12px;
    top: 66px;
    z-index: 5000;
  }

  .grid.two,
  .grid.three,
  .grid.four,
  .grid.auto,
  .form-grid,
  .credential-grid,
  .payment-grid,
  .module-grid,
  .invoice-options,
  .detail-grid {
    grid-template-columns: 1fr !important;
  }

  .card,
  .accordion,
  .notice,
  .kpi {
    border-radius: 10px;
  }

  .card,
  .accordion-body,
  .notice {
    padding: 14px;
  }

  .accordion summary {
    gap: 9px;
    min-height: 54px;
    padding: 14px;
  }

  .accordion summary::after {
    margin-left: auto;
  }

  .accordion-summary-meta {
    font-size: 11px;
    margin-left: 42px;
    max-width: calc(100% - 42px);
    overflow: hidden;
    text-overflow: ellipsis;
  }

  label,
  .inline-edit {
    min-width: 0 !important;
  }

  input,
  select,
  textarea {
    font-size: 16px;
    max-width: 100%;
  }

  .form-actions,
  .toolbar,
  .toolbar form,
  .top-sales-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .btn,
  .form-actions .btn,
  .toolbar .btn {
    width: 100%;
  }

  .kpi {
    min-height: 94px;
    padding: 14px;
  }

  .kpi strong {
    font-size: 24px !important;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .kpi .kpi-icon {
    height: 40px;
    width: 40px;
  }

  .table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap table:not(.sale-lines) {
    min-width: 680px;
  }

  th,
  td {
    padding: 10px;
  }

  .enhanced-table-tools {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .enhanced-table-search {
    max-width: none;
    width: 100%;
  }

  .table-pagination {
    justify-content: space-between;
    width: 100%;
  }

  .table-page-info {
    flex: 1 1 100%;
    order: -1;
  }

  .select2-lite-list {
    max-height: min(320px, calc(100dvh - 110px));
    max-width: calc(100vw - 24px);
  }

  .modal {
    max-height: calc(100dvh - 24px);
    max-width: calc(100vw - 24px);
    overflow: auto;
  }
}

@media (max-width: 700px) {
  form[data-sale-form] > .table-wrap {
    border: 0;
    background: transparent !important;
    box-shadow: none;
    overflow: visible;
  }

  .sale-lines,
  .sale-lines tbody,
  .sale-lines tr,
  .sale-lines td {
    display: block;
    width: 100%;
  }

  .sale-lines {
    min-width: 0 !important;
  }

  .sale-lines thead {
    display: none;
  }

  .sale-lines tr {
    background: rgba(255, 255, 255, .88);
    border: 1px solid #d8e5ef;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(15, 35, 55, .08);
    margin-bottom: 10px;
    padding: 10px;
  }

  .sale-lines td {
    border: 0;
    padding: 7px 0;
  }

  .sale-lines td::before {
    color: #5d6e83;
    display: block;
    font-size: 11px;
    font-weight: 750;
    margin-bottom: 5px;
    text-transform: uppercase;
  }

  .sale-lines td:nth-child(1)::before { content: "Produit"; }
  .sale-lines td:nth-child(2)::before { content: "Quantite"; }
  .sale-lines td:nth-child(3)::before { content: "Prix"; }
  .sale-lines td:nth-child(4)::before { content: "Total"; }

  .sale-lines td:first-child {
    min-width: 0;
  }

  .sale-lines input,
  .sale-lines select,
  .sale-lines .select2-lite {
    min-width: 0;
    width: 100%;
  }

  .sale-lines td:last-child {
    align-items: center;
    display: flex;
    justify-content: flex-end;
    padding-top: 2px;
  }

  .sale-remove-line {
    height: 40px;
    width: 40px;
  }

  .invoice-total-box {
    max-width: none;
    width: 100%;
  }

  html[data-theme="dark"] .sale-lines tr {
    background: rgba(8, 30, 55, .82);
    border-color: rgba(56, 189, 248, .28);
  }

  html[data-theme="dark"] .sale-lines td::before {
    color: #b7cce0;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 10px;
  }

  .topbar {
    top: 6px;
  }

  .topbar-title h1 {
    font-size: 17px !important;
  }

  .avatar.circle {
    height: 32px;
    width: 32px;
  }

  .card,
  .accordion-body,
  .notice {
    padding: 12px;
  }

  .card h2,
  .card h3 {
    font-size: 18px;
    line-height: 1.25;
  }

  .chat-shell.card {
    height: calc(100dvh - 92px) !important;
    min-height: 420px;
  }

  .chat-head {
    padding: 12px;
  }

  .chat-thread {
    padding: 14px 10px !important;
  }

  .chat-row {
    max-width: 92% !important;
  }

  .chat-bubble {
    padding: 8px 10px 7px;
  }

  .chat-bubble p {
    font-size: 13px;
  }

  .chat-composer {
    padding: 10px;
  }

  .auth-modern {
    padding: 14px;
  }
}

@media (max-width: 420px) {
  .sidebar {
    width: min(88vw, 306px);
  }

  .topbar {
    gap: 6px;
    padding: 8px;
  }

  .mobile-menu-toggle {
    height: 36px;
    width: 36px;
  }

  .topbar-title {
    gap: 7px;
  }

  .topbar-title h1 {
    font-size: 16px !important;
  }

  .topbar-title p {
    display: none;
  }

  .top-actions {
    gap: 4px;
  }

  .icon-btn {
    height: 36px;
    width: 36px;
  }

  .user-menu-toggle {
    min-height: 36px;
    padding: 2px 6px 2px 2px;
  }

  .accordion-summary-meta {
    display: none;
  }
}

/* ONISMA mobile polish */
@media (max-width: 980px) {
  .card::before,
  .hero-card::before {
    margin: -14px -14px 12px;
  }

  .accordion::before {
    margin: 0;
  }

  .platform-brand-card .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .platform-brand-preview {
    justify-content: flex-start;
    min-width: 0;
    width: 100%;
  }

  .history-actions,
  .action-stack,
  .tenant-actions {
    white-space: normal;
  }
}

@media (max-width: 640px) {
  .card::before,
  .hero-card::before {
    margin: -12px -12px 12px;
  }
}

/* ONISMA modern KPI cards */
body {
  font-family: "Segoe UI Variable", Inter, "Segoe UI", Aptos, Arial, sans-serif;
  font-weight: 400;
}

.kpi {
  align-items: stretch;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .98), rgba(244, 249, 252, .94)) !important;
  border: 1px solid #d8e5ef !important;
  border-left: 4px solid #0f766e !important;
  border-radius: 8px !important;
  box-shadow: 0 14px 34px rgba(15, 35, 55, .08) !important;
  color: #142033 !important;
  display: grid !important;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 92px;
  overflow: hidden;
  padding: 16px 18px !important;
  position: relative;
}

.kpi::before {
  display: none !important;
}

.kpi > div {
  min-width: 0;
}

.kpi span:not(.kpi-icon) {
  color: #5b6b81 !important;
  display: block;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1.25;
  margin: 0;
  text-transform: uppercase;
}

.kpi strong {
  color: #172033 !important;
  display: block;
  font-size: clamp(23px, 2.2vw, 30px) !important;
  font-weight: 720 !important;
  line-height: 1.14;
  margin: 6px 0 0 !important;
}

.kpi small {
  color: #60728a !important;
  display: block;
  font-size: 12px !important;
  font-weight: 500;
  line-height: 1.35;
  margin-top: 6px;
}

.kpi .kpi-icon {
  align-self: start;
  background: rgba(15, 118, 110, .10) !important;
  border: 1px solid rgba(15, 118, 110, .18) !important;
  border-radius: 8px !important;
  color: #0f766e !important;
  height: 42px;
  width: 42px;
}

.report-kpis {
  align-items: stretch;
  gap: 16px;
}

.report-kpis .kpi {
  min-height: 90px;
}

.report-kpis .kpi strong {
  font-size: clamp(22px, 2vw, 28px) !important;
  letter-spacing: 0;
  max-width: 100%;
  white-space: nowrap;
}

.report-kpis .kpi small {
  max-width: 100%;
  white-space: normal;
}

.report-kpis .kpi:nth-child(1) { border-left-color: #0f766e !important; }
.report-kpis .kpi:nth-child(2) { border-left-color: #0f76a8 !important; }
.report-kpis .kpi:nth-child(3) { border-left-color: #2563eb !important; }
.report-kpis .kpi:nth-child(4) { border-left-color: #7c3aed !important; }

html[data-theme="dark"] .kpi {
  background:
    linear-gradient(135deg, rgba(7, 23, 43, .95), rgba(13, 48, 82, .86)) !important;
  border-color: rgba(56, 189, 248, .30) !important;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .24) !important;
  color: #eaf6ff !important;
}

html[data-theme="dark"] .kpi span:not(.kpi-icon) {
  color: #b7cce0 !important;
}

html[data-theme="dark"] .kpi strong {
  color: #f8fbff !important;
}

html[data-theme="dark"] .kpi small {
  color: #a9bfd5 !important;
}

html[data-theme="dark"] .kpi .kpi-icon {
  background: rgba(40, 199, 232, .14) !important;
  border-color: rgba(56, 189, 248, .30) !important;
  color: #38d9ff !important;
}

@media (max-width: 1180px) {
  .grid.four.report-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .grid.four.report-kpis {
    grid-template-columns: 1fr !important;
  }

  .kpi {
    min-height: 86px;
    padding: 14px !important;
  }

  .report-kpis .kpi strong,
  .kpi strong {
    font-size: 24px !important;
    white-space: normal;
  }
}

/* ONISMA report KPI stacking */
.report-kpis .kpi {
  align-content: center;
  grid-template-columns: 1fr !important;
  justify-items: start;
}

.report-kpis .kpi span:not(.kpi-icon) {
  max-width: 100%;
}

.report-kpis .kpi strong {
  font-size: clamp(21px, 1.9vw, 27px) !important;
  margin-top: 8px !important;
  overflow-wrap: normal;
  white-space: nowrap;
}

.report-kpis .kpi small {
  margin-top: 4px;
}

@media (max-width: 640px) {
  .report-kpis .kpi strong {
    white-space: normal;
  }
}

/* ONISMA pharmacy management stability v46 */
.settings-accordion-stack,
.site-management,
.site-brand-stack {
  display: grid;
  gap: 16px;
}

.settings-accordion,
.site-management .accordion {
  margin-bottom: 0;
}

.settings-accordion .accordion-body,
.site-management .accordion-body {
  padding: 18px;
}

.settings-permission-panel,
.protected-status-card,
.site-brand-form {
  background: rgba(248, 252, 255, .78);
  border: 1px solid rgba(203, 221, 235, .86);
  border-radius: 12px;
  padding: 14px;
}

.settings-permission-panel,
.site-brand-form {
  display: grid;
  gap: 12px;
}

.settings-permission-panel {
  grid-column: 1 / -1;
}

.protected-status-card {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.protected-status-card small {
  color: var(--muted);
}

.settings-clear-code {
  align-self: end;
}

.site-brand-title {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.site-brand-title small {
  color: var(--muted);
}

.site-edit-modal {
  max-width: min(760px, calc(100vw - 32px));
}

.site-edit-modal .modal-form {
  padding: 18px;
}

.table-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: flex-start;
}

.btn.icon-only {
  align-items: center;
  border-radius: 10px;
  display: inline-flex;
  height: 38px;
  justify-content: center;
  min-width: 0;
  padding: 0;
  width: 38px;
}

.btn.icon-only .app-icon {
  height: 17px;
  width: 17px;
}

.sr-only {
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (min-width: 981px) {
  .app-shell::after {
    background: linear-gradient(180deg, rgba(5, 18, 34, .98), rgba(8, 30, 55, .96));
    bottom: 0;
    content: "";
    left: 0;
    pointer-events: none;
    position: fixed;
    top: 0;
    width: 292px;
    z-index: 0;
  }

  .app-shell > .sidebar {
    background: linear-gradient(180deg, rgba(5, 18, 34, .98), rgba(8, 30, 55, .96)) !important;
    min-height: 100dvh;
    overflow-y: auto;
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .app-shell > .main {
    position: relative;
    z-index: 1;
  }
}

html[data-theme="dark"] .settings-permission-panel,
html[data-theme="dark"] .protected-status-card,
html[data-theme="dark"] .site-brand-form {
  background: rgba(3, 13, 25, .42);
  border-color: rgba(56, 189, 248, .22);
}

html[data-theme="dark"] .app-shell::after,
html[data-theme="dark"] .app-shell > .sidebar {
  background: linear-gradient(180deg, #061223 0%, #0b2037 100%) !important;
}

@media (max-width: 980px) {
  .app-shell::after {
    display: none;
  }

  .sidebar {
    background: linear-gradient(180deg, rgba(5, 18, 34, .98), rgba(8, 30, 55, .96)) !important;
    min-height: 100dvh;
    overflow-y: auto;
  }

  .protected-status-card {
    align-items: flex-start;
    flex-direction: column;
  }
}
/* ONISMA alerts payments profile v47 */
.super-admin-dashboard-stack {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.super-admin-wide-table {
  width: 100%;
}

.profile-grid .profile-password-card {
  grid-column: 1 / -1;
}

.proof-link {
  white-space: nowrap;
}

.form-span {
  grid-column: 1 / -1;
}

@media (max-width: 760px) {
  .profile-grid .profile-password-card,
  .form-span {
    grid-column: auto;
  }
}
/* ONISMA clients subscriptions split v48 */
.client-edit-modal,
.subscription-assign-form {
  max-width: min(920px, calc(100vw - 32px));
}

.subscription-choice-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
}

.subscription-card {
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 12px;
  padding: 18px;
}

.subscription-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.subscription-card strong {
  font-size: 26px;
}

.subscription-status-panel {
  display: grid;
  gap: 16px;
}

html[data-theme="dark"] .subscription-card {
  background: rgba(3, 13, 25, .52);
  border-color: rgba(56, 189, 248, .22);
}

@media (max-width: 980px) {
  .subscription-choice-grid {
    grid-template-columns: 1fr;
  }
}
/* ONISMA reports and sidebar refinement v49 */
@media (min-width: 981px) {
  .app-shell {
    align-items: start;
  }

  .app-shell > .sidebar {
    height: auto !important;
    max-height: none !important;
    min-height: 100vh !important;
    overflow: visible !important;
    position: relative !important;
  }

  .sidebar {
    padding: 18px 20px !important;
  }

  .brand {
    margin-bottom: 14px !important;
    padding-bottom: 14px !important;
  }

  .brand-logo {
    height: 46px !important;
    width: 46px !important;
  }

  .brand strong {
    font-size: 15px !important;
    line-height: 1.2;
  }

  .brand small {
    font-size: 11px !important;
  }

  .nav {
    gap: 2px !important;
  }

  .nav a,
  .nav-parent {
    min-height: 34px !important;
    padding: 7px 10px !important;
  }

  .nav-sub {
    gap: 1px !important;
    margin-bottom: 2px !important;
  }

  .nav-sub a {
    min-height: 30px !important;
    padding: 6px 9px !important;
  }

  .nav-text {
    font-size: 13px;
  }
}

.grid.auto {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.kpi {
  min-height: 84px !important;
  padding: 14px 16px !important;
}

.kpi strong {
  font-size: clamp(18px, 1.35vw, 25px) !important;
  letter-spacing: 0 !important;
  line-height: 1.12 !important;
  max-width: 100%;
  overflow-wrap: normal !important;
  white-space: nowrap !important;
  word-break: normal !important;
}

.kpi small {
  font-size: 11px !important;
  line-height: 1.25 !important;
}

.kpi .kpi-icon {
  height: 38px !important;
  width: 38px !important;
}

.report-kpis .kpi {
  min-height: 82px !important;
}

.report-kpis .kpi strong {
  font-size: clamp(17px, 1.25vw, 23px) !important;
}

.sales-kpis .kpi strong {
  font-size: clamp(18px, 1.4vw, 24px) !important;
}

.professional-table tfoot th,
.professional-table tfoot td {
  background: #eef6ff;
  border-top: 2px solid var(--line);
  color: #142033;
  font-weight: 800;
  white-space: nowrap;
}

.compact-report-table {
  min-width: 560px;
}

.numeric-cell {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

html[data-theme="dark"] .professional-table tfoot th,
html[data-theme="dark"] .professional-table tfoot td {
  background: rgba(14, 43, 70, .98);
  border-top-color: rgba(56, 189, 248, .30);
  color: #f8fbff;
}

@media (max-width: 980px) {
  .grid.auto {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  }
}

@media (max-width: 640px) {
  .kpi strong,
  .report-kpis .kpi strong,
  .sales-kpis .kpi strong {
    font-size: 20px !important;
    white-space: nowrap !important;
  }
}

/* ONISMA client edit modal alignment v50 */
.client-edit-modal {
  border: 1px solid rgba(203, 220, 230, .95);
  border-radius: 14px !important;
  max-height: calc(100dvh - 56px);
  max-width: min(860px, calc(100vw - 48px)) !important;
  overflow: hidden !important;
  width: 100%;
}

.client-edit-modal .modal-head {
  align-items: center;
  background: linear-gradient(180deg, #f8fbfd, #eef6fb);
  display: flex;
  gap: 14px;
  min-height: 66px;
  padding: 16px 20px;
}

.client-edit-modal .modal-head h2 {
  align-items: center;
  color: #172033;
  display: flex;
  flex: 1 1 auto;
  font-size: 18px;
  font-weight: 700;
  gap: 10px;
  line-height: 1.25;
  min-width: 0;
}

.client-edit-modal .modal-head .icon-button {
  flex: 0 0 auto;
  height: 38px;
  width: 38px;
}

.client-edit-modal .modal-form {
  display: grid;
  gap: 15px 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-height: calc(100dvh - 124px);
  overflow-y: auto;
  padding: 18px 20px 20px;
}

.client-edit-modal .modal-form label {
  align-content: start;
  color: #3d4d63;
  font-size: 12px;
  font-weight: 650;
  gap: 7px;
  min-width: 0;
}

.client-edit-modal .modal-form input,
.client-edit-modal .modal-form select,
.client-edit-modal .modal-form textarea {
  border-color: #cddceb;
  min-height: 42px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-edit-modal input[type="color"] {
  padding: 6px;
}

.client-edit-modal input[type="file"] {
  align-items: center;
  display: flex;
  font-size: 12px;
  padding: 8px;
}

.client-edit-modal .form-actions {
  align-items: center;
  background: linear-gradient(180deg, rgba(255,255,255,.90), #fff);
  border-top: 1px solid #dbe6f0;
  bottom: -20px;
  display: flex;
  gap: 10px;
  grid-column: 1 / -1;
  justify-content: flex-end;
  margin: 2px -20px -20px;
  padding: 14px 20px 16px;
  position: sticky;
  z-index: 2;
}

.client-edit-modal .form-actions .btn {
  min-width: 112px;
}

html[data-theme="dark"] .client-edit-modal {
  border-color: rgba(56, 189, 248, .24);
}

html[data-theme="dark"] .client-edit-modal .modal-head {
  background: linear-gradient(180deg, rgba(14, 43, 70, .98), rgba(8, 29, 52, .96));
}

html[data-theme="dark"] .client-edit-modal .modal-head h2,
html[data-theme="dark"] .client-edit-modal .modal-form label {
  color: #eaf6ff;
}

html[data-theme="dark"] .client-edit-modal .form-actions {
  background: linear-gradient(180deg, rgba(15, 35, 56, .94), rgba(9, 24, 42, .98));
  border-top-color: rgba(56, 189, 248, .22);
}

@media (max-width: 900px) {
  .client-edit-modal .modal-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .client-edit-modal {
    max-height: calc(100dvh - 24px);
    max-width: calc(100vw - 24px) !important;
  }

  .client-edit-modal .modal-head {
    padding: 14px 16px;
  }

  .client-edit-modal .modal-form {
    grid-template-columns: 1fr;
    max-height: calc(100dvh - 102px);
    padding: 16px;
  }

  .client-edit-modal .form-actions {
    align-items: stretch;
    flex-direction: column-reverse;
    margin: 2px -16px -16px;
    padding: 12px 16px 14px;
  }

  .client-edit-modal .form-actions .btn {
    width: 100%;
  }
}

/* ONISMA subscription assignment refinement v51 */
.subscription-empty-note {
  margin-bottom: 14px;
}

.subscription-edit-modal {
  border-radius: 14px !important;
  max-width: min(760px, calc(100vw - 48px)) !important;
  overflow: hidden !important;
}

.subscription-edit-modal .modal-form {
  display: grid;
  gap: 15px 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 18px 20px 20px;
}

.subscription-edit-modal .form-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.subscription-assign-form select:disabled,
.subscription-assign-form input:disabled,
.subscription-assign-form button:disabled {
  cursor: not-allowed;
  opacity: .62;
}

@media (max-width: 640px) {
  .subscription-edit-modal {
    max-width: calc(100vw - 24px) !important;
  }

  .subscription-edit-modal .modal-form {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .subscription-edit-modal .form-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }
}

/* ONISMA settings tariffs v52 */
.tariff-form-card {
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  padding-bottom: 16px;
}

.tariff-table-wrap {
  margin-top: 4px;
}

.platform-brand-preview {
  align-items: center;
  display: flex;
  gap: 12px;
}

.platform-brand-preview strong {
  white-space: nowrap;
}

/* ONISMA client details v53 */
.client-detail-modal {
  max-width: min(1080px, calc(100vw - 36px)) !important;
}

.client-detail-modal .client-detail-form {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
  max-height: calc(100dvh - 124px);
  overflow: auto;
  padding: 18px 20px 20px;
}

.client-detail-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.client-detail-section {
  margin: 0;
}

.client-detail-section .accordion-body.form-grid,
.client-detail-section .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.client-sites-grid {
  display: grid;
  gap: 14px;
}

.client-detail-site {
  margin: 0;
}

@media (max-width: 900px) {
  .client-detail-section .accordion-body.form-grid,
  .client-detail-section .form-grid,
  .client-detail-summary {
    grid-template-columns: 1fr;
  }
}
/* ONISMA super dashboard KPI v54 */
.super-dashboard-kpis {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.super-dashboard-kpis .kpi {
  min-height: 104px !important;
}

.super-dashboard-kpis .kpi strong {
  font-size: clamp(20px, 1.75vw, 28px) !important;
  line-height: 1.12;
  max-width: 100%;
  overflow-wrap: anywhere;
}
/* ONISMA upload buttons v55 */
input[type="file"] {
  align-items: center;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  font-size: 13px;
  min-height: 44px;
  padding: 6px;
  width: 100%;
}

input[type="file"]::file-selector-button {
  background: linear-gradient(135deg, var(--brand), #2563eb);
  border: 0;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .16);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  margin-right: 12px;
  min-height: 32px;
  padding: 8px 14px;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

input[type="file"]::file-selector-button:hover {
  box-shadow: 0 12px 22px rgba(37, 99, 235, .22);
  filter: brightness(1.03);
  transform: translateY(-1px);
}

html[data-theme="dark"] input[type="file"] {
  background: rgba(3, 13, 25, .48);
  border-color: rgba(56, 189, 248, .24);
  color: #a9bfd5;
}

html[data-theme="dark"] input[type="file"]::file-selector-button {
  background: linear-gradient(135deg, #0891b2, #2563eb);
  box-shadow: 0 12px 26px rgba(8, 145, 178, .18);
}
/* ONISMA client sales totals v57 */
.client-sales-panel {
  display: grid;
  gap: 14px;
  margin: 0 0 16px;
}
.client-sales-filter {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(170px, .9fr) repeat(4, minmax(135px, 1fr)) auto;
}
.client-sales-filter label {
  min-width: 0;
}
.sales-filter-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}
.client-sales-summary {
  margin: 0;
}
.client-sales-summary .mini-stat {
  background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(239,246,255,.84));
  border-color: rgba(125, 172, 230, .56);
  box-shadow: 0 12px 26px rgba(15, 23, 42, .06);
}
.client-sales-summary .mini-stat strong {
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.client-sales-cell strong,
.client-sales-cell small {
  white-space: nowrap;
}
html[data-theme="dark"] .client-sales-summary .mini-stat {
  background: linear-gradient(135deg, rgba(13, 35, 55, .94), rgba(25, 68, 98, .78));
  border-color: rgba(56, 189, 248, .34);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .24);
}
@media (max-width: 1180px) {
  .client-sales-filter {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .sales-filter-actions {
    align-self: stretch;
  }
}
@media (max-width: 720px) {
  .client-sales-filter,
  .client-sales-summary {
    grid-template-columns: 1fr !important;
  }
  .sales-filter-actions {
    flex-direction: column;
  }
  .sales-filter-actions .btn {
    width: 100%;
  }
}
/* ONISMA super admin chat v58 */
.chat-client-meta {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-top: 2px;
}
.platform-pwa-form .form-span {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  .chat-switcher {
    min-width: 0;
    width: 100%;
  }
}
/* ONISMA brand icon alerts v59 */
.brand-icon-thumb {
  border-radius: 8px;
  margin-left: 8px;
}
.nav a.nav-alert-danger .app-icon {
  color: #ef4444 !important;
  opacity: 1;
}
.nav a.nav-alert-danger .nav-badge {
  background: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .18);
}
.nav a.nav-alert-danger:hover .app-icon,
.nav a.nav-alert-danger.active .app-icon {
  color: #fecaca !important;
}
html[data-theme="dark"] .nav a.nav-alert-danger .app-icon {
  color: #f87171 !important;
}
/* ONISMA top sales full-width v60 */
.card,
.accordion-body {
  min-width: 0;
}
.table-wrap {
  max-width: 100%;
  width: 100%;
}
.table-wrap table {
  width: 100%;
}
.enhanced-table-tools {
  width: 100%;
}
.top-sales-page {
  width: 100%;
}
.top-sales-page h2 {
  margin-bottom: 16px;
}
.top-sales-controls {
  align-items: end;
  display: grid !important;
  gap: 12px;
  grid-template-columns: minmax(190px, 240px) minmax(160px, 190px) auto;
  justify-content: start;
  width: 100%;
}
.top-sales-controls label {
  min-width: 0 !important;
}
.top-sales-presets {
  align-self: end;
}
.top-sales-layout {
  display: grid !important;
  gap: 16px;
  grid-template-columns: 1fr !important;
  width: 100%;
}
.top-sales-chart {
  min-height: 360px;
  overflow: hidden;
  width: 100%;
}
.top-sales-table-wrap {
  width: 100%;
}
.top-sales-table {
  min-width: 980px;
  width: 100%;
}
.top-sales-chart-head {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}
.top-sales-chart-head strong {
  display: block;
  font-size: 15px;
}
.top-sales-chart-head small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 3px;
}
.top-sales-chart-total {
  color: var(--brand-dark);
  font-size: 16px;
  white-space: nowrap;
}
.top-sales-svg {
  display: block;
  height: auto;
  min-height: 300px;
  width: 100%;
}
.top-sales-axis {
  stroke: rgba(100, 116, 139, .35);
  stroke-width: 1;
}
.top-sales-svg-rank,
.top-sales-svg-label,
.top-sales-svg-quantity,
.top-sales-svg-value {
  fill: var(--ink);
  font-family: Aptos, "Segoe UI", Inter, Arial, sans-serif;
  font-size: 13px;
}
.top-sales-svg-rank {
  fill: var(--brand-dark);
  font-weight: 800;
}
.top-sales-svg-label {
  font-weight: 700;
}
.top-sales-svg-quantity {
  fill: var(--muted);
  font-size: 12px;
}
.top-sales-svg-value {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-anchor: end;
}
.top-sales-svg-track {
  fill: rgba(148, 163, 184, .18);
}
.top-sales-svg-bar {
  fill: url(#topSalesGradient);
}
html[data-theme="dark"] .top-sales-svg-rank {
  fill: #67e8f9;
}
html[data-theme="dark"] .top-sales-svg-label,
html[data-theme="dark"] .top-sales-svg-value {
  fill: #eaf6ff;
}
html[data-theme="dark"] .top-sales-svg-quantity {
  fill: #b7cce0;
}
html[data-theme="dark"] .top-sales-chart-total {
  color: #93c5fd;
}
@media (max-width: 820px) {
  .top-sales-controls {
    grid-template-columns: 1fr;
  }
  .top-sales-presets {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  .top-sales-presets .btn {
    width: 100%;
  }
  .top-sales-chart-head {
    display: grid;
  }
}
/* ONISMA client detail sales histogram v61 */
.client-list-table-wrap table {
  min-width: 860px;
}

.client-detail-modal {
  max-width: min(1180px, calc(100vw - 28px)) !important;
}

.client-detail-sales-panel {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 14px;
  padding: 18px 20px;
}

.client-detail-sales-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.client-detail-sales-heading strong {
  display: block;
  font-size: 18px;
}

.client-detail-sales-heading small {
  color: var(--muted);
  display: block;
  margin-top: 3px;
}

.client-detail-sales-filter {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(170px, 1.05fr) repeat(4, minmax(130px, .9fr)) auto;
  width: 100%;
}

.client-detail-sales-filter label {
  min-width: 0;
}

.client-detail-sales-summary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.client-detail-sales-table-wrap table {
  min-width: 760px;
}

.sales-histogram-card {
  background: linear-gradient(135deg, rgba(255,255,255,.97), rgba(239,246,255,.78));
  border: 1px solid rgba(125, 172, 230, .5);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .06);
  overflow: hidden;
  padding: 12px;
}

.sales-histogram-legend {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 14px;
  justify-content: flex-end;
  margin-bottom: 4px;
}

.sales-histogram-legend span {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.sales-histogram-legend i {
  display: inline-block;
  height: 10px;
  width: 18px;
}

.legend-bar {
  background: linear-gradient(180deg, #2563eb, #0f766e);
  border-radius: 3px;
}

.legend-line {
  border-top: 2px solid #f59e0b;
}

.sales-histogram-svg {
  display: block;
  height: auto;
  min-height: 260px;
  width: 100%;
}

.sales-axis {
  stroke: rgba(100, 116, 139, .34);
  stroke-width: 1;
}

.sales-axis-label,
.sales-x-label,
.sales-bar-value {
  fill: var(--muted);
  font-family: Aptos, "Segoe UI", Inter, Arial, sans-serif;
  font-size: 12px;
}

.sales-bar-value {
  fill: var(--ink);
  font-size: 10px;
  font-weight: 700;
}

.sales-histogram-bar {
  fill: url(#unused);
  fill: #2563eb;
  opacity: .88;
}

.sales-histogram-bar:nth-of-type(2n) {
  fill: #0f766e;
}

.sales-trend-line {
  fill: none;
  stroke: #f59e0b;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.sales-trend-dot {
  fill: #fff;
  stroke: #f59e0b;
  stroke-width: 2;
}

.sales-histogram-empty {
  align-items: center;
  background: rgba(241, 245, 249, .75);
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  justify-content: center;
  min-height: 180px;
  text-align: center;
}

.platform-brand-preview {
  min-width: 0;
  overflow: hidden;
}

.platform-brand-preview .brand-thumb,
.platform-brand-preview .brand-icon-thumb,
.platform-brand-preview img {
  border-radius: 10px;
  flex: 0 0 52px;
  height: 52px !important;
  max-height: 52px;
  max-width: 52px;
  object-fit: cover;
  width: 52px !important;
}

.platform-brand-preview small {
  line-height: 1.35;
}

html[data-theme="dark"] .sales-histogram-card {
  background: linear-gradient(135deg, rgba(10, 28, 48, .96), rgba(13, 45, 72, .78));
  border-color: rgba(56, 189, 248, .28);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .25);
}

html[data-theme="dark"] .sales-axis-label,
html[data-theme="dark"] .sales-x-label {
  fill: #aac0d5;
}

html[data-theme="dark"] .sales-bar-value {
  fill: #eaf6ff;
}

html[data-theme="dark"] .sales-trend-dot {
  fill: #082033;
}

@media (max-width: 1120px) {
  .client-detail-sales-filter {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .client-detail-sales-panel {
    padding: 14px;
  }
  .client-detail-sales-heading,
  .client-detail-sales-filter,
  .client-detail-sales-summary {
    grid-template-columns: 1fr !important;
  }
  .client-detail-sales-heading {
    align-items: flex-start;
    display: grid;
  }
  .sales-filter-actions {
    flex-direction: column;
  }
  .sales-filter-actions .btn {
    width: 100%;
  }
}
/* ONISMA top sales histogram trend v62 */
.top-sales-histogram-legend {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 14px;
  justify-content: flex-end;
  margin: -6px 0 2px;
}

.top-sales-histogram-legend span {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.top-sales-histogram-svg {
  min-height: 320px;
}

.top-sales-histogram-bar {
  fill: url(#topSalesHistogramGradient);
  opacity: .9;
}

.top-sales-trend-line {
  fill: none;
  stroke: #f59e0b;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.top-sales-trend-dot {
  fill: #fff;
  stroke: #f59e0b;
  stroke-width: 2;
}

.top-sales-svg-xlabel,
.top-sales-svg-ylabel,
.top-sales-svg-count {
  fill: var(--muted);
  font-family: Aptos, "Segoe UI", Inter, Arial, sans-serif;
  font-size: 12px;
}

.top-sales-svg-count {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

html[data-theme="dark"] .top-sales-trend-dot {
  fill: #09233a;
}

html[data-theme="dark"] .top-sales-svg-xlabel,
html[data-theme="dark"] .top-sales-svg-ylabel {
  fill: #a9bfd5;
}

html[data-theme="dark"] .top-sales-svg-count {
  fill: #eaf6ff;
}
/* ONISMA period filters modal compact v63 */
.top-sales-controls.filter-inline {
  align-items: end;
  display: grid !important;
  gap: 12px;
  grid-template-columns: minmax(150px, 180px) minmax(140px, 165px) minmax(140px, 165px) minmax(135px, 155px) minmax(220px, auto) minmax(150px, auto);
  justify-content: stretch;
}

.top-sales-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.top-sales-actions .btn,
.top-sales-presets .btn {
  min-height: 42px;
  white-space: nowrap;
}

.top-sales-controls .top-sales-presets {
  align-items: center;
  display: flex;
  justify-content: flex-end;
}

.client-detail-modal {
  max-height: calc(100dvh - 24px);
  overflow: auto;
  width: min(1180px, calc(100vw - 24px));
}

.client-detail-modal .modal-head {
  position: sticky;
  top: 0;
  z-index: 12;
}

.client-detail-modal .client-detail-form {
  max-height: none;
  overflow: visible;
}

.client-detail-sales-panel {
  gap: 12px;
  padding: 16px;
}

.client-detail-sales-filter {
  grid-template-columns: minmax(150px, 180px) minmax(145px, 170px) minmax(120px, 150px) minmax(145px, 165px) minmax(145px, 165px) minmax(215px, auto);
}

.client-detail-sales-filter .sales-filter-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.client-detail-sales-filter .sales-filter-actions .btn {
  min-height: 42px;
  white-space: nowrap;
}

.client-detail-sales-summary .mini-stat {
  min-height: 86px;
  padding: 14px;
}

.client-detail-sales-summary .mini-stat strong {
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.08;
}

.sales-histogram-card {
  padding: 10px 12px 8px;
}

.sales-histogram-svg {
  min-height: 220px;
}

@media (max-width: 1240px) {
  .top-sales-controls.filter-inline {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .client-detail-sales-filter {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .top-sales-controls.filter-inline,
  .client-detail-sales-filter {
    grid-template-columns: 1fr !important;
  }

  .top-sales-actions,
  .client-detail-sales-filter .sales-filter-actions,
  .top-sales-controls .top-sales-presets {
    align-items: stretch;
    flex-direction: column;
    justify-content: stretch;
  }

  .top-sales-actions .btn,
  .top-sales-presets .btn,
  .client-detail-sales-filter .sales-filter-actions .btn {
    width: 100%;
  }
}
/* ONISMA modal chart axis v64 */
.sales-histogram-svg {
  min-height: 200px;
}

.sales-axis-label {
  font-size: 11px;
}
/* ONISMA client detail modal scroll v65 */
dialog.client-detail-modal {
  max-height: calc(100dvh - 18px) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

dialog.client-detail-modal .modal-head {
  background: var(--surface, #fff);
  position: sticky;
  top: 0;
  z-index: 30;
}

dialog.client-detail-modal .client-detail-sales-panel,
dialog.client-detail-modal .client-detail-form {
  flex: 0 0 auto;
}

dialog.client-detail-modal .client-detail-form {
  max-height: none !important;
  overflow: visible !important;
  padding-bottom: 28px;
}

html[data-theme="dark"] dialog.client-detail-modal .modal-head {
  background: #0f172a;
}

@media (max-width: 720px) {
  dialog.client-detail-modal {
    max-height: calc(100dvh - 8px) !important;
    width: calc(100vw - 8px) !important;
  }
}
/* ONISMA mobile top blank fix v66 */
@media (max-width: 980px) {
  html,
  body {
    margin: 0 !important;
    min-height: 100dvh;
    padding: 0 !important;
  }

  .app-shell {
    display: block !important;
    margin: 0 !important;
    min-height: 100dvh !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .app-shell::after {
    display: none !important;
  }

  .app-shell > .sidebar,
  aside.sidebar[data-mobile-sidebar] {
    bottom: 0 !important;
    height: 100dvh !important;
    left: 0 !important;
    margin: 0 !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    position: fixed !important;
    right: auto !important;
    top: 0 !important;
    transform: translateX(-105%) !important;
    width: min(86vw, 318px) !important;
    z-index: 3000 !important;
  }

  body.mobile-nav-open .app-shell > .sidebar,
  body.mobile-nav-open aside.sidebar[data-mobile-sidebar] {
    transform: translateX(0) !important;
  }

  .app-shell > .main,
  main.main {
    display: block !important;
    margin: 0 !important;
    min-height: 100dvh !important;
    padding-top: 10px !important;
    position: relative !important;
    top: auto !important;
    transform: none !important;
    width: 100% !important;
  }

  .topbar {
    margin-top: 0 !important;
    top: 0 !important;
  }
}
/* ONISMA admin password reset v67 */
.admin-password-reset-line {
  align-items: center;
  align-self: end;
  display: flex;
  gap: 10px;
  min-height: 44px;
}

.admin-password-reset-line input {
  flex: 0 0 auto;
}

.admin-password-note {
  background: linear-gradient(135deg, rgba(14, 165, 233, .08), rgba(37, 99, 235, .08));
  border: 1px solid rgba(14, 165, 233, .2);
  border-radius: 14px;
  color: var(--text);
  display: grid;
  gap: 4px;
  grid-column: 1 / -1;
  padding: 12px 14px;
}

.admin-password-note small {
  color: var(--muted);
  font-weight: 500;
}

.theme-dark .admin-password-note {
  background: linear-gradient(135deg, rgba(56, 189, 248, .12), rgba(37, 99, 235, .12));
  border-color: rgba(125, 211, 252, .24);
}
/* ONISMA dashboard alerts and compact sales v68 */
.dashboard-bottom-section {
  margin-top: 16px;
  width: 100%;
}

.dashboard-movements-panel {
  width: 100%;
}

.dashboard-movements-table-wrap,
.alerts-table-wrap {
  width: 100%;
}

.dashboard-movement-table,
.alerts-table {
  min-width: 920px;
  width: 100%;
}

.dashboard-summary-compact {
  margin-bottom: 0;
}

.alert-push-panel {
  align-items: center;
  background: linear-gradient(135deg, rgba(14, 165, 233, .08), rgba(37, 99, 235, .08));
  border: 1px solid rgba(14, 165, 233, .22);
  border-radius: 14px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin: 14px 0;
  padding: 14px 16px;
}

.alert-push-panel > div {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.alert-push-panel svg {
  color: var(--danger);
  flex: 0 0 auto;
}

.alert-push-panel strong,
.alert-push-panel small {
  display: block;
}

.alert-push-panel small {
  color: var(--muted);
  margin-top: 2px;
}

.sales-kpis .kpi {
  min-height: 92px !important;
  padding: 12px 14px !important;
}

.sales-kpis .kpi span:not(.kpi-icon) {
  font-size: 10.5px !important;
  line-height: 1.25 !important;
}

.sales-kpis .kpi strong {
  font-size: clamp(17px, 1.65vw, 21px) !important;
  line-height: 1.15 !important;
  margin-top: 6px !important;
  overflow-wrap: normal !important;
  white-space: nowrap;
}

.sales-kpis .kpi small {
  font-size: 11px !important;
  line-height: 1.25 !important;
}

html[data-theme="dark"] .alert-push-panel {
  background: linear-gradient(135deg, rgba(14, 165, 233, .13), rgba(37, 99, 235, .12));
  border-color: rgba(125, 211, 252, .26);
}

@media (max-width: 760px) {
  .alert-push-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .alert-push-panel .btn {
    width: 100%;
  }

  .sales-kpis .kpi strong {
    font-size: 18px !important;
  }
}
/* ONISMA subscription alerts v69 */
.alerts-table .alert-row-link {
  margin-left: 10px;
  white-space: nowrap;
}

.alerts-table td {
  vertical-align: middle;
}
/* ONISMA PWA install and sales summary v70 */
.pwa-install-button[hidden] {
  display: none !important;
}

.pwa-install-button {
  align-items: center;
  display: inline-flex;
  gap: 8px;
  min-height: 40px;
  white-space: nowrap;
}

.sales-today-summary {
  align-items: center;
  background: linear-gradient(135deg, rgba(15, 118, 110, .08), rgba(37, 99, 235, .08));
  border: 1px solid rgba(14, 165, 233, .24);
  border-left: 4px solid var(--brand);
  border-radius: 14px;
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr);
  margin-bottom: 16px;
  padding: 12px 14px;
}

.sales-today-icon {
  align-items: center;
  background: rgba(14, 165, 233, .12);
  border: 1px solid rgba(14, 165, 233, .24);
  border-radius: 12px;
  color: var(--brand);
  display: inline-flex;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.sales-today-lines {
  display: grid;
  gap: 5px;
}

.sales-today-lines div {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1.25;
  min-width: 0;
}

.sales-today-lines span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.sales-today-lines strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.sales-today-lines small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

html[data-theme="dark"] .sales-today-summary {
  background: linear-gradient(135deg, rgba(14, 165, 233, .13), rgba(37, 99, 235, .12));
  border-color: rgba(125, 211, 252, .26);
}

html[data-theme="dark"] .sales-today-icon {
  background: rgba(56, 189, 248, .13);
  border-color: rgba(125, 211, 252, .24);
  color: #7dd3fc;
}

@media (max-width: 760px) {
  .pwa-install-button span {
    display: none;
  }

  .pwa-install-button {
    min-width: 42px;
    padding-inline: 10px;
  }

  .sales-today-summary {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .sales-today-icon {
    display: none;
  }
}
/* ONISMA mobile responsive audit v72 */
@media (max-width: 760px) {
  .enhanced-table-tools {
    align-items: stretch !important;
    display: grid !important;
    gap: 8px !important;
    grid-template-columns: 1fr !important;
    margin: 0 0 8px !important;
    padding: 0 !important;
  }

  .enhanced-table-search {
    box-sizing: border-box !important;
    flex: 0 0 auto !important;
    font-size: 14px !important;
    height: 38px !important;
    line-height: 1.2 !important;
    max-height: 38px !important;
    max-width: 100% !important;
    min-height: 38px !important;
    padding: 8px 10px !important;
    width: 100% !important;
  }

  .table-pagination {
    align-items: center !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    justify-content: flex-start !important;
    width: 100% !important;
  }

  .table-page-info {
    flex: 0 0 auto !important;
    font-size: 12px !important;
    order: 0 !important;
  }

  .table-page-size {
    flex: 0 0 auto !important;
    margin-right: 2px !important;
  }

  .table-page-size select {
    height: 34px !important;
    min-height: 34px !important;
    padding-bottom: 5px !important;
    padding-top: 5px !important;
    width: auto !important;
  }

  .table-page-button {
    height: 32px !important;
    min-width: 32px !important;
    padding: 0 8px !important;
  }

  .card,
  .accordion {
    overflow: visible;
  }

  .card > h2,
  .accordion summary span {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 480px) {
  .enhanced-table-search {
    font-size: 13px !important;
    height: 36px !important;
    max-height: 36px !important;
    min-height: 36px !important;
  }

  .table-pagination {
    row-gap: 5px !important;
  }
}
/* ONISMA modern sales summary and site search v73 */
.select2-lite select[data-lite-select] {
  border: 0;
  height: 1px;
  min-height: 0;
  min-width: 0;
  opacity: 0;
  padding: 0;
  pointer-events: none;
  position: absolute;
  width: 1px;
}

.site-select2-lite input[type="search"] {
  background: #fff;
  border-color: #b8d3e8;
  box-shadow: 0 8px 18px rgba(15, 35, 55, .06);
  font-weight: 650;
}

.sales-today-summary {
  background:
    linear-gradient(135deg, rgba(14, 165, 233, .12), rgba(37, 99, 235, .08)),
    rgba(255, 255, 255, .88) !important;
  border: 1px solid rgba(14, 165, 233, .28) !important;
  border-left: 4px solid #0f766e !important;
  box-shadow: 0 18px 44px rgba(15, 35, 55, .08);
  gap: 14px !important;
  padding: 14px 16px !important;
}

.sales-today-icon {
  background: linear-gradient(135deg, rgba(14, 165, 233, .18), rgba(15, 118, 110, .12)) !important;
  border-color: rgba(14, 165, 233, .34) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72);
  height: 48px !important;
  width: 48px !important;
}

.sales-today-lines {
  gap: 7px !important;
}

.sales-today-lines div {
  align-items: center !important;
  background: rgba(255, 255, 255, .62);
  border: 1px solid rgba(184, 211, 232, .72);
  border-radius: 10px;
  display: grid !important;
  gap: 8px !important;
  grid-template-columns: minmax(0, 1fr) auto auto;
  min-height: 30px;
  padding: 6px 10px;
}

.sales-today-lines span {
  color: #5a6c82 !important;
  font-size: 11px !important;
  letter-spacing: 0 !important;
}

.sales-today-lines strong {
  color: #111827 !important;
  font-size: 13px !important;
}

.sales-today-lines small {
  color: #667085 !important;
  font-size: 11px !important;
}

html[data-theme="dark"] .site-select2-lite input[type="search"] {
  background: rgba(7, 23, 43, .92);
  border-color: rgba(56, 189, 248, .32);
  color: #eaf6ff;
}

html[data-theme="dark"] .sales-today-summary {
  background:
    linear-gradient(135deg, rgba(14, 165, 233, .16), rgba(37, 99, 235, .12)),
    rgba(7, 23, 43, .78) !important;
  border-color: rgba(125, 211, 252, .3) !important;
  box-shadow: 0 22px 54px rgba(0, 0, 0, .24);
}

html[data-theme="dark"] .sales-today-lines div {
  background: rgba(8, 30, 55, .68);
  border-color: rgba(56, 189, 248, .2);
}

html[data-theme="dark"] .sales-today-lines span,
html[data-theme="dark"] .sales-today-lines small {
  color: #b7cce0 !important;
}

html[data-theme="dark"] .sales-today-lines strong {
  color: #fff !important;
}

@media (max-width: 760px) {
  .sales-today-summary {
    padding: 12px !important;
  }

  .sales-today-lines div {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .sales-today-lines small {
    grid-column: 2;
  }
}
/* ONISMA global select2-lite fields v74 */
.generic-select2-lite {
  min-width: 0;
  width: 100%;
}

.generic-select2-lite input[type="search"] {
  background: #fff;
  border-color: #b8d3e8;
  box-shadow: 0 8px 18px rgba(15, 35, 55, .05);
  color: var(--ink);
  font-weight: 650;
  min-height: 42px;
  padding-right: 11px;
}

.generic-select2-lite input[type="search"]::placeholder {
  color: #69788c;
}

.generic-select2-lite .select2-lite-clear {
  display: none !important;
}

html[data-theme="dark"] .generic-select2-lite input[type="search"] {
  background: rgba(7, 23, 43, .92);
  border-color: rgba(56, 189, 248, .32);
  color: #eaf6ff;
}

html[data-theme="dark"] .generic-select2-lite input[type="search"]::placeholder {
  color: #9fb4c9;
}

@media (max-width: 760px) {
  .generic-select2-lite input[type="search"] {
    min-height: 40px;
  }
}
/* ONISMA customers list full width v75 */
.customers-page-layout .customers-list-card {
  grid-column: 1 / -1;
  width: 100%;
}

.customers-list-card .enhanced-table-tools {
  justify-content: space-between;
  width: 100%;
}

.customers-list-card .enhanced-table-search {
  max-width: 320px;
}

.customers-list-card .table-wrap {
  width: 100%;
}

.customers-list-card table {
  min-width: 920px;
  width: 100%;
}

@media (max-width: 760px) {
  .customers-list-card .enhanced-table-search {
    max-width: 100%;
  }
}
/* ONISMA catalog actions and confirm modal v76 */
.confirm-modal {
  max-width: min(460px, calc(100vw - 32px));
}

.confirm-modal .modal-head h2 {
  align-items: center;
  display: flex;
  gap: 10px;
}

.confirm-icon {
  align-items: center;
  background: #fef0c7;
  border: 1px solid #fedf89;
  border-radius: 999px;
  color: var(--warning);
  display: inline-flex;
  font-size: 16px;
  font-weight: 800;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.confirm-body {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.confirm-body p {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  margin: 0;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.product-catalog-table {
  min-width: 1080px;
}

.product-row-actions {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.product-row-actions .icon-form {
  display: inline-flex;
}

.status-toggle-form {
  display: inline-flex;
  margin: 0;
}

.status-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  padding: 0;
}

.status-toggle-track {
  background: #e4e7ec;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  display: inline-flex;
  height: 24px;
  padding: 2px;
  transition: background .16s ease, border-color .16s ease;
  width: 44px;
}

.status-toggle-track span {
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .18);
  display: block;
  height: 18px;
  transition: transform .16s ease;
  width: 18px;
}

.status-toggle.is-on .status-toggle-track {
  background: #12b76a;
  border-color: #12b76a;
}

.status-toggle.is-on .status-toggle-track span {
  transform: translateX(20px);
}

.status-toggle-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-toggle.is-on .status-toggle-label {
  color: var(--success);
}

.status-toggle.is-off .status-toggle-label {
  color: var(--muted);
}

.product-edit-modal {
  max-width: min(980px, calc(100vw - 32px));
}

.product-edit-modal .modal-form {
  padding: 18px;
}

.product-edit-actions {
  align-items: end;
  grid-column: 1 / -1;
  justify-content: flex-end;
}

html[data-theme="dark"] .confirm-body p,
html[data-theme="dark"] .status-toggle {
  color: var(--ink);
}

html[data-theme="dark"] .status-toggle-track {
  background: #1e293b;
  border-color: #334155;
}

html[data-theme="dark"] .status-toggle-track span {
  background: #e5edf7;
}

@media (max-width: 760px) {
  .confirm-actions,
  .product-edit-actions {
    flex-direction: column-reverse;
  }

  .confirm-actions .btn,
  .product-edit-actions .btn {
    width: 100%;
  }
}
/* ONISMA suppliers list full width v77 */
.suppliers-page-layout .suppliers-list-card {
  grid-column: 1 / -1;
  width: 100%;
}

.suppliers-list-card .enhanced-table-tools {
  justify-content: space-between;
  width: 100%;
}

.suppliers-list-card .enhanced-table-search {
  max-width: 320px;
}

.suppliers-list-card .table-wrap {
  width: 100%;
}

.suppliers-list-card table {
  min-width: 880px;
  width: 100%;
}

@media (max-width: 760px) {
  .suppliers-list-card .enhanced-table-search {
    max-width: 100%;
  }
}
/* ONISMA agent edit modal v79 */
.agent-edit-modal {
  max-width: min(860px, calc(100vw - 32px));
}

.agent-edit-modal .modal-form {
  padding: 18px;
}

.agent-edit-actions {
  align-items: end;
  grid-column: 1 / -1;
  justify-content: flex-end;
}

@media (max-width: 760px) {
  .agent-edit-actions {
    flex-direction: column-reverse;
  }

  .agent-edit-actions .btn {
    width: 100%;
  }
}
/* ONISMA sales custom payment v80 */
.payment-custom-toggle {
  align-content: center;
  background: color-mix(in srgb, var(--brand) 6%, var(--surface));
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 9px 11px;
}

.payment-amount-disabled input[disabled] {
  background: #f3f6fb;
  color: #667085;
  cursor: not-allowed;
}

html[data-theme="dark"] .payment-custom-toggle {
  background: rgba(96, 165, 250, .08);
}

html[data-theme="dark"] .payment-amount-disabled input[disabled] {
  background: #111827;
  color: #94a3b8;
}