/* Settings refinement: quiet hierarchy, generous rhythm, precise controls. */

#settings-dialog[open] {
  width: min(760px, 94vw);
  height: min(690px, 88vh);
  max-height: 90vh;
  /* Totals as designed; the dialog's transparent scrollbar inset
     (dialogs.css) comes out of the padding, and the edge line is its ring. */
  padding: calc(1.55rem - var(--dlg-gut-y)) calc(1.65rem - var(--dlg-gut-x)) calc(1.35rem - var(--dlg-gut-y));
  background: linear-gradient(155deg, rgba(30,30,32,0.98), rgba(16,16,17,0.99) 46%);
  background-origin: border-box;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12), var(--shadow-pop);
}
#settings-dialog .dialog-head {
  padding-bottom: 1rem;
  margin-bottom: 0.55rem;
  border-bottom: 1px solid var(--border);
}
#settings-dialog .dialog-head h2 {
  font-size: 1.42rem;
  letter-spacing: -0.045em;
  font-weight: 550;
}
.set-layout { gap: 1.5rem; margin-top: 0.35rem; }
.set-tabs {
  flex-basis: 12rem;
  gap: 0.3rem;
  padding: 0.25rem 0.45rem 0.5rem 0;
  border-right: 1px solid var(--border);
}
.set-tabs button {
  min-height: 2.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: 11px;
  font-size: 0.88rem;
  letter-spacing: -0.01em;
  transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}
.set-tabs button[aria-selected="true"] {
  background: rgba(255,255,255,0.085);
  border-color: rgba(255,255,255,0.11);
  box-shadow: inset 2px 0 0 rgba(255,255,255,0.78);
}
.set-panels {
  padding: 0.25rem 0.4rem 1rem 0.15rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
}
.set-panels section { gap: 0.68rem; }
.set-heading {
  margin: 0 0 0.05rem;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.2;
}
.set-blurb {
  max-width: 56ch;
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.65;
}
.set-panels label {
  margin: 0.45rem 0 0.08rem;
  color: #b7b7bc;
  font-size: 0.76rem;
  font-weight: 550;
  letter-spacing: 0.005em;
  text-transform: none;
}
.set-panels input:not([type="checkbox"]):not([type="file"]),
.set-panels select {
  min-height: 2.9rem;
  border-color: rgba(255,255,255,0.105);
  border-radius: 11px;
  background-color: rgba(255,255,255,0.035);
}
.set-panels input:focus,
.set-panels select:focus {
  border-color: rgba(255,255,255,0.36);
  background-color: rgba(255,255,255,0.055);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.055);
}
.set-panels section > button,
.set-panels .sync-btns button {
  min-height: 2.85rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
}
.set-panels section > button:not(.primary),
.set-panels .sync-btns button {
  background: rgba(255,255,255,0.045);
  border-color: rgba(255,255,255,0.12);
}
.set-panels section > button:hover,
.set-panels .sync-btns button:hover {
  background: rgba(255,255,255,0.085);
  border-color: rgba(255,255,255,0.2);
}
.set-panels label.sync-check {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin: 0.35rem 0;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.025);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 450;
  line-height: 1.5;
}
.set-panels label.sync-check input[type="checkbox"] {
  flex: 0 0 1rem;
  width: 1rem;
  min-width: 1rem;
  height: 1rem;
  min-height: 1rem;
  margin: 0.15rem 0 0;
  accent-color: #e8e8ea;
}
#s-upload-label {
  margin-top: 0.7rem;
  color: #b7b7bc;
  font-size: 0.76rem;
  font-weight: 550;
  letter-spacing: 0;
  text-transform: none;
}
#s-upload {
  width: 100%;
  min-height: 3rem;
  padding: 0.45rem;
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: 12px;
  background: rgba(255,255,255,0.025);
  color: var(--muted);
}
#s-upload::file-selector-button,
#s-upload::-webkit-file-upload-button {
  min-height: 2.15rem;
  margin-right: 0.7rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
}
#o-list, #l-list { margin-top: 0.35rem; }
#o-list li, #l-list li {
  min-height: 3rem;
  padding: 0.65rem 0.15rem;
  border-color: var(--border);
}
#o-list li button, #l-list li button {
  min-height: 2.15rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.78rem;
}
#s-clear {
  min-height: 3rem !important;
  margin-top: 0.5rem !important;
  border-radius: 12px !important;
  background: var(--red-bg) !important;
}
#s-clear:hover { background: var(--red-solid) !important; }
#sy-status, #pd-status {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(255,255,255,0.025);
}
#settings-dialog .dlg-note { border-radius: 11px; }
#settings-dialog :focus-visible {
  outline: 2px solid rgba(255,255,255,0.78);
  outline-offset: 3px;
}

@media (max-width: 720px) {
  #settings-dialog[open] {
    width: 100vw;
    height: min(90dvh, 820px);
    max-height: 92dvh;
    padding: calc(1.2rem - var(--dlg-gut-y)) calc(1rem - var(--dlg-gut-x)) calc(1rem - var(--dlg-gut-y) + env(safe-area-inset-bottom, 0px));
    border-radius: 22px 22px 0 0;
  }
  #settings-dialog .dialog-head { padding-bottom: 0.8rem; }
  .set-layout {
    flex: 1 1 auto;
    min-height: 0;
    gap: 0.8rem;
  }
  .set-tabs {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 0 0 0.65rem;
    gap: 0.35rem;
  }
  .set-panels { padding: 0.2rem 0.15rem 1.2rem; }
  .set-heading { font-size: 1.22rem; }
  .set-panels section { gap: 0.62rem; }
}
@media (max-width: 560px) {
  #settings-dialog[open] { height: min(90dvh, 820px); min-height: 0; }
  .set-layout { flex-direction: column; }
  .set-tabs {
    flex-direction: row;
    flex: 0 0 auto;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    scroll-padding-inline: 0.25rem;
  }
  .set-tabs::-webkit-scrollbar { display: none; }
  .set-tabs button {
    min-height: 2.55rem;
    padding: 0.55rem 0.8rem;
    white-space: nowrap;
    scroll-snap-align: start;
  }
  /* Mobile tabs are horizontal: balance the selected-state edge highlight
     on both sides instead of carrying the desktop left-only rail. */
  .set-tabs button[aria-selected="true"] {
    box-shadow: inset 2px 0 0 rgba(255,255,255,0.78), inset -2px 0 0 rgba(255,255,255,0.78);
  }
  .set-panels { flex: 1 1 auto; }
  .set-panels label.sync-check { padding: 0.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  .set-tabs button { transition: none; }
}
