/* Network Doctor — tool-specific; chrome in tool-page-chrome.css */

/* ─── Tool engine (accent from site theme) ─── */
.nd-tool-main {
  --nd-accent: #4356a3;
  --nd-accent-rgb: 67 86 163;
  --nd-ink: #0f2744;
  --nd-muted: #64748b;
  --nd-ok: #16a34a;
  --nd-warn: #d97706;
  --nd-fail: #dc2626;
  --nd-border: #e2e8f0;
  --nd-soft: #f8fafc;
}

.nd-intake {
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid var(--nd-border);
  border-radius: 14px;
  background: var(--nd-soft);
}

.nd-intake__lead {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 800;
  color: var(--nd-ink);
}

.nd-intake__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}

.nd-field { display: flex; flex-direction: column; gap: 6px; }
.nd-field--full { grid-column: 1 / -1; }

.nd-field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--nd-muted);
}

.nd-select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1.5px solid var(--nd-border);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  color: var(--nd-ink);
  cursor: pointer;
}

.nd-select:focus {
  outline: none;
  border-color: #2aabe2;
  box-shadow: 0 0 0 3px rgba(42, 171, 226, 0.12);
}

.nd-select:disabled { opacity: 0.55; cursor: not-allowed; background: #eef2f7; }

.nd-intake__hint { margin: 12px 0 0; font-size: 13px; color: var(--nd-fail); font-weight: 700; }
.nd-intake.is-hidden { display: none; }
.nd-intake__note { margin: 10px 0 0; font-size: 12px; color: #94a3b8; }

.nd-captcha { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--nd-border); }
.nd-captcha__label { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 700; color: var(--nd-muted); }
.nd-captcha__box { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.nd-captcha__img { display: block; border-radius: 10px; border: 1px solid var(--nd-border); background: #fff; }
.nd-captcha__refresh {
  border: 1.5px solid var(--nd-border);
  background: #fff;
  color: var(--nd-ink);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.nd-captcha__refresh:hover { border-color: #2aabe2; color: #2aabe2; }
.nd-captcha__input {
  width: 130px;
  height: 44px;
  padding: 0 12px;
  border: 1.5px solid var(--nd-border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-align: center;
  background: #fff;
}
.nd-captcha__input:focus {
  outline: none;
  border-color: #2aabe2;
  box-shadow: 0 0 0 3px rgba(42, 171, 226, 0.12);
}

.nd-launch { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 24px; }

.nd-start-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 32px;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: #2aabe2;
  cursor: pointer;
  box-shadow: 0 10px 24px -10px rgba(42, 171, 226, 0.55);
  transition: background 0.18s, transform 0.18s;
}

.nd-start-btn:hover:not(:disabled) {
  background: #1e5ea8;
  transform: translateY(-1px);
}

.nd-start-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.nd-restart-btn {
  background: none;
  border: 1.5px solid var(--nd-border);
  color: #2aabe2;
  border-radius: 10px;
  padding: 9px 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.nd-progress-wrap { margin-bottom: 20px; }
.nd-progress-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; color: var(--nd-ink); margin-bottom: 8px; }
.nd-progress-bar { height: 10px; border-radius: 999px; background: var(--nd-soft); overflow: hidden; border: 1px solid var(--nd-border); }
.nd-progress-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #2aabe2, #4356a3); transition: width 0.4s ease; }

.nd-summary { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 22px; }
.nd-metric { background: var(--nd-soft); border: 1px solid var(--nd-border); border-radius: 12px; padding: 12px 6px; text-align: center; }
.nd-metric-value { font-size: 14px; font-weight: 800; color: #2aabe2; margin-bottom: 4px; }
.nd-metric-label { font-size: 11px; color: var(--nd-muted); line-height: 1.4; }

.nd-stages { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.nd-stage { background: #fff; border: 1px solid var(--nd-border); border-radius: 14px; overflow: hidden; }
.nd-stage.is-running { border-color: rgba(42, 171, 226, 0.35); }
.nd-stage.is-ok { border-color: rgba(22, 163, 74, 0.35); }
.nd-stage.is-warn { border-color: rgba(217, 119, 6, 0.4); }
.nd-stage.is-fail { border-color: rgba(220, 38, 38, 0.4); }
.nd-stage-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; user-select: none; }
.nd-stage-num { width: 26px; height: 26px; flex-shrink: 0; border-radius: 8px; background: var(--nd-soft); color: #2aabe2; font-size: 13px; font-weight: 800; display: grid; place-items: center; }
.nd-stage-headmain { flex: 1; min-width: 0; }
.nd-stage-title { font-size: 14px; font-weight: 700; color: var(--nd-ink); }
.nd-stage-summary { font-size: 12px; color: var(--nd-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nd-stage-summary:empty { display: none; }
.nd-stage-chevron { flex-shrink: 0; color: #94a3b8; transition: transform 0.3s; }
.nd-stage.is-open .nd-stage-chevron { transform: rotate(180deg); }
.nd-stage-status { font-size: 12px; font-weight: 700; color: var(--nd-muted); display: inline-flex; align-items: center; gap: 6px; }
.nd-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.nd-dot--run { background: #2aabe2; animation: ndBlink 1s ease-in-out infinite; }
.nd-dot--ok { background: var(--nd-ok); }
.nd-dot--warn { background: var(--nd-warn); }
.nd-dot--fail { background: var(--nd-fail); }
@keyframes ndBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.nd-stage-body { padding: 0 16px; max-height: 0; overflow: hidden; transition: max-height 0.35s ease, padding 0.35s ease; }
.nd-stage.is-open .nd-stage-body { max-height: 800px; padding: 0 16px 14px; }
.nd-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px dashed var(--nd-border); font-size: 13px; }
.nd-row:first-child { border-top: none; }
.nd-row-label { color: var(--nd-muted); }
.nd-row-value { font-weight: 700; color: var(--nd-ink); text-align: left; word-break: break-word; }
.nd-row--ok .nd-row-value { color: var(--nd-ok); }
.nd-row--warn .nd-row-value { color: var(--nd-warn); }
.nd-row--fail .nd-row-value { color: var(--nd-fail); }

.nd-report {
  background: linear-gradient(180deg, #fff, var(--nd-soft));
  border: 1px solid rgba(42, 171, 226, 0.18);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 16px;
}
.nd-report-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; margin-bottom: 6px; border-bottom: 1px solid var(--nd-border); }
.nd-report-title { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; color: #2aabe2; }
.nd-report-model { font-size: 11px; color: #94a3b8; }
.nd-report-loading { display: flex; align-items: center; gap: 10px; padding: 16px 0; color: var(--nd-muted); font-size: 14px; }
.nd-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(42, 171, 226, 0.25); border-top-color: #2aabe2; animation: ndSpin 0.8s linear infinite; }
@keyframes ndSpin { to { transform: rotate(360deg); } }
.nd-report-body { font-size: 14px; line-height: 2; color: #334155; }
.nd-report-body h3 { font-size: 16px; font-weight: 800; color: #2aabe2; margin: 16px 0 8px; }
.nd-report-body h4 { font-size: 14px; font-weight: 800; color: var(--nd-ink); margin: 12px 0 6px; }
.nd-report-body p { margin: 0 0 10px; }
.nd-report-body ul { margin: 0 0 12px; padding-inline-start: 22px; }
.nd-report-body code { background: var(--nd-soft); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; direction: ltr; display: inline-block; }
.nd-error { margin-top: 12px; }

@media (max-width: 1100px) {
  .nd-tool-main { padding: 18px; }
}

@media (max-width: 720px) {
  .nd-tool-main { padding: 16px; }
  .nd-intake__grid { grid-template-columns: 1fr; }
  .nd-summary { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 460px) {
  .nd-summary { grid-template-columns: repeat(2, 1fr); }
  .nd-start-btn { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .nd-dot--run, .nd-spinner { animation: none !important; }
}
