/* =====================================================================
   Settings page
   ===================================================================== */
.set-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1rem; }
.set-tabs button {
  position: relative; padding: 0.5rem 0.85rem; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--panel); color: var(--text-soft); font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.set-tabs button:hover { color: var(--text); border-color: var(--accent-bright); }
.set-tabs button.on { background: var(--accent-soft); border-color: var(--accent-bright); color: #fff; }
.set-dot { position: absolute; top: 0.2rem; right: 0.3rem; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--amber); }

#set-body { display: flex; flex-direction: column; gap: 1rem; max-width: 980px; }
.set-card h2 { margin-bottom: 0.3rem; }
.set-card > .hint:first-of-type { margin-top: 0; }
.set-sub { margin: 1.3rem 0 0.2rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }

.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.2rem 1.2rem; }
.set-field { display: block; margin-top: 0.9rem; }
.set-label { display: block; margin-bottom: 0.3rem; font-size: 0.84rem; font-weight: 600; color: var(--text); }
.set-input { display: flex; align-items: center; gap: 0.5rem; }
.set-input input, .set-input select { width: 100%; max-width: 22rem; }
.set-input input[type="number"] { max-width: 8rem; }
.set-input small { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.set-field .hint, .set-toggle .hint { margin-top: 0.25rem; }
input:invalid { border-color: var(--red); }

.set-toggle { display: flex; align-items: flex-start; gap: 0.7rem; margin-top: 1.1rem; cursor: pointer; }
.set-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.set-toggle b { font-size: 0.88rem; color: var(--text); }
.switch { flex: none; position: relative; width: 2.4rem; height: 1.35rem; margin-top: 0.05rem; border-radius: 999px;
          background: rgba(255, 255, 255, 0.12); border: 1px solid var(--border-strong); transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 0.12rem; left: 0.14rem; width: 0.95rem; height: 0.95rem;
                 border-radius: 50%; background: #fff; transition: transform 0.15s; }
.set-toggle input:checked + .switch { background: var(--accent); border-color: var(--accent-bright); }
.set-toggle input:checked + .switch::after { transform: translateX(1.02rem); }
.set-toggle input:focus-visible + .switch { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

/* word lists */
.set-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; padding: 0.45rem; min-height: 2.6rem;
             border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: rgba(5, 10, 28, 0.6);
             max-height: 15rem; overflow-y: auto; cursor: text; }
.set-chip { display: inline-flex; align-items: center; gap: 0.15rem; padding: 0.18rem 0.2rem 0.18rem 0.55rem; border-radius: 7px;
            background: var(--panel-raised); border: 1px solid var(--border); font-size: 0.8rem; max-width: 100%; overflow-wrap: anywhere; }
.set-chip button { border: none; background: none; color: var(--muted); font: inherit; font-size: 1rem; line-height: 1;
                   padding: 0 0.3rem; cursor: pointer; border-radius: 5px; }
.set-chip button:hover { color: var(--red); background: var(--red-soft); }
.set-chip-input { flex: 1 1 9rem; min-width: 7rem; border: none !important; background: transparent !important; padding: 0.25rem 0.3rem !important; outline: none !important; }
.set-details { margin-top: 1rem; }
.set-details summary { cursor: pointer; font-weight: 600; font-size: 0.86rem; color: var(--accent-bright); }

/* call results */
.set-outcomes { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.8rem; }
.set-outcome { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.6rem; border: 1px solid var(--border);
               border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.02); }
.set-order { display: flex; flex-direction: column; gap: 0.15rem; }
.set-order .btn { padding: 0.15rem 0.5rem; }
.set-outcome-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.set-outcome-top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.set-outcome-top input { flex: 1 1 10rem; min-width: 0; }
.set-preview { min-width: 6rem; justify-content: center; }
.set-outcome-flags { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; }
.set-outcome-flags .check { font-size: 0.82rem; }
.set-outcome small { font-size: 0.74rem; }
.set-del[aria-disabled="true"] { opacity: 0.45; }
.set-add { display: flex; gap: 0.5rem; margin-top: 0.8rem; }
.set-add input { flex: 1; min-width: 0; }

/* scoring */
.set-rescore { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
               border-color: rgba(243, 181, 63, 0.45); }
.set-rescore p { margin: 0.1rem 0 0; }
.set-steps { display: grid; gap: 0.35rem; margin: 0.6rem 0; max-width: 22rem; }
.set-step { display: grid; grid-template-columns: 1fr 1fr 2.2rem; gap: 0.5rem; align-items: center; }
.set-step.head span { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.set-step input { width: 100%; }

/* scraper buttons */
.set-buttons { display: flex; flex-direction: column; gap: 0.6rem; margin: 0.8rem 0; }
.set-button { padding: 0.6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.02);
              display: flex; flex-direction: column; gap: 0.45rem; }
.set-button-top { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.set-button-top input { flex: 1 1 10rem; min-width: 0; }
.set-button-top select { flex: 0 1 12rem; min-width: 0; }

/* connections */
.set-conns { list-style: none; margin: 0.6rem 0 0; padding: 0; }
.set-conns li { display: flex; gap: 0.8rem; align-items: flex-start; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.set-conns li:last-child { border-bottom: none; }
.set-conns .pill { flex: none; min-width: 3.6rem; justify-content: center; margin-top: 0.1rem; }
.set-conn-status { color: var(--text-soft); font-size: 0.86rem; overflow-wrap: anywhere; }

/* the save bar stays in view at the bottom while you edit */
.set-savebar { position: sticky; bottom: 0.8rem; z-index: 5; display: flex; align-items: center; justify-content: flex-end;
               flex-wrap: wrap; gap: 0.5rem 0.8rem; padding: 0.7rem 0.9rem; border-radius: var(--radius);
               border: 1px solid var(--border-strong); background: var(--panel-solid); box-shadow: var(--shadow); }
.set-savebar:not(.is-dirty) { position: static; box-shadow: none; background: var(--panel); }
.set-savebar.is-dirty { border-color: rgba(243, 181, 63, 0.6); }
.set-save-note { margin-right: auto; font-size: 0.84rem; color: var(--muted); }
.set-savebar.is-dirty .set-save-note { color: var(--amber); }

@media (max-width: 600px) {
  .set-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -1rem 1rem; padding: 0 1rem; }
  .set-tabs::-webkit-scrollbar { display: none; }
  .set-tabs button { white-space: nowrap; flex: none; }
  .set-grid { grid-template-columns: minmax(0, 1fr); }
  .set-outcome { flex-wrap: wrap; }
  .set-order { flex-direction: row; order: 2; }
  .set-outcome-main { flex-basis: 100%; }
  .set-del { order: 3; margin-left: auto; }
  .set-savebar { bottom: 0.5rem; }
  .set-save-note { width: 100%; }
  .set-savebar .btn { flex: 1; }
}
