@font-face {
    font-family: 'Civil Premium';
    src: url('../fonts/Civil Premium Regular.woff2') format('woff2'),
         url('../fonts/Civil Premium Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Civil Premium';
    src: url('../fonts/Civil Premium Medium.woff2') format('woff2'),
         url('../fonts/Civil Premium Medium.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Civil Premium';
    src: url('../fonts/Civil Premium Bold.woff2') format('woff2'),
         url('../fonts/Civil Premium Bold.woff') format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --color-primary: #00b199;
    --color-primary-dark: #009980;
    --color-primary-light: #cef9f5;
    --color-bg: #f9f9f6;
    --color-surface: #ffffff;
    --color-text: var(--color-primary);

    --color-border: #e0e0e0;
    --color-warning: #f39c12;
    --color-error: #dc3545;
    --color-success: #27ae60;

    --nav-height: 5rem;
    --border-radius: 4px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --color-primary-mid: #e0f7f4;
    --content-padding: 4rem;
}

@media screen and (orientation: portrait) {
    :root {
        --content-padding: 2rem;
    }
}

* {
    --scrollbarBG: var(--color-bg);
    --thumbBG: var(--color-primary);
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Civil Premium', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.3;
    scrollbar-width: thin;
    scrollbar-color: var(--thumbBG) var(--scrollbarBG);
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: var(--scrollbarBG);
}

*::-webkit-scrollbar-thumb {
    background-color: var(--thumbBG);
    border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
    background-color: color-mix(in srgb, var(--thumbBG), black 15%);
}

html, body {
    min-height: 100% !important;
    height: 100%;
    width: 100%;
    overflow: auto;
}

body {
    background: var(--color-bg);
    color: var(--color-text);
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    color: var(--color-primary-dark);
}

.hidden {
    display: none !important;
}

/* Nav */
nav {
    position: absolute;
    display: block;
    top: 0;
    width: 100%;
    height: var(--nav-height);
    background-color: var(--color-primary);
    box-shadow: var(--shadow-md);
    z-index: 20;
}

.logo {
    position: absolute;
    top: 0.5rem;
    z-index: 10;
    left: var(--content-padding);
    padding-left: 10px;
    display: inline-block;
}

.logo-nav {
    display: block;
    height: calc(var(--nav-height) - 2rem);
}

.nav-user {
    position: absolute;
    bottom: 0.4rem;
    right: var(--content-padding);
    color: white;
    font-size: 0.9rem;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-user a {
    display: flex;
    align-items: center;
}

.nav-role {
    font-size: 0.75rem;
    opacity: 0.7;
    padding: 0.1rem 0.4rem;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 3px;
}

.nav-logout-icon {
    width: 1rem;
    height: 1rem;
    color: white;
    opacity: 0.85;
    cursor: pointer;
    transition: opacity 0.2s;
}

.nav-logout-icon:hover {
    opacity: 1;
}

.nav-links {
    position: absolute;
    bottom: 0.4rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    opacity: 0.7;
    text-decoration: none;
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-bottom: 2px solid transparent;
    padding-bottom: 0.15rem;
}

a.nav-link:hover {
    opacity: 1;
    text-decoration: none;
}

.nav-link-active {
    opacity: 1;
    border-bottom-color: white;
}

.nav-link-icon {
    width: 0.85em;
    height: 0.85em;
    color: white;
}

.clickable {
    cursor: pointer;
    transition: transform 0.2s;
}

.clickable:hover {
    transform: scale(1.2);
}

/* SVG sprite icon base */
svg.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    flex-shrink: 0;
    overflow: visible;
}

.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }

.icon-button {
    width: 2rem;
    height: 2rem;
    color: var(--color-primary);
}

.svg-theme {
    color: var(--color-primary);
}
img.svg-theme {
    filter: invert(58%) sepia(85%) saturate(953%) hue-rotate(124deg) brightness(79%) contrast(103%);
}

.svg-red {
    color: var(--color-error);
}
img.svg-red {
    filter: invert(19%) sepia(95%) saturate(6932%) hue-rotate(358deg) brightness(100%) contrast(110%);
}

#archive-toggle,
#filter-toggle {
    opacity: 0.5;
    transition: opacity 0.2s, transform 0.2s;
}

