:root { color-scheme: light; --ink: #17263b; --muted: #5d6b7d; --line: #dce3e8; --blue: #245779; --light: #f4f7f9; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--light); color: var(--ink); font: 16px/1.5 system-ui, sans-serif; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; }
.site-header { display: flex; align-items: center; gap: 2rem; min-height: 4.5rem; padding: .8rem max(1.5rem, calc((100vw - 72rem)/2)); background: #fff; border-bottom: 1px solid var(--line); }
.site-header .brand { color: var(--ink); font-size: 1.35rem; font-weight: 750; text-decoration: none; }
.site-header nav { display: flex; flex: 1; flex-wrap: wrap; gap: 1.3rem; }
.site-header nav a { text-decoration: none; font-weight: 550; }
.site-header form { margin: 0; }
.nav-logout { background: none; border: 0; color: var(--blue); cursor: pointer; }
.page-content { width: min(72rem, calc(100% - 2rem)); margin: 2.5rem auto 5rem; }
.page-heading { margin-bottom: 1.7rem; }
.page-heading h1 { margin: .1rem 0 .35rem; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.15; }
.page-heading p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--blue) !important; text-transform: uppercase; letter-spacing: .13em; font-size: .76rem; font-weight: 800; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; }
.action-card, .panel { background: #fff; border: 1px solid var(--line); border-radius: .7rem; box-shadow: 0 5px 18px #21374b0b; }
.action-card { display: grid; gap: .35rem; min-height: 12rem; padding: 1.5rem; color: var(--ink); text-decoration: none; }
.action-card:hover { border-color: var(--blue); }
.action-card strong { font-size: 1.25rem; }
.action-card span:last-child { color: var(--muted); }
.action-icon { font-size: 1.6rem; color: var(--blue); }
.panel { padding: 1.5rem; }
.narrow-panel { max-width: 28rem; margin: 5rem auto; }
.panel h1 { margin-top: 0; }
.panel p { margin: 1rem 0; }
.panel label { display: block; font-weight: 650; margin-bottom: .3rem; }
.panel input, .panel select, .panel textarea { display: block; width: 100%; padding: .65rem .75rem; border: 1px solid #acb8c4; border-radius: .4rem; background: #fff; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .7rem 1.1rem; border: 1px solid var(--blue); border-radius: .4rem; background: #fff; color: var(--blue); text-decoration: none; font-weight: 650; cursor: pointer; }
.button.primary { background: var(--blue); color: #fff; }
.button.danger { border-color: #a32626; color: #a32626; }
.button.danger:hover { background: #fff4f4; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
.error-box { padding: .8rem 1rem; border: 1px solid #b83b3b; border-radius: .4rem; background: #fff4f4; color: #9a2323; }
.success-box { padding: .8rem 1rem; border: 1px solid #4d9667; border-radius: .4rem; background: #effaf2; color: #20603d; }
.customer-page-form { margin: 0; max-width: 42rem; }
.issuer-page-form { max-width: 42rem; }
.customer-dialog { width: min(34rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 1.5rem; border: 1px solid var(--line); border-radius: .7rem; box-shadow: 0 18px 60px #17263b50; }
.customer-dialog::backdrop { background: #17263b99; }
.customer-dialog .inline-customer-form { border: 0; padding: 0; box-shadow: none; }
.customer-dialog .inline-customer-form h2 { font-size: 1.35rem; letter-spacing: normal; text-transform: none; }
.customer-dialog .inline-customer-form form { display: flex; flex-wrap: wrap; gap: .6rem; }
.customer-dialog .inline-customer-form form p { flex: 0 0 100%; margin: 0; }
.table-panel { overflow-x: auto; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 1rem; margin-bottom: 1.2rem; }
.filter-bar > div { flex: 1 1 13rem; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.5rem; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.summary-card { display: grid; gap: .25rem; text-decoration: none; color: var(--ink); }
.summary-card strong { font-size: 2.5rem; line-height: 1.2; }
.summary-card span:last-child { color: var(--muted); font-size: .9rem; }
.recent-invoices { margin-top: 2rem; }
.status-badge { display: inline-block; padding: .2rem .65rem; border-radius: 1rem; font-size: .85rem; white-space: nowrap; }
.status-badge.draft { background: #fff1d6; color: #7a4d00; }
.status-badge.issued { background: #e6f4ed; color: #20583c; }
.notice-box { padding: 1rem; margin-bottom: 1.5rem; background: #fff7e8; border: 1px solid #d6ae64; border-radius: .5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid #4386b3; outline-offset: 3px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .8rem; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
@media (max-width: 48rem) { .site-header { align-items: flex-start; flex-wrap: wrap; gap: .7rem; } .site-header nav { order: 3; flex-basis: 100%; } }
.toolbar { display: flex; flex-wrap: wrap; gap: .7rem; margin: 0 0 1.2rem; }
.invoice-paper { width: min(100%, 210mm); min-height: 297mm; margin: auto; padding: 18mm; background: #fff; box-shadow: 0 8px 30px #192c4130; color: #17212d; }
.invoice-paper h1 { margin: 0; font-size: 1.9rem; }
.invoice-paper h2 { margin: 0 0 .5rem; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.invoice-paper p { margin: .4rem 0; }
.invoice-top, .invoice-section, .invoice-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.invoice-top { min-height: 9rem; border-bottom: 1px solid var(--line); }
.invoice-top > :last-child { text-align: right; }
.invoice-name { color: var(--muted); }
.invoice-section { padding: 1.6rem 0; }
.date-list { align-self: end; }
.date-list p { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); }
.date-list span { color: var(--muted); }
.invoice-items { overflow-x: auto; margin: 1rem 0 2rem; }
.invoice-items th { color: #fff; background: #284f68; }
.invoice-items th, .invoice-items td { padding: .7rem .55rem; }
.invoice-items td:last-child, .invoice-items th:last-child { text-align: right; }
.invoice-items small { color: var(--muted); }
.invoice-bottom { border-top: 1px solid var(--line); padding-top: 1rem; }
.invoice-total { display: grid; justify-items: end; align-content: start; gap: .3rem; }
.invoice-total span { color: var(--muted); }
.invoice-total strong { font-size: 1.45rem; }
.invoice-vat-note { margin-top: 2rem !important; color: var(--muted); font-size: .85rem; }
@media (max-width: 40rem) { .invoice-paper { padding: 1.2rem; min-height: auto; } .invoice-top, .invoice-section, .invoice-bottom { grid-template-columns: 1fr; gap: 1rem; } .invoice-top > :last-child { text-align: left; } }
.invoice-editor .invoice-top > :last-child { text-align: left; }
.invoice-editor .invoice-section { align-items: start; }
.paper-field { margin: .6rem 0; }
.paper-field label { display: block; margin-bottom: .2rem; color: var(--muted); font-size: .78rem; font-weight: 700; }
.paper-field input, .paper-field select, .paper-field textarea { display: block; width: 100%; padding: .45rem .55rem; border: 1px solid #bac7d0; border-radius: .25rem; background: #fbfdff; color: var(--ink); }
.paper-field textarea { min-height: 3.5rem; resize: vertical; }
.paper-field .errorlist { margin: .25rem 0; padding-left: 1rem; color: #a32626; }
.item-fields { display: grid; grid-template-columns: minmax(10rem, 3fr) repeat(3, minmax(5rem, 1fr)); gap: .5rem; border-bottom: 1px solid var(--line); padding: .6rem 0; }
.item-description { grid-column: 1 / -1; }
.item-fields > .paper-field { align-self: end; }
.paper-field input[type="checkbox"] { width: auto; margin: .4rem 0; accent-color: var(--blue); }
.paper-field input:focus, .paper-field select:focus, .paper-field textarea:focus { outline: 2px solid #4386b3; outline-offset: -2px; }
.item-marked-delete { background: #fff4f4; }
.item-marked-delete input:disabled, .item-marked-delete select:disabled, .item-marked-delete textarea:disabled { opacity: .55; }
@media (max-width: 48rem) { .item-fields { grid-template-columns: 1fr 1fr; } .item-name { grid-column: 1 / -1; } }

/* Pravidlo .button nesmí přebít skrytí ovládacích prvků atributem hidden. */
[hidden] { display: none !important; }

/* Stejná výška ovládacích prvků i v prohlížečích s nativním vzhledem selectu. */
.paper-field input:not([type="checkbox"]):not([type="hidden"]), .paper-field select { height: 2.7rem; }
.paper-field select { appearance: none; padding-right: 1.7rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23245779' stroke-width='2'/%3E%3C/svg%3E"); background-position: right .5rem center; background-repeat: no-repeat; }
.invoice-bottom > section { min-width: 0; }
.payment-summary { padding: .7rem; border: 1px solid var(--line); border-radius: .3rem; overflow-wrap: anywhere; }
#manual-payment { margin: .8rem 0; }
#manual-payment summary { cursor: pointer; color: var(--blue); font-size: .9rem; }
.date-control { display: flex; align-items: stretch; gap: .3rem; }
.date-control input { min-width: 0; }
.calendar-toggle { padding: .4rem .65rem; }
.date-calendar { width: min(23rem, calc(100vw - 2rem)); padding: 1rem; border: 1px solid var(--line); border-radius: .7rem; color: var(--ink); box-shadow: 0 18px 60px #17263b50; }
.date-calendar::backdrop { background: #17263b66; }
.calendar-header, .calendar-footer { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.calendar-header .button { padding: .4rem .7rem; }
.calendar-weekdays, .calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: .2rem; text-align: center; }
.calendar-weekdays { margin: 1rem 0 .4rem; color: var(--muted); }
.calendar-day { min-height: 2.5rem; border: 1px solid transparent; border-radius: .3rem; background: white; color: var(--ink); cursor: pointer; }
.calendar-day:hover, .calendar-day:focus-visible { background: #eaf2f8; }
.calendar-day[aria-current="date"] { border-color: var(--blue); }
.calendar-day[aria-pressed="true"] { background: var(--blue); color: white; }
.calendar-footer { margin-top: 1rem; }
