/* ===== components.css: glass cards, buttons, inputs, badges, tables, toasts ===== */
.glass { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: 0 10px 40px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.05); }
.pad { padding: 1.1rem 1.25rem; }

.btn { font: 600 .88rem var(--font); color: var(--text); background: rgba(255,255,255,.06); border: 1px solid var(--line);
  padding: .6rem 1rem; border-radius: 12px; cursor: pointer; transition: .18s; display: inline-block; text-decoration: none; }
.btn:hover { background: rgba(255,255,255,.11); text-decoration: none; }
.btn.primary { border: 0; background: linear-gradient(120deg, var(--blue), var(--violet)); box-shadow: 0 6px 24px rgba(99,102,241,.4); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.danger { color: #ffb3c0; border-color: rgba(255,77,109,.4); }
.btn.wide { width: 100%; padding: .8rem; } .btn[disabled] { opacity: .5; cursor: wait; }

label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .9rem; }
input[type=text], input[type=email], input[type=password], input:not([type]) { display: block; width: 100%; margin-top: .35rem; padding: .7rem .85rem;
  font: 400 .95rem var(--font); color: var(--text); background: rgba(5,9,26,.6); border: 1px solid var(--line); border-radius: 12px; }
input:focus { border-color: var(--cyan); outline: none; box-shadow: 0 0 0 3px rgba(34,211,238,.18); }
.form-card { max-width: 520px; padding: 1.4rem; }

.alert { padding: .7rem .9rem; border-radius: 12px; margin: .8rem 0; font-size: .88rem; }
.alert.bad { background: rgba(255,77,109,.12); border: 1px solid rgba(255,77,109,.4); color: #ffc2cd; }

/* status badge: colour is set by the class the JS adds (online/degraded/offline/disabled/pending) */
.badge { font: 600 .72rem var(--font); padding: .22rem .6rem; border-radius: 99px; vertical-align: middle; margin-left: .4rem;
  background: rgba(255,255,255,.08); display: inline-flex; align-items: center; gap: .4rem; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.online { color: var(--ok); background: rgba(52,211,153,.12); } .badge.online::before { animation: pulse 1.8s infinite; }
.badge.degraded { color: var(--warn); background: rgba(251,191,36,.12); }
.badge.offline { color: var(--bad); background: rgba(255,77,109,.12); }
.badge.disabled, .badge.pending { color: var(--muted); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; color: var(--muted); font-weight: 400; padding: .55rem .7rem; border-bottom: 1px solid var(--line); }
.tbl td { padding: .6rem .7rem; border-bottom: 1px solid rgba(130,160,255,.07); }
.tbl tbody tr { cursor: pointer; transition: background .15s; } .tbl tbody tr:hover, .tbl tbody tr.sel { background: rgba(99,102,241,.14); }
.na { color: var(--muted); font-style: italic; }            /* "unavailable" is shown as a dash, never as 0 */
.table-scroll { overflow-x: auto; }
.up-c { color: var(--up); } .down-c { color: var(--down); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; margin: .8rem 0 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; }
.code { background: rgba(5,9,26,.7); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; overflow: auto; font: 12.5px/1.6 ui-monospace, Menlo, Consolas, monospace; max-height: 340px; }

.seg { display: inline-flex; background: rgba(255,255,255,.05); border-radius: 12px; padding: 3px; }
.seg button { font: 600 .8rem var(--font); background: none; border: 0; color: var(--muted); padding: .4rem .8rem; border-radius: 9px; cursor: pointer; }
.seg button.on { background: linear-gradient(120deg, var(--blue), var(--violet)); color: #fff; }

.switch { display: flex; align-items: center; gap: .6rem; font-size: .8rem; color: var(--muted); cursor: pointer; margin: 0 0 .8rem; }
.switch input { display: none; } .switch i { width: 34px; height: 20px; border-radius: 99px; background: rgba(255,255,255,.12); position: relative; transition: .2s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + i { background: var(--blue); } .switch input:checked + i::after { left: 17px; }

/* connection-test steps */
.steps { list-style: none; padding: 0; margin: .8rem 0; display: grid; gap: .5rem; }
.steps li { display: grid; grid-template-columns: 26px 1fr auto; gap: .7rem; align-items: center; padding: .6rem .8rem; border-radius: 12px; background: rgba(255,255,255,.04); animation: slidein .35s both; }
.steps .ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; }
.steps .spin .ic { border: 2px solid var(--line); border-top-color: var(--cyan); animation: spin .8s linear infinite; }
.steps .pass .ic { background: rgba(52,211,153,.18); color: var(--ok); } .steps .fail .ic { background: rgba(255,77,109,.18); color: var(--bad); }
.steps .skip .ic { background: rgba(255,255,255,.08); color: var(--muted); }
.steps small { display: block; color: var(--muted); } .steps .res { font-weight: 700; font-size: .8rem; }
.verdict { font-weight: 600; } .verdict.ok { color: var(--ok); } .verdict.bad { color: var(--bad); }
@keyframes spin { to { transform: rotate(360deg); } } @keyframes slidein { from { opacity: 0; transform: translateY(6px); } }

.events { list-style: none; padding: 0; margin: .8rem 0 0; display: grid; gap: .4rem; font-size: .88rem; }
.events li { display: flex; gap: .8rem; color: var(--muted); } .events time { min-width: 150px; }

.toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; z-index: 50; }
.toast { padding: .75rem 1rem; border-radius: 12px; background: #131b3d; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: slidein .3s both; }
.toast.ok { border-color: rgba(52,211,153,.5); } .toast.bad { border-color: rgba(255,77,109,.5); }
