:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --border: #d8dee9;
    --text: #1f2937;
    --muted: #6b7280;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --success: #15803d;
    --danger: #b91c1c;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
    min-height: 100vh;
    padding: 0 0 32px 0;
}
.app-header {
    margin: 0 auto 28px;
}

.app-nav {
    display: flex;
    align-items: center;
    justify-content: end;
    gap: 18px;
    padding: 10px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.app-brand,
.app-nav-link {
    text-decoration: none;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 4px 10px 4px 4px;
    color: var(--text);
    font-weight: 800;
}

.app-brand:hover {
    color: var(--text);
}

.app-brand-mark {
    display: inline-grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.24);
}

.app-brand-text {
    white-space: nowrap;
}

.app-nav-list {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px;
    margin: 0;
    list-style: none;
    border-radius: 999px;
    background: #e5edff;
}

.app-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    color: #1741a6;
    font-weight: 700;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.app-nav-link:hover,
.app-nav-link.active {
    background: var(--panel);
    color: var(--text);
}

.app-nav-link.active {
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.12);
}

.wrap {
    max-width: 860px;
    margin: 0 auto;
}

h1 {
    margin: 0 0 8px;
    font-size: 24px;
    line-height: 1.15;
}

.intro {
    margin: 0 0 28px;
    color: var(--muted);
    font-size: 16px;
}

.card {
    background: var(--panel);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 18px;
}

    .card h2 {
        margin: 0 0 8px;
        font-size: 22px;
    }

    .card p {
        margin: 0 0 18px;
        color: var(--muted);
        line-height: 1.5;
    }

form {
    display: grid;
    gap: 14px;
}

.row {
    display: grid;
    grid-template-columns: 1fr 180px 120px;
    gap: 12px;
    align-items: end;
}

    .row.single {
        grid-template-columns: 1fr 120px;
    }

label {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

input,
select,
button,
.output {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 16px;
    min-height: 48px;
}

input,
select {
    padding: 12px 14px;
    color: var(--text);
    background: #fff;
}

    input:focus,
    select:focus {
        outline: 2px solid rgba(37, 99, 235, 0.15);
        border-color: var(--accent);
    }

button {
    cursor: pointer;
    border: none;
    padding: 12px 16px;
    font-weight: 700;
    background: var(--accent);
    color: #fff;
    transition: background 0.15s ease;
}

    button:hover {
        background: var(--accent-hover);
    }

    button.secondary {
        background: #e5edff;
        color: #1741a6;
        border: 1px solid #c7d6ff;
    }

        button.secondary:hover {
            background: #dbe7ff;
        }

    button:disabled {
        cursor: not-allowed;
        opacity: 0.55;
    }

.result-wrap {
    display: grid;
    grid-template-columns: 1fr 140px;
    gap: 12px;
    align-items: start;
}

.output {
    padding: 14px 16px;
    background: #f8fafc;
    line-height: 1.5;
    border-style: dashed;
    display: flex;
    align-items: center;
    word-break: break-word;
}

.status {
    min-height: 20px;
    font-size: 14px;
    color: var(--muted);
}

    .status.success {
        color: var(--success);
    }

    .status.error {
        color: var(--danger);
    }

.hint {
    font-size: 13px;
    color: var(--muted);
    margin-top: -4px;
}

@media (max-width: 720px) {
    .app-header {
        margin-bottom: 20px;
    }

    .app-nav {
        align-items: stretch;
        flex-direction: column;
    }

    .app-brand {
        justify-content: center;
    }

    .app-nav-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .app-nav-link {
        padding: 0 10px;
        text-align: center;
    }

    .row,
    .row.single,
    .result-wrap {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 22px;
    }

    .card {
        padding: 18px;
    }
}
/*dokumenty*/
.documents-page.wrap {
    max-width: 1440px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 22px;
}

.document-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 22px;
    align-items: stretch;
}

