/* ============================================================
   MUBSIRA BUSINESS -- Design System
   Black and white. SaaS grade. No fluff.
   ============================================================ */

:root {
    --color-bg:             #fafafa;
    --color-surface:        #ffffff;
    --color-surface-alt:    #f5f5f5;
    --color-border:         #e5e5e5;
    --color-border-strong:  #d4d4d4;

    --color-text:           #0a0a0a;
    --color-text-secondary: #404040;
    --color-text-muted:     #737373;
    --color-text-faint:     #a3a3a3;

    --color-accent:         #0a0a0a;
    --color-accent-hover:   #262626;
    --color-accent-inverse: #ffffff;

    --color-primary:        #4f46e5;
    --color-primary-light:  rgba(79, 70, 229, 0.08);
    --color-primary-soft:   rgba(79, 70, 229, 0.1);

    --color-success:        #16a34a;
    --color-success-bg:     #f0fdf4;
    --color-warning:        #ca8a04;
    --color-warning-bg:     #fefce8;
    --color-danger:         #dc2626;
    --color-danger-bg:      #fef2f2;
    --color-info:           #2563eb;
    --color-info-bg:        #eff6ff;

    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", Consolas, monospace;

    --text-xs:    0.75rem;
    --text-sm:    0.8125rem;
    --text-base:  0.875rem;
    --text-md:    0.9375rem;
    --text-lg:    1.0625rem;
    --text-xl:    1.25rem;
    --text-2xl:   1.5rem;
    --text-3xl:   1.875rem;

    --weight-normal:   400;
    --weight-medium:   500;
    --weight-semibold: 600;
    --weight-bold:     700;

    --leading-tight:   1.2;
    --leading-snug:    1.35;
    --leading-normal:  1.5;

    --space-1:  0.25rem;
    --space-2:  0.5rem;
    --space-3:  0.75rem;
    --space-4:  1rem;
    --space-5:  1.25rem;
    --space-6:  1.5rem;
    --space-8:  2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    --shadow-xs:  0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.06);
    --shadow-md:  0 4px 8px rgba(0,0,0,0.06);
    --shadow-lg:  0 8px 24px rgba(0,0,0,0.08);

    --transition-fast: 100ms ease;
    --transition-base: 180ms ease;

    --max-width: 1120px;
    --sidebar-width: 220px;
}


/* ---------- Reset ---------- */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    font-weight: var(--weight-normal);
    line-height: var(--leading-normal);
    color: var(--color-text);
    background-color: var(--color-bg);
    min-height: 100vh;
    overflow-wrap: break-word;
    word-break: break-word;
    -webkit-text-size-adjust: 100%;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }


/* ============================================================
   LAYOUT
   ============================================================ */

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


/* ---------- Sidebar ---------- */

.sidebar {
    width: var(--sidebar-width);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    transition: transform var(--transition-base);
}

.sidebar-header {
    padding: var(--space-5) var(--space-5) var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.sidebar-logo {
    font-size: var(--text-md);
    font-weight: var(--weight-bold);
    letter-spacing: -0.02em;
    color: var(--color-text);
}

.sidebar-logo-dot {
    color: var(--color-text-muted);
}

.sidebar-label {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: var(--weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-faint);
    margin-top: var(--space-3);
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-3) var(--space-2);
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: var(--space-4);
}

.sidebar-section-title {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: var(--weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-faint);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-1);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0.4375rem var(--space-3);
    font-size: var(--text-sm);
    font-weight: var(--weight-normal);
    color: var(--color-text-secondary);
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.sidebar-link:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.sidebar-link.active {
    background: var(--color-surface-alt);
    color: var(--color-text);
    font-weight: var(--weight-medium);
}

.sidebar-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.55;
}

.sidebar-link.active svg {
    opacity: 0.85;
}

.sidebar-badge {
    margin-left: auto;
    font-size: 0.6875rem;
    font-weight: var(--weight-semibold);
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--color-danger);
    color: #fff;
    padding: 0 5px;
}

/* Tax season badge on Export Center nav item */
.nav-tax-badge {
    margin-left: auto;
    font-size: 0.575rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 4px;
    background: linear-gradient(135deg, #f59e0b, #ea580c);
    color: #fff;
    white-space: nowrap;
    animation: taxBadgePulse 3s ease-in-out infinite;
}
@keyframes taxBadgePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.sidebar-footer {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--color-border);
}

.sidebar-footer-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    transition: color var(--transition-fast);
}

.sidebar-footer-link:hover {
    color: var(--color-text);
}

/* Sidebar backdrop -- hidden on desktop */
.sidebar-backdrop {
    display: none;
}


/* ---------- Main Content ---------- */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 48px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.topbar-title {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.menu-toggle {
    display: none;
    padding: var(--space-2);
}

.menu-toggle svg {
    width: 18px;
    height: 18px;
}

.page-content {
    flex: 1;
    padding: var(--space-6);
    max-width: 960px;
}

.page-content-wide {
    flex: 1;
    padding: var(--space-6);
}


/* ============================================================
   TYPOGRAPHY
   ============================================================ */

.page-title {
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    letter-spacing: -0.02em;
    line-height: var(--leading-tight);
    color: var(--color-text);
    margin-bottom: var(--space-1);
}

.page-subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-6);
}

.section-heading {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
    margin-bottom: var(--space-3);
}

.label {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
}

.mono {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}


/* ============================================================
   COMPONENTS
   ============================================================ */

/* ---------- Cards ---------- */

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-5);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.card-title {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
}

.card-body {
    padding: 0.5rem 0 0;
}


/* ---------- Stat Cards ---------- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
}

.stat-label {
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--space-2);
}

.stat-value {
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    letter-spacing: -0.02em;
    color: var(--color-text);
    line-height: 1;
}

.stat-sub {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-1);
}

.stat-positive .stat-value { color: var(--color-success, #22c55e); }
.stat-negative .stat-value { color: var(--color-danger, #ef4444); }


/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0.5rem 1rem;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    line-height: 1;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
    white-space: nowrap;
    cursor: pointer;
}

.btn svg {
    width: 14px;
    height: 14px;
}

.btn-primary {
    background: var(--color-accent);
    color: var(--color-accent-inverse);
    border-color: var(--color-accent);
}

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

.btn-success {
    background: #22c55e;
    color: #fff;
    border-color: #22c55e;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border-strong);
}

.btn-secondary:hover {
    background: var(--color-surface-alt);
    border-color: var(--color-text-muted);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
    border-color: var(--color-danger);
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 0.3125rem 0.625rem;
    font-size: var(--text-xs);
}

.btn-active,
.btn-ghost.btn-active {
    background: var(--color-accent);
    color: var(--color-accent-inverse);
    border-color: var(--color-accent);
}

.btn-active:hover,
.btn-ghost.btn-active:hover {
    background: var(--color-accent-hover);
}

.btn-lg {
    padding: 0.625rem 1.25rem;
    font-size: var(--text-base);
}

.btn-icon {
    padding: 0.375rem;
    border-radius: var(--radius-sm);
}


/* ---------- Form Controls ---------- */

.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-text);
    margin-bottom: var(--space-1);
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: 2px;
    margin-bottom: var(--space-1);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.4375rem 0.625rem;
    font-size: var(--text-sm);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-text);
}

.form-input::placeholder {
    color: var(--color-text-faint);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-4);
}


/* ---------- Table ---------- */

.table-wrapper {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    gap: var(--space-3);
}

.table-search {
    width: 220px;
    padding: 0.3125rem 0.625rem;
    font-size: var(--text-xs);
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
}

.table-search:focus {
    outline: none;
    border-color: var(--color-text-muted);
}

.data-table {
    width: 100%;
    font-size: var(--text-sm);
}

