:root {
  --bg: #0f1419;
  --panel: #171e26;
  --panel-2: #1d2630;
  --line: #2a3542;
  --text: #e8eef5;
  --muted: #8b9aab;
  --accent: #2f9e7f;
  --accent-2: #3db8a0;
  --warn: #d4a017;
  --danger: #c45c5c;
  --radius: 10px;
  --font: "IBM Plex Sans", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1a3a32 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #243044 0%, transparent 50%),
    var(--bg);
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 20, 25, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; gap: 0.75rem; align-items: center; }
.brand strong { display: block; font-size: 1.05rem; }
.brand .muted { color: var(--muted); font-size: 0.82rem; }
.mark {
  width: 2.25rem; height: 2.25rem; border-radius: 8px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), #1f6b58);
  font-family: var(--mono); font-weight: 600; font-size: 0.85rem;
}
.top-actions { display: flex; gap: 0.5rem; align-items: end; flex-wrap: wrap; }
.pwd { display: grid; gap: 0.25rem; font-size: 0.75rem; color: var(--muted); }
.pwd input { min-width: 10rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 1rem 1.25rem 0;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
.stat span {
  display: block;
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--accent-2);
}
.stat label { color: var(--muted); font-size: 0.8rem; }

.lock-screen {
  display: none;
  min-height: calc(100vh - 5rem);
  place-items: center;
  padding: 2rem 1.25rem;
}
body.locked .lock-screen { display: grid; }
body.locked #appContent { display: none !important; }
.lock-card {
  max-width: 28rem;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.5rem 1.35rem;
}
.lock-card h1 {
  margin: 0 0 0.65rem;
  font-size: 1.25rem;
}
.lock-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.92rem;
}
.lock-card .msg { margin-top: 0.85rem; }

.activity {
  margin: 0.85rem 1.25rem 0;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
}
.activity.running {
  border-color: #2f9e7f88;
  box-shadow: 0 0 0 1px #2f9e7f33 inset;
}
.activity.done { border-color: #2f9e7f66; }
.activity.error { border-color: #c45c5c88; }
.activity-main {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  margin-top: 0.35rem;
  background: var(--muted);
  flex: 0 0 auto;
}
.activity.running .dot {
  background: var(--accent-2);
  box-shadow: 0 0 0 0 rgba(61, 184, 160, 0.6);
  animation: pulse 1.4s infinite;
}
.activity.done .dot { background: var(--accent); }
.activity.error .dot { background: var(--danger); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 184, 160, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(61, 184, 160, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 184, 160, 0); }
}
.activity-text { flex: 1; min-width: 0; }
.activity-text strong { display: block; font-size: 0.95rem; }
.activity-text .muted { display: block; margin-top: 0.2rem; font-size: 0.82rem; color: var(--muted); }
.activity-meta { font-size: 0.78rem; white-space: nowrap; }
.progress {
  margin-top: 0.65rem;
  height: 6px;
  border-radius: 99px;
  background: var(--panel-2);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s ease;
}
.activity.running .progress-bar.indeterminate {
  width: 35%;
  animation: slide 1.2s ease-in-out infinite;
}
@keyframes slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
.activity-counters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
  margin-top: 0.65rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.activity-counters b { color: var(--accent-2); font-family: var(--mono); font-weight: 500; }
.activity-counters .mono { font-family: var(--mono); color: var(--text); }
.activity-log {
  margin: 0.65rem 0 0;
  padding: 0.55rem 0.7rem;
  max-height: 9rem;
  overflow: auto;
  background: var(--panel-2);
  border-radius: 8px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  white-space: pre-wrap;
}

.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1rem;
  padding: 1rem 1.25rem 2rem;
}
.side { display: flex; flex-direction: column; gap: 1rem; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}
.panel.grow { min-width: 0; }
.panel h2 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
}
.phase-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #04150f;
  background: var(--accent);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  margin-bottom: 0.5rem;
}
.hint {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}
.hint.small { font-size: 0.75rem; margin-top: 0.5rem; }
.field {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.65rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.check {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.check input { width: auto; }
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1rem 0;
}

textarea, input, select, button {
  font: inherit;
  color: var(--text);
}
textarea, input, select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}
textarea { resize: vertical; font-family: var(--mono); font-size: 0.85rem; }
button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #04150f;
  font-weight: 600;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
}
button:hover { background: var(--accent-2); }
button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
button.ghost:hover { border-color: var(--accent); color: var(--accent-2); }
button.full { width: 100%; margin-top: 0.5rem; }
.row { display: flex; gap: 0.5rem; }
.row input { width: 5rem; }
.msg { margin: 0.75rem 0 0; font-size: 0.85rem; color: var(--accent-2); }
.msg.error { color: var(--danger); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  align-items: center;
}
.filters input[type="search"] { flex: 1 1 220px; }
.filters input[type="text"], .filters select { flex: 0 1 160px; width: auto; }
.filters label {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}
.filters label input { width: auto; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--panel-2); color: var(--muted); font-weight: 500; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: rgba(47, 158, 127, 0.06); }
.domain-link {
  color: var(--accent-2);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.85rem;
  background: none;
  border: 0;
  padding: 0;
  font-weight: 500;
}
.domain-link:hover { text-decoration: underline; background: none; }
.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-family: var(--mono);
  border: 1px solid var(--line);
}
.badge.active { color: var(--accent-2); border-color: #2f9e7f66; }
.badge.discovered { color: #7eb6ff; border-color: #7eb6ff55; }
.badge.pending { color: var(--warn); }
.badge.error, .badge.blocked, .badge.inactive { color: var(--danger); }
.contacts { color: var(--muted); font-size: 0.82rem; line-height: 1.45; }
.soc-row { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.soc {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  text-decoration: none;
  border: 1px solid var(--line);
}
.soc.on {
  color: #04150f;
  background: var(--accent);
  border-color: transparent;
}
.soc.on:hover { background: var(--accent-2); }
.soc.off {
  color: #5a6a7a;
  background: transparent;
  opacity: 0.55;
}
.tech { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.85rem;
  color: var(--muted);
}

dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  width: min(720px, 92vw);
  padding: 0;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.detail { margin: 0; }
.detail header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
}
.detail h2 { margin: 0; font-size: 1rem; }
.detail pre {
  margin: 0;
  padding: 1rem;
  max-height: 70vh;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .layout { grid-template-columns: 1fr; }
}
