:root {
    --blue: #34363a;
    --blue-2: #24262a;
    --accent: #d71920;
    --soft: #f7f8fa;
    --line: #e1e4e8;
    --text: #202327;
    --muted: #69727d;
    --danger: #b42318;
    --warning-bg: #fff6f6;
    --warning-line: #d71920;
    --card: #ffffff;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f5f6f7;
    color: var(--text);
    line-height: 1.45;
}

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

.site-header {
    background: #fff;
    color: var(--text);
    padding: 24px;
    border-bottom: 5px solid var(--accent);
    box-shadow: 0 10px 28px rgba(32, 35, 39, .06);
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 28px;
}

.brand-logo {
    width: 218px;
    max-width: 34vw;
    height: auto;
    display: block;
}

.brand {
    font-size: 13px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
}

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

h2 {
    color: var(--blue);
    margin: 0 0 12px;
    font-size: 21px;
}

h3 {
    color: var(--blue-2);
    margin-top: 0;
}

.subtitle {
    margin: 0;
    color: var(--muted);
    max-width: 920px;
}

.main {
    padding: 26px 18px 60px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
    color: var(--muted);
    font-size: 14px;
}

.topbar a {
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

.notice {
    background: var(--warning-bg);
    border: 1px solid #f3c2c4;
    border-left: 5px solid var(--warning-line);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 20px;
}

.success {
    background: #ecfdf3;
    border: 1px solid #bbf7d0;
    color: #166534;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 18px;
}

.info-text {
    color: var(--muted);
    margin: -4px 0 14px;
}

.process-overview {
    border-color: #e4d6d6;
    background: #fffafa;
}

.process-overview h2 {
    margin-bottom: 6px;
}

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

.process-column {
    min-width: 0;
}

.process-column h3 {
    margin: 0 0 10px;
    font-size: 16px;
}

.process-list {
    display: grid;
    gap: 10px;
}

.process-item {
    display: grid;
    gap: 10px;
    margin: 0;
    border: 1px solid #e7dede;
    border-radius: 8px;
    background: #fff;
    padding: 12px;
}

.process-item strong,
.process-item span {
    display: block;
}

.process-item span,
.empty-state,
.muted-action {
    color: var(--muted);
    font-size: 13px;
}

.process-meta,
.process-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.process-meta {
    justify-content: space-between;
}

.process-actions form {
    margin: 0;
}

.muted-action {
    border: 1px solid #e7dede;
    border-radius: 8px;
    padding: 9px 11px;
    background: #f7f8fa;
}

.draft-bar {
    position: sticky;
    top: 10px;
    z-index: 20;
    display: block;
    background: #fff;
    border: 1px solid #cfd7df;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 22px;
    box-shadow: 0 14px 34px rgba(32, 35, 39, .12);
    max-height: calc(100vh - 20px);
    overflow: auto;
}

.draft-tracker-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.draft-tracker-head h2 {
    margin-bottom: 10px;
}

.draft-bar p {
    color: var(--muted);
    font-size: 13px;
    margin: 0 0 6px;
}

.draft-bar [data-draft-status] {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.draft-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(174px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.draft-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 10px;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(32, 35, 39, .06);
    padding: 20px;
    margin-bottom: 18px;
}

.contact-card {
    border-left: 5px solid var(--accent);
}

.responsibles-card {
    border-left: 5px solid #4b4f55;
}

.responsibles-list {
    display: grid;
    gap: 12px;
}

.responsible-row {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) minmax(190px, 1fr) minmax(140px, .85fr) auto;
    gap: 12px;
    align-items: end;
    border: 1px solid #e4e7eb;
    border-radius: 8px;
    background: var(--soft);
    padding: 12px;
}

.responsible-row label {
    margin-bottom: 0;
    font-size: 13px;
}

.responsible-row input {
    margin-top: 6px;
}

.responsible-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 12px;
}

.btn-tertiary {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--blue);
    padding: 10px 12px;
    font-size: 14px;
}

.btn-tertiary:hover {
    background: var(--blue-2);
    color: #fff;
}

.login {
    max-width: 460px;
    margin: 40px auto;
}

label {
    font-weight: 700;
    display: block;
    margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    border: 1px solid #c9d6e2;
    border-radius: 8px;
    padding: 10px 11px;
    font: inherit;
    background: #fff;
}

