:root {
    --bg: #070b14;
    --surface: #0d1422;
    --surface-2: #121d31;
    --surface-3: #18263d;
    --text: #e8eef8;
    --muted: #93a4bd;
    --line: #24344f;
    --brand: #1365ee;
    --brand-dark: #0b55d9;
    --accent: #f71824;
    --warn: #f59e0b;
    --danger: #ef4444;
    --ok: #22c55e;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at 14% 6%, rgba(19, 101, 238, .16), transparent 28%),
        radial-gradient(circle at 92% 88%, rgba(247, 24, 36, .10), transparent 30%),
        var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
}

a {
    color: inherit;
    text-decoration: none;
}

.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
}

body.sidebar-collapsed .app {
    grid-template-columns: 1fr;
}

.sidebar {
    background: #05070d;
    color: #e6edf5;
    padding: 22px 16px;
    border-right: 1px solid var(--line);
}

body.sidebar-collapsed .sidebar {
    display: none;
}

.sidebar-float-toggle {
    position: fixed;
    left: 250px;
    top: 88px;
    z-index: 70;
    display: inline-flex;
    align-items: center;
    width: 38px;
    min-height: 38px;
    padding: 8px;
    border: 1px solid rgba(148, 163, 184, .36);
    border-radius: 0 8px 8px 0;
    background: #1365ee;
    color: #ffffff;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 14px 34px rgba(2, 6, 23, .28);
    transition: left .18s ease, background .18s ease, transform .18s ease;
}

.sidebar-float-toggle:hover,
.sidebar-float-toggle:focus {
    background: #0b55d9;
    outline: none;
    transform: translateX(2px);
}

body.sidebar-collapsed .sidebar-float-toggle {
    left: 0;
}

.sidebar-float-icon::before {
    content: "<";
    display: inline-grid;
    width: 18px;
    height: 18px;
    place-items: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
}

body.sidebar-collapsed .sidebar-float-icon::before,
.dashboard-page:not(.menu-open) .sidebar-float-icon::before {
    content: ">";
}

.brand {
    font-size: 18px;
    line-height: 1.25;
    font-weight: 700;
    margin-bottom: 22px;
    color: #ffffff;
}

.nav a {
    display: block;
    padding: 10px 12px;
    border-radius: 6px;
    color: #a9b8ce;
    margin-bottom: 4px;
}

.nav a:hover,
.nav a.active {
    background: #101d32;
    color: #fff;
    box-shadow: 3px 0 0 var(--brand) inset;
}

.grouped-nav {
    display: grid;
    gap: 6px;
}

.nav-group {
    border: 1px solid transparent;
    border-radius: 8px;
}

.nav-group[open] {
    border-color: #101d32;
    background: rgba(16, 29, 50, .42);
}

.nav-group summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    color: #e6edf5;
    cursor: pointer;
    font-weight: 800;
    list-style: none;
}

.nav-group summary::-webkit-details-marker {
    display: none;
}

.nav-group summary::after {
    content: "+";
    color: #93a4bd;
    font-weight: 900;
}

.nav-group[open] summary::after {
    content: "-";
}

.nav-group a {
    margin: 0 6px 4px 12px;
    padding: 9px 10px;
}

.main {
    min-width: 0;
}

.topbar {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 32px rgba(0, 0, 0, .18);
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.topbar-actions form {
    margin: 0;
}

.content {
    padding: 26px 28px 40px;
}

.page-title {
    margin: 0 0 18px;
    font-size: 24px;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid.cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 18px 42px rgba(0, 0, 0, .16);
}

.ticket-stopwatch-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #0b1220 0%, #13233c 58%, #2b1115 100%);
    border-color: #375174;
}

.ticket-stopwatch-card .eyebrow {
    margin: 0 0 8px;
}