.data-table th {
    text-align: left;
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    background: var(--color-surface-alt);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.data-table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

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

.data-table tr:hover td {
    background: var(--color-surface-alt);
}

.data-table .text-right {
    text-align: right;
}

.data-table .text-center {
    text-align: center;
}

.data-table .col-actions {
    width: 100px;
    text-align: right;
}

/* ---------- Row Action Menu ---------- */
.action-menu-wrap {
    position: relative;
    display: inline-block;
}
.action-menu-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.action-menu-trigger:hover {
    background: var(--color-surface-alt);
    border-color: var(--color-border-strong);
    color: var(--color-text);
}
.action-menu-dropdown {
    display: none;
    position: fixed;
    z-index: 9999;
    min-width: 180px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    padding: 4px 0;
    animation: menuFadeIn 0.12s ease;
}
@keyframes menuFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.action-menu-dropdown.open {
    display: block;
}
.action-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: none;
    color: var(--color-text);
    font-size: var(--text-sm);
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
    white-space: nowrap;
}
.action-menu-item:hover {
    background: var(--color-surface-alt);
}
.action-menu-item svg {
    flex-shrink: 0;
    color: var(--color-text-muted);
}
.action-menu-item:hover svg {
    color: var(--color-text);
}
.action-menu-item.menu-danger {
    color: var(--color-danger);
}
.action-menu-item.menu-danger svg {
    color: var(--color-danger);
}
.action-menu-item.menu-disabled {
    opacity: 0.38;
    pointer-events: none;
}
.action-menu-sep {
    height: 1px;
    background: var(--color-border);
    margin: 4px 0;
}


/* ---------- Status Badges ---------- */

.status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    padding: 2px 8px;
    border-radius: 9999px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-draft       { background: var(--color-surface-alt); color: var(--color-text-muted); }
.status-draft .status-dot { background: var(--color-text-faint); }

.status-sent        { background: var(--color-info-bg); color: var(--color-info); }
.status-sent .status-dot  { background: var(--color-info); }

.status-paid        { background: var(--color-success-bg); color: var(--color-success); }
.status-paid .status-dot  { background: var(--color-success); }

.status-overdue     { background: var(--color-danger-bg); color: var(--color-danger); }
.status-overdue .status-dot { background: var(--color-danger); }

.status-partial     { background: var(--color-warning-bg); color: var(--color-warning); }
.status-partial .status-dot { background: var(--color-warning); }

.status-cancelled   { background: var(--color-surface-alt); color: var(--color-text-faint); }
.status-cancelled .status-dot { background: var(--color-text-faint); }

.status-accepted    { background: #dcfce7; color: #15803d; }
.status-accepted .status-dot { background: #15803d; }

.status-declined    { background: #fef2f2; color: #b91c1c; }
.status-declined .status-dot { background: #b91c1c; }

.status-converted   { background: #ede9fe; color: #7c3aed; }
.status-converted .status-dot { background: #7c3aed; }

/* Quote badge in invoice list */
.doc-type-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    vertical-align: middle;
    margin-left: 0.4rem;
}
.doc-type-badge.badge-quote {
    background: #fef3c7;
    color: #92400e;
}


/* ---------- Empty State ---------- */

.empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-6);
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-4);
    color: var(--color-text-faint);
}

.empty-state-title {
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.empty-state-desc {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-6);
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}


/* ---------- Smart Summary ---------- */

.smart-summary {
    margin-bottom: var(--space-4);
    padding: var(--space-3) 0;
}

.smart-summary-text {
    font-size: var(--text-md);
    font-weight: var(--weight-medium);
    color: var(--color-text-secondary);
    line-height: var(--leading-normal);
    margin: 0;
}

/* ---------- Action Center ---------- */

.action-center-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
    overflow: hidden;
}

.action-center-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.action-center-title {
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
    margin-bottom: 2px;
}

.action-center-subtitle {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.action-center-list {
    padding: 0;
}

.action-center-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition-fast);
}

.action-center-item:last-child {
    border-bottom: none;
}

.action-center-item:hover {
    background: var(--color-surface-alt);
}

.action-center-item-danger {
    border-left: 3px solid var(--color-danger);
}

.action-center-item-warn {
    border-left: 3px solid var(--color-warning);
}

.action-center-item-info {
    border-left: 3px solid var(--color-info);
}

.action-center-icon {
    flex-shrink: 0;
    color: var(--color-text-muted);
}

.action-center-item-danger .action-center-icon { color: var(--color-danger); }
.action-center-item-warn .action-center-icon   { color: var(--color-warning); }
.action-center-item-info .action-center-icon   { color: var(--color-info); }

.action-center-text {
    flex: 1;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-text);
    min-width: 0;
}

.action-center-btns {
    display: flex;
    gap: var(--space-2);
    flex-shrink: 0;
}

.action-center-btns .btn {
    font-size: 0.7rem;
    padding: 3px 10px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    background: var(--color-surface);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.action-center-btns .btn:hover {
    background: var(--color-accent);
    color: var(--color-accent-inverse);
    border-color: var(--color-accent);
}

/* Action Center: all-clear state */
.action-center-clear {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5);
    background: var(--color-success-bg);
    border-color: rgba(34, 197, 94, 0.2);
}

.action-center-clear svg {
    color: var(--color-success);
}

.action-center-clear-title {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
    margin-bottom: 2px;
}

.action-center-clear-sub {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

@media (max-width: 600px) {
    .action-center-item {
        flex-wrap: wrap;
        gap: var(--space-2);
        padding: var(--space-3);
    }
    .action-center-btns {
        width: 100%;
        justify-content: flex-end;
    }
    .action-center-text {
        flex: 1 1 calc(100% - 32px);
    }
}


/* ---------- Dashboard Quick Action Bar ---------- */

.dashboard-quick-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.btn-quick-receipt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    line-height: 1;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-success, #22c55e);
    background: var(--color-success, #22c55e);
    color: #fff;
    cursor: pointer;
    transition: opacity var(--transition-fast);
    white-space: nowrap;
}

.btn-quick-receipt:hover {
    opacity: 0.9;
}


/* ---------- Data Trust Banner ---------- */

.trust-banner {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 1rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.06) 0%, rgba(34, 197, 94, 0.02) 100%);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    line-height: 1.5;
    color: var(--color-text-secondary);
    flex-wrap: wrap;
}

.trust-banner-text {
    flex: 1;
    min-width: 0;
}

.trust-banner-link {
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    color: var(--color-primary);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.trust-banner-link:hover {
    text-decoration: underline;
}

@media (max-width: 600px) {
    .trust-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.375rem;
        padding: 0.5rem 0.75rem;
    }
    .trust-banner-link {
        align-self: flex-end;
    }
}

/* ---------- Guidance Callouts ---------- */

.guidance {
    position: relative;
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
    color: var(--color-text-secondary);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
}

.guidance p {
    margin: 0;
}

.guidance p + p {
    margin-top: var(--space-2);
}

.guidance-title {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.guidance-info {
    border-left-color: var(--color-info);
}

.guidance-warn {
    border-left-color: var(--color-warning);
    background: var(--color-warning-bg);
}

.guidance-danger {
    border-left-color: var(--color-danger);
    background: var(--color-danger-bg);
}

.guidance-success {
    border-left-color: var(--color-success);
    background: var(--color-success-bg);
}

.guidance-compact {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.guidance-section {
    margin-top: var(--space-6);
    margin-bottom: var(--space-4);
}

.guidance-section .guidance {
    margin-bottom: var(--space-3);
}


/* ---------- Modal ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.modal-title {
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
}

.modal-close {
    padding: var(--space-1);
    color: var(--color-text-muted);
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--color-text);
}

.modal-body {
    padding: var(--space-5);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--color-border);
}

/* ---------- Confirm Action Dialog ---------- */

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.confirm-dialog {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 420px;
    padding: 2rem;
    text-align: center;
}

.confirm-icon {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-title {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.confirm-message {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.confirm-actions .btn {
    min-width: 100px;
    padding: 0.5rem 1.25rem;
}

/* Slide-in animation for confirm dialog */
.animate-slide-in {
    animation: confirmSlideIn 0.2s ease-out;
}

@keyframes confirmSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}


/* ---------- Timeline ---------- */

.timeline {
    position: relative;
    padding-left: var(--space-6);
}

.timeline::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 4px;
    bottom: 4px;
    width: 1px;
    background: var(--color-border);
}

.timeline-item {
    position: relative;
    padding-bottom: var(--space-4);
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: calc(-1 * var(--space-6) + 3px);
    top: 4px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--color-border-strong);
    border: 2px solid var(--color-surface);
}

.timeline-item:first-child .timeline-dot {
    background: var(--color-text);
}

.timeline-content {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.timeline-date {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-text-faint);
    margin-top: 2px;
}


/* ---------- Tabs ---------- */

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-5);
}