#archive-toggle:hover,
#filter-toggle:hover {
    opacity: 0.8;
}

#archive-toggle.active,
#filter-toggle.active {
    opacity: 1;
}

#archive-toggle {
    margin-right: 0.3rem;
}

/* Backdrop & Progress */
#backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(6px);
    z-index: 15;
}

.lds-ring {
    position: fixed;
    display: block;
    left: calc(50% - 2.5rem);
    top: calc(50% - 2.5rem);
    width: 80px;
    height: 80px;
    z-index: 2000;
}

.lds-ring div {
    box-sizing: border-box;
    display: block;
    position: absolute;
    width: 64px;
    height: 64px;
    margin: 8px;
    border: 8px solid #fff;
    border-radius: 50%;
    animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    border-color: var(--color-primary) transparent transparent transparent;
}

.lds-ring div:nth-child(1) {
    animation-delay: -0.45s;
}

.lds-ring div:nth-child(2) {
    animation-delay: -0.3s;
}

.lds-ring div:nth-child(3) {
    animation-delay: -0.15s;
}

@keyframes lds-ring {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast */
#toast {
    visibility: hidden;
    min-width: 250px;
    background-color: var(--color-primary);
    color: #fff;
    text-align: center;
    border-radius: var(--border-radius);
    padding: 12px 24px;
    position: fixed;
    z-index: 400;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

#toast.show {
    visibility: visible;
    animation: fadein 0.3s;
}

#toast.toast-err {
    background-color: var(--color-error);
}

#toast-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: block;
    color: white;
    transform: translateY(-0.05em);
}

@keyframes fadein {
    from { bottom: 0; opacity: 0; }
    to { bottom: 30px; opacity: 1; }
}

/* Main content */
main {
    position: absolute;
    top: var(--nav-height);
    display: block;
    left: var(--content-padding);
    padding: 1rem;
    padding-bottom: 7rem;
    width: calc(100% - var(--content-padding) * 2);
    color: var(--color-primary);
}

h1 {
    font-weight: 600;
    font-size: 1.6rem;
    margin-top: 0.5rem;
}

.content-area {
}

/* List table */
.list-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.list-table thead th {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 0.6rem 0.5rem;
    border-bottom: 2px solid var(--color-primary);
    color: var(--color-primary);
    opacity: 0.7;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.list-table thead th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.2rem;
}

.list-table thead th.sortable:hover {
    opacity: 1;
}

.list-table thead th.sorted-asc::after {
    content: '\25B2';
    position: absolute;
    right: 0.2rem;
    opacity: 0.9;
    font-size: 0.6rem;
}

.list-table thead th.sorted-desc::after {
    content: '\25BC';
    position: absolute;
    right: 0.2rem;
    opacity: 0.9;
    font-size: 0.6rem;
}

.list-table th,
.list-table td {
    vertical-align: top;
    padding: 0.6rem 0.5rem;
    white-space: normal;
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-table td {
    border-bottom: 1px solid var(--color-border);
}

.list-table td:last-child {
    overflow: visible;
}

tr.row-highlight {
    cursor: pointer;
    transition: background-color 0.15s;
}

tr.row-highlight:hover {
    background-color: var(--color-primary-light) !important;
}

.list-table tbody tr.highlight {
    background: var(--color-primary-mid);
}

.th-actions {
    text-align: right !important;
}

.th-actions .icon {
    vertical-align: middle;
    margin-left: 6px;
}

.th-actions .icon:first-child {
    margin-left: 0;
}

/* Filter row */
.filter-row.filter-hidden {
    display: none;
}

.list-table .filter-row th {
    padding: 0.4rem 0.5rem 0.4rem;
    border-bottom: none;
    text-transform: none;
    letter-spacing: normal;
    opacity: 1;
}

.filter-wrap {
    position: relative;
    display: block;
}

.filter-clear {
    position: absolute;
    right: 0.3rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-primary);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: none;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.filter-clear:hover {
    opacity: 1;
}

.filter-wrap.has-value .filter-clear {
    display: block;
}

input[type=text].filter-input {
    width: 100%;
    height: 1.8rem;
    border: 1px solid var(--color-primary);
    border-radius: 0 0 6px 6px;
    outline: none;
    padding: 0 1.4rem 0 0.4rem;
    font-size: 0.8rem;
    color: var(--color-primary);
    box-sizing: border-box;
    text-align: left;
}

input[type=text].filter-input::placeholder {
    color: var(--color-primary);
    opacity: 0.4;
}

input[type=text].filter-input:focus {
    box-shadow: 0 0 0 2px rgba(0,177,153,0.15);
    border-color: var(--color-primary);
}

/* Status badges in list */
.status-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 1rem;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
}

