/* ═══════════════════════════════════════════════════════════════════════
   EssayCraft Pro — RESIZABLE LEFT PANE
   Copyright (c) 2026 Blade Research Inc. All rights reserved.

   One module, three shells. The client dashboard (.ecp-rail), the editor
   Workroom and the admin Control Room (.ecp-wr-side) all use the same
   fixed-sidebar layout, so they all get the same drag handle, the same
   collapse behaviour and the same appearance controls.

   DESIGN CONTRACT — "do not tamper":
   Everything is gated behind .ecp-rail-resizable, which JS only adds once it
   has found a rail AND the viewport is wide enough to have one. With the class
   absent, not a single rule below matches and the shells render exactly as
   they did before.

   Width lives in ONE place: --ecp-rail-w on the shell. The content column is
   already flex:1 1 auto; min-width:0 in both shells, so it reflows to whatever
   is left over without this file touching it at all.
   ═══════════════════════════════════════════════════════════════════════ */

.ecp-rail-resizable {
  --ecp-rail-w: 254px;
  --ecp-rail-min: 0px;
}

/* ── The pane itself ──
   Scoped to wide viewports ONLY. Below 900px both shells turn this element
   into a fixed, off-canvas drawer, and a stray position:relative here would
   drop it back into the flow and break the drawer on every phone. Sizing the
   pane is a desktop concern; the media query is the guard rail. */
@media (min-width: 901px) {
  .ecp-rail-resizable > .ecp-rail,
  .ecp-rail-resizable > .ecp-wr-side {
    flex: 0 0 var(--ecp-rail-w) !important;
    width: var(--ecp-rail-w) !important;
    min-width: 0 !important;
    position: relative;
    overflow: visible;            /* the handle sits just outside the edge */
  }
}

/* While dragging, kill every transition on both panes — a 240ms ease on the
   width is what makes a resize feel like mud instead of a drag. */
body.ecp-rail-dragging,
body.ecp-rail-dragging * {
  transition: none !important;
  animation-play-state: paused !important;
}
body.ecp-rail-dragging {
  cursor: col-resize !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* Outside a drag, width changes glide. */
@media (min-width: 901px) {
  .ecp-rail-resizable > .ecp-rail,
  .ecp-rail-resizable > .ecp-wr-side {
    transition: flex-basis .18s ease, width .18s ease;
  }
}

/* ══ THE HANDLE ══════════════════════════════════════════════════════════ */
/* Anchored to the SHELL and offset by the pane's width, so a pane of width 0
   still has a visible, clickable handle sitting against the screen edge. */
.ecp-rail-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--ecp-rail-w, 254px);
  margin-left: -5px;
  width: 11px;
  z-index: 40;
  cursor: col-resize;
  touch-action: none;             /* the drag is ours, not the scroller's */
  background: transparent;
  border: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* The visible hairline — invisible until it matters. */
.ecp-rail-handle::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 3px;
  margin-left: -1.5px;
  border-radius: 3px;
  background: currentColor;
  color: #0f9aa0;
  opacity: 0;
  transition: opacity .16s ease;
}
.ecp-rail-handle:hover::before,
.ecp-rail-handle:focus-visible::before,
body.ecp-rail-dragging .ecp-rail-handle::before { opacity: .85; }
.ecp-rail-handle:focus-visible { outline: none; }

