/* ============================================
   ROOT VARIABLES
============================================ */
:root {
    --bg: #f5f5f7;
    --card-bg: #ffffff;
    --accent: #e0003b;
    --accent-soft: #ffe4ec;

    --green: #0d8d0d;
    --green-soft: #e7fce7;

    --text-main: #222;
    --text-soft: #666;
    --border: #ddd;

    --radius-lg: 16px;
    --shadow-soft: 0 14px 30px rgba(0,0,0,0.06);
}


/* ============================================
   PAGE BASE
============================================ */
body {
    margin: 0;
    padding: 30px 14px 60px;
    background: var(--bg);
    color: var(--text-main);
    font-family: system-ui, -apple-system, Segoe UI, sans-serif;
}

.page {
    max-width: 650px;
    margin: 0 auto;
}

h1 {
    font-size: 30px;
    margin-bottom: 26px;
    font-weight: 700;
    text-align: center;
}

h2 {
    font-size: 18px;
    margin-bottom: 22px;
    font-weight: 600;
    text-align: center;
}


/* ============================================
   CARD
============================================ */
.card {
    background: var(--card-bg);
    padding: 26px 22px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.card-top {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 28px;
}


/* ============================================
   FORM GRID (CENTERS EVERYTHING)
============================================ */
.form-grid {
    width: fit-content;
    margin: 0 auto;
}


/* ============================================
   INPUT ROWS
============================================ */
.row {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) 110px;
    align-items: center;
    column-gap: 12px;
    margin-bottom: 14px;
}

.row label {
    text-align: right;
    padding-right: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.input-wrapper {
    width: 110px;
    min-width: 80px;
    max-width: 110px;
    display: flex;
    align-items: center;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fafafa;
    padding: 0 10px;
}

.input-wrapper input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    padding: 6px 4px 6px 0;
    font-size: 15px;
    outline: none;
    text-align: right;
}

.suffix {
    font-size: 14px;
    color: var(--text-soft);
    padding-left: 4px;
}


/* ============================================
   RESULT GRID
============================================ */
.result-row {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) 110px;
    align-items: center;
    column-gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed rgba(0,0,0,0.06);
}

.result-label {
    text-align: right;
    padding-right: 12px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.result-value {
    text-align: right;
    width: 110px;
    min-width: 80px;
    max-width: 110px;
    font-weight: 600;
}

.result-value.strong {
    font-size: 17px;
}


/* ============================================
   GREEN PILL (RESULTS SEPARATOR)
============================================ */
.pill {
    display: block;
    margin: 22px auto;
    width: fit-content;

    background: var(--green-soft);
    color: var(--green);

    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 999px;
}


/* ============================================
   TOOLTIP
============================================ */
.help-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid #c5c5c5;
    font-size: 11px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
    background: #fff;
    position: relative;
    flex-shrink: 0;
}

.help-icon .tooltip {
    position: absolute;
    top: 120%;
    left: 50%;
    transform: translateX(-50%);

    background: #111;
    color: #fff;
    font-size: 12px;
    padding: 10px 12px;
    border-radius: 10px;

    white-space: normal;
    width: 240px;

    line-height: 1.35;
    text-align: left; /* ← вот эта строка нужна */

    opacity: 0;
    visibility: hidden;
    transition: .15s ease-out;
    z-index: 50;
}

.help-icon:hover .tooltip {
    opacity: 1;
    visibility: visible;
}


/* ============================================
   MAIN RESULT HIGHLIGHT (profitMonth)
============================================ */
.result-profit {
    font-size: 22px;
    font-weight: 700;
}

.result-profit.positive {
    color: var(--green);
}

.result-profit.negative {
    color: var(--accent);
}

.result-profit.zero {
    color: var(--text-main);
}


/* ============================================
   MOBILE LAYOUT
============================================ */
@media (max-width: 520px) {

    .row,
    .result-row {
        grid-template-columns: 1fr;
    }

    .row label,
    .result-label {
        text-align: left;
        padding-right: 0;
        margin-bottom: 4px;
        white-space: normal;
    }

    .input-wrapper,
    .result-value {
        width: 100%;
        max-width: 100%;
        text-align: left;
    }
}
