/* monitor.3ecpa.com — single hand-written stylesheet. No framework, no build step.
   Mobile-first: base rules target a ~375px phone, breakpoints add desktop comfort. */

:root {
    --brand: #12507e;
    --brand-dark: #0d3c60;
    --brand-tint: #eaf2f8;
    --ink: #1b2733;
    --ink-soft: #5b6b7c;
    --line: #dde5ec;
    --bg: #f4f7fa;
    --card: #ffffff;
    --ok: #1a7f4b;
    --ok-tint: #e7f5ed;
    --warn: #a4571a;
    --warn-tint: #fdf2e5;
    --bad: #b3261e;
    --bad-tint: #fdeceb;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(16, 36, 56, .08), 0 4px 16px rgba(16, 36, 56, .05);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    /* Never let the page itself scroll sideways on a phone. */
    overflow-x: hidden;
}

a { color: var(--brand); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }

.muted { color: var(--ink-soft); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }

/* ---------- Layout ---------- */

.wrap {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.card-head {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-head h1, .card-head h2 { margin: 0; }

/* ---------- Top bar ---------- */

.topbar {
    background: var(--brand);
    color: #fff;
    box-shadow: var(--shadow);
}

.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: .65rem 1rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.brand {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: .01em;
    margin-right: auto;
}

.brand span { opacity: .75; font-weight: 400; }

/* The nav collapses into a tap-to-open menu on small screens. */
.menu { position: relative; }

.menu summary {
    list-style: none;
    cursor: pointer;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: 0 .85rem;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-weight: 600;
    font-size: .95rem;
}

.menu summary::-webkit-details-marker { display: none; }

.menu-items {
    position: absolute;
    right: 0;
    top: calc(100% + .4rem);
    min-width: 210px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: .35rem;
    z-index: 30;
}

.menu-items a, .menu-items button {
    display: block;
    width: 100%;
    text-align: left;
    padding: .7rem .75rem;
    min-height: 44px;
    border: 0;
    background: none;
    border-radius: 7px;
    color: var(--ink);
    text-decoration: none;
    font: inherit;
    cursor: pointer;
}

.menu-items a:hover, .menu-items button:hover { background: var(--brand-tint); }

.menu-sep { height: 1px; background: var(--line); margin: .35rem 0; }

.menu-label {
    padding: .5rem .75rem .25rem;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-soft);
}

/* ---------- Forms ---------- */

label {
    display: block;
    font-weight: 600;
    font-size: .9rem;
    margin-bottom: .35rem;
}

input[type=text], input[type=email], input[type=search], select {
    width: 100%;
    /* 16px minimum stops iOS zooming in when the field is focused. */
    font-size: 16px;
    font-family: inherit;
    padding: .7rem .8rem;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
}

input:focus, select:focus {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
    border-color: var(--brand);
}

.field { margin-bottom: 1rem; }

.hint { font-size: .85rem; color: var(--ink-soft); margin-top: .35rem; }

.code-input {
    font-size: 1.9rem;
    letter-spacing: .5em;
    text-align: center;
    font-weight: 700;
    padding-left: .5em;
    min-height: 60px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 46px;
    padding: .65rem 1.15rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover { background: var(--brand-dark); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn-block { width: 100%; }

.btn-secondary {
    background: #fff;
    color: var(--brand);
    border-color: var(--line);
}

.btn-secondary:hover { background: var(--brand-tint); }

.btn-danger { background: var(--bad); }
.btn-danger:hover { background: #8f1e17; }

.btn-sm { min-height: 38px; padding: .35rem .75rem; font-size: .875rem; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; }

/* ---------- Messages ---------- */

.alert {
    border-radius: var(--radius);
    padding: .8rem .95rem;
    margin-bottom: 1rem;
    border: 1px solid;
    font-size: .95rem;
}

.alert-ok { background: var(--ok-tint); border-color: #bfe3d0; color: #145c37; }
.alert-error { background: var(--bad-tint); border-color: #f3c9c6; color: #8f1e17; }
.alert-info { background: var(--brand-tint); border-color: #c9dcea; color: var(--brand-dark); }

.alert ul { margin: .25rem 0 0; padding-left: 1.1rem; }

/* ---------- Tables ---------- */

/* Wide tables scroll inside their own box, never the whole page. */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

table { border-collapse: collapse; width: 100%; font-size: .93rem; }

th, td {
    text-align: left;
    padding: .7rem .8rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

th {
    background: #f7fafc;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ink-soft);
    white-space: nowrap;
}

tbody tr:last-child td { border-bottom: 0; }

.empty { padding: 2rem 1rem; text-align: center; color: var(--ink-soft); }

/* ---------- Bits ---------- */

.pill {
    display: inline-block;
    padding: .18rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .03em;
    white-space: nowrap;
}

.pill-ok { background: var(--ok-tint); color: var(--ok); }
.pill-off { background: #eceff2; color: var(--ink-soft); }
.pill-admin { background: var(--brand-tint); color: var(--brand-dark); }
.pill-warn { background: var(--warn-tint); color: var(--warn); }

.stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}

.stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: .9rem 1rem;
}

.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; color: var(--brand-dark); }
.stat-label { font-size: .8rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; }

.pager { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }

/* ---------- Login screens ---------- */

.auth {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.auth-box { width: 100%; max-width: 420px; }

.auth-logo {
    text-align: center;
    margin-bottom: 1.25rem;
}

.auth-logo strong {
    display: block;
    font-size: 1.35rem;
    color: var(--brand-dark);
}

.auth-logo span { color: var(--ink-soft); font-size: .9rem; }

/* ---------- Bigger screens ---------- */

@media (min-width: 641px) {
    .wrap { padding: 1.5rem; }
    h1 { font-size: 1.75rem; }
    .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1001px) {
    .card { padding: 1.5rem; }
}

/* Respect users who prefer less motion. */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
