:root {
  --bg: #0f1419;
  --card: #1a2332;
  --text: #e7ecf3;
  --muted: #9aa8b8;
  --accent: #3d8bfd;
  --accent-hover: #5a9dff;
  --error-bg: #3a1f24;
  --error-text: #ffb4b4;
  --border: #2a3544;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

body.centered {
  display: grid;
  place-items: center;
  padding: 1rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: #121820;
}

.topbar h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.report-hint {
  margin: 0;
  flex: 1;
  color: var(--muted);
  font-size: 0.85rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.actions a {
  color: var(--accent);
  text-decoration: none;
}

.actions a:hover {
  color: var(--accent-hover);
}

.card {
  max-width: 720px;
  margin: 2rem auto;
  padding: 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.card.narrow {
  width: 100%;
  max-width: 420px;
  margin: 0;
}

.lead {
  color: var(--muted);
  line-height: 1.5;
}

.upload-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field span {
  font-weight: 600;
}

.field small {
  color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0f1419;
  color: var(--text);
}

.primary {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.primary:hover {
  background: var(--accent-hover);
}

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

.link-btn:hover {
  color: var(--text);
}

.inline {
  display: inline;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-top: 1rem;
}

.alert-error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid #5c2a32;
}

.alert-ok {
  background: #1a2e24;
  color: #8fd19e;
  border: 1px solid #2a5c3a;
}

.secondary {
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #121820;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.secondary:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-hover);
}

.secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 2rem 1rem;
}

.report-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 64px);
  border: none;
  background: white;
}

.hidden {
  display: none !important;
}

.job-card {
  max-width: 640px;
}

.progress-wrap {
  height: 10px;
  background: #0f1419;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin: 1rem 0 0.35rem;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #6ea8fe);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.progress-pct {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.progress-msg {
  margin: 0.25rem 0 1.25rem;
  color: var(--muted);
  min-height: 1.4em;
}

.upload-progress {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #121820;
}

.stage-label-inline {
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.stage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.stage-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--muted);
}

.stage-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

.stage-item.active {
  color: var(--text);
  font-weight: 600;
}

.stage-item.active .stage-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(61, 139, 253, 0.25);
}

.stage-item.done {
  color: #8fd19e;
}

.stage-item.done .stage-dot {
  background: #3ecf6a;
}

.stage-item.error {
  color: var(--error-text);
}

.stage-item.error .stage-dot {
  background: #ff6b6b;
}

.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.monitor-card {
  max-width: 960px;
}

.monitor-section {
  margin-top: 1.5rem;
}

.monitor-section h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.hint-inline {
  font-weight: normal;
  color: var(--muted);
  font-size: 0.85rem;
}

.monitor-pre {
  margin: 0;
  padding: 1rem;
  background: #0f1419;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre;
  max-height: 420px;
}

.vmstat-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0f1419;
}

.vmstat-table {
  width: 100%;
  max-width: 520px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.vmstat-table th,
.vmstat-table td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

.vmstat-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
}

.monitor-pre-cpu {
  border-color: #3d5a80;
  background: #121a24;
  max-height: 220px;
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .card {
    margin: 1rem;
  }
}

/* Стартовая страница — оболочка «Эксперт Наташа» */
body.natasha {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  background: #fff;
  color: #17243a;
  accent-color: #0c8f8c;
}

.natasha-nav {
  width: 248px;
  flex: 0 0 248px;
  background: #17243a;
  color: #c4cfde;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.nav-brand {
  padding: 28px 24px 18px;
  text-align: center;
}

.nav-avatar {
  width: 148px;
  height: 148px;
  border-radius: 18px;
  display: block;
  margin: 0 auto;
  object-fit: cover;
  background: #0e1626;
}

.nav-name {
  margin-top: 14px;
  color: #a5b5ca;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
}

.nav-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: #c4cfde;
  text-align: left;
  font: inherit;
  font-size: 15px;
  padding: 12px 16px;
  border-radius: 4px;
  cursor: pointer;
}

.nav-item:hover {
  background: #243950;
  color: #fff;
}

.nav-item.active {
  background: #28425a;
  color: #fff;
}

.nav-meta {
  margin-top: auto;
  padding: 18px 22px 16px;
  font-size: 13px;
  color: #8ea2bb;
  line-height: 1.45;
}

.nav-defect {
  display: inline-block;
  margin-bottom: 14px;
  color: #9ecbff;
  font-size: 13px;
  text-decoration: none;
}

.nav-defect:hover {
  text-decoration: underline;
}

.nav-meta strong {
  display: block;
  margin-top: 2px;
  color: #d5deea;
  font-weight: 600;
}

.nav-admin {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  font-size: 13px;
}

.nav-admin a {
  color: #9ecbff;
  text-decoration: none;
}

.nav-logout {
  color: #8ea2bb;
  font-size: 13px;
}

