/* ============================================================================
   ATLAS REDESIGN — Customize Workspace slide-over  (v1.8)
   Branch: atlas-redesign-2026-06-29 · pairs with js/redesign/customize-workspace.js

   A right slide-over opened from a sliders trigger in the top bar. Both themes
   via html[data-rtheme]. Tokens-only — ZERO raw hex. Every control persists to
   localStorage['atlas_prefs'] and applies LIVE via root attributes:
     data-rdensity = comfortable | compact   (overrides --r-gutter → all screens)
     data-rmotion  = full | reduced           (gates v1.7 breathing + bell anim)
     data-w-kpis / data-w-sched / data-w-insights / data-w-workforce = on | off  (gate Home sections)
   Theme delegates to window.atlasRedesign (atlas_mode). Landing = default view.
   ========================================================================== */

/* ── density: tighten the shared gutter every redesign screen consumes ────── */
html[data-rdensity="compact"] { --r-gutter: 15px; }

/* ── Home widget gating (applies in BOTH themes — one render, themed by CSS) ─ */
html[data-w-kpis="off"]      .rd-home__kpis        { display: none !important; }
html[data-w-sched="off"]     .rd-home__band--upper { display: none !important; }
html[data-w-insights="off"]  .rd-home__band--main  { display: none !important; }
html[data-w-workforce="off"] .rd-home__workforce   { display: none !important; }

/* ── trigger button (top bar) ─────────────────────────────────────────────── */
.rd-cust-trigger {
  display: inline-flex; width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--r-border); background: var(--r-surface); color: var(--r-muted);
  align-items: center; justify-content: center; cursor: pointer; font-family: inherit;
  transition: background var(--r-dur) var(--r-ease), color var(--r-dur) var(--r-ease);
}
.rd-cust-trigger:hover { background: var(--r-canvas-raised); color: var(--r-ink); }
.rd-cust-trigger i { font-size: 16px; }

/* ── scrim + panel ────────────────────────────────────────────────────────── */
.rd-cust-scrim {
  position: fixed; inset: 0; z-index: 230;
  background: rgba(20, 18, 12, .34); backdrop-filter: blur(3px);
  animation: rdCustFade .16s ease both;
}
html[data-rtheme="operator"] .rd-cust-scrim { background: rgba(0, 0, 0, .5); }
@keyframes rdCustFade { from { opacity: 0; } to { opacity: 1; } }

.rd-cust-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 231;
  width: 412px; max-width: 100vw;
  background: var(--r-canvas); border-left: 1px solid var(--r-border);
  box-shadow: -40px 0 90px -30px rgba(40, 33, 20, .45);
  display: flex; flex-direction: column;
  font-family: var(--r-font-body); color: var(--r-ink);
  animation: rdCustIn .2s var(--r-ease) both;
}
html[data-rtheme="operator"] .rd-cust-panel { box-shadow: -40px 0 90px -30px rgba(0, 0, 0, .7); }
@keyframes rdCustIn { from { transform: translateX(26px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .rd-cust-panel, .rd-cust-scrim { animation: none; } }
html[data-rmotion="reduced"] .rd-cust-panel, html[data-rmotion="reduced"] .rd-cust-scrim { animation: none; }

.rd-cust-head {
  flex: none; padding: 18px 20px; border-bottom: 1px solid var(--r-hairline);
  background: linear-gradient(180deg, var(--r-canvas-raised), var(--r-canvas));
  display: flex; align-items: center; gap: 12px;
}
.rd-cust-head-ic {
  flex: none; width: 38px; height: 38px; border-radius: 10px;
  background: var(--r-surface); border: 1px solid var(--r-border); color: var(--r-primary);
  display: inline-flex; align-items: center; justify-content: center; font-size: 19px;
}
.rd-cust-head-tt { flex: 1; min-width: 0; }
.rd-cust-head-tt b { font-family: var(--r-font-display); font-size: 18px; font-weight: 600; color: var(--r-ink); }
.rd-cust-head-tt span { display: block; font-size: 12px; color: var(--r-faint); }
.rd-cust-close {
  flex: none; width: 32px; height: 32px; border-radius: 9px;
  border: 1px solid var(--r-border); background: var(--r-surface); color: var(--r-muted);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-family: inherit;
}
.rd-cust-close:hover { background: var(--r-canvas-raised); color: var(--r-ink); }

.rd-cust-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.rd-cust-label {
  font-family: var(--r-font-mono); font-size: 9.5px; letter-spacing: .1em;
  color: var(--r-faint); margin-bottom: 9px; text-transform: uppercase;
}
.rd-cust-label-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 9px; }
.rd-cust-label-row .rd-cust-hint { font-size: 12px; color: var(--r-faint); }
.rd-cust-section { margin-bottom: 20px; }

/* segmented control */
.rd-seg {
  display: flex; background: var(--r-well); border: 1px solid var(--r-border);
  border-radius: var(--r-radius-control); padding: 3px;
}
.rd-seg-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 8px; padding: 8px; font-size: 12.5px; font-family: inherit;
  cursor: pointer; color: var(--r-muted); background: transparent; font-weight: 500;
  transition: background var(--r-dur) var(--r-ease), color var(--r-dur) var(--r-ease);
}
.rd-seg-btn i { font-size: 14px; }
.rd-seg-btn.is-on { background: var(--r-surface); color: var(--r-primary); box-shadow: var(--r-shadow-card); font-weight: 600; }
html[data-rtheme="operator"] .rd-seg-btn.is-on { background: var(--r-surface-2); color: var(--r-ink); box-shadow: none; }