.card.is-secondary {
    box-shadow: none;
    background: rgba(255, 255, 255, 0.72);
}

.card.is-primary {
    border-color: rgba(37, 99, 235, 0.28);
    box-shadow: 0 18px 45px rgba(37, 99, 235, 0.12);
}

.section-heading,
.identity-summary {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

    .section-heading p,
    .subsection-heading p,
    .identity-summary p,
    .hint,
    .status {
        margin: 0;
        color: var(--muted);
        line-height: 1.5;
    }

.eyebrow {
    display: inline-flex;
    margin-bottom: 6px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.document-source {
    display: grid;
    gap: 18px;
}

.mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 5px;
    border-radius: 999px;
    background: #e5edff;
    min-width: 310px;
}

    .mode-switch button {
        min-height: 42px;
        border-radius: 999px;
        background: transparent;
        color: #1741a6;
        box-shadow: none;
    }

        .mode-switch button:hover,
        .mode-switch button.active {
            background: var(--panel);
            color: var(--text);
        }

.source-panel {
    padding-top: 4px;
}

.subsection-heading {
    margin-bottom: 12px;
}

    .subsection-heading h3 {
        margin: 0 0 3px;
        font-size: 17px;
    }

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

.template-button {
    min-height: 104px;
    padding: 14px;
    text-align: left;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #f8fafc;
    color: var(--text);
    box-shadow: none;
}

    .template-button:hover,
    .template-button.active {
        background: #e5edff;
        border-color: #93b4ff;
        color: var(--text);
        transform: translateY(-1px);
    }

    .template-button strong,
    .template-button span {
        display: block;
    }

    .template-button strong {
        margin-bottom: 5px;
        font-size: 14px;
    }

    .template-button span {
        color: var(--muted);
        font-size: 13px;
        font-weight: 500;
        line-height: 1.35;
    }

.field-block {
    display: block;
}

.compact-select {
    margin-top: 14px;
    max-width: 420px;
}

.upload-box {
    display: none;
}

    .upload-box.active {
        display: block;
    }

.dropzone {
    display: grid;
    min-height: 150px;
    place-items: center;
    border: 1px dashed #9aa9c3;
    border-radius: 14px;
    background: #f8fafc;
    color: var(--muted);
    text-align: center;
    cursor: pointer;
}

    .dropzone:hover {
        border-color: var(--accent);
        background: #eef4ff;
    }

.identity-count {
    flex: 0 0 auto;
    padding: 7px 10px;
    border-radius: 999px;
    background: #e5edff;
    color: #1741a6;
    font-size: 13px;
    font-weight: 700;
}

.identity-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.identity-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f8fafc;
    overflow: hidden;
}

    .identity-card.requires-lookup,
    .identity-card.requires-manual {
        border-color: rgba(37, 99, 235, 0.35);
    }

.identity-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
}

    .identity-head h3 {
        margin: 0 0 4px;
        font-size: 18px;
    }

    .identity-head p {
        margin: 0;
        color: var(--muted);
        font-size: 13px;
        line-height: 1.4;
    }

.identity-type {
    flex: 0 0 auto;
    padding: 6px 9px;
    border: 1px solid #c7d6ff;
    border-radius: 999px;
    background: #e5edff;
    color: #1741a6;
    font-size: 12px;
    font-weight: 700;
}

.identity-fields {
    display: grid;
    gap: 14px;
    padding: 18px;
}

.interaction-box {
    padding: 14px;
    border: 1px solid rgba(37, 99, 235, 0.28);
    border-radius: 14px;
    background: #eef4ff;
}

.ares-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 170px;
    gap: 12px;
    align-items: end;
}

.ico-field input {
    min-height: 58px;
    font-size: 20px;
    font-weight: 750;
    letter-spacing: 0.06em;
}

.ares-button {
    min-height: 58px;
}

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

    .readonly-grid .wide,
    .manual-grid .wide {
        grid-column: 1 / -1;
    }

    .readonly-grid input,
    .readonly-grid textarea {
        background: #f3f4f6;
        color: #4b5563;
    }

