:root {
    --app-bg: #eef2f5;
    --card-bg: #ffffff;
    --header-bg: #24c2c7;
    --topbar-bg: #2d42a4;
    --row-even: #dcdcdc;
    --row-odd: #f2f2f2;
    --line-color: #4f4ea1;
    --accent-red: #b11111;
    --button-bg: #e5e5e5;
    --text-dark: #3b3b3b;
    --shadow: 0 16px 40px rgba(19, 31, 78, 0.12);
    --border-radius: 22px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--app-bg);
    color: var(--text-dark);
}

.page-shell {
    min-height: 100%;
    padding: 20px 12px 28px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.mobile-app-card {
    width: min(100%, 430px);
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.mobile-app-card--error {
    padding: 28px 22px;
}

.app-topbar {
    background: var(--topbar-bg);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-topbar__time {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-align: center;
}

.pricing-table__head {
    background: var(--header-bg);
    color: #154650;
    font-weight: 700;
    padding: 9px 8px;
    font-size: clamp(0.92rem, 1.7vw, 1rem);
}

.pricing-table__body {
    width: 100%;
}

.row-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.9fr) minmax(56px, 0.82fr) minmax(54px, 0.78fr) minmax(66px, 0.9fr);
    align-items: center;
    column-gap: 8px;
}

.table-row {
    min-height: 54px;
    padding: 7px 8px;
    font-size: clamp(0.95rem, 1.9vw, 1rem);
}

.table-row:nth-child(odd) {
    background: var(--row-odd);
}

.table-row:nth-child(even) {
    background: var(--row-even);
}

.table-row--accent {
    background: var(--row-even) !important;
}

.cell-title,
.cell-static,
.cell-sum {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cell-title {
    font-size: clamp(0.96rem, 1.95vw, 1.03rem);
}

.cell-input,
.cell-static,
.cell-sum {
    text-align: center;
}

.cell-static {
    color: #5c5c5c;
}

.cell-sum {
    text-align: right;
    padding-right: 2px;
    font-size: clamp(1rem, 2vw, 1.06rem);
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
    padding-right: 2px;
}

.line-input,
.line-select {
    width: 100%;
    min-width: 0;
    border: 0;
    border-bottom: 2px solid var(--line-color);
    background: transparent;
    color: #383f90;
    font-size: clamp(1rem, 2vw, 1.08rem);
    font-weight: 700;
    text-align: center;
    padding: 2px 3px 4px;
    outline: none;
    border-radius: 0;
    appearance: none;
    -webkit-appearance: none;
}

.line-input:focus,
.line-select:focus {
    border-bottom-color: #cc1a69;
}

.line-select--name {
    text-align: left;
    color: #444444;
    font-weight: 400;
    font-size: clamp(0.94rem, 1.85vw, 1rem);
    padding-right: 18px;
    background-image:
        linear-gradient(45deg, transparent 50%, #666666 50%),
        linear-gradient(135deg, #666666 50%, transparent 50%);
    background-position:
        calc(100% - 14px) 50%,
        calc(100% - 8px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.line-input--price,
.line-input--qty {
    max-width: 72px;
}

.line-input--wide {
    max-width: 100px;
}

.installment-section {
    padding: 14px 12px 0;
    background: #f7f7f7;
}

.checkbox-line {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    font-size: 1.02rem;
    color: #222222;
    margin-bottom: 10px;
}

.checkbox-line input[type="checkbox"] {
    width: 24px;
    height: 24px;
    margin: 0;
    accent-color: #e14d7d;
}

.installment-panel {
    display: grid;
    gap: 12px;
    margin-bottom: 10px;
}

.installment-grid {
    display: grid;
    align-items: end;
    gap: 10px;
}

.installment-grid--top {
    grid-template-columns: auto minmax(88px, 1fr) auto auto;
}

.installment-grid--bottom {
    grid-template-columns: auto minmax(42px, 64px) auto;
}

.installment-label {
    font-size: clamp(1rem, 2vw, 1.04rem);
    white-space: nowrap;
}

.installment-label--align-right {
    text-align: right;
}

.installment-input-wrap {
    min-width: 0;
}

.installment-input-wrap--months .line-input {
    max-width: 48px;
}

.installment-value {
    text-align: right;
    font-size: clamp(1rem, 2vw, 1.05rem);
    color: #565656;
}

.total-line {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 12px;
    padding: 0 2px 4px;
}

.total-line__label {
    font-size: clamp(1.12rem, 2.3vw, 1.22rem);
    color: #555555;
}

.total-line__value {
    min-width: 112px;
    text-align: right;
    font-size: clamp(1.6rem, 3.5vw, 1.84rem);
    font-weight: 700;
    color: var(--accent-red);
}

.actions {
    padding: 14px 12px;
    display: grid;
    gap: 12px;
    background: #f5f5f5;
}

.action-button {
    width: 100%;
    border: none;
    border-radius: 6px;
    background: var(--button-bg);
    color: #1e1e1e;
    font-size: clamp(1.05rem, 2.1vw, 1.1rem);
    padding: 16px 14px;
    cursor: pointer;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.05);
}

.action-button:hover {
    background: #dddddd;
}

.action-button--secondary {
    background: #ececec;
}

.action-button--small {
    width: auto;
    min-width: 120px;
    justify-self: center;
    padding: 12px 18px;
}

.app-footer {
    padding: 18px 16px 28px;
    text-align: center;
    background: #f7f7f7;
}

.app-footer__logo {
    display: block;
    width: 112px;
    height: auto;
    margin: 0 auto 10px;
}

.app-footer__tagline {
    color: #4f4ea1;
    font-size: 1.2rem;
    font-style: italic;
    margin-bottom: 12px;
}

.app-footer__caption {
    color: #666666;
    font-size: 0.98rem;
}

.modal,
.toast {
    position: fixed;
    inset: 0;
}

.modal.is-hidden,
.toast.is-hidden,
.installment-panel.is-hidden {
    display: none;
}

.modal {
    z-index: 50;
}

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(14, 18, 35, 0.52);
}

.modal__dialog {
    position: relative;
    z-index: 1;
    width: min(92vw, 360px);
    margin: 16vh auto 0;
    background: #ffffff;
    border-radius: 16px;
    padding: 20px 18px 18px;
    box-shadow: var(--shadow);
    text-align: center;
}

.modal__title {
    margin: 0 0 10px;
    font-size: 1.3rem;
}

.modal__text {
    margin: 0 0 18px;
    line-height: 1.45;
}

.toast {
    inset: auto 50% 24px auto;
    transform: translateX(50%);
    width: min(92vw, 360px);
    background: rgba(39, 47, 80, 0.96);
    color: #ffffff;
    padding: 14px 16px;
    border-radius: 12px;
    z-index: 60;
    box-shadow: var(--shadow);
    font-size: 0.95rem;
}

@media (max-width: 380px) {
    .row-grid {
        grid-template-columns: minmax(0, 1.8fr) minmax(48px, 0.8fr) minmax(46px, 0.7fr) minmax(60px, 0.85fr);
        column-gap: 6px;
    }

    .table-row,
    .pricing-table__head {
        padding-left: 6px;
        padding-right: 6px;
    }

    .installment-grid--top {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .installment-label--align-right,
    .installment-value {
        text-align: left;
    }

    .total-line {
        justify-content: space-between;
    }
}

@media (min-width: 1024px) {
    .page-shell {
        padding-top: 28px;
    }

    .mobile-app-card {
        border-radius: 28px;
    }
}
