
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: #f4f6f8;
    color: #17202a;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.calculator-wrapper {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.brand {
    font-size: 22px;
    font-weight: 800;
}

.brand span {
    color: #1769e0;
}

.back-link {
    color: #1769e0;
    font-weight: 700;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.calculator-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
    gap: 22px;
    align-items: start;
}

.calculator-grid > main,
.calculator-grid > aside {
    min-width: 0;
}

.card {
    min-width: 0;
    margin-bottom: 20px;
    padding: 24px;
    background: #fff;
    border: 1px solid #e1e6ea;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(26, 40, 56, 0.04);
}

.form-grid,
.operation {
    min-width: 0;
}

.form-group {
    min-width: 0;
}

label {
    min-width: 0;
    overflow-wrap: anywhere;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 8px;
    color: #1769e0;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 7px;
    font-size: 30px;
    line-height: 1.2;
}

h2 {
    margin-bottom: 18px;
    font-size: 18px;
    line-height: 1.25;
}

.page-header p,
.section-heading p,
.series-header p {
    margin-bottom: 0;
    color: #687481;
}

.section {
    margin-top: 26px;
    padding-top: 24px;
    border-top: 1px solid #e6eaee;
}

.section-heading,
.series-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 18px;
}

.section-heading h2,
.series-header h2 {
    margin-bottom: 4px;
}

.form-grid {
    display: grid;
    gap: 14px;
}

.form-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-group {
    margin-bottom: 14px;
}

label {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 18px;
    margin-bottom: 6px;
    color: #344050;
    font-size: 12px;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    background: #fff;
    color: #17202a;
    border: 1px solid #ccd4db;
    border-radius: 9px;
    font: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus {
    border-color: #1769e0;
    box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.1);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    background: #1769e0;
    color: #fff;
}

.button-primary:hover {
    background: #0f5bc9;
}

.button-secondary {
    background: #eef1f4;
    color: #26313d;
}

.button-secondary:hover {
    background: #e1e6eb;
}

.button-danger {
    padding: 8px 11px;
    background: #fff0f0;
    color: #b42318;
}

.operation {
    margin-bottom: 14px;
    padding: 16px;
    background: #fafbfc;
    border: 1px solid #dfe5ea;
    border-radius: 12px;
}

.operation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.operation-title {
    font-size: 15px;
    font-weight: 800;
}

.info {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    border: 1px solid #9ba8b4;
    border-radius: 50%;
    color: #667481;
    font-size: 10px;
    font-weight: 800;
    cursor: help;
}

.info::after {
    content: attr(data-tooltip);
    position: absolute;
    z-index: 1000;
    left: 50%;
    bottom: calc(100% + 9px);
    width: min(250px, calc(100vw - 40px));
    max-width: 250px;
    padding: 10px 12px;
    background: #17202a;
    color: #fff;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    text-align: left;
    white-space: normal;
    overflow-wrap: break-word;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, 4px);
    transition: opacity 0.15s, transform 0.15s;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.18);
}

.info:hover::after,
.info:focus::after {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.helper-note {
    margin-top: 3px;
    padding: 10px 12px;
    background: #f6f8fa;
    border-left: 3px solid #1769e0;
    color: #667481;
    font-size: 12px;
}

.helper-note strong {
    color: #344050;
}

.result-card {
    position: static;
}

.price-box {
    margin-bottom: 15px;
    padding: 20px;
    background: #edf5ff;
    border: 1px solid #d9e9ff;
    border-radius: 13px;
}

.price-label {
    display: block;
    margin-bottom: 3px;
    color: #687481;
    font-size: 12px;
}

.price {
    margin-bottom: 3px;
    color: #1769e0;
    font-size: 36px;
    font-weight: 900;
    line-height: 1.2;
}

.price-description {
    color: #687481;
    font-size: 12px;
}

.result-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 10px 0;
    border-bottom: 1px solid #e4e8ec;
}

.result-line strong {
    white-space: nowrap;
}

.result-line-total {
    font-size: 15px;
    font-weight: 700;
}

.result-line-main {
    margin-top: 5px;
    border-bottom: 0;
    color: #1769e0;
    font-size: 17px;
    font-weight: 800;
}

.result-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 18px;
}

.notice {
    margin-top: 16px;
    padding: 12px;
    background: #fff8e7;
    border: 1px solid #efd891;
    border-radius: 9px;
    color: #67541d;
    font-size: 12px;
}

.series-card {
    overflow: visible;
}

.series-header {
    align-items: center;
}

.series-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.series-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid #e5e9ed;
    border-radius: 9px;
    background: #fff;
}

.series-row.current {
    background: #edf5ff;
    border-color: #bcd8ff;
}

.series-quantity {
    font-weight: 700;
}

.series-price {
    color: #1769e0;
    font-weight: 800;
    text-align: right;
}

