/* =========================================================
   CHOICE SCREEN
   ========================================================= */
.choice-screen {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
}

.choice-container {
    width: 100%;
    max-width: 900px;
    text-align: center;
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.choice-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.choice-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
}

.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.choice-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2.5rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    outline: none;
    width: 100%;
}

.choice-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.choice-card:active {
    transform: translateY(-2px);
}

.choice-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s ease;
}

.choice-icon.tax-icon {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.choice-card:hover .choice-icon {
    transform: scale(1.1) rotate(-5deg);
}

.choice-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.choice-content p {
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 0.95rem;
}

.choice-arrow {
    margin-top: auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.choice-card:hover .choice-arrow {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    transform: translateX(10px);
}

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   TAX DASHBOARD SPECIFIC
   ========================================================= */
#tax-app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.tax-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.highlights-card {
    background: linear-gradient(135deg, var(--accent), #10b981);
    color: white;
}
.highlights-card label, .highlights-card .stat-meta {
    color: rgba(255,255,255,0.8);
}
.highlights-card h2 {
    color: white;
}

.premium-stat {
    border: 2px solid var(--accent);
}

.tax-view {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 2rem; /* Nice padding like Salary dashboard */
}
.tax-view.active {
    display: block;
}

/* Receipt Column Styles */
.receipt-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: opacity 0.2s;
}
.receipt-link:hover {
    opacity: 0.7;
}

/* Reports / Export UI */
.report-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.text-right { text-align: right; }
.text-center { text-align: center; }

/* Desktop side-by-side for choice grid if needed */
@media (min-width: 1024px) {
    .choice-grid { grid-template-columns: repeat(2, 1fr); }
}

/* =========================================================
   TAX LEDGER GRID (Reuses deduction-row class)
   ========================================================= */
.tax-ledger-table .tax-table-head,
.tax-ledger-table .deduction-row:not(.is-expanded) {
    display: grid;
    /* Date, Type, Category, Raw, Biz %, Allowed, Receipt */
    grid-template-columns: 90px 60px 2fr 100px 80px 100px 60px;
    align-items: center;
    gap: 15px;
}

.tax-table-head {
    padding: 10px 15px 10px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    margin-bottom: 15px;
}
.tax-table-head span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* Formatted Receipt Badge */
.receipt-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
    border-radius: 8px;
    transition: all 0.2s;
}
.receipt-badge:hover {
    background: rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

/* Mobile Visibility Handling for Tax Ledger */
@media (max-width: 768px) {
    .tax-ledger-table .tax-table-head,
    .tax-ledger-table .deduction-row:not(.is-expanded) {
        /* Mobile: Expand Toggle, Date, Category, Allowed */
        grid-template-columns: 35px 80px 1fr 80px;
        position: relative;
    }
    
    /* Hide non-core columns on basic row views */
    .tax-ledger-table .tax-table-head span:nth-child(2), /* Type */
    .tax-ledger-table .tax-table-head span:nth-child(4), /* Gross */
    .tax-ledger-table .tax-table-head span:nth-child(5), /* Biz % */
    .tax-ledger-table .tax-table-head span:nth-child(7), /* Receipt */
    .tax-ledger-table .tax-table-head span:nth-child(8), /* Action */
    .tax-ledger-table .deduction-row:not(.is-expanded) > .d-type,
    .tax-ledger-table .deduction-row:not(.is-expanded) > .d-base-eq,
    .tax-ledger-table .deduction-row:not(.is-expanded) > .d-frequency,
    .tax-ledger-table .deduction-row:not(.is-expanded) > .d-recurring,
    .tax-ledger-table .deduction-row:not(.is-expanded) > .btn-remove {
        display: none !important;
    }
}
/* --- SYNCED ROWS --- */
.deduction-row.is-synced {
    border-left: 3px solid var(--info);
    background: rgba(59, 130, 246, 0.03);
}
.sync-tag {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--info);
    background: rgba(59, 130, 246, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    letter-spacing: 0.05em;
}

/* --- HELP CENTER INLINE --- */
.help-inline-card {
    background: var(--surface);
    box-shadow: var(--card-shadow);
    animation: fadeIn 0.4s ease;
}
.help-tabs {
    background: var(--surface-2) !important;
}
.help-tab {
    padding: 0.6rem 1.25rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.help-tab:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text);
}
.help-tab.active {
    background: var(--surface);
    border-color: var(--border);
    color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.help-body {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.help-content {
    animation: slideUp 0.3s ease;
}
.help-step-card {
    background: var(--surface-2);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}
.step-number {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
    font-weight: 800;
    font-size: 1.25rem;
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

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

/* --- PREMIUM FORM ELEMENTS --- */
.search-input {
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 0.6rem 1rem;
    color: var(--text);
    font-size: 0.9rem;
    transition: all 0.3s;
    width: 240px;
    margin-top: 1rem; /* Added margin as requested */
}
.search-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

/* --- CUSTOM RADIO & CHECKBOX --- */
.radio-label, .check-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text);
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}
.radio-label:hover { background: rgba(255,255,255,0.05); }

input[type="radio"], input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 50%;
    margin: 0;
    display: grid;
    place-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
input[type="checkbox"] { border-radius: 4px; }

input[type="radio"]::before, input[type="checkbox"]::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em var(--accent);
}
input[type="checkbox"]::before { border-radius: 2px; }

input[type="radio"]:checked, input[type="checkbox"]:checked {
    border-color: var(--accent);
    background: var(--accent-glow);
}
input[type="radio"]:checked::before, input[type="checkbox"]:checked::before {
    transform: scale(1);
}

.ledger-year-label {
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    margin-right: 5px;
}

/* --- YEAR MODAL (TAX) --- */
.tax-year-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}
.tax-year-modal.show { display: flex; }
.tax-year-modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 400px;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--modal-shadow);
}
.tax-year-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 1.5rem 0;
}
.tax-year-item {
    padding: 1rem;
    text-align: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
}
.tax-year-item:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
    transform: translateY(-2px);
}
.tax-year-item.active {
    background: var(--accent);
    color: white;
}

/* --- SORTING --- */
.sort-btn {
    background: none;
    border: none;
    padding: 0;
    margin-left: 5px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    vertical-align: middle;
}
/* --- PREMIUM SOURCE PILL --- */
.source-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 4px 10px;
    border-radius: 20px;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    vertical-align: middle;
}
.source-link-btn:hover {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px var(--accent-glow);
    transform: translateY(-1px);
}
.source-link-btn svg {
    transition: transform 0.2s;
}
.source-link-btn:hover svg {
    transform: scale(1.1);
}

.manual-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
