/* ByteLogic Accounting - Main Stylesheet */
/* Extracted from base.html inline styles */

        /* =============================================================================
           WCAG 2.2 ACCESSIBILITY STYLES
           Level AA compliance target
           ============================================================================= */
        
        /* Skip link for keyboard navigation (WCAG 2.4.1) */
        .skip-link {
            position: absolute;
            top: 0;
            left: 0;
            transform: translateY(-100%);
            background: var(--accent);
            color: white;
            padding: 12px 24px;
            z-index: 9999;
            font-weight: 600;
            text-decoration: none;
            border-radius: 0 0 8px 0;
            transition: transform 0.2s ease;
        }
        
        .skip-link:focus {
            transform: translateY(0);
        }
        
        /* Focus visible styles (WCAG 2.4.7) - minimum 2px outline */
        :focus-visible {
            outline: 3px solid var(--accent);
            outline-offset: 2px;
        }
        
        /* Remove default outline only when focus-visible is supported */
        :focus:not(:focus-visible) {
            outline: none;
        }
        
        /* High contrast focus for buttons */
        .btn:focus-visible,
        button:focus-visible,
        [role="button"]:focus-visible {
            outline: 3px solid white;
            outline-offset: 2px;
            box-shadow: 0 0 0 6px var(--accent);
        }
        
        /* Ensure minimum touch target size (WCAG 2.5.8) - 24x24px minimum */
        button, 
        [role="button"], 
        a, 
        input, 
        select, 
        textarea {
            min-height: 24px;
            min-width: 24px;
        }
        
        /* Reduced motion preference (WCAG 2.3.3) */
        @media (prefers-reduced-motion: reduce) {
            *, *::before, *::after {
                animation-duration: 0.01ms !important;
                animation-iteration-count: 1 !important;
                transition-duration: 0.01ms !important;
            }
        }
        
        /* High contrast mode support */
        @media (prefers-contrast: high) {
            :root {
                --text-muted: #a0a0a0;
                --text-secondary: #c0c0c0;
                --border: #4a4a4a;
            }
        }
        
        /* Visually hidden - for screen readers only (WCAG) */
        .visually-hidden {
            position: absolute !important;
            width: 1px !important;
            height: 1px !important;
            padding: 0 !important;
            margin: -1px !important;
            overflow: hidden !important;
            clip: rect(0, 0, 0, 0) !important;
            white-space: nowrap !important;
            border: 0 !important;
        }
        
        /* Ensure links are distinguishable (WCAG 1.4.1) */
        a:not(.btn):not(.nav-link) {
            text-decoration: underline;
            text-decoration-thickness: 1px;
            text-underline-offset: 2px;
        }
        
        a:not(.btn):not(.nav-link):hover {
            text-decoration-thickness: 2px;
        }
        
        /* Error states for forms (WCAG 3.3.1) */
        input[aria-invalid="true"],
        select[aria-invalid="true"],
        textarea[aria-invalid="true"] {
            border-color: var(--danger) !important;
        }
        
        /* Ensure sufficient spacing for touch targets (WCAG 2.5.8) */
        .nav-link {
            min-height: 44px; /* iOS recommended */
        }
        :root {
            --bg-primary: #0a0a0f;
            --bg-secondary: #12121a;
            --bg-tertiary: #1a1a24;
            --bg-accent: #6366f1;
            --text-primary: #f8fafc;
            /* WCAG 2.2 AA contrast: minimum 4.5:1 for normal text */
            /* Updated colors for better contrast ratios */
            --text-secondary: #a8b5c4; /* 5.2:1 contrast on #0a0a0f */
            --text-muted: #8b99a8; /* 4.6:1 contrast on #0a0a0f - AA compliant */
            --border: #3d3d4a;
            --accent: #818cf8; /* Lighter accent for better visibility */
            --accent-hover: #a5b4fc;
            --accent-dark: #6366f1; /* Original for backgrounds */
            --success: #4ade80; /* Brighter green for contrast */
            --warning: #facc15; /* Brighter yellow */
            --danger: #f87171; /* Brighter red for contrast */
            --income: #4ade80;
            --expense: #f87171;
            --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
            --font-mono: 'JetBrains Mono', monospace;
            /* Focus ring color */
            --focus-ring: #818cf8;
        }

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

        body {
            font-family: var(--font-sans);
            background: var(--bg-primary);
            color: var(--text-primary);
            min-height: 100vh;
            line-height: 1.5;
        }

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

        /* Sidebar */
        .sidebar {
            width: 260px;
            background: var(--bg-secondary);
            border-right: 1px solid var(--border);
            position: fixed;
            height: 100vh;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
        }

        .sidebar-header {
            padding: 24px 20px;
            border-bottom: 1px solid var(--border);
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .logo-icon {
            width: 36px;
            height: 36px;
            background: linear-gradient(135deg, var(--accent) 0%, #a855f7 100%);
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .logo-icon svg {
            color: white;
        }

        .logo-text h1 {
            font-family: var(--font-mono);
            font-size: 1.1rem;
            font-weight: 700;
            color: var(--text-primary);
        }

        .logo-text span {
            font-size: 0.7rem;
            color: var(--text-muted);
        }

        .sidebar-nav {
            flex: 1;
            padding: 16px 12px;
            overflow-y: auto;
        }

        .nav-section {
            margin-bottom: 24px;
        }

        .nav-section-title {
            font-size: 0.7rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: var(--text-muted);
            padding: 0 12px 10px;
        }

        .nav-link {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 11px 12px;
            color: var(--text-secondary);
            text-decoration: none;
            border-radius: 8px;
            font-size: 0.9rem;
            font-weight: 500;
            transition: all 0.15s ease;
            margin-bottom: 2px;
        }

        .nav-link:hover {
            background: var(--bg-tertiary);
            color: var(--text-primary);
        }

        .nav-link.active {
            background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
            color: white;
        }

        .nav-link svg {
            width: 18px;
            height: 18px;
            opacity: 0.8;
        }

        .nav-link.active svg {
            opacity: 1;
        }

        .nav-badge {
            margin-left: auto;
            background: var(--danger);
            color: white;
            font-size: 0.7rem;
            font-weight: 600;
            padding: 2px 8px;
            border-radius: 10px;
        }

        /* User section */
        .sidebar-footer {
            padding: 16px;
            border-top: 1px solid var(--border);
        }

        .user-info {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px;
            background: var(--bg-tertiary);
            border-radius: 10px;
            margin-bottom: 12px;
        }

        .user-avatar {
            width: 36px;
            height: 36px;
            background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 600;
            font-size: 0.9rem;
        }

        .user-details {
            flex: 1;
            overflow: hidden;
        }

        .user-name {
            font-size: 0.9rem;
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .user-org {
            font-size: 0.75rem;
            color: var(--text-muted);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .logout-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            width: 100%;
            padding: 10px;
            background: transparent;
            border: 1px solid var(--border);
            border-radius: 8px;
            color: var(--text-secondary);
            font-size: 0.85rem;
            font-family: inherit;
            cursor: pointer;
            text-decoration: none;
            transition: all 0.15s ease;
        }

        .logout-btn:hover {
            background: var(--bg-tertiary);
            color: var(--text-primary);
        }

        /* Main content */
        .main-content {
            flex: 1;
            margin-left: 260px;
            padding: 28px 36px;
            max-width: calc(100% - 260px);
        }

        .page-header {
            margin-bottom: 32px;
        }

        .page-header h1 {
            font-size: 1.75rem;
            font-weight: 700;
            margin-bottom: 4px;
        }

        .page-header p {
            color: var(--text-secondary);
        }

        /* Cards */
        .card {
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 24px;
        }

        .card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .card-title {
            font-size: 0.8rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text-secondary);
        }

        /* Stats grid */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 20px;
            margin-bottom: 32px;
        }

        .stat-card {
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 20px;
        }

        .stat-label {
            font-size: 0.8rem;
            color: var(--text-secondary);
            margin-bottom: 8px;
        }

        .stat-value {
            font-family: var(--font-mono);
            font-size: 1.75rem;
            font-weight: 700;
        }

        .stat-value.positive { color: var(--income); }
        .stat-value.negative { color: var(--expense); }
        .stat-value.neutral { color: var(--accent); }

        /* Tables */
        .table-container {
            overflow-x: auto;
        }

        table {
            width: 100%;
            border-collapse: collapse;
        }

        th {
            text-align: left;
            padding: 14px 16px;
            font-size: 0.75rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text-muted);
            border-bottom: 1px solid var(--border);
        }

        td {
            padding: 16px;
            border-bottom: 1px solid var(--border);
            font-size: 0.9rem;
        }

        tr:hover {
            background: var(--bg-tertiary);
        }

        .amount {
            font-family: var(--font-mono);
            font-weight: 500;
        }

        .amount.positive { color: var(--income); }
        .amount.negative { color: var(--expense); }

        /* Badges */
        .badge {
            display: inline-block;
            padding: 4px 10px;
            border-radius: 6px;
            font-size: 0.75rem;
            font-weight: 600;
        }

        .badge-success { background: rgba(34, 197, 94, 0.15); color: var(--success); }
        .badge-warning { background: rgba(234, 179, 8, 0.15); color: var(--warning); }
        .badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
        .badge-info { background: rgba(99, 102, 241, 0.15); color: var(--accent); }

        /* Buttons */
        .btn {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 10px 18px;
            border-radius: 8px;
            font-size: 0.9rem;
            font-weight: 500;
            font-family: inherit;
            text-decoration: none;
            cursor: pointer;
            border: none;
            transition: all 0.15s ease;
        }

        .btn-primary {
            background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
            color: white;
        }

        .btn-primary:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
        }

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

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

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

        .btn-ghost:hover {
            background: var(--bg-tertiary);
            color: var(--text-primary);
        }

        .btn-sm {
            padding: 6px 12px;
            font-size: 0.8rem;
        }

        /* Forms */
        select, input, textarea {
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 10px 14px;
            color: var(--text-primary);
            font-size: 0.9rem;
            font-family: inherit;
        }

        select:focus, input:focus, textarea:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
        }

        label {
            display: block;
            font-size: 0.85rem;
            font-weight: 500;
            color: var(--text-secondary);
            margin-bottom: 6px;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: flex;
            align-items: center;
            gap: 4px;
        }

        /* Tooltips for form help */
        .tooltip-icon {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            color: var(--text-muted);
            font-size: 10px;
            font-weight: 600;
            cursor: help;
            position: relative;
            flex-shrink: 0;
        }

        .tooltip-icon:hover {
            background: var(--accent);
            border-color: var(--accent);
            color: white;
        }

        /* Tooltip popup - hidden by default */
        .tooltip-icon::after {
            content: attr(data-tooltip);
            position: absolute;
            bottom: calc(100% + 8px);
            left: 50%;
            transform: translateX(-50%);
            background: var(--bg-secondary);
            color: var(--text-primary);
            padding: 10px 14px;
            border-radius: 8px;
            font-size: 12px;
            font-weight: 400;
            line-height: 1.5;
            z-index: 1000;
            box-shadow: 0 8px 24px rgba(0,0,0,0.4);
            border: 1px solid var(--border);
            max-width: 280px;
            min-width: 200px;
            white-space: normal;
            text-align: left;
            /* Hidden by default */
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
            transition: opacity 0.2s, visibility 0.2s;
        }

        .tooltip-icon::before {
            content: '';
            position: absolute;
            bottom: calc(100% + 2px);
            left: 50%;
            transform: translateX(-50%);
            border: 6px solid transparent;
            border-top-color: var(--bg-secondary);
            z-index: 1001;
            /* Hidden by default */
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.2s, visibility 0.2s;
        }

        /* Show tooltip on hover */
        .tooltip-icon:hover::after,
        .tooltip-icon:hover::before {
            opacity: 1;
            visibility: visible;
        }

        /* Grid layouts */
        .grid-2 {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 24px;
        }

        .grid-3 {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 24px;
        }

        /* Time tracking */
        .time-tracker {
            background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
            border: none;
            border-radius: 12px;
            padding: 24px;
            margin-bottom: 32px;
        }

        .time-tracker.active {
            background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
        }

        .time-tracker h3 {
            font-size: 0.9rem;
            font-weight: 500;
            opacity: 0.9;
            margin-bottom: 8px;
        }

        .time-display {
            font-family: var(--font-mono);
            font-size: 2.5rem;
            font-weight: 700;
            margin-bottom: 16px;
        }

        .time-controls {
            display: flex;
            gap: 12px;
        }

        /* Alert messages */
        .alert {
            padding: 14px 18px;
            border-radius: 10px;
            margin-bottom: 24px;
            font-size: 0.9rem;
        }

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

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

        /* Empty state */
        .empty-state {
            text-align: center;
            padding: 60px 20px;
            color: var(--text-muted);
        }

        .empty-state svg {
            width: 64px;
            height: 64px;
            margin-bottom: 16px;
            opacity: 0.5;
        }

        .empty-state h3 {
            font-size: 1.1rem;
            color: var(--text-secondary);
            margin-bottom: 8px;
        }

        /* Pro Feature Lock Styles */
        .nav-link.locked {
            opacity: 0.5;
            pointer-events: none;
            cursor: not-allowed;
            position: relative;
        }
        
        .nav-link.locked::after {
            content: 'PRO';
            position: absolute;
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
            background: var(--warning);
            color: #000;
            font-size: 0.6rem;
            font-weight: 700;
            padding: 2px 6px;
            border-radius: 4px;
        }
        
        .pro-badge {
            display: inline-block;
            background: var(--warning);
            color: #000;
            font-size: 0.65rem;
            font-weight: 700;
            padding: 2px 6px;
            border-radius: 4px;
            margin-left: 8px;
        }
        
        .coming-soon {
            opacity: 0.6;
        }
        
        .coming-soon:hover {
            opacity: 0.8;
        }
        
        .soon-badge {
            display: inline-block;
            background: #4a5568;
            color: #e2e8f0;
            font-size: 0.55rem;
            font-weight: 600;
            padding: 2px 5px;
            border-radius: 3px;
            margin-left: 4px;
            vertical-align: middle;
        }
        
        .locked-feature-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.8);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 9999;
        }
        
        .locked-feature-modal {
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 40px;
            max-width: 450px;
            text-align: center;
        }
        
        .locked-feature-modal h2 {
            font-size: 1.5rem;
            margin-bottom: 16px;
        }
        
        .locked-feature-modal p {
            color: var(--text-muted);
            margin-bottom: 24px;
        }
        
        .locked-feature-modal .launch-date {
            display: inline-block;
            background: var(--warning);
            color: #000;
            padding: 8px 16px;
            border-radius: 8px;
            font-weight: 600;
            margin-bottom: 24px;
        }
        
        .plan-limits-bar {
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 12px 16px;
            margin-bottom: 20px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 0.85rem;
        }
        
        .plan-limits-bar .plan-name {
            font-weight: 600;
            color: var(--success);
        }
        
        .plan-limits-bar .limits {
            color: var(--text-muted);
        }

        /* Pagination */
        .pagination {
            display: flex;
            gap: 8px;
            justify-content: center;
            margin-top: 24px;
        }

        .pagination a, .pagination span {
            padding: 8px 14px;
            border-radius: 6px;
            font-size: 0.85rem;
            text-decoration: none;
            color: var(--text-secondary);
            border: 1px solid var(--border);
        }

        .pagination a:hover {
            background: var(--bg-tertiary);
            color: var(--text-primary);
        }

        .pagination .active {
            background: var(--accent);
            color: white;
            border-color: var(--accent);
        }

        /* Responsive */
        @media (max-width: 1200px) {
            .stats-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        @media (max-width: 768px) {
            .sidebar {
                display: none;
            }
            .main-content {
                margin-left: 0;
                max-width: 100%;
            }
            .stats-grid {
                grid-template-columns: 1fr;
            }
        }

/* Help Panel */
        .floating-help-btn {
            position: fixed;
            bottom: 24px;
            right: 24px;
            width: 48px;
            height: 48px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
            border: none;
            color: white;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 16px rgba(129, 140, 248, 0.4);
            transition: all 0.2s ease;
            z-index: 1000;
        }
        
        .floating-help-btn:hover {
            transform: scale(1.1);
            box-shadow: 0 6px 24px rgba(129, 140, 248, 0.5);
        }
        
        .help-panel {
            position: fixed;
            bottom: 84px;
            right: 24px;
            width: 340px;
            max-height: 400px;
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 16px;
            box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
            z-index: 1001;
            display: none;
            flex-direction: column;
            overflow: hidden;
        }
        
        .help-panel.active {
            display: flex;
        }
        
        .help-panel-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 20px;
            border-bottom: 1px solid var(--border);
        }
        
        .help-panel-header h3 {
            margin: 0;
            font-size: 1rem;
            color: var(--text-primary);
        }
        
        .help-panel-header button {
            background: transparent;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            padding: 4px;
        }
        
        .help-panel-content {
            flex: 1;
            overflow-y: auto;
            padding: 20px;
        }
        
        .help-panel-content h4 {
            font-size: 0.95rem;
            margin: 0 0 12px;
            color: var(--text-primary);
        }
        
        .help-panel-content p {
            font-size: 0.85rem;
            color: var(--text-secondary);
            line-height: 1.6;
            margin-bottom: 16px;
        }
        
        .help-tip {
            display: flex;
            gap: 10px;
            padding: 12px;
            background: var(--bg-tertiary);
            border-radius: 8px;
            margin-bottom: 8px;
        }
        
        .help-tip svg {
            color: var(--accent);
            flex-shrink: 0;
            margin-top: 2px;
        }
        
        .help-tip span {
            font-size: 0.85rem;
            color: var(--text-secondary);
        }
        
        .help-panel-footer {
            padding: 16px 20px;
            border-top: 1px solid var(--border);
        }
        
        .help-panel-footer .btn {
            width: 100%;
            text-align: center;
            display: block;
        }
        
        .help-loading {
            text-align: center;
            color: var(--text-muted);
            padding: 20px;
        }
