:root {
  --obsidian: #07090E; --midnight: #0D1322; --cyan: #00F0FF; --purple: #7000FF; --violet: #9B4DFF;
  --text: #B9C3D6; --muted: #7D8AA5; --white: #F2F6FF; --glass: rgba(18,27,48,.55); --edge: rgba(0,240,255,.16);
  --ok: #2EE6A6; --warn: #FFB547; --bad: #FF4D6D;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; color: var(--text); font: 15px/1.55 Inter, system-ui, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased;
  background: var(--obsidian);
  background-image: radial-gradient(900px 500px at 85% 0%, rgba(112,0,255,.18), transparent 60%),
    radial-gradient(800px 500px at 0% 35%, rgba(0,240,255,.08), transparent 60%),
    linear-gradient(var(--obsidian), var(--midnight) 50%, var(--obsidian)); background-attachment: fixed; }
h1, h2, h3 { font-family: Sora, Inter, sans-serif; color: var(--white); margin: 0; letter-spacing: -.02em; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; height: 64px; padding: 0 24px;
  background: rgba(7,9,14,.75); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid rgba(0,240,255,.1); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--white); font: 700 17px Sora, Inter, sans-serif; }
.brand svg { width: 30px; height: 30px; color: var(--cyan); filter: drop-shadow(0 0 8px rgba(0,240,255,.5)); }
.brand em { font-style: normal; font: 600 12px Inter, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--cyan);
  padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(0,240,255,.35); background: rgba(0,240,255,.06); }

/* buttons */
button { font: inherit; cursor: pointer; }
.btn, button[type=submit]:not(.btn-ghost) { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 12px 22px;
  font-weight: 600; color: #03121A; background: linear-gradient(90deg, var(--cyan), #5AA8FF 55%, var(--violet)); box-shadow: 0 0 24px rgba(0,240,255,.3); }
.btn:hover, button[type=submit]:not(.btn-ghost):hover { box-shadow: 0 0 36px rgba(0,240,255,.5); }
.btn-ghost, td button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 10px; color: var(--white);
  background: rgba(255,255,255,.04); border: 1px solid rgba(0,240,255,.3); }
.btn-ghost:hover, td button:hover { background: rgba(0,240,255,.09); box-shadow: 0 0 20px rgba(0,240,255,.15); }
.btn-ghost svg { width: 17px; height: 17px; }
button.danger { color: #FFE3E8; background: rgba(255,77,109,.12); border: 1px solid rgba(255,77,109,.55); border-radius: 10px; padding: 9px 16px; }
button.danger:hover { background: rgba(255,77,109,.22); box-shadow: 0 0 20px rgba(255,77,109,.25); }

/* cards and forms */
.card { background: var(--glass); border: 1px solid var(--edge); border-radius: 18px; padding: 22px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05); display: grid; gap: 14px; margin-bottom: 18px; }
.card.flush { padding: 6px 0; overflow-x: auto; }
.card h3 { font-size: 18px; }
.card:not(.login) > button { justify-self: start; min-width: 200px; }
label { display: grid; gap: 6px; color: var(--text); font-size: 13px; font-weight: 500; }
input, select, textarea { font: inherit; font-size: 15px; color: var(--white); background: rgba(7,9,14,.6); border: 1px solid rgba(0,240,255,.18);
  border-radius: 10px; padding: 10px 12px; width: 100%; }
input::placeholder, textarea::placeholder { color: #55617A; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,240,255,.12); }
select option { background: var(--midnight); }
fieldset { border: 1px solid rgba(0,240,255,.14); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; margin: 0; }
legend { color: var(--white); font-weight: 600; padding: 0 6px; }
label.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--white); }
label.check input { width: 18px; height: 18px; accent-color: var(--cyan); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 8px; }
.sub { margin: 0; color: var(--muted); font-size: 14px; }
.note { margin: 0; color: var(--muted); font-size: 13px; } .note.ok { color: var(--ok); } .center { text-align: center; }

