.card {
    /* Solid pearl-white with a glass EDGE (rim + One Sun shadow) but no
       backdrop-filter -- cards repeat many-per-page, so keeping them off the
       blur budget (max 3 concurrent blur layers) is deliberate. */
    background: var(--bg-surface);
    border: var(--glass-rim);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft), var(--rim-light);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md), var(--rim-light);
}

/* Vertical rhythm between stacked cards */
.card + .card { margin-top: var(--space-6); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-title {
    font-size: var(--text-base);
    font-weight: 600;
}

.card-subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: var(--text-base);
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    white-space: nowrap;
    min-height: var(--touch-target);
    cursor: pointer;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--accent);
    color: var(--text-on-accent);
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
}

.btn-success {
    background: var(--green);
    color: white;
}

.btn-success:hover {
    background: var(--green-light);
}

.btn-danger {
    background: var(--red);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-dark);
}

.btn-outline-danger {
    background: transparent;
    color: var(--red);
    border: 1px solid rgba(var(--red-rgb), 0.5);
}

.btn-outline-danger:hover {
    background: var(--red-tint);
    border-color: var(--red);
}

.btn-warning {
    background: var(--warning);
    color: #1a1200;
}

.btn-warning:hover {
    background: #d48a20;
}

.btn-info {
    background: var(--blue);
    color: white;
}

.btn-info:hover {
    background: #4a7bbf;
}

.btn:active:not(:disabled) {
    transform: scale(0.97);
    transition: transform 0.06s ease;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: var(--touch-target);
    height: var(--touch-target);
    min-width: var(--touch-target);
    min-height: var(--touch-target);
    padding: 0;
    border-radius: var(--radius-md);
}

.stat-card {
    background: var(--bg-surface);
    border: var(--glass-rim);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: var(--shadow-soft), var(--rim-light);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md), var(--rim-light);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.revenue {
    background: rgba(var(--gold-rgb), 0.2);
    color: var(--gold);
}

.stat-icon.orders {
    background: rgba(var(--blue-rgb), 0.14);
    color: var(--accent);
}

.stat-icon.profit {
    background: rgba(var(--green-rgb), 0.2);
    color: var(--success);
}

.stat-icon.session {
    background: rgba(var(--blue-rgb), 0.2);
    color: var(--info);
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: var(--text-3xl);
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.stat-trend {
    font-size: var(--text-xs);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-trend.up {
    color: var(--success);
}

.stat-trend.down {
    color: var(--danger);
}

.input-group {
    margin-bottom: 16px;
}

.input-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-base);
    min-height: var(--touch-target);
    transition: border-color 0.15s ease;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-input);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.input.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(var(--red-rgb), 0.15);
}

.input::placeholder {
    color: var(--text-muted);
}

.input-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

select.input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

textarea.input {
    min-height: 80px;
    resize: vertical;
}

.table-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 16px;
    text-align: left;
}

.table th {
    background: var(--bg-tertiary);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.table td {
    border-bottom: 1px solid var(--border);
    font-size: var(--text-base);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tbody tr:nth-child(even) td {
    background: rgba(15, 23, 42, 0.02);
}

.table tbody tr {
    transition: background 120ms ease-out;
}

.table tbody tr:hover td {
    background: rgba(var(--blue-rgb), 0.05);
}

.table td.actions {
    white-space: nowrap;
    vertical-align: middle;
}
.table-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.table th.actions-head {
    text-align: right;
}
.table td.actions {
    text-align: right;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: var(--radius-sm);
}

.badge-success {
    background: rgba(var(--green-rgb), 0.2);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.16);
    color: var(--warning);
}

.badge-danger {
    background: rgba(var(--red-rgb), 0.14);
    color: var(--danger);
}

.badge-info {
    background: rgba(var(--blue-rgb), 0.12);
    color: var(--info);
}

.badge-secondary {
    background: rgba(71, 85, 105, 0.12);
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: var(--text-lg);
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p {
    margin-bottom: 20px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    padding: 16px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    /* Glass modal -- one of the three blur-budget surfaces (overlays) */
    background: var(--glass-elevated);
    backdrop-filter: blur(var(--blur-overlay)) saturate(1.5);
    -webkit-backdrop-filter: blur(var(--blur-overlay)) saturate(1.5);
    border: var(--glass-rim);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg), var(--glass-rim-inset);
    transform: scale(0.95);
    transition: transform 0.2s ease;
    opacity: 0;
}

.modal-overlay.active .modal {
    transform: scale(1);
    opacity: 1;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: var(--text-lg);
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
}

.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    background: var(--glass-elevated);
    backdrop-filter: blur(var(--blur-card));
    -webkit-backdrop-filter: blur(var(--blur-card));
    border: var(--glass-rim);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md), var(--glass-rim-inset);
    animation: toastIn 0.25s ease;
    min-width: 280px;
    max-width: 420px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info    { border-left: 3px solid var(--info); }

@keyframes toastIn {
    from {
        transform: translateX(110%) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

.toast.removing {
    animation: toastOut 0.22s ease-in forwards;
}

@keyframes toastOut {
    to {
        transform: translateX(110%) scale(0.9);
        opacity: 0;
    }
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: var(--success);
}

.toast.error .toast-icon {
    color: var(--danger);
}

.toast.warning .toast-icon {
    color: var(--warning);
}

.toast.info .toast-icon {
    color: var(--info);
}

.toast-message {
    flex: 1;
    font-size: var(--text-base);
}

.toast-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.search-bar {
    position: relative;
}

.search-bar svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--accent);
}

.search-bar .input {
    padding-left: 44px;
    border-radius: 14px;
    border: 2px solid var(--border);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-bar .input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--gold-rgb), 0.2);
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 6px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.quantity-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--text-secondary);
    transition: var(--transition-fast);
    background: rgba(0, 0, 0, 0.05);
}

.quantity-btn:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.1);
}

.quantity-value {
    min-width: 36px;
    text-align: center;
    font-weight: 700;
    font-size: var(--text-base);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

.product-card {
    background: linear-gradient(145deg, var(--bg-tertiary) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    width: 100%;
}

.product-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(var(--gold-rgb), 0.25);
}

.product-card:active {
    transform: scale(0.96) translateY(-2px);
}

.product-card.out-of-stock {
    opacity: 0.5;
    pointer-events: none;
}

.product-card-compact {
    padding: 12px 8px;
    background: linear-gradient(145deg, rgba(var(--gold-rgb), 0.15) 0%, rgba(var(--gold-rgb), 0.05) 100%);
    border-color: rgba(var(--gold-rgb), 0.3);
}

.product-card-compact .product-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.favorite-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    opacity: 0.8;
    transition: var(--transition-fast);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.favorite-btn:hover,
.favorite-btn.active {
    opacity: 1;
    transform: scale(1.15);
}

.product-image {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
    display: block;
}

.product-emoji-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.product-name {
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent-secondary);
}