.tab {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.tab:hover {
    color: var(--color-text);
}

.tab.active {
    color: var(--color-text);
    border-bottom-color: var(--color-text);
}

.tab-count {
    font-size: var(--text-xs);
    color: var(--color-text-faint);
    margin-left: var(--space-1);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}


/* ---------- Toast / Notification ---------- */

.toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--color-text);
    color: #fff;
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: toast-in 200ms ease;
}

.toast-success { background: var(--color-success); }
.toast-error   { background: var(--color-danger);  }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ---------- Update Banner ---------- */

.update-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 500;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
}

.update-banner.visible {
    transform: translateY(0);
    opacity: 1;
}

.update-banner-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.5rem;
}

.update-banner-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary-soft, rgba(99, 102, 241, 0.1));
    color: var(--color-primary);
    border-radius: 50%;
}

.update-banner-text {
    flex: 1;
    min-width: 0;
}

.update-banner-title {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--color-text);
    margin-bottom: 2px;
}

.update-banner-desc {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    line-height: 1.4;
}

.update-banner-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.update-banner-progress {
    height: 3px;
    background: var(--color-border);
    overflow: hidden;
}

.update-banner-progress-bar {
    height: 100%;
    background: var(--color-primary);
    width: 0%;
    transition: width 0.4s ease;
    border-radius: 0 3px 3px 0;
}

@media (max-width: 768px) {
    .update-banner-inner {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }
    .update-banner-icon {
        width: 32px;
        height: 32px;
    }
    .update-banner-icon svg {
        width: 18px;
        height: 18px;
    }
    .update-banner-text {
        flex: 1 1 calc(100% - 48px);
    }
    .update-banner-actions {
        width: 100%;
        justify-content: flex-end;
    }
}


/* ---------- Language Toggle ---------- */

.lang-toggle {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    padding: 2px 6px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition-fast), color var(--transition-fast);
}

.lang-toggle:hover {
    color: var(--color-text);
    border-color: var(--color-text-muted);
}


/* ---------- Detail Panel ---------- */

.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.detail-title-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.detail-id {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-text-faint);
}

.detail-actions {
    display: flex;
    gap: var(--space-2);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.detail-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-block-label {
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

.detail-block-value {
    font-size: var(--text-sm);
    color: var(--color-text);
}


/* ---------- Invoice Preview ---------- */

.invoice-preview {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-lg, 12px);
    padding: 2rem 2.5rem;
    max-width: 750px;
    color: #1a1a1a;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

[data-theme="dark"] .invoice-preview {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

.invoice-preview-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-8);
}

.invoice-preview-company {
    font-size: var(--text-md);
    font-weight: var(--weight-bold);
    color: var(--color-text);
    margin-bottom: var(--space-1);
}

.invoice-preview-meta {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    line-height: var(--leading-normal);
}

.invoice-preview-title {
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    letter-spacing: -0.02em;
    color: var(--color-text);
    text-align: right;
}

.invoice-preview-number {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    text-align: right;
    margin-top: var(--space-1);
}

.invoice-preview-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
    margin-bottom: var(--space-8);
    font-size: var(--text-sm);
}

.invoice-preview-party-label {
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-2);
}

.invoice-preview-table {
    width: 100%;
    font-size: var(--text-sm);
    margin-bottom: var(--space-6);
}

.invoice-preview-table th {
    text-align: left;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-text);
}

.invoice-preview-table td {
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border);
}

.invoice-preview-totals {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-2);
    font-size: var(--text-sm);
}

.invoice-preview-total-row {
    display: flex;
    gap: var(--space-8);
    min-width: 200px;
    justify-content: space-between;
}

.invoice-preview-total-row.grand {
    font-weight: var(--weight-bold);
    font-size: var(--text-md);
    padding-top: var(--space-2);
    border-top: 2px solid var(--color-text);
}

.invoice-preview-notes {
    margin-top: var(--space-8);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}


/* ---------- Global Search (Spotlight) ---------- */

.search-trigger {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0.3125rem 0.75rem;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast);
    min-width: 180px;
}

.search-trigger:hover {
    border-color: var(--color-text-muted);
    color: var(--color-text);
}

.search-trigger svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.5;
}

.search-trigger-label {
    flex: 1;
    text-align: left;
}

.search-kbd {
    font-family: var(--font-mono);
    font-size: 0.5625rem;
    font-weight: var(--weight-medium);
    letter-spacing: 0.04em;
    padding: 1px 4px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    color: var(--color-text-faint);
    line-height: 1.4;
}

.spotlight-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 500;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: min(20vh, 140px);
}

.spotlight-overlay.open {
    display: flex;
}

.spotlight {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 48px rgba(0,0,0,0.15), 0 0 0 1px var(--color-border);
    width: 100%;
    max-width: 560px;
    overflow: hidden;
    animation: spotlight-in 120ms ease-out;
}

@keyframes spotlight-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.spotlight-input-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.spotlight-icon {
    flex-shrink: 0;
    color: var(--color-text-muted);
}

.spotlight-input {
    flex: 1;
    border: none;
    outline: none;
    background: none;
    font-size: var(--text-md);
    font-family: var(--font-sans);
    color: var(--color-text);
    padding: var(--space-1) 0;
}

.spotlight-input::placeholder {
    color: var(--color-text-faint);
}

.spotlight-esc {
    font-family: var(--font-mono);
    font-size: 0.5625rem;
    font-weight: var(--weight-medium);
    padding: 2px 5px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    color: var(--color-text-faint);
    flex-shrink: 0;
}

.spotlight-results {
    max-height: 360px;
    overflow-y: auto;
}

.spotlight-group {
    padding: var(--space-1) 0;
}

.spotlight-group-title {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: var(--weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-faint);
    padding: var(--space-2) var(--space-4) var(--space-1);
}

.spotlight-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    cursor: pointer;
    transition: background-color 60ms;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--color-text);
}

.spotlight-item:hover,
.spotlight-item.active {
    background: var(--color-surface-alt);
}

.spotlight-item-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-alt);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.spotlight-item:hover .spotlight-item-icon,
.spotlight-item.active .spotlight-item-icon {
    background: var(--color-border);
}

.spotlight-item-icon svg {
    width: 14px;
    height: 14px;
    stroke: var(--color-text-secondary);
}

.spotlight-item-text {
    flex: 1;
    min-width: 0;
}

