:root {
    --bg-color: #f4f6fa;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --text-muted: #7f8c8d;
    --primary-color: #34495e;
    --accent-color: #3498db;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --border-color: #dcdde1;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    padding: 20px 10px;
}

.restart-container {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 25px 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.calc-header {
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    text-align: center;
}

.calc-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 14px;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

@media (min-width: 768px) {
    body { padding: 40px 20px; }
    .restart-container { padding: 30px; }
    .calc-header h1 { font-size: 26px; }
}

.calc-descriptor {
    font-size: 14px;
    color: var(--text-color);
    text-align: left;
    max-width: 900px;
    margin: 0 auto;
}

.calc-descriptor p {
    line-height: 1.6;
}

.calc-descriptor ul {
    margin: 10px 0 10px 15px;
    list-style: none;
    padding-left: 0;
}

.calc-descriptor li {
    position: relative;
    padding-left: 18px;
    margin-bottom: 8px;
    line-height: 1.5;
}

.calc-descriptor li::before {
    content: "—";
    position: absolute;
    left: 0;
    color: var(--text-color);
}

.descriptor-note {
    margin-top: 10px;
}

.restart-box {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
}

@media (min-width: 850px) {
    .restart-box {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
    .restart-outputs {
        height: 100% !important;
    }
}

.restart-inputs {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.form-group input, .form-group select {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    background-color: #fff;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
}

.form-group select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%232c3e50' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.restart-outputs {
    background: #fafbfc;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: fit-content;
}

@media (min-width: 768px) {
    .restart-outputs { padding: 20px; }
}

/* ОБНОВЛЕННЫЙ БЛОК ВЫВОДА */
.restart-output-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 0;
    font-size: 14px;
    border-bottom: 1px solid #f1f2f6;
}

.restart-output-row > div {
    flex: 1; /* Текст занимает всё место, кроме ширины числа */
}

.output-val, 
#outMaxDayRiskCombo {
    font-weight: 700;
    white-space: nowrap; /* Гарантирует, что число и ₽ не разорвутся */
    font-size: 15px;
    color: var(--text-color);
    flex-shrink: 0; /* Число не сжимается */
}

.restart-output-row:last-child {
    border-bottom: none;
}

.output-val.accent { color: var(--text-color); }
.output-val.success { color: var(--text-color); }

.restart-output-row.sep {
    border-bottom: none;
    padding-top: 18px;
    margin-top: 5px;
    color: var(--primary-color);
}

.total-risk-row {
    border-top: 1px dashed var(--border-color);
    border-bottom: none;
    padding-top: 15px;
    margin-top: 5px;
}

.alert-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 15px;
    line-height: 1.4;
}

.hint-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #dee2e6;
    color: #495057;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s, color 0.2s;
    vertical-align: middle;
}

.hint-trigger:hover {
    background: var(--accent-color);
    color: #fff;
}

.field-hint {
    display: none !important;
}

/* СТИЛИ ДЛЯ ПОП-АП ОКНА */
.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.popup-overlay.active {
    display: flex;
    opacity: 1;
}

.popup-content {
    background: #ffffff;
    padding: 24px 20px;
    border-radius: 12px;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    position: relative;
    transform: scale(0.9);
    transition: transform 0.2s ease-in-out;
}

.popup-overlay.active .popup-content {
    transform: scale(1);
}

.popup-close {
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 24px;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.popup-close:hover {
    color: var(--text-color);
}

#popupText {
    font-size: 14px;
    color: var(--text-color);
    line-height: 1.5;
    padding-right: 10px;
}

.text-danger {
    color: var(--text-color);
}

inline-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    text-align: left;
}

.inline-footer a {
    color: var(--accent-color);
    text-decoration: none;
}

.inline-footer a:hover {
    text-decoration: underline;
}
