* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: 'Segoe UI', sans-serif;
    background: #0d1015;
    color: #fff;
}

body {
    height: 100vh;
    overflow: hidden;
    display: flex;
    background: #0d1015;
}

button, input, textarea, select {
    font: inherit;
}

.hidden {
    display: none !important;
}

#auth-screen {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0d1015;
}

.auth-card {
    width: min(96vw, 24rem);
    background: #161920;
    padding: 2rem;
    border-radius: 0.75rem;
    border: 1px solid #1f2937;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.auth-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.05em;
    text-align: center;
}

.auth-input {
    width: 100%;
    background: #0a0c10;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    padding: 0.75rem 0.85rem;
    color: #fff;
}

.auth-input:focus,
.panel-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.auth-button {
    width: 100%;
    border: none;
    border-radius: 0.5rem;
    padding: 0.8rem 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

.auth-button.primary {
    background: #2563eb;
    color: white;
}

.auth-button.primary:hover {
    background: #3b82f6;
}

.auth-button.success {
    background: #16a34a;
    color: white;
}

.auth-button.success:hover {
    background: #22c55e;
}

.support-message {
    margin-top: 1.2rem;
    padding: 0.9rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(251, 191, 36, 0.45);
    background: rgba(120, 75, 20, 0.18);
    color: #fef3c7;
    text-align: center;
}

.password-error {
    margin-top: 0.6rem;
    color: #fecaca;
    font-size: 0.95rem;
    text-align: center;
}

.support-message strong {
    display: block;
    margin-bottom: 0.4rem;
    color: #fbbf24;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.support-message p {
    margin: 0;
    line-height: 1.5;
    font-size: 0.92rem;
}

/* Make inline links inside support-message visually fit the theme */
.support-message a {
    color: #ffd54d;
    background: rgba(255,213,77,0.08);
    padding: 2px 6px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 0 8px rgba(255,213,77,0.06);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.support-message a:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(255,213,77,0.12);
}

#main-app {
    width: 100%;
    height: 100%;
    display: flex;
}

.sidebar {
    width: 480px;
    min-width: 480px;
    background: #161920;
    height: 100%;
    overflow-y: auto;
    border-right: 1px solid #1f2937;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    color: #60a5fa;
    font-weight: 700;
    font-size: 1.25rem;
}

.panel {
    background: #111318;
    border: 1px solid #1f2937;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.field-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.35rem;
    color: #9ca3af;
}

.field-label.primary {
    color: #60a5fa;
    font-weight: 700;
}

.panel-input {
    width: 100%;
    background: #0a0c10;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    padding: 0.6rem 0.7rem;
    color: #fff;
}

textarea.panel-input {
    resize: vertical;
    min-height: 100px;
}

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

#dynamic-texts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.animated-box {
    transition: max-height 0.4s ease, opacity 0.4s ease;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.animated-box.show {
    max-height: 600px;
    opacity: 1;
}

.tech-banner {
    position: fixed;
    right: 20px;
    top: 20px;
    z-index: 70;
    max-width: 340px;
    border: 1px solid rgba(251, 191, 36, 0.35);
    background: rgba(27, 24, 17, 0.9);
    color: #fef3c7;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 12px;
    line-height: 1.5;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(6px);
}

.tech-banner strong {
    color: #fbbf24;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.page-area {
    flex: 1;
    background: #0a0c10;
    height: 100%;
    overflow-y: auto;
    padding: 2.5rem;
    display: flex;
    justify-content: center;
}

.doc-paper {
    font-family: 'Times New Roman', Times, serif;
    background: #fff;
    color: #000;
    width: 210mm;
    min-height: 297mm;
    padding: 20mm;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.55);
    margin: 0 auto;
    font-size: 14pt;
    line-height: 1.5;
    position: relative;
    overflow: hidden;
}

.doc-paper.watermark-active::before {
    content: "ЄРДР";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-35deg);
    font-size: 7.5rem;
    font-weight: 900;
    color: rgba(0, 0, 0, 0.06);
    pointer-events: none;
    z-index: 0;
    white-space: nowrap;
    font-family: 'Times New Roman', Times, serif;
}

.doc-content-z {
    position: relative;
    z-index: 10;
}

.doc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.doc-header .brand {
    flex: 1;
    text-align: center;
}

.doc-header .meta {
    width: 170px;
    text-align: right;
    font-size: 11pt;
}

.doc-set {
    text-align: center;
    margin-bottom: 1.25rem;
}

.doc-type {
    text-transform: uppercase;
    letter-spacing: 0.3em;
    font-size: 16pt;
    font-weight: 700;
}

.doc-subtitle {
    font-size: 14pt;
    font-weight: 700;
    margin-top: 0.25rem;
}

.doc-date-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.doc-body {
    text-align: justify;
}

.doc-paragraph {
    text-indent: 1.5cm;
    text-align: justify;
    margin-bottom: 12px;
    white-space: pre-wrap;
}

.section-header {
    text-align: center;
    font-weight: 700;
    margin: 1rem 0 0.5rem;
    letter-spacing: 0.1em;
}

.doc-signatures {
    margin-top: 4rem;
}

.sig-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-top: 40px;
}

.sig-row.double {
    display: none;
}

.signature-block {
    width: 48%;
}

.signature-label {
    font-size: 13pt;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.signature-line {
    border-bottom: 1px solid #000;
    width: 130px;
}

.person-name {
    font-size: 13pt;
    font-weight: 700;
}

.person-role {
    font-size: 12pt;
}

.signature-image {
    position: absolute;
    bottom: 25px;
    right: 150px;
    height: 70px;
    z-index: 10;
    max-width: 200px;
    object-fit: contain;
}

.signature-image-double {
    position: absolute;
    bottom: 20px;
    left: 0;
    height: 60px;
    z-index: 10;
    max-width: 150px;
    object-fit: contain;
}

.signature-wrap {
    position: relative;
    padding-top: 55px;
}

.signature-row-inline {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    gap: 8px;
}

.signature-row-space {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.left-block {
    width: 48%;
}

.right-block {
    width: 48%;
}

.print-button {
    width: 100%;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.8rem 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    transition: 0.2s ease;
}

.print-button:hover {
    background: #3b82f6;
}

@media print {
    body * {
        visibility: hidden;
    }

    #document-preview,
    #document-preview * {
        visibility: visible;
    }

    #document-preview {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 15mm;
        box-shadow: none;
        border: none;
    }

    @page {
        margin: 0;
    }

    body {
        background-color: white !important;
    }

    .tech-banner {
        display: none !important;
    }
}
