:root {
    --red: #e3000f;
    --red-hover: #ff1a28;
    --black: #000000;
    --white: #ffffff;
    --muted: #b5b5b5;
    --field: #141414;
    --line: #2c2c2c;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background: var(--black);
    color: var(--white);
    font-family: "Roboto Condensed", sans-serif;
    font-size: 18px;
}

.accent {
    height: 6px;
    background: var(--red);
}

.shell {
    width: min(440px, calc(100% - 32px));
    margin: 0 auto;
    padding: 48px 0 64px;
}

.shell.is-wide {
    width: min(960px, calc(100% - 32px));
}

.brand {
    text-align: center;
    margin-bottom: 36px;
}

.logo {
    width: 220px;
    height: auto;
}

.kicker {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 15px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1 {
    margin: 6px 0 0;
    font-family: "Bebas Neue", sans-serif;
    font-size: 54px;
    font-weight: 400;
    letter-spacing: 0.04em;
    line-height: 0.95;
}

.panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.panel[hidden] {
    display: none !important;
}

form,
.actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--muted);
    font-size: 14px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--field);
    color: var(--white);
    font: 400 18px "Roboto Condensed", sans-serif;
}

input:focus {
    outline: none;
    border-color: var(--red);
}

button {
    border: 0;
    border-radius: 4px;
    padding: 12px 32px;
    background: var(--red);
    color: var(--white);
    font: 700 20px "Roboto Condensed", sans-serif;
    letter-spacing: 0.02em;
    cursor: pointer;
}

button:hover {
    background: var(--red-hover);
}

button:disabled {
    opacity: 0.7;
    cursor: wait;
}

.actions button {
    min-height: 64px;
}

.error {
    margin: 0;
    color: var(--red);
    font-size: 16px;
    letter-spacing: 0;
    text-transform: none;
}

.session {
    margin: 0;
    text-align: center;
    color: var(--muted);
}

.session strong {
    color: var(--white);
    font-weight: 700;
}

.logout {
    align-self: center;
    margin-top: 8px;
    padding: 8px 16px;
    background: transparent;
    color: var(--muted);
    font-size: 16px;
    font-weight: 400;
}

.logout:hover,
.ghost:hover {
    background: transparent;
    color: var(--white);
}

.ghost {
    align-self: center;
    padding: 8px 16px;
    background: transparent;
    color: var(--muted);
    font-size: 16px;
    font-weight: 400;
}

#listScreen {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#listScreen[hidden],
#menuScreen[hidden] {
    display: none !important;
}

#invoiceList {
    overflow-x: auto;
}

.list-tools {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.month-label {
    width: 180px;
}

.status {
    min-height: 1.2em;
    margin: 0;
    color: var(--muted);
    text-align: center;
}

.status.is-error {
    color: var(--red);
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
}

.invoice-table th,
.invoice-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.invoice-table th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.invoice-table td:nth-child(n + 2),
.invoice-table th:nth-child(n + 2) {
    text-align: right;
    white-space: nowrap;
}

.invoice-table tbody tr {
    position: relative;
}

.invoice-table tbody tr:hover td {
    background: #141414;
}

.invoice-table tbody tr.invoice-row--purchase td {
    background: rgba(227, 0, 15, 0.22);
}

.invoice-table tbody tr.invoice-row--sale td {
    background: rgba(46, 168, 79, 0.24);
}

.invoice-table tbody tr.invoice-row--purchase:hover td {
    background: rgba(227, 0, 15, 0.36);
}

.invoice-table tbody tr.invoice-row--sale:hover td {
    background: rgba(46, 168, 79, 0.38);
}

.invoice-row-link {
    color: var(--white);
    font-weight: 700;
    text-decoration: none;
}

.invoice-row-link::after {
    content: "";
    position: absolute;
    inset: 0;
}

.invoice-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 24px 16px;
    overflow: auto;
    background: rgba(0, 0, 0, 0.72);
}

.invoice-overlay[hidden] {
    display: none !important;
}

.invoice-paper {
    width: min(860px, 100%);
    padding: 22px 22px 28px;
    background: var(--white);
    color: #1a1a1a;
    font-size: 16px;
}

.invoice-paper h2 {
    margin: 0 0 8px;
    font-family: "Bebas Neue", sans-serif;
    font-size: 40px;
    font-weight: 400;
    letter-spacing: 0.03em;
}

.invoice-paper p {
    margin: 0 0 6px;
}

.invoice-close {
    float: right;
}

.notice-paper {
    width: min(460px, 100%);
}

.notice-text {
    clear: both;
    margin: 8px 0 0;
    font-size: 22px;
    line-height: 1.35;
}

.invoice-parties {
    display: flex;
    gap: 24px;
    margin: 16px 0;
}

.invoice-party {
    flex: 1;
}

.invoice-party strong {
    display: block;
    margin-bottom: 4px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.invoice-lines {
    width: 100%;
    border-collapse: collapse;
}

.invoice-lines th,
.invoice-lines td {
    padding: 6px;
    border: 1px solid #d7d7d7;
    text-align: left;
    vertical-align: top;
}

.invoice-lines th {
    background: #f4f4f4;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.invoice-totals {
    margin-top: 14px;
    font-weight: 700;
    text-align: right;
}

@media (max-width: 700px) {
    .invoice-parties {
        flex-direction: column;
        gap: 12px;
    }
}

@media (max-width: 450px) {
    .invoice-overlay {
        padding: 8px;
    }

    .invoice-paper {
        width: 100%;
        max-width: 100%;
        padding: 12px 10px 16px;
        font-size: 15px;
        overflow-wrap: anywhere;
    }

    .invoice-paper h2 {
        font-size: 28px;
        line-height: 1;
    }

    .invoice-close {
        float: none;
        display: block;
        width: 100%;
        margin: 0 0 12px;
    }

    .invoice-lines,
    .invoice-lines tr,
    .invoice-lines td {
        display: block;
        width: 100%;
        max-width: 100%;
    }

    .invoice-lines tr:first-child {
        display: none;
    }

    .invoice-lines tr {
        margin: 0 0 10px;
        border: 1px solid #d7d7d7;
    }

    .invoice-lines td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 12px;
        border: 0;
        border-bottom: 1px solid #eeeeee;
        padding: 6px 8px;
    }

    .invoice-lines td:first-child {
        display: block;
        background: #f4f4f4;
        font-weight: 700;
    }

    .invoice-lines td::before {
        flex: 0 0 auto;
        color: #666666;
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .invoice-lines td:nth-child(2)::before {
        content: "Ilość";
    }

    .invoice-lines td:nth-child(3)::before {
        content: "J.m.";
    }

    .invoice-lines td:nth-child(4)::before {
        content: "Cena netto";
    }

    .invoice-lines td:nth-child(5)::before {
        content: "Wartość netto";
    }

    .invoice-lines td:nth-child(6)::before {
        content: "VAT";
    }

    .invoice-totals {
        text-align: left;
    }
}
