* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1420;
  --card: #1a2130;
  --text: #e8ecf4;
  --muted: #8b94a7;
  --accent: #4f8cff;
  --danger: #ff6b6b;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 16px;
  min-height: 100vh;
}

header { margin-bottom: 18px; padding-left: 16px; }
.logo { font-size: 22px; font-weight: 700; color: var(--accent); }
.subtitle { color: var(--muted); font-size: 13px; margin-top: 2px; }

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.card-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.card-value { font-size: 18px; font-weight: 600; margin-top: 6px; }

.list { list-style: none; margin-top: 8px; }
.list li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
  font-size: 15px;
}
.list li:last-child { border-bottom: none; }

.section-title {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin: 14px 4px 8px 16px;
}
.list-item {
  font-size: 15px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.list-item:last-child { border-bottom: none; }
.list-item .k { display: inline-block; min-width: 108px; color: var(--muted); }
.list-item .v { word-break: break-word; }

a.site-link { color: var(--accent); text-decoration: none; cursor: pointer; }

.lk-row { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.tgid-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.gear { font-size: 17px; cursor: pointer; opacity: .85; line-height: 1; padding: 2px; }
.gear:active { opacity: 1; }
.card.clickable { cursor: pointer; }
.card.clickable:active { opacity: .8; }
.btn-ghost {
  background: rgba(255,255,255,.04);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.btn-ghost:active { background: rgba(255,255,255,.09); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger {
  margin-right: auto;
  background: rgba(255,82,82,.12);
  color: #ff5252;
  border: 1px solid rgba(255,82,82,.4);
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger:active { background: rgba(255,82,82,.22); }
.btn-small {
  background: rgba(255,255,255,.08);
  color: var(--accent);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 9px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.modal-card {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  padding: 22px;
  width: calc(100% - 40px);
  max-width: 360px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.modal-card label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px; }
.modal-card input {
  width: 100%;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 9px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 15px;
}
.modal-card input:focus { outline: none; border-color: var(--accent); }
.inrow { display: flex; gap: 8px; }
.inrow input { flex: 1; }
.suggest { position: relative; }
.suggest.open {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  margin-top: 6px;
  max-height: 220px;
  overflow-y: auto;
}
.suggest-item { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,.06); }
.suggest-item:last-child { border-bottom: none; }
.suggest-item:hover { background: rgba(255,255,255,.08); }
.suggest-name { font-size: 14px; color: var(--text); }
.suggest-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.modal-msg { font-size: 13px; color: var(--muted); min-height: 16px; margin-top: 10px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.renew-row { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.tariff-btn {
  flex: 1 1 40%;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  padding: 14px 10px;
  color: var(--text);
  cursor: pointer;
  text-align: center;
}
.tariff-btn span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.tariff-btn b { font-size: 16px; }

.row { display: flex; gap: 8px; margin-bottom: 12px; }
.row .card { flex: 1; margin-bottom: 0; padding: 10px 12px; }
.row .card-label { font-size: 10px; }
.row .card-value { font-size: 14px; margin-top: 4px; word-break: break-all; }
.card-sub { font-size: 10px; color: var(--muted); margin-top: 2px; }

.error .card-value { color: var(--danger); }
.hidden { display: none; }

.btn-add {
  display: block;
  width: calc(100% - 32px);
  margin: 0 16px 12px;
  background: rgba(79,140,255,.12);
  color: var(--accent);
  border: 1px dashed rgba(79,140,255,.5);
  border-radius: 12px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn-add:active { background: rgba(79,140,255,.2); }

.conn-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.conn-row.clickable { cursor: pointer; }
.conn-row.clickable:active { opacity: .75; }
.conn-left { flex: 1; min-width: 0; }
.conn-type-title { font-size: 14px; font-weight: 700; color: var(--text); }
.conn-host { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.conn-row .v { flex: 1; }
.pencil { cursor: pointer; opacity: .95; font-size: 18px; padding: 2px 4px; line-height: 1; }
.pencil:active { opacity: 1; }

.modal-card select {
  width: 100%;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 9px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 15px;
}
.modal-card select:focus { outline: none; border-color: var(--accent); }

.conn-section {
  margin: 14px 0 2px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #3CB46E;
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  z-index: 100;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
  max-width: calc(100% - 48px);
  text-align: center;
}