textarea {
    width: 100%;
    min-height: 86px;
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 12px 14px;
    color: var(--text);
    background: #fff;
    font: inherit;
    resize: vertical;
}

    textarea:focus {
        outline: 2px solid rgba(37, 99, 235, 0.15);
        border-color: var(--accent);
    }

.page-header .intro,
.identity-head p,
.card.is-secondary p,
.muted-heading h3,
.muted-heading p {
    color: var(--muted);
}

.field-block,
.ico-field,
.manual-grid label,
.ares-row label {
    color: var(--text);
    font-weight: 750;
}

.readonly-panel {
    padding: 16px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 14px;
    background: rgba(248, 250, 252, 0.72);
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

    .readonly-panel label {
        color: #4b5563;
        font-weight: 650;
    }

    .readonly-panel.is-filled {
        border-color: rgba(21, 128, 61, 0.38);
        background: #f0fdf4;
        box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.08);
    }

        .readonly-panel.is-filled input,
        .readonly-panel.is-filled textarea {
            border-color: rgba(21, 128, 61, 0.32);
            background: #ffffff;
            color: var(--text);
        }

.interaction-box.is-loading {
    border-color: rgba(148, 163, 184, 0.35);
    background: #f8fafc;
    box-shadow: none;
}

    .interaction-box.is-loading .ico-field input,
    .interaction-box.is-filled .ico-field input {
        border-color: var(--border);
        background: #f8fafc;
        color: #64748b;
        box-shadow: none;
    }

        .interaction-box.is-loading .ico-field input:focus,
        .interaction-box.is-filled .ico-field input:focus {
            outline: none;
            border-color: var(--border);
        }

.statutory-panel textarea {
    min-height: 112px;
}

.actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

    .actions .download {
        max-width: 240px;
    }

.hidden {
    display: none !important;
}

@media (max-width: 1060px) {
    .template-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .section-heading,
    .identity-summary,
    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .mode-switch {
        min-width: 0;
        width: 100%;
    }

    .template-grid,
    .manual-grid,
    .readonly-grid,
    .ares-row {
        grid-template-columns: 1fr;
    }

    .actions .download {
        max-width: none;
    }
}

/* dokumenty: kompaktní krok 2 + ARES */
.identities-card {
    padding: 20px;
}

.identity-list {
    gap: 12px;
}

.identity-card {
    background: rgba(248, 250, 252, 0.82);
}

.identity-head {
    padding: 12px 16px;
    align-items: center;
}

    .identity-head h3 {
        font-size: 16px;
    }

.identity-fields {
    gap: 10px;
    padding: 12px 14px 14px;
}

    .identity-fields input,
    .identity-fields textarea,
    .identity-fields button {
        min-height: 40px;
        border-radius: 10px;
        font-size: 14px;
    }

.interaction-box {
    padding: 12px;
}

.ares-row {
    grid-template-columns: minmax(170px, 260px) 140px;
}

.ico-field input {
    min-height: 42px;
    font-size: 16px;
    font-weight: 750;
}

.ares-button {
    min-height: 42px;
    padding: 10px 12px;
}

.manual-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

    .manual-grid .wide {
        grid-column: span 2;
    }

.readonly-panel {
    padding: 12px;
}

.readonly-summary {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 10px;
}

    .readonly-summary strong,
    .readonly-summary span {
        display: block;
    }

    .readonly-summary strong {
        font-size: 14px;
    }

    .readonly-summary span {
        max-width: 680px;
        color: var(--muted);
        font-size: 12px;
        line-height: 1.4;
    }

.readonly-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

    .readonly-grid label {
        font-size: 12px;
        margin: 0;
    }

    .readonly-grid .col-3 {
        grid-column: span 3;
    }

    .readonly-grid .col-4 {
        grid-column: span 4;
    }

    .readonly-grid .wide {
        grid-column: 1 / -1;
    }

    .readonly-grid input,
    .readonly-grid textarea {
        margin-top: 5px;
        background: #f8fafc;
        color: #64748b;
    }