.session-banner {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.session-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.session-id {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);
}

.session-timer {
    font-family: var(--font-mono);
    font-size: var(--text-xl);
    font-weight: 600;
}

.session-cash {
    text-align: right;
}

.session-cash-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.session-cash-value {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-secondary);
}

/* Vertical bar chart (reports) — canonical definition; the dashboard's
   horizontal chart is .ds-barchart in design-system.css. An older
   duplicate of these rules further down this file was removed. */
.chart-container {
    height: 260px;
    position: relative;
    padding: 8px 0 0;
}

.bar-chart {
    display: flex;
    height: 100%;
    align-items: flex-end;
    gap: 8px;
    padding: 0 8px 8px;
}

.bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    max-width: none;
    height: 100%;
    gap: 4px;
}

.bar {
    width: 100%;
    background: linear-gradient(180deg, var(--accent), rgba(var(--gold-rgb), 0.5));
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height 0.5s ease-out;
}

.bar-label {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.bar-value {
    font-size: 12px;
    font-weight: 600;
}

.recent-orders {
    max-height: 300px;
    overflow-y: auto;
}

.recent-order-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.recent-order-item:last-child {
    border-bottom: none;
}

.recent-order-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.recent-order-id {
    font-family: var(--font-mono);
    font-size: 13px;
}

.recent-order-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.recent-order-total {
    font-family: var(--font-mono);
    font-weight: 600;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    transition: var(--transition-fast);
}

.quick-action-btn:hover {
    border-color: var(--border-strong);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-md);
}

.quick-action-btn svg {
    width: 32px;
    height: 32px;
    color: var(--accent);
}

.quick-action-btn span {
    font-weight: 500;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.tables-overview .card {
    margin-top: 24px;
}

.tables-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.table-btn {
    width: 80px;
    text-align: center;
}

.table-btn.available:hover {
    border-color: var(--success);
    transform: translateY(-2px);
}

.table-btn.occupied {
    cursor: pointer;
}

.table-btn.occupied:hover {
    transform: scale(1.05);
}

.pos-right .order-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 8px;
}

.pos-right .order-actions .btn {
    padding: 10px 8px;
}

.pos-right .order-actions .btn svg {
    width: 18px;
    height: 18px;
}

.client-option:hover {
    background: var(--bg-tertiary);
}

.pos-client-card {
    padding: 0px 12px 14px;
}

#modal .btn[data-modal-table] {
    min-height: 50px;
    font-size: 16px;
    font-weight: 600;
}

.modal-btn-quicksale:hover,
.modal-btn-table:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.order-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(145deg, var(--bg-tertiary) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 2px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    min-width: max-content;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.order-tab:hover {
    background: linear-gradient(145deg, rgba(var(--gold-rgb), 0.15) 0%, rgba(var(--gold-rgb), 0.08) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.order-tab.active {
    background: linear-gradient(145deg, rgba(var(--gold-rgb), 0.3) 0%, rgba(var(--gold-rgb), 0.15) 100%);
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(var(--gold-rgb), 0.3);
}

.order-tab-label {
    font-weight: 700;
    font-size: 12px;
    color: var(--text-primary);
}

.order-tab-total {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
}

.order-tab-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: var(--text-secondary);
    transition: var(--transition-fast);
    margin-left: 4px;
    background: rgba(0, 0, 0, 0.1);
}

.order-tab-close:hover {
    background: var(--danger);
    color: white;
}

.pos-main {
    min-height: 0;
}

.pos-right {
    min-height: 0;
}

.table-status-item:hover {
    transform: scale(1.05);
    border-color: var(--accent);
}

.tables-overview {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: var(--z-fab);
}

.tables-overview .btn {
    box-shadow: var(--shadow-lg);
}

.tables-overview .btn:hover {
    transform: scale(1.1);
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .pos-main {
        grid-template-columns: 1fr !important;
    }

    .order-tab-total {
        display: none;
    }

    .card + .card { margin-top: var(--space-4); }

    .page-content .card { padding: var(--space-4); }
}

#langToggleBtn {
    font-weight: 600;
    min-width: 50px;
}

#langToggleBtn span {
    margin-left: 4px;
}

body[dir="rtl"] #langToggleBtn span {
    margin-left: 0;
    margin-right: 4px;
}

body[dir="rtl"] .tabs {
    direction: rtl;
}

body[dir="rtl"] .tabs .tab {
    direction: rtl;
}

body[dir="rtl"] .product-card {
    direction: rtl;
}

body[dir="rtl"] .order-item {
    direction: rtl;
}

body[dir="rtl"] .order-tabs-container {
    direction: rtl;
}

.tabs {
    display: flex;
    gap: 6px;
    background: linear-gradient(180deg, var(--bg-tertiary) 0%, rgba(0, 0, 0, 0.1) 100%);
    padding: 6px;
    border-radius: 16px;
    margin-bottom: 12px;
    overflow-x: auto;
    flex-wrap: nowrap;
    border: 1px solid var(--border);
}

.tabs::-webkit-scrollbar {
    height: 4px;
}

.tabs::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 2px;
}

.tab {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 12px;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    background: transparent;
}

.tab:hover {
    background: rgba(var(--gold-rgb), 0.15);
    color: var(--text-primary);
}

.tab.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(var(--gold-rgb), 0.4);
}

/* ── Global polish additions ───────────────────────────────── */

/* Card hover elevation */
.card {
    transition: box-shadow var(--transition-fast);
}

/* Badge sizing consistency */
.badge {
    padding: 3px 10px 4px;
    line-height: 1.4;
    letter-spacing: 0.2px;
}

/* Product card in components context */
.product-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

/* Quantity control — cleaner hit area */
.quantity-btn {
    min-width: 28px;
    min-height: 28px;
}

/* Empty state icon opacity */
.empty-state svg {
    opacity: 0.35;
}

/* Selection state for client-option rows */
.client-option:hover {
    background: rgba(var(--gold-rgb), 0.08);
}