/* login */
#login-view { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 32px 16px; }
.login { width: 100%; max-width: 440px; padding: 34px; gap: 16px; }
.login h1 { font-size: 28px; }
.badge { justify-self: start; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(0,240,255,.35);
  background: rgba(0,240,255,.06); color: var(--cyan); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* layout */
#app-view:not([hidden]) { display: grid; grid-template-columns: 230px 1fr; min-height: calc(100vh - 64px); }
.side { border-right: 1px solid rgba(0,240,255,.1); background: rgba(7,9,14,.45); padding: 22px 14px; display: flex; flex-direction: column; justify-content: space-between; }
.side nav { display: grid; gap: 6px; }
.side nav button { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; border: 1px solid transparent; background: none;
  color: var(--text); font-weight: 500; text-align: left; }
.side nav button svg { width: 20px; height: 20px; color: var(--cyan); }
.side nav button:hover { color: var(--white); background: rgba(0,240,255,.06); }
.side nav button.active { color: var(--white); background: linear-gradient(90deg, rgba(0,240,255,.16), rgba(112,0,255,.12)); border-color: rgba(0,240,255,.3);
  box-shadow: 0 0 22px rgba(0,240,255,.12); }
.side-foot { color: #55617A; font-size: 12px; margin: 0; padding: 0 14px; }
.content { padding: 28px 32px 60px; min-width: 0; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 20px; margin-bottom: 22px; }
.head h2 { font-size: 30px; width: 100%; }
.head .sub { flex: 1; }
.tools { display: flex; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; align-items: start; }
.stack > .card:last-child { margin-bottom: 0; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 10px; }
.tile { position: relative; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 14px; padding: 18px; border-radius: 18px;
  background: var(--glass); border: 1px solid var(--edge); box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }
.tile .ico { grid-row: span 2; display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 13px;
  color: var(--tone, var(--cyan)); background: linear-gradient(135deg, rgba(0,240,255,.12), rgba(112,0,255,.16)); border: 1px solid rgba(0,240,255,.22); }
.tile .ico svg { width: 24px; height: 24px; filter: drop-shadow(0 0 6px currentColor); }
.tile b { font: 700 28px/1.1 Sora, Inter, sans-serif; color: var(--white); }
.tile span { color: var(--muted); font-size: 13px; }
.tile.ok { --tone: var(--ok); } .tile.warn { --tone: var(--warn); } .tile.bad { --tone: var(--bad); } .tile.violet { --tone: var(--violet); }
.tile.bad.on { border-color: rgba(255,77,109,.5); box-shadow: 0 0 26px rgba(255,77,109,.15); }
#versions .note { margin: 4px 2px 22px; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 12px 14px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  border-bottom: 1px solid rgba(0,240,255,.12); }
td { padding: 12px; border-bottom: 1px solid rgba(255,255,255,.05); color: var(--white); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(0,240,255,.03); }
td.dev { min-width: 200px; }
td.dev b { display: block; font-weight: 600; } td.dev small { display: block; max-width: 230px; word-break: break-all; color: var(--muted); font: 11px/1.4 ui-monospace, Consolas, monospace; }
td.muted { color: var(--muted); }
td.nowrap { white-space: nowrap; }
td .pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: var(--muted); background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); }
td .pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.state-healthy .pill { color: var(--ok); border-color: rgba(46,230,166,.35); background: rgba(46,230,166,.08); }
.state-offline .pill { color: var(--warn); border-color: rgba(255,181,71,.35); background: rgba(255,181,71,.08); }
.state-problem .pill, .state-revoked .pill { color: var(--bad); border-color: rgba(255,77,109,.35); background: rgba(255,77,109,.08); }
td.actions { min-width: 250px; }
td.actions div { display: flex; flex-wrap: wrap; gap: 6px; max-width: 270px; }
td.actions button { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
tr.retired td { opacity: .55; }

#message { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); margin: 0; padding: 12px 18px; border-radius: 12px; color: var(--white);
  background: rgba(13,19,34,.96); border: 1px solid rgba(0,240,255,.35); box-shadow: 0 0 30px rgba(0,240,255,.2); z-index: 20; }
#message:empty { display: none; }

@media (max-width: 900px) {
  #app-view:not([hidden]) { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid rgba(0,240,255,.1); padding: 10px; }
  .side nav { grid-auto-flow: column; overflow-x: auto; }
  .side-foot { display: none; }
  .content { padding: 20px 16px 60px; }
  .grid2, .row { grid-template-columns: 1fr; }
  .brand em { display: none; }
}