.spotlight-item-title {
    font-weight: var(--weight-medium);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spotlight-item-title mark {
    background: none;
    color: var(--color-text);
    font-weight: var(--weight-bold);
    text-decoration: underline;
    text-decoration-color: var(--color-text-muted);
    text-underline-offset: 2px;
}

.spotlight-item-sub {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spotlight-item-badge {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    color: var(--color-text-faint);
    flex-shrink: 0;
}

.spotlight-empty {
    padding: var(--space-8) var(--space-4);
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.spotlight-hint {
    padding: var(--space-2) var(--space-4) var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    border-top: 1px solid var(--color-border);
    font-size: 0.6875rem;
    color: var(--color-text-faint);
}

.spotlight-hint kbd {
    font-family: var(--font-mono);
    font-size: 0.5625rem;
    font-weight: var(--weight-medium);
    padding: 1px 4px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    margin-right: 2px;
}

@media (max-width: 768px) {
    .search-trigger {
        min-width: auto;
        padding: 0.3125rem;
    }
    .search-trigger-label,
    .search-kbd {
        display: none;
    }
    .spotlight {
        max-width: calc(100vw - 2rem);
        margin: 0 1rem;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        width: 260px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Dark backdrop behind open sidebar */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 49;
        opacity: 0;
        transition: opacity 0.25s ease;
    }
    .sidebar-backdrop.visible {
        display: block;
        opacity: 1;
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
    }

    .page-content,
    .page-content-wide {
        padding: var(--space-3);
    }

    .page-title {
        font-size: var(--text-lg);
    }

    .page-subtitle {
        font-size: var(--text-xs);
        margin-bottom: var(--space-4);
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-3);
    }

    .stat-card {
        padding: var(--space-3);
    }

    .stat-value {
        font-size: var(--text-xl);
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

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

    .invoice-preview-header {
        flex-direction: column;
        gap: var(--space-4);
    }

    .invoice-preview-title {
        text-align: left;
    }

    .invoice-preview-number {
        text-align: left;
    }

    .invoice-preview-parties {
        grid-template-columns: 1fr;
    }

    /* Responsive tables */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 520px;
    }

    .data-table th,
    .data-table td {
        padding: var(--space-2) var(--space-3);
        font-size: var(--text-xs);
        max-width: 160px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .data-table .col-actions {
        width: 48px;
        min-width: 48px;
        position: sticky;
        right: 0;
        background: var(--color-surface);
        box-shadow: -4px 0 8px rgba(0,0,0,0.04);
    }

    .data-table tr:hover .col-actions {
        background: var(--color-surface-alt);
    }

    .table-search {
        width: 100%;
        min-width: 0;
    }

    /* Modal full screen on mobile */
    .modal {
        max-width: 100vw;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }

    .modal-footer {
        flex-direction: column;
        gap: var(--space-2);
    }

    .modal-footer .btn {
        width: 100%;
    }

    /* Touch-friendly tap targets */
    .btn {
        min-height: 40px;
    }

    .btn-sm {
        min-height: 34px;
    }

    .sidebar-link {
        padding: 0.625rem var(--space-3);
        font-size: var(--text-base);
        min-height: 44px;
    }

    /* Toolbar stacking */
    .page-content-wide > div[style*="justify-content:space-between"] {
        flex-direction: column;
        align-items: stretch !important;
    }

    /* Dashboard health row */
    .dashboard-health-row {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }

    /* Export layout */
    .export-layout {
        grid-template-columns: 1fr;
    }

    /* Confirm dialog */
    .confirm-dialog {
        max-width: calc(100vw - 2rem);
    }

    /* Collapsible section toggle icon */
    .section-collapse-icon {
        transition: transform 0.25s ease;
    }
    .section-collapse-icon.collapsed {
        transform: rotate(-90deg);
    }
}

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

    .detail-header {
        flex-direction: column;
        gap: var(--space-3);
    }

    .page-content,
    .page-content-wide {
        padding: var(--space-2);
    }

    .page-title {
        font-size: var(--text-md);
    }

    .stat-value {
        font-size: var(--text-lg);
    }

    .data-table {
        min-width: 440px;
    }

    .modal-body {
        padding: var(--space-3);
    }

    .modal-header {
        padding: var(--space-3) var(--space-4);
    }

    .card {
        padding: var(--space-3);
    }

    .topbar {
        padding: 0 var(--space-3);
    }
}

/* ============================================================
   CLIENT DOSSIER (inside modal)
   ============================================================ */

/* Financial stats row — 5 stat boxes in a responsive row */
.client-dossier-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 0;
    margin-bottom: 1.25rem;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.client-dossier-stats > div {
    flex: 1;
    min-width: 90px;
    text-align: center;
    padding: 0.5rem 0.25rem;
}

.client-dossier-stats .stat-label {
    font-size: 0.65rem;
    margin-bottom: 4px;
}

.client-dossier-stats .stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Smart summary banner inside dossier */
.client-smart-summary {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--color-surface-alt);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.5;
    border-left: 3px solid var(--color-primary);
}

.client-smart-summary svg {
    flex-shrink: 0;
    margin-top: 2px;
}

/* Timeline inside client dossier */
.client-timeline {
    position: relative;
    padding-left: 1.25rem;
}

.client-timeline::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--color-border);
    border-radius: 1px;
}

.client-timeline-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
}

.client-timeline-item:last-child {
    padding-bottom: 0;
}

.client-timeline-item .timeline-dot {
    position: absolute;
    left: calc(-1.25rem + 3px);
    top: 5px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--color-border-strong, var(--color-text-muted));
    border: 2px solid var(--color-surface);
    flex-shrink: 0;
    z-index: 1;
}

.client-timeline-item:first-child .timeline-dot {
    background: var(--color-primary);
}

/* Collapsible cards inside dossier modal */
.modal-body .card {
    margin-bottom: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
}

.modal-body .card .collapsible-header {
    padding: 0.25rem 0;
}

.modal-body .card .section-heading {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0;
}

.modal-body .card .collapsible-body {
    padding-top: 0.5rem;
}

/* Tables inside dossier cards */
.modal-body .card .data-table {
    font-size: 0.8rem;
}

.modal-body .card .data-table th {
    font-size: 0.68rem;
    padding: 0.5rem 0.625rem;
}

.modal-body .card .data-table td {
    padding: 0.45rem 0.625rem;
}

/* Responsive: stack dossier stats on small screens */
@media (max-width: 600px) {
    .client-dossier-stats {
        gap: 0.5rem;
    }
    .client-dossier-stats > div {
        min-width: 70px;
        flex: 1 1 calc(50% - 0.5rem);
    }
    .client-dossier-stats .stat-value {
        font-size: 1rem;
    }
    .client-smart-summary {
        font-size: 0.78rem;
        padding: 0.6rem 0.75rem;
    }
}


/* ============================================================
   COLLAPSIBLE SECTIONS
   ============================================================ */

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    padding: 0.25rem 0;
}

.collapsible-icon {
    display: inline-flex;
    align-items: center;
    transition: transform 0.25s ease;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.collapsible-icon.collapsed {
    transform: rotate(-90deg);
}

.collapsible-body {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.25s ease;
}

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

/* ============================================================
   DASHBOARD: BUSINESS HEALTH + CATEGORY BREAKDOWN
   ============================================================ */

.dashboard-health-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
    margin-bottom: var(--space-5);
}

.dashboard-health-card,
.dashboard-category-card {
    overflow: hidden;
}

.health-score-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid var(--color-success);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.health-score-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.health-score-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-top: 2px;
}

.health-metrics {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.health-metric-cell {
    text-align: center;
    padding: 0.25rem 0;
}

/* ── Category bars (expense breakdown) ── */
.cat-bar-row {
    margin-bottom: 0.6rem;
}

.cat-bar-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-sm);
    margin-bottom: 0.2rem;
    color: var(--color-text);
}

.cat-bar-track {
    width: 100%;
    height: 8px;
    background: var(--color-surface-alt, #f1f5f9);
    border-radius: 4px;
    overflow: hidden;
}

.cat-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 2px;
}

/* ============================================================
   TAX PREP SCORE
   ============================================================ */

.tax-prep-card {
    overflow: hidden;
}

.tax-prep-score-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid currentColor;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tax-prep-readiness {
    word-wrap: break-word;
}

.tax-prep-time-estimate {
    white-space: nowrap;
}

.tax-prep-coach {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.tax-prep-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.tax-prep-check-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
}

.tax-prep-fail {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.tax-prep-pass {
    background: rgba(34, 197, 94, 0.04);
}

.tax-prep-priority-badge {
    white-space: nowrap;
}

.tax-prep-passed-section {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border);
}

.tax-prep-positive-msg {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.tax-prep-passed-list {
    opacity: 0.85;
}

.tax-prep-export-warning {
    font-size: var(--text-sm);
    color: var(--color-warning, #f59e0b);
    font-weight: 500;
    line-height: 1.5;
}

/* ============================================================
   EXPORT CENTER SECTIONS (Accordion)
   ============================================================ */

.export-section {
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-lg, 12px);
    background: var(--color-surface);
    margin-bottom: 0.85rem;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.export-section:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.export-section--open {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.export-section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}

.export-section-header:hover {
    background: var(--color-surface-alt);
}

.export-section-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md, 8px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.export-section-text {
    flex: 1;
    min-width: 0;
}

.export-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.3;
}

.export-section-desc {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: 2px;
    line-height: 1.4;
}

.export-section-chevron {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.export-section--open .export-section-chevron {
    transform: rotate(180deg);
}

.export-section-body {
    padding: 0 1.25rem 1.25rem;
    animation: exportSectionSlide 0.25s ease;
}

@keyframes exportSectionSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Export Layout (two-column: controls + preview) ── */
.export-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
    align-items: start;
}

.export-controls {
    overflow: hidden;
}

.export-preview-panel {
    /* inherits .card */
    position: sticky;
    top: 1rem;
}

/* Mobile: stack export sections */
@media (max-width: 768px) {
    .export-layout {
        grid-template-columns: 1fr;
    }
    .export-section-header {
        padding: 0.85rem 1rem;
        gap: 0.75rem;
    }
    .export-section-icon {
        width: 38px;
        height: 38px;
    }
    .export-section-title {
        font-size: 0.95rem;
    }
    .export-section-desc {
        font-size: var(--text-xs);
    }
    .export-section-body {
        padding: 0 1rem 1rem;
    }
    .dashboard-health-row {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }
}

/* ============================================================
   EXPORT COMPTABLE (Accountant Export)
   ============================================================ */

.comptable-tax-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #dc2626, #991b1b);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    margin-bottom: 1rem;
}

