* {
    box-sizing: border-box;
}

:root {
    font-family: Arial, Helvetica, sans-serif;
    color: #1f2933;
    background: #f4f6f8;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    min-height: 100vh;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.card,
.content-card,
.app-header {
    background: #ffffff;
    border: 1px solid #e5e9ed;
    border-radius: 14px;
    box-shadow: 0 16px 44px rgba(20, 30, 40, 0.08);
}

.compact-card {
    width: 100%;
    max-width: 390px;
    padding: 34px;
}

.hidden {
    display: none !important;
}

.brand {
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-align: center;
    color: #66727d;
}

.brand-left {
    margin: 0 0 4px;
    text-align: left;
    font-size: 11px;
}

h1,
h2 {
    margin: 0;
    color: #17212b;
}

h1 {
    font-size: 28px;
    line-height: 1.2;
    text-align: center;
}

h2 {
    font-size: 23px;
}

.subtitle {
    margin: 10px 0 28px;
    color: #6b7580;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.subtitle.left {
    text-align: left;
    margin-bottom: 22px;
}

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 700;
}

.field input,
.search-form input {
    width: 100%;
    height: 46px;
    padding: 0 13px;
    border: 1px solid #ccd3da;
    border-radius: 8px;
    background: #ffffff;
    color: #17212b;
    outline: none;
}

.field input:focus,
.search-form input:focus {
    border-color: #697988;
    box-shadow: 0 0 0 3px rgba(79, 96, 112, 0.10);
}

.button {
    width: 100%;
    min-height: 46px;
    border: 0;
    border-radius: 8px;
    padding: 11px 16px;
    cursor: pointer;
    font-weight: 700;
}

.button:disabled {
    cursor: default;
    opacity: 0.55;
}

.button.small {
    width: auto;
    min-height: 38px;
    padding: 8px 13px;
}

.primary {
    background: #202a33;
    color: #ffffff;
}

.primary:hover:not(:disabled) {
    background: #111820;
}

.secondary {
    background: #eef1f4;
    color: #26313b;
}

.secondary:hover:not(:disabled) {
    background: #e2e7eb;
}

.message {
    margin-top: 16px;
    padding: 11px 12px;
    border-radius: 7px;
    font-size: 13px;
    line-height: 1.45;
}

.error,
.error-inline {
    background: #fff1f0;
    color: #a61b1b;
    border: 1px solid #f1c4c0;
}

.success-message {
    background: #effaf3;
    color: #176d36;
    border: 1px solid #bfe2ca;
}

#loadingView {
    text-align: center;
}

.status-text {
    margin: 15px 0 0;
    color: #66727d;
    font-size: 14px;
}

.spinner {
    width: 36px;
    height: 36px;
    margin: 0 auto;
    border: 4px solid #e5e9ed;
    border-top-color: #202a33;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.app-shell {
    width: 100%;
    max-width: 760px;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 14px;
    padding: 16px 18px;
}

#loggedUser {
    font-size: 15px;
}

