:root {
    --bg: #f5f6f4;
    --panel: #ffffff;
    --text: #1b1f24;
    --muted: #65707a;
    --line: #dfe4e1;
    --accent: #b3261e;
    --accent-dark: #7d1712;
    --good: #156f45;
    --bad: #9c2b2e;
    --neutral: #6b5d2e;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
}

a {
    color: var(--accent-dark);
    text-decoration: none;
}

input, select, textarea, button {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    font: inherit;
    padding: 10px 11px;
}

textarea {
    resize: vertical;
}

button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 40px;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-weight: 650;
    padding: 10px 14px;
}

button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.button.secondary {
    background: #e8ece8;
    color: var(--text);
}

.danger-button {
    color: var(--bad);
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.login-panel {
    width: min(420px, calc(100vw - 32px));
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 32px;
    box-shadow: 0 16px 45px rgba(16, 24, 32, .08);
}

.login-panel h1 {
    margin: 0;
    font-size: 32px;
}

.login-panel p {
    margin: 4px 0 24px;
    color: var(--muted);
}

label {
    display: grid;
    gap: 7px;
    margin-bottom: 16px;
    font-weight: 650;
}

.topbar {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 28px;
    background: #15191d;
    color: #fff;
}

.topbar span {
    color: #c6ccd1;
    margin-left: 10px;
}

.topbar nav {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.topbar a {
    color: #fff;
}

.container {
    width: min(1280px, calc(100vw - 32px));
    margin: 28px auto;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.page-head h1 {
    margin: 0;
    font-size: 28px;
}

.page-head p {
    margin: 5px 0 0;
    color: var(--muted);
}

.actions, .form-actions {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-form {
    margin: 0;
}

.inline-form label {
    margin: 0;
    min-width: 120px;
}

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

.row-actions form {
    margin: 0;
}

.link-button {
    min-height: 0;
    background: transparent;
    color: var(--accent-dark);
    font-weight: 500;
    padding: 0;
}

.link-button.danger {
    color: var(--bad);
}

.inline-action-form {
    margin: 0;
}

.inline-action-form button.badge {
    width: auto;
    border-radius: 999px;
    min-height: 26px;
    padding: 4px 9px;
    font-size: 12px;
}

.message-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #e8ece8;
    color: var(--accent-dark);
    font-size: 15px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
}

.panel h2 {
    margin: 0 0 16px;
    font-size: 18px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.status-list {
    display: grid;
    gap: 12px;
    margin: 0;
}

.status-list div {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 14px;
}

.status-list dt {
    color: var(--muted);
    font-weight: 650;
}

.status-list dd {
    margin: 0;
}

.status-list dd span {
    display: block;
    color: var(--muted);
    margin-top: 3px;
}

.detail-notes {
    margin-bottom: 18px;
}

.detail-notes p {
    margin: 0 0 18px;
    color: var(--text);
}

.detail-notes p:last-child {
    margin-bottom: 0;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 880px;
}

.compact-table {
    min-width: 760px;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric-card {
    display: grid;
    gap: 8px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.metric-card span,
.metric-card small {
    color: var(--muted);
}

.metric-card strong {
    font-size: 26px;
    line-height: 1.1;
}

.report-section {
    margin-bottom: 18px;
}

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

.progress-list div {
    display: grid;
    grid-template-columns: 130px 1fr 56px;
    gap: 12px;
    align-items: center;
}

.progress-list span {
    color: var(--muted);
    font-weight: 650;
}

.progress-list strong {
    text-align: right;
}

meter {
    width: 100%;
    height: 14px;
}

th, td {
    border-bottom: 1px solid var(--line);
    padding: 13px 12px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.sort-link {
    color: inherit;
}

td span {
    display: block;
    color: var(--muted);
    margin-top: 3px;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 700;
}

.badge.good {
    background: #e2f4ea;
    color: var(--good);
}

.badge.bad {
    background: #fde7e8;
    color: var(--bad);
}

.badge.neutral {
    background: #f2ead0;
    color: var(--neutral);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 18px;
}

.wide {
    grid-column: 1 / -1;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox input {
    width: auto;
}

.alert {
    border-radius: 6px;
    margin-bottom: 16px;
    padding: 12px 14px;
}

.alert.success {
    background: #e2f4ea;
    color: var(--good);
}

.alert.error {
    background: #fde7e8;
    color: var(--bad);
}

.alert.warning {
    background: #fff3cd;
    color: #6f5200;
}

.hint, .empty {
    color: var(--muted);
}

.send-targets {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    border: 0;
    margin: 18px 0 12px;
    padding: 0;
}

.send-targets legend {
    width: 100%;
    margin-bottom: 2px;
    font-weight: 650;
}

.send-targets label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.send-targets input {
    width: auto;
}

.recipient-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 18px;
}

.recipient-list label {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
}

.recipient-list input {
    width: auto;
    margin-top: 3px;
}

.recipient-list span {
    display: grid;
    gap: 2px;
}

.recipient-list small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.public-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.response-panel {
    width: min(680px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 32px;
    box-shadow: 0 16px 45px rgba(16, 24, 32, .08);
}

.response-brand {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    color: var(--muted);
}

.response-brand strong {
    color: var(--accent-dark);
}

.response-panel h1 {
    margin: 0 0 6px;
    font-size: 28px;
    line-height: 1.15;
}

.response-panel > p {
    margin: 0 0 24px;
    color: var(--muted);
}

.answer-options {
    border: 0;
    margin: 0 0 16px;
    padding: 0;
}

.answer-options legend {
    margin-bottom: 8px;
    font-weight: 650;
}

.answer-options label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    padding: 10px 12px;
}

.answer-options label:has(input:checked) {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.answer-options input {
    width: auto;
}

.package-list {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.package-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 14px;
}

.package-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.package-row h2 {
    margin: 0 0 4px;
    font-size: 18px;
}

.package-row p {
    margin: 8px 0 0;
    color: var(--muted);
}

.package-row form {
    margin: 0;
}

.package-options {
    border: 0;
    margin: 0 0 18px;
    padding: 0;
    transition: opacity .16s ease;
}

.package-options legend {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    margin-bottom: 10px;
    font-weight: 650;
}

.package-options legend small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.package-options label {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    margin-bottom: 10px;
    background: #fff;
    padding: 14px;
    transition: border-color .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.package-options label:has(input:checked) {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.package-options input {
    width: auto;
    margin-top: 5px;
}

.package-card-body {
    display: grid;
    gap: 10px;
}

.package-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.package-card-head strong {
    font-size: 17px;
}

.package-options em {
    color: var(--accent-dark);
    font-style: normal;
    font-weight: 700;
}

.package-options small {
    display: block;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.package-options.is-disabled {
    opacity: .48;
}

.package-options.is-disabled label {
    cursor: not-allowed;
    background: #f7f8f6;
}

.package-options.is-disabled legend small {
    color: var(--neutral);
}

.answer-summary {
    display: grid;
    gap: 12px;
    align-items: start;
}

.answer-summary p {
    margin: 0;
    color: var(--text);
    white-space: pre-wrap;
}

@media (max-width: 760px) {
    .topbar, .page-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .recipient-list {
        grid-template-columns: 1fr;
    }

    .report-grid {
        grid-template-columns: 1fr;
    }

    .progress-list div {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .progress-list strong {
        text-align: left;
    }

    .status-list div {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .package-row {
        flex-direction: column;
    }

    .response-panel {
        padding: 24px;
    }

    .package-options legend,
    .package-card-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
}
