/* Document rendering rules — Times New Roman, school-exam look.
   Used identically for on-screen preview AND print/PDF output (print.css only
   adds page-break/isolation rules, never re-styles content), so preview and
   PDF can never visually disagree. */

#doc-preview {
    --doc-pad-top: 2cm;
    --doc-pad-right: 1.5cm;
    --doc-pad-bottom: 2cm;
    --doc-pad-left: 2.5cm;
    --doc-font: "Times New Roman", Georgia, serif;
}

.doc-page {
    width: 21cm;
    min-height: 29.7cm;
    margin: 0 auto 28px auto;
    padding: var(--doc-pad-top) var(--doc-pad-right) var(--doc-pad-bottom) var(--doc-pad-left);
    background: #fff;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.18);
    box-sizing: border-box;
    font-family: var(--doc-font);
    font-size: 12pt;
    line-height: 1.25;
    color: #000;
    display: flex;
    flex-direction: column;
}

.doc-logo {
    display: block;
    max-height: 60px;
    max-width: 160px;
    margin: 0 auto 6px auto;
}

.doc-topic {
    text-align: center;
    font-size: 12pt;
    font-style: italic;
    margin: 0 0 10px 0;
}

.doc-page-header {
    text-align: center;
    font-size: 9pt;
    color: #555;
    margin: 0 0 10px 0;
}

.doc-page-footer {
    margin-top: auto;
    padding-top: 10px;
    text-align: center;
    font-size: 9pt;
    color: #555;
}

.doc-schoolname {
    text-align: center;
    font-size: 10.5pt;
    margin: 0 0 4px 0;
}

.doc-title {
    text-align: center;
    font-weight: bold;
    font-size: 14pt;
    margin: 0 0 4px 0;
}

.doc-subtitle {
    text-align: center;
    font-weight: bold;
    font-size: 12pt;
    margin: 0 0 16px 0;
}

.doc-fillline,
.doc-fillline-label,
.doc-signoff {
    margin: 10px 0;
}

.doc-fillline-label {
    font-weight: bold;
}

.doc-instr-heading {
    font-weight: bold;
    margin: 14px 0 4px 0;
}

.doc-instr {
    margin: 4px 0;
    font-size: 11pt;
}

.doc-hint {
    font-size: 9pt;
    font-style: italic;
    color: #444;
    margin: 4px 0 10px 0;
}

/* Generic table style: every cell fully bordered. */
.doc-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0 14px 0;
    font-size: 11pt;
}
.doc-table td,
.doc-table th {
    border: 1px solid #000;
    padding: 4px 6px;
    text-align: center;
    vertical-align: middle;
}
.doc-table-head th { font-weight: bold; background: #fafafa; }

.doc-task-table { width: auto; min-width: 50%; }

.doc-compact-answers td { min-width: 60px; height: 24px; }

/* Letter-grid (Фамилия/Имя/Отчество) — fully bordered cells. */
.doc-lettergrid-wrap { margin: 6px 0 10px 0; }
.doc-lettergrid-label { font-size: 11pt; margin-bottom: 2px; }
.doc-lettergrid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.doc-lettergrid td {
    height: 26px;
    border: 1px solid #000;
}

/* Number-line scratch strip */
.doc-numberline-wrap { margin: 10px 0; }
.doc-numberline {
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
}
.doc-numberline td {
    border: 1px solid #000;
    text-align: center;
    font-size: 10pt;
    height: 22px;
    width: 5%;
}
.doc-numberline-blank td { height: 34px; }

.doc-task-label { font-weight: bold; margin: 12px 0 2px 0; }
.doc-blank-line {
    height: 22px;
    border-bottom: 1px solid #000;
    margin: 0 0 10px 0;
}

.doc-task-block { margin: 0 0 16px 0; }
.doc-task-text { margin: 4px 0; white-space: pre-wrap; }
.doc-task-score { text-align: right; font-weight: bold; margin: 4px 0 0 0; }