.comptable-tax-days {
    margin-left: auto;
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
}

.comptable-panel {
    overflow: hidden;
}

.comptable-header {
    background: linear-gradient(135deg, #0d9488, #0f766e);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    margin: calc(-1 * var(--space-5));
    margin-bottom: 0;
}

.comptable-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.comptable-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: white;
}

.comptable-subtitle {
    margin: 0.15rem 0 0;
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.8);
}

.comptable-body {
    padding: 1.25rem 0 0;
}

.comptable-period {
    margin-bottom: 1.25rem;
}

.comptable-custom-dates {
    margin-top: 0.5rem;
}

.comptable-summary-section {
    margin-bottom: 1.25rem;
}

.comptable-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.comptable-summary-cell {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    text-align: center;
}

.comptable-preflight {
    margin-bottom: 1.25rem;
    padding: 1rem;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.comptable-preflight-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.comptable-status-strip {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.comptable-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: var(--text-sm);
    font-weight: 500;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
}

.comptable-badge-blocking {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger, #ef4444);
}

.comptable-badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-warning, #f59e0b);
}

.comptable-badge-ready {
    background: rgba(34, 197, 94, 0.1);
    color: var(--color-success, #22c55e);
}

.comptable-all-clear {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-success, #22c55e);
    font-weight: 600;
    font-size: var(--text-sm);
    padding: 0.5rem 0;
}

.comptable-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.comptable-check-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
}

.comptable-check-blocking {
    background: rgba(239, 68, 68, 0.05);
}

.comptable-check-warning {
    background: rgba(245, 158, 11, 0.05);
}

.comptable-check-ready {
    background: transparent;
}

.comptable-package {
    margin-bottom: 1.25rem;
}

.comptable-package-grid {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.comptable-file-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.comptable-file-count {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-muted);
    margin-left: auto;
}

.comptable-actions {
    margin-bottom: 1rem;
}

.comptable-send-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.85rem 1.25rem;
    background: linear-gradient(135deg, #0d9488, #0f766e);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    text-align: left;
    font-size: 1rem;
}

.comptable-send-btn:hover {
    opacity: 0.92;
}

.comptable-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.comptable-send-label {
    font-weight: 700;
    font-size: 1rem;
    color: white;
}

.comptable-send-sub {
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, 0.75);
}

.comptable-success {
    text-align: center;
    padding: 1.5rem;
    background: var(--color-success-bg, #f0fdf4);
    border: 1px solid rgba(22, 163, 74, 0.2);
    border-radius: var(--radius-md);
}

/* ============================================================
   DOCUMENT EXPORT (ZIP download)
   ============================================================ */

.doc-export-panel {
    overflow: hidden;
}

.doc-export-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.doc-export-info {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.doc-export-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
    margin-bottom: 1rem;
}

.doc-export-preview {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
}

.doc-export-status {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.doc-export-empty {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.doc-export-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.doc-export-stat-cell {
    text-align: center;
    padding: 0.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.doc-export-folder-preview {
    margin-top: 0.75rem;
}

.doc-export-tree {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    line-height: 1.6;
    padding: 0.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

/* ============================================================
   EXPORT PREVIEW (Other Formats)
   ============================================================ */

.export-preview {
    position: sticky;
    top: 1rem;
}

.export-preview-body {
    max-height: 400px;
    overflow-y: auto;
}

.export-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.export-preview-cell {
    text-align: center;
    padding: 0.5rem;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.export-preview-summary {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    line-height: 1.5;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border);
}

/* ============================================================
   PRO LICENSE / MONETIZATION
   ============================================================ */

.pro-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    text-transform: uppercase;
    vertical-align: middle;
    line-height: 1.4;
}

.pro-badge svg {
    width: 10px;
    height: 10px;
}

.pro-section {
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
    background: var(--color-surface);
    position: relative;
    overflow: hidden;
}

.pro-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #f59e0b, #d97706, #f59e0b);
}

.pro-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.pro-section-header h3 {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
}

.pro-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--text-sm);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.pro-status-active {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid var(--color-success);
}

.pro-status-inactive {
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.pro-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pro-status-active .pro-status-dot {
    background: var(--color-success);
}

.pro-status-inactive .pro-status-dot {
    background: var(--color-text-faint);
}

.pro-key-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    margin-bottom: 1rem;
}

.pro-key-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.pro-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.pro-feature-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--text-sm);
    padding: 0.5rem 0.75rem;
    background: var(--color-surface-alt);
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.pro-feature-item svg {
    flex-shrink: 0;
}

.pro-feature-item.locked {
    opacity: 0.6;
}

.pro-feature-item.locked svg {
    color: var(--color-text-faint);
}

.pro-feature-item.unlocked svg {
    color: var(--color-success);
}

.usage-meter {
    margin-bottom: 0.75rem;
}

.usage-meter-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-sm);
    margin-bottom: 0.3rem;
    color: var(--color-text-secondary);
}

.usage-meter-bar {
    width: 100%;
    height: 6px;
    background: var(--color-surface-alt);
    border-radius: 3px;
    overflow: hidden;
}

.usage-meter-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
    background: var(--color-accent);
}

.usage-meter-fill.near-limit {
    background: var(--color-warning);
}

.usage-meter-fill.at-limit {
    background: var(--color-danger);
}

.upgrade-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1px solid #fcd34d;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: var(--text-sm);
}

.upgrade-banner-icon {
    color: #d97706;
    flex-shrink: 0;
}

.upgrade-banner-text {
    flex: 1;
    color: var(--color-text-secondary);
}

.upgrade-banner-btn {
    flex-shrink: 0;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    transition: opacity 0.15s;
}

.upgrade-banner-btn:hover {
    opacity: 0.9;
}

.pro-locked-overlay {
    position: relative;
}

.pro-locked-overlay::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(2px);
    border-radius: 8px;
    pointer-events: all;
    cursor: pointer;
}

/* Onboarding animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes setupPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(10,10,10,0.15); }
    50%      { box-shadow: 0 0 0 6px rgba(10,10,10,0); }
}

/* ============================================================
   LIVE DEMO ONBOARDING — Banner + Floating Coach
   ============================================================ */

/* ── Demo Banner ── */
.demo-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1.25rem;
    border-radius: var(--radius-lg, 12px);
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #f1f5f9;
    animation: demoBannerSlide 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
}
.demo-banner::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899, #3b82f6);
    background-size: 200% 100%;
    animation: demoShimmer 3s linear infinite;
}
@keyframes demoBannerSlide {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes demoShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.demo-banner-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}
.demo-pulse-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #22c55e;
    flex-shrink: 0;
    animation: demoDotPulse 2s ease infinite;
}
@keyframes demoDotPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
    50%      { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}
.demo-banner-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: rgba(59,130,246,0.25);
    color: #93c5fd;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(59,130,246,0.3);
    flex-shrink: 0;
}
.demo-banner-text {
    font-size: var(--text-sm);
    color: #cbd5e1;
    line-height: 1.4;
}
.demo-banner-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.btn-demo-start {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-md, 8px);
    font-weight: 600;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}
.btn-demo-start:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(59,130,246,0.35);
}
.btn-demo-start:active {
    transform: scale(0.97);
}
.demo-banner.demo-clearing {
    opacity: 0.6;
    pointer-events: none;
}
.demo-banner.demo-clearing .btn-demo-start {
    opacity: 0.5;
}

