.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.module-card {
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}

.module-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.module-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  margin-bottom: 0.75rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-idle { background: #334155; color: #cbd5e1; }
.badge-running,
.badge-starting { background: rgba(34, 197, 94, 0.2); color: #86efac; }
.badge-stopping { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.badge-failed { background: rgba(248, 113, 113, 0.2); color: #fca5a5; }
.badge-completed { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }

.form-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .form-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
  }

  .field-full {
    grid-column: 1 / -1;
  }
}

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.field input[type="text"],
.field input[type="number"],
.field input[type="password"] {
  width: 100%;
  max-width: 100%;
  padding: 0.55rem 0.75rem;
  font: inherit;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

/* Базовые чекбоксы (модули без module-settings.css используют native) */
.field-check:not(:has(.check-ui)) label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--text);
  font-size: 0.9rem;
}

.field-check:not(:has(.check-ui)) input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.btn {
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.9);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.status-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.status-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.page-intro {
  margin-bottom: 1.25rem;
}

.page-intro h2 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 600;
}

.page-intro p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.form-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.form-section h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.form-section .form-section-desc {
  margin: 0 0 0.85rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.field textarea {
  width: 100%;
  min-height: 5rem;
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-size: 0.875rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  resize: vertical;
}

.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.proxy-hint code {
  font-size: 0.8em;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.proxy-errors {
  margin: 0.75rem 0;
  padding: 0.75rem;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  max-height: 12rem;
  overflow: auto;
}

.proxy-error-line {
  margin-bottom: 0.5rem;
}

.proxy-error-line:last-child {
  margin-bottom: 0;
}

.proxy-error-line code {
  font-size: 0.8em;
  word-break: break-all;
}

.field-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
}

.proxy-count {
  margin: 0.35rem 0 0.5rem;
}

.system-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.lamp {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.lamp-on {
  background: #22c55e;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.75);
}

.lamp-off {
  background: #64748b;
}

.lamp-warn {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.55);
}

.system-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.metric-tile {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.metric-tile span {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.metric-tile strong {
  font-size: 0.95rem;
}

.logs-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-bottom: 0.75rem;
}

.field-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.field-inline select {
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 6px;
  padding: 0.3rem 0.45rem;
}

.field-inline-check input {
  accent-color: var(--accent);
}

.log-list {
  max-height: 460px;
  overflow: auto;
  background: #0b1220;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  line-height: 1.45;
}

.log-row {
  white-space: pre-wrap;
  word-break: break-word;
  padding: 0.1rem 0.2rem;
  border-radius: 4px;
}

.log-row + .log-row {
  margin-top: 0.12rem;
}

.log-error {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.12);
}

.log-warn {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.12);
}

.log-info {
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.12);
}

.log-all {
  color: #e2e8f0;
}
