* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0b0e1a;
  --card: rgba(255, 255, 255, 0.055);
  --card-border: rgba(255, 255, 255, 0.09);
  --text: #eef0f8;
  --muted: #8b90a8;
  --accent: #7c6cff;
  --accent2: #46c8ff;
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  overflow-x: hidden;
}

.hidden { display: none !important; }

.bg-glow {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(600px 400px at 20% 10%, rgba(124, 108, 255, 0.22), transparent 60%),
    radial-gradient(700px 500px at 85% 85%, rgba(70, 200, 255, 0.14), transparent 60%),
    radial-gradient(500px 400px at 70% 20%, rgba(255, 94, 170, 0.10), transparent 60%);
  animation: drift 24s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-2%, 2%, 0) scale(1.06); }
}

/* ---------- login ---------- */
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.login-card {
  width: min(400px, 92vw);
  padding: 48px 40px 40px;
  text-align: center;
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.logo { font-size: 52px; line-height: 1; margin-bottom: 14px; filter: drop-shadow(0 6px 18px rgba(124, 108, 255, 0.5)); }
.logo-sm { font-size: 22px; margin-right: 8px; }

.login-card h1 {
  font-size: 26px; font-weight: 700; letter-spacing: 0.5px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sub { color: var(--muted); font-size: 14px; margin: 6px 0 28px; }

.btn-oidc {
  display: block;
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  text-decoration: none;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  color: white;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-oidc:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(124, 108, 255, 0.35); }
.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: 12px; margin: 22px 0 14px;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--card-border);
}

.field input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.22); }

button {
  margin-top: 16px;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 15px; font-weight: 600;
  color: white;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
button:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(124, 108, 255, 0.35); }
button:active { transform: translateY(0); }
button:disabled { opacity: 0.6; cursor: wait; }

.error { color: #ff7d92; font-size: 13px; margin-top: 14px; }
.warning { color: #ffc86b; font-size: 13px; text-align: center; margin: 0 24px 16px; }

/* ---------- dashboard ---------- */
#dash-view { max-width: 1060px; margin: 0 auto; padding: 28px 24px 40px; animation: rise 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }

.dash-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 30px; gap: 12px; }
.brand {
  font-size: 19px; font-weight: 700; letter-spacing: 0.4px;
  color: var(--text); text-decoration: none;
}
.brand:hover { color: var(--accent2); }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
a.ghost.nav-link {
  display: inline-flex; align-items: center;
  text-decoration: none;
}
a.ghost.nav-link.active {
  color: var(--text);
  border-color: rgba(124, 108, 255, 0.55);
  background: rgba(124, 108, 255, 0.12);
}
.page { animation: rise 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
.page-panel {
  padding: 28px 24px;
  margin-bottom: 28px;
}

.ghost {
  width: auto; margin: 0; padding: 9px 18px;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--muted);
  font-size: 13px; font-weight: 500;
}
.ghost:hover { color: var(--text); border-color: var(--muted); box-shadow: none; }
.ghost.tiny { padding: 6px 12px; font-size: 12px; }
.ghost.danger:hover { color: #ff7d92; border-color: #ff7d92; }
.ghost.accent:hover { color: var(--accent2); border-color: var(--accent); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.tile {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 18px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  text-decoration: none; color: var(--text);
  transition: transform 0.18s, border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
.tile:hover {
  transform: translateY(-3px);
  border-color: rgba(124, 108, 255, 0.55);
  background: rgba(124, 108, 255, 0.09);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
}

.tile .icon {
  width: 46px; height: 46px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(124, 108, 255, 0.28), rgba(70, 200, 255, 0.18));
  border: 1px solid rgba(124, 108, 255, 0.25);
}

.tile .label { min-width: 0; }
.tile .name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .host { color: var(--muted); font-size: 12px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.section-title {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.4px;
  margin-top: 10px;
}

.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 44px; opacity: 0.7; }

.lan-tip {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 28px 0 0;
  opacity: 0.75;
  transition: color 0.15s, opacity 0.15s;
}
.lan-tip kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.25);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}
.lan-tip.armed {
  color: var(--accent2);
  opacity: 1;
}
.lan-host {
  display: none;
  color: var(--accent2) !important;
}
body.lan-hot .lan-host { display: block; }
body.lan-hot .tile .host:not(.lan-host) { display: none; }
body.lan-hot .tile {
  border-color: rgba(70, 200, 255, 0.45);
}

/* ---------- server metrics ---------- */
.metrics {
  margin: 0 0 34px;
  padding: 22px 20px 18px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.metrics-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
.metrics-head h2 { font-size: 18px; margin: 0 0 4px; }
.metrics-sub { color: var(--muted); font-size: 13px; margin: 0; }
.metrics-stamp { font-size: 12px; white-space: nowrap; }
.metrics-gauges {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 900px) {
  .metrics-gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.gauge-card {
  text-align: center;
  padding: 10px 8px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--card-border);
}
.gauge-card canvas { max-width: 140px; margin: 0 auto; display: block; }
.gauge-label { font-weight: 600; font-size: 13px; margin-top: 4px; }
.gauge-detail { font-size: 11px; margin-top: 2px; line-height: 1.35; min-height: 2.5em; }
.card-soft {
  padding: 14px 16px 10px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--card-border);
  margin-bottom: 18px;
}
.trend-wrap {
  position: relative;
  height: 160px;
  width: 100%;
}
.card-soft h3, .metrics-disks h3, .metrics-table-card h3 {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--muted); margin: 0 0 12px;
}
.metrics-disks { margin-bottom: 18px; }
.disk-bars { display: flex; flex-direction: column; gap: 12px; }
.disk-row {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--card-border);
}
.disk-meta {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 13px; margin-bottom: 8px;
}
.disk-meta strong { font-weight: 600; }
.disk-track {
  height: 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.disk-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.45s ease;
}
.disk-fill.warn { background: linear-gradient(90deg, #e6a23c, #ffc86b); }
.disk-fill.crit { background: linear-gradient(90deg, #e05a6e, #ff7d92); }
.metrics-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 800px) {
  .metrics-tables { grid-template-columns: 1fr; }
}
.metrics-table-card {
  padding: 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--card-border);
  min-width: 0;
}
.metrics-table-card.wide { grid-column: 1 / -1; }
.file-drive-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 960px) {
  .file-drive-grid { grid-template-columns: 1fr; }
}
.file-drive-frame {
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--card-border);
  min-width: 0;
}
.file-drive-head {
  display: flex; flex-direction: column; gap: 2px;
  margin-bottom: 10px;
}
.file-drive-head strong { font-size: 13px; font-weight: 600; }
.file-drive-head .muted { font-size: 11px; }
.proc-table { font-size: 12px; overflow-x: auto; }
.proc-table td.file-name { max-width: 160px; cursor: default; }
.proc-table table { width: 100%; border-collapse: collapse; }
.proc-table th {
  text-align: left; color: var(--muted); font-weight: 600;
  padding: 4px 6px 8px; border-bottom: 1px solid var(--card-border);
}
.proc-table td {
  padding: 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: top; max-width: 280px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.proc-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; max-width: none; }
