:root {
    --color-background: oklch(98.5% 0.002 247.839);
    --color-background-light: oklch(96.7% 0.003 264.542);
    --color-background-input: #f8fbff;
    --color-background-gradient-start: #eaf3fa;
    --color-background-gradient-end: #dbeaf6;
    --color-background-input: #f8fbff;
    --color-background-cell: #efefef;
    --color-background-modal: #fff;
    --color-background-modal-overlay: rgba(0, 0, 0, 0.4);
    --color-background-hover: #f0f0f0;

    --color-primary: #001bb6;
    --color-primary-light: #eaf3fa;

    --color-border: #dfdfdf;
    --color-border-ui: #ccc;
    --color-border-search-result: #eee;

    --color-text: #222;
    --color-text-header: #1a1a1a;
    --color-text-secondary: #666;
    --color-text-placeholder: #aaa;
    --color-text-link: #001bb6;
    --color-text-white: #fff;

    --color-button-bg: #001bb6;
    --color-button-text: #fff;
}

* {
    box-sizing: border-box;
}

html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
    display: block;
}

body {
    line-height: 1;
}

ol,
ul {
    list-style: none;
}

blockquote,
q {
    quotes: none;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
    content: "";
    content: none;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

html,
body,
input {
    font-family: Arial, Helvetica, sans-serif;
}

html,
body {
    height: 100%;
    width: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--color-background);
}

b,
strong {
    font-weight: bold;
}

.accent-font {
    font-family: "Funnel Sans", sans-serif;
    font-optical-sizing: auto;
}

h1 {
    font-size: 2.4rem;
    font-weight: 500;
    margin-bottom: 1rem;
    font-family: "Funnel Sans", sans-serif;
    font-optical-sizing: auto;
}

h2 {
    font-size: 2rem;
    font-weight: 500;
    margin-bottom: 1rem;
    margin-top: 1.5rem;
    font-family: "Funnel Sans", sans-serif;
    font-optical-sizing: auto;
}

h3 {
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    margin-top: 1rem;
    font-family: "Funnel Sans", sans-serif;
    font-optical-sizing: auto;
}

p {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--color-text);
    line-height: 1.25;
}

span {
    font-size: 1rem;
    color: var(--color-text);
}

ul.list {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    list-style: disc;
}

ol.list li,
ul.list li {
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.header {
    background: var(--color-background-light);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    position: sticky;
    inset: 0;
    z-index: 100;
}

.header h1 {
    margin: 0;
    font-size: 2rem;
    color: var(--color-text-header);
}

div#ausgaben {
    margin-top: 20px;
    padding: 1rem;
    width: 100%;
    margin-bottom: 5rem;
}

.row {
    margin: 5px 0 8px 0;
    display: flex;
    width: 100%;
    border: 1px solid var(--color-border);
}

.row-wrap {
    flex-wrap: wrap;
}

.cell {
    display: inline-block;
    padding: 1em;
    box-sizing: border-box;
    border-right: 1px solid var(--color-border);
    background-color: var(--color-background-light);
    cursor: pointer;
    min-width: 10%;
    flex-grow: 1;
    position: relative;
    text-decoration: none;
}

.hidden-link {
    text-decoration: none;
    color: inherit;
}

.row.row-wrap .cell {
    border-bottom: 1px solid var(--color-border);
}

.row:not(.row-wrap) .cell:last-child {
    border-right: none;
}

.row-wrap {
    border-bottom: none;
    border-right: none;
}

.cell-amount {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--color-text);
    margin: 0;
    line-height: 1.2;
    font-family: "Funnel Sans", sans-serif;
}

.cell-example-star {
    color: #888888;
    position: absolute;
    top: 5px;
    font-size: 1.2rem;
    right: 5px;
}

.cell-selected {
    background-color: var(--color-primary-light);
}

.name-span {
    display: block;
    margin-top: 5px;
    font-size: 0.9em;
    color: var(--color-text);
    word-break: break-word;
    hyphens: auto;
    line-height: 1.15;
}

.tax-input {
    padding: 10px;
    font-size: 1em;
    width: 100%;
    max-width: 300px;
    border: 1px solid var(--color-border);
    border-radius: 5px;
    background: var(--color-background-input);
    color: var(--color-text);
    transition:
        border-color 0.1s,
        box-shadow 0.2s;
    -moz-appearance: none;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    box-shadow: none;
}

.tax-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px #eaf3fa;
}

