/* ==========================================================================
   SUITE SETTINGS — the shared two-column settings window shell
   Version 1.0.0 (2026-10-02). Served live by the hub at
   `http://127.0.0.1:4040/suite-settings.css`, next to `suite-ui.css`.
   One `<link>` per application:

     <link rel="stylesheet" href="http://127.0.0.1:4040/suite-settings.css" />

   WHAT THIS FILE IS
   The suite's ONE settings-window chrome. Every application opens its
   settings as a separate window (`?view=settings`) rendering the shared
   `SettingsWindow` shell from `@suite/settings`: a header, a left section
   nav and a scrollable right content column (the Kor panel pattern,
   centralized). A structural change is one edit in this file; every
   application inherits it on reload. No vendored copies.

   WHAT THIS FILE IS NOT
   The row/group/switch primitives INSIDE the content column — those are
   `suite-ui-group` / `suite-ui-row` / `suite-ui-switch` from `suite-ui.css`,
   reused as-is. Only the window shell lives here.

   ALL colors derive from the suite theme tokens (suite-theme.css); nothing
   is hardcoded, so light/dark and per-app accents flow in for free.

   THE CLASS CONTRACT (v1)
     .suite-settings-window        the window root: fills the viewport, column flex
     .suite-settings-header        48px title bar with hairline bottom
       .suite-settings-heading     the title cluster (title + subtitle)
         .suite-settings-title     "Settings" (13px/600)
         .suite-settings-subtitle  the application name (11px, tertiary)
       .suite-settings-close       the close button (16px icon hit area 28px)
     .suite-settings-body          the two-column row (flex:1, min-height:0)
       .suite-settings-nav         224px left nav, hairline right, scroll-y
         .suite-settings-nav-item  one row (32px, radius, hover/active accent)
           .suite-settings-nav-icon   leading 16px icon slot
           .suite-settings-nav-label  the row text (ellipsis)
       .suite-settings-main        right column (flex:1, min-width:0, column)
         .suite-settings-content   scrollable content pad 20/24, max-width 760px
         .suite-settings-footer    optional hairline-top footer strip
     .suite-settings-input         shared text input (rows)
     .suite-settings-select        shared select (rows)
     .suite-settings-textarea      shared textarea (rows)
     .suite-settings-back-link     small link-style action (rows)

   RULES (suite-ui precedents)
   - Light DOM only: no shadow roots, no bare-element selectors, no !important.
   - Theme flows from suite-theme.css tokens; this file never recolors them.
   - Defensive layout: the nav collapses to a horizontal scroll strip under
     640px — nothing wraps, overlaps or clips, and the content column keeps
     its scroll regardless of section count.
   ========================================================================== */

