:root {
    --primary: #005EB8;
    --primary-hover: #004b93;
    --accent: #00A9CE; 
    --accent-light: #E8F4F8;
    --success: #00823B; 
    --warning: #D97706; 
    --bg-color: #F0F4F8; 
    --surface: #FFFFFF;
    --text-dark: #1F2937;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --radius: 16px;
}

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

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at top right, #E0F2FE 0%, transparent 40%), 
                      radial-gradient(circle at bottom left, #E0F2FE 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-dark);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Master Width Container */
.container { 
    width: 100%;
    max-width: 1080px; 
    margin: 0 auto; 
    padding: 0 20px; 
}

/* Navbar */
.navbar {
    background-color: var(--surface);
    position: relative;
    z-index: 100;
    padding: 16px 0;
}
.nav-content { display: flex; align-items: center; }

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.logo-icon {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1rem;
}

/* Dynamic Banners - Now styled as layout cards */
.award-banner {
    color: white;
    padding: 12px 20px;
    font-size: 0.95rem;
    box-shadow: var(--shadow-md);
    border-radius: var(--radius);
    margin-bottom: 24px;
}
.banner-success { background-color: var(--success); }
.banner-warning { background-color: var(--warning); }
.banner-info { background-color: var(--primary); }

.banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
}
.banner-content strong { font-weight: 700; }

.page-wrapper { padding: 40px 0; flex-grow: 1; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.ml-auto { margin-left: auto; }

/* Headers & Breadcrumbs */
.page-header { margin-bottom: 35px; }
.page-header h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.03em; color: var(--primary); }
.subtitle { color: var(--text-muted); margin-top: 8px; font-size: 1.15rem; }

.breadcrumbs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
    flex-wrap: wrap;
}
.breadcrumbs a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
.breadcrumbs a:hover { color: var(--accent); }

/* Cards */
.app-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255,255,255,0.8);
    padding: 28px;
    margin-bottom: 24px;
}
.region-card { border-top: 4px solid var(--primary); transition: transform 0.2s, box-shadow 0.2s; }
.region-card:hover { transform: translateY(-3px); box-shadow: 0 15px 25px -5px rgba(0,0,0,0.1); }
.card-header { margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.card-header h2 { font-size: 1.3rem; }

/* Buttons & Pills */
.region-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}
.band-pills { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px; }
.pill {
    background-color: var(--accent-light); color: var(--primary); text-decoration: none;
    padding: 8px 16px; border-radius: 20px; font-size: 0.95rem; font-weight: 600;
    transition: all 0.2s ease; border: 1px solid transparent;
}
.pill:hover { background-color: var(--primary); color: white; transform: translateY(-2px); box-shadow: 0 4px 6px rgba(0, 94, 184, 0.2); }

.btn-primary {
    display: inline-block;
    background-color: var(--primary);
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 94, 184, 0.2);
    white-space: nowrap;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 94, 184, 0.3);
}

/* Layouts */
.app-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 32px;
    align-items: start;
}

/* Forms */
.form-group { margin-bottom: 22px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 8px; font-size: 0.95rem; }
.hint { display: block; font-size: 0.8rem; color: var(--text-muted); margin-top: 6px; }

input[type="number"], input[type="text"], select {
    width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: 10px;
    font-size: 1rem; font-family: inherit; background-color: #F9FAFB; transition: all 0.2s; outline: none;
}
input[type="number"]:focus, input[type="text"]:focus, select:focus { 
    border-color: var(--accent); background-color: var(--surface); box-shadow: 0 0 0 4px rgba(0, 169, 206, 0.1); 
}

/* Tax Code Specific Styling */
#tax_code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--primary);
    background-color: var(--accent-light);
    border-color: #bae6fd;
    text-transform: uppercase;
}
#tax_code:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 94, 184, 0.15);
}

.select-wrapper { position: relative; }
.select-wrapper::after { content: "▼"; font-size: 0.8rem; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text-muted); }
select { appearance: none; padding-right: 40px; }