.tax-input::placeholder {
    color: #aaa;
    opacity: 1;
}

.highlight {
    outline: 4px solid var(--color-primary);
    outline-offset: 4px;
    box-shadow:
        0 0 0 6px #eaf3fa,
        0 0 16px 4px var(--color-primary);
    transition:
        outline-color 0.2s,
        box-shadow 0.2s;
    z-index: 10;
}

/* Hide number input spinners for Chrome, Safari, Edge, Opera */
.tax-input::-webkit-outer-spin-button,
.tax-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Hide number input spinners for Firefox */
.tax-input[type="number"] {
    -moz-appearance: textfield;
}

/* Style dropdown (select) with .tax-input */
.tax-input[type="select"],
select.tax-input {
    background: var(--color-background-input)
        url("data:image/svg+xml;utf8,<svg fill='gray' height='16' viewBox='0 0 20 20' width='16' xmlns='http://www.w3.org/2000/svg'><path d='M7 7l3 3 3-3' stroke='gray' stroke-width='2' fill='none' stroke-linecap='round'/></svg>")
        no-repeat center right 0.75em/1.2em 1.2em;
    padding-right: 2.5em;
    cursor: pointer;
    font-family: Arial, Helvetica, sans-serif;
}

select.tax-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px #eaf3fa;
}

select.tax-input option {
    background: #fff;
    color: var(--color-text);
    font-family: Arial, Helvetica, sans-serif !important;
}

.tax-input-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
}

.tax-form-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    padding: 1rem 1rem;
    margin: 1rem 2rem;
    border-radius: 8px;
    justify-content: space-between;
    background: linear-gradient(135deg, #eaf3fa 0%, #dbeaf6 100%);
}
.select-view-container {
    display: flex;
    align-items: center;
    margin-top: 2rem;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.cta {
    margin: 2rem 0;
    padding: 1rem;
    background: linear-gradient(135deg, #eaf3fa 0%, #dbeaf6 100%);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
}

.cta p {
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 1rem;
    align-self: flex-start;
    font-family: "Funnel Sans", sans-serif;
}

.tax-inputs-container {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.tax-label {
    font-weight: 500;
    display: block;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}

.calc-button {
    background-color: var(--color-primary);
    color: var(--color-text-white);
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2rem;
    align-self: center;
    font-weight: 500;
    text-decoration: none;
}

.cta-button {
    background-color: var(--color-primary);
    color: var(--color-text-white);
    padding: 12px 18px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 500;
    text-decoration: none;
    flex: none;
    font-family: "Funnel Sans", sans-serif;
}

.help-button {
    font-family: Arial, Helvetica, sans-serif;
    background: transparent;
    margin-top: 0.5rem;
    color: var(--color-primary);
    padding: 0;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: underline;
}

.header {
    padding: 1rem;
    border-bottom: 1px solid var(--color-border-ui);
}

.header > nav > ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    margin: 0;
    padding: 0;
    font-size: 1rem;
}

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background: var(--color-background-modal-overlay);
}

.modal-content {
    background: var(--color-background-modal);
    margin: 3rem auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 50vw;
    position: relative;
}

.modal-content h2 {
    margin-top: 0;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    cursor: pointer;
}

.header-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    margin: 0;
    font-weight: normal;
    font-family: Arial, Helvetica, sans-serif;
}

.header-btn:hover {
    text-decoration: underline;
}

.view-toggle-btn {
    background: #001bb620;
    border-radius: 5px;
    padding: 0.5rem 1rem;
    border: 0;
    outline: 0;
    cursor: pointer;
    font-size: 1rem;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--color-text);
}

.view-toggle-btn[aria-pressed="true"] {
    background-color: var(--color-primary);
    color: var(--color-text-white);
}

.main {
    flex: 1 1 auto;
    display: flex;
    gap: 1rem;
    flex-direction: row;
    align-items: stretch;
}

.sidebar {
    width: 40rem;
    height: 100%;
    border-left: 1px solid var(--color-border-ui);
    padding: 1rem;
    overflow: auto;
    position: relative;
}

.sidebar-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2.5rem;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 2rem;
    font-weight: lighter;
    color: var(--color-text-secondary);
}

.sidebar h2 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.search-result {
    padding: 0.5rem;
    border-bottom: 1px solid var(--color-border-ui);
    cursor: pointer;
}

.search-result:hover {
    background-color: #f0f0f0;
}