.readonly-panel.is-filled label.has-value input,
.readonly-panel.is-filled label.has-value textarea {
    border-color: rgba(21, 128, 61, 0.34);
    background: #ffffff;
    color: var(--text);
}

.readonly-panel.is-filled label:not(.has-value) input,
.readonly-panel.is-filled label:not(.has-value) textarea {
    border-style: dashed;
    background: #f8fafc;
    color: #94a3b8;
}

.ares-lookup-panel.is-loading,
.ares-lookup-panel.is-filled {
    border-color: rgba(148, 163, 184, 0.34);
    background: #f8fafc;
    box-shadow: none;
}

    .ares-lookup-panel.is-loading .ico-field input,
    .ares-lookup-panel.is-filled .ico-field input {
        border-color: var(--border);
        background: #f1f5f9;
        color: #64748b;
        box-shadow: none;
    }

        .ares-lookup-panel.is-loading .ico-field input:focus,
        .ares-lookup-panel.is-filled .ico-field input:focus {
            outline: none;
            border-color: var(--border);
        }

.statutory-panel {
    margin-top: -2px;
}

.statutory-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
}

.statutory-card {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 8px;
    align-items: start;
    min-height: auto;
    margin: 0;
    padding: 10px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    font-weight: 500;
}

    .statutory-card input {
        width: 16px;
        min-height: 16px;
        margin: 2px 0 0;
    }

    .statutory-card strong,
    .statutory-card small,
    .statutory-card em {
        display: block;
    }

    .statutory-card strong {
        margin-bottom: 2px;
        font-size: 14px;
    }

    .statutory-card small,
    .statutory-card em {
        color: var(--muted);
        font-size: 12px;
        line-height: 1.35;
    }

    .statutory-card em {
        margin-top: 4px;
        font-style: normal;
    }

    .statutory-card.selected {
        border-color: rgba(21, 128, 61, 0.48);
        background: #f0fdf4;
        box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.08);
    }

.statutory-empty {
    padding: 10px 12px;
    border: 1px dashed rgba(148, 163, 184, 0.6);
    border-radius: 12px;
    background: #f8fafc;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 1060px) {
    .manual-grid,
    .readonly-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

        .manual-grid .wide,
        .readonly-grid .col-3,
        .readonly-grid .col-4,
        .readonly-grid .wide {
            grid-column: 1 / -1;
        }
}

@media (max-width: 720px) {
    .identity-head,
    .readonly-summary {
        flex-direction: column;
        align-items: stretch;
    }

    .manual-grid,
    .readonly-grid,
    .ares-row,
    .statutory-list {
        grid-template-columns: 1fr;
    }
}

