:root {
    --page-bg: #f4f4f4;
    --panel-bg: #ffffff;
    --text: #222;
    --muted: #666;
    --border: #ddd;

    --topbar-bg: #1f2937;
    --topbar-text: #ffffff;
    --topbar-muted: #d1d5db;

    --button-bg: #f3f4f7;
    --button-bg-hover: #e6e8ee;
    --button-bg-active: #d9dce5;
    --button-border: #c8ccd4;
    --button-text: #111827;

    --danger: #900;
    --ok: #060;
    --focus: #93c5fd;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: var(--page-bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}
h1,
h2,
h3 {
    margin-top: 0;
}

a {
    color: inherit;
}

.topbar {
    background: var(--topbar-bg);
    color: var(--topbar-text);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

.topbar h1 {
    margin: 0;
}

.subline {
    margin-top: 4px;
    color: var(--topbar-muted);
    font-size: 0.9rem;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.top-actions form,
.top-action-form {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

.top-nav-button,
.top-nav-button:visited,
.top-actions button.top-nav-button {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    height: 42px;
    min-height: 42px;
    padding: 0 18px;
    margin: 0;

    border: 1px solid var(--button-border);
    border-radius: 8px;
    background: var(--button-bg);

    color: var(--button-text);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1;

    text-decoration: none;
    cursor: pointer;

    appearance: none;
    -webkit-appearance: none;
}

.top-nav-button:hover,
.top-actions button.top-nav-button:hover {
    background: var(--button-bg-hover);
    color: var(--button-text);
    text-decoration: none;
}

.top-nav-button:active,
.top-actions button.top-nav-button:active {
    background: var(--button-bg-active);
}

.top-nav-button:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

main {
    padding: 16px 24px 40px;
}

.panel,
.card,
.section {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

label {
    display: block;
    margin-top: 12px;
    font-weight: bold;
}

input,
select,
textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    margin-top: 4px;
}

button {
    margin-top: 12px;
    margin-right: 8px;
    padding: 8px 12px;
    cursor: pointer;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.92rem;
}

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

.small {
    color: var(--muted);
    font-size: 0.9rem;
}

.ok {
    color: var(--ok);
}

.error,
.danger {
    color: var(--danger);
}

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

.status-green {
    background: #d8f5d0;
}

.status-yellow {
    background: #fff3bf;
}

.status-red {
    background: #ffd6d6;
}

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

    .top-actions {
        width: 100%;
    }

    main {
        padding: 12px;
    }
}

.site-footer {
    padding: 24px;
    background: #111827;
    color: white;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.site-footer span {
    display: block;
    margin-top: 4px;
    color: #cbd5e1;
}

.footer-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #e5e7eb;
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

.footer-test-program[hidden],
.site-footer .test-program-inline[hidden],
.site-footer .test-program-info[hidden] {
    display: none;
}

.footer-test-program {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 0 0 auto;
}

.site-footer .test-program-inline {
    display: grid;
    grid-template-columns: max-content minmax(180px, 210px) max-content;
    align-items: center;
    column-gap: 0.4rem;
    row-gap: 0.25rem;
    margin: 0;
    font-size: 0.82rem;
    opacity: 0.86;
}

.site-footer .test-program-prompt,
.site-footer .test-program-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0;
    white-space: nowrap;
}

.site-footer .test-program-inline label {
    display: inline;
    margin: 0;
    color: #e5e7eb;
    white-space: nowrap;
}

.site-footer .test-program-inline input {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0.35rem 0.5rem;
}

.site-footer .test-program-inline button {
    margin: 0;
    padding: 0.35rem 0.55rem;
}

.site-footer .test-program-inline button.test-program-info {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    padding: 0;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}

.site-footer .test-program-info:hover::after,
.site-footer .test-program-info:focus-visible::after {
    content: attr(data-tooltip);
    position: absolute;
    z-index: 20;
    left: 50%;
    bottom: calc(100% + 0.45rem);
    box-sizing: border-box;
    transform: translateX(calc(-50% + var(--test-program-tooltip-shift, 0px)));
    width: min(320px, 75vw);
    padding: 0.5rem 0.6rem;
    border: 1px solid #c8ccd4;
    border-radius: 0.35rem;
    background: #ffffff;
    color: #111827;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.35;
    text-align: left;
    white-space: pre-wrap;
    box-shadow: 0 0.2rem 0.8rem rgba(0, 0, 0, 0.25);
}

.site-footer .test-program-result {
    grid-column: 1 / -1;
    min-height: 1em;
    margin-top: 0;
    color: #cbd5e1;
}

.site-footer .test-program-result:empty {
    display: none;
}

@media (max-width: 1100px) {
    .footer-test-program {
        order: 3;
        flex: 1 0 100%;
    }

    .site-footer .test-program-inline {
        width: 100%;
        grid-template-columns: max-content minmax(180px, 1fr) max-content;
    }
}

@media (max-width: 700px) {
    .footer-test-program {
        width: 100%;
    }

    .site-footer .test-program-inline {
        width: 100%;
        grid-template-columns: minmax(0, 1fr) max-content;
    }

    .site-footer .test-program-prompt {
        grid-column: 1 / -1;
    }

    .site-footer .test-program-inline input {
        grid-column: 1;
    }

    .site-footer .test-program-actions {
        grid-column: 2;
    }
}

@media (max-width: 480px) {
    .site-footer .test-program-inline {
        grid-template-columns: minmax(0, 1fr);
    }

    .site-footer .test-program-prompt,
    .site-footer .test-program-inline input,
    .site-footer .test-program-actions,
    .site-footer .test-program-result {
        grid-column: 1;
    }

    .site-footer .test-program-actions {
        justify-content: flex-start;
    }
}
