/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0a0a0a;
    --bg-card: #141414;
    --bg-card-hover: #1a1a1a;
    --border: #262626;
    --text: #e5e5e5;
    --text-muted: #737373;
    --orange: #f7931a;
    --orange-dark: #c47613;
    --orange-glow: rgba(247, 147, 26, 0.15);
    --green: #22c55e;
    --red: #ef4444;
    --blue: #3b82f6;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --max-width: 1200px;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === LAYOUT === */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* === HEADER === */
.header {
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    background: rgba(10,10,10,0.95);
    backdrop-filter: blur(10px);
    z-index: 100;
}
.header .container { display: flex; align-items: center; justify-content: space-between; }
.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--orange);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.logo svg { width: 28px; height: 28px; }
.nav { display: flex; gap: 1.5rem; align-items: center; }
.nav a { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; }
.nav a:hover { color: var(--text); text-decoration: none; }

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--orange); color: #000; }
.btn-primary:hover { background: var(--orange-dark); text-decoration: none; }
.btn-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--orange); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 2rem; font-size: 1.05rem; }

/* === CARDS === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.card-hover:hover { border-color: var(--orange); background: var(--bg-card-hover); }

/* === STAT CARDS === */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}
.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.stat-change {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}
.positive { color: var(--green); }
.negative { color: var(--red); }

/* === FORMS === */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    font-weight: 500;
}
input, select, textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--orange);
}
select { cursor: pointer; }

/* === TABLE === */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    white-space: nowrap;
}
th { color: var(--text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
tr:hover td { background: var(--bg-card-hover); }
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-buy { background: rgba(34,197,94,0.15); color: var(--green); }
.badge-sell { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-exempt { background: rgba(59,130,246,0.15); color: var(--blue); }
.badge-taxable { background: rgba(239,68,68,0.15); color: var(--red); }

/* === MODAL === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}
.modal h2 { margin-bottom: 1.5rem; font-size: 1.2rem; }

/* === TABS === */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab {
    padding: 0.7rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--orange); border-bottom-color: var(--orange); }

/* === ALERT BOX === */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.alert-warning { background: rgba(247,147,26,0.1); border: 1px solid rgba(247,147,26,0.3); color: var(--orange); }
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: var(--green); }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--red); }

/* === TOAST === */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 2000; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    animation: slideIn 0.3s ease;
    max-width: 350px;
}
.toast-success { background: var(--green); color: #000; }
.toast-error { background: var(--red); color: #fff; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* === CHART === */
.chart-container { position: relative; height: 350px; }

/* === LANDING PAGE === */
.hero {
    padding: 5rem 0 4rem;
    text-align: center;
}
.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1.25rem;
}
.hero h1 span { color: var(--orange); }
.hero p {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 2rem;
}
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding: 3rem 0;
}
.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    transition: border-color 0.2s;
}
.feature-card:hover { border-color: var(--orange); }
.feature-icon { font-size: 2rem; margin-bottom: 1rem; }
.feature-card h3 { margin-bottom: 0.5rem; font-size: 1.1rem; }
.feature-card p { color: var(--text-muted); font-size: 0.9rem; }

.pricing-section { padding: 4rem 0; }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-top: 2rem; }
.price-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
}
.price-card.featured { border-color: var(--orange); box-shadow: 0 0 30px var(--orange-glow); }
.price-amount { font-size: 2.5rem; font-weight: 800; margin: 1rem 0; }
.price-amount span { font-size: 1rem; color: var(--text-muted); font-weight: 400; }
.price-features { list-style: none; text-align: left; margin: 1.5rem 0; }
.price-features li { padding: 0.4rem 0; font-size: 0.9rem; color: var(--text-muted); }
.price-features li::before { content: "\2713 "; color: var(--orange); margin-right: 0.5rem; }

.footer {
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* === APP LAYOUT === */
.app-main { padding: 2rem 0; }
.app-header { margin-bottom: 2rem; }
.app-header h1 { font-size: 1.5rem; font-weight: 700; }
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* === LOADING === */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--orange);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.75rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .features { grid-template-columns: 1fr; }
    .pricing-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 2rem; }
    .hero p { font-size: 1rem; }
    .nav { gap: 1rem; }
    .stat-value { font-size: 1.3rem; }
    th, td { padding: 0.5rem; font-size: 0.8rem; }
    .modal { padding: 1.5rem; }
    .exemption-summary { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
    .grid-4 { grid-template-columns: 1fr; }
    .header .container { flex-wrap: wrap; gap: 0.5rem; }
    .nav { width: 100%; justify-content: flex-end; }
}

/* === PRINT (for tax report) === */
@media print {
    body { background: #fff; color: #000; }
    .header, .no-print, .btn { display: none !important; }
    .card { border: 1px solid #ccc; box-shadow: none; }
    .stat-card { border: 1px solid #ccc; }
    table { font-size: 0.8rem; }
    .badge-buy { color: green; }
    .badge-sell { color: red; }
}