.status-draft {
    background-color: #e2e3e5;
    color: #383d41;
}

.status-new {
    background-color: #cce5ff;
    color: #004085;
}

.status-open {
    background-color: #fff3cd;
    color: #856404;
}

.status-closed {
    background-color: #d4edda;
    color: #155724;
}

.status-submitted {
    background-color: #fff3cd;
    color: #856404;
}

.status-returned {
    background-color: #f8d7da;
    color: #721c24;
}

.status-ke_schvaleni {
    background-color: #e2e3f1;
    color: #383d6e;
}

.status-schvaleno {
    background-color: #d4edda;
    color: #155724;
}

/* Icon row (action icons in table) */
.icon-row {
    display: flex;
    gap: 0.2rem;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.icon-row .icon {
    box-sizing: content-box;
    width: 1.1rem;
    height: 1.1rem;
    padding: 0.15rem;
    border-radius: 25%;
    transition: background-color 0.15s, transform 0.2s;
}

.icon-row .icon:hover {
    background-color: rgba(0,177,153,0.08);
}

/* Year pills */
#year-pills {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.year-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex: none;
    height: 2.2rem;
    padding: 0 1rem;
    border: 2px solid var(--color-primary);
    border-radius: 0 0 6px 6px;
    background: var(--color-surface);
    color: var(--color-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.year-btn .pill-icon {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.year-btn:not(.active):hover {
    background-color: var(--color-primary-light);
}

.year-btn.active {
    background-color: var(--color-primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.year-btn.active .pill-icon {
    color: #fff;
    opacity: 1;
}

/* Row count */
.row-count {
    font-size: 0.85rem;
    color: var(--color-primary);
    opacity: 0.6;
    padding: 0.6rem 0;
}

/* List item elements */
.list-item-elem {
    vertical-align: middle;
}

/* Forms */
.form-container {
    background: var(--color-surface);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 250;
    min-width: 400px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.form-container label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 13px;
    color: var(--color-primary-dark);
}

.form-container input,
.form-container select,
.form-container textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    font-size: 14px;
    margin-bottom: 12px;
}

.form-container input:focus,
.form-container select:focus,
.form-container textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0, 177, 153, 0.2);
}

.form-container textarea {
    min-height: 80px;
    resize: vertical;
}

/* Buttons */
.btn-icon {
    width: 0.95rem;
    height: 0.95rem;
    display: block;
    transform: translateY(-0.05em);
}

.cta-button .btn-icon {
    color: #fff;
}
.cta-button img.btn-icon {
    filter: invert(1);
}
.cta-button-secondary .btn-icon {
    color: var(--color-primary);
}
.cta-button-secondary img.btn-icon {
    filter: invert(58%) sepia(85%) saturate(953%) hue-rotate(124deg) brightness(79%) contrast(103%);
}

.cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.4rem;
    background-color: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 0 0 8px 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.15s;
}

.cta-button:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-1px);
}

.cta-button-secondary {
    background-color: var(--color-surface);
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.cta-button-secondary:hover {
    background-color: var(--color-primary-light);
}

.cta-button-danger {
    background-color: var(--color-error);
}

.cta-button-danger:hover {
    background-color: color-mix(in srgb, var(--color-error), black 15%);
    transform: translateY(-1px);
}

.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* Landing / Login page */
.banner {
    display: block;
    width: 750px;
    max-width: 90%;
    margin-top: 10%;
    margin-left: auto;
    margin-right: auto;
}

.landing-buttons {
    position: absolute;
    bottom: 8%;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.landing-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 1.6rem;
    border-radius: 2rem;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s, box-shadow 0.2s, transform 0.15s;
    cursor: pointer;
    min-width: 260px;
    justify-content: center;
}

.landing-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.landing-btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.landing-btn-primary:hover {
    background-color: var(--color-primary-dark);
}

.landing-btn-secondary {
    background-color: var(--color-surface);
    color: var(--color-primary);
    border: 1.5px solid var(--color-primary);
}

.landing-btn-secondary:hover {
    background-color: #f0faf8;
}

.landing-btn-icon {
    height: 1.2em;
    width: auto;
    vertical-align: middle;
    flex-shrink: 0;
}

.landing-btn-secondary .landing-btn-icon {
    color: var(--color-primary);
}

.landing-footer {
    position: fixed;
    bottom: 1rem;
    right: 1.5rem;
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--color-primary);
    opacity: 0.6;
}

