.tlb-frontend {
    --tlb-ink: #172033;
    --tlb-muted: #667085;
    --tlb-border: #d8dee8;
    --tlb-surface: #ffffff;
    --tlb-soft: #f5f7fb;
    --tlb-primary: #176b43;
    --tlb-primary-dark: #0f5132;
    --tlb-accent: #c88a23;
    max-width: 1100px;
    margin: 0 auto;
    padding: 22px;
    color: var(--tlb-ink);
}

.tlb-builder-form {
    display: grid;
    gap: 22px;
    max-width: 880px;
    margin: 0 auto;
    padding: 30px;
    border: 1px solid rgba(23, 107, 67, 0.16);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.98)),
        linear-gradient(135deg, rgba(23, 107, 67, 0.12), rgba(200, 138, 35, 0.12));
    box-shadow: 0 24px 70px rgba(23, 32, 51, 0.12);
}

.tlb-builder-form h2 {
    margin: 0;
    color: var(--tlb-ink);
    font-size: 30px;
    line-height: 1.18;
}

.tlb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}

.tlb-builder-form label {
    display: grid;
    gap: 7px;
    margin: 0;
    color: var(--tlb-ink);
    font-weight: 700;
}

.tlb-builder-form label span {
    font-size: 13px;
    letter-spacing: 0;
}

.tlb-builder-form input,
.tlb-builder-form select,
.tlb-builder-form textarea {
    width: 100%;
    min-height: 46px;
    box-sizing: border-box;
    border: 1px solid var(--tlb-border);
    border-radius: 10px;
    padding: 11px 13px;
    background: #fff;
    color: var(--tlb-ink);
    font: inherit;
    box-shadow: inset 0 1px 2px rgba(23, 32, 51, 0.04);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.tlb-builder-form input:focus,
.tlb-builder-form textarea:focus {
    outline: 0;
    border-color: var(--tlb-primary);
    box-shadow: 0 0 0 4px rgba(23, 107, 67, 0.14);
}

.tlb-builder-form textarea {
    resize: vertical;
}

.tlb-checks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 9px 14px;
    margin: 0;
    border: 1px solid var(--tlb-border);
    border-radius: 10px;
    padding: 14px;
}

.tlb-checks legend {
    padding: 0 6px;
    font-weight: 800;
}

.tlb-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tlb-progress {
    display: flex;
    gap: 10px;
    align-items: center;
    font-weight: 800;
}

.tlb-progress[hidden] {
    display: none;
}

.tlb-primary-submit {
    justify-self: start;
}

.tlb-builder-form button {
    justify-self: start;
    min-height: 48px;
    border: 0;
    border-radius: 999px;
    padding: 0 22px;
    background: linear-gradient(135deg, var(--tlb-primary), var(--tlb-primary-dark));
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(23, 107, 67, 0.22);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.tlb-builder-form button:hover,
.tlb-builder-form button:focus {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(23, 107, 67, 0.28);
}

.tlb-generated-note {
    margin-bottom: 24px;
}

.tlb-word-document {
    max-width: 816px;
    min-height: 1056px;
    margin: 0 auto 24px;
    padding: 78px 72px;
    box-sizing: border-box;
    border: 1px solid #cfd6e4;
    border-radius: 4px;
    background: #ffffff;
    color: #111827;
    font-family: "Times New Roman", Times, serif;
    font-size: 12pt;
    line-height: 1.55;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 26px 70px rgba(15, 23, 42, 0.18);
}

.tlb-word-document::before {
    content: "";
    display: block;
    height: 1px;
    margin: -24px 0 22px;
    border-top: 1px solid #edf0f5;
}

.tlb-word-header {
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 2px solid #111827;
    text-align: center;
}

.tlb-word-header p {
    margin: 0 0 7px;
    color: #4b5563;
    font-family: Arial, sans-serif;
    font-size: 10pt;
    text-transform: uppercase;
}

.tlb-generated-note h2 {
    margin: 0;
    color: #111827;
    font-size: 20pt;
    line-height: 1.25;
}

.tlb-generated-note h3 {
    margin: 20px 0 8px;
    color: #111827;
    font-size: 14pt;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.tlb-generated-note p {
    margin: 0 0 12px;
    text-align: justify;
}

.tlb-generated-note strong {
    font-weight: 800;
}

.tlb-generated-note ul {
    margin: 0 0 12px 24px;
    padding: 0;
    list-style-type: disc;
}

.tlb-generated-note ul li {
    margin: 0 0 6px;
}

.tlb-generated-note ol {
    margin: 0 0 12px 26px;
    padding: 0;
}

.tlb-generated-note li {
    padding-left: 4px;
}

.tlb-note-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-width: 816px;
    margin: 0 auto;
    padding: 14px;
    border: 1px solid rgba(23, 107, 67, 0.14);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.10);
}

.tlb-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--tlb-border);
    border-radius: 999px;
    background: #ffffff;
    color: var(--tlb-ink);
    font-family: Arial, sans-serif;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.tlb-action-primary {
    border-color: var(--tlb-primary);
    background: linear-gradient(135deg, var(--tlb-primary), var(--tlb-primary-dark));
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(23, 107, 67, 0.23);
}

.tlb-action-button:hover,
.tlb-action-button:focus {
    border-color: var(--tlb-primary);
    background: #f0fdf4;
    color: var(--tlb-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.10);
}

.tlb-action-primary:hover,
.tlb-action-primary:focus {
    background: linear-gradient(135deg, var(--tlb-primary-dark), #0b3f28);
    color: #ffffff;
}

@media (max-width: 760px) {
    .tlb-frontend {
        padding: 12px;
    }

    .tlb-builder-form {
        padding: 22px;
        border-radius: 14px;
    }

    .tlb-builder-form h2 {
        font-size: 25px;
    }

    .tlb-word-document {
        min-height: auto;
        padding: 32px 24px;
        font-size: 11.5pt;
    }

    .tlb-note-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .tlb-action-button {
        width: 100%;
    }
}

@media print {
    .tlb-builder-form,
    .tlb-note-actions {
        display: none;
    }

    .tlb-word-document {
        max-width: none;
        min-height: auto;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
}