input[readonly] {
    color: #454b52;
    background: #f0f2f4;
    cursor: not-allowed;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

textarea {
    min-height: 78px;
    resize: vertical;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.sections-stack {
    display: grid;
    gap: 18px;
}

.section-pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    align-items: start;
}

.section-pair .card {
    margin-bottom: 0;
}

.section-status {
    min-width: 0;
}

.status-item {
    display: block;
    color: inherit;
    text-decoration: none;
    border: 1px solid var(--line);
    border-left: 5px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(32, 35, 39, .05);
    padding: 10px;
}

.status-item:hover {
    border-color: #d9c4c4;
    background: #fffafa;
}

.status-item.is-saved {
    border-left-color: #16a34a;
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.status-item.is-dirty {
    border-left-color: #f59e0b;
    border-color: #fde68a;
    background: #fffbeb;
}

.status-title {
    display: block;
    color: var(--blue);
    font-weight: 700;
    font-size: 13px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    margin-top: 7px;
}

.status-item.is-saved [data-status-state] {
    color: #166534;
    font-weight: 700;
}

.status-item.is-dirty [data-status-state] {
    color: #92400e;
    font-weight: 700;
}

.status-meter {
    display: block;
    height: 7px;
    background: #e8eef5;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 8px;
}

.status-meter span {
    display: block;
    height: 100%;
    background: var(--accent);
}

.status-item.is-saved .status-meter span {
    background: #22c55e;
}

.status-item.is-dirty .status-meter span {
    background: #f59e0b;
}

.module-head {
    background: #fbfbfc;
    border: 1px solid #eceff2;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 14px;
}

.module {
    scroll-margin-top: 240px;
}

.module.is-saved .module-head {
    background: #f0fdf4;
    border-color: #bbf7d0;
    box-shadow: inset 4px 0 0 #22c55e;
}

.module.is-dirty .module-head {
    background: #fffbeb;
    border-color: #fde68a;
    box-shadow: inset 4px 0 0 #f59e0b;
}

.check-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: max-content;
    margin: 0;
    cursor: pointer;
}

.section-toggle {
    font-weight: 700;
}

.section-select-row {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 6px 0 10px;
    margin-bottom: 2px;
}

.bulk-panel {
    background: var(--soft);
    border: 1px solid #e4e7eb;
    border-radius: 8px;
    margin: 16px 0 4px;
    padding: 14px;
}

.bulk-grid {
    display: grid;
    grid-template-columns: .75fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}

.bulk-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.module-actions {
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid #eceff2;
    padding-top: 14px;
}

.selection-count {
    color: var(--muted);
    font-size: 13px;
}

.questions {
    margin-top: 8px;
}

.question-row {
    display: grid;
    grid-template-columns: 34px minmax(250px, 1.4fr) minmax(130px, .65fr) minmax(180px, .9fr) minmax(180px, .9fr);
    gap: 12px;
    align-items: start;
    border-top: 1px solid #eceff2;
    padding: 16px 0;
}

.question-row:first-child {
    border-top: 0;
}

.question-row.is-touched {
    background: #fffafa;
    box-shadow: inset 4px 0 0 var(--accent);
    padding-left: 10px;
}

.select-cell {
    padding-top: 28px;
}

.question-title {
    font-weight: 700;
}

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

.btn {
    display: inline-block;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    padding: 13px 18px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.btn:hover {
    background: var(--blue-2);
}

.btn-secondary {
    background: #4b4f55;
    padding: 11px 14px;
    font-size: 14px;
}

.errors {
    background: #fff1f0;
    border: 1px solid #ffccc7;
    color: var(--danger);
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 18px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid #eceff2;
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--soft);
    color: var(--blue);
}

.pill {
    display: inline-block;
    border-radius: 999px;
    padding: 5px 10px;
    font-weight: 700;
    font-size: 13px;
}

.p1 { background: #fee2e2; color: #991b1b; }
.p2 { background: #ffedd5; color: #9a3412; }
.p3 { background: #fef9c3; color: #854d0e; }
.p4 { background: #dcfce7; color: #166534; }

.scorebar {
    height: 9px;
    background: #e8eef5;
    border-radius: 20px;
    overflow: hidden;
    margin-top: 6px;
}

.scorebar span {
    display: block;
    height: 100%;
    background: var(--accent);
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.submit-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.footer-note {
    color: var(--muted);
    font-size: 13px;
    margin-top: 20px;
}

@media (max-width: 1050px) {
    .bulk-grid,
    .responsible-row,
    .question-row {
        grid-template-columns: 1fr;
    }

    .select-cell {
        padding-top: 0;
    }

    .bulk-actions,
    .draft-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .draft-status-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
}

@media (max-width: 760px) {
    .grid,
    .process-grid,
    .result-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 24px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .brand-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }

    .brand-logo {
        max-width: 220px;
    }

    .draft-bar {
        top: 0;
        border-radius: 0 0 8px 8px;
        margin-left: -18px;
        margin-right: -18px;
    }

    .module {
        scroll-margin-top: 280px;
    }
}

@media print {
    body {
        background: white;
    }

    .site-header {
        color: black;
        background: white;
        border-bottom: 2px solid #000;
    }

    .btn,
    form,
    .topbar {
        display: none;
    }

    .card {
        box-shadow: none;
    }
}
