/* shell.css — WKR-SHELL — Operator shell (palette · search · notifications · header · sidebar ·
   module transitions · Settings · Audit Log)
   Lead-wired lane file (2.76.85 fold). Owned by the WKR-SHELL seat.
   Scope every rule under a .shell-* / .palette-* / .notif-* / #module-auditlog selector
   (plus token :root and the shared .module-panel.shell-* hooks GRAPH/LEDGER consume).
   Motion 150–250 ms eased transform/opacity only; honour prefers-reduced-motion.

   SHARED TOKENS (consume — do not rename without a council)
   Provenance (Lead ledger ## LEAD, re-opened here):
   --motion-fast/base/slow  Fluent durationFast 150 / durationNormal 200 / durationGentle 250
                            Carbon duration.moderate.01 = 150 ms
   --motion-instant         Fluent durationUltraFast 50 ms (reduced-motion zeros all)
   --ease-out               Fluent curveDecelerateMax cubic-bezier(0.1, 0.9, 0.2, 1)
   --ease-in-out            Carbon standard productive easing
   --ease-emphasized        Carbon entrance / Fluent decelerate
   --elev-0..4              Primer shadow.resting.medium two-layer stack, themed light/dark
                            --elev-3 dark α0.45 from scout is UNVERIFIED — not used
   --stagger-step           40 ms, cap 8 rows (feel standard)
   Reduced motion           Ant Design alias.ts `motion === false` → durations 0s
                            commit 3bc029ad8f28bc03be737eeb0633b7bccfeb3038 MIT CONFIRMED */

:root {
  --motion-instant: 50ms;
  --motion-fast: 150ms;
  --motion-base: 200ms;
  --motion-slow: 250ms;
  --ease-out: cubic-bezier(0.1, 0.9, 0.2, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
  --ease-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --stagger-step: 40ms;
  --elev-0: none;
  --elev-1: 0 1px 0 rgba(15, 23, 42, 0.35);
  --elev-2: 0 1px 1px rgba(0, 0, 0, 0.28), 0 3px 6px rgba(0, 0, 0, 0.22);
  --elev-3: 0 2px 4px rgba(0, 0, 0, 0.24), 0 8px 16px rgba(0, 0, 0, 0.22);
  --elev-4: 0 4px 8px rgba(0, 0, 0, 0.28), 0 16px 28px rgba(0, 0, 0, 0.24);
}

[data-theme="light"] {
  --elev-1: 0 1px 0 rgba(15, 23, 42, 0.06);
  --elev-2: 0 1px 1px rgba(15, 23, 42, 0.10), 0 3px 6px rgba(15, 23, 42, 0.12);
  --elev-3: 0 2px 4px rgba(15, 23, 42, 0.08), 0 8px 16px rgba(15, 23, 42, 0.10);
  --elev-4: 0 4px 8px rgba(15, 23, 42, 0.08), 0 16px 28px rgba(15, 23, 42, 0.12);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-instant: 0ms;
    --motion-fast: 0ms;
    --motion-base: 0ms;
    --motion-slow: 0ms;
    --stagger-step: 0ms;
  }
}

html[data-reduce-motion="on"] {
  --motion-instant: 0ms;
  --motion-fast: 0ms;
  --motion-base: 0ms;
  --motion-slow: 0ms;
  --stagger-step: 0ms;
}

/* Incoming module: 150–250 ms opacity + 8 px translate. Does not rewrite display:none. */
.module-panel.active.shell-enter {
  animation: none;
  opacity: 0;
  transform: translateY(8px);
}
.module-panel.active.shell-enter.shell-enter-on {
  transition: opacity var(--motion-base) var(--ease-out), transform var(--motion-base) var(--ease-out);
  opacity: 1;
  transform: translateY(0);
}
html[data-reduce-motion="on"] .module-panel.active.shell-enter { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .module-panel.active.shell-enter { opacity: 1; transform: none; }
}

.shell-skel { padding: 12px 0; }
.shell-skel-line {
  height: 12px;
  margin: 10px 0;
  border-radius: 4px;
  background: color-mix(in srgb, var(--text-muted) 18%, transparent);
}
.shell-skel-line:nth-child(2) { width: 82%; }
.shell-skel-line:nth-child(3) { width: 64%; }
.shell-skel-line:nth-child(4) { width: 74%; }

/* ══════════════ HIGH-END MODULE HOVER POLISH (v2.76.128) ══════════════ */
/* Purpose: Create the "wanting to use" feel with smooth, purposeful feedback. */
/* No gimmicks—only enhanced affordance and depth through subtle transforms. */

#appHeader.shell-scrolled {
  box-shadow: var(--elev-2);
}

/* Landing & login screens: gentle fade-in entrance for polished first impression.
   Fill mode `both` pins the end state — the base rule must never carry opacity:0
   without it, or the screens snap back to invisible after the animation ends. */
