:root {
  --bg: #071018;
  --panel: #0d1822;
  --panel-2: #101f2b;
  --border: #203341;
  --text: #edf7f7;
  --muted: #8ba0aa;
  --cyan: #45e0d0;
  --cyan-dim: #123d3c;
  --green: #5ee6a8;
  --amber: #ffc568;
  --red: #ff747c;
  --shadow: 0 22px 70px rgba(0, 0, 0, .28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 80% -20%, #153440 0, transparent 38%), var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
code { color: #b7f5ed; font-family: "SFMono-Regular", Consolas, monospace; font-size: .9em; overflow-wrap: anywhere; }

.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--cyan); color: #05201e; font-weight: 900; box-shadow: 0 8px 30px rgba(69,224,208,.22); }
.brand strong, .brand small { display: block; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
main { padding: 54px 0 80px; }
footer { padding: 24px 0 36px; border-top: 1px solid rgba(255,255,255,.07); color: var(--muted); font-size: 12px; }

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(38px, 7vw, 66px); letter-spacing: -.045em; line-height: 1; }
h2 { margin-bottom: 18px; font-size: 22px; letter-spacing: -.02em; }
.eyebrow { margin-bottom: 10px; color: var(--cyan); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.muted { color: var(--muted); line-height: 1.55; }
.small { font-size: 13px; }
.hero-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 38px; }
.headline-status { color: var(--muted); font-size: 18px; }
.headline-status strong { color: var(--text); }
.dot { display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 50%; background: var(--muted); }
.dot.online { background: var(--green); box-shadow: 0 0 16px rgba(94,230,168,.75); }
.dot.offline { background: var(--red); }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border: 1px solid var(--border); border-radius: 11px; background: var(--panel-2); color: var(--text); font-weight: 720; transition: transform .15s, border-color .15s, background .15s; }
.button:hover { transform: translateY(-1px); border-color: #3d5c69; }
.button.primary { border-color: var(--cyan); background: var(--cyan); color: #05201e; }
.button.secondary { background: #142531; }
.button.ghost { background: transparent; }
.button.danger { border-color: #66363e; background: #391c25; color: #ffb6bb; }
.button.compact { min-height: 35px; padding: 0 12px; font-size: 13px; }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 56px; }
.metric, .panel { border: 1px solid var(--border); border-radius: 16px; background: linear-gradient(150deg, rgba(18,37,49,.96), rgba(11,23,32,.96)); box-shadow: var(--shadow); }
.metric { padding: 20px; }
.metric span, .metric small { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin: 8px 0 7px; font-size: 18px; }
.section-title { display: flex; align-items: end; justify-content: space-between; margin-bottom: 16px; }
.section-title h2 { margin: 0; font-size: 30px; }
.refresh-note, .footnote { color: var(--muted); font-size: 12px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 16px; background: rgba(9,20,29,.75); }
table { width: 100%; min-width: 880px; border-collapse: collapse; }
th, td { padding: 17px 16px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 13px; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(69,224,208,.035); }
tbody tr:last-child td { border-bottom: 0; }
td a:hover { color: var(--cyan); }
.status { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; background: #1a2932; color: var(--muted); font-size: 11px; font-weight: 800; }
.status.online { background: rgba(94,230,168,.12); color: var(--green); }
.status.offline { background: rgba(255,116,124,.12); color: #ff9ba1; }
.status.never { background: rgba(255,197,104,.12); color: var(--amber); }
.badge { display: inline-flex; margin-left: 8px; padding: 3px 7px; border-radius: 6px; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.badge.protected { background: rgba(255,197,104,.12); color: var(--amber); }

.panel { padding: 26px; }
.login-wrap { display: grid; min-height: calc(100vh - 250px); place-items: center; }
.login-panel { width: min(440px, 100%); padding: 38px; }
.login-panel h1 { font-size: 42px; }
.stack-form { display: grid; gap: 18px; margin-top: 26px; }
label { display: grid; gap: 8px; color: #c5d4d8; font-size: 13px; font-weight: 700; }
input { width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; outline: 0; background: #07131c; color: var(--text); }
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(69,224,208,.1); }
.inline-error, .flash { border: 1px solid #66363e; border-radius: 10px; background: #321921; color: #ffb6bb; padding: 12px 14px; font-size: 13px; }
.flash-stack { display: grid; gap: 8px; margin-top: 20px; }
.flash.success { border-color: #225847; background: #102d27; color: #9cf4ce; }

.back-link { display: inline-block; margin-bottom: 30px; color: var(--muted); font-size: 13px; }
.back-link:hover { color: var(--cyan); }
.detail-heading { align-items: center; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.full-width { grid-column: 1 / -1; }
dl { margin: 0; }
dl > div { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
dt { color: var(--muted); }
dd { margin: 0; text-align: right; }
.action-row { display: flex; flex-wrap: wrap; gap: 9px; }
.qr-box { margin-top: 20px; padding: 18px; border-radius: 12px; background: #f7ffff; color: #102126; text-align: center; }
.qr-box img { display: block; width: min(300px, 100%); margin: 0 auto 12px; image-rendering: pixelated; }
.qr-box p { margin: 0; font-size: 13px; font-weight: 700; }
.secret-row, .security-actions { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 18px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.secret-row:last-child, .security-actions:last-child { border-bottom: 0; }
.secret-row span, .secret-row code { display: block; }
.secret-row span { margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.security-actions p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.security-actions.revoke { margin-top: 12px; }
.danger-panel { border-color: #3e3036; }
.protected-panel { border-color: #5b4a2d; }

dialog { width: min(480px, calc(100% - 28px)); padding: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0,0,0,.7); backdrop-filter: blur(3px); }
dialog form { padding: 28px; }
.dialog-head { display: flex; justify-content: space-between; }
.dialog-head h2 { margin: 0; font-size: 28px; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 9px; background: transparent; color: var(--muted); font-size: 24px; }

@media (max-width: 850px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 22px, 1180px); }
  .topbar { height: 70px; }
  main { padding-top: 38px; }
  .brand small { display: none; }
  .hero-row, .section-title, .secret-row, .security-actions { align-items: stretch; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric { padding: 18px; }
  .hero-row .button { width: 100%; }
  h1 { font-size: 44px; }
  .login-panel { padding: 26px; }
  .panel { padding: 20px; }
}
