:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --panel-muted: #f8fafc;
    --border: #d8dee9;
    --text: #1f2937;
    --muted: #6b7280;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft: #e5edff;
    --success: #15803d;
    --success-soft: #f0fdf4;
    --danger: #b91c1c;
    --danger-soft: #fef2f2;
    --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, var(--panel-muted) 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-nav-link {
    text-decoration: none;
}

.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: 1440px;
    margin: 0 auto;
}

.documents-page .document-template-workspace {
    display: grid;
    gap: 18px;
}

.documents-page .document-form {
    display: grid;
    gap: 0;
}

.documents-page .document-form > .card {
    margin-bottom: 18px;
}

.documents-page .document-entity-card {
    padding: 0;
    overflow: hidden;
}

.documents-page .document-form .identity-head h3 {
    margin: 0;
}

.documents-page .document-form textarea {
    min-height: 112px;
}

.documents-page .document-form .readonly-grid textarea {
    min-height: 82px;
    resize: none;
    overflow: hidden;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.documents-page .compact-actions {
    margin-top: 12px;
}

.documents-page .compact-actions button {
    width: auto;
    min-width: 190px;
}

.documents-page .inline-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
}

.documents-page .inline-checkbox input {
    width: 16px;
    min-height: 16px;
    margin: 0;
}

.documents-page .choice-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.documents-page .choice-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: auto;
    min-height: 38px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.documents-page .choice-pill.is-active {
    border-color: rgba(21, 128, 61, 0.48);
    background: #ecfdf5;
    color: #166534;
}

.documents-page .choice-pill input {
    width: 14px;
    min-height: 14px;
    margin: 0;
}

.documents-page .person-inflection-divider {
    display: block;
    grid-column: 1 / -1;
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px solid rgba(148, 163, 184, 0.3);
}

.documents-page .person-inflection-divider .choice-list {
    margin-top: 0;
}

.documents-page .control-groups {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.documents-page .control-label {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.documents-page .instrumental-field {
    display: block;
    margin-top: 10px;
}

.documents-page .instrumental-field input {
    margin-top: 5px;
}

.documents-page .person-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.3);
}

.documents-page .person-text-fill {
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    background: #fff;
}

.documents-page .person-text-fill summary {
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.documents-page .person-text-fill-body {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.documents-page .person-parse-actions {
    margin-top: 0;
    padding-top: 8px;
    border-top: 0;
}

.documents-page .combobox-control {
    position: relative;
    display: block;
}

.documents-page .combobox-control input {
    padding-right: 42px;
}

.documents-page .combobox-arrow {
    position: absolute;
    top: 50%;
    right: 16px;
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    pointer-events: none;
    transform: translateY(-65%) rotate(45deg);
}

.documents-page .person-entry-list {
    gap: 14px;
}

.documents-page .person-entry {
    display: grid;
    gap: 7px;
}

.documents-page .person-entry + .person-entry {
    padding-top: 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.35);
}

.documents-page .person-entry-title {
    color: var(--text);
    font-size: 14px;
    font-weight: 650;
}

.documents-page .calculated-field .control-label {
    margin-bottom: 5px;
}

.documents-page .calculation-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.documents-page .calculation-control input {
    min-width: 0;
    margin: 0;
}

.documents-page .calculation-control .calculation-button {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    padding: 0 10px;
    font-size: 12px;
}

.documents-page .compact-select {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.documents-page .compact-select select {
    min-width: 210px;
    min-height: 38px;
}

input:required:invalid:not(:disabled):not([type="radio"]):not([type="checkbox"]),
textarea:required:invalid:not(:disabled),
select:required:invalid:not(:disabled) {
    border-color: rgba(217, 119, 6, 0.48);
    background-color: rgba(255, 251, 235, 0.72);
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.07);
}

.choice-pill:has(input:required:invalid) {
    border-color: rgba(217, 119, 6, 0.38);
    background-color: rgba(255, 251, 235, 0.68);
}

input:required:invalid:focus,
textarea:required:invalid:focus,
select:required:invalid:focus {
    border-color: var(--accent);
    background-color: #fff;
}

.documents-page .person-option-group {
    min-width: 0;
    padding: 10px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.72);
}

.documents-page .person-option-group .choice-list {
    margin-top: 8px;
}