.series-row.current .series-quantity::after {
    content: " AKTUALNA";
    margin-left: 6px;
    color: #1769e0;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.series-explanation {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 14px;
    padding-top: 13px;
    border-top: 1px solid #e6eaee;
    color: #687481;
    font-size: 11px;
}

.series-explanation strong {
    color: #344050;
    font-size: 12px;
}

/* Tooltip przy ikonie po prawej stronie nagłówka */

.series-header > .info::after {
    left: auto;
    right: 0;
    transform: translate(0, 4px);
}

.series-header > .info:hover::after,
.series-header > .info:focus::after {
    transform: translate(0, 0);
}

/* TABLET */

@media (max-width: 900px) {
    .calculator-grid {
        grid-template-columns: 1fr;
    }
}

/* SMARTFONY I MAŁE TABLETY */

@media (max-width: 700px) {

    .calculator-wrapper {
        padding: 16px 12px 30px;
    }

    .topbar {
        align-items: center;
        flex-direction: row;
        gap: 10px;
        margin-bottom: 16px;
    }

    .brand {
        font-size: 20px;
    }

    .calculator-grid {
        gap: 12px;
    }

    .card {
        margin-bottom: 12px;
        padding: 15px;
        border-radius: 13px;
    }

    h1 {
        margin-bottom: 5px;
        font-size: 24px;
    }

    h2 {
        margin-bottom: 12px;
        font-size: 16px;
    }

    .eyebrow {
        margin-bottom: 5px;
        font-size: 10px;
    }

    .page-header p,
    .section-heading p,
    .series-header p {
        font-size: 12px;
        line-height: 1.4;
    }

    .section {
        margin-top: 17px;
        padding-top: 15px;
    }

    .section-heading,
    .series-header {
        gap: 10px;
        margin-bottom: 11px;
    }

    .section-heading h2,
    .series-header h2 {
        margin-bottom: 3px;
    }

    .form-grid {
        gap: 8px;
    }

    .form-grid-2,
    .form-grid-3 {
        grid-template-columns: 1fr;
    }

    .form-group {
        margin-bottom: 8px;
    }

    label {
        min-height: 16px;
        margin-bottom: 4px;
        font-size: 11px;
    }

    input,
    select {
        min-height: 40px;
        padding: 8px 10px;
        border-radius: 8px;
        font-size: 14px;
    }

    .operation {
        margin-bottom: 9px;
        padding: 11px;
        border-radius: 10px;
    }

    .operation-header {
        gap: 8px;
        margin-bottom: 9px;
    }

    .operation-title {
        font-size: 14px;
    }

    .button {
        min-height: 40px;
        padding: 9px 12px;
        font-size: 13px;
    }

    .button-danger {
        padding: 7px 10px;
    }

    .helper-note {
        margin-top: 2px;
        padding: 8px 10px;
        font-size: 11px;
    }

    .price-box {
        margin-bottom: 10px;
        padding: 15px;
        border-radius: 11px;
    }

    .price {
        font-size: 30px;
    }

    .result-line {
        gap: 10px;
        padding: 8px 0;
        font-size: 13px;
    }

    .result-line-total {
        font-size: 14px;
    }

    .result-line-main {
        font-size: 16px;
    }

    .result-actions {
        gap: 7px;
        margin-top: 12px;
    }

    .notice {
        margin-top: 11px;
        padding: 9px;
        font-size: 11px;
    }

    .series-list {
        gap: 5px;
    }

    .series-row {
        min-height: 38px;
        padding: 7px 9px;
        gap: 8px;
        font-size: 12px;
    }

    .series-explanation {
        gap: 2px;
        margin-top: 10px;
        padding-top: 10px;
    }

    .info::after {
        left: auto;
        right: -8px;
        transform: translate(0, 4px);
    }

    .info:hover::after,
    .info:focus::after {
        transform: translate(0, 0);
    }
}

/* BARDZO MAŁE TELEFONY */

@media (max-width: 480px) {

    .calculator-wrapper {
        padding: 13px 10px 24px;
    }

    .card {
        padding: 13px;
    }

    .topbar {
        margin-bottom: 13px;
    }

    .brand {
        font-size: 18px;
    }

    .back-link {
        font-size: 12px;
    }

    h1 {
        font-size: 22px;
    }

    .section {
        margin-top: 15px;
        padding-top: 13px;
    }

    .form-grid {
        gap: 6px;
    }

    .form-group {
        margin-bottom: 7px;
    }

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

    .series-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }
}

/* DRUKOWANIE */

@media print {

    body {
        background: #fff;
    }

    .no-print,
    .topbar,
    .info {
        display: none !important;
    }

    .calculator-wrapper {
        max-width: none;
        padding: 0;
    }

    .calculator-grid {
        display: block;
    }

    .card {
        border: 0;
        box-shadow: none;
    }

    .result-card {
        position: static;
    }
}
