:root {
  --bg: #07100f;
  --surface: rgba(16, 28, 26, .86);
  --surface-strong: #12201e;
  --line: rgba(165, 207, 190, .14);
  --text: #f0f7f4;
  --muted: #91a7a0;
  --accent: #8df0bf;
  --accent-strong: #49d493;
  --danger: #ff7e7e;
  --warn: #f6c86e;
  --radius: 18px;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 75% 0, #123229 0, transparent 35%), var(--bg); }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.ambient { position: fixed; width: 420px; height: 420px; border-radius: 50%; filter: blur(110px); opacity: .12; pointer-events: none; }
.ambient-one { background: #57e8aa; top: -180px; right: 8%; }
.ambient-two { background: #2ba4a0; bottom: -240px; left: 25%; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); padding: 40px; border: 1px solid var(--line); border-radius: 24px; background: rgba(10, 20, 18, .9); box-shadow: 0 30px 80px rgba(0,0,0,.38); backdrop-filter: blur(20px); }
.brand-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 15px; color: #062017; background: linear-gradient(135deg, var(--accent), #43c9b1); font-size: 24px; font-weight: 900; box-shadow: 0 10px 30px rgba(73,212,147,.18); }
.brand-mark.small { width: 38px; height: 38px; border-radius: 11px; font-size: 18px; }
.eyebrow { margin: 24px 0 8px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-size: 20px; letter-spacing: -.02em; }
.muted { color: var(--muted); line-height: 1.7; }
label { display: grid; gap: 8px; color: #c7d6d1; font-size: 13px; font-weight: 600; }
input, select { width: 100%; border: 1px solid var(--line); border-radius: 11px; outline: 0; color: var(--text); background: #0b1715; padding: 12px 14px; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus { border-color: rgba(141,240,191,.65); box-shadow: 0 0 0 3px rgba(141,240,191,.1); }
.token-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.login-card form { display: grid; gap: 18px; margin-top: 28px; }
.primary, .ghost, .danger, .icon-button { border: 0; border-radius: 11px; padding: 11px 16px; font-weight: 750; }
.primary { color: #052116; background: linear-gradient(135deg, var(--accent), var(--accent-strong)); }
.primary:hover { filter: brightness(1.06); }
.ghost, .icon-button { color: #d3e1dc; border: 1px solid var(--line); background: rgba(255,255,255,.035); }
.ghost:hover, .icon-button:hover { background: rgba(255,255,255,.07); }
.danger { color: #2c0808; background: var(--danger); }
.full { width: 100%; }
.form-error { min-height: 20px; margin: -8px 0 0; color: var(--danger); font-size: 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 245px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 26px 20px; border-right: 1px solid var(--line); background: rgba(7,16,15,.82); backdrop-filter: blur(18px); }
.brand-block { display: flex; align-items: center; gap: 12px; padding: 0 4px 30px; }
.brand-block strong, .brand-block span { display: block; }
.brand-block span { margin-top: 3px; color: var(--muted); font-size: 11px; letter-spacing: .08em; }
nav { flex: 1; }
.nav-item { width: 100%; display: flex; gap: 11px; align-items: center; border: 0; border-radius: 11px; padding: 12px 14px; color: var(--text); background: rgba(141,240,191,.1); text-align: left; }
.nav-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent); }
.sidebar-foot { display: grid; gap: 14px; }
.service-state { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.status-dot.online { background: var(--accent-strong); box-shadow: 0 0 12px rgba(73,212,147,.7); }

.main-content { width: min(1500px, 100%); padding: 40px clamp(24px, 4vw, 60px) 70px; }
.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin-bottom: 30px; }
.topbar .eyebrow, .panel-heading .eyebrow { margin-top: 0; }
.topbar p { margin-bottom: 0; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric, .panel { border: 1px solid var(--line); background: var(--surface); box-shadow: 0 18px 50px rgba(0,0,0,.16); backdrop-filter: blur(12px); }
.metric { display: grid; gap: 7px; padding: 20px; border-radius: 15px; }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { font-size: 30px; letter-spacing: -.04em; }
.metric small { color: #627a73; }
.panel { margin-bottom: 18px; padding: 24px; border-radius: var(--radius); }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px; }
.badge { padding: 7px 10px; border-radius: 999px; font-size: 11px; }
.badge.neutral { color: var(--muted); border: 1px solid var(--line); }
.create-form { display: grid; grid-template-columns: 130px 150px minmax(240px, 1fr) auto; align-items: end; gap: 14px; }
.filters { display: flex; gap: 10px; }
.filters input { min-width: 260px; }
.filters select { width: 130px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 12px 10px; color: #738a83; font-size: 11px; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
td { padding: 15px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
code { color: #bcebd7; font-family: "Cascadia Code", Consolas, monospace; }
.machine { display: block; max-width: 220px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 750; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.active { color: var(--accent); background: rgba(73,212,147,.1); }
.status.disabled { color: var(--danger); background: rgba(255,126,126,.1); }
.status.expired { color: var(--warn); background: rgba(246,200,110,.1); }
.row-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.row-actions button { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; color: #c5d5cf; background: transparent; font-size: 11px; }
.row-actions button:hover { border-color: rgba(141,240,191,.45); color: var(--accent); }
.actions-col { min-width: 170px; }
.empty-state { padding: 42px; color: var(--muted); text-align: center; }

.dialog-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.7); backdrop-filter: blur(8px); }
.dialog { width: min(560px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface-strong); box-shadow: 0 30px 90px rgba(0,0,0,.5); }
.dialog.compact { width: min(440px, 100%); }
.dialog .eyebrow { margin-top: 0; }
.license-list { width: 100%; min-height: 210px; resize: vertical; margin: 22px 0 12px; padding: 14px; border: 1px dashed rgba(141,240,191,.35); border-radius: 11px; outline: 0; color: #bcebd7; background: #081310; font: 13px/1.8 "Cascadia Code", Consolas, monospace; white-space: pre; }
.license-list:focus { border-color: rgba(141,240,191,.65); box-shadow: 0 0 0 3px rgba(141,240,191,.1); }
.result-actions { display: flex; gap: 10px; }
.dialog-meta { display: flex; justify-content: space-between; margin-bottom: 22px; padding: 10px 0; color: var(--muted); font-size: 12px; }
.dialog-meta strong { color: var(--text); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.toast { position: fixed; z-index: 30; right: 24px; bottom: 24px; max-width: 360px; transform: translateY(20px); opacity: 0; pointer-events: none; padding: 13px 16px; border: 1px solid var(--line); border-radius: 11px; background: #172925; box-shadow: 0 18px 50px rgba(0,0,0,.35); transition: .2s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-color: rgba(255,126,126,.35); color: #ffd0d0; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 20px; padding: 16px 22px; }
  .brand-block { padding: 0; }
  .sidebar nav { display: none; }
  .sidebar-foot { margin-left: auto; display: flex; align-items: center; }
  .sidebar-foot .ghost { width: auto; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .main-content { padding: 28px 16px 50px; }
  .topbar, .panel-heading, .table-heading { align-items: stretch; flex-direction: column; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .create-form { grid-template-columns: 1fr; }
  .result-actions { flex-direction: column; }
  .filters { flex-direction: column; }
  .filters input, .filters select { min-width: 0; width: 100%; }
  .service-state { display: none; }
  .brand-block strong { font-size: 13px; }
  .brand-block span { display: none; }
  .login-card { padding: 28px 22px; }
}