/* The grip dots — the only always-on hint that this edge can be dragged. */
.ecp-rail-grip {
  position: relative;
  width: 5px;
  height: 34px;
  border-radius: 99px;
  background: rgba(127, 145, 165, .40);
  transition: background .16s ease, height .16s ease;
  pointer-events: none;
}
.ecp-rail-handle:hover .ecp-rail-grip { background: #0f9aa0; height: 54px; }

/* ── Collapse / expand chip ── */
.ecp-rail-toggle {
  position: absolute;
  top: 50%;
  left: var(--ecp-rail-w, 254px);
  margin-left: -13px;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(127, 145, 165, .38);
  background: #fff;
  color: #0f9aa0;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 41;
  box-shadow: 0 2px 8px rgba(16, 34, 52, .18);
  opacity: 0;
  transition: opacity .16s ease, transform .16s ease, background .16s ease;
}
.ecp-rail-resizable:hover .ecp-rail-toggle,
.ecp-rail-handle:hover ~ .ecp-rail-toggle,
.ecp-rail-toggle:focus-visible { opacity: 1; }
.ecp-rail-toggle:hover { background: #0f9aa0; color: #fff; }
.ecp-rail-toggle:active { transform: translateY(-50%) scale(.92); }
/* No hover on touch — the chip stays visible so it is reachable at all. */
@media (hover: none) {
  .ecp-rail-toggle { opacity: .9; }
  .ecp-rail-handle { width: 22px; right: -11px; }
}

/* ══ WIDTH-DRIVEN TEXT ADJUSTMENT ════════════════════════════════════════
   These classes are set by a ResizeObserver on the rail — they respond to the
   rail's ACTUAL width, not the viewport, so a rail dragged narrow on a huge
   monitor adapts exactly like a rail on a small one. This is what keeps text
   from spilling, wrapping into three lines, or clipping mid-word.
   ═══════════════════════════════════════════════════════════════════════ */

/* Snug — everything still fits, just tighter. */
.ecp-rail-snug .ecp-nav,
.ecp-rail-snug .ecp-wr-nav { padding-left: 10px; padding-right: 8px; gap: 8px; }
.ecp-rail-snug .ecp-nav-t,
.ecp-rail-snug .ecp-wr-nav-t { font-size: 12.5px; }
.ecp-rail-snug .ecp-brand-sub,
.ecp-rail-snug .ecp-wr-brand-sub { display: none; }
.ecp-rail-snug .ecp-rail-top,
.ecp-rail-snug .ecp-wr-side-top { padding-left: 10px; padding-right: 10px; }

/* Narrow — drop everything that is context rather than navigation. */
.ecp-rail-narrow .ecp-nav-email,
.ecp-rail-narrow .ecp-nav-user-plan,
.ecp-rail-narrow .ecp-rail-card-sub,
.ecp-rail-narrow .ecp-wr-side-card-sub,
.ecp-rail-narrow .ecp-profile-chevron,
.ecp-rail-narrow .ecp-brand-reload-ic { display: none !important; }
.ecp-rail-narrow .ecp-nav-t,
.ecp-rail-narrow .ecp-wr-nav-t { font-size: 11.5px; }
.ecp-rail-narrow .ecp-nav-group { font-size: 9.5px; }
.ecp-rail-narrow .ecp-brand-title,
.ecp-rail-narrow .ecp-wr-brand-title { font-size: 13px; }

/* Icons — the pane is now a strip. Labels come off, everything centres, and
   the label survives as a tooltip so nothing becomes unidentifiable. */
.ecp-rail-icons .ecp-nav-t,
.ecp-rail-icons .ecp-wr-nav-t,
.ecp-rail-icons .ecp-brand-txt,
.ecp-rail-icons .ecp-wr-brand-txt,
.ecp-rail-icons .ecp-nav-user-info,
.ecp-rail-icons .ecp-nav-group,
.ecp-rail-icons .ecp-rail-card-lbl,
.ecp-rail-icons .ecp-rail-card-sub,
.ecp-rail-icons .ecp-wr-side-card-lbl,
.ecp-rail-icons .ecp-wr-side-card-sub,
.ecp-rail-icons .ecp-signout-txt { display: none !important; }

.ecp-rail-icons .ecp-nav,
.ecp-rail-icons .ecp-wr-nav,
.ecp-rail-icons .ecp-brand,
.ecp-rail-icons .ecp-wr-brand,
.ecp-rail-icons .ecp-me,
.ecp-rail-icons .ecp-signout {
  justify-content: center !important;
  padding-left: 6px !important;
  padding-right: 6px !important;
  gap: 0 !important;
}
.ecp-rail-icons .ecp-nav-ic,
.ecp-rail-icons .ecp-wr-nav-ic { font-size: 17px; }
.ecp-rail-icons .ecp-rail-top,
.ecp-rail-icons .ecp-rail-bottom,
.ecp-rail-icons .ecp-wr-side-top,
.ecp-rail-icons .ecp-wr-side-bottom { padding-left: 6px; padding-right: 6px; }
.ecp-rail-icons .ecp-rail-card,
.ecp-rail-icons .ecp-wr-side-card { padding: 8px 4px; text-align: center; }
.ecp-rail-icons .ecp-rail-card-val,
.ecp-rail-icons .ecp-wr-side-card-val { font-size: 16px; }
/* Badges would otherwise sit on top of the icon they belong to. */
.ecp-rail-icons .ecp-nav-badge {
  position: absolute; top: 4px; right: 6px; transform: scale(.82);
}
.ecp-rail-icons .ecp-nav,
.ecp-rail-icons .ecp-wr-nav { position: relative; }

/* Fully closed — the pane is gone and a tab brings it back. */
@media (min-width: 901px) {
  .ecp-rail-resizable.ecp-rail-closed > .ecp-rail,
  .ecp-rail-resizable.ecp-rail-closed > .ecp-wr-side {
    flex-basis: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    border-right-width: 0 !important;
  }
}
/* ── Closed ──
   Nothing is offset backwards any more, or it would sit off the left edge of
   the screen. The reopen chip is pinned visible and enlarged: when the pane is
   gone it is the ONLY way back, so it never depends on hover to appear. */
.ecp-rail-resizable.ecp-rail-closed .ecp-rail-handle {
  margin-left: 0;
  width: 16px;
}
.ecp-rail-resizable.ecp-rail-closed .ecp-rail-handle::before { opacity: .5; }
.ecp-rail-resizable.ecp-rail-closed .ecp-rail-grip { background: #0f9aa0; height: 46px; }
.ecp-rail-resizable.ecp-rail-closed .ecp-rail-toggle {
  opacity: 1 !important;
  margin-left: 6px;
  width: 30px;
  height: 30px;
  font-size: 15px;
  font-weight: 800;
  background: #0f9aa0;
  color: #fff;
  border-color: #0f9aa0;
  box-shadow: 0 3px 12px rgba(15, 154, 160, .45);
}
.ecp-rail-resizable.ecp-rail-closed .ecp-rail-toggle:hover { background: #0c7f84; }
/* The palette chip is a preference, not an escape route — it stands down while
   the pane is closed so the reopen chip is unambiguous. */
.ecp-rail-resizable.ecp-rail-closed .ecp-rail-paint { display: none; }

/* ══ APPEARANCE — colour, tone and frame ════════════════════════════════
   Four independent layers, each inert until the user opts in:
     .ecp-rail-tinted   → background from --ecp-rail-bg, already composed in
                          JS (finish layers first, base colour last)
     .ecp-rail-filtered → hue / brightness / saturation via one filter
     .ecp-rail-onlight  → the pane is now pale, so its text goes dark
     .ecp-rail-rounded / -edge / -shadowed → the frame

   The filter and the background are on the pane only, so the content column
   is never touched. Contrast is a measured fact from JS, not a theme guess:
   a pale pane inside a dark shell gets dark labels and nobody has to think
   about it.
   ═══════════════════════════════════════════════════════════════════════ */
.ecp-rail-tinted > .ecp-rail,
.ecp-rail-tinted > .ecp-wr-side {
  background: var(--ecp-rail-bg) !important;
  background-repeat: repeat !important;
  transition: background .22s ease, box-shadow .22s ease, border-radius .22s ease;
}
.ecp-rail-filtered > .ecp-rail,
.ecp-rail-filtered > .ecp-wr-side {
  filter: hue-rotate(var(--ecp-rail-hue, 0deg))
          brightness(var(--ecp-rail-bright, 1))
          saturate(var(--ecp-rail-sat, 1));
}

/* Glass only means anything when something sits behind the pane. Where
   backdrop-filter is unsupported the alpha alone still reads as a soft tint,
   which is why the JS lowers opacity rather than relying on the blur. */
.ecp-rail-glass > .ecp-rail,
.ecp-rail-glass > .ecp-wr-side {
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
}

/* Frame. Only the inner corners round — the outer edge meets the viewport. */
.ecp-rail-rounded > .ecp-rail,
.ecp-rail-rounded > .ecp-wr-side {
  border-radius: 0 var(--ecp-rail-radius, 0px) var(--ecp-rail-radius, 0px) 0;
}
.ecp-rail-shadowed > .ecp-rail,
.ecp-rail-shadowed > .ecp-wr-side {
  box-shadow: var(--ecp-rail-shadow, none);
  position: relative;
  z-index: 2;
}
.ecp-rail-tinted.ecp-rail-edge > .ecp-rail,
.ecp-rail-tinted.ecp-rail-edge > .ecp-wr-side {
  border-right: 1px solid rgba(127, 145, 165, .26);
}
.ecp-rail-tinted:not(.ecp-rail-edge) > .ecp-rail,
.ecp-rail-tinted:not(.ecp-rail-edge) > .ecp-wr-side {
  border-right-color: transparent;
}

/* ── CONTRAST ──────────────────────────────────────────────────────────
   Nav text, headings, dividers and avatars follow the pane's own luminance.
   Colours are written as currentColor-friendly rgba so one rule covers every
   shell without knowing any of their variable names. */
.ecp-rail-onlight > .ecp-rail,
.ecp-rail-onlight > .ecp-wr-side { color: #16212e; }
.ecp-rail-onlight > .ecp-rail .ecp-nav,
.ecp-rail-onlight > .ecp-rail .ecp-nav-name,
.ecp-rail-onlight > .ecp-rail .ecp-rail-sec,
.ecp-rail-onlight > .ecp-wr-side .ecp-wr-nav {
  color: rgba(22, 33, 46, .78) !important;
}
.ecp-rail-onlight > .ecp-rail .ecp-nav-email,
.ecp-rail-onlight > .ecp-rail .ecp-rail-lab,
.ecp-rail-onlight > .ecp-wr-side .ecp-wr-lab { color: rgba(22, 33, 46, .55) !important; }
.ecp-rail-onlight > .ecp-rail .ecp-nav:hover,
.ecp-rail-onlight > .ecp-wr-side .ecp-wr-nav:hover {
  background: rgba(16, 34, 52, .07) !important;
  color: #16212e !important;
}
.ecp-rail-onlight > .ecp-rail .ecp-nav-div,
.ecp-rail-onlight > .ecp-rail hr { border-color: rgba(16, 34, 52, .12) !important; }

.ecp-rail-ondark > .ecp-rail,
.ecp-rail-ondark > .ecp-wr-side { color: #eef3f9; }
.ecp-rail-ondark > .ecp-rail .ecp-nav,
.ecp-rail-ondark > .ecp-rail .ecp-nav-name,
.ecp-rail-ondark > .ecp-rail .ecp-rail-sec,
.ecp-rail-ondark > .ecp-wr-side .ecp-wr-nav {
  color: rgba(238, 243, 249, .82) !important;
}
.ecp-rail-ondark > .ecp-rail .ecp-nav-email,
.ecp-rail-ondark > .ecp-rail .ecp-rail-lab,
.ecp-rail-ondark > .ecp-wr-side .ecp-wr-lab { color: rgba(238, 243, 249, .58) !important; }
.ecp-rail-ondark > .ecp-rail .ecp-nav:hover,
.ecp-rail-ondark > .ecp-wr-side .ecp-wr-nav:hover {
  background: rgba(255, 255, 255, .09) !important;
  color: #fff !important;
}
.ecp-rail-ondark > .ecp-rail .ecp-nav-div,
.ecp-rail-ondark > .ecp-rail hr { border-color: rgba(255, 255, 255, .13) !important; }

/* ── ACCENT ── the active item, wherever the shell puts it. */
.ecp-rail-tinted > .ecp-rail .ecp-nav.active,
.ecp-rail-tinted > .ecp-wr-side .ecp-wr-nav.active,
.ecp-rail-tinted > .ecp-wr-side .ecp-wr-nav.is-active {
  background: var(--ecp-rail-accent-soft, rgba(127, 145, 165, .16)) !important;
  color: var(--ecp-rail-accent, currentColor) !important;
  box-shadow: inset 2px 0 0 var(--ecp-rail-accent, transparent);
}
.ecp-rail-tinted > .ecp-rail .ecp-nav.active .ecp-nav-c,
.ecp-rail-tinted > .ecp-rail .ecp-nav.active .ecp-badge {
  color: var(--ecp-rail-accent, currentColor) !important;
}

/* ── The appearance popover ── */
.ecp-rail-paint {
  position: absolute;
  top: 12px;
  left: var(--ecp-rail-w, 254px);
  margin-left: -13px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(127, 145, 165, .38);
  background: #fff;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 41;
  box-shadow: 0 2px 8px rgba(16, 34, 52, .18);
  opacity: 0;
  transition: opacity .16s ease, transform .16s ease;
}
.ecp-rail-resizable:hover .ecp-rail-paint,
.ecp-rail-paint:focus-visible { opacity: 1; }
.ecp-rail-paint:active { transform: scale(.92); }
@media (hover: none) { .ecp-rail-paint { opacity: .9; } }

.ecp-rp-panel {
  position: fixed;
  z-index: 2147483100;
  width: 296px;
  max-width: calc(100vw - 24px);
  background: #fff;
  color: #16212e;
  border-radius: 16px;
  box-shadow: 0 22px 60px rgba(16, 34, 52, .3), 0 2px 8px rgba(16, 34, 52, .12);
  padding: 14px 14px 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .16s ease, transform .16s ease;
}
.ecp-rp-panel.ecp-rp-on { opacity: 1; transform: none; }
.ecp-rp-title {
  font-size: 12px; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; color: #5b6b7d; margin: 0 0 9px;
}

/* Tabs keep three panels' worth of control inside one popover instead of a
   scroll the length of the window. */
.ecp-rp-tabs {
  display: flex; gap: 3px; padding: 3px; margin-bottom: 11px;
  background: #eef2f7; border-radius: 10px;
}
.ecp-rp-tab {
  flex: 1; padding: 6px 4px; border: 0; border-radius: 8px; cursor: pointer;
  background: transparent; color: #5b6b7d;
  font-family: inherit; font-size: 11.5px; font-weight: 700;
  transition: background .15s ease, color .15s ease;
}
.ecp-rp-tab.is-on { background: #fff; color: #16212e; box-shadow: 0 1px 3px rgba(16,34,52,.14); }
.ecp-rp-tab:hover:not(.is-on) { color: #16212e; }

/* The body scrolls, not the whole popover — the tabs and Done stay put. */
.ecp-rp-body {
  max-height: min(52vh, 430px);
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0 -4px 10px;
  padding: 0 4px;
  scrollbar-width: thin;
}
.ecp-rp-body::-webkit-scrollbar { width: 7px; }
.ecp-rp-body::-webkit-scrollbar-thumb { background: #d5dde7; border-radius: 99px; }

.ecp-rp-sub {
  font-size: 10px; font-weight: 800; letter-spacing: .07em;
  text-transform: uppercase; color: #8b98a8; margin: 10px 0 5px;
}
.ecp-rp-sub:first-child { margin-top: 0; }
.ecp-rp-sw {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; margin-bottom: 4px;
}
.ecp-rp-sw-acc { grid-template-columns: repeat(8, 1fr); margin-bottom: 0; }
.ecp-rp-swatch {
  aspect-ratio: 1 / 1; min-height: 26px;
  border-radius: 7px; cursor: pointer;
  border: 2px solid transparent; padding: 0;
  box-shadow: inset 0 0 0 1px rgba(16, 34, 52, .12);
  transition: transform .12s ease, box-shadow .12s ease;
}
.ecp-rp-swatch:hover { transform: scale(1.13); box-shadow: inset 0 0 0 1px rgba(16,34,52,.18), 0 3px 8px rgba(16,34,52,.22); }
.ecp-rp-swatch:focus-visible { outline: 2px solid #0f9aa0; outline-offset: 2px; }
.ecp-rp-swatch.is-active {
  border-color: #0f9aa0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5), 0 0 0 2px rgba(15,154,160,.28);
}
.ecp-rp-acc { border-radius: 50%; }

.ecp-rp-custom { display: flex; align-items: center; gap: 7px; margin-top: 2px; }
.ecp-rp-color {
  width: 34px; height: 30px; padding: 0; cursor: pointer;
  border: 1px solid #e0e6ee; border-radius: 8px; background: #fff;
}
.ecp-rp-hex {
  flex: 1; min-width: 0; height: 30px; padding: 0 8px;
  border: 1px solid #e0e6ee; border-radius: 8px; background: #fff; color: #16212e;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
}
.ecp-rp-hex:focus { outline: none; border-color: #0f9aa0; }
.ecp-rp-mini { flex: 0 0 auto; padding: 8px 12px; }

.ecp-rp-row { margin-bottom: 11px; }
.ecp-rp-lab {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11.5px; font-weight: 700; color: #5b6b7d; margin-bottom: 4px;
}
.ecp-rp-lab b { color: #16212e; font-size: 12px; }
.ecp-rp-range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 20px; background: transparent; margin: 0;
}
.ecp-rp-range::-webkit-slider-runnable-track { height: 5px; border-radius: 99px; background: #e6ebf2; }
.ecp-rp-range::-moz-range-track            { height: 5px; border-radius: 99px; background: #e6ebf2; }
.ecp-rp-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 19px; height: 19px; margin-top: -7px; border-radius: 50%;
  background: #0f9aa0; border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(16, 34, 52, .28); cursor: pointer;
}
.ecp-rp-range::-moz-range-thumb {
  width: 19px; height: 19px; border-radius: 50%;
  background: #0f9aa0; border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(16, 34, 52, .28); cursor: pointer;
}

/* Segmented pickers for the choices that are not a range. */
.ecp-rp-seg {
  display: flex; flex-wrap: wrap; gap: 3px; padding: 3px;
  background: #eef2f7; border-radius: 9px;
}
.ecp-rp-segb {
  flex: 1 1 auto; padding: 6px 7px; border: 0; border-radius: 7px; cursor: pointer;
  background: transparent; color: #5b6b7d;
  font-family: inherit; font-size: 11px; font-weight: 700; white-space: nowrap;
}
.ecp-rp-segb.is-on { background: #fff; color: #16212e; box-shadow: 0 1px 3px rgba(16,34,52,.14); }
.ecp-rp-segb:hover:not(.is-on) { color: #16212e; }

.ecp-rp-note { font-size: 10.5px; line-height: 1.45; color: #8b98a8; margin: 8px 0 0; }

.ecp-rp-acts { display: flex; gap: 7px; margin-top: 3px; }
.ecp-rp-btn {
  flex: 1; padding: 8px 6px; border-radius: 9px; cursor: pointer;
  border: 1px solid #e4e9f0; background: #f5f8fc; color: #16212e;
  font-size: 12px; font-weight: 700; font-family: inherit;
}
.ecp-rp-btn:hover { border-color: #0f9aa0; background: #eef7f8; }
.ecp-rp-btn.is-primary { background: #0f9aa0; border-color: #0f9aa0; color: #fff; }
.ecp-rp-btn.is-primary:hover { background: #0c8489; border-color: #0c8489; }

/* Dark shells */
.ecp-dark .ecp-rp-panel,
.ecp-wr-dark .ecp-rp-panel { background: #14212e; color: #e8eef7; }
.ecp-dark .ecp-rp-lab b,
.ecp-wr-dark .ecp-rp-lab b { color: #e8eef7; }
.ecp-dark .ecp-rp-btn,
.ecp-wr-dark .ecp-rp-btn { background: #1b2c3b; border-color: #24384a; color: #e8eef7; }
.ecp-dark .ecp-rp-tabs, .ecp-wr-dark .ecp-rp-tabs,
.ecp-dark .ecp-rp-seg,  .ecp-wr-dark .ecp-rp-seg  { background: #101b26; }
.ecp-dark .ecp-rp-tab.is-on,  .ecp-wr-dark .ecp-rp-tab.is-on,
.ecp-dark .ecp-rp-segb.is-on, .ecp-wr-dark .ecp-rp-segb.is-on { background: #23374a; color: #e8eef7; }
.ecp-dark .ecp-rp-hex, .ecp-wr-dark .ecp-rp-hex,
.ecp-dark .ecp-rp-color, .ecp-wr-dark .ecp-rp-color { background: #1b2c3b; border-color: #24384a; color: #e8eef7; }
.ecp-dark .ecp-rp-body::-webkit-scrollbar-thumb,
.ecp-wr-dark .ecp-rp-body::-webkit-scrollbar-thumb { background: #2b4055; }
.ecp-dark .ecp-rail-toggle,
.ecp-dark .ecp-rail-paint,
.ecp-wr-dark .ecp-rail-toggle,
.ecp-wr-dark .ecp-rail-paint { background: #1b2c3b; border-color: #2c4459; color: #4fd0d6; }

/* Anyone who has asked for less movement gets less movement. */
@media (prefers-reduced-motion: reduce) {
  .ecp-rp-panel, .ecp-rp-swatch,
  .ecp-rail-tinted > .ecp-rail, .ecp-rail-tinted > .ecp-wr-side { transition: none !important; }
}

/* ══ MOBILE — the drawer owns the pane, so the handle stands down ════════
   Below 900px both shells turn the rail into an off-canvas drawer with its own
   width and transform. Resizing it would fight that, so every rule above is
   withdrawn rather than overridden halfway.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  /* The controls come off. Nothing else needs undoing: every sizing rule
     above is already behind min-width:901px, so the shells' own drawer rules
     are the only ones in play down here. */
  .ecp-rail-handle,
  .ecp-rail-toggle,
  .ecp-rail-paint { display: none !important; }

  /* If the popover is ever opened down here — from the console, or from a
     future entry point inside the drawer — it becomes a bottom sheet rather
     than a 296px card floating off the edge of a phone. */
  .ecp-rp-panel {
    left: 0 !important; right: 0 !important;
    top: auto !important; bottom: 0 !important;
    width: 100% !important; max-width: none !important;
    border-radius: 18px 18px 0 0;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    transform: translateY(14px);
  }
  .ecp-rp-panel.ecp-rp-on { transform: none; }
  .ecp-rp-body { max-height: 46vh; }
  .ecp-rp-sw { grid-template-columns: repeat(8, 1fr); gap: 7px; }
  .ecp-rp-swatch { min-height: 34px; }

  /* The narrow/icon text classes are width-driven and would otherwise persist
     into a full-width drawer, hiding labels on a pane that has room for them. */
  .ecp-rail-icons .ecp-nav-t,
  .ecp-rail-icons .ecp-wr-nav-t,
  .ecp-rail-icons .ecp-brand-txt,
  .ecp-rail-icons .ecp-wr-brand-txt,
  .ecp-rail-icons .ecp-nav-user-info,
  .ecp-rail-icons .ecp-nav-group,
  .ecp-rail-icons .ecp-rail-card-lbl,
  .ecp-rail-icons .ecp-rail-card-sub,
  .ecp-rail-icons .ecp-wr-side-card-lbl,
  .ecp-rail-icons .ecp-wr-side-card-sub,
  .ecp-rail-icons .ecp-signout-txt,
  .ecp-rail-narrow .ecp-nav-email,
  .ecp-rail-narrow .ecp-nav-user-plan,
  .ecp-rail-narrow .ecp-rail-card-sub,
  .ecp-rail-narrow .ecp-wr-side-card-sub,
  .ecp-rail-narrow .ecp-profile-chevron { display: revert !important; }

  .ecp-rail-icons .ecp-nav,
  .ecp-rail-icons .ecp-wr-nav,
  .ecp-rail-icons .ecp-brand,
  .ecp-rail-icons .ecp-wr-brand,
  .ecp-rail-icons .ecp-me,
  .ecp-rail-icons .ecp-signout {
    justify-content: flex-start !important;
    padding-left: revert !important;
    padding-right: revert !important;
    gap: revert !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ecp-rail-resizable > .ecp-rail,
  .ecp-rail-resizable > .ecp-wr-side,
  .ecp-rail-handle::before,
  .ecp-rail-grip,
  .ecp-rail-toggle,
  .ecp-rail-paint,
  .ecp-rp-panel { transition: none !important; }
}
