/* RIMS POS Professional Theme */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Variables for Theming */
:root {
    /* Brand Colors */
    --primary: #0066cc;
    --primary-hover: #0052a3;
    --primary-light: #e6f2ff;
    --secondary: #6c757d;
    --secondary-hover: #5a6268;
    --secondary-light: #f8f9fa;
    
    /* Status Colors */
    --success: #10b981;
    --success-hover: #059669;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-hover: #d97706;
    --warning-light: #fef3c7;
    --info: #3b82f6;
    --info-hover: #2563eb;
    --info-light: #dbeafe;
    
    /* Neutral Colors */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Layout Colors */
    --background: #ffffff;
    --surface: #ffffff;
    --surface-hover: #f9fafb;
    --border: #e5e7eb;
    --border-hover: #d1d5db;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 200ms ease-in-out;
    --transition-slow: 300ms ease-in-out;
    
    /* Z-Index */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --background: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --border: #334155;
    --border-hover: #475569;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --primary-light: #1e3a8a;
    --secondary-light: #374151;
    --success-light: #064e3b;
    --danger-light: #7f1d1d;
    --warning-light: #78350f;
    --info-light: #1e3a8a;
}

/* Global Styles */
* {
    box-sizing: border-box;
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--gray-50);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
    margin-top: 0;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    margin-top: 0;
    margin-bottom: var(--spacing-md);
}

/* Links */
a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
}

/* Cards */
.card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
    overflow: hidden;
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: var(--spacing-lg);
}

.card-header h1,
.card-header h2,
.card-header h3,
.card-header h4,
.card-header h5,
.card-header h6 {
    margin-bottom: 0;
}

.card-body {
    padding: var(--spacing-lg);
}

.card-footer {
    background-color: var(--gray-50);
    border-top: 1px solid var(--border);
    padding: var(--spacing-md) var(--spacing-lg);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    user-select: none;
    text-decoration: none;
    gap: var(--spacing-xs);
}

.btn:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--secondary-hover);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: var(--success-hover);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: var(--danger-hover);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border);
    color: var(--text-primary);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--gray-50);
    border-color: var(--border-hover);
}

/* Button Sizes */
.btn-sm {
    font-size: 0.75rem;
    padding: var(--spacing-xs) var(--spacing-sm);
}

.btn-lg {
    font-size: 1rem;
    padding: var(--spacing-md) var(--spacing-lg);
}

/* Forms */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--surface);
    background-clip: padding-box;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    color: var(--text-primary);
    background-color: var(--surface);
    border-color: var(--primary);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

.form-control:disabled,
.form-select:disabled {
    background-color: var(--gray-100);
    opacity: 1;
}

/* Tables */
.table {
    width: 100%;
    margin-bottom: var(--spacing-md);
    background-color: var(--surface);
    border-collapse: collapse;
}

