:root {
  --bg: #121417;
  --bg-2: #181b20;
  --elev: #1e2228;
  --elev-2: #252a31;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #e8eaed;
  --muted: #8b929c;
  --green: #3dd68c;
  --green-dim: rgba(61, 214, 140, 0.14);
  --danger: #e15a5a;
  --danger-dim: rgba(225, 90, 90, 0.16);
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --h: 36px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; }
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
form { margin: 0; }
input, select, textarea, button {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  outline: none;
  background: none;
  margin: 0;
}
input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  transition: background-color 9999s ease-out;
  box-shadow: 0 0 0 1000px var(--elev) inset;
}
::selection { background: var(--green-dim); }

.shell { min-height: 100dvh; display: flex; }
.side {
  width: 240px;
  flex: none;
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  background: #14171b;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-text b { display: block; font-size: 13px; font-weight: 600; }
.brand-text span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.mark {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  background: var(--elev-2);
  border: 1px solid var(--line-2);
  color: var(--green);
  font-family: var(--mono);
  font-size: 12px;
}
.side-actions { display: flex; flex-direction: column; gap: 8px; }
.side-actions .btn, .logout .btn { width: 100%; }
.btn.dl {
  width: 100%;
  margin-top: 12px;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--text);
}
.dl-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.dl-row .btn.dl { margin-top: 0; }
.tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
}
.tab {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--elev);
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
  transition: background 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease);
}
.tab span { font-size: 11px; color: var(--muted); font-weight: 500; }
.tab.on {
  color: var(--text);
  border-color: var(--line-2);
  background: var(--elev-2);
}
.tab.on span { color: var(--green); }
@media (hover: hover) and (pointer: fine) {
  .tab:hover { color: var(--text); background: #2c3139; }
}
.main { flex: 1; min-width: 0; padding: 28px 28px 48px; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.03em; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.flash { color: var(--green); font-size: 13px; margin: 0 0 14px; }
.add { display: flex; align-items: center; gap: 8px; flex: none; }
.add .field { width: 220px; }

.field, .btn, .ico, .speed {
  height: var(--h);
  border-radius: 8px;
  line-height: 1;
}
.field {
  padding: 0 12px;
  background: var(--elev);
  border: 1px solid var(--line);
  color: var(--text);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.field:focus {
  border-color: rgba(61, 214, 140, 0.55);
  box-shadow: 0 0 0 3px var(--green-dim);
}
select.field {
  padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%238b929c' d='M1 1l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  background: var(--elev-2);
  border: 1px solid var(--line-2);
  font-size: 13px;
  font-weight: 550;
  transition: background 160ms var(--ease), transform 140ms var(--ease);
}
.btn.primary { background: var(--green); color: #0d1611; border-color: transparent; font-weight: 650; }
.btn.ghost { background: transparent; }
.btn:active, .ico:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: #2c3139; }
  .btn.primary:hover { background: #63e09d; }
  .ico:hover { color: var(--text); background: var(--elev-2); border-color: var(--line-2); }
}

.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.item-head, .item-bar, .who, .acts, .modal-acts { display: flex; align-items: center; }
.item-head { justify-content: space-between; gap: 12px; }
.who { gap: 10px; min-width: 0; }
.who > div { min-width: 0; }
.name { font-weight: 600; font-size: 14px; }
.mono { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 2px; }
.dot {
  width: 8px; height: 8px; border-radius: 99px; flex: none;
  background: #3a4048; box-shadow: 0 0 0 3px rgba(58,64,72,.28);
}
.dot.on { background: var(--green); box-shadow: 0 0 0 3px var(--green-dim); }
.pill {
  display: inline-flex; align-items: center; justify-content: center;
  height: 22px; padding: 0 8px; border-radius: 99px;
  font-size: 11px; font-weight: 650; flex: none;
}
.pill.ok { background: var(--green-dim); color: var(--green); }
.pill.ban { background: var(--danger-dim); color: #ffb4b4; }
.item-bar { justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.speed { width: 140px; }
.acts { gap: 6px; flex-wrap: wrap; }
.acts form { display: flex; }
.ico {
  display: inline-flex; align-items: center; justify-content: center;
  height: 32px; padding: 0 10px;
  background: var(--elev); border: 1px solid var(--line);
  color: var(--muted); font-size: 12px; white-space: nowrap;
}
.ico.danger { color: #ffb4b4; }
.empty {
  padding: 48px 16px; text-align: center; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 12px;
}

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.box {
  width: min(380px, 100%);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 24px 22px;
}
.box h1 { font-size: 18px; margin: 14px 0 4px; }
.box p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.box .field, .box .btn { width: 100%; height: 42px; }
.box .btn { margin-top: 12px; }
.err {
  margin: 12px 0 0; color: #ffb4b4; font-size: 13px;
  background: var(--danger-dim); border-radius: 8px; padding: 8px 10px;
}

.overlay {
  position: fixed; inset: 0; background: rgba(8,9,11,.62);
  backdrop-filter: blur(8px);
  display: none; place-items: center; padding: 16px; z-index: 20;
}
.overlay.open { display: grid; }
.modal {
  width: min(520px, 100%);
  background: var(--elev);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  padding: 20px;
  transform: scale(0.96); opacity: 0;
  transition: transform 220ms var(--ease), opacity 220ms var(--ease);
}
.overlay.open .modal { transform: none; opacity: 1; }
.modal h2 { margin: 0 0 12px; font-size: 16px; }
.qr { display: block; margin: 8px auto 14px; width: 200px; height: 200px; border-radius: 8px; background: #fff; }
.conf {
  width: 100%; min-height: 140px; resize: vertical;
  background: #121417; border: 1px solid var(--line); border-radius: 8px;
  color: #b6f5d0; font-family: var(--mono); font-size: 11.5px; padding: 12px;
  line-height: 1.45;
}
.modal-acts { justify-content: flex-end; gap: 8px; margin-top: 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .side {
    width: auto;
    flex-direction: row;
    align-items: center;
    padding: 12px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .side-actions { flex-direction: row; width: auto; align-items: center; }
  .side-actions .btn, .logout .btn { width: auto; height: 32px; padding: 0 12px; }
  .main { padding: 16px 14px 32px; }
  .tabs { width: 100%; }
  .tab { flex: 1; justify-content: center; }
  .top { flex-direction: column; align-items: stretch; gap: 12px; }
  .add { width: 100%; }
  .add .field { flex: 1; width: auto; min-width: 0; }
  .add .btn { flex: none; }
  .item-bar { flex-direction: column; align-items: stretch; }
  .speed { width: 100%; }
  .acts { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .acts form, .acts a, .acts .ico { width: 100%; }
  .ico { width: 100%; }
  .modal-acts { flex-direction: column-reverse; align-items: stretch; }
  .modal-acts .btn { width: 100%; }
}