/* ── Client card (replaces inline styles in clients.js) ─────────── */
.client-card-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    text-align: center;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.client-card-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
.client-card-avatar-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}
.client-card-avatar-img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}
.client-card-avatar-initials {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--text-2xl);
    border: 2px solid var(--border);
}
.client-card-name {
    font-weight: 600;
    font-size: var(--text-base);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.client-card-phone {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-bottom: 2px;
}
.client-card-discount {
    font-size: var(--text-xs);
    color: var(--success);
    font-weight: 600;
    margin-bottom: 4px;
}
.client-card-chips {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 8px;
}
.client-card-chip {
    font-size: var(--text-xs);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}
.client-card-chip.debt {
    background: rgba(212, 86, 74, 0.12);
    color: var(--danger);
}
.client-card-chip.credit {
    background: rgba(46, 204, 113, 0.12);
    color: var(--success);
}
.client-card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
}
.client-card-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: background 0.15s ease, color 0.15s ease;
}
.client-card-action-btn:hover {
    background: var(--accent);
    color: var(--text-primary);
}
.client-card-action-btn.delete:hover {
    background: var(--danger);
    color: var(--text-primary);
}

.client-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    padding: 16px;
}

.client-photo-upload {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}
.client-photo-preview {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
}
.client-photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.client-photo-placeholder {
    color: var(--text-muted);
}
.client-photo-hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: 4px;
}
.client-discount-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.client-discount-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}
.client-discount-toggle > span {
    font-weight: 600;
}
.client-discount-active {
    margin-left: auto;
    font-size: var(--text-xs);
    color: var(--success);
    font-weight: 700;
}

.order-tab.reorder-mode {
    border-color: var(--info) !important;
    background: rgba(var(--info-rgb), 0.2) !important;
    cursor: grab;
}

.order-tab.drag-over {
    border-color: var(--info) !important;
    background: rgba(var(--info-rgb), 0.3) !important;
    transform: scale(1.03);
}

.order-tab.dragging { opacity: 0.45; }

.order-tab-printed {
    display: flex;
    align-items: center;
    color: var(--info);
    opacity: 0.9;
    flex-shrink: 0;
}

.tab-color-popover {
    animation: fadeInDown 0.12s ease-out;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Pos discount btn ─────────────────────────────────────── */
.pos-discount-btn {
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition-fast);
    border-radius: var(--radius-sm);
}

.pos-discount-btn:hover { filter: brightness(1.15); }

/* ── Collect debt btn accent ──────────────────────────────── */
#collectDebtBtn {
    border-color: rgba(212, 86, 74, 0.35);
    color: var(--danger);
}

#collectDebtBtn:hover {
    background: rgba(212, 86, 74, 0.15);
    border-color: var(--danger);
    color: var(--danger);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    background: var(--accent);
    color: white;
}



.image-option:hover {
    border-color: var(--accent) !important;
    transform: scale(1.05);
}

.gallery-image-item:hover {
    border-color: var(--accent) !important;
    transform: scale(1.05);
}

.client-block {
    transition: transform 0.15s, box-shadow 0.15s;
}
.client-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.client-card-action {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: background 0.15s, color 0.15s;
}
.client-card-action:hover {
    background: var(--accent);
    color: white;
}

.session-order-item {
    transition: background 0.15s;
}
.session-order-item:hover {
    background: var(--bg-tertiary);
}

/* ============================================
   v2 DESIGN OVERRIDES — tighter, modern
   ============================================ */

/* Page wrapper */
.page-content { padding: 20px 24px; }

/* Cards */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    padding: 16px;
}
.card-header {
    padding: 0 0 12px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-title {
    font-size: var(--text-md);
    font-weight: var(--fw-semibold);
    color: var(--text-primary);
    letter-spacing: 0.01em;
    margin: 0;
}

/* Session banner -- clean glass card; the only ambient warmth comes from
   the LUMINA daylight canvas behind it, not a page-local beige gradient. */
.session-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-surface);
    border: var(--glass-rim);
    box-shadow: var(--shadow-soft), var(--rim-light);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
}
.session-banner h3 {
    font-size: var(--text-lg);
    font-weight: var(--fw-semibold);
    margin: 0 0 2px 0;
}
.session-banner p { font-size: var(--text-md); color: var(--text-secondary); margin: 0; }

/* Stat cards — compact */
.stat-card {
    padding: 14px 16px;
    gap: 12px;
    align-items: center;
    background: var(--bg-surface);
    border-radius: 10px;
}
.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}
.stat-icon svg { width: 18px; height: 18px; }
.stat-value {
    font-size: var(--text-xl);
    font-weight: var(--fw-semibold);
    line-height: 1.1;
    letter-spacing: -0.01em;
    margin-bottom: 2px;
}
.stat-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}
.stat-trend {
    font-size: var(--text-xs);
    margin-top: 4px;
}

/* Grids tighter */
.grid { gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Recent orders denser */
.recent-orders { max-height: 320px; }
.recent-order-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-default);
}
.recent-order-id {
    font-family: var(--font-mono);
    font-size: var(--text-md);
    font-weight: var(--fw-medium);
    color: var(--text-primary);
}
.recent-order-time {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}
.recent-order-total {
    font-family: var(--font-mono);
    font-size: var(--text-md);
    font-weight: var(--fw-semibold);
    color: var(--accent);
}

/* (Removed duplicate .chart-container/.bar-chart/.bar-item/.bar block —
   canonical definition now lives with the first set above.) */

/* Quick actions — row layout, compact */
.quick-actions {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}
.quick-action-btn {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    text-align: left;
}
.quick-action-btn svg {
    width: 18px;
    height: 18px;
    color: var(--accent);
    flex-shrink: 0;
}
.quick-action-btn span {
    font-size: var(--text-md);
    font-weight: var(--fw-medium);
}

/* Tables */
.table { font-size: var(--text-md); }
.table th {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    font-weight: var(--fw-medium);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-default);
}
.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-default);
}

/* Inputs */
.input {
    font-size: var(--text-md);
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
}
.input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* Buttons */
.btn {
    font-size: var(--text-md);
    font-weight: var(--fw-medium);
    padding: 8px 14px;
    border-radius: 8px;
}
.btn-sm { font-size: var(--text-sm); padding: 6px 10px; }
.btn-lg { font-size: var(--text-base); padding: 10px 16px; }

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-tertiary);
    border-radius: 10px;
}
.tab {
    flex: 1;
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--text-md);
    font-weight: var(--fw-medium);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.tab:hover { color: var(--text-primary); }