.table th,
.table td {
    padding: var(--spacing-md);
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 600;
    text-align: left;
    background-color: var(--gray-50);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.table tbody tr {
    transition: background-color var(--transition-fast);
}

.table tbody tr:hover {
    background-color: var(--surface-hover);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-primary {
    background-color: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background-color: var(--success-light);
    color: var(--success);
}

.badge-danger {
    background-color: var(--danger-light);
    color: var(--danger);
}

.badge-warning {
    background-color: var(--warning-light);
    color: var(--warning);
}

.badge-info {
    background-color: var(--info-light);
    color: var(--info);
}

/* Alerts */
.alert {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.alert-success {
    background-color: var(--success-light);
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-danger {
    background-color: var(--danger-light);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.alert-warning {
    background-color: var(--warning-light);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.alert-info {
    background-color: var(--info-light);
    color: var(--info);
    border: 1px solid var(--info);
}

/* Loading States */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.skeleton {
    animation: skeleton-loading 1s linear infinite alternate;
}

@keyframes skeleton-loading {
    0% { background-color: var(--gray-200); }
    100% { background-color: var(--gray-300); }
}

/* Page Layout */
.page-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-header {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: var(--spacing-lg) var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.page-header h1 {
    margin: 0;
    font-size: 1.875rem;
}

.page-content {
    flex: 1;
    padding: 0 var(--spacing-xl) var(--spacing-xl);
    max-width: 100%;
}

.page-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

/* Grid System */
.container {
    width: 100%;
    padding-right: var(--spacing-md);
    padding-left: var(--spacing-md);
    margin-right: auto;
    margin-left: auto;
}

@media (min-width: 640px) {
    .container { max-width: 640px; }
}

@media (min-width: 768px) {
    .container { max-width: 768px; }
}

@media (min-width: 1024px) {
    .container { max-width: 1024px; }
}

@media (min-width: 1280px) {
    .container { max-width: 1280px; }
}

/* Animations */
.fade-in {
    animation: fadeIn var(--transition-slow);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn var(--transition-slow);
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }

.bg-primary { background-color: var(--primary); }
.bg-secondary { background-color: var(--secondary); }
.bg-success { background-color: var(--success); }
.bg-danger { background-color: var(--danger); }
.bg-warning { background-color: var(--warning); }
.bg-info { background-color: var(--info); }
.bg-light { background-color: var(--gray-50); }
.bg-dark { background-color: var(--gray-900); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }
.mt-5 { margin-top: var(--spacing-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }
.mb-5 { margin-bottom: var(--spacing-xl); }

.p-0 { padding: 0; }
.p-1 { padding: var(--spacing-xs); }
.p-2 { padding: var(--spacing-sm); }
.p-3 { padding: var(--spacing-md); }
.p-4 { padding: var(--spacing-lg); }
.p-5 { padding: var(--spacing-xl); }

.d-none { display: none; }
.d-block { display: block; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }

.flex-row { flex-direction: row; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.justify-content-start { justify-content: flex-start; }
.justify-content-center { justify-content: center; }
.justify-content-end { justify-content: flex-end; }
.justify-content-between { justify-content: space-between; }
.align-items-start { align-items: flex-start; }
.align-items-center { align-items: center; }
.align-items-end { align-items: flex-end; }

.gap-1 { gap: var(--spacing-xs); }
.gap-2 { gap: var(--spacing-sm); }
.gap-3 { gap: var(--spacing-md); }
.gap-4 { gap: var(--spacing-lg); }
.gap-5 { gap: var(--spacing-xl); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

.rounded { border-radius: var(--radius-md); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Responsive Utilities */
@media (max-width: 767px) {
    .hide-mobile { display: none !important; }
}

@media (min-width: 768px) {
    .hide-desktop { display: none !important; }
}

/* Print Styles */
@media print {
    .no-print { display: none !important; }
    
    body {
        background: white;
        color: black;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* ============================================================
   RIMS POS — V3 Document-Style Pattern
   Append this to wwwroot/css/theme.css (or load separately).
   Builds on the existing tokens in theme.css.
   ============================================================ */

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}
.page-header h1 {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
    color: var(--gray-900);
    letter-spacing: -0.01em;
}
.page-header .lhs { display: flex; flex-direction: column; gap: 2px; }
.page-header .subtitle { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }
.page-header .actions { display: flex; gap: 8px; align-items: center; }


/* ============================================================
   Document banner (above doc-paper on Invoice/Credit Note Create)
   ============================================================ */
.doc-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: linear-gradient(180deg, #f7faff, #eef4ff);
    border: 1px solid #cfdcfb;
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}
.doc-banner .ico-wrap {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.doc-banner .meta { flex: 1; }
.doc-banner .meta .ttl { font-weight: 600; color: var(--gray-900); font-size: 13px; }
.doc-banner .meta .det { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.doc-banner .det b { color: var(--gray-800); font-weight: 600; }
.doc-banner .actions { display: flex; gap: 6px; }


/* ============================================================
   Doc paper — the document editor card
   ============================================================ */
.doc-paper {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 28px 32px;
    box-shadow: var(--shadow);
}
.doc-paper.cn {
    border-top: 4px solid var(--danger);
}

.doc-paper .doc-h {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--gray-900);
}
.doc-paper.cn .doc-h { border-bottom-color: var(--danger); }

.doc-paper .logo-wrap {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2c7be5, #0066cc);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}
.doc-paper.cn .logo-wrap {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.doc-paper h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 6px;
    letter-spacing: -0.02em;
    color: var(--gray-900);
}
.doc-paper h2 .label-rib {
    display: inline-block;
    background: var(--gray-900);
    color: #fff;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    border-radius: 2px;
    vertical-align: 4px;
}
.doc-paper.cn h2 .label-rib { background: var(--danger); }

.doc-paper .doc-num {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace;
    margin-top: 4px;
}

.doc-paper .doc-section-h {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* two-column header row */
.doc-paper .doc-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    padding-top: 22px;
}

/* Bill To callout */
.doc-paper .billto {
    background: var(--gray-50);
    border-left: 3px solid var(--gray-900);
    padding: 12px 14px;
    border-radius: 0 6px 6px 0;
}
.doc-paper.cn .billto { border-left-color: var(--danger); }

/* dotted underline label/value rows */
.doc-paper .field-row {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 12px;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px dotted var(--gray-200);
    font-size: 13px;
}
.doc-paper .field-row:last-child { border-bottom: 0; }
.doc-paper .field-row .k {
    color: var(--text-secondary);
    font-size: 11px;
    letter-spacing: .4px;
    text-transform: uppercase;
    font-weight: 600;
}
.doc-paper .field-row .v { font-weight: 500; }

/* Items grid — darker headers when inside .doc-paper.
   Paint the WHOLE thead (row + cells + inner content div) so the
   dark band is continuous. DevExpress 23.2 renders a <thead><tr><th>
   with an inner .dxbl-grid-header-content div — styling only the
   inner div leaves the th gaps and command-column header light. */
.doc-paper .dxbl-grid,
.doc-paper table.line-items {
    border-left: 0 !important;
    border-right: 0 !important;
    border-radius: 0 !important;
}
.doc-paper .dxbl-grid thead,
.doc-paper .dxbl-grid thead tr,
.doc-paper .dxbl-grid thead th,
.doc-paper .dxbl-grid .dxbl-grid-header-content,
.doc-paper table.line-items thead,
.doc-paper table.line-items thead tr,
.doc-paper table.line-items thead th {
    background: var(--gray-900) !important;
    background-color: var(--gray-900) !important;
    color: #fff !important;
    border-color: var(--gray-900) !important;
}
.doc-paper .dxbl-grid thead th,
.doc-paper .dxbl-grid .dxbl-grid-header-content,
.doc-paper table.line-items thead th {
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: .8px;
    font-weight: 600;
}
/* Sort / filter / column-edit icons inside the dark header must stay white */
.doc-paper .dxbl-grid thead th i,
.doc-paper .dxbl-grid thead th svg,
.doc-paper .dxbl-grid thead th .dxbl-image,
.doc-paper .dxbl-grid thead th .dxbl-grid-header-indicator {
    color: #fff !important;
    fill: #fff !important;
}

.doc-paper.cn .dxbl-grid thead,
.doc-paper.cn .dxbl-grid thead tr,
.doc-paper.cn .dxbl-grid thead th,
.doc-paper.cn .dxbl-grid .dxbl-grid-header-content,
.doc-paper.cn table.line-items thead,
.doc-paper.cn table.line-items thead tr,
.doc-paper.cn table.line-items thead th {
    background: var(--danger) !important;
    background-color: var(--danger) !important;
    border-color: var(--danger) !important;
}

/* Document footer: two-column (notes/payment left, totals right) */
.doc-paper .doc-footer {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
}

/* Payment block (Invoice only) */
.pay-block {
    background: var(--success-light);
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-md);
    padding: 12px 14px;
}
.pay-block .head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #065f46;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* Reason callout (Credit Note only) */
.reason-callout {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid var(--danger);
    padding: 12px 14px;
    border-radius: var(--radius-md);
}
.reason-callout .head {
    font-size: 11px;
    font-weight: 700;
    color: #7f1d1d;
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: 6px;
}

/* Status banner inside doc-paper footer right column */
.status-banner {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    font-size: 12px;
    line-height: 1.4;
}
.status-banner b { display: block; margin-bottom: 2px; font-size: 12px; letter-spacing: .5px; }
.status-banner.paid    { background: var(--success-light); border: 1px solid #a7f3d0; color: #065f46; }
.status-banner.unpaid  { background: var(--warning-light); border: 1px solid #fde68a; color: #78350f; }
.status-banner.refund  { background: var(--danger-light);  border: 1px solid #fecaca; color: #7f1d1d; }


/* ============================================================
   Totals block
   ============================================================ */
.totals {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
.totals .row { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .row .lbl { color: var(--gray-700); }
.totals .row .val { font-weight: 500; }
.totals .row.muted { color: var(--text-secondary); }
.totals .sep { height: 1px; background: var(--border); margin: 8px 0; }
.totals .total .lbl { font-weight: 600; color: var(--gray-900); }
.totals .total .val { font-weight: 700; font-size: 16px; color: var(--primary); }


/* ============================================================
   Status badges (replaces inline GetStatusBadgeClass() switches)
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid transparent;
    white-space: nowrap;
}
.badge.draft     { background: var(--gray-100); color: var(--gray-600); }
.badge.sent      { background: var(--info-light); color: #1e40af; }
.badge.accepted,
.badge.paid,
.badge.approved  { background: var(--success-light); color: #065f46; }
.badge.rejected  { background: var(--danger-light);  color: #991b1b; }
.badge.expired   { background: var(--warning-light); color: #92400e; }
.badge.converted,
.badge.applied   { background: var(--primary-light); color: #004a93; }
.badge.partial   { background: #fde68a; color: #78350f; }
.badge.unpaid,
.badge.pending   { background: var(--warning-light); color: #92400e; }


/* ============================================================
   Sticky bottom action bar
   ============================================================ */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-top: 16px;
}
.action-bar.sticky-bottom {
    position: sticky;
    bottom: 0;
    z-index: 10;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, .04);
}
.action-bar .left  { display: flex; gap: 8px; align-items: center; }
.action-bar .right { display: flex; gap: 8px; }

/* The sticky bar spans the full content width, so its (mostly empty)
   background used to swallow clicks meant for controls behind it (e.g. the
   inline grid editor's Save/Cancel). Let clicks pass through the bar itself
   and re-enable them on its children so every button stays clickable. */
.action-bar.sticky-bottom { pointer-events: none; }
.action-bar.sticky-bottom .left,
.action-bar.sticky-bottom .right,
.action-bar.sticky-bottom > * { pointer-events: auto; }

/* Give the content enough bottom clearance that a sticky action bar never
   covers controls near the bottom of the page (e.g. the inline grid editor's
   Save button on ~860px-high viewports). Unconditional: the :has(+ ...)
   adjacency variant silently failed to match on some pages, leaving the bar
   swallowing clicks. */
.page-layout-with-rail {
    padding-bottom: 120px;
}


/* ============================================================
   Page layout with sticky right rail (Create + Details pages)
   ============================================================ */
.page-layout-with-rail {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 16px;
    align-items: start;
}
.right-rail {
    position: sticky;
    top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
@media (max-width: 1200px) {
    .page-layout-with-rail { grid-template-columns: 1fr; }
    .right-rail { position: static; }
}


/* ============================================================
   KPI tiles (List pages + Details views)
   ============================================================ */
.tiles-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
}
.tile .ttl {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 600;
}
.tile .val {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
}
.tile .sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}


/* ============================================================
   Status quick-filter tabs (List pages, ABOVE search section)
   ============================================================ */
.status-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.status-tabs .tab {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: transparent;
    border-top: 0;
    border-left: 0;
    border-right: 0;
}
.status-tabs .tab:hover { color: var(--gray-900); }
.status-tabs .tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.status-tabs .tab .count {
    margin-left: 6px;
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}


/* ============================================================
   Status / activity timeline (right rail of Details views)
   ============================================================ */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
    content: '';
    position: absolute;
    left: 7px; top: 6px; bottom: 6px;
    width: 2px;
    background: var(--border);
}
.timeline .ev { position: relative; padding: 4px 0 12px; }
.timeline .ev::before {
    content: '';
    position: absolute;
    left: -19px; top: 6px;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--primary);
}
.timeline .ev.done::before { background: var(--primary); }
.timeline .ev .when { font-size: 11px; color: var(--text-secondary); }
.timeline .ev .what { font-size: 13px; color: var(--gray-800); font-weight: 500; }
.timeline .ev .who  { font-size: 11px; color: var(--text-secondary); }

/* ============================================================
   V3 Details — watermark stamp behind .doc-paper
   ============================================================ */
.doc-paper { position: relative; }
.doc-paper > * { position: relative; z-index: 1; }
.doc-stamp {
    position: absolute;
    top: 28%; left: 50%;
    transform: translate(-50%, -50%) rotate(-12deg);
    font-family: 'Inter', system-ui, sans-serif;
    font-weight: 800;
    font-size: 96px;
    letter-spacing: 4px;
    color: rgba(37, 99, 235, .08);
    border: 6px solid rgba(37, 99, 235, .12);
    padding: 8px 24px;
    border-radius: 8px;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    z-index: 0;
}
.doc-stamp.accepted { color: rgba(16, 185, 129, .10); border-color: rgba(16, 185, 129, .14); }
.doc-stamp.paid,
.doc-stamp.approved { color: rgba(16, 185, 129, .10); border-color: rgba(16, 185, 129, .14); }
.doc-stamp.partial,
.doc-stamp.unpaid,
.doc-stamp.pending,
.doc-stamp.expired { color: rgba(245, 158, 11, .10); border-color: rgba(245, 158, 11, .16); }
.doc-stamp.rejected,
.doc-stamp.credited,
.doc-stamp.cancelled { color: rgba(239, 68, 68, .10); border-color: rgba(239, 68, 68, .16); }

/* Read-only field value (mirrors Create-screen FieldRow on Details views) */
.ro-val {
    font-weight: 500;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
}
.ro-val.muted { color: var(--text-secondary); font-weight: 400; }
.ro-val a { color: var(--primary); text-decoration: none; font-weight: 600; }
.ro-val a:hover { text-decoration: underline; }

/* Compact 2x2 right-rail summary tiles (Details views) */
.det-tiles-2x2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.det-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
}
.det-tile .ttl {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 2px;
}
.det-tile .val {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.det-tile .sub {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.det-tile.warn .val   { color: var(--warning); }
.det-tile.danger .val { color: var(--danger); }
.det-tile.success .val{ color: var(--success); }

/* Status banner — inside .doc-paper footer right column */
.status-banner {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    font-size: 12px;
    line-height: 1.4;
}
.status-banner b { display: block; margin-bottom: 2px; font-size: 12px; letter-spacing: .5px; }
.status-banner.paid    { background: var(--success-light); border: 1px solid #a7f3d0; color: #065f46; }
.status-banner.partial { background: #fef3c7;              border: 1px solid #fde68a; color: #78350f; }
.status-banner.unpaid  { background: var(--warning-light); border: 1px solid #fde68a; color: #78350f; }
.status-banner.refund  { background: var(--danger-light);  border: 1px solid #fecaca; color: #7f1d1d; }

/* Payments table in Invoice Details footer */
.payments-table {
    width: 100%;
    font-size: 12px;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}
.payments-table thead th {
    text-align: left;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
}
.payments-table tbody td {
    padding: 6px 8px;
    border-bottom: 1px dotted var(--gray-200);
}
.payments-table tbody tr:last-child td { border-bottom: 0; }
.payments-table .num { text-align: right; }
.payments-table .outstanding td {
    background: var(--warning-light);
    color: #78350f;
    font-weight: 600;
}

/* ============================================================
   V3 List pages — refined layout
   ============================================================ */
.list-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 12px;
}
.list-page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 4px;
    letter-spacing: -0.01em;
}
.list-page-header .sub {
    font-size: 12px;
    color: var(--text-secondary);
}
.list-page-header .actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Refined KPI tiles — bigger than .tile, with accent stripe + delta */
.kpi-strip-lists {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.lt-tile {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    overflow: hidden;
}
.lt-tile.accent { border-left-width: 3px; }
.lt-tile.accent.warning { border-left-color: var(--warning); }
.lt-tile.accent.danger  { border-left-color: var(--danger); }
.lt-tile.accent.success { border-left-color: var(--success); }
.lt-tile.accent.primary { border-left-color: var(--primary); }
.lt-tile .lbl {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-secondary);
    font-weight: 600;
}
.lt-tile .val {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    margin-top: 6px;
}
.lt-tile .val.warn   { color: var(--warning); }
.lt-tile .val.danger { color: var(--danger); }
.lt-tile .sub {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.lt-tile .ico {
    position: absolute;
    top: 12px; right: 12px;
    width: 28px; height: 28px;
    border-radius: 6px;
    background: var(--gray-100);
    color: var(--gray-500);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
}
.lt-tile.accent.warning .ico { background: var(--warning-light); color: var(--warning); }
.lt-tile.accent.danger  .ico { background: var(--danger-light);  color: var(--danger); }
.lt-tile.accent.success .ico { background: var(--success-light); color: var(--success); }
.lt-tile.accent.primary .ico { background: var(--primary-light); color: var(--primary); }
.lt-tile .delta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
}
.lt-tile .delta.up   { color: var(--success); }
.lt-tile .delta.down { color: var(--danger); }

/* Segmented status filter (replaces a dropdown) */
.seg-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
    padding: 4px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.seg-filter .seg {
    background: transparent;
    border: 0;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background-color 100ms;
}
.seg-filter .seg:hover { background: rgba(0, 0, 0, .04); }
.seg-filter .seg.active {
    background: var(--primary);
    color: #fff;
}
.seg-filter .seg.active.warn    { background: var(--warning); }
.seg-filter .seg.active.danger  { background: var(--danger); }
.seg-filter .seg.active.success { background: var(--success); }
.seg-filter .seg .count {
    background: rgba(0, 0, 0, .06);
    color: inherit;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}
.seg-filter .seg.active .count {
    background: rgba(255, 255, 255, .25);
    color: #fff;
}

/* Search row — light, single line */
.list-search {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.list-search > * { flex-shrink: 0; }
.list-search .grow { flex: 1; min-width: 240px; }
.list-search .vdiv {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
}

/* Above-grid toolbar — count + actions */
.list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 4px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.list-toolbar b { color: var(--gray-900); font-weight: 600; }

/* List grid — mono refnums, row-click + chevron */
.list-grid {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.list-grid tbody tr { cursor: pointer; transition: background-color 100ms; }
.list-grid tbody tr:hover {
    background: linear-gradient(90deg, var(--primary-light), transparent 60%) !important;
}
.list-grid tbody tr:hover .row-arrow {
    opacity: 1;
    transform: translateX(0);
}
.list-grid .row-arrow {
    display: inline-block;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 120ms, transform 120ms;
    color: var(--primary);
    font-size: 12px;
}
.refnum {
    font-family: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace;
    color: var(--primary);
    font-weight: 600;
    font-size: 12px;
    text-decoration: none;
}
.refnum:hover { text-decoration: underline; }
.refnum.dim { color: var(--gray-600); font-weight: 500; }
.num-mono {
    font-family: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace;
    font-variant-numeric: tabular-nums;
}
.num-mono.warn   { color: var(--warning); font-weight: 600; }
.num-mono.danger { color: var(--danger); font-weight: 600; }
.num-mono.muted  { color: var(--text-secondary); }

/* ============================================================
   Print styles — scoped to documents only
   ============================================================
   The previous draft of this block hid everything outside .doc-paper,
   which broke print on pages without the V3 chrome. The scoped
   version below only activates when a .doc-paper element exists in
   the page, leaving non-document pages with default browser print. */
@media print {
    /* Hide app chrome on every page. */
    .sidebar, .topbar,
    nav, header.topbar,
    .page-header, .action-bar,
    .status-tabs, .tiles-row,
    .right-rail, .no-print {
        display: none !important;
    }

    /* On document pages, isolate the doc-paper for printing. */
    body:has(.doc-paper) * { visibility: hidden; }
    body:has(.doc-paper) .doc-paper,
    body:has(.doc-paper) .doc-paper * { visibility: visible; }
    body:has(.doc-paper) .doc-paper {
        position: absolute;
        left: 0; top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
    }

    /* On non-document pages (lists, details without doc-paper), keep
       the main content visible with sane spacing. */
    .card { border: 1px solid #000 !important; box-shadow: none !important; }
    body { background: #fff !important; color: #000; }
}

/* ---------------------------------------------------------------------
   Typography utility classes.
   Use these instead of inline style="font-size:Npx" so the design tokens
   in :root stay the single source of truth.  px values shown for human
   reference assume 16px root (1rem = 16px).
   --------------------------------------------------------------------- */
.text-xs   { font-size: 0.6875rem; }  /* 11px */
.text-sm   { font-size: 0.75rem; }    /* 12px */
.text-md   { font-size: 0.8125rem; }  /* 13px */
.text-base { font-size: 0.875rem; }   /* 14px */
.text-lg   { font-size: 1rem; }       /* 16px */
.text-xl   { font-size: 1.125rem; }   /* 18px */

.text-muted     { color: var(--text-secondary); }
.text-strong    { color: var(--gray-900); font-weight: 600; }
.text-primary   { color: var(--primary); }
.text-success   { color: var(--success); }
.text-danger    { color: var(--danger); }
.text-warning   { color: var(--warning); }

.mono { font-family: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace; }

/* ============================================================
   V3 Full-Bleed Glass Auth Pages
   Used by: Login, ForgotPassword, ResetPassword,
            ChangeExpiredPassword, TenantSelection, AccessDenied.
   The shared chrome (background image + brand-mark + footer) lives
   in AuthLayout.razor — these rules style what sits on top of it.
   ============================================================ */

/* The auth layout itself is set by AuthLayout.razor; rules here only
   style the inner chrome. */

/* Brand mark — top-left corner */
.brand-mark {
    position: absolute;
    top: 28px;
    left: 32px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 2;
}
.brand-mark img {
    width: 56px;
    height: auto;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .4));
}
.brand-mark .name {
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    line-height: 1.2;
}
.brand-mark .name small {
    display: block;
    color: rgba(255, 255, 255, .7);
    font-weight: 400;
    font-size: 11px;
    margin-top: 2px;
}

/* Glass card — the form container */
.glass {
    width: 420px;
    background: rgba(15, 25, 40, .55);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .4), 0 4px 12px rgba(0, 0, 0, .2);
    color: #fff;
    z-index: 1;
}
.glass.glass-wide { width: 520px; padding: 28px; }   /* Tenant Selection */

.glass h1 {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.01em;
    color: #fff;
}
.glass .sub {
    color: rgba(255, 255, 255, .7);
    font-size: 13px;
    margin-top: 4px;
}

.glass .form {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.glass .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.glass .field label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, .7);
    letter-spacing: .5px;
    text-transform: uppercase;
}
.glass .input-wrap {
    height: 42px;
    padding: 0 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .15);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: border-color 120ms, background 120ms;
}
.glass .input-wrap:focus-within {
    border-color: rgba(110, 198, 243, .6);
    background: rgba(255, 255, 255, .12);
}
.glass .input-wrap > i { color: rgba(255, 255, 255, .6); flex-shrink: 0; }

/* Strip default InputText / DxTextBox chrome inside the glass */
.glass .glass-input,
.glass .input-wrap input {
    flex: 1;
    background: transparent;
    border: 0;
    outline: 0;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    padding: 0;
    min-width: 0;
}
.glass .glass-input::placeholder,
.glass .input-wrap input::placeholder { color: rgba(255, 255, 255, .45); }

/* Show/hide password */
.glass .reveal {
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, .55);
    cursor: pointer;
    padding: 4px 2px;
    margin-right: -6px;
}
.glass .reveal:hover { color: #fff; }

/* Remember-me + forgot link row */
.glass .row-2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}
.glass .row-2 .remember {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, .7);
    cursor: pointer;
}
.glass .row-2 .remember input[type="checkbox"] {
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, .4);
    background: rgba(255, 255, 255, .08);
    cursor: pointer;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.glass .row-2 .remember input[type="checkbox"]:checked {
    background: var(--primary, #0066cc);
    border-color: var(--primary, #0066cc);
}
.glass .row-2 .remember input[type="checkbox"]:checked::after {
    content: '\f00c';   /* fa-check */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 9px;
    color: #fff;
}
.glass .row-2 a {
    color: #6ec6f3;
    text-decoration: none;
    font-weight: 500;
}
.glass .row-2 a:hover { text-decoration: underline; }

/* Primary CTA */
.glass .btn-login {
    height: 44px;
    width: 100%;
    border-radius: 8px;
    background: var(--primary, #0066cc);
    color: #fff;
    border: 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
    box-shadow: 0 4px 14px rgba(0, 102, 204, .4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 120ms, box-shadow 120ms, transform 120ms;
}
.glass .btn-login:hover:not(:disabled) {
    background: var(--primary-hover, #0052a3);
    box-shadow: 0 6px 18px rgba(0, 102, 204, .55);
}
.glass .btn-login:disabled { opacity: .6; cursor: not-allowed; }
.glass .btn-login .spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: glass-spin 800ms linear infinite;
}
@keyframes glass-spin { to { transform: rotate(360deg); } }

/* Footer copyright strip */
.foot {
    position: absolute;
    bottom: 24px;
    left: 0; right: 0;
    text-align: center;
    color: rgba(255, 255, 255, .55);
    font-size: 11px;
    z-index: 1;
}
.foot b { color: rgba(255, 255, 255, .8); font-weight: 500; }

/* Back link */
.glass .back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, .7);
    font-size: 12px;
    text-decoration: none;
    margin-top: 18px;
}
.glass .back-link:hover { color: #fff; }

/* Inline alert in glass card */
.glass .glass-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.45;
}
.glass .glass-alert i { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.glass .glass-alert-danger {
    background: rgba(239, 68, 68, .15);
    border: 1px solid rgba(239, 68, 68, .35);
    color: #fda4af;
}
.glass .glass-alert-success {
    background: rgba(16, 185, 129, .15);
    border: 1px solid rgba(16, 185, 129, .35);
    color: #86efac;
}
.glass .glass-alert-warning {
    background: rgba(245, 158, 11, .15);
    border: 1px solid rgba(245, 158, 11, .35);
    color: #fcd34d;
}

/* Validation-message styling (Blazor's <ValidationMessage>) */
.glass .validation-message {
    color: #fda4af;
    font-size: 11px;
    margin-top: -2px;
}

/* "Password expired" status pill */
.glass .status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(245, 158, 11, .18);
    border: 1px solid rgba(245, 158, 11, .35);
    color: #fcd34d;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

/* Greeting strip (top of Tenant Selection) */
.glass .greet {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.glass .greet .avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2c7be5, #0066cc);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}
.glass .greet .who { font-size: 13px; }
.glass .greet .who b { color: #fff; }
.glass .greet .who small {
    display: block;
    color: rgba(255, 255, 255, .55);
    font-size: 11px;
    margin-top: 1px;
}

/* Tenant rows (Tenant Selection) */
.tenant-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 340px;
    overflow: auto;
    padding-right: 2px;
}
.tenant-list::-webkit-scrollbar { width: 6px; }
.tenant-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .15); border-radius: 3px; }

.tenant-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 10px;
    cursor: pointer;
    transition: background 120ms, border-color 120ms;
}
.tenant-row:hover {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .18);
}
.tenant-row.selected {
    background: rgba(0, 102, 204, .18);
    border-color: var(--primary, #0066cc);
    box-shadow: 0 0 0 1px var(--primary, #0066cc);
}
.tenant-row .avatar {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2c7be5, #0066cc);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}
.tenant-row .meta { flex: 1; min-width: 0; }
.tenant-row .meta .name {
    font-weight: 600;
    color: #fff;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tenant-row .meta .dom {
    font-size: 12px;
    color: rgba(255, 255, 255, .6);
    margin-top: 2px;
}
.tenant-row .meta .last {
    font-size: 11px;
    color: rgba(255, 255, 255, .45);
    margin-top: 4px;
}
.tenant-row .pills {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.tenant-row .pill {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .85);
    letter-spacing: .3px;
    text-transform: uppercase;
    font-weight: 600;
}
.tenant-row .pill.admin       { background: rgba(239, 68, 68, .25);  color: #fda4af; }
.tenant-row .pill.administrator { background: rgba(239, 68, 68, .25); color: #fda4af; }
.tenant-row .pill.super       { background: rgba(245, 158, 11, .25); color: #fcd34d; }
.tenant-row .pill.superuser   { background: rgba(245, 158, 11, .25); color: #fcd34d; }
.tenant-row .pill.user        { background: rgba(59, 130, 246, .25); color: #93c5fd; }
.tenant-row .pill.viewer      { background: rgba(107, 114, 128, .25); color: #d1d5db; }
.tenant-row .pill.default     { background: rgba(16, 185, 129, .2);  color: #86efac; }
.tenant-row .radio {
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tenant-row.selected .radio {
    border-color: var(--primary, #0066cc);
    background: var(--primary, #0066cc);
}
.tenant-row.selected .radio::after {
    content: '';
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #fff;
}

/* Password strength meter (Change Expired) */
.pw-meter {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}
.pw-meter .seg {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, .12);
}
.pw-meter .seg.on.weak { background: var(--danger, #ef4444); }
.pw-meter .seg.on.med  { background: var(--warning, #f59e0b); }
.pw-meter .seg.on      { background: var(--success, #10b981); }

.pw-req {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, .04);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 8px;
    font-size: 11px;
}
.pw-req .ttl {
    color: rgba(255, 255, 255, .6);
    font-weight: 600;
    letter-spacing: .4px;
    text-transform: uppercase;
    font-size: 10px;
    margin-bottom: 6px;
}
.pw-req .item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    color: rgba(255, 255, 255, .55);
}
.pw-req .item i { width: 12px; font-size: 9px; }
.pw-req .item.ok { color: #86efac; }

/* ============================================================
   V3 Dashboard (Index.razor)
   Companion to document-pattern.css. The page composes a hero
   greeting, a KPI strip with sparklines, a main column (chart +
   activity + 2-col ageing / top-customers) and a right rail of
   quick-actions / needs-attention / expiring quotations.
   ============================================================ */

/* Hero greeting */
.dash-greet h1 {
    font-size: 26px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
    color: var(--gray-900);
}
.dash-greet .sub {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 2px;
}
.dash-greet { margin-bottom: 18px; }

/* KPI strip */
.kpi-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    position: relative;
    overflow: hidden;
}
.kpi .ico {
    position: absolute; top: 14px; right: 16px;
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
}
.kpi .ico.primary { background: var(--primary-light); color: var(--primary); }
.kpi .ico.success { background: var(--success-light); color: var(--success); }
.kpi .ico.warning { background: var(--warning-light); color: var(--warning); }
.kpi .ico.danger  { background: var(--danger-light);  color: var(--danger);  }

.kpi .ttl {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-secondary);
    font-weight: 600;
}
.kpi .val {
    font-size: 26px;
    font-weight: 700;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
    letter-spacing: -0.02em;
}
.kpi .delta {
    display: inline-flex;
    align-items: center; gap: 4px;
    font-size: 12px; font-weight: 600;
    margin-top: 4px;
}
.kpi .delta.up   { color: var(--success); }
.kpi .delta.down { color: var(--danger);  }
.kpi .delta.flat { color: var(--text-secondary); }
.kpi .delta .vs  { color: var(--text-secondary); font-weight: 400; margin-left: 4px; }
.kpi .spark      { margin-top: 10px; height: 36px; }

/* Page grid: main + right rail */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
    align-items: start;
}
.dash-main { display: flex; flex-direction: column; gap: 12px; }
.dash-rail { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; }

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Revenue chart card extras */
.chart-summary {
    display: flex;
    gap: 24px;
    margin-bottom: 12px;
}
.chart-summary .cell .lbl {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .4px;
    font-weight: 600;
    color: var(--text-secondary);
}
.chart-summary .cell .v {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
}
.chart-summary .cell .v.muted { color: var(--text-secondary); font-weight: 600; }

.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-secondary); }
.legend .it { display: inline-flex; align-items: center; gap: 6px; }
.legend .it .dot { width: 8px; height: 8px; border-radius: 50%; }

/* Activity grid — kill default header, smaller rows */
.activity-grid .dxbl-grid-header-content { display: none !important; }
.activity-grid .dxbl-grid-table > tbody > tr > td {
    padding: 10px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}
.activity-grid .av-ico {
    width: 30px; height: 30px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px;
}
.activity-grid .av-ico.success { background: var(--success-light); color: var(--success); }
.activity-grid .av-ico.warning { background: var(--warning-light); color: var(--warning); }
.activity-grid .av-ico.danger  { background: var(--danger-light);  color: var(--danger);  }
.activity-grid .av-ico.info    { background: var(--info-light);    color: var(--info);    }
.activity-grid .av-ico.primary { background: var(--primary-light); color: var(--primary); }
.activity-grid .ref {
    font-family: ui-monospace, "JetBrains Mono", monospace;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}
.activity-grid .ref:hover { text-decoration: underline; }

/* Ageing rows */
.age-row {
    display: grid;
    grid-template-columns: 1fr 100px 80px;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dotted var(--border);
    font-size: 13px;
}
.age-row:last-child { border-bottom: 0; }
.age-bar {
    height: 6px;
    background: var(--gray-100);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}
.age-bar .fill { height: 100%; border-radius: 3px; }

/* Top customers */
.customer-row {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    gap: 12px;
    padding: 10px 0;
    align-items: center;
    border-bottom: 1px dotted var(--border);
    font-size: 13px;
}
.customer-row:last-child { border-bottom: 0; }
.customer-row .cust-av {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 11px;
}
.customer-row .cust-name { font-weight: 500; }
.customer-row .cust-meta { color: var(--text-secondary); font-size: 11px; margin-top: 1px; }
.customer-row .cust-amt  { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Quick actions tile grid (right rail) */
.quick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.qa-tile {
    /* Applied to <DxButton CssClass="qa-tile"> — override DevExtreme defaults */
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    align-items: flex-start !important;
    padding: 14px 12px !important;
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    cursor: pointer;
    transition: border-color 120ms, box-shadow 120ms;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--gray-800) !important;
    height: auto !important;
    text-align: left !important;
    box-shadow: none !important;
}
.qa-tile:hover {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px var(--primary-light) !important;
}
.qa-tile .ico {
    width: 28px; height: 28px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
}

/* Needs attention rows */
.task-row {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    align-items: flex-start;
    border-bottom: 1px dotted var(--border);
}
.task-row:last-child { border-bottom: 0; }
.task-row .tk-ico {
    width: 28px; height: 28px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}
.task-row .body { flex: 1; min-width: 0; }
.task-row .ttl { font-size: 13px; font-weight: 500; color: var(--gray-900); }
.task-row .det { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.task-row .cta {
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    padding-top: 4px;
    text-decoration: none;
}

/* Expiring quotations rows */
.exp-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 8px 0;
    align-items: center;
    border-bottom: 1px dotted var(--border);
    font-size: 13px;
}
.exp-row:last-child { border-bottom: 0; }
.exp-row .num {
    font-family: ui-monospace, "JetBrains Mono", monospace;
    color: var(--primary);
    font-weight: 600;
    font-size: 12px;
}
.exp-row .cust {
    color: var(--text-secondary);
    font-size: 11px;
    margin-top: 1px;
}

/* Responsive: stack rail under main on narrow screens */
@media (max-width: 1200px) {
    .dash-grid { grid-template-columns: 1fr; }
    .dash-rail { position: static; }
    .two-col   { grid-template-columns: 1fr; }
    .kpi-strip { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   V3 Sidebar / NavMenu — dark navy + brand tile + section caps
   Pairs with NavMenu.razor and the .app-sidebar background in
   MainLayout.razor (#0f172a).
   ============================================================ */

.nav-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 14px 0 24px;
    font-family: 'Inter', system-ui, sans-serif;
}

.nav-header {
    padding: 4px 16px 18px;
}

.brand-tile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 10px;
}
.brand-tile .logo-square {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 102, 204, .35);
}
.brand-tile .brand-text {
    min-width: 0;
    line-height: 1.15;
}
.brand-tile .brand-name {
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .2px;
}
.brand-tile .brand-tenant {
    color: rgba(255, 255, 255, .55);
    font-size: 11px;
    font-weight: 400;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 168px;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 8px;
    overflow-y: auto;
}
.nav-menu::-webkit-scrollbar { width: 6px; }
.nav-menu::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .1); border-radius: 3px; }

.nav-section {
    display: flex;
    flex-direction: column;
    margin-top: 6px;
}

.nav-section-title {
    padding: 14px 14px 6px;
    color: rgba(255, 255, 255, .45);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-group {
    display: flex;
    flex-direction: column;
}

/* Top-level nav row — applies to <NavLink> and the <button> toggle */
.nav-container .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin: 1px 0;
    border-radius: 8px;
    color: rgba(255, 255, 255, .78);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    background: transparent;
    border: 0;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background 120ms, color 120ms;
}
.nav-container .nav-item:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}
.nav-container .nav-item.active,
.nav-container .nav-item:focus-visible {
    background: rgba(37, 99, 235, .22);
    color: #fff;
    outline: 0;
    box-shadow: inset 3px 0 0 var(--primary);
}

.nav-container .nav-icon {
    width: 16px;
    text-align: center;
    color: rgba(255, 255, 255, .55);
    font-size: 13px;
}
.nav-container .nav-item:hover .nav-icon,
.nav-container .nav-item.active .nav-icon {
    color: #fff;
}

.nav-container .nav-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-arrow {
    color: rgba(255, 255, 255, .35);
    font-size: 10px;
    transition: transform 120ms;
}

/* Sub-menu (open under a nav-toggle) */
.nav-submenu {
    display: none;
    flex-direction: column;
    padding: 4px 0 6px 26px;
    gap: 1px;
}
.nav-submenu.show { display: flex; }

.nav-container .nav-subitem {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: 6px;
    color: rgba(255, 255, 255, .65);
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: none;
    transition: background 120ms, color 120ms;
}
.nav-container .nav-subitem:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}
.nav-container .nav-subitem.active {
    background: rgba(37, 99, 235, .25);
    color: #fff;
    box-shadow: inset 2px 0 0 var(--primary);
}
.nav-container .nav-subitem .nav-icon {
    width: 14px;
    font-size: 11px;
    color: rgba(255, 255, 255, .45);
}
.nav-container .nav-subitem:hover .nav-icon,
.nav-container .nav-subitem.active .nav-icon { color: #fff; }
