:root {
    --ink: #202a2b;
    --muted: #667474;
    --line: #dbe3e2;
    --paper: #ffffff;
    --green: #087f63;
    --red: #c0343d;
    --amber: #96701b;
    --blue: #2463aa;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: #f8faf9;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 14px;
    letter-spacing: 0;
}

header,
main,
footer {
    max-width: 1360px;
    margin: 0 auto;
    padding-left: 36px;
    padding-right: 36px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 108px;
    gap: 20px;
}

.identity {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.mark {
    width: 38px;
    height: 38px;
    background: var(--ink);
    color: white;
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 22px;
    flex-shrink: 0;
}

h1 {
    font-size: 23px;
    margin: 0 0 2px;
    font-weight: 600;
}

.subtitle,
.label,
.setting-source {
    color: var(--muted);
    font-size: 12px;
}

.connection {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
}

.dot {
    width: 7px;
    height: 7px;
    display: inline-block;
    background: var(--muted);
    border-radius: 50%;
    flex-shrink: 0;
}

.dot.ok {
    background: var(--green);
}

.dot.failed {
    background: var(--red);
}

.interval {
    margin-left: 16px;
    color: var(--muted);
}

.summary {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 24px 0;
    background: linear-gradient(105deg, #f0f7f5, #f8faf9 65%);
}

.summary>div {
    padding: 0 24px;
    border-right: 1px solid var(--line);
}

.summary>div:first-child {
    padding-left: 0;
}

.summary>div:last-child {
    border: 0;
}

.summary .label {
    display: block;
    margin-bottom: 5px;
}

.summary strong {
    font-size: 30px;
    font-weight: 500;
    white-space: nowrap;
}

.summary strong span {
    color: var(--muted);
    font-size: 14px;
    padding-left: 8px;
}

.summary strong.time {
    font-size: 21px;
    font-family: 'IBM Plex Mono', monospace;
    line-height: 39px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 28px 0 18px;
}

h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.section-heading>span {
    color: var(--muted);
    font-size: 12px;
}

.column-head,
.monitor-row {
    display: grid;
    grid-template-columns: minmax(180px, 2fr) 110px 85px 145px minmax(150px, 1fr);
    gap: 20px;
    align-items: center;
}

.column-head {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    padding: 0 0 10px;
}

.monitor-row {
    padding: 24px 0;
    border-top: 1px solid var(--line);
    min-height: 116px;
}

.service-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.operation {
    font-size: 11px;
    color: var(--blue);
    margin-bottom: 5px;
}

.target {
    color: var(--muted);
    font-size: 11px;
    overflow-wrap: anywhere;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    white-space: nowrap;
}

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

.status.failed {
    color: var(--red);
}

.status.stale {
    color: var(--amber);
}

.status.stale .dot {
    background: var(--amber);
}

.metric {
    font-size: 12px;
    font-family: 'IBM Plex Mono', monospace;
}

.metric-label {
    display: none;
}

.timeline {
    width: 100%;
    height: 44px;
    display: block;
}

.error {
    grid-column: 1 / -1;
    color: var(--red);
    font-size: 12px;
    overflow-wrap: anywhere;
    margin-top: -6px;
}

.settings {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 28px;
    padding: 26px 0 20px;
}

.setting-source {
    display: block;
    margin-top: 8px;
}

label {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 8px;
}

.form-controls {
    display: flex;
    gap: 8px;
}

input,
select {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    border: 1px solid #b7c6c3;
    background: var(--paper);
    border-radius: 4px;
    height: 40px;
    padding: 0 12px;
    width: 100%;
    min-width: 0;
    color: var(--ink);
}

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

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

.form-actions .setting-source {
    margin: 0 0 0 8px;
}

.interval-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.vault-targets .label {
    display: block;
    margin-bottom: 5px;
}

.vault-targets .target+.label {
    margin-top: 12px;
}

.optional-monitor {
    border-top: 1px solid var(--line);
    margin-top: 28px;
    padding: 20px 0;
}

.optional-monitor summary {
    cursor: pointer;
    font-weight: 600;
    padding: 4px 0;
}

.optional-monitor summary span {
    margin-left: 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

.optional-interval {
    max-width: 320px;
    margin-top: 16px;
}

.interval-control>div {
    display: flex;
    gap: 8px;
}

.interval-control button {
    padding: 0 10px;
}

.interval-control select {
    font-family: 'IBM Plex Sans', sans-serif;
    padding: 0 8px;
}

.interval-note {
    color: var(--muted);
    font-size: 12px;
    margin: 12px 0 0;
}

.interval-control>.custom-interval {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: end;
    gap: 8px;
    max-width: 420px;
    margin-top: 10px;
}

.interval-control>.custom-interval[hidden] {
    display: none;
}

.custom-interval label {
    font-size: 11px;
    margin-bottom: 5px;
}

.custom-interval input,
.custom-interval select {
    height: 36px;
    padding: 0 8px;
}

.interval-range {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 11px;
}

.check-frequency {
    display: block;
    color: var(--muted);
    margin-top: 5px;
    font-size: 11px;
}

.settings+.settings {
    border-top: 0;
}

button {
    height: 40px;
    border: 1px solid #b7c6c3;
    border-radius: 4px;
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    padding: 0 16px;
    cursor: pointer;
    white-space: nowrap;
}

button:hover {
    background: #edf3f1;
}

button.primary {
    background: var(--green);
    border-color: var(--green);
    color: white;
}

button.primary:hover {
    background: #06654f;
}

button:disabled {
    opacity: .6;
    cursor: wait;
}

input:focus-visible,
select:focus-visible,
button:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.form-message {
    font-size: 12px;
    min-height: 17px;
    margin: 8px 0 0;
    color: var(--green);
    overflow-wrap: anywhere;
}

.form-message.failed {
    color: var(--red);
}

.tabs {
    display: flex;
    gap: 18px;
}

.tabs button {
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 6px 0;
    height: 32px;
    color: var(--muted);
    border-bottom: 2px solid transparent;
}

.tabs button[aria-selected="true"] {
    color: var(--ink);
    border-color: var(--green);
}

.history-tools,
.log-downloads {
    display: flex;
    align-items: center;
    gap: 12px;
}

.log-downloads {
    gap: 8px;
}

.download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid #b7c6c3;
    border-radius: 4px;
    color: var(--ink);
    font-size: 12px;
    text-decoration: none;
    white-space: nowrap;
}

.download-button:hover {
    background: #edf3f1;
}

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

.log-estimate {
    margin: -6px 0 14px;
    color: var(--muted);
    font-size: 12px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    text-align: left;
}

th {
    font-weight: 400;
    color: var(--muted);
    padding: 10px 12px;
    background: #eef3f1;
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
}

th:first-child,
td:first-child {
    padding-left: 0;
    width: 160px;
}

td:first-child {
    font-family: 'IBM Plex Mono', monospace;
}

footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-top: 30px;
    padding-bottom: 24px;
    color: var(--muted);
    font-size: 11px;
}

@media (max-width: 1000px) {

    .column-head,
    .monitor-row {
        grid-template-columns: minmax(160px, 2fr) 90px 70px 100px minmax(100px, 1fr);
        gap: 12px;
    }

    .settings {
        grid-template-columns: 180px minmax(0, 1fr);
    }

    .interval-controls {
        gap: 12px;
    }
}

@media (max-width: 760px) {

    header,
    main,
    footer {
        padding-left: 20px;
        padding-right: 20px;
    }

    header {
        min-height: 120px;
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        gap: 12px;
    }

    h1 {
        font-size: 21px;
    }

    .summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px 0;
        padding: 20px 0;
    }

    .summary>div {
        padding: 0 16px;
    }

    .summary>div:nth-child(odd) {
        padding-left: 0;
    }

    .summary>div:nth-child(even) {
        border: 0;
    }

    .summary strong {
        font-size: 27px;
    }

    .summary strong.time {
        font-size: 18px;
        line-height: 35px;
    }

    .column-head {
        display: none;
    }

    .monitor-row {
        grid-template-columns: minmax(0, 1fr) minmax(90px, auto);
        gap: 14px;
    }

    .monitor-row>.status {
        justify-self: end;
    }

    .metric {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .metric-label {
        display: block;
        color: var(--muted);
        font-family: 'IBM Plex Sans', sans-serif;
        font-size: 11px;
    }

    .timeline {
        grid-column: 1 / -1;
        height: 40px;
    }

    .settings {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .interval-controls {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .interval-control>div {
        max-width: 280px;
    }

    .form-controls {
        flex-wrap: wrap;
    }

    input {
        flex-basis: 100%;
    }

    .history-section .section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .history-tools {
        align-items: flex-start;
        flex-direction: column;
        width: 100%;
    }

    .log-downloads {
        flex-wrap: wrap;
    }

    .tabs {
        width: 100%;
        justify-content: space-between;
    }

    table {
        min-width: 440px;
    }

    footer {
        flex-direction: column;
        gap: 4px;
    }
}

@media (prefers-reduced-motion: no-preference) {
    main {
        animation: enter .3s ease-out;
    }

    @keyframes enter {
        from {
            opacity: 0;
            transform: translateY(5px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}