.tab.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Sidebar — collapsed footer fixes */
.sidebar.collapsed .sidebar-footer #sidebarLogout {
    font-size: 0;
    padding: 8px;
    width: 32px;
    height: 32px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar.collapsed .sidebar-footer #sidebarLogout::before {
    content: "⏻";
    font-size: 16px;
}
.sidebar.collapsed .sidebar-footer { padding: 8px 4px; }
.sidebar.collapsed .user-badge { justify-content: center; padding: 6px 0; }

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sidebar:not(.collapsed) .sidebar-footer #sidebarLogout {
    width: 100%;
}

/* Section labels in sidebar */
.nav-section-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-hint);
    padding: 12px 14px 6px;
    font-weight: var(--fw-medium);
}

/* ============================================
   MOTION / UX — GPU-only, low-cost animations
   ============================================ */

:root {
    --ease-out: cubic-bezier(0.2, 0.7, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.3, 0.64, 1);
    --dur-fast: 120ms;
    --dur-mid: 180ms;
}

/* Button press feedback — universal. NO will-change on bulk items (cards/order-items)
   because that keeps GPU layers permanently allocated and tanks low-spec POS. */
.btn,
.pos-action-btn,
.payment-method-btn,
.quick-cash-btn,
.qty-btn,
.icon-btn,
.tab,
.nav-item,
.quick-action-btn,
.stat-card {
    transition: transform var(--dur-fast) var(--ease-out),
                background-color var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out),
                opacity var(--dur-fast) var(--ease-out);
}
.pos-product-card,
.pos-order-item {
    transition: transform var(--dur-fast) var(--ease-out),
                background-color var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out);
}

.btn:active:not(:disabled),
.pos-action-btn:active:not(:disabled),
.payment-method-btn:active,
.quick-cash-btn:active,
.qty-btn:active,
.icon-btn:active {
    transform: scale(0.96);
    transition-duration: 60ms;
}

.pos-product-card:active:not(.disabled) {
    transform: scale(0.97);
    transition-duration: 60ms;
}

/* Hover lift (only on devices that support hover) */
@media (hover: hover) {
    .quick-action-btn:hover,
    .stat-card:hover {
        transform: translateY(-1px);
    }
}

/* Order item entry animation removed — was running on every re-render and lagged tab switches.
   The flash-highlight class (added only on actual addToOrder) gives the same feel without the cost. */

/* Modal fade-scale */
@keyframes modal-in {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}
.modal-overlay.active .modal {
    animation: modal-in 180ms var(--ease-spring);
}
.modal-overlay {
    transition: opacity var(--dur-mid) var(--ease-out);
}

/* Toast slide-in from bottom */
@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 12px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}
.toast {
    animation: toast-in 180ms var(--ease-spring);
}

/* Page content fade-in on route change — only for non-POS pages.
   POS re-renders heavily during tab switches; animating every child caused lag. */
@keyframes page-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
body:not([data-page="pos"]) .page-content > * {
    animation: page-in 200ms var(--ease-out);
}

/* Tab content swap fade for finance/invoice hubs only */
[id$="HubBody"],
#invTabBody,
#financeHubBody {
    animation: page-in 160ms var(--ease-out);
}

/* Qty number micro-bounce on change */
@keyframes qty-bump {
    0% { transform: scale(1); }
    40% { transform: scale(1.18); }
    100% { transform: scale(1); }
}
.qty-value.bump { animation: qty-bump 200ms var(--ease-spring); }

/* Disabled state smooth fade */
button:disabled,
.btn:disabled,
.pos-action-btn:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

/* Sidebar item slight slide on active */
.nav-item.active { transform: translateX(0); }
.nav-item { transform: translateX(0); }
@media (hover: hover) {
    .nav-item:hover:not(.active) { transform: translateX(2px); }
}

/* Focus ring smooth */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    transition: outline-offset 80ms var(--ease-out);
}

/* Spinner — for async ops */
@keyframes spin {
    to { transform: rotate(360deg); }
}
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 700ms linear infinite;
    display: inline-block;
    vertical-align: middle;
}

/* Skeleton shimmer for loading states */
@keyframes skeleton {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 0%, rgba(255,255,255,0.04) 50%, var(--bg-tertiary) 100%);
    background-size: 200px 100%;
    background-repeat: no-repeat;
    animation: skeleton 1.2s linear infinite;
    border-radius: 6px;
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 1ms !important;
        transition-duration: 1ms !important;
    }
}

/* ============================================
   v2 SPACING — vertical rhythm + top bar
   ============================================ */

/* Top bar — tighter, balanced */
.top-bar {
    padding: 0 24px;
    height: 56px;
    gap: 16px;
}
.top-bar .page-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.top-bar .page-title h1 {
    font-size: var(--text-xl);
    font-weight: var(--fw-semibold);
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin: 0;
}
.top-bar .page-subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.2;
}
.top-bar-actions { gap: 10px; }
.top-bar-actions .datetime {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}
.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}
.icon-btn svg { width: 16px; height: 16px; }

/* Page content padding consistent */
.page-content { padding: 20px 24px 32px; }

/* Vertical rhythm — replace inline margin-bottom:24 / margin-top:24 */
.dashboard-page > * + *,
.invoice-scanner-page > * + *,
.finance-hub-page > * + *,
.invoice-hub-page > * + *,
.inventory-page > * + *,
.recipes-page > * + *,
.cost-control-page > * + *,
.finance-page > * + *,
.ap-page > * + *,
.alerts-page > * + * {
    margin-top: 16px;
}

/* Cancel old big margins */
.mb-24 { margin-bottom: var(--space-6); }
.mt-24 { margin-top: var(--space-6); }
.mb-16 { margin-bottom: var(--space-4); }

/* Session banner spacing */
.session-banner { margin-bottom: 0; padding: 14px 18px; }
.session-banner h3 { font-size: var(--text-md); }
.session-banner p { font-size: var(--text-sm); margin-top: 2px; }

/* Card header tighter */
.card-header {
    padding: 0 0 10px 0;
    margin-bottom: 12px;
}

/* Grids — uniform gap */
.grid { gap: 12px; }
.grid-4 { gap: 12px; }
.grid-3 { gap: 12px; }
.grid-2 { gap: 14px; }

/* Stat card row — slightly tighter */
.stat-card { padding: 12px 14px; }