/* Wizard / Edit form overlay */
#edit-form {
    position: fixed;
    z-index: 250;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: calc(var(--nav-height) + 2rem);
    padding-bottom: 2rem;
    overflow-y: auto;
}

#wizard-container {
    background: var(--color-surface);
    border: 1px solid rgba(0, 177, 153, 0.2);
    border-radius: 8px;
    padding: 1.5rem;
    width: 42rem;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
}

.wizard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.wizard-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 0;
}

/* Wizard step dots */
.wizard-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 1.5rem;
}

.wizard-step-dot {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    border: 2px solid var(--color-primary);
    background: var(--color-surface);
    color: var(--color-primary);
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

.wizard-step-dot.active {
    background-color: var(--color-primary);
    color: #fff;
}

.wizard-step-line {
    width: 1.5rem;
    height: 2px;
    background-color: var(--color-primary);
    opacity: 0.3;
}

/* Wizard form rows */
#wizard-container .form-row {
    margin-bottom: 1rem;
}

.form-row-pair {
    display: flex;
    gap: 1rem;
}

.form-row-pair > .form-row {
    flex: 1;
    min-width: 0;
}

#wizard-container label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--color-primary);
}

#wizard-container .form-actions {
    margin-top: 0.5rem;
}

/* Wizard inputs */
.wizard-input {
    display: block;
    width: 100%;
    height: 2.2rem;
    border: 2px solid var(--color-primary);
    border-radius: 0 0 8px 8px;
    outline-color: var(--color-primary);
    padding: 0 0.5rem;
    font-size: 0.9rem;
    text-align: left;
    color: var(--color-primary);
    box-sizing: border-box;
    background: var(--color-surface);
}

.wizard-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 177, 153, 0.15);
    border-color: var(--color-primary);
}

.wizard-input::-webkit-calendar-picker-indicator {
    filter: invert(58%) sepia(85%) saturate(953%) hue-rotate(124deg) brightness(79%) contrast(103%);
    cursor: pointer;
}

.wizard-input::placeholder {
    color: var(--color-primary);
    opacity: 0.55;
}

.wizard-textarea {
    height: auto;
    min-height: 6rem;
    resize: vertical;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
}

/* Display-only field */
.display-field {
    background: rgba(0, 177, 153, 0.06);
    border: 2px solid var(--color-primary);
    border-radius: 0 0 8px 8px;
    padding: 0 0.5rem;
    height: 2.2rem;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--color-primary);
}

/* Reference number row */
.ref-num-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ref-num-part {
    flex: 1;
    text-align: center;
    justify-content: center;
    min-width: 3rem;
}

.ref-num-sep {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-primary);
    opacity: 0.6;
    flex-shrink: 0;
}

/* Input clear button */
.input-wrap {
    position: relative;
    display: block;
}

.input-clear {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-primary);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: none;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.input-clear:hover {
    opacity: 1;
}

.input-wrap.has-value .input-clear {
    display: block;
}

.input-wrap .wizard-input {
    padding-right: 1.6rem;
}

.input-wrap .wizard-textarea + .input-clear {
    top: 0.4rem;
    transform: none;
}

/* Summary (step 3) */
.summary-grid {
    margin-bottom: 1rem;
}

