:root {
  --bg: #0b0f14;
  --card: #151c27;
  --text: #eef3fb;
  --muted: #8b9bb4;
  --accent: #22c55e;
  --danger: #dc2626;
  --blue: #3b82f6;
  --brand: #e10600;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  padding: 1rem 1.25rem 0.25rem;
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

header h1,
header .brand {
  margin: 0;
  font-size: 1.25rem;
}

.brand-name {
  color: var(--brand);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-sep {
  color: var(--muted);
  font-weight: 600;
}

.brand-tag {
  color: var(--text);
  font-weight: 600;
}

.sub {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.card {
  margin: 0.75rem 1.25rem;
  padding: 0.9rem 1rem;
  background: var(--card);
  border: 1px solid #243044;
  border-radius: 12px;
}

h2 {
  margin: 0.85rem 0 0.55rem;
  font-size: 0.95rem;
}

.card > h2:first-child {
  margin-top: 0;
}

.auth-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

@media (max-width: 900px) {
  .auth-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .auth-grid { grid-template-columns: 1fr; }
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--muted);
}

input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  background: #0a0e14;
  border: 1px solid #334155;
  color: var(--text);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font-size: 1rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  background: var(--accent);
  color: #04120a;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  background: #334155;
  color: #fff;
}

button.danger {
  background: var(--danger);
  color: #fff;
}

a.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  background: var(--accent);
  color: #04120a;
  font-weight: 700;
  cursor: pointer;
  font-size: inherit;
  line-height: 1.2;
}

a.btn-link.secondary {
  background: #334155;
  color: #fff;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.me-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.me-bar .label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.me-bar strong {
  font-size: 1.1rem;
  letter-spacing: 0.06em;
}

.status {
  margin: 0.65rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.status.ok { color: #4ade80; }
.status.err { color: #f87171; }

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.35rem;
  border-bottom: 1px solid #243044;
  font-size: 0.9rem;
}

.list li:last-child { border-bottom: 0; }

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #334155;
  color: var(--muted);
}

.badge.online {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--accent);
}

.badge.pending {
  background: color-mix(in srgb, #f59e0b 25%, transparent);
  color: #fbbf24;
}

.list li.pending {
  opacity: 0.85;
}

.hint-inline {
  color: var(--muted);
  font-size: 0.85rem;
}

.contacts-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.contacts-head h2 {
  margin: 0;
}

.contacts li {
  cursor: pointer;
  border-radius: 8px;
  padding: 0.65rem 0.55rem;
}

.contacts li:hover {
  background: #1a2433;
}

.contacts li.selected {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  outline: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}

.contact-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.contact-main small {
  color: var(--muted);
  font-size: 0.78rem;
}

.selected-info {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: #0a0e14;
  border: 1px dashed #334155;
}

.selected-info .label {
  margin: 0;
}

.selected-info strong {
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}

.id-pass-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 0.35rem;
  width: 100%;
  min-width: 0;
}

.id-pass-row label {
  margin-bottom: 0;
  min-width: 0;
  overflow: hidden;
}

.id-pass-row input[readonly] {
  opacity: 0.95;
  letter-spacing: 0.08em;
  font-weight: 700;
}

@media (max-width: 560px) {
  .id-pass-row { grid-template-columns: 1fr; }
}

.actions-bottom {
  margin-top: 0.75rem;
}

.actions-bottom button {
  min-width: 120px;
}

.dlg {
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  background: var(--card);
  color: var(--text);
  max-width: 420px;
  width: calc(100% - 2rem);
  overflow: hidden;
}

.dlg form {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}

.dlg::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.dlg h2 {
  margin: 0 0 0.85rem;
}

.dlg label {
  margin-bottom: 0.75rem;
}

.hint {
  margin: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
  background: #0f1520;
}