/* ── Floating Coach ── */
.demo-coach {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    max-width: 320px;
    width: calc(100vw - 2rem);
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
    padding: 1rem 1.25rem 0.75rem;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: opacity 0.4s cubic-bezier(0.16,1,0.3,1), transform 0.4s cubic-bezier(0.16,1,0.3,1);
    pointer-events: none;
}
.demo-coach.demo-coach-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}
.demo-coach.demo-coach-exit {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}
.demo-coach-body {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}
.demo-coach-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
}
.demo-coach-msg {
    font-size: var(--text-sm);
    color: var(--color-text);
    line-height: 1.5;
    transition: opacity 0.2s ease;
    flex: 1;
    padding-top: 0.3rem;
}
.demo-coach-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 0.6rem;
    padding-bottom: 0.25rem;
}
.demo-coach-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--color-border, #e2e8f0);
    transition: background 0.3s, transform 0.3s;
}
.demo-coach-dot.active {
    background: var(--color-primary, #3b82f6);
    transform: scale(1.4);
}
.demo-coach-close {
    position: absolute;
    top: 0.4rem; right: 0.5rem;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--color-text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0.2rem 0.3rem;
    border-radius: 4px;
    transition: background 0.15s;
}
.demo-coach-close:hover {
    background: var(--color-surface-alt, #f1f5f9);
}

/* Mobile */
@media (max-width: 600px) {
    .demo-banner {
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }
    .demo-banner-right {
        justify-content: stretch;
    }
    .btn-demo-start {
        width: 100%;
        text-align: center;
    }
    .demo-coach {
        right: 0.75rem;
        bottom: 0.75rem;
        max-width: calc(100vw - 1.5rem);
    }
}

/* Dark theme adjustments */
[data-theme="dark"] .demo-banner {
    background: linear-gradient(135deg, #0c1221 0%, #1a2332 100%);
    border-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .demo-coach {
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
}

/* ── Mini Demo Bar (non-dashboard pages) ── */
.demo-mini-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-md, 8px);
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #f1f5f9;
    font-size: var(--text-sm);
    animation: demoBannerSlide 0.4s ease;
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
}
.demo-mini-bar::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899, #3b82f6);
    background-size: 200% 100%;
    animation: demoShimmer 3s linear infinite;
}
.demo-mini-bar .btn-demo-start {
    margin-left: auto;
    padding: 0.3rem 0.75rem;
    font-size: 0.7rem;
}
[data-theme="dark"] .demo-mini-bar {
    background: linear-gradient(135deg, #0c1221 0%, #1a2332 100%);
}

/* ── Onboarding Tour Bar ── */
.tour-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1.25rem;
    border-radius: var(--radius-lg, 12px);
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
    border: 1.5px solid #93c5fd;
    box-shadow: 0 2px 12px rgba(59,130,246,0.08);
    animation: tourBarSlide 0.5s ease;
    flex-wrap: wrap;
}
@keyframes tourBarSlide {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}
.tour-bar-dots {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}
.tour-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    background: #e5e7eb;
    color: #6b7280;
    transition: all 0.3s ease;
    flex-shrink: 0;
}
.tour-dot.active {
    background: #3b82f6;
    color: white;
    box-shadow: 0 0 0 4px rgba(59,130,246,0.2);
    animation: tourDotPulse 2s ease-in-out infinite;
}
.tour-dot.done {
    background: #22c55e;
    color: white;
}
@keyframes tourDotPulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(59,130,246,0.15); }
    50% { box-shadow: 0 0 0 8px rgba(59,130,246,0.08); }
}
.tour-dot-line {
    width: 24px;
    height: 2px;
    background: #e5e7eb;
    flex-shrink: 0;
}
.tour-dot-line.done {
    background: #22c55e;
}
.tour-bar-info {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
    min-width: 0;
}
.tour-bar-step {
    font-size: 0.65rem;
    font-weight: 600;
    color: #3b82f6;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.tour-bar-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.3;
}
.tour-bar-desc {
    font-size: var(--text-xs, 0.75rem);
    color: var(--color-text-muted, #6b7280);
    max-width: 400px;
}
.tour-bar-btn {
    margin-left: auto;
    flex-shrink: 0;
    white-space: nowrap;
}
[data-theme="dark"] .tour-bar {
    background: linear-gradient(135deg, #0f172a 0%, #0d1b2a 100%);
    border-color: rgba(59,130,246,0.3);
}
@media (max-width: 600px) {
    .tour-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }
    .tour-bar-btn { margin-left: 0; width: 100%; }
}

/* ── Tour Celebration Overlay ── */
.tour-complete-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.tour-complete-overlay.visible {
    opacity: 1;
}
.tour-complete-card {
    background: var(--color-surface, white);
    border-radius: var(--radius-lg, 16px);
    padding: 2.5rem 2rem;
    text-align: center;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: tourCelebPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes tourCelebPop {
    from { transform: scale(0.8) translateY(30px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
.tour-complete-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}
.tour-complete-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}
.tour-complete-text {
    font-size: var(--text-sm, 0.875rem);
    color: var(--color-text-muted, #6b7280);
    line-height: 1.6;
    margin-bottom: 1rem;
}
.tour-complete-reminders {
    text-align: left;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--color-surface-alt, #f8fafc);
    border-radius: var(--radius-md, 8px);
    border: 1px solid var(--color-border, #e5e7eb);
}
.tour-reminder-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0;
    font-size: var(--text-sm, 0.875rem);
    color: var(--color-text, #334155);
    line-height: 1.4;
}
.tour-reminder-item svg {
    flex-shrink: 0;
}
.tour-complete-btn {
    font-size: 1rem;
    padding: 0.75rem 2rem;
}

/* ── Tour Transition Overlay (between steps) ── */
.tour-transition-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.tour-transition-overlay.visible {
    opacity: 1;
}
.tour-transition-card {
    background: var(--color-surface, white);
    border-radius: var(--radius-lg, 16px);
    padding: 2rem 2rem 1.75rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: tourCelebPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tour-t-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 1.25rem;
}
.tour-t-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    background: #e5e7eb;
    color: #6b7280;
    transition: all 0.3s ease;
}
.tour-t-dot.done {
    background: #22c55e;
    color: white;
}
.tour-t-dot.just-done {
    background: #22c55e;
    color: white;
    animation: tourDotCheck 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes tourDotCheck {
    0% { transform: scale(0.5); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}
.tour-t-dot.next {
    background: #dbeafe;
    color: #3b82f6;
    border: 2px solid #3b82f6;
}
.tour-t-line {
    width: 32px;
    height: 2px;
    background: #e5e7eb;
    flex-shrink: 0;
}
.tour-t-line.done {
    background: #22c55e;
}
.tour-t-check {
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: center;
}
.tour-t-done-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #22c55e;
    margin-bottom: 0.25rem;
}
.tour-t-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--color-text);
    margin-bottom: 0.4rem;
}
.tour-t-text {
    font-size: var(--text-sm, 0.875rem);
    color: var(--color-text-muted, #6b7280);
    line-height: 1.6;
    margin-bottom: 1.25rem;
}
.tour-t-next-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md, 8px);
    background: #f0f9ff;
    border: 1px solid #bfdbfe;
}
.tour-t-next-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
}
.tour-t-next-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #3b82f6;
}
.tour-t-btn {
    font-size: 0.95rem;
    padding: 0.65rem 2rem;
    width: 100%;
}
[data-theme="dark"] .tour-transition-card {
    background: var(--color-surface, #1e293b);
}
[data-theme="dark"] .tour-t-next-row {
    background: #1e293b;
    border-color: rgba(59,130,246,0.3);
}
[data-theme="dark"] .tour-complete-reminders {
    background: #1e293b;
    border-color: rgba(100,116,139,0.3);
}
[data-theme="dark"] .tour-reminder-item {
    color: #e2e8f0;
}

/* ── Tour: Field-by-field hint ── */
.tour-field-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin: -0.25rem 0 0.75rem 0;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-md, 8px);
    font-size: var(--text-sm, 0.875rem);
    color: #1e40af;
    line-height: 1.4;
    animation: tourHintSlide 0.3s ease;
}
@keyframes tourHintSlide {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.tour-field-skip {
    background: none;
    border: 1px solid #93c5fd;
    border-radius: 4px;
    color: #3b82f6;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    cursor: pointer;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: background 0.15s, color 0.15s;
}
.tour-field-skip:hover {
    background: #3b82f6;
    color: white;
}
[data-theme="dark"] .tour-field-hint {
    background: #1e293b;
    border-color: rgba(59,130,246,0.35);
    color: #93c5fd;
}
[data-theme="dark"] .tour-field-skip {
    border-color: rgba(59,130,246,0.4);
    color: #60a5fa;
}

/* ── Tour: Continue card (after fields done) ── */
.tour-continue-card {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-lg, 12px);
    animation: tourHintSlide 0.4s ease;
}
[data-theme="dark"] .tour-continue-card {
    background: #052e16;
    border-color: rgba(34,197,94,0.3);
}