.summary-row {
    display: flex;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-label {
    font-weight: 600;
    color: var(--color-primary);
    width: 7rem;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.summary-value {
    color: var(--color-primary);
    font-size: 0.9rem;
    white-space: pre-line;
    word-break: break-word;
}

/* Searchable combobox */
.combo-wrap {
    position: relative;
}

select.combo-hidden {
    display: none;
}

input.combo-input {
    display: block;
    width: 100%;
    height: 2.2rem;
    border: 2px solid var(--color-primary);
    border-radius: 0 0 8px 8px;
    outline-color: var(--color-primary);
    padding: 0 2rem 0 0.5rem;
    font-size: 0.9rem;
    text-align: left;
    box-sizing: border-box;
    color: var(--color-primary);
    background-color: var(--color-surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300b199' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.4rem center;
    background-size: 1.2rem;
    cursor: pointer;
}

.combo-clear {
    position: absolute;
    right: 1.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-primary);
    font-size: 1rem;
    cursor: pointer;
    display: none;
    opacity: 0.5;
    line-height: 1;
    z-index: 1;
}
.combo-clear:hover {
    opacity: 1;
}
.combo-wrap.has-value .combo-clear {
    display: block;
}

input.combo-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 177, 153, 0.15);
    border-color: var(--color-primary);
}

input.combo-input::placeholder {
    color: var(--color-primary);
    opacity: 0.55;
}

.combo-list {
    display: none;
    position: fixed;
    max-height: 14rem;
    overflow-y: auto;
    background: var(--color-surface);
    border: 2px solid var(--color-primary);
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 2000;
}

.combo-list.open {
    display: block;
}

.combo-item {
    padding: 0.4rem 0.5rem;
    font-size: 0.9rem;
    color: var(--color-primary);
    cursor: pointer;
}

.combo-item:hover,
.combo-item.highlighted {
    background-color: #cef9f5;
}

.combo-item.active {
    font-weight: 600;
    background-color: #cef9f5;
}

/* Search highlight */
::highlight(search-results) {
    background-color: var(--color-warning);
    color: black;
}

/* Add button */
.add-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    border: none;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    transition: background 0.2s;
}

.add-btn:hover {
    background: var(--color-primary-dark);
}

/* Footer */
footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3rem;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 1.5rem 1.5rem 0 0;
    z-index: 5;
    min-width: 25rem;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}

cta {
    position: fixed;
    display: block;
    margin: auto;
    background-color: var(--color-primary);
    width: 5rem;
    height: 5rem;
    z-index: 10;
    bottom: 0;
    border-radius: 50%;
    border: 0.25rem solid white;
    left: calc(50% - 2.5rem);
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s, box-shadow 0.2s;
}

cta:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(0,0,0,0.18);
}

cta icon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    cursor: pointer;
}

cta icon img,
cta icon svg,
cta icon svg.icon {
    width: 3.2rem;
    height: 3.2rem;
}

version {
    position: absolute;
    display: block;
    font-size: 0.7rem;
    color: var(--color-primary);
    opacity: 0.6;
    bottom: 0.5rem;
    right: 0.5rem;
}

/* Detail panel */
#detail-panel {
    position: fixed;
    display: block;
    z-index: 250;
    left: 15%;
    width: 70%;
    top: calc(var(--nav-height) + 2rem);
    max-height: calc(100vh - var(--nav-height) - 6rem);
    overflow-y: auto;
    transition: left 0.2s, width 0.2s;
}

#detail-panel.detail-narrow {
    left: 30%;
    width: 40%;
}

#detail-panel.detail-confirm {
    left: 35%;
    width: 30%;
}

#detail-container {
    background: var(--color-surface);
    border: 1px solid rgba(0, 177, 153, 0.2);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
}

#detail-container .form-row {
    margin-bottom: 1rem;
}

#detail-container label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--color-primary);
}

#detail-container .form-actions {
    margin-top: 2.5rem;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.detail-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-primary);
}

.detail-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Status badge */
.detail-badge-wrap {
    margin-bottom: 1rem;
}

.detail-status-badge {
    display: inline-block;
    padding: 0.3rem 0.9rem;
    border-radius: 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
}

.detail-status-draft {
    background-color: #e2e3e5;
    color: #383d41;
}

.detail-status-new {
    background-color: #cce5ff;
    color: #004085;
}

.detail-status-open {
    background-color: #fff3cd;
    color: #856404;
}

.detail-status-closed {
    background-color: #d4edda;
    color: #155724;
}

.detail-status-submitted {
    background-color: #fff3cd;
    color: #856404;
}

.detail-status-returned {
    background-color: #f8d7da;
    color: #721c24;
}

