/* Settings page styles — used by ui/js/screens/settings.js and settings/*.js */
:root {
  --brand-green: var(--accent); /* Silo7 accent, local to the settings page */
}

.pw-settings { display: flex; flex-direction: column; gap: 1.5rem; }
.pw-settings-section {
  background: var(--copy-bg);
  border: 1px solid var(--copy-border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
}
.pw-settings-field { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.pw-settings-desc, .pw-radio-help { color: var(--plain-text); font-size: 0.85rem; }
.pw-radio { display: grid; grid-template-columns: auto auto 1fr; gap: 0.5rem; align-items: baseline; }
.pw-radio-label { font-weight: 600; color: var(--plain-emph); }
.pw-settings-status { min-height: 1.2rem; font-size: 0.85rem; color: var(--plain-emph); }

/* ---- frame shell: page heading, section marker (contract §5) ---- */
.pw-settings > h1 {
  font-size: 1.35rem; margin: 0.25rem 0 0.35rem; color: var(--plain-emph);
  display: inline-block; padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--brand-green);
}
.pw-settings-section > h2 {
  position: relative; padding-left: 0.75rem;
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--plain-text); margin: 0 0 1rem; font-weight: 700;
}
.pw-settings-section > h2::before {
  content: ""; position: absolute; left: 0; top: 0.02em; bottom: 0.02em;
  width: 3px; border-radius: 2px; background: var(--brand-green);
}
.sec-desc { color: var(--plain-text); font-size: 0.85rem; margin: 0 0 1.1rem; line-height: 1.5; }

/* ---- field grid: label + control, help + status beneath (contract §5) ---- */
.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 1.1rem; }
/* An author-origin `display` beats the user-agent [hidden] rule outright, so the
   line above silently defeated `el.hidden = true` on every .field. Restore it.
   Same trap already patched for .mod-config below and .pw-theory in
   investigation.css: prefer a plain [hidden] guard on any class that sets display. */
.field[hidden] { display: none; }
.field:last-of-type { margin-bottom: 0; }
.field label { font-weight: 600; font-size: 0.9rem; color: var(--plain-emph); }
.field .help { color: var(--plain-text); font-size: 0.8rem; line-height: 1.45; }
.field input[type=text], .field input[type=password], .field input[type=number], .field select {
  font-size: 0.9rem; color: var(--plain-emph);
  background: var(--raised); border: 1px solid var(--copy-border); border-radius: 4px;
  padding: 0.45rem 0.6rem; width: 100%; transition: border-color 0.12s, box-shadow 0.12s;
}
.field input[type=number] { width: 8rem; }
.field input:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15);
}
.field .row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

/* ---- inline field status: reserves height, fades in ---- */
.status { min-height: 1.1rem; font-size: 0.8rem; color: var(--plain-text); display: flex; align-items: center; gap: 0.35rem; }
.status.saved { color: var(--conf-high-text); }
.status .dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: currentColor; opacity: 0; transition: opacity 0.2s; }
.status.saved .dot, .status.saving .dot { opacity: 1; }

/* ---- checkbox row (e.g. TLS) ---- */
.check { display: flex; align-items: center; gap: 0.55rem; }
.check input { width: 1rem; height: 1rem; accent-color: var(--accent); }
.check label { font-weight: 500; font-size: 0.9rem; color: var(--plain-emph); }

/* ---- buttons ---- */
.btn {
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
  background: var(--raised); color: var(--plain-emph); border: 1px solid var(--copy-border);
  border-radius: 4px; padding: 0.42rem 0.8rem; transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--ticket-bg); border-color: #3F454D; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.25); }
.btn:disabled { color: var(--plain-text); cursor: default; opacity: 0.55; }

/* ---- test-connection result chip ---- */
.result { font-size: 0.8rem; padding: 0.25rem 0.55rem; border-radius: 100px; display: none; align-items: center; gap: 0.35rem; }
.result.ok { display: inline-flex; background: var(--conf-high-bg); color: var(--conf-high-text); }
.result.bad { display: inline-flex; background: var(--conf-low-bg); color: var(--conf-low-text); }
.result .g { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: currentColor; }

/* ---- restart notice ---- */
.notice {
  display: flex; gap: 0.55rem; align-items: flex-start; margin-top: 1rem;
  background: var(--ticket-bg); color: var(--ticket-text);
  border: 1px solid var(--copy-border); border-radius: 5px; padding: 0.6rem 0.75rem; font-size: 0.82rem; line-height: 1.45;
}
.notice .i { font-weight: 700; }

/* ---- module rows ---- */
.mods { display: flex; flex-direction: column; border: 1px solid var(--copy-border); border-radius: 5px; overflow: hidden; }
.mod { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0.85rem; border-top: 1px solid var(--copy-border); }
.mod:first-child { border-top: none; }
.mod .name { font-weight: 600; font-size: 0.9rem; color: var(--plain-emph); }
.mod .layer {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: #fff;
  background: var(--layer-chip); padding: 0.12rem 0.45rem; border-radius: 100px;
}
.mod .spacer { flex: 1; }
.mod .state { font-size: 0.76rem; color: var(--plain-text); min-width: 3.5rem; text-align: right; }

/* ---- toggle switch ---- */
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.track { position: absolute; inset: 0; background: #3F454D; border-radius: 100px; transition: background 0.16s; cursor: pointer; }
.track:before { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform 0.16s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.switch input:checked + .track { background: var(--layer-cleared); }
.switch input:checked + .track:before { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.25); }
.mods-actions { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.85rem; }

/* ---- connection config (2026-07-22): badge, pending hint, Configure panel ---- */
.mod .badge {
  font-size: 0.68rem; padding: 0.12rem 0.5rem; border-radius: 100px;
  border: 1px solid var(--copy-border); color: var(--plain-text); flex: none;
}
.mod .badge-live { border-color: var(--layer-cleared); color: var(--layer-cleared); }
.mod .pending { font-size: 0.72rem; color: var(--layer-chip); }
.mod-config { padding: 0.85rem; border-top: 1px dashed var(--copy-border); background: rgba(255, 255, 255, 0.02); }
.mod-config[hidden] { display: none; }
.mod-config .cfg-grid { display: flex; flex-direction: column; gap: 0.6rem; }
.mod-config .cfg-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.mod-config code { font-size: 0.8rem; }
.btn-small { font-size: 0.72rem; padding: 0.2rem 0.6rem; }
.btn-danger { border-color: #b4544f; color: #d98782; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (max-width: 560px) { .field input[type=number] { width: 100%; } }
