/* feiMail Tools — Interactive Diagnostic Widgets (strict font-weight: 400) */

.tw-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.tw-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.tw-score-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.tw-score-main {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.tw-grade-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  background: var(--bg-subtle);
}

.tw-grade-ok {
  border-color: var(--ok);
  color: var(--ok);
  background: var(--ok-bg);
}

.tw-grade-warn {
  border-color: var(--warn);
  color: var(--warn);
  background: var(--warn-bg);
}

.tw-grade-fail {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-bg);
}

.tw-meter {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-hover);
  overflow: hidden;
}

.tw-meter-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--ok);
  transition: width 0.2s ease;
}

.tw-meter-warn {
  background: var(--warn);
}

.tw-meter-danger {
  background: var(--danger);
}

/* SPF Recursive Tree */
.tw-spf-tree {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tw-spf-children {
  list-style: none;
  margin: 8px 0 0 18px;
  padding: 0 0 0 12px;
  border-left: 1px dashed var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tw-spf-node {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.tw-spf-rec {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-secondary);
  overflow-wrap: anywhere;
}

/* Waterfall chart for Header Analyzer */
.tw-waterfall {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tw-hop {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tw-hop-bar-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-hover);
  overflow: hidden;
}

.tw-hop-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--brand);
}

.tw-hop-bar-skew {
  background: var(--warn);
}

.tw-w-0 { width: 4%; }
.tw-w-10 { width: 10%; }
.tw-w-20 { width: 20%; }
.tw-w-30 { width: 30%; }
.tw-w-40 { width: 40%; }
.tw-w-50 { width: 50%; }
.tw-w-60 { width: 60%; }
.tw-w-70 { width: 70%; }
.tw-w-80 { width: 80%; }
.tw-w-90 { width: 90%; }
.tw-w-100 { width: 100%; }

/* Dropzone & editors */
.tw-dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  padding: 24px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.tw-dropzone.dragover {
  border-color: var(--brand);
  background: var(--bg-active-soft);
}

.tw-textarea {
  width: 100%;
  min-height: 150px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 12.5px;
  resize: vertical;
}

.tw-code {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  font-family: var(--font-mono);
  font-size: 12px;
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Provider checkboxes for DNS generator */
.tw-check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.tw-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  cursor: pointer;
  font-size: 13px;
}

/* Content checker preview iframe */
.tw-preview-wrap {
  display: flex;
  justify-content: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  overflow-x: auto;
}

.tw-preview-frame {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  height: 420px;
  max-width: 100%;
}

.tw-preview-desktop {
  width: 600px;
}

.tw-preview-mobile {
  width: 375px;
}

/* Conversion nudge (shown only on warn/fail) */
.tw-nudge {
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.tw-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.tw-kpi {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.tw-kpi-val {
  font-size: 20px;
  color: var(--ink-primary);
}

.tw-table-scroll {
  width: 100%;
  overflow-x: auto;
}

.tw-icon {
  width: 15px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tw-icon svg {
  width: 15px;
  height: 15px;
}

@media (max-width: 820px) {
  .tw-check-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tw-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .tw-check-grid,
  .tw-kpi-strip {
    grid-template-columns: 1fr;
  }
  .tw-spf-children {
    margin-left: 10px;
    padding-left: 8px;
  }
  .tw-preview-desktop,
  .tw-preview-mobile {
    width: 100%;
  }
}