/* landing chips */
.rd-cust-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rd-cust-chip {
  border: 1px solid var(--r-border); border-radius: 9px; padding: 7px 12px;
  font-size: 12.5px; font-weight: 600; font-family: inherit; cursor: pointer;
  background: var(--r-surface); color: var(--r-muted);
  transition: border-color var(--r-dur) var(--r-ease), color var(--r-dur) var(--r-ease);
}
.rd-cust-chip:hover { border-color: var(--r-primary); color: var(--r-ink); }
.rd-cust-chip.is-on { border-color: var(--r-primary); background: var(--r-mint-surface); color: var(--r-mint-ink); }

/* widget toggle rows */
.rd-cust-wrow {
  display: flex; align-items: center; gap: 12px; padding: 13px 0;
  border-top: 1px solid var(--r-hairline);
}
.rd-cust-wic {
  flex: none; width: 32px; height: 32px; border-radius: 9px;
  background: var(--r-mint-surface); color: var(--r-mint-ink);
  display: inline-flex; align-items: center; justify-content: center; font-size: 16px;
}
.rd-cust-wbody { flex: 1; min-width: 0; }
.rd-cust-wbody b { font-size: 13px; font-weight: 600; color: var(--r-ink); display: block; }
.rd-cust-wbody span { font-size: 12px; color: var(--r-faint); }
.rd-switch {
  flex: none; width: 38px; height: 22px; border-radius: 11px; border: none; cursor: pointer;
  position: relative; transition: background .15s; background: var(--r-seg-track);
}
.rd-switch.is-on { background: var(--r-primary); }
.rd-switch-knob {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--r-surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s;
}
.rd-switch.is-on .rd-switch-knob { transform: translateX(16px); }
html[data-rtheme="operator"] .rd-switch-knob { background: var(--r-ink); }

/* footer */
.rd-cust-foot {
  flex: none; padding: 12px 18px; border-top: 1px solid var(--r-hairline);
  background: var(--r-surface); display: flex; align-items: center; gap: 10px;
}
.rd-cust-saved { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--r-faint); }
.rd-cust-saved i { font-size: 14px; color: var(--r-good); }
.rd-cust-reset {
  margin-left: auto; height: 34px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--r-border); background: var(--r-surface); color: var(--r-muted);
  font-size: 12.5px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.rd-cust-reset:hover { background: var(--r-canvas-raised); color: var(--r-ink); }
