:root {
  --bg: #090b10;
  --surface: #11141b;
  --surface-2: #171b24;
  --border: #252b37;
  --text: #f5f7fa;
  --muted: #8e98a8;
  --accent: #72e6b1;
  --accent-deep: #102c22;
  --danger: #ff7c82;
  --warning: #ffc96b;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 50% -20%, #17231e 0, var(--bg) 38%); }
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.topbar {
  height: 72px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; border-bottom: 1px solid rgba(255,255,255,.06);
  position: sticky; top: 0; z-index: 5; backdrop-filter: blur(18px); background: rgba(9,11,16,.78);
}
.brand { color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -.03em; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-button, .quiet-button, .danger-button {
  color: var(--muted); background: transparent; border: 1px solid var(--border); border-radius: 11px;
  height: 40px; padding: 0 14px;
}
.icon-button { width: 40px; padding: 10px; }
.icon-button svg, .search-wrap svg { fill: none; stroke: currentColor; stroke-width: 2; }
.quiet-button:hover, .icon-button:hover { color: var(--text); border-color: #3b4555; }

main { width: min(1180px, calc(100% - 40px)); margin: 52px auto 80px; }
.search-wrap {
  width: min(580px, 100%); margin: 0 auto 42px; height: 54px; border: 1px solid var(--border);
  border-radius: 16px; display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: rgba(17,20,27,.86); box-shadow: 0 20px 60px rgba(0,0,0,.24);
}
.search-wrap:focus-within { border-color: #4b665b; box-shadow: 0 0 0 3px rgba(114,230,177,.08); }
.search-wrap svg { width: 20px; color: var(--muted); }
.search-wrap input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 16px; }
.search-wrap input::placeholder { color: #677180; }

.resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.resource-card {
  position: relative; text-align: left; min-height: 190px; padding: 20px; border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); background: linear-gradient(145deg, rgba(23,27,36,.96), rgba(15,18,24,.96));
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.resource-card:not([disabled]):hover { transform: translateY(-3px); border-color: #3c4d48; box-shadow: 0 18px 40px rgba(0,0,0,.25); }
.resource-card[disabled] { cursor: default; opacity: .72; }
.server-icon {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  background: var(--accent-deep); color: var(--accent); margin-bottom: 26px;
}
.server-icon::before { font-size: 11px; font-weight: 850; letter-spacing: .04em; }
.server-icon.qemu::before { content: "VM"; }
.server-icon.lxc::before { content: "LXC"; font-size: 9px; }
.resource-name { display: block; font-size: 17px; font-weight: 700; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resource-meta { display: block; margin-top: 7px; color: var(--muted); font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 7px; background: #657080; }
.status-dot.running { background: var(--accent); box-shadow: 0 0 0 4px rgba(114,230,177,.1); }
.lock-badge { position: absolute; top: 20px; right: 20px; color: #758091; font-size: 12px; }
.empty, .notice { text-align: center; color: var(--muted); padding: 50px 20px; }
.notice { padding: 14px 18px; margin: 0 0 24px; border: 1px solid #58472b; border-radius: 12px; background: #251e13; color: var(--warning); }

dialog {
  width: min(430px, calc(100% - 32px)); border: 1px solid var(--border); border-radius: 22px;
  padding: 28px; background: var(--surface); color: var(--text); box-shadow: 0 30px 100px rgba(0,0,0,.65);
}
dialog::backdrop { background: rgba(2,3,5,.78); backdrop-filter: blur(5px); }
.wide-dialog { width: min(600px, calc(100% - 32px)); }
.dialog-close { position: absolute; top: 16px; right: 18px; border: 0; background: transparent; color: var(--muted); font-size: 28px; }
.eyebrow { margin: 0 0 7px; color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-weight: 750; font-size: 11px; }
h1, h2 { margin: 0; letter-spacing: -.035em; }
h1 { font-size: 30px; }
h2 { font-size: 24px; }
.muted { color: var(--muted); }
dialog .server-icon { margin-top: 5px; }
dialog label { display: grid; gap: 8px; margin-top: 20px; color: #c7cdd6; font-size: 13px; font-weight: 650; }
input[type="text"], input[type="password"], input[type="number"], input[type="datetime-local"] {
  width: 100%; border: 1px solid var(--border); border-radius: 11px; background: #0c0f14;
  color: var(--text); padding: 12px 13px; outline: none;
}
input:focus { border-color: #4b665b; box-shadow: 0 0 0 3px rgba(114,230,177,.08); }
.primary-button {
  height: 44px; padding: 0 18px; border: 0; border-radius: 11px; color: #07130e; background: var(--accent); font-weight: 800;
}
.primary-button:hover { filter: brightness(1.05); }
.primary-button:disabled { opacity: .5; cursor: wait; }
.full { width: 100%; margin-top: 16px; }
.field-error { min-height: 18px; margin: 8px 0 0; color: var(--danger); font-size: 12px; }
.progress-state { height: 58px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid #344037; border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 28px; }
.admin-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.admin-list { display: grid; gap: 10px; }
.admin-row {
  width: 100%; display: flex; align-items: center; border: 1px solid var(--border);
  border-radius: 14px; padding: 8px; background: var(--surface); color: var(--text);
}
.admin-row:hover { border-color: #3b4555; }
.admin-main { min-width: 0; flex: 1; display: flex; align-items: center; gap: 14px; padding: 6px 8px; border: 0; background: transparent; color: var(--text); text-align: left; }
.admin-row .server-icon { width: 36px; height: 36px; margin: 0; border-radius: 10px; }
.admin-copy { min-width: 0; flex: 1; }
.admin-copy strong, .admin-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-copy small { color: var(--muted); margin-top: 3px; }
.order-actions { display: flex; gap: 5px; }
.order-button { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 9px; background: #0d1016; color: var(--muted); }
.order-button:hover:not(:disabled) { color: var(--text); border-color: #45505f; }
.order-button:disabled { opacity: .25; cursor: default; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 0; }
.toggle-row span { display: grid; gap: 4px; }
.toggle-row small { color: var(--muted); font-weight: 400; }
input[type="checkbox"] { appearance: none; width: 42px; height: 24px; border-radius: 20px; background: #303744; position: relative; transition: .15s; flex: 0 0 auto; }
input[type="checkbox"]::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: white; transition: .15s; }
input[type="checkbox"]:checked { background: var(--accent); }
input[type="checkbox"]:checked::after { transform: translateX(18px); background: #082016; }
fieldset { margin: 10px 0 0; padding: 14px; border: 1px solid var(--border); border-radius: 13px; }
legend { padding: 0 6px; color: var(--muted); font-size: 12px; }
.radio-row { display: flex; grid-template-columns: none; align-items: center; gap: 10px; margin: 8px 0; font-weight: 500; }
.radio-row input[type="number"], .radio-row input[type="datetime-local"] { width: auto; min-width: 110px; padding: 8px; }
.dialog-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; }
.danger-button { color: var(--danger); }
.security-note { margin: 18px 0 0; color: var(--muted); font-size: 12px; }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); opacity: 0;
  padding: 11px 16px; border: 1px solid var(--border); border-radius: 12px; background: #191e27;
  transition: .2s; pointer-events: none; z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .topbar { padding: 0 20px; }
  main { margin-top: 30px; width: min(100% - 24px, 1180px); }
  .search-wrap { margin-bottom: 26px; }
  .resource-grid { grid-template-columns: 1fr; }
  .resource-card { min-height: 160px; }
  .admin-layout { grid-template-columns: 1fr; }
  dialog { padding: 24px; }
  .dialog-actions { flex-direction: column-reverse; }
}
