/* Shared workspace chrome. Permission-gated navigation remains server rendered. */
.dashboard-pagination { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding-top: 14px; margin-top: 12px; border-top: 1px solid #dce5ef; color: #475467; font-size: 13px; }
.dashboard-pagination[hidden] { display: none; }
.dashboard-pagination p { margin: 0; }
.dashboard-page-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.dashboard-page { display: inline-flex; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: #f4f7fb; color: #142d4e; text-decoration: none; font: inherit; cursor: pointer; }
.dashboard-page:hover { background: #e8eef6; }
.dashboard-page:is([aria-disabled="true"], :disabled) { color: #64748b; background: transparent; cursor: default; }
.dashboard-page-number { white-space: nowrap; }
.dashboard-list-heading { cursor: pointer; }
.dashboard-list-heading .section-title { display: inline; margin-right: 8px; }
.superadmin-workspace .superadmin-dashboard-panels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.superadmin-dashboard-panels > .card { min-width: 0; }
.recent-event-message { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.recent-event-time { display: block; color: #64748b; margin-top: 5px; }
@media (max-width: 1000px) { .superadmin-workspace .superadmin-dashboard-panels { grid-template-columns: minmax(0, 1fr); } }
body :is(.panel, .card, .account-create-card, .table-container, .table-wrapper, .form-section, .report-section, .customer-profile-card, .recent-purchases-card, .checkout-card, .checkout-summary, .cart-summary, .library-panel, .template-card) {
    border-color: #bdcfe3;
    box-shadow: 0 5px 18px rgb(25 61 105 / 10%);
}
body.admin-workspace .admin-sidebar,
body.customer-theme .sidebar {
    background: linear-gradient(150deg, rgb(222 240 255 / 87%), rgb(244 248 255 / 76%));
    backdrop-filter: blur(18px);
    border-right: 1px solid #bfd2e9;
    box-shadow: 4px 0 18px #244c7610;
}
body .workspace-icon-button,
body .admin-sidebar-logout .workspace-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 10px;
    border: 1px solid #bfd0e4;
    border-radius: 10px;
    background: #ffffffa8;
    color: #173958;
    cursor: pointer;
}
body .workspace-icon-button svg { width: 22px; height: 22px; flex: none; }
body .workspace-icon-button:hover { background: #dcecff; }
body .workspace-icon-button:focus-visible { outline: 3px solid #1683f5; outline-offset: 2px; }
body .admin-sidebar-logout .workspace-logout-icon,
body .workspace-logout-icon { color: #b42335; background: #fff4f4; border-color: #efc7cd; }
/* The handle straddles the edge; navigation lists keep their own scrolling. */
body.admin-workspace .admin-sidebar,
body.customer-theme .sidebar { overflow: visible; }
body.customer-theme .sidebar .navigation { min-height: 0; overflow-y: auto; flex: 1 1 auto; }
body .workspace-icon-button.sidebar-toggle {
    position: absolute;
    top: 74px;
    right: -14px;
    z-index: 3;
    width: 28px;
    height: 44px;
    min-height: 44px;
    padding: 4px;
    margin: 0;
    border: 2px solid #fff;
    border-radius: 16px;
    background: #f5f6fa;
    color: #273244;
    box-shadow: 0 2px 7px #18324e26;
}
body .workspace-icon-button.sidebar-toggle svg { width: 18px; height: 18px; }
html[data-sidebar-collapsed="true"] .sidebar-toggle svg { transform: rotate(180deg); }
body .workspace-icon-button.sidebar-toggle:hover { background: #e5edf7; }
#posNavigationContent .workspace-icon-button.sidebar-toggle { position: static; align-self: flex-end; margin-left: auto; }
.workspace-account-row { display: flex; align-items: center; gap: 6px; width: 100%; }
.workspace-account-name { min-width: 0; flex: 1; overflow-wrap: anywhere; font-size: 13px; }
.workspace-account-name small { display: block; color: #52657d; font-size: 12px; margin-top: 4px; }
.workspace-account-actions { display: flex; gap: 4px; flex: none; }
.workspace-account-actions form { margin: 0; }
#posApp .workspace-icon-button { background: #ffffffa8; color: #173958; }
#posApp .workspace-logout-icon { background: #fff4f4; color: #b42335; }
body.customer-theme .customer-account { display: block; padding: 12px 0; }
body.customer-theme .sidebar .brand { min-width: 0; }
.staff-workspace .workspace-pagination { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; margin: 22px 0 0; text-align: center; }
.pagination-summary { margin: 0; color: #425972; font-size: 14px; }
.pagination-pages { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; }
.pagination-pages :is(a, .pagination-current) { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 8px 12px; border-radius: 8px; }
.pagination-current { background: #1683f5; color: #fff; font-weight: 700; }
body.staff-workspace :is(.staff-recent-orders, .staff-all-transactions) .workspace-table thead th { background: #cfdeef; color: #203f63; border-color: #adc4df; }
.staff-workspace .field-error { color: #b42335; font-size: 12px; }
@media (min-width: 769px) {
    html[data-sidebar-collapsed="true"] body.admin-workspace { --admin-sidebar-width: 80px; }
    html[data-sidebar-collapsed="true"] body.customer-theme { --customer-sidebar: 80px; }
    html[data-sidebar-collapsed="true"] :is(.admin-sidebar, .customer-theme .sidebar) { padding-left: 10px; padding-right: 10px; }
    html[data-sidebar-collapsed="true"] :is(.admin-sidebar-name, .admin-sidebar-menu a span, .workspace-account-name, .customer-theme .brand > div, .customer-theme .nav-item > span, .customer-theme .sidebar-footer) { display: none; }
    html[data-sidebar-collapsed="true"] :is(.admin-sidebar-menu a, .customer-theme .nav-item) { justify-content: center; }
    html[data-sidebar-collapsed="true"] .admin-sidebar-logo { width: 42px; height: 42px; }
    html[data-sidebar-collapsed="true"] .admin-sidebar-brand a { padding: 0; justify-content: center; }
    html[data-sidebar-collapsed="true"] :is(.workspace-account-row, .workspace-account-actions) { flex-direction: column; }
}
@media (max-width: 768px) {
    body.admin-workspace .admin-sidebar,
    body.customer-theme .sidebar { position: relative; padding-top: 64px; }
    body .workspace-icon-button.sidebar-toggle { right: 12px; top: 12px; }
    body .admin-sidebar-brand, body.customer-theme .sidebar .brand { padding-right: 36px; }
    body.customer-theme .sidebar { display: flex; flex-direction: column; }
    body.customer-theme .customer-account { width: 100%; }
    html[data-sidebar-collapsed="true"] :is(.admin-sidebar-menu, .admin-sidebar-brand, .customer-theme .sidebar > .navigation, .customer-theme .sidebar > .brand, .customer-theme .sidebar-footer) { display: none; }
}
@media (min-width: 769px) and (max-width: 850px) {
    body.customer-theme .sidebar { position: relative; }
    body.customer-theme .workspace-icon-button.sidebar-toggle { right: 12px; top: 12px; }
}
/* A saved theme applies consistently across shared Admin, Staff and Customer pages. */
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] body { --ink: #e1eafb; --muted: #a9bad2; --line: #3b526d; --ui-border: #425d7b; --customer-ink: #e1eafb; --customer-muted: #a9bad2; --customer-line: #3b526d; background: #101a29; color: #e1eafb; }
html[data-theme="dark"] body :is(.workspace-main, .main, .main-content, .app, .customer-dashboard-main) { background: #101a29; color: #e1eafb; }
html[data-theme="dark"] :is(.workspace-main, .main, .main-content)::before,
html[data-theme="dark"] :is(.workspace-main, .main, .main-content)::after { opacity: .06; }
html[data-theme="dark"] body :is(.admin-sidebar, .customer-theme .sidebar) { background: linear-gradient(150deg, #193650ed, #17263be8); border-color: #425d7b; color: #e1eafb; }
html[data-theme="dark"] body :is(.panel, .card, .table-container, .table-wrapper, .account-create-card, .form-section, .report-section, .workspace-toolbar, .ui-metric, .customer-profile-card, .recent-purchases-card, .library-panel, .modal-content, .modal-box, .checkout-card, .checkout-summary, .cart-summary, .template-card) { background: #1a293d; border-color: #425d7b; color: #e1eafb; box-shadow: 0 5px 18px #0003; }
html[data-theme="dark"] body :is(h1, h2, h3, label, td, strong, .admin-sidebar-name, .workspace-account-name, .customer-details, .customer-theme .nav-item, .admin-sidebar a) { color: #e1eafb; }
html[data-theme="dark"] body :is(.muted, .sync-note, .workspace-heading p, .workspace-account-name small, .pagination-summary) { color: #a9bad2; }
html[data-theme="dark"] body :is(input, select, textarea, .workspace-clock) { background: #132236; color: #e1eafb; border-color: #536d8a; }
html[data-theme="dark"] body input::placeholder,
html[data-theme="dark"] body textarea::placeholder { color: #9eafc6; }
html[data-theme="dark"] body :is(th, .workspace-table thead th),
html[data-theme="dark"] body.staff-workspace :is(.staff-recent-orders, .staff-all-transactions) .workspace-table thead th { background: #29415e; color: #e1eafb; border-color: #536d8a; }
html[data-theme="dark"] body :is(td, .table-scroll, .cart-row) { border-color: #3b526d; }
html[data-theme="dark"] body tbody tr:nth-child(even) { background: #20344d; }
/* System logs use a white table surface in the light stylesheet. Cover both row stripes. */
html[data-theme="dark"] body #systemLogs .table { background: #1a293d; color: #e1eafb; }
html[data-theme="dark"] body #systemLogs tbody tr:nth-child(odd) { background: #1a293d; }
html[data-theme="dark"] body #systemLogs tbody tr:hover { background: #233b55; }
html[data-theme="dark"] body :is(.page-title p, #systemLogs .note) { color: #a9bad2; }
html[data-theme="dark"] body #systemLogs .log-pagination { border-color: #3b526d; }
html[data-theme="dark"] body #systemLogs .log-page { background: #22364e; border-color: #536d8a; color: #e1eafb; }
html[data-theme="dark"] body #systemLogs .log-page:hover { background: #294b70; }
html[data-theme="dark"] body #systemLogs .log-page.current { background: #294b70; border-color: #8bc6ff; }
html[data-theme="dark"] body #systemLogs .log-page.disabled { background: #132236; color: #a9bad2; }
html[data-theme="dark"] body #systemLogs .badge.info { background: #294b70; color: #c3e3ff; }
html[data-theme="dark"] body #systemLogs .badge.warning { background: #493c20; color: #ffdc89; }
html[data-theme="dark"] body #systemLogs .badge.danger { background: #552b36; color: #ffb5bd; }
html[data-theme="dark"] body .badge { background: #29415e; color: #e1eafb; }
html[data-theme="dark"] body :is(.datetime, .user-pill, .dashboard-page) { background: #29415e; color: #e1eafb; border-color: #536d8a; }
html[data-theme="dark"] body .dashboard-pagination { color: #a9bad2; border-color: #3b526d; }
html[data-theme="dark"] body .dashboard-page:hover { background: #233b55; }
html[data-theme="dark"] body .dashboard-page:is([aria-disabled="true"], :disabled) { color: #a9bad2; background: transparent; opacity: 1; }
html[data-theme="dark"] body.superadmin-workspace :is(.note, .recent-event-time, .ui-metric-hint) { color: #a9bad2; }
html[data-theme="dark"] body.superadmin-workspace .list li { color: #e1eafb; border-color: #3b526d; }
html[data-theme="dark"] body.superadmin-workspace :is(.table, .modal-panel, .permission-cell, .module-link) { background: #1a293d; color: #e1eafb; border-color: #425d7b; }
html[data-theme="dark"] body.superadmin-workspace .badge.success { background: #204535; color: #94e6b3; }
html[data-theme="dark"] body.superadmin-workspace .badge.warning { background: #493c20; color: #ffdc89; }
html[data-theme="dark"] body.superadmin-workspace .badge.danger { background: #552b36; color: #ffb5bd; }
html[data-theme="dark"] body.superadmin-workspace .badge.info { background: #294b70; color: #c3e3ff; }
html[data-theme="dark"] body :is(a, .workspace-main a) { color: #8bc6ff; }
html[data-theme="dark"] body :is(.secondary, .ui-back, .customer-action, .workspace-icon-button),
html[data-theme="dark"] .admin-sidebar-logout .workspace-icon-button { background: #22364e; border-color: #536d8a; color: #e1eafb; }
html[data-theme="dark"] body .workspace-icon-button.sidebar-toggle { background: #22364e; border-color: #425d7b; color: #e1eafb; }
html[data-theme="dark"] body :is(.admin-sidebar-menu .active a, .customer-theme .nav-item.active) { background: #294b70; color: #a9d7ff; }
html[data-theme="dark"] body :is(.admin-sidebar a:hover, .nav-item:hover, tbody tr:hover) { background: #233b55; }
html[data-theme="dark"] #posApp { --ink: #e1eafb; --muted: #a9bad2; --line: #425d7b; }
html[data-theme="dark"] #posApp :is(.catalog-card, .pos-tabs, .pos-step-actions, .pos-mobile-dialog, .delivery-map-dialog, .pos-mobile-tools, .quantity-controls button) { background: #1a293d; color: #e1eafb; border-color: #425d7b; }
html[data-theme="dark"] #posApp :is(.product-symbol, .cart-product-picture, .grand-total) { background: #29415e; color: #e1eafb; }
html[data-theme="dark"] #posApp .grand-total strong { color: #e1eafb; }
html[data-theme="dark"] #posApp .workspace-icon-button { background: #22364e; color: #e1eafb; }
html[data-theme="dark"] #posApp .pos-tabs [aria-selected="true"] { background: #69551e; border-color: #f4cf55; color: #fff3cc; }
html[data-theme="dark"] #posApp .pos-tabs [aria-selected="true"] :is(span, strong) { color: inherit; }
/* Staff components need enough specificity to override their light page styles. */
@media screen {
    html[data-theme="dark"] body.staff-workspace .workspace-main .workspace-table th { background: #29415e; color: #e1eafb; border-color: #536d8a; }
    html[data-theme="dark"] body.staff-workspace .workspace-main .workspace-table tbody tr:hover { background: #233b55; }
    html[data-theme="dark"] body.staff-workspace .workspace-main :is(.customer-action, .secondary, .ui-back, .workspace-search) { background: #22364e; color: #e1eafb; border-color: #536d8a; }
    html[data-theme="dark"] body.staff-workspace .workspace-main :is(.customer-action, .secondary, .ui-back):hover { background: #294b70; border-color: #8bc6ff; }
    html[data-theme="dark"] body.staff-workspace .workspace-main :focus-visible { outline-color: #8bc6ff; }
    html[data-theme="dark"] body.staff-workspace .workspace-main :is(.badge, .inventory-alerts-count) { background: #29415e; color: #e1eafb; border-color: #536d8a; }
    html[data-theme="dark"] body.staff-workspace .workspace-main :is(.badge.good, .notice.success) { background: #204535; color: #94e6b3; }
    html[data-theme="dark"] body.staff-workspace .workspace-main :is(.badge.low, .is-low-stock .inventory-alert-status) { background: #493c20; color: #ffdc89; }
    html[data-theme="dark"] body.staff-workspace .workspace-main :is(.badge.out, .notice.error, button.danger, .is-out-of-stock .inventory-alert-status) { background: #552b36; color: #ffb5bd; border-color: #995563; }
    html[data-theme="dark"] body.staff-workspace .workspace-main :is(.field-error, .is-out-of-stock .inventory-alert-icon) { color: #ffb5bd; }
    html[data-theme="dark"] body.staff-workspace .workspace-main .is-low-stock .inventory-alert-icon { color: #ffdc89; }
    html[data-theme="dark"] body.staff-workspace .workspace-main .inventory-alert-empty { color: #94e6b3; }
    html[data-theme="dark"] body.staff-workspace .workspace-main .inventory-alert-product { color: #e1eafb; text-decoration-color: #8bc6ff; }
    html[data-theme="dark"] body.staff-workspace .workspace-main .inventory-alert-quantity,
    html[data-theme="dark"] body.staff-workspace .customer-directory .workspace-table td[data-label]::before { color: #a9bad2; }
    html[data-theme="dark"] body.staff-workspace .workspace-main :is(.inventory-alert-item, .inventory-alerts-footer, .customer-directory tbody tr) { border-color: #3b526d; }
    html[data-theme="dark"] #posApp .catalog-card:hover { background: #233b55; }
    html[data-theme="dark"] #posApp .catalog-card.is-unavailable { background: #352b3b; }
    html[data-theme="dark"] #posApp input[readonly] { background: #22364e; color: #a9bad2; }
    html[data-theme="dark"] #posApp :is(.field-error, .cart-row .remove-item) { color: #ffb5bd; }
    html[data-theme="dark"] #posApp [aria-invalid="true"] { border-color: #ffb5bd; }
    html[data-theme="dark"] #posApp .stock-badge.in-stock { background: #204535; color: #94e6b3; }
    html[data-theme="dark"] #posApp .stock-badge.out-of-stock { background: #552b36; color: #ffb5bd; }
    html[data-theme="dark"] #posApp .item-discount summary { color: #a9bad2; }
    html[data-theme="dark"] #posApp .checkout-actions .ui-back { background: #22364e; color: #e1eafb; border-color: #536d8a; }
    html[data-theme="dark"] #posApp #discountTotal { color: #94e6b3; }
}
@media print {
    .workspace-account-actions, .sidebar-toggle { display: none !important; }
}