.ticket-stopwatch {
    color: #ffffff;
    font-family: "Courier New", Consolas, monospace;
    font-size: clamp(42px, 8vw, 92px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
    overflow-wrap: anywhere;
    text-shadow: 0 8px 28px rgba(0, 0, 0, .36);
}

.ticket-stopwatch-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.ticket-stopwatch-actions .button {
    min-width: 112px;
}

.metric {
    font-size: 28px;
    font-weight: 700;
    margin-top: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    display: grid;
    gap: 7px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.stat-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.stat-card strong {
    font-size: 24px;
    overflow-wrap: anywhere;
}

.asset-flow {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.asset-flow span {
    display: grid;
    min-height: 44px;
    place-items: center;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.asset-ops-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 16px 0;
    align-items: start;
}

.asset-inline-form {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) minmax(160px, 1.4fr) 92px auto;
    gap: 8px;
    margin-bottom: 12px;
}

.compact-table {
    font-size: 13px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.cash-ledger-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.cash-ledger-total-link {
    display: block;
}

.cash-ledger-total-link:hover,
.cash-ledger-total-link:focus {
    border-color: var(--brand);
    outline: none;
}

.cash-register-actions {
    margin-bottom: 16px;
}

.cash-ledger-card {
    margin-top: 16px;
}

.ledger-reference-link {
    color: var(--brand);
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.finance-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
    gap: 18px;
    align-items: end;
    margin-bottom: 16px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(135deg, #0d1422 0%, #101d32 58%, #13243f 100%);
}

.finance-hero h1 {
    margin: 0 0 6px;
    font-size: 28px;
}

.finance-report-form,
.finance-date-form,
.finance-inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    justify-content: flex-end;
}

.finance-report-form label {
    min-width: 150px;
}

.finance-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.finance-summary-card {
    display: grid;
    gap: 8px;
    min-height: 124px;
    align-content: start;
}

.finance-summary-card span,
.finance-summary-card small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.finance-summary-card strong {
    color: #ffffff;
    font-size: 26px;
    overflow-wrap: anywhere;
}

.finance-summary-card.is-positive {
    border-color: rgba(34, 197, 94, .38);
}

.finance-summary-card.is-negative {
    border-color: rgba(239, 68, 68, .42);
}

.finance-two-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.finance-panel {
    min-width: 0;
    margin-bottom: 16px;
}

.finance-two-column .finance-panel {
    margin-bottom: 0;
}

.finance-mini-metrics,
.finance-metric-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.finance-metric-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.finance-mini-metrics span,
.finance-metric-list span {
    display: grid;
    gap: 5px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
}

.finance-mini-metrics b,
.finance-metric-list b {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
}

.finance-mini-metrics strong,
.finance-metric-list strong {
    font-size: 20px;
}

.finance-inline-form {
    justify-content: flex-start;
    margin-bottom: 14px;
}

.finance-inline-form label {
    min-width: min(100%, 360px);
}

.cash-transaction-detail {
    display: grid;
    gap: 18px;
}

.transaction-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.transaction-detail-grid p {
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
}

.transaction-detail-grid b {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.asset-label {
    display: inline-grid;
    gap: 5px;
    min-width: 116px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    color: #0f172a;
}

.asset-label strong {
    font-size: 12px;
}

.barcode {
    display: flex;
    align-items: stretch;
    gap: 1px;
    height: 34px;
}

.barcode i {
    display: block;
    background: #0f172a;
}

.qr-grid {
    display: grid;
    grid-template-columns: repeat(7, 6px);
    gap: 1px;
}

.qr-grid i {
    display: block;
    width: 6px;
    height: 6px;
    background: #e2e8f0;
}

.qr-grid i.on {
    background: #0f172a;
}

.muted {
    color: var(--muted);
}

.success-text {
    color: #22c55e;
    font-weight: 700;
}

.error-text {
    color: #ef4444;
    font-weight: 700;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.search-form {
    flex: 1;
    min-width: min(100%, 360px);
    display: flex;
    gap: 8px;
    align-items: center;
    position: relative;
}

.search-form input {
    min-width: 180px;
}

.search-form .button {
    flex: 0 0 auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.table tbody tr:hover {
    background: rgba(19, 101, 238, .06);
}

.ticket-hover-popover {
    position: relative;
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    outline: none;
}

.ticket-hover-trigger {
    color: var(--brand);
    cursor: help;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
}

.ticket-hover-card {
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    z-index: 40;
    display: none;
    width: min(430px, 88vw);
    padding: 16px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 20px 50px rgba(2, 6, 23, .30);
    color: #0f172a;
    font-size: 13px;
    line-height: 1.45;
}

.document-list-card {
    overflow: visible;
}

.document-list-card .table {
    overflow: visible;
}

.ticket-hover-card strong,
.ticket-hover-card span {
    display: block;
}

.ticket-hover-card strong {
    margin-bottom: 10px;
    color: #0f172a;
    font-size: 14px;
    letter-spacing: 0;
}

.ticket-hover-card span {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    padding: 7px 0;
    border-top: 1px solid #e2e8f0;
}

.ticket-hover-card b {
    color: #475569;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.ticket-hover-card em {
    color: #0f172a;
    font-style: normal;
    font-weight: 600;
    overflow-wrap: anywhere;
    white-space: normal;
}

.ticket-hover-popover:hover .ticket-hover-card,
.ticket-hover-popover:focus .ticket-hover-card,
.ticket-hover-popover:focus-within .ticket-hover-card {
    display: block;
}

.table th,
.table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.table th {
    background: var(--surface-2);
    font-size: 12px;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: .03em;
}

.table tr:last-child td {
    border-bottom: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text);
    font-size: 12px;
}

.badge.ok {
    background: rgba(34, 197, 94, .14);
    color: var(--ok);
}

.badge.warn {
    background: rgba(245, 158, 11, .14);
    color: var(--warn);
}

.badge.danger {
    background: rgba(239, 68, 68, .14);
    color: var(--danger);
}

.form {
    display: grid;
    gap: 12px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

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

.purchase-order-lines {
    display: grid;
    gap: 10px;
}

.purchase-order-line {
    display: grid;
    grid-template-columns: minmax(220px, 1.5fr) minmax(140px, .75fr) minmax(140px, .75fr) auto;
    gap: 10px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
}

.line-stack {
    display: grid;
    gap: 3px;
    margin-bottom: 7px;
}

.line-stack:last-child {
    margin-bottom: 0;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 11px;
    color: var(--text);
    font: inherit;
    background: #09111f;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand);
    outline: 3px solid rgba(19, 101, 238, .18);
}

select option {
    background: #09111f;
    color: var(--text);
}

textarea {
    min-height: 94px;
    resize: vertical;
}

.check-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 700;
}

.check-row input {
    width: auto;
}

[hidden] {
    display: none !important;
}

.button {
    border: 0;
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
}

.button:hover {
    background: var(--brand-dark);
}

.button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.button.secondary {
    background: #25344d;
}

.button.secondary:hover {
    background: #31415e;
}

.button.danger {
    background: var(--danger);
}

.button.danger:hover {
    background: #b91c1c;
}

.button.compact {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 13px;
}

.user-workspace,
.branch-workspace,
.customer-workspace,
.inventory-workspace {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: start;
}

.user-smart-panel,
.user-list-card,
.branch-smart-panel,
.branch-list-card,
.customer-smart-panel,
.customer-list-card {
    min-width: 0;
}

.user-smart-panel,
.branch-smart-panel,
.customer-smart-panel {
    max-width: 760px;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.panel-heading h2 {
    margin: 0;
}

.eyebrow {
    margin: 0 0 3px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.selected-user {
    display: grid;
    gap: 3px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid rgba(19, 101, 238, .28);
    border-radius: 8px;
    background: rgba(19, 101, 238, .08);
}

.selected-user span {
    font-weight: 800;
}

.selected-user small {
    color: var(--muted);
}

.user-panel-form {
    display: grid;
    gap: 12px;
}

.user-editor-card {
    align-self: start;
}

.user-management-panels {
    margin-top: 16px;
}

.inline-edit-form,
.stacked-action {
    display: grid;
    gap: 10px;
}

.inline-edit-form .button,
.stacked-action .button {
    justify-self: start;
}

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

.row-actions form {
    margin: 0;
}

.row-actions .button {
    min-height: 34px;
    padding: 7px 10px;
}

.action-menu {
    position: relative;
}

.action-menu summary {
    list-style: none;
}

.action-menu summary::-webkit-details-marker {
    display: none;
}

.action-form {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 45;
    width: min(320px, 86vw);
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
    box-shadow: 0 18px 42px rgba(0, 0, 0, .32);
}

.action-form input,
.action-form select {
    min-width: 0;
}

.search-select {
    position: relative;
}

.search-select input {
    width: 100%;
}

.search-select-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 50;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
    box-shadow: 0 18px 42px rgba(0, 0, 0, .24);
}

.search-select-menu button {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.search-select-menu button:hover,
.search-select-menu button:focus {
    background: rgba(19, 101, 238, .12);
}

.search-select-menu button span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: .85rem;
}

.search-select-empty {
    padding: 12px;
    color: var(--muted);
}

.payslip-page {
    max-width: 860px;
    margin: 0 auto;
    padding: 24px;
}

.payslip-card {
    border-radius: 8px;
}

.payslip-signatures span {
    display: block;
    height: 48px;
    border-bottom: 1px solid var(--line);
}

.public-track-page {
    background: #f4f7fb;
}

.public-track {
    max-width: 980px;
    margin: 0 auto;
    padding: 32px 16px;
}

.track-hero {
    padding: 28px 0;
}

.track-hero h1 {
    margin: 0 0 16px;
}

.track-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: end;
    max-width: 720px;
}

.smart-users-table tr.is-selected td,
.smart-branches-table tr.is-selected td,
.smart-customers-table tr.is-selected td,
.smart-inventory-table tr.is-selected td,
.smart-suppliers-table tr.is-selected td {
    background: rgba(19, 101, 238, .12);
}

.smart-users-table tbody tr[data-user-row],
.smart-branches-table tbody tr[data-branch-row],
.smart-customers-table tbody tr[data-customer-row] {
    cursor: pointer;
}

.tickets-table tbody tr[data-ticket-row] {
    cursor: pointer;
}

.tickets-table .ticket-select-cell {
    width: 54px;
    min-width: 54px;
    text-align: center;
    vertical-align: middle;
}

.ticket-checkbox {
    width: 24px;
    height: 24px;
    min-width: 24px;
    padding: 0;
    cursor: pointer;
    accent-color: var(--brand);
}

.tickets-datatable .datatable-controls {
    align-items: stretch;
}

.tickets-datatable #bulk-ticket-status-form select {
    min-width: 220px;
}

.inventory-datatable,
.tickets-datatable,
.sms-workspace {
    margin-top: 16px;
}

.sms-log-card {
    min-width: 0;
}

.sms-compose-card,
.sms-history-wide {
    margin-top: 16px;
}

.sms-compose-form textarea[name="manual_phones"] {
    min-height: 74px;
}

.sms-target-grid {
    display: grid;
    grid-template-columns: minmax(240px, .7fr) minmax(0, 1.3fr);
    gap: 16px;
    align-items: start;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 6px;
}

.sms-contact-list {
    max-height: 320px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #09111f;
}

.sms-contact-option {
    display: flex;
    grid-template-columns: none;
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    text-transform: none;
    font-size: 13px;
    cursor: pointer;
}

.sms-contact-option input {
    width: auto;
    margin-top: 3px;
}

.sms-contact-option span {
    display: grid;
    gap: 3px;
}

.sms-contact-option small {
    color: var(--muted);
}

.sms-message-cell {
    min-width: 320px;
    max-width: 520px;
}

.expense-category-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.expense-category-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.expense-category-card {
    min-width: 0;
}

.expense-category-card .panel-heading {
    align-items: flex-start;
}

.expense-detail-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.expense-detail-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 5px 7px 5px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-2);
}

.expense-detail-pill b {
    font-size: 12px;
}

.expense-detail-pill form {
    margin: 0;
}

.expense-detail-pill button {
    border: 0;
    border-radius: 999px;
    background: #25344d;
    color: #ffffff;
    padding: 4px 7px;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.expense-detail-pill form button {
    background: rgba(239, 68, 68, .22);
    color: #fecaca;
}

.whatsapp-compose-card,
.whatsapp-help-grid {
    margin-top: 16px;
}

.whatsapp-diagnostics {
    display: grid;
    gap: 8px;
    margin: 0 0 16px;
    border-color: rgba(245, 158, 11, .45);
    background: rgba(245, 158, 11, .08);
}

.whatsapp-diagnostics h2,
.whatsapp-diagnostics p {
    margin: 0;
}

.whatsapp-diagnostics h2 {
    color: #fbbf24;
}

.whatsapp-diagnostics p:not(.eyebrow) {
    color: #fde68a;
}

.whatsapp-compose-form {
    max-width: 980px;
}

.whatsapp-form-note {
    margin: 0;
}

.whatsapp-contact-list {
    display: grid;
}

.whatsapp-contact-option {
    display: grid;
    gap: 4px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.whatsapp-contact-option:hover,
.whatsapp-contact-option:focus {
    background: rgba(34, 197, 94, .12);
    outline: none;
}

.whatsapp-contact-option small,
.whatsapp-empty {
    color: var(--muted);
}

.whatsapp-empty {
    margin: 0;
    padding: 12px;
}

.whatsapp-submit {
    background: #16a34a;
}

.whatsapp-submit:hover {
    background: #15803d;
}

.whatsapp-stats {
    margin-bottom: 16px;
}

.whatsapp-inbox-layout {
    display: grid;
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    margin-top: 16px;
}

.whatsapp-conversation-panel,
.whatsapp-chat-panel {
    min-width: 0;
}

.whatsapp-filter-form {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.whatsapp-thread-list {
    display: grid;
    gap: 8px;
    max-height: 720px;
    overflow: auto;
}

.whatsapp-thread {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
}

.whatsapp-thread:hover,
.whatsapp-thread.is-active {
    border-color: #22c55e;
    background: rgba(34, 197, 94, .08);
}

.whatsapp-contact-avatar {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #1f8f5f;
    color: #ffffff;
    font-weight: 900;
}

.whatsapp-contact-identity {
    display: grid;
    gap: 3px;
    min-width: 0;
    overflow: hidden;
}

.whatsapp-contact-identity strong,
.whatsapp-contact-identity small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.whatsapp-contact-identity small {
    color: var(--muted);
    font-size: 12px;
}

.whatsapp-contact-meta {
    display: grid;
    justify-items: end;
    gap: 7px;
    min-width: 58px;
}

.whatsapp-contact-meta time {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

.whatsapp-unread-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--ok);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, .16);
}

.whatsapp-chat-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, .9fr);
    gap: 16px;
    align-items: start;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.whatsapp-chat-header h2,
.whatsapp-empty-state h2 {
    margin: 0 0 6px;
}

.whatsapp-contact-actions {
    margin-top: 10px;
}

.whatsapp-mini-form {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) auto;
    gap: 8px;
    align-items: end;
}

.whatsapp-mini-form + .whatsapp-mini-form {
    margin-top: 8px;
}

.whatsapp-mini-form:nth-child(2) {
    grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) auto;
}