.detail-status-ke_schvaleni {
    background-color: #e2e3f1;
    color: #383d6e;
}

.detail-status-schvaleno {
    background-color: #d4edda;
    color: #155724;
}

/* Detail info grid (souhlasy pattern) */
.detail-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem 1.5rem;
    margin-bottom: 1.5rem;
}

.detail-info-single {
    grid-template-columns: 1fr;
}

.detail-info-full {
    grid-column: 1 / -1;
}

.detail-info-field {
    min-width: 0;
}

.detail-info-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--color-primary);
}

.detail-info-value {
    background-color: var(--color-primary-light);
    border: 2px solid var(--color-primary);
    border-radius: 0 0 8px 8px;
    padding: 0.4rem 0.5rem;
    font-size: 0.9rem;
    color: var(--color-primary);
    height: auto;
    min-height: 2.2rem;
    line-height: 1.4rem;
    box-sizing: border-box;
    word-break: break-word;
    white-space: pre-line;
}

.summary-section .detail-info-value {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0.2rem 0;
    color: var(--color-primary);
    font-size: 0.9rem;
    white-space: pre-wrap;
    line-height: 1.5;
    min-height: 0;
}

.detail-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 0.3rem;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
}


/* Collapsible summary sections */
.summary-section {
    background-color: var(--color-primary-light);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    margin-bottom: 0.5rem;
}

.summary-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.summary-section-chevron {
    font-size: 0.85rem;
    color: var(--color-primary);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.summary-section.expanded .summary-section-chevron {
    transform: rotate(90deg);
}

.summary-section-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-primary);
}

.summary-section-body {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}

.summary-section.expanded .summary-section-body {
    max-height: 2000px;
    opacity: 1;
}

.summary-section-body .summary-grid {
    margin-top: 0.4rem;
}

.summary-section-body .detail-info-grid {
    margin-top: 0.5rem;
    margin-bottom: 0;
}

/* Warning icon for empty sections */
.summary-section-warn {
    margin-left: auto;
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: var(--color-warning);
}

/* Detail bottom actions (souhlasy pattern) */
.detail-bottom-actions {
    margin-top: 2.5rem;
}

/* History rows */
.detail-history-row {
    display: flex;
    gap: 0.8rem;
    padding: 0.4rem;
    border-bottom: 1px solid var(--color-primary-light);
    font-size: 0.85rem;
    align-items: baseline;
}

.detail-history-row:last-child {
    border-bottom: none;
}

.detail-history-action {
    font-weight: 600;
    flex-shrink: 0;
    color: var(--color-primary);
}