.documents-page .person-declension .instrumental-field {
    margin-top: 0;
}

.documents-page .no-inflection-option {
    margin-top: 8px;
}

.documents-page .instrumental-field.is-disabled {
    opacity: 0.55;
}

.documents-page .share-parts-list {
    display: grid;
    gap: 8px;
}

.documents-page .owner-holdings {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 2px solid rgba(124, 58, 237, 0.2);
}

.documents-page .share-part-row {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
}

.documents-page .share-part-row-title {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.documents-page .statutory-panel {
    margin-top: 0;
}

.documents-page .statutory-card {
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

h1 {
    margin: 0 0 8px;
    font-size: 24px;
    line-height: 1.15;
}

.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: 17px;
}

.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,
.button-link,
.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,
.button-link {
    cursor: pointer;
    border: none;
    padding: 12px 16px;
    font-weight: 700;
    background: var(--accent);
    color: #fff;
    transition: background 0.15s ease;
}

    button.button-danger {
        border: 1px solid #fecaca;
        background: var(--danger-soft);
        color: #991b1b;
    }

        button.button-danger:hover {
            background: #fee2e2;
        }

    button.button-compact {
        width: auto;
        min-width: 2rem;
        min-height: 2rem;
        padding: 0.25rem 0.5rem;
        font-size: 0.78rem;
    }

    button:hover,
    .button-link:hover {
        background: var(--accent-hover);
    }

    button.secondary {
        background: var(--accent-soft);
        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: var(--panel-muted);
    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;
}

.muted {
    color: var(--muted);
    font-size: 0.84rem;
}

.text-danger {
    color: var(--danger);
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.button-link:hover {
    background: var(--accent-hover);
    color: #fff;
}

.file-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
    font-weight: 700;
}

.file-pill small {
    flex: 0 0 auto;
    font-weight: 500;
}

@media (max-width: 720px) {
    .app-header {
        margin-bottom: 20px;
    }

    .app-nav {
        align-items: stretch;
        flex-direction: column;
    }

    .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;
    }
}
/* Documents */

.page-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 22px;
}

.card.is-primary {
    border-color: rgba(37, 99, 235, 0.28);
    box-shadow: 0 18px 45px rgba(37, 99, 235, 0.12);
}

.section-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

    .section-heading 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;
}

.selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 320px));
    gap: 10px;
}

.selection-tile {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 104px;
    flex-direction: column;
    justify-content: center;
    padding: 14px;
    text-align: left;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel-muted);
    color: var(--text);
    box-shadow: none;
    cursor: pointer;
}

    .selection-tile:hover,
    .selection-tile.active,
    .selection-tile:has(input:checked) {
        background: var(--accent-soft);
        border-color: #93b4ff;
        color: var(--text);
        transform: translateY(-1px);
    }

    .selection-tile:has(input:focus-visible) {
        outline: 3px solid rgba(37, 99, 235, 0.24);
        outline-offset: 2px;
    }

    .selection-tile > input[type="radio"] {
        position: absolute;
        width: 1px;
        height: 1px;
        min-height: 1px;
        opacity: 0;
        pointer-events: none;
    }

    .selection-tile strong,
    .selection-tile span {
        display: block;
    }

    .selection-tile strong {
        margin-bottom: 5px;
        font-size: 14px;
    }

    .selection-tile span {
        color: var(--muted);
        font-size: 13px;
        font-weight: 500;
        line-height: 1.35;
    }

.dropzone {
    display: grid;
    min-height: 120px;
    place-items: center;
    border: 1px dashed #9aa9c3;
    border-radius: 14px;
    background-color: #e7f3ff;
    color: var(--muted);
    text-align: center;
    cursor: pointer;
}

.dropzone:hover {
    border-color: var(--accent);
    background: #84d7ff;
    color: #333;
}

.is-invalid .dropzone {
    border-color: var(--danger);
    background: var(--danger-soft);
}

.identity-count {
    flex: 0 0 auto;
    padding: 7px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: #1741a6;
    font-size: 13px;
    font-weight: 700;
}

.identity-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(248, 250, 252, 0.82);
    overflow: hidden;
}

.identity-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
}

    .identity-head h3 {
        margin: 0 0 4px;
        font-size: 16px;
    }

    .identity-head p {
        margin: 0;
        color: var(--muted);
        font-size: 13px;
        line-height: 1.4;
    }

