/* CME Monitoring — native-platform styles. Browser policy: Baseline Newly
   Available allowed with graceful degradation (see CLAUDE.md). */

:root {
    color-scheme: light dark;
    --brand: #0b57d0;
    /* light-dark() is Baseline Newly Available: plain light values first as a
       same-cascade fallback; non-supporting browsers ignore the second line. */
    --surface: #ffffff;
    --surface: light-dark(#ffffff, #1c1c1e);
    --surface-page: #f4f5f7;
    --surface-page: light-dark(#f4f5f7, #121214);
    --text: #1a1a1a;
    --text: light-dark(#1a1a1a, #ececec);
    --text-quiet: #555555;
    --text-quiet: light-dark(#555555, #a8a8a8);
    --border: #c4c8ce;
    --border: light-dark(#c4c8ce, #3a3a3e);
    --danger: #b3261e;
    --danger: light-dark(#b3261e, #ff8c84);
    --ok: #1e7e34;
    --ok: light-dark(#1e7e34, #7ddf8f);
    --warn: #9a6700;
    --warn: light-dark(#9a6700, #f0c674);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    line-height: 1.5;
    background: var(--surface-page);
    color: var(--text);
    min-block-size: 100dvb;
}

h1 {
    font-size: 1.5rem;
}

h2 {
    font-size: 1.1rem;
}

code,
pre {
    font-family: ui-monospace, monospace;
    font-size: 0.9em;
}

pre {
    overflow-x: auto;
    padding: 0.5rem;
    background: var(--surface-page);
    border-radius: 4px;
}

:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 2px;
}

/* Header */

.site-header {
    background: var(--surface);
    border-block-end: 1px solid var(--border);
}

.site-header nav {
    display: flex;
    align-items: safe center;
    gap: 1.25rem;
    padding: 0.5rem 1.25rem;
}

.site-header nav a {
    color: inherit;
}

.brand {
    font-weight: 600;
    color: inherit;
    text-decoration: none;
}

.push-end {
    margin-inline-start: auto;
}

/* Auth */

.auth-shell {
    display: grid;
    place-content: center;
    min-block-size: 100dvb;
    padding: 1rem;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
    inline-size: min(24rem, 90vw);
}

.auth-card h1 {
    margin-block-start: 0;
}

/* Forms */

.field {
    margin-block-end: 1.5rem;
}

.field label {
    display: inline-block;
    font-weight: 500;
    /* Expand tap area without layout shift */
    padding-block: 10px;
    margin-block: -10px;
    margin-block-end: 0.25rem;
}

.label-row {
    display: flex;
    align-items: safe center;
    justify-content: space-between;
}

input {
    display: block;
    inline-size: 100%;
    font: inherit;
    font-size: 1rem;
    padding: 0.65rem 0.75rem;
    min-block-size: 48px;
    color: inherit;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}

input:user-invalid {
    border-color: var(--danger);
}

@media (pointer: coarse) {
    input {
        min-block-size: 52px;
    }
}

/* Buttons */

button {
    font: inherit;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 6px;
}

.button-primary {
    inline-size: 100%;
    min-block-size: 48px;
    padding: 0.65rem 1rem;
    border: none;
    background: var(--brand);
    color: #ffffff;
    font-weight: 600;
}

.button-primary[disabled] {
    opacity: 0.6;
    cursor: default;
}

.button-quiet {
    background: none;
    border: none;
    color: var(--brand);
    padding: 0.25rem 0.5rem;
}

/* Alerts and status */

.alert {
    border: 1px solid var(--danger);
    border-inline-start-width: 4px;
    color: var(--danger);
    border-radius: 4px;
    padding: 0.75rem;
}

.status::before {
    content: "● ";
}

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

.status-warn {
    color: var(--warn);
}

/* Dashboard */

.dashboard {
    padding: 1.25rem;
    max-inline-size: 75rem;
    margin-inline: auto;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    contain: layout style paint;
}

.card h2 {
    margin-block-start: 0;
}

/* Panels, tables, details */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-block-end: 1.5rem;
}

.panel h2 {
    margin-block-start: 0;
}

.inline-form {
    display: flex;
    flex-flow: row wrap;
    gap: 1rem;
    align-items: end;
}

.inline-form .field {
    flex: 1 1 250px;
    margin-block-end: 0;
}

.inline-form .button-primary {
    flex: 0 0 auto;
    inline-size: auto;
}

.hint {
    display: block;
    font-weight: normal;
    font-size: 0.85rem;
    color: var(--text-quiet);
}

.data-table {
    inline-size: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.data-table th,
.data-table td {
    text-align: start;
    padding: 0.65rem 1rem;
    border-block-start: 1px solid var(--border);
    vertical-align: top;
}

.data-table thead th {
    border-block-start: none;
    font-size: 0.85rem;
    color: var(--text-quiet);
}

.status-summary {
    list-style: none;
    margin: 0;
    padding: 0;
}

.detail-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 0.75rem;
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
}

.detail-list dt {
    color: var(--text-quiet);
    text-transform: capitalize;
}

.detail-list dd {
    margin: 0;
    overflow-wrap: anywhere;
}

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

.button-danger-solid {
    background: var(--danger);
}

/* Dialog */

dialog {
    background: var(--surface);
    color: inherit;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    inline-size: min(26rem, 90vw);
}

dialog::backdrop {
    background: rgb(0 0 0 / 0.45);
}

.dialog-actions {
    display: flex;
    justify-content: end;
    gap: 0.75rem;
    margin-block-start: 1rem;
}

.dialog-actions .button-primary {
    inline-size: auto;
    min-block-size: auto;
    padding: 0.5rem 1rem;
}

/* Utilities */

.visually-hidden {
    position: absolute;
    clip-path: inset(50%);
    overflow: hidden;
    inline-size: 1px;
    block-size: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    white-space: nowrap;
}