/* ── Tour: Review card (on invoices page) ── */
.tour-review-card {
    margin: 0.75rem 0 1.25rem 0;
    padding: 1.25rem 1.5rem;
    background: var(--color-surface, white);
    border: 2px solid #3b82f6;
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 4px 16px rgba(59,130,246,0.1);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.tour-review-tip {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.5rem 0;
}
.tour-review-tip svg {
    flex-shrink: 0;
    margin-top: 2px;
}
[data-theme="dark"] .tour-review-card {
    background: var(--color-surface, #1e293b);
    border-color: rgba(59,130,246,0.5);
    box-shadow: 0 4px 16px rgba(59,130,246,0.15);
}

/* ── Setup Wizard Card (legacy -- kept for fallback) ── */
.setup-wizard {
    margin-bottom: 1.5rem;
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    animation: fadeIn 0.5s ease;
    border: 2px solid var(--color-accent);
    background: var(--color-surface);
}
.setup-wizard-header {
    background: var(--color-accent);
    color: var(--color-accent-inverse);
    padding: 1.25rem 1.5rem 1rem;
}
.setup-wizard-header h2 {
    margin: 0 0 0.25rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-accent-inverse);
}
.setup-wizard-header p {
    margin: 0;
    font-size: var(--text-sm);
    opacity: 0.85;
    color: var(--color-accent-inverse);
}
/* Progress bar */
.setup-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.setup-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.25);
    border-radius: 3px;
    overflow: hidden;
}
.setup-progress-fill {
    height: 100%;
    background: white;
    border-radius: 3px;
    transition: width 0.4s ease;
}
.setup-progress-label {
    font-size: var(--text-xs);
    opacity: 0.75;
    white-space: nowrap;
    color: var(--color-accent-inverse);
}
/* Steps */
.setup-wizard-body {
    padding: 1.25rem 1.5rem;
}
.setup-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--radius-md, 8px);
    margin-bottom: 0.75rem;
    transition: background 0.2s, box-shadow 0.2s;
}
.setup-step.active {
    background: var(--color-surface-alt);
    border: 1.5px solid var(--color-accent);
    animation: setupPulse 2s ease infinite;
}
.setup-step.completed {
    background: var(--color-success-bg, #f0fdf4);
    border: 1.5px solid var(--color-success, #16a34a);
    opacity: 0.85;
}
.setup-step.pending {
    background: var(--color-surface-alt, #f5f5f5);
    border: 1.5px solid var(--color-border);
    opacity: 0.55;
}
.setup-step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.setup-step.active .setup-step-number {
    background: var(--color-accent);
    color: var(--color-accent-inverse);
}
.setup-step.completed .setup-step-number {
    background: var(--color-success, #16a34a);
    color: white;
}
.setup-step.pending .setup-step-number {
    background: var(--color-border);
    color: var(--color-text-muted);
}
.setup-step-content {
    flex: 1;
    min-width: 0;
}
.setup-step-title {
    font-weight: 600;
    font-size: var(--text-base, 0.875rem);
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.setup-step-title .badge-time {
    font-size: var(--text-xs);
    font-weight: 500;
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
}
.setup-step.completed .setup-step-title .badge-time {
    background: var(--color-success-bg, #f0fdf4);
    color: var(--color-success, #16a34a);
    border-color: var(--color-success, #16a34a);
}
.setup-step-desc {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-bottom: 0.35rem;
    line-height: 1.45;
}
.setup-step-items {
    font-size: var(--text-xs);
    color: var(--color-text-faint);
    margin-bottom: 0.5rem;
}
.setup-step-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}
.setup-step-actions .btn {
    font-size: var(--text-sm);
}
/* Skip link */
.setup-wizard-footer {
    padding: 0 1.5rem 1.25rem;
    text-align: right;
}
.setup-wizard-footer .btn-ghost {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

/* Mobile tweaks */
@media (max-width: 600px) {
    .setup-wizard-header { padding: 1rem; }
    .setup-wizard-body { padding: 1rem; }
    .setup-step { padding: 0.75rem; gap: 0.75rem; }
    .setup-step-number { width: 30px; height: 30px; font-size: 0.8rem; }
    .setup-wizard-footer { padding: 0 1rem 1rem; }
}

/* ============================================================
   RECEIPT CAPTURE
   ============================================================ */
.receipt-capture-area {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
    margin-top: 0.5rem;
}
.receipt-capture-area:hover,
.receipt-capture-area.dragover {
    border-color: var(--color-primary);
    background: var(--color-primary-light, rgba(59,130,246,0.06));
}
.receipt-capture-area .receipt-icon {
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}
.receipt-capture-area .receipt-label {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}
.receipt-capture-btns {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}
.receipt-capture-btns .btn {
    font-size: var(--text-sm);
    padding: 0.35rem 0.75rem;
}
.receipt-preview {
    position: relative;
    display: inline-block;
    margin-top: 0.75rem;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    max-width: 100%;
}
.receipt-preview img {
    display: block;
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: var(--radius-md);
}
.receipt-preview-actions {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    display: flex;
    gap: 0.25rem;
}
.receipt-preview-actions .btn {
    background: rgba(0,0,0,0.65);
    color: #fff;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    backdrop-filter: blur(4px);
}
.receipt-preview-actions .btn:hover {
    background: rgba(0,0,0,0.85);
}
.receipt-compress-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    color: var(--color-success);
    margin-top: 0.4rem;
}
.receipt-compress-info.compressing {
    color: var(--color-warning);
}
/* Receipt badge on expense row */
.receipt-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--color-primary-light, rgba(59,130,246,0.1));
    color: var(--color-primary);
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    border-radius: 99px;
    cursor: pointer;
    transition: background 0.15s;
}
.receipt-badge:hover {
    background: rgba(59,130,246,0.2);
}
/* Vendor suggestion chip */
.vendor-suggestion {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--color-primary-light, rgba(59,130,246,0.06));
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    margin-top: 0.4rem;
    font-size: var(--text-sm);
    animation: fadeIn 0.3s ease;
}
.vendor-suggestion .btn {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    flex-shrink: 0;
}
/* Quick receipt FAB (mobile) */
.quick-receipt-fab {
    position: fixed;
    bottom: 5.5rem;
    right: 1.25rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(59,130,246,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    z-index: 90;
}
.quick-receipt-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(59,130,246,0.5);
}
@media (min-width: 769px) {
    .quick-receipt-fab { display: none; }
}
/* Receipt gallery grid */
.receipt-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}
.receipt-gallery-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    cursor: pointer;
    transition: transform 0.15s;
    aspect-ratio: 3/4;
    background: var(--color-bg-alt, #f9fafb);
}
.receipt-gallery-item:hover {
    transform: scale(1.03);
}
.receipt-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.receipt-gallery-item .receipt-gallery-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.4rem 0.5rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: #fff;
    font-size: 0.65rem;
    line-height: 1.3;
}
/* Camera viewfinder modal */
.camera-viewfinder {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
}
.camera-viewfinder video {
    width: 100%;
    display: block;
}
.camera-viewfinder canvas {
    display: none;
}
.camera-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
}
.camera-shutter {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 4px solid #fff;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: transform 0.1s;
}
.camera-shutter::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: #fff;
    transition: background 0.1s;
}
.camera-shutter:active {
    transform: scale(0.92);
}
.camera-shutter:active::after {
    background: var(--color-primary);
}