.content-card {
    padding: 28px;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.menu-button {
    min-height: 116px;
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    padding: 18px;
    border: 1px solid #dfe5ea;
    border-radius: 12px;
    background: #ffffff;
    color: #1f2933;
    text-decoration: none;
    text-align: left;
    cursor: pointer;
}

.menu-button:hover {
    border-color: #aeb9c3;
    background: #fafbfc;
}

.menu-icon {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #202a33;
    color: #ffffff;
    font-size: 18px;
    font-weight: 800;
}

.news-button .menu-icon {
    background: #eef1f4;
    color: #26313b;
}

.menu-button strong,
.menu-button small {
    display: block;
}

.menu-button strong {
    margin-bottom: 5px;
    font-size: 17px;
}

.menu-button small {
    color: #74808b;
    font-size: 12px;
    line-height: 1.4;
}

.section-head {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
}

.section-head p {
    margin: 5px 0 0;
    color: #6f7a84;
    font-size: 13px;
    line-height: 1.4;
    word-break: break-word;
}

.back-button {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: #53616d;
    padding: 4px 0;
    cursor: pointer;
    font-weight: 700;
}

.back-button:hover {
    color: #111820;
}

.search-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.search-button {
    width: auto;
    min-width: 100px;
}

.hint {
    margin: 10px 0 0;
    color: #77828c;
    font-size: 12px;
    line-height: 1.45;
}

.inline-status {
    margin-top: 18px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f4f6f8;
    color: #5e6b76;
    font-size: 13px;
}

.inline-status.success {
    background: #effaf3;
    color: #176d36;
    border: 1px solid #c8e7d2;
}

.inline-status.warning {
    background: #fff9e9;
    color: #815e00;
    border: 1px solid #eedda8;
}

.result-list {
    display: grid;
    gap: 9px;
    margin-top: 14px;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    min-height: 66px;
    padding: 13px 15px;
    border: 1px solid #e0e5e9;
    border-radius: 10px;
    background: #ffffff;
    color: #1f2933;
    text-align: left;
    cursor: pointer;
}

.result-item:hover {
    border-color: #aeb9c3;
    background: #fafbfc;
}

.result-text {
    min-width: 0;
}

.result-text strong,
.result-text small {
    display: block;
}

.result-text strong {
    overflow-wrap: anywhere;
    font-size: 14px;
    line-height: 1.4;
}

.result-text small {
    margin-top: 5px;
    color: #7a858f;
    font-size: 11px;
}

.result-arrow {
    flex: 0 0 auto;
    color: #9aa4ad;
    font-size: 27px;
    line-height: 1;
}

.upload-targets {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.target-option {
    position: relative;
    display: block;
    padding: 14px;
    border: 1px solid #dfe5ea;
    border-radius: 10px;
    cursor: pointer;
}

.target-option.selected {
    border-color: #202a33;
    box-shadow: inset 0 0 0 1px #202a33;
}

.target-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.target-option strong,
.target-option small {
    display: block;
}

.target-option strong {
    font-size: 14px;
}

.target-option small {
    margin-top: 5px;
    color: #78838d;
    font-size: 11px;
}

.file-picker {
    display: block;
    margin-bottom: 14px;
    padding: 24px 18px;
    border: 2px dashed #c9d0d6;
    border-radius: 11px;
    text-align: center;
    cursor: pointer;
    background: #fafbfc;
}

.file-picker:hover {
    border-color: #8d9aa5;
}

.file-picker strong,
.file-picker span {
    display: block;
}

.file-picker strong {
    margin-bottom: 5px;
}

.file-picker span {
    color: #7b8690;
    font-size: 12px;
}

.file-picker input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.selected-files {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
}

.selected-file {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 11px;
    border-radius: 8px;
    background: #f3f5f7;
    font-size: 12px;
}

.selected-file span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-file small {
    flex: 0 0 auto;
    color: #7a858f;
}

code {
    padding: 1px 4px;
    border-radius: 4px;
    background: #f1f3f5;
}

@media (max-width: 640px) {
    .page {
        align-items: flex-start;
        padding: 12px;
    }

    .app-shell {
        max-width: none;
    }

    .app-header,
    .content-card {
        border-radius: 11px;
    }

    .content-card {
        padding: 20px;
    }

    .menu-grid,
    .upload-targets {
        grid-template-columns: 1fr;
    }

    .search-form {
        grid-template-columns: 1fr;
    }

    .search-button {
        width: 100%;
    }

    .section-head {
        display: block;
    }

    .back-button {
        margin-bottom: 12px;
    }
}

/* ======================================================
   PWA instalace
   ====================================================== */

.pwa-install-area {
    position: sticky;
    bottom: 12px;
    z-index: 20;
    display: flex;
    justify-content: center;
    margin-top: 14px;
    pointer-events: none;
}

.pwa-install-button {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid #d7dde2;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: #5d6974;
    box-shadow: 0 6px 18px rgba(20, 30, 40, 0.08);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    backdrop-filter: blur(8px);
}

.pwa-install-button:hover {
    color: #202a33;
    border-color: #aeb8c1;
    background: #ffffff;
}

.pwa-install-icon {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #eef1f4;
    color: #202a33;
    font-size: 14px;
    line-height: 1;
}

.pwa-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(17, 24, 32, 0.42);
}

.pwa-dialog {
    width: 100%;
    max-width: 390px;
    padding: 24px;
    border: 1px solid #e1e6ea;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 20px 60px rgba(20, 30, 40, 0.18);
}

.pwa-dialog h2 {
    margin-bottom: 12px;
    font-size: 20px;
}

.pwa-dialog p {
    margin: 0 0 18px;
    color: #63707b;
    font-size: 14px;
    line-height: 1.55;
}

@media (max-width: 640px) {
    .pwa-install-area {
        bottom: 8px;
    }

    .pwa-install-button {
        min-height: 36px;
        font-size: 11px;
    }
}

/* ======================================================
   SKLAD + MOJE SOUBORY
   ====================================================== */

button,
input,
textarea {
    font: inherit;
}

.field textarea {
    width: 100%;
    min-height: 110px;
    padding: 12px 13px;
    border: 1px solid #ccd3da;
    border-radius: 8px;
    background: #ffffff;
    color: #17212b;
    outline: none;
    resize: vertical;
    line-height: 1.45;
}

.field textarea:focus {
    border-color: #697988;
    box-shadow: 0 0 0 3px rgba(79, 96, 112, 0.10);
}

.wide-action {
    margin-bottom: 14px;
}

.scanner-panel {
    margin: 14px 0;
    padding: 12px;
    border: 1px solid #dfe5ea;
    border-radius: 12px;
    background: #111820;
    overflow: hidden;
}

.scanner-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    color: #ffffff;
    font-size: 13px;
}