.whatsapp-resolve-form {
    margin: 0;
}

.whatsapp-message-stream {
    display: grid;
    gap: 10px;
    max-height: 560px;
    min-height: 340px;
    overflow: auto;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #07101d;
}

.whatsapp-message {
    display: flex;
}

.whatsapp-message.inbound {
    justify-content: flex-start;
}

.whatsapp-message.outbound {
    justify-content: flex-end;
}

.whatsapp-message div {
    max-width: min(620px, 86%);
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
}

.whatsapp-message.inbound div {
    border-color: rgba(148, 163, 184, .28);
    background: #0b1524;
}

.whatsapp-message.outbound div {
    border-color: rgba(34, 197, 94, .34);
    background: rgba(34, 197, 94, .12);
}

.whatsapp-message strong {
    display: block;
    margin-bottom: 6px;
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 800;
}

.whatsapp-message.outbound strong {
    color: #86efac;
}

.whatsapp-message p {
    margin: 0 0 7px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.whatsapp-message small {
    color: var(--muted);
}

.whatsapp-message-meta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.whatsapp-message-ticks {
    color: #94a3b8;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0;
}

.whatsapp-message-ticks.read {
    color: #38bdf8;
}

.whatsapp-media-image,
.whatsapp-media-video {
    display: block;
    width: min(360px, 100%);
    max-height: 340px;
    margin-bottom: 8px;
    border-radius: 8px;
    object-fit: cover;
    background: #020617;
}

.whatsapp-media-audio {
    display: block;
    width: min(360px, 100%);
    margin-bottom: 8px;
}

.whatsapp-media-document {
    display: grid;
    gap: 4px;
    min-width: min(320px, 100%);
    margin-bottom: 8px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(15, 23, 42, .55);
}

.whatsapp-media-document span {
    font-weight: 800;
    overflow-wrap: anywhere;
}

.whatsapp-reply-form {
    margin-top: 14px;
}

.whatsapp-reply-form textarea {
    min-height: 110px;
}

.whatsapp-reply-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.whatsapp-file-note {
    flex: 1 1 180px;
    min-width: 0;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.whatsapp-empty-state {
    min-height: 380px;
    display: grid;
    align-content: center;
    justify-items: center;
    text-align: center;
}

.pos-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.pos-header .page-title {
    margin-bottom: 0;
    font-size: 34px;
}

.pos-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
    gap: 16px;
    align-items: start;
}

.pos-products-panel,
.pos-checkout-panel {
    min-width: 0;
}

.pos-checkout-panel {
    position: sticky;
    top: 78px;
    display: grid;
    gap: 16px;
}

.pos-panel-heading {
    margin-bottom: 16px;
}

.pos-panel-heading h2 {
    font-size: 26px;
}

.pos-search-label,
.pos-field-stack label {
    gap: 9px;
    font-size: 14px;
}

.pos-search-select input,
.pos-checkout-panel input,
.pos-checkout-panel select {
    min-height: 58px;
    padding: 14px 16px;
    font-size: 20px;
}

.pos-search-results {
    max-height: 420px;
}

.pos-search-results button {
    min-height: 68px;
    padding: 14px 16px;
}

.pos-search-results button strong {
    font-size: 17px;
}

.pos-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.pos-product-tile {
    min-height: 128px;
    display: grid;
    align-content: space-between;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #09111f;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.pos-product-tile:hover,
.pos-product-tile:focus,
.pos-product-tile.is-selected {
    border-color: var(--brand);
    background: rgba(19, 101, 238, .16);
    outline: none;
}

.pos-product-tile span {
    font-size: 17px;
    font-weight: 800;
    line-height: 1.25;
}

.pos-product-tile strong {
    color: #ffffff;
    font-size: 22px;
}

.pos-product-tile small {
    color: var(--muted);
    font-size: 14px;
}

.pos-field-stack {
    display: grid;
    gap: 10px;
}

.pos-customer-create {
    display: grid;
    gap: 12px;
}

.pos-price-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pos-qty-control {
    display: grid;
    grid-template-columns: 68px minmax(0, 1fr) 68px;
    gap: 8px;
}

.pos-qty-control .button {
    min-height: 58px;
    padding: 0;
    font-size: 28px;
}

.pos-qty-control input {
    text-align: center;
    font-size: 26px;
    font-weight: 800;
}

.pos-quick-qty,
.pos-payment-buttons {
    display: grid;
    gap: 8px;
}

.pos-quick-qty {
    grid-template-columns: repeat(4, 1fr);
}

.pos-payment-buttons {
    grid-template-columns: repeat(2, 1fr);
}

.pos-quick-qty button,
.pos-payment-buttons button {
    min-height: 50px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
}

.pos-quick-qty button:hover,
.pos-payment-buttons button:hover,
.pos-payment-buttons button.is-selected {
    border-color: var(--brand);
    background: rgba(19, 101, 238, .18);
}

.inline-create-panel {
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 10px 12px;
}

.inline-create-panel summary {
    cursor: pointer;
    font-weight: 800;
}

.sale-totals {
    display: grid;
    gap: 8px;
    max-width: 420px;
}

.sale-totals p {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 9px 10px;
    border-radius: 6px;
    background: var(--surface-2);
}

.pos-totals {
    max-width: none;
}

.pos-totals p {
    align-items: center;
    padding: 12px 14px;
    font-size: 16px;
}

.pos-totals strong {
    font-size: 21px;
}

.pos-grand-total {
    background: #ffffff !important;
    color: #07111f;
}

.pos-grand-total span {
    color: #334155;
    font-weight: 900;
}

.pos-grand-total strong {
    color: #07111f;
    font-size: 31px;
}

.pos-save-button {
    min-height: 66px;
    width: 100%;
    font-size: 22px;
}

.sales-history-card {
    margin-top: 16px;
}

.sale-form:not(.pos-workspace) {
    margin-top: 16px;
}

@media (max-width: 1180px) {
    .pos-workspace {
        grid-template-columns: 1fr;
    }

    .pos-checkout-panel {
        position: static;
    }

    .pos-product-grid {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    }
}

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

    .pos-header .page-title {
        font-size: 30px;
    }

    .pos-history-link {
        width: 100%;
        min-height: 50px;
    }

    .pos-products-panel,
    .pos-checkout-panel {
        padding: 14px;
    }

    .pos-panel-heading h2 {
        font-size: 22px;
    }

    .pos-search-select input,
    .pos-checkout-panel input,
    .pos-checkout-panel select {
        min-height: 54px;
        font-size: 18px;
    }

    .pos-product-grid,
    .pos-price-grid,
    .pos-payment-buttons {
        grid-template-columns: 1fr;
    }

    .pos-product-tile {
        min-height: 112px;
    }

    .pos-quick-qty {
        grid-template-columns: repeat(2, 1fr);
    }

    .pos-grand-total strong {
        font-size: 27px;
    }
}

.document-form,
.document-form + .card {
    margin-top: 16px;
}

.content:has(.pos-workspace) {
    padding: 0;
    background: #f7f9fc;
    color: #111827;
}

.main:has(.pos-workspace) > .topbar {
    display: none;
}

body.pos-page .main > .topbar {
    display: none;
}

body.pos-page .content {
    padding: 0;
    background: var(--bg);
    color: var(--text);
}

body:has(.pos-workspace).pos-sidebar-hidden .app {
    grid-template-columns: 1fr;
}

body:has(.pos-workspace).pos-sidebar-hidden .sidebar {
    display: none;
}

body.pos-sidebar-hidden .app {
    grid-template-columns: 1fr;
}

body.pos-sidebar-hidden .sidebar {
    display: none;
}

.pos-workspace {
    min-height: 100vh;
    grid-template-columns: minmax(0, 1fr) minmax(390px, 464px);
    gap: 0;
    margin: 0;
    background: #f7f9fc;
}

.pos-products-panel,
.pos-checkout-panel {
    border: 0;
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
}

.pos-products-panel {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    padding: 0;
    border-right: 1px solid #e5e7eb;
}

.pos-topbar {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto;
    gap: 16px;
    align-items: center;
    min-height: 74px;
    padding: 12px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
}

.pos-top-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.pos-top-actions .button {
    min-height: 48px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 0 18px;
    font-size: 15px;
}

.pos-top-actions .button.secondary {
    background: #ffffff;
    color: #111827;
}

.pos-search-select::before {
    content: "";
    position: absolute;
    left: 18px;
    top: 50%;
    z-index: 1;
    width: 14px;
    height: 14px;
    border: 2px solid #7c8798;
    border-radius: 999px;
    transform: translateY(-58%);
}

.pos-search-select::after {
    content: "";
    position: absolute;
    left: 31px;
    top: calc(50% + 8px);
    z-index: 1;
    width: 7px;
    height: 2px;
    border-radius: 999px;
    background: #7c8798;
    transform: rotate(45deg);
}

.pos-search-select input {
    min-height: 48px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 12px 44px;
    background: #f8fafc;
    color: #111827;
    font-size: 16px;
}

.pos-search-results {
    border-color: #dbe3ef;
    background: #ffffff;
    color: #111827;
}

.pos-search-results button {
    min-height: 62px;
    color: #111827;
}

.pos-category-tabs {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 24px 20px 18px;
    overflow-x: auto;
    background: #ffffff;
}

.pos-category-tabs button {
    flex: 0 0 auto;
    min-width: 84px;
    min-height: 42px;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    background: #ffffff;
    color: #243044;
    padding: 0 18px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
}

.pos-category-tabs button:hover,
.pos-category-tabs button.is-selected {
    border-color: #1267f1;
    background: #1267f1;
    color: #ffffff;
}

.pos-product-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
    align-content: start;
    margin: 0;
    padding: 0 20px 20px;
    overflow: auto;
}

