/* ==========================================================================
   turnstone — coordinator.css
   Coordinator-specific chrome.  Loaded only by coordinator/index.html;
   not part of console/static/style.css (the admin dashboard sheet).
   ==========================================================================
   Tokens (--panel, --hair, --ok, --warn, etc.) come from shared_static/
   base.css.  Form controls + .btn / .ghost / .appbar primitives come
   from shared_static/ui-base.css.  This file holds the patterns specific
   to the coordinator view: the right-rail sidebar and the pinned approval
   dock.
   ========================================================================== */

/* ==========================================================================
   Sidebar — coordinator right-rail container.  The .sidebar rule defines
   the visual chrome (panel bg, hair border, padding); the coord page's
   inline <style> overrides position/top/height/border-right to flex the
   rail into its grid column.  Section labels are 10px uppercase.
   ========================================================================== */
.sidebar {
  position: sticky;
  top: 48px;
  align-self: start;
  height: calc(100vh - 48px);
  padding: 16px 10px;
  background: var(--panel);
  border-right: 1px solid var(--hair);
  overflow: auto;
}

.side-section {
  margin-bottom: 18px;
}

.side-label {
  padding: 0 8px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
}

/* ==========================================================================
   Approval dock — bottom-pinned strip that appears when pending approvals
   exist.  Signature product pattern: a neutral dock (not a modal, not
   inline) that surfaces the approval contract without hijacking focus.

   Layout:
     .approval-dock        position: fixed bottom
       .dhead              11px uppercase warn kicker + count on right
       .dcall              risk pill + function name + arg preview
       .dctx               context code snippets
       .drow               right-aligned action cluster + nav spacer

   Actions (action cluster):
     button.act           neutral default ("dismiss" / "view")
     button.act.primary   ok-tinted green per the .ts-approval-btn--approve
                          convention in shared_static/chat.css.  The original
                          Claude Design spec preferred amber; turnstone
                          deliberately broke from it to keep colour-family
                          parity with the Approve button's existing green.
                          1.5px border, --r-md squared.
     button.act.always    dashed border — "Always approve for this rule"
     button.act.danger    err-tinted red — "Deny"

   Keyboard shortcuts (wired in coordinator.js):
     Enter  → primary approve
     D      → deny
     ⇧A     → always approve

   Focus policy: when the dock opens, move focus to button.act.primary so
   keyboard users can confirm without hunting.  Do NOT trap focus.
   ========================================================================== */
.approval-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 22px; /* clears the statusbar if one is present */
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 20px;
  background: var(--panel);
  border-top: 1px solid var(--hair);
  box-shadow: 0 -6px 24px -12px rgba(21, 24, 27, 0.18);
}

.approval-dock::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    to right,
    transparent,
    color-mix(in srgb, var(--warn) 50%, transparent),
    transparent
  );
}

.approval-dock .dhead {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--warn);
}

.approval-dock .dhead::before {
  content: "⚠";
  font-size: 12px;
}

.approval-dock .dhead .dcount {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-3);
}

/* Inline code-panel framing — the .dcall row reads as "the exact call you
   are approving," so we frame it like a mini inspectable code line rather
   than bare text on the dock surface. */
.approval-dock .dcall {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 10px;
  background: var(--panel);
  border: 1px solid var(--hair);
  border-radius: var(--r-sm);
}

.approval-dock .dcall .risk { flex-shrink: 0; }

.approval-dock .dcall .dfn {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
}

.approval-dock .dcall .dargs {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
}

.approval-dock .dctx {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--ink-3);
}

.approval-dock .dctx code {
  padding: 0 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-2);
  background: var(--panel-2);
  border: 1px solid var(--hair);
  border-radius: 3px;
}

.approval-dock .drow {
  display: flex;
  align-items: center;
  gap: 6px;
}

.approval-dock .drow .spacer { flex: 1; }

.approval-dock .drow .nav {
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
}

.approval-dock .drow .nav:hover {
  background: var(--panel-2);
  color: var(--ink);
}

/* Action buttons — 1.5px border, --r-md squared (NOT pill — these are
   primary-action surfaces, not inline buttons). */
.approval-dock button.act {
  padding: 7px 16px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--panel);
  border: 1.5px solid var(--hair-2);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.approval-dock button.act:hover {
  color: var(--ink);
  border-color: var(--ink-4);
}

.approval-dock button.act:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Approve and Always are siblings — same ok hue, differentiated by fill
   (filled vs outlined) and border-style (solid vs dashed).  Matches the
   .ts-approval-btn--approve convention in shared_static/chat.css.  Four
   stacked non-colour cues for WCAG 1.4.1: fill state, border style,
   label, position. */
.approval-dock button.act.primary {
  background: color-mix(in srgb, var(--ok) 28%, var(--panel));
  color: var(--ok-text);
  border-color: color-mix(in srgb, var(--ok) 65%, var(--hair));
  font-weight: 600;
}

.approval-dock button.act.primary:hover {
  background: color-mix(in srgb, var(--ok) 40%, var(--panel));
  color: var(--ink);
  border-color: var(--ok);
}

.approval-dock button.act.always {
  background: transparent;
  border-style: dashed;
  border-color: color-mix(in srgb, var(--ok) 65%, var(--hair));
  color: var(--ok-text);
}

.approval-dock button.act.always:hover {
  background: color-mix(in srgb, var(--ok) 15%, var(--panel));
  color: var(--ink);
  border-color: var(--ok);
}

.approval-dock button.act.danger {
  color: var(--err);
  border-color: color-mix(in srgb, var(--err) 42%, var(--hair));
}

.approval-dock button.act.danger:hover {
  background: var(--err-soft);
  color: var(--err);
  border-color: var(--err);
}

/* ==========================================================================
   Drag-and-drop overlay — applied to #coord-main while the user is
   dragging files from the OS over the chat pane. Composer wires this on
   construction (dragDrop.targetEl=coord-main, dropClass=coord-drop-target).
   The dashed outline + "Drop file to attach" overlay mirror the interactive
   pane's pattern so the affordance reads the same in both surfaces.
   ========================================================================== */
#coord-main {
  position: relative; /* anchors the ::after overlay */
}
#coord-main.coord-drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
}
#coord-main.coord-drop-target::after {
  content: "Drop file to attach";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 10;
}

/* Match .btn .kbd (in shared_static/ui-base.css) — --ink-3 clears AA at
   10px, --ink-4 is borderline on light panels. */
.approval-dock button.act .kbd {
  margin-left: 6px;
  padding: 0 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  border: 1px solid var(--hair);
  border-radius: 2px;
}

/* Tinted keycap on the primary Approve button — uses the parent's
   --ok hue so the keycap reads as part of the green action surface. */
.approval-dock button.act.primary .kbd {
  color: color-mix(in srgb, var(--ok) 70%, var(--ink-3));
  border-color: color-mix(in srgb, var(--ok) 40%, var(--hair));
}
