/* Stable Monitor — styles taken from the screen mockups */

:root {
    --brand: #0A79A8;
    --brand-blue: #38BCE8;   /* logo blue */
    --brand-deep: #0B4F6C;   /* sign-in panel */
    --logo-purple: #4A164B;
    --logo-amber: #F7B642;
    --logo-pink: #E11D5A;
    --brand-dark: #075C80;
    --brand-soft: #E4F6FC;
    --ink: #111827;
    --ink-2: #374151;
    --ink-3: #4B5563;
    --ink-4: #6B7280;
    --line: #E5E7EB;
    --line-soft: #F1F2F4;
    --ground: #F4F5F7;
    --up: #16A34A;
    --up-text: #15803D;
    --up-bar: #4ADE80;
    --down: #DC2626;
    --down-text: #B91C1C;
    --slow: #F59E0B;
    --slow-text: #B45309;
    --muted: #9CA3AF;
    --mono: "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.45; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); text-decoration: underline; }
h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
h2 { margin: 0; font-size: 16px; font-weight: 700; }
.mono { font-family: var(--mono); }
.muted-text { color: var(--ink-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* Header */
.topbar { background: #fff; border-bottom: 1px solid var(--line); border-top: 4px solid var(--brand-blue);
          border-image: linear-gradient(90deg, var(--logo-purple) 0 25%, var(--logo-amber) 25% 50%, var(--brand-blue) 50% 75%, var(--logo-pink) 75% 100%) 1 0 0 0; }
.brand img { height: 40px; width: auto; display: block; }
.auth-logo { width: 280px; max-width: 100%; height: auto; display: block; }
.topbar-inner { max-width: 1360px; margin: 0 auto; padding: 0 32px; min-height: 64px; display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; font-size: 17px; }
.brand:hover { color: var(--ink); text-decoration: none; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 8px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 500; }
.nav a:hover { background: var(--ground); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--ink-3); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; }
.linkbutton { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; }
.linkbutton:hover { text-decoration: underline; }

/* Page */
.page { max-width: 1360px; margin: 0 auto; padding: 24px 32px 48px; display: flex; flex-direction: column; gap: 22px; }
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.page-head .grow { flex: 1 1 320px; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }
.breadcrumb { font-size: 13px; color: var(--ink-4); }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-left: auto; }

/* Buttons and forms */
.btn { height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid #D1D5DB; background: #fff; color: var(--ink); font: inherit; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--ground); text-decoration: none; color: var(--ink); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-outline { border-color: var(--brand); color: var(--brand); }
.btn-danger { border-color: #FCA5A5; color: var(--down-text); }
.btn-danger:hover { background: #FEF2F2; color: var(--down-text); }
.btn-small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; height: 46px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=url], .field input[type=number],
.field input[type=datetime-local], .field input[type=time], .field select, .field textarea, .search input {
    height: 42px; border: 1px solid #D1D5DB; border-radius: 8px; padding: 0 12px; font: inherit; font-size: 14px; font-weight: 400; color: var(--ink); background: #fff; width: 100%;
}
.field textarea { height: auto; min-height: 80px; padding: 10px 12px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
.field .hint { font-weight: 400; color: var(--ink-4); }
.field.mono-input input { font-family: var(--mono); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); font-weight: 400; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.form-grid-method { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; }
.field-validation-error, .text-danger { color: var(--down-text); font-weight: 500; font-size: 13px; }
.validation-summary-errors ul { margin: 0; padding-left: 18px; }
.search { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #D1D5DB; border-radius: 8px; padding: 0 12px; height: 40px; }
.search input { border: 0; height: 38px; padding: 0; outline: none; }

/* Cards */
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.card-pad { padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; }
.card-head { padding: 16px 20px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-3); }
.columns { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-start; }
.columns > .main { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.columns > .side { flex: 1 1 320px; display: flex; flex-direction: column; gap: 18px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat .label { font-size: 13px; color: var(--ink-3); }
.stat { border-top: 3px solid var(--brand-blue); }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 2px; }
.stat.down { border-color: #FCA5A5; }
.value.up { color: var(--up-text); } .value.down { color: var(--down-text); } .value.slow { color: var(--slow-text); } .value.muted { color: var(--ink-3); }

/* Status */
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; background: var(--muted); }
.dot.up { background: var(--up); } .dot.down { background: var(--down); } .dot.slow { background: var(--slow); } .dot.muted, .dot.paused, .dot.pending { background: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.status.up { color: var(--up-text); } .status.down { color: var(--down-text); } .status.slow { color: var(--slow-text); } .status.muted, .status.paused, .status.pending { color: var(--ink-3); }
.pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.pill.up { background: #DCFCE7; color: #166534; } .pill.down { background: #FEE2E2; color: #991B1B; } .pill.slow { background: #FEF3C7; color: #92400E; }
.pill.muted, .pill.paused, .pill.pending { background: #F3F4F6; color: var(--ink-2); }
.tag { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 4px; background: #F3F4F6; color: var(--ink-2); }
.tag.Down, .tag.Reminder { background: #FEE2E2; color: #991B1B; } .tag.Recovered { background: #DCFCE7; color: #166534; } .tag.Ssl { background: #FEF3C7; color: #92400E; }

/* Banner and flash messages */
.banner { display: flex; align-items: center; gap: 14px; background: #FEF2F2; border: 1px solid #FCA5A5; border-radius: 12px; padding: 14px 18px; color: #7F1D1D; flex-wrap: wrap; }
.banner:hover { color: #7F1D1D; text-decoration: none; background: #FEE9E9; }
.banner strong { font-weight: 600; }
.flash { border-radius: 10px; padding: 12px 16px; border: 1px solid; }
.flash.ok { background: #F0FDF4; border-color: #BBF7D0; color: #166534; }
.flash.error { background: #FEF2F2; border-color: #FCA5A5; color: #991B1B; }
.flash.info { background: var(--brand-soft); border-color: #A9DFF3; color: var(--brand-dark); }

/* Dashboard tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 20px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.tile.down { border-color: #FCA5A5; }
.tile-head { display: flex; align-items: flex-start; gap: 12px; }
.tile-head .grow { flex: 1; min-width: 0; }
.tile-head h2 { font-size: 17px; }
.tile-head h2 a { color: var(--ink); }
.tile-sub { font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.ep-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.ep-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.ep-row .state { font-size: 12px; font-weight: 600; width: 64px; text-align: right; }
.ep-row .uptime { font-family: var(--mono); font-size: 13px; color: var(--ink-2); width: 68px; text-align: right; }
.empty { color: var(--ink-4); padding: 8px 0; }

/* Bar strips */
.bars { display: flex; gap: 2px; height: 22px; }
.bars span { flex: 1; border-radius: 2px; background: #E5E7EB; min-width: 1px; }
.bars.thin { gap: 1px; height: 12px; }
.bars.thin span { border-radius: 0; }
.bars span.up { background: var(--up-bar); } .bars span.down { background: var(--down); } .bars span.slow { background: var(--slow); } .bars span.none { background: #E5E7EB; }
.bar-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-4); margin-top: 5px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th { text-align: left; color: var(--ink-3); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; padding: 10px 12px; white-space: nowrap; }
table.grid td { padding: 12px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
table.grid th:first-child, table.grid td:first-child { padding-left: 20px; }
table.grid th:last-child, table.grid td:last-child { padding-right: 20px; }
table.grid tr.fail td { background: #FEF7F7; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions a, .row-actions button { font-weight: 600; font-size: 13px; }
.row-actions .sep { color: #D1D5DB; margin: 0 8px; }

/* History chart */
.chart { display: flex; gap: 10px; }
.chart .axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--ink-4); text-align: right; height: 200px; }
.chart .plot { flex: 1; min-width: 0; }
.chart svg { width: 100%; height: 200px; display: block; }
.segmented { display: flex; border: 1px solid #D1D5DB; border-radius: 8px; overflow: hidden; margin-left: auto; }
.segmented a { padding: 8px 14px; font-size: 13px; color: var(--ink-2); border-left: 1px solid #D1D5DB; }
.segmented a:first-child { border-left: 0; }
.segmented a.active { background: var(--brand); color: #fff; font-weight: 600; }
.segmented a:hover { text-decoration: none; }
.kpis { display: flex; gap: 20px; font-size: 13px; color: var(--ink-3); flex-wrap: wrap; }
.kpis strong { color: var(--ink); }
.list-item { padding: 13px 20px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 4px; }
.list-item:first-child { border-top: 0; }

/* Test result */
.test-result { border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; border: 1px solid; }
.test-result.ok { background: #F0FDF4; border-color: #BBF7D0; }
.test-result.fail { background: #FEF2F2; border-color: #FCA5A5; }
.test-result .line { display: flex; justify-content: space-between; gap: 12px; }
.test-result .line span:first-child { color: var(--ink-3); }

/* Sign in pages (Login, Forgot/Reset password, Setup): same layout as the BMS sign-in page.
   Light or dark follows the computer's setting (data-theme on <html>, set in _AuthLayout). */
.login-page {
    --lg-bg: #ffffff; --lg-card: #ffffff; --lg-border: rgba(0,0,0,.175); --lg-text: #212529; --lg-muted: #6c757d;
    --lg-input-bg: #ffffff; --lg-input-border: #dee2e6; --lg-addon: #f8f9fa;
    --lg-btn: #212529; --lg-btn-hover: #424649;
    --lg-ok-bg: #d1e7dd; --lg-ok-border: #a3cfbb; --lg-ok-text: #0a3622; --lg-error: #dc3545;
    margin: 0; background: var(--lg-bg); color: var(--lg-text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 16px; line-height: 1.5;
}
html[data-theme=dark] .login-page {
    --lg-bg: #212529; --lg-card: #212529; --lg-border: rgba(255,255,255,.15); --lg-text: #dee2e6; --lg-muted: #adb5bd;
    --lg-input-bg: #212529; --lg-input-border: #495057; --lg-addon: #2b3035;
    --lg-btn: #0d6efd; --lg-btn-hover: #0b5ed7;
    --lg-ok-bg: #051b11; --lg-ok-border: #0f5132; --lg-ok-text: #75b798; --lg-error: #ea868f;
}
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.login-card { width: 100%; max-width: 1080px; display: flex; background: var(--lg-card); border: 1px solid var(--lg-border);
    border-radius: 16px; box-shadow: 0 .5rem 1rem rgba(0,0,0,.15); overflow: hidden; }
.login-brand-panel { flex: 1 1 50%; min-height: 560px; display: flex; align-items: center; justify-content: center; padding: 32px;
    background: linear-gradient(135deg, #0f1e3f 0%, #163464 55%, #00A1D6 140%); }
.login-brand-text { color: #fff; font-weight: 700; font-size: 3.8rem; line-height: 1.2; text-align: center; text-shadow: 0 3px 6px rgba(0,0,0,.5); }
.login-form { flex: 1 1 50%; padding: 48px; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.login-logo { width: 220px; max-width: 100%; height: auto; margin: 0 auto 24px; }
.login-logo-light { display: block; } .login-logo-dark { display: none; }
html[data-theme=dark] .login-logo-light { display: none; } html[data-theme=dark] .login-logo-dark { display: block; }
.login-heading { font-size: 1.25rem; font-weight: 400; margin: 0 0 16px; padding-bottom: 16px; }
.login-form h2 { font-size: 1.25rem; font-weight: 400; margin: 0 0 8px; }
.login-form p { margin: 0 0 16px; color: var(--lg-muted); }
.login-form a { color: var(--lg-muted); }
.login-form a:hover { color: var(--lg-text); }
.login-success { background: var(--lg-ok-bg); border: 1px solid var(--lg-ok-border); color: var(--lg-ok-text); border-radius: 6px; padding: 8px 14px; font-size: 14px; margin-bottom: 16px; }
.login-error, .login-field-error { color: var(--lg-error); font-size: 14px; display: block; }
.login-error { margin-bottom: 8px; }
.login-field-error:not(:empty) { margin: -10px 0 12px; }
.login-input-group { display: flex; margin-bottom: 16px; }
.login-input-group input { flex: 1; min-width: 0; height: 38px; padding: 6px 12px; font: inherit; color: var(--lg-text); background: var(--lg-input-bg);
    border: 1px solid var(--lg-input-border); border-radius: 6px 0 0 6px; }
.login-input-group input:focus { outline: 0; border-color: #86b7fe; box-shadow: 0 0 0 .25rem rgba(13,110,253,.25); }
.login-addon { display: flex; align-items: center; padding: 0 12px; color: var(--lg-text); background: var(--lg-addon);
    border: 1px solid var(--lg-input-border); border-left: 0; border-radius: 0 6px 6px 0; }
.login-check { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.login-check input { width: 16px; height: 16px; margin: 0; accent-color: #0d6efd; }
.login-button, .login-form .btn-primary { width: 100%; height: 48px; justify-content: center; border: 1px solid var(--lg-btn); border-radius: 8px;
    background: var(--lg-btn); color: #fff; font: inherit; font-size: 1.25rem; cursor: pointer; }
.login-button:hover, .login-form .btn-primary:hover { background: var(--lg-btn-hover); border-color: var(--lg-btn-hover); color: #fff; }
.login-forgot { text-align: center; margin-top: 16px; font-size: 14px; }
/* The other sign-in pages (setup, forgot and reset password) keep their labelled fields */
.login-form .field { color: var(--lg-text); margin-bottom: 16px; }
.login-form .field input { background: var(--lg-input-bg); color: var(--lg-text); border-color: var(--lg-input-border); }
html[data-theme=dark] .login-form .flash.ok { background: var(--lg-ok-bg); border-color: var(--lg-ok-border); color: var(--lg-ok-text); }
html[data-theme=dark] .login-form .flash.error { background: #2c0b0e; border-color: #842029; color: var(--lg-error); }

@media (max-width: 767px) {
    .login-brand-panel { display: none; }
    .login-form { padding: 24px; }
}

@media (max-width: 720px) {
    .topbar-inner, .page { padding-left: 16px; padding-right: 16px; }
    .form-grid-2, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
    .tiles { grid-template-columns: minmax(0, 1fr); }
}