/* Quick actions card padding */
.quick-actions { padding: 4px 0; }

/* Recent order row spacing */
.recent-order-item { padding: 8px 0; }

/* Logo spacing fix when expanded */
.sidebar:not(.collapsed) .sidebar-header {
    padding: 10px 14px;
}

/* ============================================
   v3 UNIVERSAL CARD SPACING — applies everywhere
   ============================================ */

/* Reset inline-driven gaps on .grid containers — enforce token */
.page-content .grid,
.page-content .grid-2,
.page-content .grid-3,
.page-content .grid-4 {
    gap: var(--space-4);
}

/* Reset margin spam on cards inside pages */
.page-content .card {
    margin: 0;
}

/* Restore vertical gap between stacked cards — higher specificity (0,3,0)
   so it beats the .page-content .card { margin:0 } reset above, which was
   silently killing the .card + .card owl and the .mt-24 utility. */
.page-content .card + .card {
    margin-top: var(--space-6);
}

/* Universal vertical rhythm between top-level siblings in any page.
   Selectors are .page-content-scoped so their specificity (0,2,0) beats the
   .page-content .card { margin:0 } and .page-content .mb-* { margin-bottom:0 }
   resets by source order — otherwise stacked sections (grids, cards, filter
   bars) collapse to a 0px gap and touch. Gap matches the card spacing. */
.page-content > div > * + *,
.page-content > section > * + *,
.page-content .dashboard-page > * + *,
.page-content .invoice-scanner-page > * + *,
.page-content .finance-hub-page > * + *,
.page-content .invoice-hub-page > * + *,
.page-content .inventory-page > * + *,
.page-content .recipes-page > * + *,
.page-content .cost-control-page > * + *,
.page-content .finance-page > * + *,
.page-content .ap-page > * + *,
.page-content .alerts-page > * + *,
.page-content .clients-page > * + *,
.page-content .orders-page > * + *,
.page-content .sessions-page > * + *,
.page-content .products-page > * + *,
.page-content .accounting-page > * + *,
.page-content .reports-page > * + *,
.page-content .settings-page > * + * {
    margin-top: var(--space-6);
}

/* D4: Products + Inventory filter toolbars share one 44px row */
.catalog-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--ds-space-2);
}
.catalog-toolbar .search-bar .input,
.catalog-toolbar .input,
.catalog-toolbar .btn {
    box-sizing: border-box;
    height: var(--touch-target);
    min-height: var(--touch-target);
}
.catalog-toolbar .input {
    width: auto;
    min-width: 150px;
}

/* D5: tighter field stacks on Settings and Team */
.settings-page .form-row {
    gap: var(--ds-space-2);
}
.settings-page .input-group {
    margin-bottom: var(--ds-space-2);
}
.team-page .ds-field {
    gap: var(--ds-space-1);
}

/* NOTE: mb-* utilities are intentionally honored. A previous reset zeroed them
   here to enforce a single wrapper rhythm, but the markup relies on mb-24/mb-16
   for section spacing at arbitrary nesting depth (e.g. inside .invTabBody) that
   the wrapper rhythm can't reach — zeroing them made stacked sections touch.
   The base .mb-24 { margin-bottom: var(--space-6) } / .mb-16 rules now apply. */

/* Cards inside grid cells: no extra padding misalignment */
.page-content .grid > .card,
.page-content .grid-2 > .card,
.page-content .grid-3 > .card,
.page-content .grid-4 > .card {
    margin: 0;
}

/* Card-header consistency */
.page-content .card-header {
    padding: 0 0 10px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-default);
}

/* Card body breathing */
.page-content .card > *:not(.card-header):not(:last-child) {
    margin-bottom: 12px;
}

/* ============================================
   v4 GLOW SYSTEM — unified accent across app
   Matches POS panel aesthetic (gold edge + soft shadow)
   ============================================ */

:root {
    /* B60 OS rgb helpers (kept in sync with main.css :root). These MUST
       match -- this block loads after main.css and would otherwise silently
       revert the whole palette to stale values. */
    --gold-rgb: 79, 70, 229;
    --red-rgb: 239, 68, 68;
    --green-rgb: 16, 185, 129;
    --blue-rgb: 59, 130, 246;
    --info-rgb: 59, 130, 246;
    --z-fab: 50;
    --glow-gold:  inset 0 0 0 1px rgba(var(--gold-rgb), 0.14), var(--ds-shadow-card);
    --glow-blue:  inset 0 0 0 1px rgba(var(--blue-rgb), 0.22), 0 0 0 3px rgba(var(--blue-rgb), 0.12);
    --glow-green: inset 0 0 0 1px rgba(var(--green-rgb), 0.25), var(--ds-shadow-card);
    --glow-red:   inset 0 0 0 1px rgba(var(--red-rgb), 0.28), var(--ds-shadow-card);
}

/* Cards: solid pearl-white with a glass edge + One Sun soft shadow */
.page-content .card {
    background: var(--bg-surface) !important;
    border: var(--glass-rim);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft), var(--rim-light);
    transition: transform 150ms, box-shadow 200ms;
    padding: 18px !important;
}
.page-content .card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md), var(--rim-light) !important;
}

/* Icon-only small buttons — compact square, no heavy shadow */
.btn.btn-sm:has(> svg:only-child) {
    width: 30px;
    height: 30px;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: none !important;
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border-default) !important;
    color: var(--text-secondary) !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
}
.btn.btn-sm:has(> svg:only-child):hover {
    background: var(--bg-elevated) !important;
    border-color: var(--border-strong) !important;
    color: var(--text-primary) !important;
    transform: none !important;
}
.btn.btn-sm.btn-danger:has(> svg:only-child) {
    background: rgba(var(--red-rgb), 0.12) !important;
    border-color: rgba(var(--red-rgb), 0.3) !important;
    color: #ff9c8d !important;
}
.btn.btn-sm.btn-danger:has(> svg:only-child):hover {
    background: rgba(var(--red-rgb), 0.22) !important;
    border-color: rgba(var(--red-rgb), 0.55) !important;
    color: #ffb5a8 !important;
}
.btn.btn-sm.btn-primary:has(> svg:only-child) {
    background: rgba(var(--gold-rgb), 0.15) !important;
    border-color: rgba(var(--gold-rgb), 0.4) !important;
    color: var(--gold) !important;
}