.proc-table tr:last-child td { border-bottom: 0; }

/* ---------- URL manager / settings panels ---------- */
.mgr-panel {
  margin-top: 36px;
  padding: 28px 24px;
  animation: rise 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.mgr-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
}
.mgr-head h2 { font-size: 20px; margin-bottom: 6px; }
.mgr-sub { color: var(--muted); font-size: 13px; line-height: 1.45; }
.mgr-sub code, .hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--accent2);
}
.mgr-block { margin-top: 22px; }
.mgr-block h3 {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1.3px; color: var(--muted); margin-bottom: 12px;
}
.mgr-form {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr auto;
  gap: 12px;
  align-items: end;
}
@media (max-width: 720px) {
  .mgr-form { grid-template-columns: 1fr; }
}
.mgr-form label { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.mgr-form label span { font-size: 12px; color: var(--muted); }
.mgr-form input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.mgr-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.22); }
.mgr-form button { margin-top: 0; width: auto; padding: 12px 18px; white-space: nowrap; }
.suffix-field { display: flex; align-items: center; gap: 0; }
.suffix-field input { border-radius: 12px 0 0 12px; }
.suffix {
  padding: 12px 12px;
  border: 1px solid var(--card-border);
  border-left: 0;
  border-radius: 0 12px 12px 0;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.hint { color: var(--muted); font-size: 12px; margin-top: 10px; }
.muted { color: var(--muted); font-size: 13px; }
.mgr-list { display: flex; flex-direction: column; gap: 8px; }
.mgr-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.18);
}
.mgr-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mgr-row-main a { color: var(--text); font-weight: 600; text-decoration: none; }
.mgr-row-main a:hover { color: var(--accent2); }
.mgr-row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.mgr-status {
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
}
.mgr-status.info { background: rgba(70, 200, 255, 0.12); color: #9edfff; }
.mgr-status.ok { background: rgba(80, 200, 120, 0.14); color: #9dffb8; }
.mgr-status.err { background: rgba(255, 125, 146, 0.14); color: #ff9aad; }

/* ---------- settings ---------- */
.settings-form { display: flex; flex-direction: column; gap: 16px; }
.settings-form fieldset {
  margin: 0; padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.18);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.settings-form fieldset.full { grid-template-columns: 1fr; }
.settings-form legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.1px;
}
.settings-form label { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.settings-form label.full { grid-column: 1 / -1; }
.settings-form label span { font-size: 12px; color: var(--muted); }
.settings-form input, .settings-form textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font-size: 13px;
  outline: none;
  font-family: inherit;
}
.settings-form textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.45;
  min-height: 220px; resize: vertical;
}
.settings-form input:focus, .settings-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.22);
}
.settings-actions { display: flex; justify-content: flex-end; }
.settings-actions button { width: auto; margin: 0; padding: 12px 18px; }
.settings-hk-form { margin-top: 12px; }
@media (max-width: 720px) {
  .settings-form fieldset { grid-template-columns: 1fr; }
}
.hk-once {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(90, 214, 122, 0.35);
  background: rgba(80, 200, 120, 0.1);
}
.hk-once textarea {
  width: 100%;
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
  min-height: 220px;
}
.hk-once-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.hk-once-actions button { width: auto; margin: 0; }
.hk-once code {
  display: block;
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  color: #9dffb8;
  word-break: break-all;
  font-size: 12px;
}
