:root {
    --background: #f3f6fa;
    --surface: #ffffff;
    --text: #172638;
    --muted: #485b70;
    --primary: #174e89;
    --border: #738397;
    --focus: #8c3600;
    --danger: #93232a;
    --radius: .75rem;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--background);
    line-height: 1.6;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--primary); text-underline-offset: .2em; }
button, input, select { font: inherit; }
button, nav a, .brand { min-height: 44px; display: inline-flex; align-items: center; }
button { padding: .65rem 1rem; border: 2px solid var(--primary); border-radius: .4rem; background: var(--primary); color: white; cursor: pointer; }
button:hover { background: #103c6c; }
button:disabled { opacity: .65; cursor: wait; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.shell { width: min(100% - 2rem, 76rem); margin-inline: auto; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-content, .toolbar, .update-controls { display: flex; flex-direction: column; gap: 1rem; }
.header-content { padding-block: 1rem; }
.brand { font-size: 1.25rem; font-weight: 750; text-decoration: none; }
main { padding-block: 2rem; }
h1 { margin: .25rem 0; font-size: clamp(1.75rem, 5vw, 2.5rem); line-height: 1.2; }
h2 { margin-top: 0; font-size: 1.15rem; }
p { margin-block: .75rem; }
.eyebrow { color: var(--muted); font-weight: 650; margin: 0; }
.notice { background: #e5eef9; border-left: 4px solid var(--primary); padding: 1rem; margin-block: 1.5rem; }
.update-controls { color: var(--muted); }
.update-controls label { display: flex; align-items: center; gap: .6rem; min-height: 44px; cursor: pointer; }
input[type="checkbox"] { width: 1.3rem; height: 1.3rem; accent-color: var(--primary); flex-shrink: 0; }
.site-grid { list-style: none; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.site-card { padding: 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-wrap: anywhere; }
.site-card p { color: var(--muted); }
.badge { display: inline-block; border: 1px solid currentColor; padding: .2rem .6rem; border-radius: .35rem; font-weight: 650; }
.badge-error, #error { color: var(--danger); }
#error { border-left: 4px solid currentColor; padding: 1rem; background: #fff0f0; }
.site-footer { padding-block: 1rem; border-top: 1px solid var(--border); color: var(--muted); }
.skip-link { position: absolute; top: .5rem; left: 1rem; transform: translateY(-200%); background: white; padding: .75rem; z-index: 10; }
.skip-link:focus { transform: translateY(0); }
.muted, .field-help { color: var(--muted); }
.field-help { font-size: .9rem; margin: .35rem 0 0; }
.panel, .summary-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; min-width: 0; }
.login-layout { display: grid; gap: 2rem; padding-block: 1rem 3rem; align-items: center; }
.login-intro h1 { font-size: clamp(2rem, 6vw, 3.4rem); }
.login-intro > p { max-width: 36rem; }
.feature-list { padding-left: 1.25rem; color: var(--muted); }
.feature-list li { margin-block: .65rem; }
.login-panel { box-shadow: 0 1rem 3rem #1726380d; }
.login-panel h2 { font-size: 1.75rem; margin-block: .2rem; }
.stack-form { display: grid; gap: 1.15rem; }
.field { display: grid; gap: .35rem; min-width: 0; }
.field label, .search-form > label { font-weight: 650; }
input:not([type="checkbox"]):not([type="hidden"]), select { width: 100%; min-width: 0; min-height: 44px; padding: .65rem .75rem; border: 1px solid var(--border); border-radius: .4rem; background: white; color: var(--text); }
.checkbox-label { display: flex; align-items: center; gap: .6rem; min-height: 44px; }
.checkbox-label input { margin: 0; }
.form-actions, .app-nav, .logout-form, .card-actions { display: flex; gap: .65rem; flex-wrap: wrap; align-items: center; }
.app-nav { gap: 1rem; }
.app-nav [aria-current="page"] { font-weight: 750; text-decoration-thickness: 3px; }
.logout-form span { overflow-wrap: anywhere; }
.button-secondary { background: white; color: var(--primary); }
.button-secondary:hover { background: #e5eef9; }
.button-danger { background: var(--danger); border-color: var(--danger); }
.button-danger:hover { background: #70151b; }
.button-danger-outline { background: white; color: var(--danger); border-color: var(--danger); }
.button-danger-outline:hover { background: #fff0f0; }
.form-error { border-left: 4px solid var(--danger); padding: 1rem; background: #fff0f0; color: var(--danger); overflow-wrap: anywhere; }
.admin-layout { display: grid; gap: 2rem; align-items: start; }
.user-list { list-style: none; padding: 0; display: grid; gap: 1rem; }
.user-card { overflow-wrap: anywhere; }
.user-card h3 { margin: 0; }
.editor-panel { min-width: 0; }
dialog { width: min(100% - 2rem, 38rem); max-height: calc(100dvh - 2rem); overflow-y: auto; padding: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); background: var(--surface); }
dialog::backdrop { background: #0a192cb3; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.dialog-heading h2 { margin: 0; overflow-wrap: anywhere; }
.dialog-heading button { flex-shrink: 0; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-block: 1.5rem; }
.summary-card dt { color: var(--muted); font-size: .9rem; }
.summary-card dd { margin: .3rem 0 0; font-size: 2rem; font-weight: 750; line-height: 1.3; }
.list-tools, .refresh-tools, .list-meta { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; justify-content: space-between; }
.list-meta { align-items: center; gap: 0 1rem; }
.search-form { width: 100%; }
.search-controls { display: flex; gap: .5rem; margin-top: .35rem; }
.refresh-tools { align-items: center; }
.site-grid > li { min-width: 0; }
.site-card { height: 100%; display: flex; flex-direction: column; }
.card-heading { display: flex; gap: .75rem; align-items: start; flex-wrap: wrap; }
.card-heading h2 { flex: 1; min-width: 8rem; margin: 0; }
.site-url { font-size: .9rem; overflow-wrap: anywhere; }
.site-metrics { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; margin: .5rem 0 1.25rem; }
.site-metrics dt { font-size: .85rem; color: var(--muted); }
.site-metrics dd { margin: .15rem 0 0; font-size: .95rem; font-weight: 600; }
.card-actions { margin-top: auto; padding-top: 1rem; border-top: 1px solid #d6dde5; }
.card-actions button { padding: .5rem .65rem; font-size: .9rem; }
.badge { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; }
.status-dot { width: .5rem; height: .5rem; flex-shrink: 0; border-radius: 50%; background: currentColor; }
.state-ok { color: #14532d; background: #edf8ee; }
.state-critical, .state-expired { color: #93232a; background: #fff0f0; }
.state-warning { color: #714300; background: #fff4d6; }
.state-stale, .state-paused, .state-unmonitored, .state-unknown, .state-not_configured, .state-not_applicable { color: #485b70; background: #f3f6fa; }
.history-list { padding-left: 1.3rem; }
.history-list li { padding-block: .75rem; border-bottom: 1px solid #d6dde5; overflow-wrap: anywhere; }
.history-list time { display: block; font-size: .9rem; color: var(--muted); }
.empty-state { text-align: center; padding: 2rem; }
@media (min-width: 30rem) { .site-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 48rem) {
    .header-content, .toolbar, .update-controls { flex-direction: row; align-items: center; justify-content: space-between; }
    .toolbar button { flex-shrink: 0; }
    .site-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .login-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 65vh; gap: 3rem; }
    .login-panel { padding: 2rem; }
    .summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .search-form { width: min(100%, 28rem); }
    .header-content { flex-wrap: wrap; }
    .admin-layout { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
}
@media (min-width: 72rem) {
    .site-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
