:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #0ea5e9;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-header: #0f172a;
    --text-main: #334155;
    --text-header: #f8fafc;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 1rem;
    --font-main: 'Vazirmatn', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    direction: rtl;
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background: var(--bg-header);
    color: var(--text-header);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-header);
    text-decoration: none;
}

.logo-img {
    height: 40px;
    width: auto;
    background: white;
    border-radius: 8px;
    padding: 2px;
}

nav ul {
    display: flex;
    gap: 0.5rem;
    list-style: none;
}

nav a {
    text-decoration: none;
    color: #cbd5e1;
    font-weight: 500;
    transition: all 0.2s;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
}

nav a:hover, nav a.active {
    color: white;
    background: rgba(255,255,255,0.1);
}

main {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

footer {
    background: var(--bg-header);
    color: var(--text-header);
    padding: 4rem 2rem 2rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
    text-align: right;
}

.footer-section h4 {
    color: white;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    position: relative;
    padding-bottom: 0.75rem;
}

.footer-section h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

.footer-section p {
    color: #94a3b8;
    line-height: 1.8;
    font-size: 0.95rem;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 0.75rem;
}

.footer-section ul li a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-section ul li a:hover {
    color: white;
    padding-right: 5px;
}

.social-links-footer {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.social-links-footer a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.social-links-footer a:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    border-color: white;
}

.contact-info-footer {
    list-style: none;
    padding: 0;
}

.contact-info-footer li {
    color: #94a3b8;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
}

/* Components */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    transition: transform 0.2s;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

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

.btn-secondary:hover {
    background-color: var(--bg-body);
    border-color: var(--text-muted);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
    background: white;
}

th {
    background-color: var(--bg-body);
    padding: 1rem;
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #f8fafc;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 5rem 1rem;
    background: linear-gradient(135deg, #e0e7ff 0%, #f0f9ff 100%);
    border-radius: var(--radius);
    margin-bottom: 3rem;
    border: 1px solid rgba(255,255,255,0.5);
}

.hero h2 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    color: #1e293b;
    font-weight: 900;
    letter-spacing: -0.05em;
}

.hero p {
    font-size: 1.25rem;
    color: #475569;
    max-width: 700px;
    margin: 0 auto 2.5rem;
    line-height: 1.8;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Utilities */
.text-success { color: #10b981; font-weight: 600; }
.text-danger { color: #ef4444; font-weight: 600; }
.font-bold { font-weight: 700; }

/* Slider */
.hero-slider {
    position: relative;
    height: 400px;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 3rem;
    box-shadow: var(--shadow);
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    padding: 2rem;
}

.slide.active {
    opacity: 1;
}

.slide-content {
    color: white;
    max-width: 800px;
    z-index: 2;
}

.slide-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.slide-content p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.slider-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 3;
}

.dot {
    width: 12px;
    height: 12px;
    background: rgba(255,255,255,0.5);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s;
}

.dot.active {
    background: white;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-family: var(--font-main);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn-block {
    width: 100%;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
}

/* Captcha */
.captcha-group {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.captcha-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

#captcha-canvas {
    background: white;
    border-radius: 4px;
    cursor: pointer;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
}

.btn-icon:hover {
    color: var(--primary);
}

/* Manifesto Styles */
.manifesto-hero {
    text-align: center;
    margin-bottom: 3rem;
}

.manifesto-grid {
    display: grid;
    gap: 2rem;
}

.manifesto-card {
    position: relative;
    padding-top: 3rem;
}

.card-icon {
    position: absolute;
    top: -1.5rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.manifesto-card.highlight {
    border: 2px solid var(--primary);
    background: #f0f9ff;
}

.process-steps {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
}

.step {
    flex: 1;
    background: var(--bg-body);
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: center;
    border: 1px dashed var(--border);
}

.step strong {
    display: block;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.feature-list, .rules-list {
    list-style: none;
    margin: 1rem 0;
}

.feature-list li, .rules-list li {
    position: relative;
    padding-right: 1.5rem;
    margin-bottom: 0.75rem;
}

.feature-list li::before {
    content: "✓";
    position: absolute;
    right: 0;
    color: var(--success);
    font-weight: bold;
}

.rules-list li::before {
    content: "•";
    position: absolute;
    right: 0;
    color: var(--primary);
    font-size: 1.5rem;
    line-height: 1rem;
}

.np-formula-box {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: center;
    border: 1px solid var(--primary);
    margin-top: 1rem;
}

.np-formula-box code {
    display: block;
    margin-top: 0.5rem;
    font-family: monospace;
    background: #f1f5f9;
    padding: 0.5rem;
    border-radius: 4px;
    direction: ltr;
}

.funds-structure {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
}

.fund-item {
    flex: 1;
    background: var(--bg-body);
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: center;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tag {
    background: #e0e7ff;
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Contact & Cooperation */
.contact-container, .cooperation-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .contact-container, .cooperation-grid {
        grid-template-columns: 1fr;
    }
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.social-links {
    display: flex;
    gap: 0.5rem;
    margin-top: 2rem;
}

.social-btn {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    text-decoration: none;
    color: var(--text-muted);
    transition: all 0.2s;
}

.social-btn:hover {
    background: var(--bg-body);
    color: var(--primary);
}

.benefits-list {
    list-style: none;
}

.benefits-list li {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.benefits-list .icon {
    font-size: 1.5rem;
}

/* Project Cards */
.project-card {
    text-align: center;
    position: relative;
    overflow: hidden;
}

.project-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 1rem;
}

.status-badge.active {
    background: #dcfce7;
    color: #166534;
}

.status-badge.developing {
    background: #fef9c3;
    color: #854d0e;
}

.status-badge.planning {
    background: #f1f5f9;
    color: #475569;
}

.cta-section {
    text-align: center;
    background: var(--bg-header);
    color: white;
    padding: 4rem 2rem;
    border-radius: var(--radius);
    margin-top: 4rem;
}

.cta-section h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.cta-section p {
    color: #cbd5e1;
    margin-bottom: 2rem;
}

.btn-light {
    background: white;
    color: var(--primary);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-light:hover {
    background: #f8fafc;
}

.btn-nav-login {
    background: var(--primary);
    color: white !important;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
}

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

/* NP Calculator Styles */
.np-calculator-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: var(--shadow);
}

.np-calculator-section h3 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.calc-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

.calc-tab {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.calc-tab:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.calc-tab.active {
    background: var(--primary);
    color: white;
}

.calc-content {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: var(--radius);
}

.form-group {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    color: var(--text-main);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-family: var(--font-main);
    font-size: 1rem;
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.calc-result-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg-header);
    color: white;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
}

.calc-result-box strong {
    font-size: 2rem;
    color: #2ecc71;
    font-family: monospace;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .calc-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .calc-tab {
        width: 100%;
        text-align: center;
    }
    
    .calc-result-box {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* New Compact Calculator Styles */
.small-hero {
    padding: 2rem 1rem;
    text-align: center;
    background: var(--bg-header);
    color: white;
    margin-bottom: 2rem;
}

.small-hero h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.small-hero p { font-size: 1rem; opacity: 0.8; }

.calculator-container {
    max-width: 600px;
    margin: 0 auto 4rem;
    padding: 0 1rem;
}

.np-calculator-card {
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    overflow: hidden;
    border: 1px solid var(--border);
}

.calc-header {
    background: #f8fafc;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.compact-tabs {
    display: flex;
    background: #e2e8f0;
    padding: 0.25rem;
    border-radius: 0.75rem;
    gap: 0;
    border: none;
    margin: 0;
}

.compact-tabs .calc-tab {
    flex: 1;
    padding: 1rem;
    border-radius: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-muted);
}

.compact-tabs .calc-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.calc-body {
    padding: 1.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    width: 100%;
    padding-left: 3rem;
}

.input-wrapper .unit {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
    pointer-events: none;
}

/* Segment Control */
.segment-control {
    display: flex;
    background: #f1f5f9;
    border-radius: 0.5rem;
    padding: 0.25rem;
    gap: 0.25rem;
}

.segment-control input[type="radio"] {
    display: none;
}

.segment-control label {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 0.25rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: all 0.2s;
}

.segment-control input:checked + label {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    font-weight: 600;
}

/* Range Slider */
.range-slider {
    padding: 0 0.5rem;
}

.range-slider input[type="range"] {
    width: 100%;
    margin-bottom: 0.5rem;
    accent-color: var(--primary);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.calc-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.base-rate-info {
    color: var(--text-muted);
}

.result-display {
    text-align: left;
}

.result-display .label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.result-display strong {
    font-size: 2.5rem;
    line-height: 1;
    color: var(--primary);
    background: -webkit-linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.calc-info-link {
    text-align: center;
    margin-top: 1rem;
}

.calc-info-link a {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-decoration: none;
}

.calc-info-link a:hover {
    color: var(--primary);
}

/* Manifesto Formula Styles */
.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin: 1.5rem 0;
}

.param-group h4 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.badge-list {
    list-style: none;
    padding: 0;
}

.badge-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: #f8fafc;
    border-radius: 0.5rem;
}

.badge {
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge.gray { background: #94a3b8; }
.badge.blue { background: #3b82f6; }
.badge.red { background: #ef4444; }

.fib-sequence {
    display: flex;
    gap: 0.5rem;
}

.fib-sequence span {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 2px solid var(--primary);
    color: var(--primary);
    border-radius: 50%;
    font-weight: bold;
    font-family: monospace;
    font-size: 1.1rem;
}

.text-danger {
    color: #ef4444;
    font-size: 0.85rem;
}

/* Refined Manifesto Styles */
.formulas-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.formula-card {
    background: var(--bg-body);
    border-radius: 0.75rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.formula-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.formula-header h3 {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.math-display {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    font-family: monospace;
    font-size: 1.1rem;
    color: var(--text-main);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: inline-block;
    border: 1px solid var(--border);
}

.math-display .var { color: var(--primary); font-weight: bold; }
.math-display .const { color: var(--text-muted); }

.params-row {
    display: flex;
    gap: 2rem;
    border-top: 1px dashed var(--border);
    padding-top: 1.5rem;
}

.param-col {
    flex: 1;
}

.param-col h4 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.tags-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-badge {
    background: white;
    border: 1px solid var(--border);
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tag-badge b { color: var(--primary); }
.tag-badge.gray b { color: #64748b; }
.tag-badge.blue b { color: #3b82f6; }
.tag-badge.red b { color: #ef4444; }

.fib-display {
    display: flex;
    gap: 0.5rem;
}

.fib-display span {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.9rem;
}

.quality-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.range-bar {
    flex: 1;
    height: 4px;
    background: linear-gradient(to left, #ef4444, #22c55e, #ef4444);
    border-radius: 2px;
}

.note-text {
    display: block;
    margin-top: 0.5rem;
    color: #ef4444;
    font-size: 0.8rem;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.info-box {
    background: var(--bg-body);
    padding: 1rem;
    border-radius: 0.75rem;
    text-align: center;
    border: 1px solid var(--border);
}

.info-box.highlight {
    background: #f0f9ff;
    border-color: #bae6fd;
}

.info-box h4 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.info-box ul {
    list-style: none;
    padding: 0;
    font-size: 0.9rem;
}

.math-small {
    font-family: monospace;
    font-weight: bold;
    color: var(--primary);
}

.action-area {
    text-align: center;
    margin-top: 1rem;
}

.btn-calc {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary);
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.4);
}

.btn-calc:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

@media (max-width: 640px) {
    .params-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .math-display {
        font-size: 0.9rem;
        padding: 0.75rem;
    }
}

/* Compact & Elegant Manifesto Styles */
.formulas-compact {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.formula-row {
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.formula-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 0.75rem;
}

.f-number {
    background: var(--primary);
    color: white;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.f-content h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    color: var(--text-main);
}

.en-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: normal;
}

.math-inline {
    font-family: monospace;
    color: var(--text-main);
    font-size: 0.95rem;
}

.math-inline .var { color: var(--primary); font-weight: 600; }
.math-inline .const { color: var(--text-muted); }

.formula-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-right: 2.25rem; /* Align with content */
}

.detail-line {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.detail-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    min-width: 120px;
}

.tags-mini {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tags-mini span {
    background: #f1f5f9;
    padding: 0.1rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-main);
    border: 1px solid transparent;
}

.tags-mini span b { color: var(--primary); margin-right: 2px; }

.tags-mini .tag-gray { color: #64748b; background: #f8fafc; border-color: #e2e8f0; }
.tags-mini .tag-blue { color: #2563eb; background: #eff6ff; border-color: #dbeafe; }
.tags-mini .tag-red { color: #dc2626; background: #fef2f2; border-color: #fee2e2; }

.fib-mini {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.fib-mini span {
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: bold;
}

.val-range {
    font-weight: bold;
    color: var(--text-main);
}

.note-text {
    color: #ef4444;
    font-size: 0.75rem;
}

/* Base Rate Box */
.base-rate-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.base-icon {
    font-size: 1.25rem;
}

.base-content strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    color: var(--text-main);
}

.base-content p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Meta Row */
.meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-header);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.meta-label {
    opacity: 0.8;
}

.mini-code {
    background: rgba(255,255,255,0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.85rem;
}

.btn-mini-calc {
    background: white;
    color: var(--bg-header);
    text-decoration: none;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.85rem;
    font-weight: bold;
    transition: all 0.2s;
}

.btn-mini-calc:hover {
    background: #e2e8f0;
}

@media (max-width: 640px) {
    .formula-details { padding-right: 0; }
    .detail-line { flex-direction: column; gap: 0.25rem; }
    .meta-row { flex-direction: column; align-items: stretch; text-align: center; }
    .meta-action { text-align: center; }
}

/* High Contrast & Refined Colors */
.formulas-compact {
    gap: 1.5rem;
}

.formula-row {
    border: 1px solid #cbd5e1; /* Darker border */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.formula-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
}

.f-number {
    background: var(--bg-header); /* Darker background for number */
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.f-content h4 {
    color: #1e293b; /* Darker text */
    font-weight: 700;
}

.math-inline {
    background: #f8fafc;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid #e2e8f0;
    display: inline-block;
}

.math-inline .var {
    color: #4f46e5; /* Stronger primary color */
}

.detail-label {
    color: #475569; /* Darker muted text */
    font-weight: 500;
}

/* Enhanced Tags */
.tags-mini span {
    border: 1px solid #e2e8f0;
    font-weight: 500;
}

.tags-mini span b {
    background: rgba(0,0,0,0.05);
    padding: 0 4px;
    border-radius: 3px;
    margin-right: 4px;
}

.tags-mini .tag-gray { 
    color: #334155; 
    background: #f1f5f9; 
    border-color: #cbd5e1; 
}

.tags-mini .tag-blue { 
    color: #1e40af; 
    background: #dbeafe; 
    border-color: #93c5fd; 
}

.tags-mini .tag-red { 
    color: #991b1b; 
    background: #fee2e2; 
    border-color: #fca5a5; 
}

/* Fib Sequence */
.fib-mini span {
    background: white;
    border: 2px solid #6366f1;
    color: #4338ca;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.15);
}

/* Base Rate Box */
.base-rate-box {
    background: #fffbeb; /* Warm yellow tint */
    border-color: #fcd34d;
    color: #92400e;
}

.base-rate-box .base-icon {
    background: #fef3c7;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1rem;
}

.base-content strong {
    color: #b45309;
}

.base-content p {
    color: #78350f;
}

/* Meta Row */
.meta-row {
    background: #1e293b; /* Slate 800 */
    border: 1px solid #0f172a;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.meta-label {
    color: #94a3b8;
}

.mini-code {
    background: #0f172a;
    border: 1px solid #334155;
    color: #38bdf8; /* Sky blue text */
}

.btn-mini-calc {
    background: #3b82f6;
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.btn-mini-calc:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

/* Enhanced Calculator Styles */
.np-calculator-card {
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.calc-header {
    background: linear-gradient(to right, #f8fafc, #f1f5f9);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.compact-tabs {
    background: #e2e8f0;
    padding: 0.35rem;
    border-radius: 1rem;
    gap: 0.5rem;
    border: none;
    margin: 0 auto;
    max-width: 300px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
    display: flex; /* Ensure flex behavior for gap */
}

.compact-tabs .calc-tab {
    flex: 1;
    padding: 0.6rem;
    border-radius: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.compact-tabs .calc-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: scale(1.02);
}

.calc-body {
    padding: 2rem;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: block;
    font-weight: 600;
}

.input-wrapper input, 
.form-group select,
.form-group input[type="number"] {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    font-size: 1rem;
    transition: all 0.2s;
    background: #f8fafc;
}

.input-wrapper input:focus, 
.form-group select:focus,
.form-group input[type="number"]:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    outline: none;
}

/* Segment Control Enhanced */
.segment-control {
    background: #f1f5f9;
    padding: 0.35rem;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    display: flex;
    gap: 0.25rem;
}

.segment-control input[type="radio"] {
    display: none;
}

.segment-control label {
    margin: 0;
    border-radius: 0.5rem;
    font-weight: 500;
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
}

.segment-control input:checked + label {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transform: scale(1.02);
}

/* Custom Step Slider */
.custom-step-slider {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin: 1.5rem 0;
    padding: 0 10px;
    direction: ltr; /* Force LTR for consistency */
}

.step-line {
    position: absolute;
    top: 50%;
    left: 10px;
    right: 10px;
    height: 4px;
    background: #e2e8f0;
    transform: translateY(-50%);
    z-index: 0;
    border-radius: 2px;
}

.step-item {
    width: 40px;
    height: 40px;
    background: white;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    z-index: 1;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    font-size: 1rem;
}

.step-item:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.step-item.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.4);
    transform: scale(1.15);
}
    display: block;
    cursor: pointer;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.range-wrapper input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--primary);
    border: 3px solid white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.4), 0 2px 4px -1px rgba(99, 102, 241, 0.2);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: -6px; /* Center thumb: (24 - 12) / -2 */
}

.range-wrapper input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.5);
}

.range-wrapper input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 12px;
    cursor: pointer;
    background: linear-gradient(to right, #e2e8f0 0%, #e2e8f0 100%);
    border-radius: 6px;
}

/* Ticks on the track */
.range-wrapper::before {
    content: '';
    position: absolute;
    top: 6px; /* Center of track */
    left: 12px;
    right: 12px;
    height: 0;
    display: flex;
    justify-content: space-between;
    z-index: 0;
    pointer-events: none;
}

/* Result Display Enhanced */
.calc-footer {
    background: #f8fafc;
    margin: 2rem -2rem -2rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-display {
    text-align: right;
}

.result-display .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.result-display strong {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(99, 102, 241, 0.2));
}

/* Financial Cycles */
.cycles-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.cycle-box {
    background: #f8fafc;
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    position: relative;
    overflow: hidden;
}

.cycle-box h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #1e293b;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.cycle-box.monthly {
    border-left: 4px solid #3b82f6;
}

.cycle-box.quarterly {
    border-left: 4px solid #f59e0b;
}

.cycle-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cycle-list li {
    position: relative;
    padding-right: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    color: #475569;
    line-height: 1.5;
}

.cycle-list li::before {
    content: '•';
    position: absolute;
    right: 0;
    color: #cbd5e1;
    font-size: 1.5rem;
    line-height: 1rem;
    top: 0.2rem;
}

.cycle-list li strong {
    color: #334155;
    font-weight: 700;
}

.highlight-step {
    background: #dbeafe;
    color: #1e40af !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.5rem;
    margin-top: 1rem !important;
    font-weight: 600;
    text-align: center;
    padding-right: 1rem !important;
}

.highlight-step::before {
    display: none;
}

/* Info Box */
.info-box {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 0.75rem;
    padding: 1rem;
    margin: 1rem 0;
    color: #92400e;
    font-size: 0.95rem;
    line-height: 1.6;
}

.info-box strong {
    display: block;
    margin-bottom: 0.5rem;
    color: #b45309;
    font-size: 1rem;
}

/* Rule Groups */
.rule-group {
    margin-bottom: 2rem;
}

.rule-group:last-child {
    margin-bottom: 0;
}

.rule-group h3 {
    font-size: 1.1rem;
    color: #334155;
    margin-bottom: 1rem;
    border-bottom: 1px dashed #cbd5e1;
    padding-bottom: 0.5rem;
    font-weight: 700;
}

/* Cooperation Page Styles */
.cooperation-intro {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.intro-card {
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.2s;
    border: 1px solid var(--border);
}

.intro-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.intro-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.intro-card h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-weight: 700;
}

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

.contact-box {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px dashed #cbd5e1;
    margin-top: 2rem;
}

.contact-box h4 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.contact-box p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.contact-box p:last-child {
    margin-bottom: 0;
}

/* Cooperation Grid Layout */
.cooperation-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2rem;
    align-items: start;
}

.form-card {
    padding: 2rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.info-side {
    position: sticky;
    top: 2rem;
}

.info-card {
    padding: 2rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.benefits-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.benefits-list li {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: flex-start;
}

.benefits-list li:last-child {
    margin-bottom: 0;
}

.benefits-list .icon {
    font-size: 1.5rem;
    background: #f0f9ff;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.benefits-list strong {
    display: block;
    color: var(--text-main);
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.benefits-list p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .cooperation-grid {
        grid-template-columns: 1fr;
    }
    
    .info-side {
        position: static;
    }
}

/* Page Header */
.page-header {
    text-align: center;
    margin-bottom: 4rem;
    padding: 2rem 0;
}

.page-header h1 {
    font-size: 2.5rem;
    color: #1e293b;
    margin-bottom: 1rem;
    font-weight: 800;
}

.page-header p {
    font-size: 1.2rem;
    color: #64748b;
    max-width: 600px;
    margin: 0 auto;
}

/* Contact Info in Cooperation Page */
.contact-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.c-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.c-icon {
    font-size: 1.2rem;
}

.social-links-mini {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.social-link {
    background: white;
    border: 1px solid var(--border);
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.85rem;
    transition: all 0.2s;
}

.social-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Fix Calculator Jumping */
.calc-body {
    /* min-height removed for dynamic resizing */
    transition: height 0.3s ease;
    overflow: hidden; /* Required for smooth height transition */
}

/* Smooth transition for dynamic inputs */
.s-dynamic-group {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}