.pos-product-tile {
    min-height: 214px;
    align-content: start;
    justify-items: center;
    gap: 9px;
    padding: 16px 12px;
    border: 1px solid #e5eaf1;
    border-radius: 8px;
    background: #ffffff;
    color: #111827;
    text-align: center;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
}

.pos-product-tile:hover,
.pos-product-tile:focus,
.pos-product-tile.is-selected {
    border-color: #1267f1;
    background: #f8fbff;
    box-shadow: 0 0 0 3px rgba(18, 103, 241, .12);
}

.pos-product-art {
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(18, 103, 241, .08), rgba(22, 163, 74, .08)),
        #f1f5f9;
    color: #1267f1;
    font-size: 28px;
    font-weight: 900;
}

.pos-product-art.small {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    font-size: 16px;
}

.pos-product-tile .pos-product-name {
    min-height: 42px;
    display: grid;
    place-items: center;
    color: #263244;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.3;
}

.pos-product-tile strong {
    color: #1267f1;
    font-size: 19px;
}

.pos-product-tile small {
    color: #64748b;
    font-size: 13px;
}

.pos-checkout-panel {
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow: auto;
    padding: 20px 16px;
    border-left: 1px solid #e5e7eb;
    color: #111827;
}

.pos-checkout-panel .pos-panel-heading {
    margin-bottom: 18px;
}

.pos-checkout-panel .pos-panel-heading h2 {
    color: #111827;
    font-size: 18px;
}

.pos-clear-sale {
    border: 0;
    background: transparent;
    color: #ef4444;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.pos-current-line {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-height: 78px;
    padding: 14px 0;
    border-top: 1px solid #edf1f6;
    border-bottom: 1px solid #edf1f6;
}

.pos-current-line strong,
.pos-current-line small {
    display: block;
}

.pos-current-line strong {
    color: #111827;
    font-size: 15px;
}

.pos-current-line small {
    margin-top: 4px;
    color: #64748b;
}

.pos-current-line > span:last-child {
    color: #111827;
    font-size: 16px;
    font-weight: 900;
}

.pos-line-tools {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin: 0 -16px;
    border-bottom: 1px solid #e5e7eb;
}

.pos-line-tools button {
    min-height: 56px;
    border: 0;
    border-right: 1px solid #e5e7eb;
    background: #ffffff;
    color: #243044;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.pos-field-stack {
    gap: 10px;
    margin-top: 14px;
}

.pos-field-stack label {
    color: #64748b;
    font-size: 12px;
}

.pos-checkout-panel input,
.pos-checkout-panel select {
    min-height: 46px;
    border-color: #dbe3ef;
    background: #ffffff;
    color: #111827;
    font-size: 16px;
}

.pos-customer-create {
    border-color: #dbe3ef;
    background: #f8fafc;
}

.pos-qty-control {
    grid-template-columns: 58px minmax(0, 1fr) 58px;
}

.pos-qty-control .button {
    min-height: 46px;
    border: 1px solid #dbe3ef;
    background: #ffffff;
    color: #334155;
    font-size: 22px;
}

.pos-qty-control input {
    font-size: 20px;
}

.pos-quick-qty button,
.pos-payment-buttons button {
    min-height: 48px;
    border-color: #dbe3ef;
    background: #ffffff;
    color: #243044;
}

.pos-quick-qty button:hover,
.pos-payment-buttons button:hover,
.pos-payment-buttons button.is-selected {
    border-color: #1267f1;
    background: #eff6ff;
    color: #1267f1;
}