.detail-history-subject {
    flex: 2;
    opacity: 0.7;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-history-user {
    opacity: 0.7;
    flex-shrink: 0;
    text-align: right;
}

.detail-history-time {
    opacity: 0.7;
    flex-shrink: 0;
    font-size: 0.8rem;
    text-align: right;
}

/* History diff modal */
.mini-modal {
    position: fixed;
    z-index: 1500;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: calc(var(--nav-height) + 2rem);
    padding-bottom: 2rem;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(6px);
}

.mini-modal-container {
    background: var(--color-surface);
    border: 1px solid rgba(0, 177, 153, 0.2);
    border-radius: 8px;
    padding: 1.5rem 1.5rem 2.5rem;
    box-sizing: border-box;
    width: 30rem;
    max-width: 90vw;
    max-height: 100%;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.mini-modal-container modal-title {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 0.75rem;
}

.history-diff-container {
    width: 38rem;
}

.history-diff-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.history-diff-table th {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    padding: 0.5rem 0.6rem;
    border-bottom: 2px solid var(--color-primary);
    color: var(--color-primary);
    opacity: 0.7;
    text-align: left;
}

.history-diff-table td {
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
    word-break: break-word;
}

.history-diff-table td:first-child {
    font-weight: 600;
    white-space: nowrap;
    width: 8rem;
}

.history-diff-old {
    background-color: #fff0f0;
}

.history-diff-new {
    background-color: #f0fff0;
}

.history-diff-inline {
    line-height: 1.6;
}
.history-diff-inline .diff-add {
    background-color: #d4edda;
    padding: 0.1em 0.2em;
    border-radius: 2px;
}
.history-diff-inline .diff-del {
    background-color: #f8d7da;
    text-decoration: line-through;
    opacity: 0.7;
    padding: 0.1em 0.2em;
    border-radius: 2px;
}

.field-diff-toggle {
    margin-left: auto;
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    opacity: 0.5;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}
.field-diff-toggle:hover {
    opacity: 1;
    transform: scale(1.2);
}
.field-diff-view {
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
}
.field-diff-view .diff-add {
    background-color: #d4edda;
    padding: 0.1em 0.2em;
    border-radius: 2px;
}
.field-diff-view .diff-del {
    background-color: #f8d7da;
    text-decoration: line-through;
    opacity: 0.7;
    padding: 0.1em 0.2em;
    border-radius: 2px;
}
.field-diff-view.hidden { display: none; }

.delete-confirm-text {
    font-size: 0.95rem;
    color: var(--color-text);
    padding: 1rem 0;
    text-align: center;
}

/* Impersonation */
.nav-impersonate-icon {
    width: 1rem;
    height: 1rem;
    color: white;
    opacity: 0.85;
    cursor: pointer;
    transition: opacity 0.2s;
}

.nav-impersonate-icon:hover {
    opacity: 1;
}

.impersonate-modal {
    position: absolute;
    top: var(--nav-height);
    right: var(--content-padding);
    background: var(--color-surface);
    border: 1px solid rgba(0, 177, 153, 0.2);
    border-radius: 0 0 8px 8px;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    z-index: 25;
    min-width: 20rem;
}

.impersonate-modal modal-title {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.impersonate-modal .form-actions {
    margin-top: 0.75rem;
}

.impersonate-modal .icon-button {
    width: 1.5rem;
    height: 1.5rem;
}


/* Return note modal */
#detail-return-note {
    margin-top: 1.5rem;
    border: 2px solid var(--color-error);
    border-radius: 8px;
    padding: 1rem;
    background: var(--color-surface);
}

#detail-return-note .form-row {
    margin-bottom: 0.5rem;
}

#detail-return-note .form-actions {
    margin-top: 0.75rem;
}


/* Approve modal */
#detail-approve-modal {
    margin-top: 1.5rem;
    border: 2px solid var(--color-primary);
    border-radius: 8px;
    padding: 1rem;
    background: var(--color-surface);
}

#detail-approve-modal .form-row {
    margin-bottom: 0.5rem;
}

#detail-approve-modal .form-actions {
    margin-top: 0.75rem;
}

.approve-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    cursor: pointer;
}

.approve-checkbox-label input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: var(--color-primary);
}

.approve-radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 0.5rem;
    padding: 0.4rem 0;
}

.approve-radio-label input[type="radio"] {
    flex-shrink: 0;
    width: 1.3rem;
    height: 1.3rem;
    margin: 0;
    accent-color: var(--color-primary);
    cursor: pointer;
}


/* Status filter pills */
#status-filter-pills {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.status-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex: none;
    height: 2.2rem;
    padding: 0 1rem;
    border: 2px solid var(--color-primary);
    border-radius: 0 0 6px 6px;
    background: var(--color-surface);
    color: var(--color-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.status-filter-btn .pill-icon {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.status-filter-btn:not(.active):hover {
    background-color: var(--color-primary-light);
}

.status-filter-btn.active {
    background-color: var(--color-primary);
    color: #fff;
}

.status-filter-btn.active .pill-icon {
    color: #fff;
    opacity: 1;
}

/* Dashboard statistics */
#stats-container {
    margin-bottom: 0.8rem;
}

.stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--color-primary);
    border-radius: 0 0 8px 8px;
    background: var(--color-surface);
    user-select: none;
}

.stats-header-left {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.stats-header-left .icon {
    width: 1rem;
    height: 1rem;
}

.stats-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-primary);
}

.stats-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4rem;
    height: 1.4rem;
    padding: 0 0.4rem;
    border-radius: 1rem;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}

.stats-toggle {
    width: 1rem;
    height: 1rem;
    transition: transform 0.2s;
}

.stats-cards {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.6rem;
    flex-wrap: wrap;
}

.stats-card {
    flex: 1 1 0;
    min-width: 10rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    padding: 0.75rem 1rem;
}

.stats-card-wide {
    flex: 2 1 20rem;
}