.identity-fields {
    display: grid;
    gap: 10px;
    padding: 12px 14px 14px;
}

    .identity-fields input,
    .identity-fields textarea,
    .identity-fields button {
        min-height: 40px;
        border-radius: 10px;
        font-size: 14px;
    }

.data-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 8px;
}

    .data-grid > label {
        margin: 0;
        color: var(--muted);
        font-size: 12px;
        font-weight: 600;
    }

    .data-grid > label > input,
    .data-grid > label > textarea {
        margin-top: 5px;
        color: var(--text);
        font-weight: 500;
    }

    .data-grid .col-1 {
        grid-column: span 1;
    }

    .data-grid .col-2 {
        grid-column: span 2;
    }

    .data-grid .col-3 {
        grid-column: span 3;
    }

    .data-grid .col-4 {
        grid-column: span 4;
    }

    .data-grid .col-5 {
        grid-column: span 5;
    }

    .data-grid .col-6 {
        grid-column: span 6;
    }

    .data-grid .wide {
        grid-column: 1 / -1;
    }

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);
    }

.identity-head p {
    color: var(--muted);
}

.subject-panel {
    padding: 12px;
    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;
}

.identity-card.is-filled,
.subject-panel.is-filled {
    border-color: rgba(21, 128, 61, 0.38);
    background: var(--success-soft);
    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);
        }

.actions {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.hidden {
    display: none !important;
}

.stats-page .stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.stats-page .stats-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel-muted);
}

.stats-page .stats-card h2 {
    margin: 0 0 12px;
    font-size: 17px;
}

.stats-page dl {
    display: grid;
    gap: 8px;
    margin: 0;
}

.stats-page dl div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: baseline;
}

.stats-page dt {
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.stats-page dd {
    margin: 0;    
    font-weight: 600;
}

.stats-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
}

.stats-table th,
.stats-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
}

.stats-table th:first-child,
.stats-table td:first-child {
    text-align: left;
}

.stats-table thead th {
    font-size: 13px;
}

@media (max-width: 1060px) {
    .stats-page .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .data-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .data-grid .wide {
        grid-column: 1 / -1;
    }

    .data-grid .col-4,
    .data-grid .col-5,
    .data-grid .col-6 {
        grid-column: span 3;
    }
}

@media (max-width: 720px) {
    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-page .stats-grid {
        grid-template-columns: 1fr;
    }

}

.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;
        font-weight: 700;
    }

    .readonly-summary span {
        max-width: 680px;
        color: var(--muted);
        font-size: 12px;
        line-height: 1.4;
    }

    .readonly-grid input,
    .readonly-grid textarea {
        background: var(--panel-muted);
        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: var(--panel-muted);
    color: #94a3b8;
}

.statutory-panel {
    margin-top: -2px;
}

.statutory-list {
    display: grid;
    grid-template-columns: 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 .readonly-summary {
        margin-bottom: 7px;
    }

    .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: var(--success-soft);
        box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.08);
    }

/* Documents: mobile */
@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 .card {
        padding: 12px 10px;
        margin-bottom: 12px;
        border-radius: 14px;
    }

    .documents-page .section-heading {
        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 .selection-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .documents-page .selection-tile {
        min-height: 84px;
        padding: 10px;
        border-radius: 12px;
    }

        .documents-page .selection-tile strong {
            font-size: 13px;
        }

    .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-fields {
        gap: 8px;
        padding: 9px 8px 10px;
    }

    .documents-page .subject-panel {
        padding: 9px 8px;
        border-radius: 12px;
    }

    .documents-page .data-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .documents-page .person-options {
        grid-template-columns: 1fr;
    }

    .documents-page .compact-select {
        width: 100%;
        flex-wrap: wrap;
    }

    .documents-page .compact-select select {
        width: 100%;
        min-width: 0;
    }

        .documents-page .data-grid .wide,
        .documents-page .data-grid .col-1,
        .documents-page .data-grid .col-2,
        .documents-page .data-grid .col-3,
        .documents-page .data-grid .col-4,
        .documents-page .data-grid .col-5,
        .documents-page .data-grid .col-6 {
            grid-column: 1 / -1;
        }

    .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 .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 .document-form .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 .compact-actions button {
        width: 100%;
    }

}