/* dokumenty: mobilni zobrazeni */
@media (max-width: 720px) {
    body {
        padding: 12px 6px;
    }

    .documents-page.wrap {
        width: 100%;
        max-width: none;
    }

    .documents-page .page-header {
        gap: 10px;
        margin-bottom: 12px;
    }

    .documents-page .intro {
        margin-bottom: 14px;
        font-size: 14px;
        line-height: 1.45;
    }

    .documents-page .card {
        padding: 12px 10px;
        margin-bottom: 12px;
        border-radius: 14px;
    }

    .documents-page .identities-card {
        padding: 10px 8px;
    }

    .documents-page .section-heading,
    .documents-page .identity-summary {
        gap: 8px;
        margin-bottom: 12px;
    }

        .documents-page .section-heading h2,
        .documents-page .card h2 {
            font-size: 19px;
        }

    .documents-page .identity-count {
        align-self: flex-start;
        padding: 5px 8px;
        font-size: 12px;
    }

    .documents-page .template-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .documents-page .template-button {
        min-height: 84px;
        padding: 10px;
        border-radius: 12px;
    }

        .documents-page .template-button strong {
            font-size: 13px;
        }

        .documents-page .template-button span {
            font-size: 12px;
            line-height: 1.3;
        }

    .documents-page .identity-list {
        gap: 8px;
    }

    .documents-page .identity-card {
        border-radius: 12px;
    }

    .documents-page .identity-head {
        flex-direction: row;
        align-items: flex-start;
        gap: 8px;
        padding: 9px 10px;
    }

        .documents-page .identity-head h3 {
            font-size: 15px;
        }

        .documents-page .identity-head p {
            font-size: 12px;
            line-height: 1.35;
        }

    .documents-page .identity-type {
        padding: 4px 7px;
        font-size: 11px;
        white-space: nowrap;
    }

    .documents-page .identity-fields {
        gap: 8px;
        padding: 9px 8px 10px;
    }

    .documents-page .interaction-box,
    .documents-page .readonly-panel {
        padding: 9px 8px;
        border-radius: 12px;
    }

    .documents-page .ares-row {
        grid-template-columns: minmax(0, 1fr) minmax(112px, 132px);
        gap: 8px;
    }

    .documents-page .manual-grid,
    .documents-page .readonly-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

        .documents-page .manual-grid .wide,
        .documents-page .readonly-grid .wide,
        .documents-page .readonly-grid .col-3,
        .documents-page .readonly-grid .col-4 {
            grid-column: 1 / -1;
        }

        .documents-page label,
        .documents-page .readonly-grid label {
            font-size: 12px;
            margin-bottom: 4px;
        }

    .documents-page .identity-fields input,
    .documents-page .identity-fields textarea,
    .documents-page .identity-fields button,
    .documents-page input,
    .documents-page select,
    .documents-page button {
        min-height: 39px;
        border-radius: 10px;
        font-size: 14px;
    }

    .documents-page input,
    .documents-page select,
    .documents-page textarea {
        padding: 9px 10px;
    }

    .documents-page textarea {
        min-height: 72px;
    }

    .documents-page .ico-field input,
    .documents-page .ares-button {
        min-height: 43px;
    }

    .documents-page .ico-field input {
        font-size: 17px;
    }

    .documents-page .readonly-summary {
        gap: 4px;
        margin-bottom: 8px;
    }

        .documents-page .readonly-summary strong {
            font-size: 13px;
        }

        .documents-page .readonly-summary span {
            font-size: 12px;
        }

    .documents-page .statutory-panel {
        margin-top: 0;
    }

    .documents-page .statutory-list {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .documents-page .statutory-card {
        padding: 8px;
        border-radius: 10px;
    }

    .documents-page .actions {
        position: sticky;
        bottom: 0;
        z-index: 20;
        gap: 8px;
        margin: 12px -10px -12px;
        padding: 8px 10px 10px;
        border-top: 1px solid rgba(148, 163, 184, 0.35);
        background: rgba(255, 255, 255, 0.94);
        backdrop-filter: blur(10px);
    }

        .documents-page .actions .download {
            max-width: none;
        }
}

@media (max-width: 420px) {
    body {
        padding: 8px 4px;
    }

    .documents-page .card {
        padding: 10px 8px;
    }

    .documents-page .identities-card {
        padding: 8px 6px;
    }

    .documents-page .identities-card {
        padding: 8px 6px;
    }

    .documents-page .identity-card {
        border: none;
        padding: 0;
    }

    .documents-page .template-grid {
        grid-template-columns: 1fr;
    }

    .documents-page .identity-head {
        flex-direction: column;
        align-items: stretch;
    }

    .documents-page .identity-type {
        align-self: flex-start;
    }

    .documents-page .ares-row,
    .documents-page .manual-grid,
    .documents-page .readonly-grid {
        grid-template-columns: 1fr;
    }

    .documents-page .actions {
        margin-right: -8px;
        margin-left: -8px;
    }
}