/* ============================================================
   BACKUP PAGE: Accordion Sections + All Sub-Components
   Mirrors the Export Center pattern for visual consistency.
   ============================================================== */

/* ── Accordion card ── */
.backup-section {
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    margin-bottom: 0.85rem;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}
.backup-section:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.backup-section--open {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.backup-section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}
.backup-section-header:hover {
    background: var(--color-surface-alt);
}

.backup-section-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.backup-section-text {
    flex: 1;
    min-width: 0;
}

.backup-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.3;
}

.backup-section-desc {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: 2px;
    line-height: 1.4;
}

.backup-section-chevron {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}
.backup-section--open .backup-section-chevron {
    transform: rotate(180deg);
}

.backup-section-body {
    padding: 0 1.25rem 1.25rem;
    animation: backupSectionSlide 0.25s ease;
}
@keyframes backupSectionSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Status banner (always visible at top) ── */
.backup-status-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.backup-status-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Info box (why backups matter) ── */
.backup-info-box {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary, #4f46e5);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.5;
}

/* ── Preview area (appears after save/restore) ── */
.backup-preview-area {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

/* ── Snapshot rows ── */
.backup-snapshot-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--color-border);
}
.backup-snapshot-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.backup-snapshot-row:first-of-type {
    padding-top: 0;
}

/* ── Protection check rows ── */
.backup-check-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border);
}
.backup-check-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.backup-check-row:first-of-type {
    padding-top: 0;
}
.backup-check-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    margin-top: 1px;
}

/* ── Device Transfer ── */
.backup-transfer-box {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.25rem;
}
.backup-transfer-box-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: var(--text-base);
    color: var(--color-text);
    margin-bottom: 0.75rem;
}
.backup-transfer-box-title svg {
    flex-shrink: 0;
    color: var(--color-text-secondary);
}
.backup-transfer-steps {
    padding-left: 1.25rem;
    margin: 0 0 0.75rem 0;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.85;
}
.backup-transfer-steps li {
    padding-left: 0.25rem;
}
.backup-transfer-steps li::marker {
    color: var(--color-text-muted);
    font-weight: 600;
}
.backup-transfer-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0;
    color: var(--color-text-muted);
}
.backup-transfer-note {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--color-info-bg, #eff6ff);
    border: 1px solid rgba(37, 99, 235, 0.15);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.55;
}
.backup-transfer-note svg {
    color: var(--color-info, #2563eb);
}

/* ── FAQ (What if I lose my data?) ── */
.backup-faq-item {
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-text-muted);
    border-radius: var(--radius-md);
    margin-bottom: 0.6rem;
    overflow: hidden;
    background: var(--color-surface);
    transition: box-shadow 0.15s ease;
}
.backup-faq-item:hover {
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}
.backup-faq-item:last-child {
    margin-bottom: 0;
}

.backup-faq-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}
.backup-faq-header:hover {
    background: var(--color-surface-alt);
}
.backup-faq-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.backup-faq-title {
    flex: 1;
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--color-text);
    min-width: 0;
}
.backup-faq-chevron {
    flex-shrink: 0;
    color: var(--color-text-muted);
    transition: transform 0.25s ease;
}
.backup-faq-header.open .backup-faq-chevron {
    transform: rotate(180deg);
}

.backup-faq-answer {
    padding: 0 1rem 0.85rem 2.35rem;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.65;
    animation: backupFaqSlide 0.2s ease;
}
@keyframes backupFaqSlide {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.backup-faq-prevention {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--color-success-bg, #f0fdf4);
    border: 1px solid rgba(22, 163, 74, 0.2);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.55;
    font-weight: 500;
}

/* ── Mobile responsive ── */
@media (max-width: 600px) {
    .backup-section-header {
        padding: 0.85rem 1rem;
        gap: 0.75rem;
    }
    .backup-section-icon {
        width: 38px;
        height: 38px;
    }
    .backup-section-title {
        font-size: 0.95rem;
    }
    .backup-section-desc {
        font-size: var(--text-xs);
    }
    .backup-section-body {
        padding: 0 1rem 1rem;
    }
    .backup-status-banner {
        padding: 0.85rem 1rem;
        gap: 0.75rem;
    }
    .backup-status-banner > .btn {
        width: 100%;
        text-align: center;
        margin-left: 0;
    }
    .backup-transfer-box {
        padding: 0.85rem 1rem;
    }
    .backup-snapshot-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }
    .backup-faq-answer {
        padding-left: 1rem;
    }
}

/* ============================================================
   DASHBOARD: KEY METRICS ROW
   ============================================================ */

.key-metrics-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.key-metric-card {
    flex: 1 1 140px;
    min-width: 120px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md, 8px);
    padding: 0.85rem 1rem;
    text-align: center;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.key-metric-card:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.key-metric-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.2rem;
    color: var(--color-text);
}

.key-metric-label {
    font-size: var(--text-xs, 0.75rem);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
    line-height: 1.3;
}

.key-metric-sub {
    font-size: var(--text-xs, 0.75rem);
    color: var(--color-text-faint, #94a3b8);
    margin-top: 0.15rem;
}

/* ============================================================
   DASHBOARD: COLLAPSIBLE DETAIL SECTIONS
   ============================================================ */

.dashboard-details-zone {
    margin-top: 0.5rem;
}

.dashboard-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg, 12px);
    margin-bottom: 0.85rem;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.dashboard-section:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.dashboard-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.1rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}

.dashboard-section-header:hover {
    background: var(--color-surface-alt, #f8fafc);
}

.dashboard-section-header.expanded {
    border-bottom: 1px solid var(--color-border);
}

.dashboard-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
}

.dashboard-section-title .section-icon {
    display: inline-flex;
    align-items: center;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.dashboard-section-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    line-height: 1.4;
}

.dashboard-section-chevron {
    display: inline-flex;
    align-items: center;
    color: var(--color-text-muted);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.dashboard-section-chevron.collapsed {
    transform: rotate(-90deg);
}

.dashboard-section-body {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.25s ease;
}

.dashboard-section-body.collapsed {
    display: none;
}

@media (max-width: 600px) {
    .key-metrics-row {
        gap: 0.5rem;
    }
    .key-metric-card {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 0;
        padding: 0.65rem 0.5rem;
    }
    .key-metric-value {
        font-size: 1.05rem;
    }
    .dashboard-section-header {
        padding: 0.75rem 0.85rem;
    }
    .dashboard-section-title {
        font-size: 0.88rem;
    }
    .dashboard-quick-bar {
        gap: 0.4rem;
    }
    .dashboard-quick-bar .btn {
        font-size: var(--text-xs, 0.75rem);
        padding: 0.4rem 0.65rem;
    }
}

/* ============================================================
   DASHBOARD: DATA-AWARE TOOLTIPS
   Single floating tooltip element, positioned by JS.
   Shows on hover (desktop) and tap (mobile).
   ============================================================ */

.dash-tooltip {
    position: fixed;
    z-index: 9999;
    max-width: 280px;
    padding: 0.55rem 0.85rem;
    background: var(--color-text, #1e293b);
    color: #fff;
    font-size: 0.75rem;
    line-height: 1.5;
    border-radius: var(--radius-md, 8px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    word-wrap: break-word;
}

.dash-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.dash-tooltip::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px 5px 0;
    border-style: solid;
    border-color: var(--color-text, #1e293b) transparent transparent;
}

.dash-tooltip.arrow-top::after {
    bottom: auto;
    top: -5px;
    border-width: 0 5px 5px;
    border-color: transparent transparent var(--color-text, #1e293b);
}

/* Hint icon on cards that have tooltips */
.dash-tip-trigger {
    cursor: help;
    position: relative;
}

.dash-tip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--color-border, #e2e8f0);
    color: var(--color-text-muted, #94a3b8);
    font-size: 0.6rem;
    font-weight: 700;
    font-style: normal;
    flex-shrink: 0;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease;
}

.dash-tip-trigger:hover .dash-tip-icon,
.dash-tip-trigger:focus .dash-tip-icon {
    background: var(--color-primary, #2563eb);
    color: #fff;
}