.icon-button {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

.qr-reader {
    overflow: hidden;
    border-radius: 9px;
    background: #000000;
}

.qr-reader video {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 8px;
    object-fit: cover;
}

.warehouse-scanner-panel {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid #dfe5ea;
    border-radius: 13px;
    background: #101820;
    color: #ffffff;
}

.warehouse-scanner-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.warehouse-scanner-head strong,
.warehouse-scanner-head span {
    display: block;
}

.warehouse-scanner-head strong {
    font-size: 14px;
}

.warehouse-scanner-head span {
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.68);
    font-size: 12px;
}

.scanner-close-button {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

.scanner-hint {
    margin: 10px 2px 0;
    color: rgba(255, 255, 255, 0.68);
    font-size: 11px;
    text-align: center;
}

.manual-id-box {
    margin-top: 4px;
    border: 1px solid #e3e7eb;
    border-radius: 9px;
    background: #fafbfc;
}

.manual-id-box summary {
    padding: 10px 12px;
    cursor: pointer;
    color: #697681;
    font-size: 12px;
    font-weight: 700;
}

.compact-search {
    padding: 0 12px 12px;
}

.warehouse-item-card {
    margin-top: 18px;
    padding: 22px;
    border: 1px solid #dfe5ea;
    border-radius: 13px;
    background: #fafbfc;
    text-align: center;
}

.warehouse-label,
.quantity-label {
    color: #7a858f;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.warehouse-item-card h3 {
    margin: 7px 0 5px;
    color: #17212b;
    font-size: 21px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.muted-code {
    display: block;
    color: #89939c;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
}

.quantity-label {
    margin-top: 26px;
}

.current-quantity-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 7px;
    margin-top: 9px;
}

.quantity-unit {
    color: #697681;
    font-size: 15px;
    font-weight: 700;
}

.adjustment-label {
    margin-top: 30px;
}

.quantity-control {
    display: grid;
    grid-template-columns: 64px minmax(90px, 1fr) 64px;
    align-items: center;
    gap: 14px;
    max-width: 340px;
    margin: 11px auto 0;
}

.quantity-button {
    width: 64px;
    height: 64px;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    font-size: 34px;
    line-height: 1;
    font-weight: 500;
}

.quantity-button:disabled {
    opacity: 0.4;
    cursor: default;
}

.quantity-button.minus {
    background: #fff0f0;
    color: #b42318;
}

.quantity-button.plus {
    background: #ebf8ef;
    color: #137333;
}

.quantity-value {
    min-width: 0;
    color: #17212b;
    font-size: 42px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.quantity-delta {
    min-width: 0;
    font-size: 38px;
    line-height: 1;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}

.quantity-delta.positive {
    color: #137333;
}

.quantity-delta.negative {
    color: #b42318;
}

.quantity-delta.neutral {
    color: #89939c;
}

.warehouse-apply-button {
    width: min(100%, 340px);
    margin: 18px auto 0;
}

.warehouse-apply-button.success {
    background: #137333;
}

.warehouse-apply-button.danger {
    background: #b42318;
}

.centered {
    text-align: center;
}

.section-head-actions {
    align-items: center;
}

.grow {
    flex: 1 1 auto;
    min-width: 0;
}

.description-box {
    margin: 0 0 20px;
    padding: 14px 15px;
    border-radius: 9px;
    background: #f4f6f8;
    color: #36434e;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.subheading {
    margin: 20px 0 10px;
    color: #27333d;
    font-size: 15px;
}

.attachment-list {
    display: grid;
    gap: 9px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 60px;
    padding: 12px 14px;
    border: 1px solid #e0e5e9;
    border-radius: 10px;
    background: #ffffff;
    color: #1f2933;
    text-decoration: none;
}

.attachment-item:hover {
    border-color: #aeb9c3;
    background: #fafbfc;
}

.attachment-icon {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #eef1f4;
    color: #27333d;
    font-weight: 800;
}

.attachment-text {
    min-width: 0;
}

.attachment-text strong,
.attachment-text small {
    display: block;
    overflow-wrap: anywhere;
}

.attachment-text strong {
    font-size: 13px;
}

.attachment-text small {
    margin-top: 4px;
    color: #7a858f;
    font-size: 10px;
}

@media (max-width: 640px) {
    .section-head-actions {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 10px;
    }

    .section-head-actions .back-button {
        grid-column: 1 / -1;
        margin-bottom: 2px;
    }

    .quantity-control {
        grid-template-columns: 58px minmax(72px, 1fr) 58px;
        gap: 10px;
    }

    .quantity-button {
        width: 58px;
        height: 58px;
    }

    .quantity-value {
        font-size: 34px;
    }
}

/* ======================================================
   USE CASE DETAIL / MANAGED ATTACHMENTS / DOCUMENTS
   ====================================================== */
.detail-block {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #e5e9ed;
}

.detail-block:first-of-type {
    margin-top: 12px;
}

.detail-block-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.detail-block-head h3,
.detail-block h3 {
    margin: 0 0 4px;
    font-size: 17px;
}

.detail-block-head small {
    color: #6b7580;
}

.empty-list-note {
    padding: 12px 14px;
    border: 1px dashed #d4dbe1;
    border-radius: 10px;
    color: #6b7580;
    background: #fafbfc;
    font-size: 14px;
}

.managed-attachment-item {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 8px;
}

.attachment-open-link {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 11px 13px;
    border: 1px solid #dfe4e8;
    border-radius: 10px;
    background: #fff;
    color: #202a33;
    text-decoration: none;
    overflow: hidden;
}

.attachment-open-link strong,
.attachment-open-link small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-open-link small {
    color: #6b7580;
}

.attachment-delete-button {
    flex: 0 0 auto;
    border: 1px solid #efc5c5;
    border-radius: 10px;
    background: #fff7f7;
    color: #b42318;
    padding: 0 13px;
    font-weight: 700;
    cursor: pointer;
}

.attachment-delete-button:disabled {
    opacity: .55;
    cursor: default;
}

.hint-box {
    margin: 12px 0;
    padding: 11px 13px;
    border-radius: 10px;
    background: #f3f7f4;
    color: #42544a;
    font-size: 13px;
    line-height: 1.45;
}

.document-auto-info {
    display: grid;
    gap: 7px;
    margin-bottom: 20px;
    padding: 13px 15px;
    border-radius: 12px;
    background: #f6f8fa;
    color: #4c5863;
    font-size: 13px;
}

.document-file-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.compact-picker {
    margin: 0;
    min-height: 92px;
}

.camera-picker {
    border-style: dashed;
}

.selected-file-removable {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.mini-remove-button {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: #f0f2f4;
    color: #4b5660;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 640px) {
    .document-file-actions {
        grid-template-columns: 1fr;
    }

    .managed-attachment-item {
        align-items: stretch;
    }

    .attachment-delete-button {
        padding: 0 11px;
    }
}


/* ======================================================
   ZAKÁZKA / USE CASE PŘEHLED
   ====================================================== */
.order-detail-head {
    align-items: center;
    margin-bottom: 18px;
}

.order-detail-title {
    max-width: 100%;
    font-size: clamp(20px, 3.6vw, 28px);
    line-height: 1.22;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.overview-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e9ed;
}

.overview-section:first-of-type {
    margin-top: 8px;
}

.overview-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.overview-section-head h3 {
    margin: 0;
    color: #27333d;
    font-size: 17px;
}

.document-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.order-document-item {
    display: flex;
    align-items: stretch;
    gap: 10px;
    padding: 13px 14px;
    border: 1px solid #e0e5e9;
    border-radius: 11px;
    background: #ffffff;
}

.order-document-main {
    flex: 1 1 auto;
    min-width: 0;
}

.order-document-title,
.order-document-meta {
    display: block;
}

.order-document-title {
    color: #202a33;
    font-size: 14px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.order-document-meta {
    margin-top: 4px;
    color: #77828c;
    font-size: 11px;
}

.order-document-description {
    margin: 8px 0 0;
    color: #586570;
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.order-document-files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.order-document-file-link {
    max-width: 100%;
    padding: 6px 9px;
    border-radius: 8px;
    background: #f2f5f7;
    color: #33414c;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-document-file-link:hover {
    background: #e7ecef;
}

.order-document-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: stretch;
}

.document-delete-button {
    min-height: 42px;
}

.usecase-actions-block {
    margin-top: 10px;
    padding-top: 0;
    border-top: 0;
}

.testing-editor {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #e8ecef;
}

.testing-editor .field {
    margin-bottom: 10px;
}

.existing-files-block {
    margin-top: 28px;
}

.detail-section-title {
    margin-bottom: 14px !important;
    font-size: 18px !important;
}

.stored-files-group + .stored-files-group {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #edf0f2;
}

@media (max-width: 640px) {
    .order-detail-head {
        display: block;
    }

    .order-detail-head .back-button {
        margin-bottom: 12px;
    }

    .overview-section-head {
        align-items: center;
    }

    .order-document-item {
        flex-direction: column;
    }

    .order-document-actions {
        justify-content: flex-end;
    }

    .document-delete-button {
        width: 100%;
        min-height: 40px;
    }
}


/* ======================================================
   USE CASE WORKFLOW – pořadí: upload / Testing / soubory
   ====================================================== */
.usecase-workflow-section {
    margin-top: 18px;
}

.usecase-workflow-section > h3 {
    margin: 0 0 12px;
    color: #27333d;
    font-size: 17px;
}

.usecase-section-divider {
    height: 1px;
    margin: 24px 0 20px;
    background: #e5e9ed;
}

.testing-editor-section .testing-editor {
    margin-top: 8px;
    padding-top: 0;
    border-top: 0;
}

.existing-files-block {
    margin-top: 0;
}

.usecase-actions-block {
    margin-top: 10px;
    padding-top: 0;
    border-top: 0;
}

/* Odkazy na přílohy jsou nyní tlačítka, aby nikdy neotvíraly nový tab. */
.attachment-item,
.attachment-open-link,
.order-document-file-link {
    font: inherit;
    cursor: pointer;
    text-align: left;
}

.attachment-item {
    width: 100%;
}

.order-document-file-link {
    border: 0;
}

/* ======================================================
   INTERNÍ FILE VIEWER / MODAL
   ====================================================== */
body.file-viewer-open {
    overflow: hidden;
}

.file-viewer-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(15, 22, 28, 0.88);
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.file-viewer-shell {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #11181f;
    color: #fff;
}

.file-viewer-header {
    flex: 0 0 auto;
    min-height: 60px;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) 46px;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(17, 24, 31, 0.98);
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.file-viewer-header-button {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 10px;
    background: rgba(255,255,255,.08);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.file-viewer-heading {
    min-width: 0;
    text-align: center;
}

.file-viewer-heading strong,
.file-viewer-heading small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-viewer-heading strong {
    font-size: 14px;
}

.file-viewer-heading small {
    margin-top: 3px;
    color: #aab4bd;
    font-size: 10px;
}

.file-viewer-image-area {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.file-viewer-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(45deg, rgba(255,255,255,.025) 25%, transparent 25%) 0 0/24px 24px,
        linear-gradient(-45deg, rgba(255,255,255,.025) 25%, transparent 25%) 0 12px/24px 24px,
        #0d1319;
    touch-action: none;
    user-select: none;
}

.file-viewer-stage img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transform-origin: center center;
    will-change: transform;
    transition: transform 80ms linear;
    -webkit-user-drag: none;
    user-select: none;
}

.file-viewer-toolbar {
    flex: 0 0 auto;
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    background: #11181f;
    border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.file-viewer-toolbar button {
    min-width: 42px;
    height: 40px;
    border: 0;
    border-radius: 9px;
    padding: 0 12px;
    background: rgba(255,255,255,.10);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.file-viewer-toolbar button:disabled {
    opacity: .4;
    cursor: default;
}

.file-viewer-toolbar span {
    min-width: 62px;
    text-align: center;
    color: #dbe1e6;
    font-size: 12px;
    font-weight: 700;
}

.file-viewer-file-area {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 28px 20px;
    overflow: auto;
    text-align: center;
    background: #f6f8fa;
    color: #1f2933;
}

.file-viewer-file-icon {
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: #e8edf1;
    color: #27333d;
    font-size: 28px;
    font-weight: 800;
}

.file-viewer-file-area h3 {
    max-width: 620px;
    margin: 4px 0 0;
    overflow-wrap: anywhere;
}

.file-viewer-file-area p {
    max-width: 620px;
    margin: 0;
    color: #69747e;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.file-viewer-download {
    width: min(100%, 360px);
    margin-top: 8px;
}

.file-viewer-loading {
    flex: 1 1 auto;
    display: grid;
    place-content: center;
    gap: 12px;
    text-align: center;
    background: #11181f;
    color: #dbe1e6;
}

.file-viewer-loading p {
    margin: 0;
}

#fileViewerError {
    position: absolute;
    left: 50%;
    bottom: calc(18px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: min(calc(100% - 30px), 620px);
    z-index: 2;
}

@media (max-width: 640px) {
    .file-viewer-header {
        grid-template-columns: 42px minmax(0, 1fr) 42px;
        min-height: 56px;
        padding: 6px 8px;
    }

    .file-viewer-header-button {
        width: 38px;
        height: 38px;
    }

    .file-viewer-toolbar {
        gap: 7px;
    }

    .file-viewer-toolbar button {
        min-width: 40px;
        height: 38px;
        padding: 0 10px;
    }
}
