:root {
    --theme-color: #3b82f6; 
    --theme-light: #eff6ff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --bg-panel: #ffffff;
    --border-light: #e2e8f0;
}

.compact-calc-panel {
    position: fixed;
    right: -400px;
    top: 50%;
    transform: translateY(-50%);
    width: 400px;
    background: var(--bg-panel);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1);
    border-radius: 20px 0 0 20px;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 9999999 !important;
    display: flex;
    flex-direction: column;
    font-family: 'Poppins', -apple-system, sans-serif;
}

.compact-calc-panel.open { right: 0; }

.panel-toggle {
    position: absolute;
    left: -44px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 180px;
    background: var(--theme-color);
    color: #fff;
    border-radius: 12px 0 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: -4px 0 15px rgba(0,0,0,0.15);
    transition: background 0.3s;
}

.panel-toggle span {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 1.5px;
    white-space: nowrap;
}

.mobile-close {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f1f5f9;
    color: #333;
    width: 30px; height: 30px;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
}

.panel-body { padding: 25px; }

.tab-container {
    display: flex;
    background: #f8fafc;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 20px;
    border: 1px solid var(--border-light);
}

.calc-tab {
    flex: 1;
    padding: 8px 0;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.calc-tab.active {
    background: var(--theme-light);
    color: var(--theme-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.input-block { margin-bottom: 15px; }
.input-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.input-label { font-size: 13px; font-weight: 600; color: var(--text-main); }

.styled-input-wrapper {
    display: flex; align-items: center; background: #f8fafc;
    border: 1px solid var(--border-light); border-radius: 6px; padding: 4px 10px; transition: border 0.3s;
}
.styled-input-wrapper:focus-within { border-color: var(--theme-color); }

.styled-input {
    border: none; background: transparent; text-align: right; font-size: 15px;
    font-weight: 700; color: var(--theme-color); width: 100px; outline: none; font-family: inherit;
}

.prefix, .suffix { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.prefix { margin-right: 5px; } .suffix { margin-left: 5px; }

input[type="range"] {
    -webkit-appearance: none; width: 100%; height: 5px; background: var(--border-light);
    border-radius: 4px; outline: none; background-image: linear-gradient(var(--theme-color), var(--theme-color));
    background-size: 0% 100%; background-repeat: no-repeat;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 16px; height: 16px; background: #fff;
    border: 2px solid var(--theme-color); border-radius: 50%; cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.tenure-toggle { display: flex; gap: 5px; font-size: 11px; font-weight: 600; color: var(--text-muted); }
.tenure-toggle span { cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.tenure-toggle span.active { background: var(--theme-light); color: var(--theme-color); }

.results-box {
    background: #f8fafc; border: 1px solid var(--border-light);
    border-radius: 12px; padding: 15px; margin-bottom: 20px;
}

.main-emi { text-align: center; margin-bottom: 12px; }
.main-emi span { display: block; font-size: 11px; color: var(--text-muted); text-transform: uppercase; font-weight: 700; letter-spacing: 1px; }
.main-emi h2 { margin: 2px 0 0; font-size: 32px; color: var(--theme-color); letter-spacing: -1px; }

.stacked-bar-container { margin: 15px 0; }
.stacked-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--border-light); }
.bar-p { background: var(--theme-color); transition: width 0.4s ease; }
.bar-i { background: #cbd5e1; transition: width 0.4s ease; }

.breakdown-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 12px; font-weight: 500; color: var(--text-muted); align-items: center; }
.breakdown-row b { color: var(--text-main); font-weight: 700; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.p-dot { background: var(--theme-color); }
.i-dot { background: #cbd5e1; }
.breakdown-row.total { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-light); color: var(--text-main); font-size: 13px; margin-bottom: 0; }

.action-links { display: flex; gap: 10px; }
.action-btn { flex: 1; text-align: center; text-decoration: none; padding: 10px; border-radius: 8px; font-size: 12px; font-weight: 600; transition: 0.3s; }
.btn-primary { background: var(--theme-color); color: #fff; border: 1px solid var(--theme-color); }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-outline { background: #fff; color: var(--text-main); border: 1px solid var(--border-light); }
.btn-outline:hover { background: #f8fafc; transform: translateY(-1px); }

.mobile-open-btn {
    position: fixed; bottom: 20px; right: 20px;
    background: var(--theme-color); color: #fff;
    padding: 15px 25px; border-radius: 30px;
    font-weight: 600; box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 9990; cursor: pointer;
}

@media (max-width: 768px) {
    .compact-calc-panel {
        width: 100%; height: 100vh; top: 0; transform: none; right: -100%; border-radius: 0;
    }
    .panel-toggle { display: none; }
    .mobile-close { display: block; }
}