@media (max-width: 420px) {
    body {
        padding: 8px 4px;
    }

    .documents-page .card {
        padding: 10px 8px;
    }

    .documents-page .identity-card {
        border: none;
        padding: 0;
    }

    .documents-page .selection-grid {
        grid-template-columns: 1fr;
    }

    .documents-page .identity-head {
        flex-direction: column;
        align-items: stretch;
    }

    .documents-page .data-grid {
        grid-template-columns: 1fr;
    }

    .documents-page .document-form .actions {
        margin-right: -8px;
        margin-left: -8px;
    }
}

/* StrojOrig */
.notarial-upload-page {
    max-width: 68rem;
}

.notarial-upload-page .upload-form {
    margin-bottom: 0;
}

.notarial-upload-page .form-content {
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.notarial-upload-page .upload-form.is-processing .form-content {
    opacity: 0.42;
    filter: grayscale(0.75);
    pointer-events: none;
    user-select: none;
}

.notarial-upload-page .upload-form.has-results .form-content {
    opacity: 0.58;
    filter: saturate(0.55);
}

.notarial-upload-page .upload-form.has-results .form-content:focus-within,
.notarial-upload-page .upload-form.has-results .form-content:hover {
    opacity: 0.82;
    filter: saturate(0.8);
}

.notarial-upload-page .upload-description {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 0.15rem;
}

.notarial-upload-page .upload-list {
    display: grid;
    gap: 0.75rem;
}

.notarial-upload-page .upload-row {
    display: grid;
    grid-template-columns: minmax(7rem, 0.3fr) minmax(15rem, 1fr) minmax(10rem, 1fr);
    gap: 1rem;
    align-items: center;
    padding: 0.9rem 1rem;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.notarial-upload-page .file-preview {
    display: grid;
    gap: 0.4rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.notarial-upload-page .file-preview-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
    align-items: center;
}

.notarial-upload-page .form-message {
    padding: 0.75rem 0.9rem;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: var(--danger-soft);
    color: #991b1b;
    white-space: pre-wrap;
}

.notarial-upload-page .process-area {
    display: grid;
    gap: 1rem;
    margin-top: 1.4rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.notarial-upload-page .process-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
}

.notarial-upload-page .process-heading h2 {
    margin: 0.15rem 0 0;
    font-size: 1.2rem;
}

.notarial-upload-page .process-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.notarial-upload-page .output-option {
    min-height: 4.5rem;
    padding: 0.75rem 0.85rem;
}

.notarial-upload-page .option-label {
    display: block;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.notarial-upload-page .converter-control {
    display: grid;
    grid-template-columns: minmax(7rem, 0.55fr) minmax(10rem, 1fr);
    align-items: center;
    gap: 0.75rem;
}

.notarial-upload-page .select-control {
    position: relative;
}

.notarial-upload-page .select-control::after {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    color: #475569;
    content: "⌄";
    pointer-events: none;
    transform: translateY(-55%);
}

.notarial-upload-page .converter-control select {
    min-height: 2.65rem;
    padding: 0.55rem 2.1rem 0.55rem 0.75rem;
    border-radius: 7px;
    background: #fff;
    font-size: 0.9rem;
    font-weight: 650;
    appearance: none;
}

.notarial-upload-page .process-status {
    text-align: right;
}

.notarial-upload-page .toggle-control {
    display: inline-flex;
    align-items: center;
    justify-content: end;
    gap: 0.65rem;
    cursor: pointer;
}

.notarial-upload-page .toggle-control input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.notarial-upload-page .toggle-switch {
    position: relative;
    flex: 0 0 auto;
    width: 2.6rem;
    height: 1.45rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #cbd5e1;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.notarial-upload-page .toggle-switch::after {
    position: absolute;
    top: 0.16rem;
    left: 0.16rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.28);
    content: "";
    transition: transform 0.15s ease;
}

.notarial-upload-page .toggle-control input:checked + .toggle-switch {
    border-color: var(--accent);
    background: var(--accent);
}

.notarial-upload-page .toggle-control input:checked + .toggle-switch::after {
    transform: translateX(1.15rem);
}

.notarial-upload-page .toggle-control input:focus-visible + .toggle-switch {
    outline: 3px solid rgba(37, 99, 235, 0.24);
    outline-offset: 2px;
}

.notarial-upload-page .toggle-control input:disabled + .toggle-switch,
.notarial-upload-page .toggle-control:has(input:disabled) {
    cursor: not-allowed;
    opacity: 0.58;
}

.notarial-upload-page .process-submit {
    display: flex;
    justify-content: flex-end;
}

.notarial-upload-page .process-button {
    display: inline-flex;
    width: auto;
    min-width: 15rem;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
}

.notarial-upload-page .download-panel {
    display: grid;
    gap: 1.15rem;
    margin: 1.5rem -1px -1px;
    padding: 1.4rem;
    border: 1px solid rgba(21, 128, 61, 0.35);
    border-radius: 8px;
    background: var(--success-soft);
    box-shadow: 0 14px 32px rgba(21, 128, 61, 0.12);
}

.notarial-upload-page .download-panel:focus {
    outline: none;
}

.notarial-upload-page .result-warnings {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid #fbbf24;
    border-radius: 8px;
    background: #fffbeb;
    color: #713f12;
}

.notarial-upload-page .warning-mark {
    display: grid;
    width: 1.6rem;
    height: 1.6rem;
    place-items: center;
    border-radius: 50%;
    background: #d97706;
    color: #fff;
    font-weight: 800;
}

.notarial-upload-page .result-warnings ul {
    margin: 0.45rem 0 0;
    padding-left: 1.25rem;
    line-height: 1.7;
}

.notarial-upload-page .machine-readable-summary {
    display: grid;
    gap: 0.8rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}

.notarial-upload-page .machine-readable-summary header {
    color: var(--text);
}

.notarial-upload-page .machine-readable-additions {
    display: grid;
    gap: 0.55rem;
}

.notarial-upload-page .machine-readable-addition {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(12rem, 0.55fr);
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
}

.notarial-upload-page .machine-readable-addition:last-child {
    border-bottom: 0;
}

.notarial-upload-page .addition-source {
    overflow-wrap: anywhere;
    color: var(--muted);
    line-height: 1.45;
}

.notarial-upload-page .addition-arrow {
    color: var(--accent);
    font-size: 1.15rem;
    font-weight: 700;
}

.notarial-upload-page .addition-result {
    overflow-wrap: anywhere;
    color: var(--text);
    font-style: italic;
}

.notarial-upload-page .download-file {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 240px;
    min-height: 2.9rem;
    gap: 0.65rem;
}

.notarial-upload-page .download-file:hover {
    border-color: #93b0ff;
    background: #eef4ff;
    color: #12358a;
}

.notarial-upload-page .format-label {
    min-width: 3.15rem;
    max-width: fit-content;
    padding: 0.2rem 0.4rem;
    border-radius: 5px;
    background: var(--accent-soft);
    color: #1741a6;
    font-size: 0.7rem;
    font-weight: 800;
    text-align: center;
}

.notarial-upload-page .format-label.docx {
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
}

.notarial-upload-page .result-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 2.5rem;
    border-top: 1px solid rgba(21, 128, 61, 0.18);
}

.notarial-upload-page .download-actions {
    flex-direction: column;
    align-items: center;
    padding: 2rem 0 0.5rem;
}

.notarial-upload-page .restart-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 2.6rem;
    gap: 0.5rem;
    padding: 0.55rem 0.8rem;
}

@media (max-width: 780px) {
    .notarial-upload-page .machine-readable-addition {
        grid-template-columns: 1fr;
    }

    .notarial-upload-page .addition-arrow {
        transform: rotate(90deg);
        transform-origin: center;
        justify-self: start;
    }

    .notarial-upload-page .upload-row {
        grid-template-columns: 1fr;
        gap: 0.55rem;
    }

    .notarial-upload-page .process-status {
        text-align: left;
    }

    .notarial-upload-page .process-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .notarial-upload-page .process-options {
        grid-template-columns: 1fr;
    }

    .notarial-upload-page .converter-control {
        grid-template-columns: 1fr;
    }

    .notarial-upload-page .process-button,
    .notarial-upload-page .restart-button {
        width: 100%;
    }

    .notarial-upload-page .file-preview-item {
        grid-template-columns: 1fr;
    }
}