/* Action cells in tables — no wrap, tight */
.table td:last-child {
    white-space: nowrap;
    text-align: right;
}
.table td:last-child > div {
    display: inline-flex !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
    justify-content: flex-end;
}

/* Stat icon boxes - tinted glass chips, One Sun rim (no dark glow).
   Revenue stays gold (money, Law 4); orders is blue (non-monetary). */
.stat-icon { box-shadow: var(--rim-light); }
.stat-icon.revenue {
    background: rgba(var(--gold-rgb), 0.14) !important;
    box-shadow: inset 0 0 0 1px rgba(var(--gold-rgb), 0.22);
    color: var(--gold-dark) !important;
}
.stat-icon.orders {
    background: rgba(var(--blue-rgb), 0.12) !important;
    box-shadow: inset 0 0 0 1px rgba(var(--blue-rgb), 0.22);
    color: var(--accent) !important;
}
.stat-icon.profit {
    background: rgba(var(--green-rgb), 0.12) !important;
    box-shadow: inset 0 0 0 1px rgba(var(--green-rgb), 0.25);
    color: var(--profit-green) !important;
}
.stat-icon.session,
.stat-icon.info {
    background: rgba(var(--blue-rgb), 0.12) !important;
    box-shadow: inset 0 0 0 1px rgba(var(--blue-rgb), 0.25);
    color: var(--accent) !important;
}

/* Status badges — glow per status */
.badge {
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.badge.ok,
.badge.success,
.badge.green,
[class*="status"][class*="ok"],
.status-ok {
    background: rgba(var(--green-rgb), 0.12);
    color: var(--profit-green);
    box-shadow: inset 0 0 0 1px rgba(var(--green-rgb), 0.22);
}
.badge.out,
.badge.danger,
.badge.red,
.badge.error,
.status-out {
    background: rgba(var(--red-rgb), 0.12);
    color: #C81E4A;
    box-shadow: inset 0 0 0 1px rgba(var(--red-rgb), 0.25);
}
.badge.warning,
.badge.low,
.status-low {
    background: rgba(245, 158, 11, 0.14);
    color: var(--alert-amber);
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.30);
}
.badge.info,
.badge.blue {
    background: rgba(var(--blue-rgb), 0.12);
    color: var(--accent-hover);
    box-shadow: inset 0 0 0 1px rgba(var(--blue-rgb), 0.25);
}

/* Table status text (OK / OUT in inventory) */
.table td .badge,
.table td button.badge { padding: 4px 10px; }

/* Inputs — blue focus glow. :focus-visible only (not :focus) so
   programmatic .focus() calls (e.g. POS search on page mount) don't
   leave a permanent ring on touch/mouse users. */
.input:focus-visible,
input.input:focus-visible,
select.input:focus-visible,
textarea.input:focus-visible {
    border-color: rgba(var(--blue-rgb), 0.7) !important;
    box-shadow: var(--glow-blue), inset 0 0 0 1px rgba(var(--blue-rgb), 0.3) !important;
}

/* Primary action button - B60 OS indigo */
.btn.btn-primary {
    background: var(--ds-primary-gradient);
    color: #fff;
    border: none;
    box-shadow: var(--ds-shadow-card);
    font-weight: 600;
}
.btn.btn-primary:hover {
    box-shadow: var(--ds-shadow-pop);
    transform: translateY(-1px);
}

/* Success - emerald */
.btn.btn-success {
    background: linear-gradient(160deg, var(--green-light) 0%, var(--green) 100%);
    color: #06301F;
    border: none;
    box-shadow: 2px 6px 18px rgba(var(--green-rgb), 0.24), var(--rim-light);
    font-weight: 600;
}
.btn.btn-success:hover {
    box-shadow: 3px 8px 22px rgba(var(--green-rgb), 0.32), var(--rim-light);
    transform: translateY(-1px);
}

/* Danger - rose */
.btn.btn-danger {
    background: linear-gradient(160deg, #FB7185 0%, var(--red) 100%);
    color: #fff;
    border: none;
    box-shadow: 2px 6px 18px rgba(var(--red-rgb), 0.24), var(--rim-light);
    font-weight: 600;
}
.btn.btn-danger:hover {
    box-shadow: 3px 8px 22px rgba(var(--red-rgb), 0.32), var(--rim-light);
    transform: translateY(-1px);
}

/* Tabs - active lifts on frosted white with ink text (no gold; not money) */
.tabs .tab.active {
    background: var(--glass-pressed) !important;
    color: var(--text-primary) !important;
    box-shadow: var(--shadow-sm), var(--rim-light) !important;
}

.font-mono { font-feature-settings: "tnum" 1; }

/* ═══════════════════════════════════════════════════
   Mobile Invoice Capture Page
   ═══════════════════════════════════════════════════ */

.page-content[data-page="invoice-mobile"] {
    padding: 0;
    overflow: hidden;
}

.invoice-mobile-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ── Capture Step ── */
.im-capture-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 16px;
    gap: 16px;
}

.im-preview-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border-default);
    overflow: hidden;
    min-height: 0;
}

.im-preview-area img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-lg);
}

.im-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    text-align: center;
    padding: 24px;
}

.im-preview-placeholder svg {
    opacity: 0.4;
}

.im-capture-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.im-capture-actions .btn {
    min-height: 52px;
    font-size: 16px;
}

/* ── Processing Step ── */
.im-processing-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 24px;
    text-align: center;
    gap: 24px;
}

.im-processing-icon {
    color: var(--accent);
    opacity: 0.6;
}

.im-processing-title {
    font-size: 20px;
    font-weight: 600;
}

.im-progress-wrap {
    width: 100%;
    max-width: 320px;
}

.im-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.im-progress-label {
    color: var(--text-secondary);
}

.im-progress-pct {
    color: var(--accent);
    font-weight: 600;
    font-family: var(--font-mono);
}

.im-progress-track {
    background: var(--bg-tertiary);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.im-progress-fill {
    background: var(--accent);
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s ease;
}

.im-error-box {
    margin-top: 16px;
    padding: 20px;
    background: var(--red-tint);
    border: 1px solid rgba(var(--red-rgb), 0.3);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 320px;
}

.im-error-title {
    color: var(--danger);
    font-weight: 600;
    margin-bottom: 8px;
}

.im-error-msg {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 16px;
}

/* ── Review Step ── */
.im-review-view {
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px) + 80px);
    overflow-y: auto;
}

.im-review-header {
    flex-shrink: 0;
    margin: 12px 12px 0;
}

