:root {
    --bg: #f3f6fb;
    --card: rgba(255, 255, 255, 0.96);
    --text: #172033;
    --muted: #7b8497;
    --primary: #246bfd;
    --primary-dark: #1756d8;
    --border: #e7eaf0;
    --danger: #e94d59;
    --success: #16875d;
    --shadow: 0 10px 35px rgba(30, 45, 80, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    background:
        radial-gradient(circle at top right, #dce9ff, transparent 35%),
        var(--bg);

    color: var(--text);
}

button,
input,
select {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.app {
    width: min(760px, calc(100% - 28px));
    margin: 0 auto;
    padding: 28px 0 60px;
}


/* HEADER */

.header {
    margin-bottom: 20px;
}

.header > div {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    width: 55px;
    height: 55px;
    display: grid;
    place-items: center;

    border-radius: 17px;
    font-size: 28px;

    background: white;
    box-shadow: var(--shadow);
}

.header h1 {
    margin: 0;
    font-size: 30px;
}

.header p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 14px;
}


/* CARDS */

.object-card,
.utility-card,
.result,
.history-item {
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow);
    border-radius: 22px;
}

.object-card {
    padding: 18px;
}

.section-title {
    margin-bottom: 12px;
}

.section-title span {
    display: block;
    font-weight: 750;
    font-size: 17px;
}

.section-title small {
    display: block;
    color: var(--muted);
    margin-top: 3px;
}


/* SELECT */

select {
    width: 100%;
    height: 50px;
    padding: 0 14px;

    background: #f8f9fc;
    color: var(--text);

    border: 1px solid var(--border);
    border-radius: 13px;

    outline: none;
    font-weight: 650;
}

.object-actions {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    margin-top: 10px;
}


/* BUTTONS */

.btn {
    min-height: 44px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
}

.secondary {
    background: #eef3ff;
    color: #2458c6;
}

.danger-light {
    padding: 0 16px;
    background: #fff0f1;
    color: var(--danger);
}


/* TABS */

.tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;

    padding: 5px;
    margin: 18px 0;

    background: #e8ecf4;
    border-radius: 15px;
}

.tab {
    border: 0;
    border-radius: 11px;
    padding: 12px;

    color: #687184;
    background: transparent;

    cursor: pointer;
    font-weight: 700;
}

.tab.active {
    color: var(--text);
    background: white;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.07);
}


/* PAGE */

.page {
    display: none;
}

.page.active {
    display: block;
}


/* INFO */

.info-box {
    padding: 14px 16px;
    margin-bottom: 14px;

    border-radius: 14px;

    color: #31517f;
    background: #eaf2ff;

    line-height: 1.45;
    font-size: 14px;
}


/* UTILITIES */

.utility-card {
    padding: 19px;
    margin-bottom: 13px;
}

.utility-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 17px;
}

.utility-icon {
    width: 44px;
    height: 44px;

    display: grid;
    place-items: center;

    border-radius: 14px;
    background: #f2f5fb;

    font-size: 22px;
}

.utility-header h2 {
    margin: 0;
    font-size: 17px;
}

.utility-header p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 13px;
}


/* INPUTS */

.inputs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.inputs.two {
    grid-template-columns: 2fr 1fr;
}

label {
    color: #687184;
    font-size: 12px;
    font-weight: 650;
}

input {
    width: 100%;
    height: 48px;

    margin-top: 6px;
    padding: 0 12px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: #fafbfc;
    color: var(--text);

    outline: none;

    transition: 0.2s;
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(36, 107, 253, 0.1);
    background: white;
}


/* PREVIEW */

.preview {
    min-height: 18px;
    margin-top: 12px;

    color: var(--muted);
    font-size: 13px;
}


/* CALCULATE */

.calculate-btn {
    width: 100%;
    min-height: 57px;

    margin: 5px 0 15px;

    border: 0;
    border-radius: 17px;

    color: white;
    background: linear-gradient(
        135deg,
        var(--primary),
        #5b8dff
    );

    box-shadow: 0 10px 25px rgba(36, 107, 253, 0.25);

    font-weight: 750;
    font-size: 17px;

    cursor: pointer;
}

.calculate-btn:active {
    transform: scale(0.99);
}


/* RESULT */

.result {
    padding: 21px;
}

.result.hidden {
    display: none;
}

.result-title {
    color: var(--muted);
    font-size: 13px;
}

.result-total {
    margin: 5px 0 18px;

    font-size: 34px;
    font-weight: 800;
}

.result-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;

    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.result-row:last-child {
    border-bottom: 0;
}

.result-row span:last-child {
    font-weight: 700;
}


/* HISTORY */

.history-top h2 {
    margin-bottom: 3px;
}

.history-top p {
    margin-top: 0;
    color: var(--muted);
}

.history-item {
    padding: 18px;
    margin-bottom: 12px;
}

.history-date {
    color: var(--muted);
    font-size: 13px;
}

.history-total {
    margin: 7px 0 13px;

    font-size: 24px;
    font-weight: 800;
}

.history-details {
    color: #586174;
    font-size: 14px;
}

.history-line {
    display: flex;
    justify-content: space-between;

    padding: 6px 0;
}

.history-actions {
    margin-top: 13px;
    padding-top: 12px;

    border-top: 1px solid var(--border);
}

.delete-record {
    border: 0;
    background: transparent;
    color: var(--danger);

    cursor: pointer;
}

.empty {
    padding: 45px 20px;

    text-align: center;
    color: var(--muted);

    background: white;
    border-radius: 20px;
}

.clear-history {
    width: 100%;

    margin-top: 8px;
    padding: 13px;

    border: 0;
    border-radius: 13px;

    background: #fff0f1;
    color: var(--danger);

    cursor: pointer;
}


/* TOAST */

.toast {
    position: fixed;
    left: 50%;
    bottom: 25px;

    transform: translate(-50%, 30px);

    padding: 12px 18px;

    border-radius: 100px;

    color: white;
    background: #172033;

    box-shadow: var(--shadow);

    opacity: 0;
    pointer-events: none;

    transition: 0.25s;

    font-size: 14px;

    z-index: 100;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}


/* MOBILE */

@media (max-width: 600px) {

    .app {
        width: min(100% - 20px, 760px);
        padding-top: 18px;
    }

    .header h1 {
        font-size: 25px;
    }

    .header p {
        font-size: 12px;
    }

    .inputs {
        grid-template-columns: 1fr;
    }

    .inputs.two {
        grid-template-columns: 1fr;
    }

    .object-actions {
        grid-template-columns: 1fr 1fr auto;
    }

    .utility-card {
        padding: 16px;
        border-radius: 18px;
    }

    input {
        font-size: 16px;
    }

}