:root {
    /* Color Palette */
    --c-primary: #27AE60;
    --c-primary-hover: #219653;
    --c-secondary: #2C3E50;
    --c-accent: #3498DB;
    
    --c-bg: #F8F9FA;
    --c-panel: #FFFFFF;
    
    --c-text-main: #212529;
    --c-text-muted: #6C757D;
    
    --c-border: #DEE2E6;
    --c-green: #27AE60;
    --c-red: #E74C3C;
    --c-orange: #F39C12;
    --c-bg-light: #F1F3F5;
    
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 4px 12px rgba(0,0,0,0.05);
    
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
    --c-bg: #0F0F1A;
    --c-panel: #1A1A24;
    
    --c-text-main: #E9ECEF;
    --c-text-muted: #ADB5BD;
    
    --c-border: #2D2D3B;
    --c-bg-light: #252533;
}

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

body {
    font-family: var(--font);
    background-color: var(--c-bg);
    color: var(--c-text-main);
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
}

.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--c-border);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--c-primary);
}

.header-brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--c-text-main);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--c-text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--c-bg-light);
    color: var(--c-text-main);
}

/* Main Layout */
.main-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 24px;
    flex-grow: 1;
}

@media (max-width: 768px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: var(--c-panel);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--c-border);
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--c-secondary);
}

[data-theme="dark"] .panel-title { color: var(--c-text-main); }

/* Forms */
.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
}

.input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-bg-light);
    overflow: hidden;
}

.currency-prefix {
    padding: 10px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--c-text-muted);
    background: var(--c-bg-light);
    border-right: 1px solid var(--c-border);
}

.currency-input {
    flex: 1;
    border: none;
}

input[type="text"], input[type="number"], select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--c-bg-light);
    color: var(--c-text-main);
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus, input[type="number"]:focus, select:focus, .input-wrapper:focus-within {
    border-color: var(--c-primary);
}

.help-text {
    font-size: 0.75rem;
    color: var(--c-text-muted);
}

.btn-primary, .btn-secondary {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--c-primary);
    color: white;
    margin-top: 8px;
}

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

.btn-secondary {
    background: var(--c-bg-light);
    color: var(--c-text-main);
    border: 1px solid var(--c-border);
}
.btn-secondary:hover { background: var(--c-border); }

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

.presets {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.preset-label {
    font-size: 0.8rem;
    color: var(--c-text-muted);
}

.btn-preset {
    background: transparent;
    border: 1px solid var(--c-border);
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 0.75rem;
    color: var(--c-text-main);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-preset:hover {
    background: var(--c-bg-light);
}

/* Results Content */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.results-header .panel-title { margin-bottom: 0; }

.placeholder-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 300px;
    border: 2px dashed var(--c-border);
    border-radius: var(--radius);
    color: var(--c-text-muted);
    font-size: 0.9rem;
}

.result-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 600px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-panel);
    overflow: hidden;
}

.card-hero {
    padding: 20px;
    text-align: center;
    background: var(--c-bg-light);
    border: none;
}

.card-hero h3 {
    font-size: 0.85rem;
    color: var(--c-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.hero-val {
    font-size: 2rem;
    font-weight: 700;
}

.text-accent { color: var(--c-accent); }
.text-error { color: var(--c-red); }
.text-success { color: var(--c-green); }
.text-warning { color: var(--c-orange); }
.text-muted { color: var(--c-text-muted); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--c-border);
    background: var(--c-bg-light);
}

.card-header h4 {
    font-size: 0.9rem;
    font-weight: 600;
}

.badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--c-panel);
    border: 1px solid currentColor;
}

.breakdown-list {
    list-style: none;
    padding: 8px 0;
}

.breakdown-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 16px;
    font-size: 0.85rem;
}

.list-val { font-family: monospace; font-size: 0.9rem; }

.breakdown-total {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--c-border);
    background: var(--c-bg-light);
    font-size: 0.9rem;
    font-weight: 600;
}

.bg-light { background: var(--c-bg-light); }
.border-none { border: none !important; }
.pb-0 { padding-bottom: 0 !important; }
.pt-0 { padding-top: 0 !important; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.rounded-bottom { border-bottom-left-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.font-medium { font-weight: 500; }
.text-sm { font-size: 0.85rem; }

/* Progress Bar */
.progress-bar-wrap {
    margin-top: 12px;
}
.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 6px;
}
.progress-bar {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--c-border);
    display: flex;
    overflow: hidden;
}
.progress-fill { height: 100%; transition: width 0.5s ease; }
.fill-accent { background: var(--c-accent); }
.fill-error { background: var(--c-red); }

footer {
    text-align: center;
    padding: 24px 0;
    font-size: 0.75rem;
    color: var(--c-text-muted);
}

/* Print Styles for PDF */
@media print {
    body { background: white !important; color: black !important; }
    .input-panel, header .icon-btn, #btn-print { display: none !important; }
    .main-layout { display: block; }
    .panel { box-shadow: none; border: none; padding: 0; }
    .card-hero { background: transparent; border: 1px solid #ccc; }
    .card-header, .breakdown-total, .bg-light { background: transparent !important; }
}