/* Custom Toggle */
.divider { height: 1px; background: var(--border); margin: 24px 0; }
.toggle-group { display: flex; justify-content: space-between; align-items: center; }
.toggle-text { display: flex; flex-direction: column; }
.toggle-text strong { font-size: 0.95rem; font-weight: 600; }
.toggle-text span { font-size: 0.85rem; color: var(--text-muted); }
.switch { position: relative; display: inline-block; width: 50px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .3s; }
.slider:before { position: absolute; content: ""; height: 22px; width: 22px; left: 3px; bottom: 3px; background-color: white; transition: .3s; }
input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before { transform: translateX(22px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

/* Hero Metrics Panel */
.hero-stat {
    background: linear-gradient(135deg, var(--primary) 0%, #00305e 100%);
    color: white;
    padding: 35px;
    border: none;
}
.stat-header { margin-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 15px; }
.stat-header h2 { font-size: 1.2rem; font-weight: 500; display: flex; align-items: center; gap: 10px; margin: 0; }
.badge { background-color: rgba(255,255,255,0.2); color: white; padding: 4px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }

.big-metrics { display: flex; width: 100%; align-items: center; }
.metric-box { display: flex; flex-direction: column; }
.metric-label { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.8; margin-bottom: 5px; font-weight: 600; }
.big-number { font-size: 2.8rem; font-weight: 800; letter-spacing: -0.05em; line-height: 1.1; }

.text-accent { color: #67e8f9; }

/* Tables */
.table-card { padding: 0; overflow: hidden; }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.modern-table { width: 100%; border-collapse: collapse; min-width: 500px; }
.modern-table th, .modern-table td { padding: 18px 24px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.modern-table th { background-color: #F9FAFB; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 700; text-align: left;}
.text-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.font-bold { font-weight: 700; }
.deduction-label { font-weight: 600; color: var(--text-dark); }
.tier-badge { display: inline-block; background: var(--accent-light); padding: 3px 8px; border-radius: 6px; font-size: 0.75rem; color: var(--primary); font-weight: 600; margin-left: 8px; vertical-align: middle; }

/* Scale Breakdown Specifics */
.scale-breakdown { padding-bottom: 0; }
.band-cell { background-color: #F8FAFC; border-right: 1px solid var(--border); }
.action-cell { background-color: #F8FAFC; border-left: 1px solid var(--border); }

.net-row { background-color: var(--accent-light); border-top: 2px solid var(--primary); }
.net-row td { border-bottom: none; font-weight: 800; font-size: 1.25rem; color: var(--primary); padding: 24px; }

/* Footer */
.footer {
    text-align: center;
    padding: 40px 20px;
    background-color: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: 40px;
}
.footer p { color: var(--text-dark); font-weight: 500; }
.footer .disclaimer { color: var(--text-muted); font-size: 0.85rem; margin-top: 10px; font-weight: 400; max-width: 800px; margin-left: auto; margin-right: auto; }
.footer-link { color: var(--primary); font-weight: 700; text-decoration: none; transition: color 0.2s; }
.footer-link:hover { color: var(--accent); text-decoration: underline; }

/* Mobile Responsiveness Rules */
@media (max-width: 860px) { 
    .app-layout { grid-template-columns: 1fr; } 
    .big-metrics { flex-direction: column; align-items: flex-start; gap: 20px; }
    .ml-auto { margin-left: 0; text-align: left !important; }
}

@media (max-width: 600px) {
    .page-wrapper { padding: 20px 15px; } 
    .app-card { padding: 20px; }
    .region-grid { grid-template-columns: 1fr; }
    
    .modern-table th, .modern-table td { padding: 12px 14px; font-size: 0.9rem; }
    .btn-primary { padding: 8px 14px; font-size: 0.85rem; }
    
    .big-number { font-size: 2.2rem; }
    .page-header h1 { font-size: 1.8rem; }
    
    .modern-table { min-width: 100%; } 
}