.stats-card-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-primary);
    opacity: 0.6;
    margin-bottom: 0.5rem;
}

.stats-card-big {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.1;
}

.stats-status-list,
.stats-type-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.stats-status-row,
.stats-type-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.stats-count {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--color-primary);
}

.stats-type-name {
    font-size: 0.85rem;
    color: var(--color-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.stats-type-other {
    opacity: 0.5;
    font-style: italic;
}

.stats-empty {
    font-size: 0.85rem;
    color: var(--color-primary);
    opacity: 0.4;
}

/* Bar chart */
.stats-chart {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 5rem;
    padding-top: 1.2rem;
    position: relative;
}

.stats-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.stats-bar-value {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 2px;
    min-height: 0.9rem;
}

.stats-bar {
    width: 100%;
    max-width: 2.5rem;
    background: var(--color-primary);
    border-radius: 3px 3px 0 0;
    opacity: 0.7;
    transition: height 0.3s ease;
}

.stats-bar-label {
    font-size: 0.65rem;
    color: var(--color-primary);
    opacity: 0.6;
    margin-top: 3px;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .stats-cards {
        flex-direction: column;
    }

    .stats-card {
        min-width: auto;
    }

    .stats-card-wide {
        flex: 1 1 auto;
    }
}

/* Full-text search */
.search-wrap {
    position: relative;
    margin-top: 0.8rem;
}

input[type=text].search-input {
    width: 100%;
    height: 2.4rem;
    border: 2px solid var(--color-primary);
    border-radius: 0 0 8px 8px;
    outline: none;
    padding: 0 2.2rem 0 2.2rem;
    font-size: 0.95rem;
    color: var(--color-primary);
    background: var(--color-surface);
    box-sizing: border-box;
}

input[type=text].search-input::placeholder {
    color: var(--color-primary);
    opacity: 0.45;
}

input[type=text].search-input:focus {
    box-shadow: 0 0 0 3px rgba(0,177,153,0.15);
    border-color: var(--color-primary);
}

.search-wrap .search-icon {
    position: absolute;
    left: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    opacity: 0.5;
}

.search-clear {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-primary);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.5;
    display: none;
}

.search-clear:hover {
    opacity: 1;
}

.search-wrap.has-value .search-clear {
    display: block;
}

.search-bar {
    position: absolute;
    bottom: 2px;
    left: 2px;
    height: 5px;
    width: 0;
    background: var(--color-primary);
    opacity: 0.85;
    border-radius: 0 0 6px 6px;
    pointer-events: none;
}

.search-bar.animating {
    transition: width 1000ms linear;
    width: 0;
}

/* Attachments */
.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 0.5rem;
}

.attachment-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 8px;
    border-radius: var(--border-radius);
    background: var(--color-surface);
    font-size: 12px;
    line-height: 1;
}

.attachment-row .icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    display: block;
}

.attachment-row a {
    color: var(--color-primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    font-size: 12px;
    line-height: 14px;
}

.attachment-row a:hover {
    text-decoration: underline;
}

.attachment-size {
    font-size: 11px;
    align-self: center;
    flex-shrink: 0;
    white-space: nowrap;
    color: var(--color-primary);
    opacity: 0.5;
    transform: translateY(1px);
}

.attachment-delete {
    cursor: pointer;
    flex-shrink: 0;
    display: block;
}

.attachment-delete:hover {
    color: var(--color-error) !important;
}

.attachment-header-info {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.attachment-header-info .icon {
    width: 1rem;
    height: 1rem;
    display: block;
    color: var(--color-primary);
    opacity: 0.6;
}

.attachment-count {
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    color: var(--color-primary);
    opacity: 0.6;
}

.attachment-empty {
    color: var(--color-primary);
    font-size: 12px;
    opacity: 0.4;
    padding: 2px 0;
}

.attachment-upload-zone {
    margin-top: 8px;
}

.attachment-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border: 1px dashed var(--color-border);
    border-radius: var(--border-radius);
    background: var(--color-bg);
    color: var(--color-primary);
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.attachment-upload-btn:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.attachment-upload-btn .icon {
    width: 14px;
    height: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .list-table {
        font-size: 12px;
    }

    .form-container {
        min-width: 90vw;
    }
}
