/* Plesk License Manager - premium dark UI */
:root {
  --bg: #0a0e17;
  --bg-2: #0d1220;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-solid: #121826;
  --panel-2: rgba(255, 255, 255, 0.055);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e7ecf3;
  --muted: #8b93a7;
  --faint: #5b6378;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #a855f7 100%);
  --ok: #2dd4bf;
  --ok-dim: rgba(45, 212, 191, 0.14);
  --warn: #f59e0b;
  --warn-dim: rgba(245, 158, 11, 0.14);
  --bad: #fb7185;
  --bad-dim: rgba(251, 113, 133, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 40px -12px rgba(0, 0, 0, 0.6);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1100px 600px at 12% -8%, rgba(99, 102, 241, 0.16), transparent 55%),
    radial-gradient(900px 500px at 105% 0%, rgba(168, 85, 247, 0.12), transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: rgba(139, 92, 246, 0.35); }

/* scrollbar */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ---------- Login ---------- */
.auth-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}
.brand .logo {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: var(--accent-grad);
  display: grid; place-items: center;
  box-shadow: 0 8px 24px -6px rgba(99,102,241,0.6);
  flex: none;
}
.brand .logo svg { width: 22px; height: 22px; }
.brand h1 { font-size: 16px; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
.brand p { margin: 1px 0 0; font-size: 12px; color: var(--muted); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 7px; font-weight: 500; }
.input, input[type=text], input[type=password], textarea, select {
  width: 100%;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
textarea { resize: vertical; min-height: 90px; font-family: var(--mono); font-size: 12.5px; }
.input:focus, input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 13.5px; font-weight: 550;
  transition: transform .06s, background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: rgba(255,255,255,0.1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent-grad); border: none; color: white; box-shadow: 0 8px 22px -8px rgba(99,102,241,0.7); }
.btn-primary:hover { filter: brightness(1.08); background: var(--accent-grad); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--bad); border-color: rgba(251,113,133,0.4); background: var(--bad-dim); }
.btn-danger:hover { background: rgba(251,113,133,0.22); }
.btn-sm { padding: 7px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; }

.auth-error, .form-error {
  background: var(--bad-dim); border: 1px solid rgba(251,113,133,0.3);
  color: #fecdd3; border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 12.5px; margin-bottom: 14px; display: none;
}
.auth-hint { margin-top: 18px; font-size: 11.5px; color: var(--faint); text-align: center; }

/* ---------- App layout ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: rgba(10, 13, 20, 0.6);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(12px);
  display: flex; flex-direction: column;
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 0 8px; margin-bottom: 28px; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; font-size: 13.5px;
  transition: background .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; opacity: .85; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.nav a.active svg { color: var(--accent-2); opacity: 1; }
.nav .nav-badge { margin-left: auto; font-size: 11px; background: var(--warn-dim); color: var(--warn); border-radius: 20px; padding: 1px 8px; font-weight: 600; }

.side-foot { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 8px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar { width: 32px; height: 32px; border-radius: 9px; background: var(--accent-grad); display: grid; place-items: center; font-weight: 650; font-size: 13px; color: white; flex: none; }
.user-row .u-name { font-size: 13px; font-weight: 550; }
.user-row .u-sub { font-size: 11px; color: var(--faint); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 30px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
  background: rgba(10,14,23,0.72); backdrop-filter: blur(12px);
}
.topbar h2 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: -0.02em; }
.topbar .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.topbar .spacer { flex: 1; }
.content { padding: 26px 30px 60px; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 18px 16px; position: relative; overflow: hidden;
}
.stat::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,0.04), transparent 40%); pointer-events: none; }
.stat .s-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stat .s-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat .s-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--panel-2); }
.stat .s-ico svg { width: 18px; height: 18px; }
.stat .s-val { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.stat .s-foot { font-size: 11.5px; color: var(--faint); margin-top: 8px; }
.ico-indigo { color: #a5b4fc; } .ico-teal { color: var(--ok); } .ico-amber { color: var(--warn); } .ico-rose { color: var(--bad); }

/* ---------- Panels / tables ---------- */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.panel-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; }
.panel-head .spacer { flex: 1; }