.pos-totals {
    gap: 0;
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.pos-totals p {
    padding: 8px 0;
    background: transparent;
    color: #111827;
    font-size: 15px;
}

.pos-totals strong {
    color: #111827;
    font-size: 16px;
}

.pos-grand-total {
    margin-top: 8px !important;
    padding-top: 18px !important;
    border-top: 1px solid #e5e7eb;
    background: transparent !important;
}

.pos-grand-total span {
    color: #111827;
    font-size: 18px;
}

.pos-grand-total strong {
    color: #1267f1;
    font-size: 27px;
}

.pos-save-button {
    min-height: 58px;
    gap: 12px;
    border-radius: 8px;
    background: #1267f1;
    font-size: 17px;
}

.pos-save-button strong {
    font-size: 18px;
}

.pos-payment-buttons {
    grid-template-columns: repeat(3, 1fr);
}

.pos-payment-buttons button:nth-child(4) {
    grid-column: 1 / -1;
}

.sales-history-card {
    margin: 18px;
    background: #ffffff;
    color: #111827;
    border-color: #e5e7eb;
}

.sales-history-card .table {
    background: #ffffff;
    color: #111827;
    border-color: #e5e7eb;
}

.sales-history-card .table th,
.sales-history-card .table td {
    border-bottom-color: #e5e7eb;
}

.sales-history-card .table th {
    background: #f8fafc;
    color: #64748b;
}

@media (max-width: 1180px) {
    .pos-workspace {
        grid-template-columns: 1fr;
    }

    .pos-checkout-panel {
        position: static;
        max-height: none;
        border-top: 1px solid #e5e7eb;
        border-left: 0;
    }
}

@media (max-width: 760px) {
    .pos-topbar {
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .pos-top-actions {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
    }

    .pos-category-tabs {
        padding: 14px 12px;
    }

    .pos-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        padding: 0 12px 12px;
    }

    .pos-product-tile {
        min-height: 184px;
        padding: 12px 8px;
    }

    .pos-product-art {
        width: 76px;
        height: 76px;
    }

    .pos-checkout-panel {
        padding: 14px 12px;
    }

    .pos-price-grid,
    .pos-payment-buttons {
        grid-template-columns: 1fr;
    }

    .pos-line-tools {
        grid-template-columns: repeat(2, 1fr);
        margin: 0 -12px;
    }
}

.content:has(.pos-workspace),
.pos-workspace {
    background: var(--bg);
    color: var(--text);
}

.pos-products-panel,
.pos-checkout-panel,
.pos-topbar {
    background: var(--surface);
    color: var(--text);
}

.pos-products-panel {
    border-right-color: var(--line);
}

.pos-checkout-panel {
    border-left-color: var(--line);
}

.pos-topbar,
.pos-category-tabs,
.pos-current-line,
.pos-line-tools,
.pos-totals,
.pos-grand-total {
    border-color: var(--line);
}

.pos-search-select input,
.pos-checkout-panel input,
.pos-checkout-panel select,
.pos-top-actions .button.secondary,
.pos-category-tabs button,
.pos-product-tile,
.pos-line-tools button,
.pos-quick-qty button,
.pos-payment-buttons button {
    border-color: var(--line);
    background: #09111f;
    color: var(--text);
}

.pos-top-actions .button.secondary:hover,
.pos-menu-toggle[aria-pressed="true"],
.pos-category-tabs button:hover,
.pos-category-tabs button.is-selected,
.pos-product-tile:hover,
.pos-product-tile:focus,
.pos-product-tile.is-selected,
.pos-quick-qty button:hover,
.pos-payment-buttons button:hover,
.pos-payment-buttons button.is-selected {
    border-color: var(--brand);
    background: rgba(19, 101, 238, .18);
    color: #ffffff;
}

.pos-search-results,
.pos-customer-create {
    border-color: var(--line);
    background: var(--surface-2);
    color: var(--text);
}

.pos-product-art {
    background: var(--surface-2);
    color: var(--brand);
}

.pos-product-tile .pos-product-name,
.pos-checkout-panel .pos-panel-heading h2,
.pos-current-line strong,
.pos-current-line > span:last-child,
.pos-totals p,
.pos-totals strong,
.pos-grand-total span {
    color: var(--text);
}

.pos-product-tile strong,
.pos-grand-total strong {
    color: #60a5fa;
}

.pos-product-tile small,
.pos-current-line small,
.pos-field-stack label {
    color: var(--muted);
}

.pos-product-tile:disabled,
.pos-product-tile[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: .5;
    filter: grayscale(.45);
}

.pos-product-tile:disabled:hover,
.pos-product-tile[aria-disabled="true"]:hover {
    border-color: var(--line);
    background: #09111f;
    box-shadow: none;
}

.pos-grand-total {
    background: transparent !important;
}

.pos-cart-lines {
    display: grid;
    gap: 8px;
    max-height: 240px;
    overflow: auto;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.pos-cart-line {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
    text-align: left;
}

.pos-cart-line:hover,
.pos-cart-line.is-selected {
    border-color: var(--brand);
    background: rgba(19, 101, 238, .16);
}

.pos-cart-select {
    min-width: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.pos-cart-line span,
.pos-cart-line small {
    display: block;
}

.pos-cart-line small {
    margin-top: 4px;
    color: var(--muted);
}

.pos-cart-line strong {
    color: #ffffff;
    white-space: nowrap;
}

.pos-cart-remove {
    position: relative;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(239, 68, 68, .5);
    border-radius: 6px;
    background: rgba(239, 68, 68, .14);
    cursor: pointer;
}

.pos-cart-remove::before {
    content: "";
    position: absolute;
    width: 15px;
    height: 17px;
    top: 17px;
    border: 2px solid var(--danger);
    border-top: 0;
    border-radius: 0 0 3px 3px;
}

.pos-cart-remove::after {
    content: "";
    position: absolute;
    width: 21px;
    height: 2px;
    top: 12px;
    border-radius: 999px;
    background: var(--danger);
    box-shadow: 0 -4px 0 -1px var(--danger);
}

.pos-cart-remove span::before,
.pos-cart-remove span::after {
    content: "";
    position: absolute;
    top: 20px;
    width: 2px;
    height: 11px;
    border-radius: 999px;
    background: var(--danger);
}

.pos-cart-remove span::before {
    left: 17px;
}

.pos-cart-remove span::after {
    right: 17px;
}

.pos-cart-remove:hover {
    background: var(--danger);
}

.pos-cart-remove:hover::before {
    border-color: #ffffff;
}

.pos-cart-remove:hover::after,
.pos-cart-remove:hover span::before,
.pos-cart-remove:hover span::after {
    background: #ffffff;
}

.sales-history-card,
.sales-history-card .table {
    background: var(--surface);
    color: var(--text);
    border-color: var(--line);
}

.sales-history-card .table th,
.sales-history-card .table td {
    border-bottom-color: var(--line);
}

.sales-history-card .table th {
    background: var(--surface-2);
    color: var(--muted);
}

body.pos-page .sales-history-card input,
body.pos-page .sales-history-card select {
    border-color: var(--line);
    background: #09111f;
    color: var(--text);
}

/* Polished POS dark theme */
body.pos-page {
    background: var(--bg);
}

body.pos-page .content,
body.pos-page .pos-workspace {
    background:
        radial-gradient(circle at 18% 8%, rgba(19, 101, 238, .16), transparent 26%),
        linear-gradient(180deg, #070b14 0%, #0a1020 100%);
    color: var(--text);
}

body.pos-page .pos-products-panel,
body.pos-page .pos-checkout-panel,
body.pos-page .pos-topbar,
body.pos-page .pos-category-tabs {
    background: rgba(13, 20, 34, .96);
    color: var(--text);
}

body.pos-page .pos-products-panel {
    border-right: 1px solid #22324c;
}

body.pos-page .pos-checkout-panel {
    border-left: 1px solid #22324c;
    box-shadow: -18px 0 45px rgba(0, 0, 0, .18);
}

body.pos-page .pos-topbar,
body.pos-page .pos-current-line,
body.pos-page .pos-line-tools,
body.pos-page .pos-cart-lines,
body.pos-page .pos-totals,
body.pos-page .pos-grand-total {
    border-color: #22324c;
}

body.pos-page .pos-search-select input,
body.pos-page .pos-checkout-panel input,
body.pos-page .pos-checkout-panel select,
body.pos-page .sales-history-card input,
body.pos-page .sales-history-card select {
    border-color: #2b3c58;
    background: #08111f;
    color: #eef5ff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}

body.pos-page .pos-search-select input::placeholder,
body.pos-page .pos-checkout-panel input::placeholder {
    color: #8292aa;
}

body.pos-page .pos-category-tabs button,
body.pos-page .pos-top-actions .button.secondary,
body.pos-page .pos-line-tools button,
body.pos-page .pos-quick-qty button,
body.pos-page .pos-payment-buttons button {
    border-color: #2b3c58;
    background: #111c2e;
    color: #dbe7f7;
}

body.pos-page .pos-category-tabs button:hover,
body.pos-page .pos-category-tabs button.is-selected,
body.pos-page .pos-menu-toggle[aria-pressed="true"],
body.pos-page .pos-payment-buttons button.is-selected,
body.pos-page .pos-payment-buttons button:hover,
body.pos-page .pos-quick-qty button:hover,
body.pos-page .pos-top-actions .button.secondary:hover {
    border-color: #3b82f6;
    background: linear-gradient(180deg, #1d5fd8 0%, #1247aa 100%);
    color: #ffffff;
    box-shadow: 0 8px 22px rgba(19, 101, 238, .24);
}

body.pos-page .pos-product-tile {
    border-color: #243652;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .025), transparent),
        #0b1424;
    color: var(--text);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
}

body.pos-page .pos-product-tile:hover,
body.pos-page .pos-product-tile:focus,
body.pos-page .pos-product-tile.is-selected {
    border-color: #3b82f6;
    background:
        linear-gradient(180deg, rgba(59, 130, 246, .20), rgba(19, 101, 238, .08)),
        #0d1829;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .14), 0 14px 30px rgba(0, 0, 0, .24);
}

body.pos-page .pos-service-tile {
    border-color: #2b4157;
}

body.pos-page .pos-service-tile .pos-product-art {
    color: #22c55e;
    background: rgba(34, 197, 94, .12);
}

body.pos-page .pos-product-art {
    background: #121f33;
    color: #60a5fa;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, .12);
}

body.pos-page .pos-product-name,
body.pos-page .pos-product-tile .pos-product-name,
body.pos-page .pos-current-line strong,
body.pos-page .pos-checkout-panel h2,
body.pos-page .pos-totals p,
body.pos-page .pos-totals strong,
body.pos-page .pos-grand-total span {
    color: #f4f7fb;
}

body.pos-page .pos-product-tile strong,
body.pos-page .pos-grand-total strong,
body.pos-page .pos-save-button strong {
    color: #7db2ff;
}

body.pos-page .pos-product-tile small,
body.pos-page .pos-current-line small,
body.pos-page .pos-field-stack label,
body.pos-page .pos-cart-line small {
    color: #9fb0c7;
}

body.pos-page .pos-current-line,
body.pos-page .pos-cart-line {
    background: #101b2d;
}

body.pos-page .pos-cart-line {
    border-color: #283a56;
}

body.pos-page .pos-cart-line:hover,
body.pos-page .pos-cart-line.is-selected {
    border-color: #3b82f6;
    background: rgba(19, 101, 238, .16);
}

body.pos-page .pos-clear-sale {
    color: #fb7185;
}

body.pos-page .pos-save-button {
    background: linear-gradient(180deg, #1d6df2 0%, #1155d8 100%);
    color: #ffffff;
    box-shadow: 0 14px 28px rgba(19, 101, 238, .32);
}

body.pos-page .pos-save-button:hover {
    background: linear-gradient(180deg, #2f7df7 0%, #1365ee 100%);
}

body.pos-page .sales-history-card,
body.pos-page .sales-history-card .table {
    border-color: #243652;
    background: #0d1422;
    color: var(--text);
}

body.pos-page .sales-history-card .table th {
    background: #121d31;
    color: #9fb0c7;
}

.schedule-calendar {
    min-width: 0;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.calendar-weekdays {
    margin-bottom: 8px;
}

.calendar-weekdays strong {
    color: var(--muted);
    font-size: 12px;
    text-align: center;
    text-transform: uppercase;
}

.calendar-cell {
    min-height: 118px;
    display: grid;
    align-content: start;
    gap: 7px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
}

.calendar-cell:hover {
    border-color: var(--brand);
}

.calendar-cell.is-muted {
    opacity: .45;
}

.calendar-date {
    font-weight: 800;
}

.calendar-pill,
.count-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
}

.calendar-pill.booking {
    background: rgba(19, 101, 238, .18);
    color: #8bb8ff;
}

.calendar-pill.ticket {
    background: rgba(34, 197, 94, .16);
    color: #86efac;
}

.schedule-day-grid {
    align-items: start;
}

.schedule-stack {
    display: grid;
    gap: 12px;
}

.schedule-item {
    display: grid;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(9, 17, 31, .45);
}

.schedule-item strong,
.schedule-item span,
.schedule-item small {
    display: block;
}

.schedule-item span {
    margin-top: 4px;
}

.schedule-item small {
    margin-top: 4px;
    color: var(--muted);
}

.schedule-adjust-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr)) auto;
    gap: 8px;
    align-items: end;
}

.document-lines {
    display: grid;
    gap: 8px;
}

.document-line {
    display: grid;
    grid-template-columns: 130px 1fr 1.4fr 90px 120px auto;
    gap: 8px;
}

@media (max-width: 980px) {
    .document-line {
        grid-template-columns: 1fr;
    }
}

.datatable-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.datatable-controls input,
.datatable-controls select {
    min-width: 170px;
}

.table-scroll {
    overflow-x: auto;
}

.smart-inventory-table th button,
.smart-suppliers-table th button,
[data-dt-sort] {
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    letter-spacing: inherit;
    text-transform: inherit;
}

.smart-inventory-table th button::after,
.smart-suppliers-table th button::after,
[data-dt-sort]::after {
    content: "↕";
    margin-left: 6px;
    color: var(--muted);
    font-size: 10px;
}

.smart-inventory-table th:last-child,
.smart-inventory-table td:last-child,
.smart-suppliers-table th:last-child,
.smart-suppliers-table td:last-child {
    min-width: 220px;
}

.datatable-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
}

.inventory-control-card,
.stock-take-card,
.inventory-history-grid,
.stock-session-card {
    margin-top: 16px;
}

.stock-transfer-form {
    max-width: 980px;
}

.transfer-document {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    padding: 20px;
}

.transfer-document-header {
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding-bottom: 16px;
}

.transfer-document-header h3 {
    margin: 4px 0;
}

.transfer-document-meta {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 140px;
    padding: 12px;
}

.transfer-document-meta span,
.transfer-document-meta strong {
    display: block;
}

.transfer-document-fields {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 16px 0;
}

.stock-take-scroll {
    max-height: 520px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.stock-take-table {
    border: 0;
}

.stock-take-table input {
    min-width: 120px;
}

.stock-take-table th,
.stock-take-table td {
    white-space: nowrap;
}

.stock-take-table td:nth-child(2) {
    min-width: 220px;
}

.inventory-history-grid {
    align-items: start;
}

.supplier-invoice-card {
    margin: 16px 0;
}

.supplier-lines {
    display: grid;
    gap: 8px;
}

.supplier-line {
    display: grid;
    grid-template-columns: minmax(180px, 1.4fr) minmax(110px, .8fr) minmax(180px, 1.3fr) 90px 110px 110px auto;
    gap: 8px;
    align-items: center;
}

.transfer-line,
.transfer-line.supplier-line {
    grid-template-columns: minmax(260px, 1fr) 120px auto;
}

.supplier-line-head {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.transfer-lines-table {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.transfer-lines-table .transfer-line {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: 42px minmax(220px, 1fr) 100px 120px 110px;
    padding: 12px;
}

.transfer-lines-table .transfer-line + .transfer-line {
    border-top: 1px solid var(--line);
}

.transfer-lines-table .transfer-line-head {
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.transfer-line-number {
    color: var(--muted);
    font-weight: 800;
}

.transfer-document-footer {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 16px;
}

.tickets-table tbody tr[data-ticket-row]:hover td {
    background: rgba(19, 101, 238, .08);
}

.print-only {
    display: none;
}

.count-pill {
    border-radius: 999px;
    background: #142037;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    padding: 6px 10px;
}

.users-table th:last-child,
.users-table td:last-child,
.smart-branches-table th:last-child,
.smart-branches-table td:last-child,
.smart-customers-table th:last-child,
.smart-customers-table td:last-child,
.tickets-table th:last-child,
.tickets-table td:last-child {
    width: 250px;
}

@media print {
    body {
        background: #ffffff;
        color: #000000;
    }

    .sidebar,
    .topbar,
    .print-hidden,
    .menu-overlay,
    .sidebar-float-toggle,
    .card form {
        display: none !important;
    }

    .app,
    .main,
    .content {
        display: block;
        padding: 0;
        margin: 0;
    }

    .card {
        box-shadow: none;
        border-color: #cccccc;
    }

    .print-only {
        display: block;
    }
}

@media (max-width: 1100px) {
    .transfer-document-header,
    .transfer-document-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .transfer-document-fields,
    .transfer-lines-table .transfer-line {
        grid-template-columns: 1fr;
    }

    .transfer-lines-table .transfer-line-head {
        display: none;
    }

    .supplier-line {
        grid-template-columns: 1fr 1fr;
    }

    .supplier-line-head {
        display: none;
    }
}

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.alert.error {
    background: rgba(239, 68, 68, .14);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, .30);
}

.alert.success {
    background: rgba(34, 197, 94, .14);
    color: var(--ok);
    border: 1px solid rgba(34, 197, 94, .30);
}

.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(circle at 18% 12%, rgba(19, 101, 238, .34), transparent 28%),
        radial-gradient(circle at 82% 84%, rgba(247, 24, 36, .22), transparent 30%),
        linear-gradient(135deg, #02050b 0%, #071b42 48%, #02040a 100%);
}

.auth-panel {
    width: min(500px, 100%);
    background: #05070d;
    border: 1px solid rgba(19, 101, 238, .54);
    border-radius: 8px;
    padding: 24px 24px 26px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, .42), 0 3px 0 #f71824 inset;
}

.auth-panel .page-title {
    color: #1365ee;
    text-align: center;
    margin-bottom: 18px;
}

.auth-panel label {
    color: #9dbcf8;
}

.auth-panel input {
    background: #0b1220;
    border-color: #163a75;
    color: #ffffff;
}

.auth-panel input:focus {
    border-color: #1365ee;
    outline: 3px solid rgba(19, 101, 238, .24);
}

.auth-panel .button {
    background: #f71824;
}

.auth-panel .button:hover {
    background: #1365ee;
}

.auth-panel .muted {
    color: #8aa4d6;
    text-align: center;
}

.login-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin-bottom: 18px;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
    border: 1px solid rgba(19, 101, 238, .32);
    padding: 12px;
}

.login-brand img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.dashboard-page {
    background: #f3f5f9;
    color: #0f172a;
}

.dashboard-page .app {
    display: block;
}

.dashboard-page .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: 280px;
    display: block;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 18px 0 35px rgba(2, 6, 23, .28);
}

.dashboard-page .sidebar-float-toggle {
    left: 0;
    top: 86px;
}

.dashboard-page.menu-open .sidebar-float-toggle {
    left: 270px;
}

.dashboard-page.menu-open .sidebar {
    transform: translateX(0);
}

.menu-overlay {
    display: none;
}

.dashboard-page .menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: block;
    border: 0;
    background: rgba(2, 6, 23, .45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

.dashboard-page.menu-open .menu-overlay {
    opacity: 1;
    pointer-events: auto;
}

.dashboard-page .topbar {
    position: sticky;
    top: 0;
    z-index: 45;
    min-height: 64px;
    padding: 0 18px;
    background: #07111f;
    color: #ffffff;
    border-bottom: 0;
    box-shadow: 0 8px 22px rgba(2, 6, 23, .18);
}

.dashboard-page .topbar > form {
    display: none;
}

.dashboard-page .content {
    padding: 18px;
}

.dashboard-topnav {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-icon {
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    display: grid;
    place-content: center;
    gap: 5px;
    padding: 0;
}

.nav-icon span {
    width: 19px;
    height: 2px;
    border-radius: 999px;
    background: #ffffff;
    display: block;
}

.dashboard-search {
    width: min(470px, 36vw);
    height: 38px;
    border-radius: 999px;
    background: #26344f;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    padding: 0 8px 0 18px;
    gap: 8px;
    position: relative;
}

.dashboard-search input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    color: #ffffff;
}

.dashboard-search input::placeholder {
    color: #cbd5e1;
}

.dashboard-search button {
    border: 0;
    border-radius: 999px;
    background: #0b63ce;
    color: #ffffff;
    padding: 7px 12px;
    font-weight: 700;
    cursor: pointer;
}

.live-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 90;
    max-height: 390px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0d1422;
    box-shadow: 0 18px 40px rgba(2, 6, 23, .35);
}

.dashboard-search .live-search-results {
    border-color: #dce3ec;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 18px 40px rgba(2, 6, 23, .22);
}

.live-search-results a,
.live-search-empty {
    display: grid;
    gap: 3px;
    padding: 11px 13px;
    border-bottom: 1px solid var(--line);
}

.dashboard-search .live-search-results a,
.dashboard-search .live-search-empty {
    border-bottom-color: #e5eaf1;
}

.live-search-results a:hover {
    background: rgba(19, 101, 238, .12);
}

.live-search-results strong {
    color: var(--brand);
}

.live-search-results span {
    color: inherit;
    font-size: 13px;
}

.live-search-results small,
.live-search-empty {
    color: var(--muted);
}

.dashboard-search .live-search-results small,
.dashboard-search .live-search-empty {
    color: #64748b;
}

.topnav-spacer {
    flex: 1;
}

.topnav-pill {
    background: #1d2a40;
    color: #ffffff;
    border-radius: 9px;
    padding: 10px 16px;
    font-weight: 700;
}

.notification-menu {
    position: relative;
}

.notification-menu summary {
    list-style: none;
}

.notification-menu summary::-webkit-details-marker {
    display: none;
}

.notification-bell {
    position: relative;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #1d2a40;
    color: #ffffff;
    cursor: pointer;
}

.notification-bell:hover,
.notification-menu[open] .notification-bell {
    border-color: var(--brand);
    background: #25344d;
}

.notification-bell span {
    font-size: 18px;
    line-height: 1;
}

.notification-bell b {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    padding: 0 5px;
    border: 2px solid var(--surface);
    border-radius: 999px;
    background: var(--accent);
    color: #ffffff;
    font-size: 11px;
    line-height: 1;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 120;
    width: min(330px, 88vw);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 18px 42px rgba(0, 0, 0, .28);
}

.notification-dropdown > strong {
    display: block;
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
}

.notification-dropdown a,
.notification-dropdown p {
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
}

.notification-dropdown a:last-child,
.notification-dropdown p:last-child {
    border-bottom: 0;
}

.notification-dropdown a:hover {
    background: rgba(19, 101, 238, .08);
}

.notification-dropdown span {
    font-weight: 800;
}

.notification-dropdown small,
.notification-dropdown p {
    color: #64748b;
}

.admin-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.account-menu {
    position: relative;
}

.account-menu summary {
    cursor: pointer;
    list-style: none;
}

.account-menu summary::-webkit-details-marker {
    display: none;
}

.account-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 100;
    min-width: 190px;
    overflow: hidden;
    border: 1px solid #dce3ec;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 18px 40px rgba(2, 6, 23, .22);
}

.account-dropdown a,
.account-dropdown button {
    width: 100%;
    display: block;
    border: 0;
    border-bottom: 1px solid #e5eaf1;
    padding: 11px 13px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.account-dropdown form {
    margin: 0;
}

.account-dropdown a:hover,
.account-dropdown button:hover {
    background: rgba(19, 101, 238, .10);
}

.admin-chip small {
    display: block;
    color: #cbd5e1;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: linear-gradient(135deg, #ffffff, #f7c9a9);
    color: #0f172a;
    display: grid;
    place-items: center;
    font-weight: 800;
}

.admin-dashboard {
    display: grid;
    gap: 14px;
}

.dashboard-hero {
    min-height: 170px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 26px;
    border-radius: 12px;
    color: #ffffff;
    background:
        linear-gradient(135deg, #07111f 0%, #123a55 48%, #0f172a 100%);
    box-shadow: 0 18px 40px rgba(2, 6, 23, .20);
}

.dashboard-hero h1 {
    margin: 4px 0 8px;
    font-size: 30px;
    letter-spacing: 0;
}

.dashboard-hero p {
    max-width: 680px;
    margin: 0;
    color: rgba(255, 255, 255, .82);
}

.dashboard-hero .eyebrow {
    color: #93c5fd;
}

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

.hero-button {
    border: 1px solid rgba(255, 255, 255, .26);
    border-radius: 8px;
    padding: 10px 14px;
    color: #ffffff;
    background: rgba(255, 255, 255, .12);
    font-weight: 800;
    backdrop-filter: blur(10px);
}

.hero-button.primary {
    border-color: transparent;
    background: #0b63ce;
}

.insight-strip {
    position: sticky;
    top: 78px;
    z-index: 35;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    padding: 0 0 4px;
    background: linear-gradient(180deg, #f3f5f9 0%, #f3f5f9 78%, rgba(243, 245, 249, 0) 100%);
}

.insight-strip article {
    padding: 16px;
    border: 1px solid #dce3ec;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 3px 10px rgba(15, 23, 42, .07);
}

.insight-strip span {
    display: block;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.insight-strip strong {
    display: block;
    margin-top: 8px;
    color: #020617;
    font-size: 24px;
}

.insight-strip small {
    display: block;
    margin-top: 7px;
    color: #334155;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(145px, 1fr));
    gap: 14px;
}

.dash-metric {
    min-height: 96px;
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 14px;
    align-items: center;
    background: #ffffff;
    border: 1px solid #dce3ec;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 3px 10px rgba(15, 23, 42, .08);
}

.dash-metric.wide {
    grid-column: span 2;
}

.tile-icon {
    height: 80px;
    border-radius: 8px;
    color: #ffffff;
    display: grid;
    place-items: center;
    font-size: 22px;
    font-weight: 800;
}

.dash-metric b,
.dash-panel h2 {
    color: #0f172a;
    font-size: 14px;
    margin: 0;
}

.dash-metric strong {
    display: block;
    margin-top: 8px;
    color: #030712;
    font-size: 26px;
    line-height: 1;
}

.dash-metric small {
    display: block;
    margin-top: 10px;
    color: #334155;
}

.blue .tile-icon { background: linear-gradient(135deg, #005bea, #2d7dff); }
.yellow .tile-icon { background: linear-gradient(135deg, #f6b400, #ffd21f); }
.orange .tile-icon { background: linear-gradient(135deg, #ff7a00, #ff9f2f); }
.green .tile-icon { background: linear-gradient(135deg, #04a857, #20c56e); }
.cyan .tile-icon { background: linear-gradient(135deg, #04a6af, #18c6c2); }
.purple .tile-icon { background: linear-gradient(135deg, #7c3aed, #a855f7); }
.red .tile-icon { background: linear-gradient(135deg, #f5222d, #ff4d4f); }

.advanced-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 14px;
}

.health-body {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 16px;
    align-items: center;
    padding: 16px;
}

.radial-score {
    width: 136px;
    height: 136px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    position: relative;
}

.radial-score::after {
    content: "";
    position: absolute;
    width: 96px;
    height: 96px;
    border-radius: 999px;
    background: #ffffff;
}

.radial-score span,
.radial-score small {
    position: relative;
    z-index: 1;
}

.radial-score span {
    align-self: end;
    color: #0f172a;
    font-size: 28px;
    font-weight: 900;
}

.radial-score small {
    align-self: start;
    color: #64748b;
    font-weight: 800;
}

.health-list,
.progress-list,
.priority-stack {
    display: grid;
    gap: 10px;
    padding: 16px;
}

.health-list {
    padding: 0;
}

.health-list p,
.progress-list p,
.priority-stack p {
    margin: 0;
}

.health-list p {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: #334155;
}

.health-list strong {
    color: #0f172a;
}

.progress-list p {
    display: grid;
    grid-template-columns: 74px 1fr 32px;
    align-items: center;
    gap: 10px;
    color: #334155;
    font-size: 12px;
}

.progress-list i,
.priority-stack i {
    height: 9px;
    border-radius: 999px;
    background: #e5eaf1;
    overflow: hidden;
}

.progress-list b,
.priority-stack i {
    display: block;
}

.progress-list b {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0b63ce, #60a5fa);
}

.priority-stack p {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding-bottom: 14px;
    color: #334155;
}

.priority-stack p i {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 7px;
}

.priority-stack p.blue i { background: #0b63ce; }
.priority-stack p.red i { background: #dc2626; }
.priority-stack p.purple i { background: #7c3aed; }

.priority-stack strong {
    color: #0f172a;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 14px;
}

.dash-panel {
    background: #ffffff;
    border: 1px solid #dce3ec;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(15, 23, 42, .07);
}

.dash-panel header {
    min-height: 42px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e5eaf1;
}

.dash-panel header a {
    color: #0b63ce;
    font-size: 12px;
}

.workflow-board {
    display: grid;
    grid-template-columns: repeat(7, minmax(130px, 1fr));
    gap: 8px;
    padding: 10px;
}

.workflow-column {
    display: grid;
    gap: 8px;
}

.workflow-head {
    height: 36px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    border-radius: 6px;
    color: #ffffff;
    font-weight: 800;
}

.workflow-column.blue .workflow-head { background: #0969da; }
.workflow-column.indigo .workflow-head { background: #3151ff; }
.workflow-column.orange .workflow-head { background: #ff6b00; }
.workflow-column.amber .workflow-head { background: #f2a900; }
.workflow-column.teal .workflow-head { background: #009688; }
.workflow-column.green .workflow-head { background: #5aae22; }
.workflow-column.slate .workflow-head { background: #64748b; }
.workflow-column.red .workflow-head { background: #dc2626; }

.job-card {
    min-height: 118px;
    display: grid;
    gap: 5px;
    padding: 10px;
    border: 1px solid #dce3ec;
    border-radius: 6px;
    background: #ffffff;
    color: #111827;
    box-shadow: 0 2px 5px rgba(15, 23, 42, .08);
}

.job-card b {
    color: #9a3412;
}

.job-card.empty-card {
    min-height: 72px;
    place-items: center;
    color: #64748b;
}

.job-card strong {
    font-size: 13px;
}

.job-card span,
.job-card small,
.job-card em {
    color: #334155;
    font-style: normal;
}

.workflow-column > a {
    text-align: center;
    color: #334155;
    font-size: 12px;
    padding: 6px;
}

.side-stack {
    display: grid;
    gap: 14px;
}

.compact-panel {
    padding-bottom: 10px;
}

.compact-panel p {
    margin: 0;
    padding: 8px 14px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: #334155;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
    margin-right: 8px;
}

.blue-dot { background: #2563eb; }
.red-dot { background: #ff2d2d; }
.orange-dot { background: #ff9500; }
.green-dot { background: #16a34a; }
.green-text { color: #16a34a; }

.sms-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 8px 14px 0;
}

.sms-actions button,
.sms-actions a {
    border: 0;
    border-radius: 5px;
    color: #ffffff;
    background: #0b63ce;
    padding: 9px;
    font-weight: 700;
    text-align: center;
}

.sms-actions button:nth-child(2),
.sms-actions a:nth-child(2) { background: #16a34a; }
.sms-actions button:nth-child(3),
.sms-actions a:nth-child(3) { grid-column: 1 / -1; background: #ff9500; }

.dashboard-lower {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 14px;
}

.intelligence-row {
    grid-template-columns: minmax(0, 1fr) minmax(320px, .7fr);
}

.table-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.table-controls span {
    border: 1px solid #dce3ec;
    border-radius: 4px;
    padding: 5px 10px;
    color: #334155;
    font-size: 12px;
}

.dash-table {
    width: 100%;
    border-collapse: collapse;
    color: #0f172a;
    font-size: 12px;
}

.dash-table th,
.dash-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #e5eaf1;
    text-align: left;
}

.dash-table th {
    color: #0f172a;
    font-weight: 800;
}

.dash-table a {
    color: #0b63ce;
}

.status-pill,
.pay-pill {
    border-radius: 5px;
    padding: 4px 7px;
    background: #dbeafe;
    color: #0b63ce;
    font-weight: 700;
}

.pay-pill.paid {
    background: #dcfce7;
    color: #15803d;
}

.pay-pill.unpaid {
    background: #fee2e2;
    color: #dc2626;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.chart-card {
    min-height: 205px;
    padding: 14px;
}

.chart-card h2 {
    margin-bottom: 12px;
}

.line-chart,
.bar-chart {
    height: 145px;
    display: flex;
    align-items: end;
    gap: 16px;
    padding: 12px;
    background: repeating-linear-gradient(to top, #edf2f7 0, #edf2f7 1px, transparent 1px, transparent 34px);
}

.line-chart span {
    flex: 1;
    border-radius: 999px 999px 0 0;
    background: linear-gradient(180deg, #0b63ce, #9dc7ff);
}

.bar-chart i,
.bar-chart b {
    width: 18px;
    border-radius: 3px 3px 0 0;
}

.bar-chart i {
    background: #16a34a;
}

.bar-chart b {
    background: #ff2d2d;
}

.donut {
    width: 150px;
    height: 150px;
    margin: 4px auto;
    border-radius: 999px;
    background: conic-gradient(#0b63ce 0 58%, #16a34a 58% 86%, #f2a900 86% 100%);
    display: grid;
    place-items: center;
    position: relative;
}

.donut::after {
    content: "";
    position: absolute;
    width: 96px;
    height: 96px;
    border-radius: 999px;
    background: #ffffff;
}

.donut strong,
.donut span {
    position: relative;
    z-index: 1;
}

.donut strong {
    font-size: 30px;
    align-self: end;
}

.donut span {
    align-self: start;
}

.bar-list p {
    display: grid;
    grid-template-columns: 120px 1fr 28px;
    align-items: center;
    gap: 10px;
    color: #334155;
}

.bar-list span {
    height: 5px;
    border-radius: 999px;
    background: #0b63ce;
}

@media (max-width: 980px) {
    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .sidebar-float-toggle,
    .dashboard-page.menu-open .sidebar-float-toggle {
        left: 0;
        top: 74px;
    }

    .grid.cols-4,
    .grid.cols-2,
    .finance-hero,
    .finance-summary-grid,
    .finance-two-column,
    .finance-mini-metrics,
    .finance-metric-list,
    .cash-ledger-summary,
    .stats-grid,
    .asset-flow,
    .asset-ops-grid,
    .asset-inline-form,
    .expense-category-layout,
    .expense-category-grid,
    .user-workspace,
    .form-grid,
    .purchase-order-line {
        grid-template-columns: 1fr;
    }

    .ticket-stopwatch-card {
        align-items: stretch;
        flex-direction: column;
    }

    .ticket-stopwatch-actions {
        justify-content: flex-start;
    }

    .topbar {
        padding: 14px 18px;
        align-items: flex-start;
        flex-direction: column;
    }

    .content {
        padding: 18px;
    }

    .metric-grid,
    .insight-strip,
    .advanced-grid,
    .dashboard-layout,
    .dashboard-lower,
    .chart-grid,
    .sms-target-grid,
    .whatsapp-inbox-layout,
    .whatsapp-chat-header,
    .workflow-board,
    .calendar-grid,
    .schedule-adjust-form {
        grid-template-columns: 1fr;
    }

    .whatsapp-mini-form,
    .whatsapp-mini-form:nth-child(2) {
        grid-template-columns: 1fr;
    }

    .checkbox-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero-actions {
        justify-content: flex-start;
    }

    .health-body {
        grid-template-columns: 1fr;
    }

    .dash-metric.wide {
        grid-column: auto;
    }

    .dashboard-topnav {
        flex-wrap: wrap;
    }

    .dashboard-search {
        width: 100%;
        order: 5;
    }

    .track-form {
        grid-template-columns: 1fr;
    }

    .insight-strip {
        position: static;
        top: auto;
    }
}

/* App-wide mobile compatibility pass */
@media (max-width: 980px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    .app {
        display: block;
        min-height: 100vh;
    }

    .sidebar {
        max-height: 48vh;
        overflow-y: auto;
        padding-bottom: 18px;
    }

    body.sidebar-collapsed .sidebar {
        display: none;
    }

    .main,
    .content,
    .card,
    .panel,
    .table-scroll,
    .table-wrap,
    .dashboard-layout,
    .dashboard-lower,
    .advanced-grid,
    .finance-workspace,
    .finance-main,
    .finance-panel,
    .expense-category-layout,
    .user-workspace,
    .form-grid,
    .settings-grid,
    .profile-grid {
        min-width: 0;
    }

    .content {
        width: 100%;
        padding: 16px;
    }

    .topbar,
    .panel-heading,
    .card-header,
    .section-header,
    .toolbar,
    .filters,
    .datatable-controls,
    .row-actions,
    .topbar-actions,
    .button-row,
    .form-actions,
    .finance-actions,
    .finance-date-form,
    .finance-inline-form,
    .finance-report-form,
    .search-form,
    .bulk-actions,
    .inline-form,
    .customer-actions,
    .ticket-actions {
        flex-wrap: wrap;
        gap: 10px;
    }

    .table-scroll,
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .card:has(> table),
    .panel:has(> table) {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table,
    table.table {
        min-width: 680px;
    }

    .stats-grid,
    .metric-grid,
    .insight-strip,
    .chart-grid,
    .asset-flow,
    .asset-ops-grid,
    .expense-category-grid,
    .finance-overview-grid,
    .finance-report-grid,
    .dashboard-cards,
    .settings-grid,
    .profile-grid,
    .quick-actions-grid,
    .summary-grid,
    .report-grid,
    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

@media (max-width: 760px) {
    .content {
        padding: 12px;
    }

    .card,
    .panel,
    .finance-panel,
    .dashboard-card,
    .metric-card,
    .stat-card {
        padding: 14px;
        border-radius: 8px;
    }

    .page-title,
    .content h1 {
        font-size: 24px;
        line-height: 1.15;
    }

    .content h2,
    .card h2,
    .panel h2 {
        font-size: 19px;
        line-height: 1.2;
    }

    .topbar,
    .panel-heading,
    .card-header,
    .section-header,
    .toolbar,
    .filters,
    .datatable-controls,
    .topbar-actions,
    .row-actions,
    .button-row,
    .form-actions,
    .finance-date-form,
    .finance-inline-form,
    .finance-report-form,
    .search-form,
    .bulk-actions,
    .inline-form {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-actions .button,
    .row-actions .button,
    .row-actions a,
    .row-actions button,
    .row-actions form,
    .button-row .button,
    .form-actions .button,
    .toolbar .button,
    .filters .button,
    .finance-actions .button,
    .bulk-actions .button,
    .search-form .button,
    .inline-form .button {
        width: 100%;
    }

    input,
    select,
    textarea,
    .input,
    .select,
    .button {
        max-width: 100%;
    }

    .form-grid,
    .finance-date-form,
    .finance-inline-form,
    .finance-report-form,
    .asset-inline-form,
    .schedule-adjust-form,
    .whatsapp-mini-form,
    .track-form,
    .purchase-order-line,
    .invoice-line,
    .quote-line,
    .sms-target-grid,
    .checkbox-grid,
    .calendar-grid,
    .workflow-board {
        grid-template-columns: 1fr;
    }

    .action-menu,
    .action-menu summary {
        width: 100%;
    }

    .action-form {
        left: auto;
        margin-top: 8px;
        max-width: none;
        position: static;
        right: auto;
        width: 100%;
    }

    .sidebar-float-toggle {
        left: 10px;
        top: 72px;
    }
}

@media (max-width: 520px) {
    .content {
        padding: 10px;
    }

    .table,
    table.table {
        min-width: 560px;
    }

    .stats-grid,
    .metric-grid,
    .insight-strip,
    .chart-grid,
    .asset-flow,
    .asset-ops-grid,
    .expense-category-grid,
    .finance-overview-grid,
    .finance-report-grid,
    .dashboard-cards,
    .settings-grid,
    .profile-grid,
    .quick-actions-grid,
    .summary-grid,
    .report-grid,
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .floating-whatsapp,
    .floating-call {
        right: 14px;
    }

    .floating-call {
        bottom: 88px;
    }

    .floating-whatsapp {
        bottom: 22px;
    }
}