.im-header-fields {
    padding: 0 12px 12px;
}

.im-items-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.im-item-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.im-item-card.unmatched {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(var(--red-rgb), 0.15);
}

.im-item-header {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-default);
}

.im-item-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
}

.im-item-original {
    font-size: 12px;
    color: var(--text-secondary);
}

.im-item-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.im-item-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.im-item-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.im-item-row-between {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.im-item-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 500;
}

.im-item-select {
    font-size: 14px;
}

.im-item-line-total {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.im-item-line-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.im-item-line-value {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent);
    font-size: 16px;
}

/* Sticky bottom bar */
.im-review-sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-panel);
    border-top: 1px solid var(--border-default);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: var(--z-overlay);
}

.im-sticky-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 640px;
    margin: 0 auto;
}

.im-sticky-total {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.im-sticky-total-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.im-sticky-total-value {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 20px;
    color: var(--accent);
}

.im-sticky-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.im-sticky-actions .btn {
    min-height: 48px;
    padding: 10px 20px;
}

/* Center on desktop for testing */
@media (min-width: 641px) {
    .invoice-mobile-page {
        max-width: 480px;
        margin: 0 auto;
    }
}

/* Tighten on very small screens */
@media (max-width: 360px) {
    .im-capture-view {
        padding: 12px;
        gap: 12px;
    }
    .im-capture-actions .btn {
        min-height: 48px;
        font-size: 15px;
    }
    .im-item-row-2col {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* ═══════════════════════════════════════════════════
   RTL SUPPORT — flipped positions
   ═══════════════════════════════════════════════════ */

body[dir="rtl"] .toast-container {
    right: auto;
    left: 24px;
}
body[dir="rtl"] .toast.success,
body[dir="rtl"] .toast.error,
body[dir="rtl"] .toast.warning,
body[dir="rtl"] .toast.info {
    border-left: none;
    border-right: 3px solid;
}
body[dir="rtl"] .toast.success  { border-right-color: var(--success); }
body[dir="rtl"] .toast.error    { border-right-color: var(--danger); }
body[dir="rtl"] .toast.warning  { border-right-color: var(--warning); }
body[dir="rtl"] .toast.info     { border-right-color: var(--info); }

body[dir="rtl"] .search-bar svg {
    left: auto;
    right: 14px;
}
body[dir="rtl"] .search-bar .input {
    padding-left: 12px;
    padding-right: 44px;
}

body[dir="rtl"] select.input {
    background-position: left 12px center;
    padding-right: 12px;
    padding-left: 40px;
}

body[dir="rtl"] .table th,
body[dir="rtl"] .table td {
    text-align: right;
}
body[dir="rtl"] .table td:last-child {
    text-align: left;
}

body[dir="rtl"] .modal-footer {
    justify-content: flex-start;
}
body[dir="rtl"] .top-bar-actions {
    margin-left: 0;
    margin-right: auto;
}

body[dir="rtl"] .tables-overview {
    right: auto;
    left: 20px;
}

body[dir="rtl"] .im-review-sticky-bar .im-sticky-content {
    flex-direction: row-reverse;
}
body[dir="rtl"] .im-sticky-actions {
    flex-direction: row-reverse;
}

/* ═══════════════════════════════════════════════════
   TOUCH TARGETS — coarse pointer devices
   Must load last to win specificity over v2 overrides
   ═══════════════════════════════════════════════════ */

@media (pointer: coarse) {
    .icon-btn { width: var(--touch-target) !important; height: var(--touch-target) !important; min-width: var(--touch-target) !important; min-height: var(--touch-target) !important; }
    .sidebar-toggle { width: var(--touch-target); height: var(--touch-target); min-width: var(--touch-target); min-height: var(--touch-target); }
    .nav-item { min-height: var(--touch-target); }
    .modal-close { width: var(--touch-target); height: var(--touch-target); }
    .pos-toolbar-btn { width: var(--touch-target); height: var(--touch-target); }
    .quantity-btn { width: var(--touch-target); height: var(--touch-target); min-width: var(--touch-target); min-height: var(--touch-target); }
    .qty-btn { width: var(--touch-target); height: var(--touch-target); min-width: var(--touch-target); min-height: var(--touch-target); }
    .fab-btn { width: var(--touch-target); height: var(--touch-target); }
}

/* ═══════════════════════════════════════════════════
   Finance Hub — Tab Bar
   ═══════════════════════════════════════════════════ */

.fh-tab-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--bg-panel);
    border-radius: var(--r-md);
    padding: 3px;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-default);
}

.fh-tab-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--r-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s ease, background-color 0.2s ease;
    font-family: inherit;
}

.fh-tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.fh-tab-btn.active {
    background: var(--gold);
    color: var(--bg-void);
    font-weight: 600;
}

.fh-date-pills {
    display: flex;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

.fh-date-pill {
    padding: 5px 10px;
    border: 1px solid var(--border-default);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    border-radius: var(--r-sm);
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.fh-date-pill:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.fh-date-pill.active {
    background: var(--gold);
    color: var(--bg-void);
    border-color: var(--gold);
}

/* ═══════════════════════════════════════════════════
   Finance Hub — KPI Cards
   ═══════════════════════════════════════════════════ */

.fh-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.fh-kpi-card {
    background: var(--bg-surface);
    border-radius: var(--r-md);
    padding: 16px;
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-soft), var(--rim-light);
    transition: transform 0.2s ease, border-color 0.2s ease;
    position: relative;
    overflow: hidden;
}

.fh-kpi-card:hover {
    transform: scale(1.02);
}

/* Colored top-borders and the tinted corner-dot were removed (off-palette
   purple/cyan + decoration-gold, Law 4). Semantic accent now lives on the
   label only: gold = plain money value, emerald = positive, rose = owed. */
.fh-kpi-card[data-color="gold"] .fh-kpi-label { color: var(--gold); }
.fh-kpi-card[data-color="green"] .fh-kpi-label { color: var(--profit-green); }
.fh-kpi-card[data-color="neutral"] .fh-kpi-label { color: var(--text-secondary); }
.fh-kpi-card[data-color="danger"] .fh-kpi-label { color: var(--red); }

.fh-kpi-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.fh-kpi-card[data-color="gold"] .fh-kpi-label { color: var(--gold); }
.fh-kpi-card[data-color="green"] .fh-kpi-label { color: var(--profit-green); }
.fh-kpi-card[data-color="neutral"] .fh-kpi-label { color: var(--text-secondary); }
.fh-kpi-card[data-color="danger"] .fh-kpi-label { color: var(--red); }

.fh-kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 4px;
}