.search-result-name {
    line-height: 1.2;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.search-result-path {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin: 0;
    line-height: 1.2;
}

.search-result-type {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin: 0;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

article.article {
    width: 800px;
    margin: 0 auto;
    padding: 1rem;
    margin-top: 2rem;
}

.footer {
    padding: 2rem 0;
    text-align: center;
    background: var(--color-background-light);
    color: var(--color-text-secondary);
    font-family: Arial, Helvetica, sans-serif;
}

.link-button {
    background: none;
    color: var(--color-text-secondary);
    padding: 0;
    border: none;
    border-radius: 0;
    font-size: 1rem;
    text-decoration: underline;
    cursor: pointer;
    display: inline;
    font-weight: normal;
    font-family: Arial, Helvetica, sans-serif;
}

.explainer {
    display: flex;
    gap: 2rem;
    justify-content: space-between;
    flex-wrap: wrap;
    padding-top: 2rem;
}

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

.explainer-step {
    flex: 1 1 200px;
    min-width: 180px;
    background: #f5f5f5;
    border-radius: 1rem;
    padding: 1.5rem;
}

.explainer .step-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--color-primary);
}

.explainer-step p {
    margin-top: 1rem;
    font-size: 1rem;
    line-height: 1.3;
}

#receipt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1em 2em 6em 2em;
}

.receipt-wrapper {
    background-color: #fff;
    position: relative;
    padding: 2rem;
    box-shadow: 0 0.4rem 1rem 0.4rem rgba(0, 0, 0, 0.11);
    max-width: 44rem;
}

.receipt-wrapper::after {
    background-image: linear-gradient(135deg, #fff 0.5rem, transparent 0), linear-gradient(-135deg, #fff 0.5rem, transparent 0);
    background-position: left-bottom;
    background-repeat: repeat-x;
    background-size: 1rem;
    content: "";
    display: block;
    position: absolute;
    bottom: -1rem;
    left: 0;
    width: 100%;
    height: 1rem;
}

.receipt-table {
    font-size: 1rem;
    font-family: monospace;
    border-collapse: collapse;
}
.receipt-table .receipt-item-name {
    padding-right: 2rem;
}

.receipt-table .receipt-item-amount {
    text-align: right;
}

.receipt-table tr > * {
    padding-bottom: 1rem;
    line-height: 1.2;
}

.receipt-table th {
    font-size: 1.2rem;
    padding-bottom: 2rem !important;
    font-weight: bold;
}

.receipt-table tr.receipt-total {
    border-top: 2px solid var(--color-border);
    font-weight: bold;
    font-size: 1.2rem;
}
.receipt-table tr.receipt-total > .td {
    padding-top: 1rem;
}

.receipt-table tr.receipt-total > td:nth-child(even) {
    text-align: right;
}

.menu-link-wrapper {
    position: relative;
    height: 100%;
}

.menu-link {
    text-decoration: none;
    color: var(--color-text-link);
    font-size: 13pt;
    font-weight: 500;
    font-family: "Funnel Sans", sans-serif;
    height: 100%;
}

.nav-menu-links {
    margin-right: 2rem !important;
}

article {
    color: var(--color-text);
}

article ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    list-style: disc;
}

article ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    list-style: decimal;
}

article li {
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

article hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2rem 0;
}

@media (width < 40rem) {
    html {
        font-size: 14px;
    }
    .receipt-wrapper {
        margin: 1rem;
        padding: 1rem;
        font-size: 0.8rem;
        padding-top: 2rem;
        margin-top: 2rem;
    }

    .receipt-table tr > .receipt-item-name,
    .receipt-table tr > .receipt-item-amount {
        font-size: 0.8rem;
    }

    .modal-content {
        max-width: 90vw;
    }

    .cell {
        width: 100% !important;
        border-width: 0 0 1px 0 !important;
        border-color: var(--color-border) !important;
        border-style: solid !important;
    }

    .row {
        flex-direction: column;
        border-width: 1px 1px 0 1px !important;
        border-color: var(--color-border) !important;
        border-style: solid !important;
    }

    .sidebar {
        position: fixed;
        bottom: 0;
        right: 0;
        top: auto;
        width: 100%;
        height: 50%;
        border-left: none;
        border-top: 1px solid var(--color-border-ui);
        background: var(--color-background);
        z-index: 1000;
        min-width: 0px;
    }

    .row:last-of-type {
        outline: 2px solid var(--color-primary) !important;
    }
}