.nav-infostart {
  display: flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
  min-height: 52px;
  padding: 8px 14px;
  background: #fff;
  color: #1e3a5f;
  text-decoration: none;
}

.infostart-mark {
  flex: 0 0 36px;
  display: block;
}

.infostart-word {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #1e3a5f;
}

.natasha-main {
  flex: 1;
  min-width: 0;
  padding: 28px 36px 48px;
  background: #fff;
}

.natasha-form {
  max-width: 920px;
}

.dark-field {
  background: #141c27;
  color: #f2f5f8;
  border-radius: 6px;
  padding: 16px 18px 18px;
  margin: 0 0 16px;
}

.dark-field h2,
.light-field h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 650;
}

.light-field {
  margin: 0 0 16px;
  color: #17243a;
}

.file-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #0c121b;
  border-radius: 3px;
  min-height: 42px;
  padding: 6px 10px;
  cursor: pointer;
}

.file-pick input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.file-choose {
  background: #f4f4f4;
  color: #1a1a1a;
  border: 1px solid #8d8d8d;
  padding: 3px 12px;
  font-size: 14px;
  white-space: nowrap;
}

.file-chosen {
  color: #d7dee8;
  font-size: 14px;
}

.file-pick-light {
  background: transparent;
  padding: 0;
  min-height: 0;
  border-radius: 0;
}

.file-pick-light .file-chosen {
  color: #17243a;
}

body.natasha .light-field input[type="text"],
body.natasha .dark-field input[type="text"] {
  width: 100%;
  background: #fff;
  color: #17243a;
  border: 1px solid #c5ced8;
  border-radius: 4px;
  padding: 8px 10px;
}

body.natasha .light-field input[type="text"]::placeholder,
body.natasha .dark-field input[type="text"]::placeholder {
  color: #8b98a8;
  letter-spacing: 0.08em;
}

.extra-field {
  margin: 0 0 18px;
  color: #65758b;
  font-size: 14px;
}

.extra-field summary {
  cursor: pointer;
}

.extra-field .field {
  margin-top: 8px;
  max-width: 420px;
}

body.natasha .extra-field input[type="text"] {
  background: #fff;
  color: #17243a;
  border: 1px solid #d9e0ea;
}

.agents-hint,
.agents-note {
  margin: 8px 0 14px;
  color: #5c6d82;
  font-size: 14px;
  max-width: 720px;
}

.agent-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.ghost-btn {
  background: #fff;
  color: #17243a;
  border: 1px solid #c5ced8;
  border-radius: 4px;
  padding: 7px 12px;
  font: inherit;
  cursor: pointer;
}

.ghost-btn:hover {
  background: #f3f6fa;
}

.agents {
  display: grid;
  gap: 6px;
  font-size: 15px;
}

.agent-line {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.agent-line .ghost-btn {
  padding: 4px 10px;
  text-decoration: none;
  color: #0c8f8c;
  border: 1px solid #0c8f8c;
}

.agent-line .ghost-btn:hover {
  background: #e7f6f6;
}

.agent,
.agent-sub {
  display: flex;
  align-items: center;
  gap: 8px;
}

.agent-sub {
  margin-left: 26px;
  color: #17243a;
}

body.natasha .num {
  width: 72px;
  background: #fff;
  color: #17243a;
  border: 1px solid #c5ced8;
  border-radius: 4px;
  padding: 4px 8px;
}

.launch {
  margin-top: 22px;
  background: #0c8f8c;
  color: #fff;
  border: 0;
  border-radius: 4px;
  padding: 10px 22px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.launch:hover {
  background: #087a78;
}

.launch:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

body.natasha .alert-error {
  background: #fff4f4;
  color: #a4262c;
  border: 1px solid #f0c2c2;
}

body.natasha .alert-ok {
  background: #b6f3c4;
  color: #046b28;
  border: 1px solid #2ebd55;
  font-weight: 650;
}

body.natasha #guestLimits {
  width: 100%;
  max-width: 100%;
  margin-top: 0;
  box-sizing: border-box;
}

body.natasha .upload-progress {
  background: #f7f9fb;
  border-color: #d9e0ea;
  color: #17243a;
}

body.natasha .progress-wrap {
  background: #e7edf3;
  border-color: #d9e0ea;
}

body.natasha .page h1 {
  margin: 0 0 12px;
  font-size: 28px;
}

.journal-link a {
  color: #087e8b;
  font-weight: 650;
}

@media (max-width: 800px) {
  body.natasha {
    flex-direction: column;
  }

  .natasha-nav {
    width: 100%;
    flex-basis: auto;
    min-height: 0;
  }

  .nav-brand {
    padding-bottom: 8px;
  }

  .nav-avatar {
    width: 72px;
    height: 72px;
  }

  .nav-meta {
    margin-top: 0;
  }

  .natasha-main {
    padding: 20px 16px 40px;
  }
}
