:root {
  color-scheme: dark;
  --bg: #0c0d12;
  --panel: #14161e;
  --panel-2: #1a1d27;
  --line: #292d3a;
  --text: #f5f6fa;
  --muted: #9298aa;
  --accent: #7c5cff;
  --accent-2: #9e8aff;
  --danger: #ff5c75;
  --success: #4bd99f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at 80% -10%, #211a43 0, transparent 30%), var(--bg); color: var(--text); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; margin: 0 0 4px; }
.eyebrow { color: var(--accent-2); text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 800; margin: 0 0 7px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 29px; letter-spacing: -.04em; }
h2 { margin-bottom: 0; }
.primary, .ghost, .danger { border: 1px solid transparent; border-radius: 10px; padding: 10px 15px; color: white; font-weight: 700; transition: .18s ease; }
.primary { background: linear-gradient(135deg, var(--accent), #6442ea); box-shadow: 0 8px 28px #7356ff33; }
.primary:hover { transform: translateY(-1px); filter: brightness(1.08); }
.ghost { background: transparent; border-color: var(--line); }
.ghost:hover { background: var(--panel-2); }
.danger { background: #ff5c7518; color: #ff8fa1; border-color: #ff5c7533; }
.full { width: 100%; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(410px, 100%); padding: 38px; background: #14161ee8; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 26px 80px #0008; backdrop-filter: blur(18px); }
.brand-mark, .logo span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, #957eff, #5c39dc); font-weight: 900; box-shadow: 0 8px 22px #6849ef55; }
.login-card .brand-mark { margin-bottom: 24px; }
.login-card h1 { margin-bottom: 9px; }
.login-card .muted { margin-bottom: 26px; }
label { color: #c9cdd8; display: grid; gap: 7px; font-size: 13px; font-weight: 650; margin-bottom: 17px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: #0f1118; color: var(--text); border-radius: 9px; padding: 11px 12px; outline: none; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #7c5cff1f; }
.error { min-height: 18px; color: var(--danger); font-size: 13px; margin: 14px 0 0; }
.app { min-height: 100vh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 16px; border-right: 1px solid var(--line); background: #101118cc; backdrop-filter: blur(16px); display: flex; flex-direction: column; }
.logo { display: flex; align-items: center; gap: 11px; padding: 0 8px 28px; font-size: 17px; }
.logo span { width: 34px; height: 34px; border-radius: 10px; }
nav { display: grid; gap: 6px; }
.nav-item { border: 0; background: transparent; color: var(--muted); border-radius: 10px; padding: 11px 13px; text-align: left; display: flex; gap: 10px; font-weight: 700; }
.nav-item:hover, .nav-item.active { color: white; background: var(--panel-2); }
.nav-item.active { box-shadow: inset 3px 0 var(--accent); }
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--line); padding: 18px 8px 0; }
.sidebar-bottom strong { display: block; margin-bottom: 14px; }
main { padding: 36px clamp(26px, 5vw, 68px) 70px; max-width: 1500px; width: 100%; margin: 0 auto; }
header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 27px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stats article { background: linear-gradient(145deg, var(--panel), #11131a); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.stats span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.stats strong { font-size: 26px; }
.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 220px; gap: 12px; margin-bottom: 14px; }
.table-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--panel); }
.table-row { display: grid; grid-template-columns: minmax(250px, 2fr) 120px minmax(120px, 1fr) 115px 100px; align-items: center; gap: 14px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.table-row:last-child { border-bottom: 0; }
.table-row.head { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; background: #10121a; padding-top: 12px; padding-bottom: 12px; }
.package-name { display: flex; gap: 12px; align-items: center; min-width: 0; }
.package-icon { width: 38px; height: 38px; border-radius: 9px; background: #272b38; display: grid; place-items: center; overflow: hidden; flex: none; font-weight: 900; color: var(--accent-2); }
.package-icon img { width: 100%; height: 100%; object-fit: contain; }
.package-name strong, .package-name span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.package-name span { color: var(--muted); font-size: 12px; margin-top: 3px; }
.badge { display: inline-flex; width: fit-content; padding: 5px 8px; border-radius: 99px; background: #7c5cff1c; color: #a998ff; font-size: 11px; font-weight: 800; }
.status { color: var(--success); font-size: 12px; font-weight: 800; }
.status.off { color: var(--muted); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; color: var(--muted); border: 1px solid var(--line); background: transparent; border-radius: 8px; font-size: 18px; }
.icon-btn:hover { color: white; background: var(--panel-2); }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.group-card { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); padding: 20px; position: relative; overflow: hidden; }
.group-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--group-color); }
.group-card .top { display: flex; justify-content: space-between; gap: 12px; }
.group-card p { color: var(--muted); font-size: 13px; min-height: 38px; margin: 10px 0 18px; }
.group-card footer { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.empty { text-align: center; color: var(--muted); padding: 50px 20px; }
dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 17px; padding: 0; box-shadow: 0 30px 100px #000b; }
dialog::backdrop { background: #05060aa8; backdrop-filter: blur(4px); }
dialog form { padding: 24px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.wide { grid-column: 1 / -1; }
.hint { color: var(--muted); font-weight: 400; }
.check { display: flex; grid-auto-flow: column; justify-content: start; align-items: center; gap: 9px; }
.check input { width: auto; accent-color: var(--accent); }
.dialog-actions { border-top: 1px solid var(--line); padding-top: 18px; display: flex; justify-content: flex-end; gap: 9px; }
.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; opacity: 0; transform: translateY(10px); pointer-events: none; background: #242735; color: white; border: 1px solid #353a4a; padding: 12px 16px; border-radius: 10px; box-shadow: 0 15px 50px #0008; transition: .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.bad { border-color: #ff5c7566; color: #ff9bac; }
@media (max-width: 800px) {
  .app { grid-template-columns: 72px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }.logo strong, .nav-item span, .sidebar-bottom { display: none; }
  .logo { padding-inline: 8px; }.nav-item { justify-content: center; font-size: 20px; }
  main { padding: 25px 18px; }.stats { grid-template-columns: 1fr 1fr 1fr; }
  .table-row { grid-template-columns: minmax(220px, 1fr) 100px 90px; }.table-row > :nth-child(3), .table-row > :nth-child(4) { display: none; }
}