body > section[id^="landing"],
main[id="loginScreen"] {
  animation: pageEntrance var(--motion-slow) var(--ease-out-expo) both;
}
@keyframes pageEntrance {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
html[data-reduce-motion="on"] body > section[id^="landing"],
html[data-reduce-motion="on"] main[id="loginScreen"] {
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  body > section[id^="landing"],
  main[id="loginScreen"] {
    animation: none;
  }
}

/* Feature cards on landing: staggered entrance reveal on the shared 40 ms step token. */
.landing-feature-card {
  animation: cardEntrance var(--motion-base) var(--ease-out-quart) both;
}
.landing-feature-card:nth-child(2) { animation-delay: calc(var(--stagger-step) * 1); }
.landing-feature-card:nth-child(3) { animation-delay: calc(var(--stagger-step) * 2); }
.landing-feature-card:nth-child(4) { animation-delay: calc(var(--stagger-step) * 3); }
.landing-feature-card:nth-child(5) { animation-delay: calc(var(--stagger-step) * 4); }
.landing-feature-card:nth-child(6) { animation-delay: calc(var(--stagger-step) * 5); }

@keyframes cardEntrance {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

html[data-reduce-motion="on"] .landing-feature-card { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .landing-feature-card { animation: none; }
}

/* Module panels get gentle hover lift + accent-glow for intentional depth. */
.module-panel:not(.active):not(:hover),
.module-panel.active .shell-menu-card:hover {
  transition: transform var(--motion-slow) var(--ease-out-expo),
              border-color var(--motion-fast) var(--ease-out-quart);
  will-change: transform;
}
.module-panel:not(.active):hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  box-shadow: 0 8px 24px rgba(0,0,0,0.25), 0 0 24px var(--accent-glow);
}

/* Reduced motion respect via single canonical rule at top of file is sufficient. */
@media (prefers-reduced-motion: reduce) {
  .module-panel { transition: none !important; }
}

/* Navigation indicator pulse when module enters focus. */
.shell-nav-indicator.pulse {
  animation: indicatorPulse var(--motion-slow) var(--ease-emphasized);
}
@keyframes indicatorPulse {
  from { width: 3px; opacity: 1; }
  to { width: 4px; opacity: 0.7; }
}
html[data-reduce-motion="on"] .shell-nav-indicator,
@media (prefers-reduced-motion: reduce) {
  .shell-nav-indicator { animation: none; }
}

/* Modal/panel entrance gets staggered reveal (40ms step) for rhythmic polish. */
.module-panel.shell-enter.shell-enter-on {
  transition-delay: calc(var(--stagger-step) * attr(data-order) * 1);
}
[data-theme="light"] #appHeader .header-chip,
[data-theme="light"] #appHeader .theme-toggle,
[data-theme="light"] #appHeader .btn-icon {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
}
[data-theme="light"] #appHeader #cmdpal-trigger {
  color: var(--accent);
  border-color: var(--accent);
}
[data-theme="light"] #appHeader .hb-cb { color: var(--accent-cb); }
[data-theme="light"] #appHeader .hb-ss { color: var(--accent-ss); }
#appHeader .theme-toggle:hover,
#appHeader .btn-icon:hover,
#appHeader .header-chip:hover {
  transform: translateY(-1px);
  transition: transform var(--motion-fast) var(--ease-out), border-color var(--motion-fast) var(--ease-out), background-color var(--motion-fast) var(--ease-out);
}
#appHeader .theme-toggle:active,
#appHeader .btn-icon:active,
#appHeader .header-chip:active { transform: translateY(0); }
#appHeader .theme-toggle:focus-visible,
#appHeader .btn-icon:focus-visible,
#appHeader .header-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.shell-notif-bell { position: relative; }
#notifBadge.shell-notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 50%;
  background: var(--red, #b91c1c);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
#notifBadge.shell-notif-badge.is-on { display: flex; }

/* Sidebar sliding indicator + keyboard target. */
.sidebar { position: relative; }
.shell-nav-indicator {
  position: absolute;
  left: 6px;
  width: 3px;
  height: 28px;
  border-radius: 2px;
  background: var(--accent);
  transition: transform var(--motion-base) var(--ease-emphasized);
  pointer-events: none;
  z-index: 1;
}
html[data-reduce-motion="on"] .shell-nav-indicator { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .shell-nav-indicator { transition: none; }
}
.sidebar .nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.sidebar .nav-item[aria-current="page"] { font-weight: 600; }

/* Legacy cmdpal overlay is neutralized; one APG dialog = #searchModal. */
#cbss-cmdpal { display: none !important; }

/* Palette — APG dialog on #searchModal */
#searchModal.palette-overlay.show { display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.palette-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.palette-panel {
  width: min(640px, calc(100vw - 24px));
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--elev-4);
  overflow: hidden;
}
.palette-panel .search-icon { font-variant: small-caps; letter-spacing: 0.04em; color: var(--accent); font-size: 0.7rem; font-weight: 700; }
.palette-list { max-height: min(420px, 56vh); overflow: auto; }
.palette-group {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 8px 14px 4px;
  font-variant-numeric: tabular-nums;
}
.palette-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 14px;
  cursor: pointer;
  border: 0;
  width: 100%;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
}
.palette-opt[aria-selected="true"],
.palette-opt:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.palette-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.palette-mark {
  flex: 0 0 36px;
  font-size: 0.62rem;
  font-weight: 700;
  font-variant: small-caps;
  color: var(--accent);
  text-align: center;
}
.palette-label { flex: 1; }
.palette-hint { font-size: 0.68rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.palette-empty { padding: 28px 16px; text-align: center; color: var(--text-muted); }
.palette-footer {
  display: flex;
  gap: 12px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  font-size: 0.68rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Notifications as APG popover (restyle existing drawer; markup is outside allowed HTML). */
#notificationDrawer.notif-drawer {
  position: fixed;
  top: calc(var(--header-h, 64px) + 8px);
  right: 16px;
  left: auto;
  bottom: auto;
  width: min(400px, calc(100vw - 24px));
  height: auto;
  max-height: min(480px, 70vh);
  transform: none;
  z-index: 90;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  box-shadow: var(--elev-3);
  overflow: hidden;
}
#notificationDrawer.notif-drawer.hidden { display: none; }
#notificationDrawer .notif-drawer-header h4 { font-size: 0.92rem; }
.notif-day {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 12px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--card-bg);
  font-variant-numeric: tabular-nums;
}
.notif-item { min-height: 44px; }
.notif-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.shell-undo {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: var(--elev-3);
  font-size: 0.82rem;
}
.shell-undo button {
  min-height: 36px;
  min-width: 44px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}