table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 600; padding: 12px 18px; border-bottom: 1px solid var(--border); }
tbody td { padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr.clickable:hover { background: var(--panel); cursor: pointer; }

.cell-main { font-weight: 550; }
.cell-sub { font-size: 11.5px; color: var(--faint); margin-top: 2px; }

/* status + badges */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.online { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-dim), 0 0 10px var(--ok); }
.dot.offline { background: var(--faint); }
.dot.never { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-dim); }
.status-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 550; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.badge.ok { background: var(--ok-dim); color: var(--ok); }
.badge.warn { background: var(--warn-dim); color: var(--warn); }
.badge.bad { background: var(--bad-dim); color: var(--bad); }
.badge.neutral { background: var(--panel-2); color: var(--muted); }
.badge.accent { background: rgba(99,102,241,0.16); color: #a5b4fc; }

.os-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.os-tag svg { width: 14px; height: 14px; }

.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 4px 9px; font-size: 11.5px; color: var(--muted); font-family: var(--mono); }

.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* empty state */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; opacity: .4; margin-bottom: 14px; }
.empty h4 { margin: 0 0 6px; color: var(--text); font-size: 15px; }
.empty p { margin: 0 0 18px; font-size: 13px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5, 8, 14, 0.66);
  backdrop-filter: blur(5px); z-index: 100;
  display: none; align-items: flex-start; justify-content: center;
  padding: 48px 20px; overflow-y: auto;
}
.modal-backdrop.show { display: flex; }
.modal {
  width: 100%; max-width: 560px; background: var(--panel-solid);
  border: 1px solid var(--border-strong); border-radius: 18px;
  box-shadow: var(--shadow); animation: pop .18s ease;
}
.modal.lg { max-width: 760px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 650; }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--border); }
.x-btn { background: transparent; border: none; color: var(--muted); padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.x-btn:hover { background: var(--panel-2); color: var(--text); }
.x-btn svg { width: 18px; height: 18px; }

.hr { height: 1px; background: var(--border); margin: 18px 0; border: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* key-value grid */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: 13px; }
.kv .k { color: var(--muted); }
.kv .v { color: var(--text); word-break: break-word; }

/* code block */
.codeblock { position: relative; background: rgba(0,0,0,0.35); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 14px; }
.codeblock pre { margin: 0; font-family: var(--mono); font-size: 12px; color: #cdd6e4; white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow: auto; }
.copy-btn { position: absolute; top: 9px; right: 9px; }

.output { background: #06090f; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; font-family: var(--mono); font-size: 12px; color: #b9c2d4; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; }

/* segmented control */
.seg { display: inline-flex; background: rgba(0,0,0,0.25); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { background: transparent; border: none; color: var(--muted); padding: 7px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 550; }
.seg button.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs button { background: transparent; border: none; color: var(--muted); padding: 10px 14px; font-size: 13px; font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent-2); }

/* job history item */
.job { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.job:last-child { border-bottom: none; }
.job .j-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.job .j-main { flex: 1; min-width: 0; }
.job .j-act { font-weight: 550; font-size: 13px; }
.job .j-meta { font-size: 11.5px; color: var(--faint); margin-top: 2px; }

/* toast */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--panel-solid); border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent); border-radius: 11px; padding: 13px 16px;
  box-shadow: var(--shadow); font-size: 13px; min-width: 240px; max-width: 360px;
  animation: slidein .22s ease; display: flex; gap: 10px; align-items: flex-start;
}
.toast.ok { border-left-color: var(--ok); }
.toast.bad { border-left-color: var(--bad); }
.toast .t-title { font-weight: 600; margin-bottom: 1px; }
.toast .t-msg { color: var(--muted); font-size: 12px; }
@keyframes slidein { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-full { display: grid; place-items: center; padding: 80px; color: var(--muted); }

.note { background: rgba(99,102,241,0.08); border: 1px solid rgba(99,102,241,0.25); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 12.5px; color: #c7cdf5; display: flex; gap: 10px; }
.note svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }

/* responsive */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 90; transform: translateX(-100%); transition: transform .2s; width: 248px; }
  .sidebar.open { transform: none; }
  .topbar { padding: 16px; }
  .content { padding: 18px 16px 50px; }
  .menu-btn { display: grid !important; }
  .row2 { grid-template-columns: 1fr; }
}
.menu-btn { display: none; place-items: center; }
.hide-sm { }
@media (max-width: 560px) { .hide-sm { display: none !important; } }
