:root {
    --ink: #1b2430;
    --muted: #5b6673;
    --bg: #f3f5f7;
    --surface: #fff;
    --line: #d5dbe1;
    --accent: #0b6e8a;
    --accent-hover: #095a72;
    --ok-bg: #e6f4ea;
    --ok: #1e6b3a;
    --err-bg: #fdecea;
    --err: #a12622;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.container { width: min(960px, 100% - 32px); margin-inline: auto; }

header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header { display: flex; align-items: center; gap: 16px; padding: 12px 0; }
.logo { display: block; max-height: 40px; }
h1 { margin: 0; font-size: 1.3rem; font-weight: 600; }
h2 { margin: 0 0 14px; font-size: 1.05rem; }
h3 { margin: 0 0 4px; font-size: .9rem; }

main { flex: 1; display: grid; gap: 16px; align-content: start; padding: 24px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 20px; }

.setup { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px 16px; align-content: start; }
.field { display: flex; flex-direction: column; gap: 4px; }
label { font-size: .9rem; font-weight: 500; }

input[type=text], input[type=email], select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: inherit;
    font: inherit;
}

.checks { display: flex; flex-direction: column; gap: 8px; grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }

fieldset { margin: 20px 0 0; padding: 14px 16px 18px; border: 1px solid var(--line); border-radius: 6px; }
legend { padding: 0 6px; font-weight: 600; }

.notes { padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--bg); font-size: .85rem; color: var(--muted); }
.notes p, .notes ol { margin: 0 0 8px; }
.notes ol { padding-left: 18px; }

.card-summary { display: flex; flex-wrap: wrap; gap: 24px; margin: 20px 0 0; }
.card-summary dt { font-size: .85rem; color: var(--muted); }
.card-summary dd { margin: 0; font-weight: 600; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
button {
    padding: 9px 18px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: #fff;
    color: var(--accent);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
button.primary { background: var(--accent); color: #fff; }
button:hover:not(:disabled) { border-color: var(--accent-hover); }
button.primary:hover:not(:disabled) { background: var(--accent-hover); }
button:disabled { opacity: .5; cursor: not-allowed; }

:focus-visible { outline: 3px solid #f5b83d; outline-offset: 2px; }

#errormessage {
    margin: 16px 0 0;
    padding: 12px 14px;
    border-radius: 6px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font: 13px/1.45 ui-monospace, Consolas, monospace;
}
#errormessage.success { background: var(--ok-bg); color: var(--ok); }
#errormessage.error { background: var(--err-bg); color: var(--err); }

.spinner {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: 4px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

a { color: var(--accent); }
ul { margin: 0; padding-left: 20px; }
p { margin: 0 0 10px; }

footer { padding: 16px 0; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .8rem; }
footer p { margin: 0; }

@media (max-width: 720px) {
    .setup { grid-template-columns: 1fr; }
    .actions button { flex: 1 1 100%; }
}