/* Settings sections */
#settingsModal .shell-set-nav { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 12px; }
#settingsModal .shell-set-tab {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: inherit;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}
#settingsModal .shell-set-tab[aria-selected="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
#settingsModal .shell-set-panel[hidden] { display: none; }
#settingsModal .shell-set-hint { font-size: 0.75rem; color: var(--text-muted); margin: 0 0 10px; }
#settingsModal .shell-theme-row { display: flex; flex-wrap: wrap; gap: 8px; }
#settingsModal .shell-theme-row label {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* Audit facets + virtual list */
#module-auditlog .shell-audit-facets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0 12px;
}
#module-auditlog .shell-audit-facets .form-input,
#module-auditlog .shell-audit-chip {
  min-height: 44px;
  font-size: 0.78rem;
}
#module-auditlog .shell-audit-chip {
  padding: 0 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: inherit;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-variant: small-caps;
  font-weight: 700;
}
#module-auditlog .shell-audit-chip[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
#module-auditlog #auditLogList.shell-audit-virt {
  position: relative;
  max-height: min(640px, calc(100vh - 260px));
  overflow: auto;
}
#module-auditlog .shell-audit-spacer { width: 100%; }
#module-auditlog .activity-date-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-primary);
  font-variant-numeric: tabular-nums;
}
#module-auditlog .activity-item {
  min-height: 52px;
  cursor: pointer;
}
#module-auditlog .activity-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#module-auditlog .audit-stat-num { font-variant-numeric: tabular-nums; }

.cbss-outbox-chip {
  display: inline-flex;
  align-items: center;
  max-width: 16rem;
  margin-right: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border, #3a3a3a);
  background: color-mix(in srgb, var(--accent, #c9a227) 12%, transparent);
  color: var(--text-secondary, inherit);
  font-size: 0.75rem;
  line-height: 1.2;
}
.cbss-outbox-chip[hidden] { display: none; }
.cbss-outbox-chip[role="button"] { cursor: pointer; }

.cbss-conflict-overlay[hidden] { display: none; }
.cbss-conflict-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  color: var(--text-secondary, inherit);
}
.cbss-conflict-note {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--text-secondary, inherit);
}
.cbss-conflict-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.cbss-conflict-table th,
.cbss-conflict-table td {
  border: 1px solid var(--border, #3a3a3a);
  padding: 0.4rem 0.5rem;
  vertical-align: top;
  text-align: left;
}
.cbss-conflict-table th[scope="row"] { font-weight: 600; }
.cbss-conflict-money {
  display: block;
  font-weight: 500;
  color: var(--orange, #d97706);
}
.cbss-conflict-same {
  display: block;
  font-weight: 400;
  color: var(--text-secondary, inherit);
}
.cbss-conflict-actions { flex-wrap: wrap; gap: 0.4rem; }
.cbss-conflict-fields { margin: 0.6rem 0 0.8rem; overflow-x: auto; }

.acct-mutation-review {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem 1rem;
  border: 1px solid var(--border, #3a3a3a);
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--accent, #c9a227) 6%, transparent);
}
.acct-mutation-review-list {
  display: grid;
  gap: 0.55rem;
}
.acct-mutation-review-card {
  padding: 0.55rem 0.7rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border, #3a3a3a);
  background: var(--bg-primary, transparent);
}
.acct-mutation-review-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  color: var(--text-secondary, inherit);
}

@media (max-width: 420px) {
  #notificationDrawer.notif-drawer { right: 8px; width: calc(100vw - 16px); }
  .palette-panel { width: calc(100vw - 16px); }
}