.suite-settings-window {
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--background, var(--panel-background, #f5f5f7));
  color: var(--foreground, #1d1d1f);
  font-family: var(--font-system, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

/* ---- Header -------------------------------------------------------------- */

.suite-settings-header {
  box-sizing: border-box;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 48px;
  padding: 0 12px 0 20px;
  border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  background-color: var(--panel-background, #ffffff);
}

.suite-settings-heading {
  box-sizing: border-box;
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.suite-settings-title {
  box-sizing: border-box;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--foreground, #1d1d1f);
  white-space: nowrap;
}

.suite-settings-subtitle {
  box-sizing: border-box;
  font-size: 11px;
  color: var(--text-tertiary, var(--muted-foreground, #6e6e73));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suite-settings-close {
  box-sizing: border-box;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  color: var(--text-secondary, var(--muted-foreground, #6e6e73));
  cursor: pointer;
  transition: background-color var(--duration-fast, 140ms) var(--ease-apple, ease);
}

.suite-settings-close:hover {
  background-color: var(--bg-hover, rgba(0, 0, 0, 0.07));
  color: var(--foreground, #1d1d1f);
}

.suite-settings-close svg {
  width: 15px;
  height: 15px;
  display: block;
}

/* ---- Two-column body ------------------------------------------------------ */

.suite-settings-body {
  box-sizing: border-box;
  flex: 1 1 auto;
  display: flex;
  flex-direction: row;
  min-height: 0;
}

.suite-settings-nav {
  box-sizing: border-box;
  flex: 0 0 auto;
  width: 224px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  background-color: var(--panel-background, #ffffff);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong, rgba(0, 0, 0, 0.15)) transparent;
}

.suite-settings-nav::-webkit-scrollbar {
  width: 8px;
}

.suite-settings-nav::-webkit-scrollbar-thumb {
  background-color: var(--border-strong, rgba(0, 0, 0, 0.15));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.suite-settings-nav::-webkit-scrollbar-track {
  background: transparent;
}

.suite-settings-nav-item {
  box-sizing: border-box;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--text-secondary, var(--muted-foreground, #6e6e73));
  text-align: left;
  cursor: pointer;
  transition: background-color var(--duration-fast, 140ms) var(--ease-apple, ease),
    color var(--duration-fast, 140ms) var(--ease-apple, ease);
}

.suite-settings-nav-item:hover {
  background-color: var(--bg-hover, rgba(0, 0, 0, 0.07));
  color: var(--foreground, #1d1d1f);
}

.suite-settings-nav-item.is-active {
  background-color: var(--accent-soft, rgba(0, 122, 255, 0.12));
  color: var(--accent, #007aff);
  font-weight: 500;
}

.suite-settings-nav-item:focus-visible {
  outline: 2px solid var(--border-focus, rgba(0, 122, 255, 0.55));
  outline-offset: -2px;
}

.suite-settings-nav-icon {
  box-sizing: border-box;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}

.suite-settings-nav-icon svg,
.suite-settings-nav-icon img {
  width: 16px;
  height: 16px;
  display: block;
}

.suite-settings-nav-label {
  box-sizing: border-box;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Content column -------------------------------------------------------- */

.suite-settings-main {
  box-sizing: border-box;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--background, #f5f5f7);
}

.suite-settings-content {
  box-sizing: border-box;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px 28px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong, rgba(0, 0, 0, 0.15)) transparent;
}

.suite-settings-content::-webkit-scrollbar {
  width: 8px;
}

.suite-settings-content::-webkit-scrollbar-thumb {
  background-color: var(--border-strong, rgba(0, 0, 0, 0.15));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.suite-settings-content::-webkit-scrollbar-track {
  background: transparent;
}

/* The content column centers its cards and never stretches unreadably wide
   on large windows; embedded application panels may exceed the cap only when
   they must (tables, canvases) via .suite-settings-content--wide. */
.suite-settings-content > * {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

.suite-settings-content--wide > * {
  max-width: none;
}

.suite-settings-footer {
  box-sizing: border-box;
  flex: 0 0 auto;
  padding: 8px 24px;
  border-top: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  font-size: 11px;
  color: var(--text-tertiary, var(--muted-foreground, #6e6e73));
  background-color: var(--panel-background, #ffffff);
}

/* ---- Shared row controls ---------------------------------------------------- */

.suite-settings-input,
.suite-settings-select,
.suite-settings-textarea {
  box-sizing: border-box;
  font: inherit;
  font-size: 13px;
  color: var(--foreground, #1d1d1f);
  background-color: var(--panel-background, #ffffff);
  border: 1px solid var(--border-strong, rgba(0, 0, 0, 0.15));
  border-radius: var(--radius-sm, 6px);
  padding: 5px 9px;
  min-width: 0;
  transition: border-color var(--duration-fast, 140ms) var(--ease-apple, ease),
    box-shadow var(--duration-fast, 140ms) var(--ease-apple, ease);
}

.suite-settings-input:focus,
.suite-settings-select:focus,
.suite-settings-textarea:focus {
  outline: none;
  border-color: var(--accent, #007aff);
  box-shadow: 0 0 0 3px var(--accent-soft, rgba(0, 122, 255, 0.12));
}

.suite-settings-input::placeholder,
.suite-settings-textarea::placeholder {
  color: var(--text-tertiary, var(--muted-foreground, #6e6e73));
}

.suite-settings-select {
  max-width: 240px;
  cursor: pointer;
}

.suite-settings-textarea {
  width: 100%;
  resize: vertical;
  min-height: 64px;
}

.suite-settings-back-link {
  box-sizing: border-box;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--accent, #007aff);
  cursor: pointer;
  text-align: left;
}

.suite-settings-back-link:hover {
  text-decoration: underline;
}

/* ---- Narrow windows: the nav becomes a horizontal strip ----------------------
   Nothing wraps or clips: items keep their label via flex-shrink-0 +
   whitespace-nowrap and the strip scrolls horizontally (wheel + touch). */

@media (max-width: 640px) {
  .suite-settings-body {
    flex-direction: column;
  }

  .suite-settings-nav {
    flex-direction: row;
    align-items: center;
    width: 100%;
    flex: 0 0 auto;
    padding: 8px 10px;
    overflow-y: hidden;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.08));
    scrollbar-width: none;
  }

  .suite-settings-nav::-webkit-scrollbar {
    display: none;
  }

  .suite-settings-nav-item {
    flex-shrink: 0;
    width: auto;
    white-space: nowrap;
  }

  .suite-settings-content {
    padding: 16px;
  }
}

/* ---- Reduced motion ---------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .suite-settings-window *,
  .suite-settings-window *::before,
  .suite-settings-window *::after {
    transition-duration: 0.01ms !important;
  }
}