.fh-kpi-trend {
    font-size: 11px;
}

.fh-kpi-trend.up { color: var(--profit-green); }
.fh-kpi-trend.down { color: var(--red); }

/* ═══════════════════════════════════════════════════
   Finance Hub — Layout Helpers
   ═══════════════════════════════════════════════════ */

.fh-overview-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 1023px) {
    .fh-overview-grid {
        grid-template-columns: 1fr;
    }
    .fh-kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .fh-kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .fh-tab-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
    }
    .fh-date-pills {
        margin-left: 0;
        margin-top: 8px;
    }
    .fh-overview-grid {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════
   Finance Hub — Quick Actions
   ═══════════════════════════════════════════════════ */

.fh-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fh-quick-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--r-sm);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
    font-family: inherit;
    text-align: left;
}

.fh-quick-action-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--bg-elevated);
}

.fh-quick-action-btn.primary {
    border-color: var(--gold);
    color: var(--gold);
}

.fh-quick-action-btn.primary:hover {
    background: var(--gold);
    color: var(--bg-void);
}

/* ═══════════════════════════════════════════════════
   Finance Hub — Alerts
   ═══════════════════════════════════════════════════ */

.fh-alert-card {
    background: var(--red-tint);
    border: 1px solid rgba(226, 92, 74, 0.3);
    border-radius: var(--r-sm);
    padding: 10px 12px;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: opacity 0.3s ease, max-height 0.3s ease;
}

.fh-alert-card.dismissing {
    opacity: 0;
    max-height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.fh-alert-msg {
    font-size: 12px;
    color: var(--red);
}

.fh-alert-severity {
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--r-sm);
    text-transform: uppercase;
}

.fh-alert-severity.high { background: rgba(226,92,74,0.2); color: var(--red); }
.fh-alert-severity.med  { background: rgba(240,160,48,0.2); color: var(--warning); }
.fh-alert-severity.low  { background: rgba(91,143,212,0.2); color: var(--blue); }

/* ═══════════════════════════════════════════════════
   Finance Hub — Bottom Summary Cards
   ═══════════════════════════════════════════════════ */

.fh-bottom-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.fh-summary-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--r-md);
    padding: 14px;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.fh-summary-card:hover {
    border-color: var(--gold);
    background: var(--bg-elevated);
}

.fh-summary-title {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 8px;
}

.fh-summary-body {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.6;
}

/* ═══════════════════════════════════════════════════
   Finance Hub — Chart
   ═══════════════════════════════════════════════════ */

.fh-chart-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--r-md);
    padding: 16px;
}

.fh-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.fh-chart-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.fh-chart-toggle {
    display: flex;
    gap: 2px;
    background: var(--bg-elevated);
    border-radius: var(--r-sm);
    padding: 2px;
}

.fh-chart-toggle-btn {
    padding: 4px 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.fh-chart-toggle-btn.active {
    background: var(--gold);
    color: var(--bg-void);
}

/* ═══════════════════════════════════════════════════
   Finance Hub — Skeleton Loading
   ═══════════════════════════════════════════════════ */

.fh-skeleton {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--r-md);
    animation: fh-shimmer 1.5s infinite;
}

@keyframes fh-shimmer {
    0% { opacity: 0.4; }
    50% { opacity: 0.7; }
    100% { opacity: 0.4; }
}

/* ═══════════════════════════════════════════════════
   Finance Hub — Tab Content Area
   ═══════════════════════════════════════════════════ */

.fh-tab-content {
    animation: fh-fadeIn 0.2s ease;
}

@keyframes fh-fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════
   Finance Hub — Light mode overrides
   ═══════════════════════════════════════════════════ */

/* Remove dark-mode glow blobs on KPI cards */
[data-theme="light"] .fh-kpi-card::after { display: none; }

/* KPI card backgrounds — lift off the page slightly */
[data-theme="light"] .fh-kpi-card {
    background: #FFFFFF;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

/* KPI label colors — hardcoded neon values need dark equivalents */
[data-theme="light"] .fh-kpi-card[data-color="gold"]   .fh-kpi-label { color: var(--gold-dark); }
[data-theme="light"] .fh-kpi-card[data-color="green"]  .fh-kpi-label { color: #1A6B3E; }
[data-theme="light"] .fh-kpi-card[data-color="purple"] .fh-kpi-label { color: #5B2D99; }
[data-theme="light"] .fh-kpi-card[data-color="cyan"]   .fh-kpi-label { color: #0D6B8A; }

/* Tab bar */
[data-theme="light"] .fh-tab-bar {
    background: #FFFFFF;
    border-color: var(--border-default);
}
[data-theme="light"] .fh-tab-btn { color: var(--text-hint); }
[data-theme="light"] .fh-tab-btn:hover { color: var(--text-secondary); background: var(--bg-surface); }
[data-theme="light"] .fh-tab-btn.active { background: var(--gold); color: #fff; }

/* Date pills */
[data-theme="light"] .fh-date-pill { color: var(--text-hint); }
[data-theme="light"] .fh-date-pill.active { color: #fff; }

/* Chart cards */
[data-theme="light"] .fh-chart-card {
    background: #FFFFFF;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* Chart toggle */
[data-theme="light"] .fh-chart-toggle { background: var(--bg-surface); }
[data-theme="light"] .fh-chart-toggle-btn { color: var(--text-secondary); }
[data-theme="light"] .fh-chart-toggle-btn.active { background: var(--gold); color: #fff; }

/* Summary cards */
[data-theme="light"] .fh-summary-card { background: #FFFFFF; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
[data-theme="light"] .fh-summary-card:hover { background: var(--bg-surface); }

/* Quick action buttons */
[data-theme="light"] .fh-quick-action-btn {
    color: var(--text-secondary);
    border-color: var(--border-default);
    background: #FFFFFF;
}
[data-theme="light"] .fh-quick-action-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--bg-surface);
}
[data-theme="light"] .fh-quick-action-btn.primary {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(154,112,32,0.06);
}
[data-theme="light"] .fh-quick-action-btn.primary:hover {
    background: var(--gold);
    color: #fff;
}

/* Skeleton loader */
[data-theme="light"] .fh-skeleton {
    background: var(--bg-surface);
    border-color: var(--border-default);
}