/*
 * kAInet Unified Shell — Creative Unification 2026-05-05 (CU-9).
 *
 * Shared chrome (header + left nav + active-brand / active-preset chips +
 * cross-engine hand-off CTAs) that turns the brand / kAIcreative /
 * kAIcontent / Library pages into a single product experience without
 * collapsing them into one mega-page.
 *
 * Loaded by every consenting template via a `<link>` to this file plus
 * the matching `kainet-unified-shell.js`. Templates declare opt-in by
 * adding `<div data-kainet-shell></div>` somewhere in their <body>.
 */

:root {
  --shell-bg:           #0b0d0f;
  --shell-fg:           #e7eaee;
  --shell-fg-dim:       #9ba3ab;
  --shell-border:       #1c2128;
  --shell-card:         #14181d;
  --shell-card-hover:   #1a2027;
  --shell-accent:       #f5a623; /* Von Restorff: only the active-brand chip uses this */
  --shell-accent-fg:    #1a1300;
  --shell-stale:        #d97706;
  --shell-stale-fg:     #fff7ed;
  --shell-radius:       10px;
  --shell-radius-sm:    6px;
  --shell-pad-x:        16px;
  --shell-pad-y:        10px;
  --shell-z-shell:      40;
  --shell-z-toast:      80;
}

[data-kainet-shell-mounted] body {
  /* Reserve space for the fixed header so existing page content
     doesn't slip underneath. Only set after JS mount so JS-disabled
     fallbacks still show the original page intact. */
  padding-top: 56px;
}

.kainet-shell-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--shell-bg);
  color: var(--shell-fg);
  border-bottom: 1px solid var(--shell-border);
  display: flex;
  align-items: center;
  padding: 0 var(--shell-pad-x);
  gap: 12px;
  z-index: var(--shell-z-shell);
  font-family: -apple-system, system-ui, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.kainet-shell-brand {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--shell-fg);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.kainet-shell-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.kainet-shell-nav a {
  display: inline-block;
  padding: 6px 12px;
  border-radius: var(--shell-radius-sm);
  color: var(--shell-fg-dim);
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}

.kainet-shell-nav a:hover {
  background: var(--shell-card-hover);
  color: var(--shell-fg);
}

.kainet-shell-nav a[aria-current="page"] {
  background: var(--shell-card);
  color: var(--shell-fg);
}

.kainet-shell-spacer {
  flex: 1 1 auto;
}

/* Discreet legal link — sits to the right of the active-brand chip on
   every shell page. Same compliance link surfaces from /legal and from
   the AI sub-processor change notification email. */
.kainet-shell-legal-link {
  font-size: 12px;
  color: var(--kainet-fg-muted, #6b7280);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background-color .12s ease, color .12s ease;
}
.kainet-shell-legal-link:hover {
  color: var(--kainet-fg, #111827);
  background-color: var(--kainet-row-stripe, #f3f4f6);
}

/* Active-brand chip — Von Restorff accent so the user always knows
   what brand they're operating in. Click switches to /brand. */
.kainet-shell-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--shell-card);
  color: var(--shell-fg);
  border: 1px solid var(--shell-border);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
}

.kainet-shell-chip:hover {
  background: var(--shell-card-hover);
  border-color: #2a3038;
}

.kainet-shell-chip--brand {
  border-color: var(--shell-accent);
}

.kainet-shell-chip--brand:hover {
  border-color: var(--shell-accent);
  background: rgba(245, 166, 35, 0.10);
}

.kainet-shell-chip__avatar {
  width: 28px; height: 28px;
  border-radius: 999px;
  background: var(--shell-accent);
  color: var(--shell-accent-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.kainet-shell-chip__avatar img {
  width: 100%; height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.kainet-shell-chip__label {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.kainet-shell-chip__sub {
  font-size: 11px;
  color: var(--shell-fg-dim);
  margin-left: 6px;
}

.kainet-shell-chip--stale {
  border-color: var(--shell-stale) !important;
  position: relative;
}

.kainet-shell-chip--stale::after {
  content: "•";
  color: var(--shell-stale);
  font-size: 18px;
  line-height: 1;
  margin-left: 4px;
}

/* Preset chip — secondary, no accent (only the brand chip carries the
   Von Restorff accent so the user's eye lands there first). */
.kainet-shell-chip--preset {
  background: transparent;
}

/* Stale banner — under header, full-width, dismissible. */
.kainet-shell-banner {
  position: fixed;
  top: 56px; left: 0; right: 0;
  background: var(--shell-stale);
  color: var(--shell-stale-fg);
  padding: 8px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: var(--shell-z-shell);
  font-family: -apple-system, system-ui, sans-serif;
}

.kainet-shell-banner button {
  background: transparent;
  color: inherit;
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 3px 10px;
  cursor: pointer;
  font-size: 12px;
}

.kainet-shell-banner button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.kainet-shell-banner__dismiss {
  margin-left: auto;
  border: none !important;
  font-size: 18px;
  line-height: 1;
}

[data-kainet-shell-mounted].kainet-shell-has-banner body {
  padding-top: 96px;
}

/* Hand-off CTA toolbar — dropped onto the bottom of the page when
   templates declare `<div data-kainet-handoff></div>`. */
.kainet-shell-handoff {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--shell-border);
  background: var(--shell-card);
  border-radius: var(--shell-radius);
  margin-top: 16px;
  font-family: -apple-system, system-ui, sans-serif;
  font-size: 13px;
  color: var(--shell-fg);
}

.kainet-shell-handoff__label {
  color: var(--shell-fg-dim);
  font-weight: 500;
  margin-right: 8px;
}

.kainet-shell-handoff a {
  color: var(--shell-fg);
  text-decoration: none;
  background: var(--shell-bg);
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius-sm);
  padding: 6px 12px;
  transition: border-color 120ms ease, background 120ms ease;
}

.kainet-shell-handoff a:hover {
  background: var(--shell-card-hover);
  border-color: #2a3038;
}

.kainet-shell-handoff a[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}
