/* Kristi's panel. Loaded by both shells: `base.html` and the standalone home
   page, which carries its own stylesheet and its own token names (`--k-*`).

   So the panel names its own tokens once, here, and each reads the app's token
   first and the home page's as the fallback. Every value is a reference onto a
   token one of the two sheets declares; none is a colour of its own, which is
   the rule both sheets hold.

   **Every cut in the previous version was a dark-theme value on a light
   panel**: cream text on a cream card, a blue-tinted ground the brand has no
   blue for, and "Loading" in white. It rendered, raised nothing, and read on
   screen as an empty box. Tone is carried by a 3px bar on the card's edge and
   a label, the brand's way of saying a status without painting a surface. */

.kr {
  --kr-surface: var(--surface, var(--k-surface));
  --kr-card: var(--canvas, var(--k-bg));
  --kr-rule: var(--rule, var(--k-line));
  --kr-ink: var(--ink, var(--k-ink-strong));
  --kr-ink-2: var(--ink-2, var(--k-muted));
  --kr-tile: var(--fill-strong, var(--k-ink-strong));
  --kr-on-tile: var(--on-dark, var(--k-surface));
  --kr-radius: var(--radius, var(--k-radius));
  --kr-needs-you: var(--accent, var(--k-accent));
  --kr-over: var(--signal-over, var(--k-accent));
  --kr-review: var(--signal-review, var(--k-muted));
  --kr-under: var(--signal-under, var(--k-muted));
  --kr-info: var(--rule, var(--k-line));
  font-family: inherit;
}

.kr-rail {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 30;
  width: 320px;
  transform: translateX(320px);
  transition: transform 300ms ease-out;
  display: flex; flex-direction: column;
  background: var(--kr-surface);
  border-left: 1px solid var(--kr-rule);
  box-shadow: var(--shadow-pop, none);
}
.kr-rail.is-open { transform: translateX(0); }

.kr-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--kr-rule);
}
.kr-mark {
  width: 24px; height: 24px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--kr-tile); color: var(--kr-on-tile);
  border-radius: var(--kr-radius);
}
.kr-mark svg { width: 16px; height: 16px; }
.kr-titles { flex: 1; min-width: 0; }
.kr-name {
  margin: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--kr-ink-2);
}
.kr-context {
  margin: 0; font-size: 13px; font-weight: 600; color: var(--kr-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kr-close {
  background: none; border: 0; padding: 4px; cursor: pointer;
  color: var(--kr-ink-2);
}
.kr-close svg { width: 16px; height: 16px; display: block; }

.kr-cards {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.kr-note { margin: 0; padding: 16px 8px; font-size: 12px; text-align: center; color: var(--kr-ink-2); }

.kr-card {
  display: block; text-decoration: none;
  background: var(--kr-card);
  border: 1px solid var(--kr-rule);
  border-left: 3px solid var(--kr-info);
  border-radius: var(--kr-radius);
  padding: 10px 12px;
  transition: border-color 120ms ease;
}
a.kr-card:hover { border-color: var(--kr-ink-2); }
.kr-card--needs_you { border-left-color: var(--kr-needs-you); }
.kr-card--over { border-left-color: var(--kr-over); }
.kr-card--review { border-left-color: var(--kr-review); }
.kr-card--under { border-left-color: var(--kr-under); }
.kr-card-title { margin: 0; font-size: 13px; font-weight: 600; color: var(--kr-ink); }
.kr-card-body { margin: 2px 0 0; font-size: 12px; line-height: 1.4; color: var(--kr-ink-2); }

.kr-foot { padding: 8px 12px; border-top: 1px solid var(--kr-rule); }
.kr-ask {
  width: 100%; display: flex; align-items: center; gap: 8px;
  background: none; border: 0; padding: 6px 8px; cursor: pointer;
  font: inherit; font-size: 12px; color: var(--kr-ink-2);
  border-radius: var(--kr-radius);
}
.kr-ask:hover { color: var(--kr-ink); }
.kr-ask svg { width: 12px; height: 12px; }
.kr-ask kbd {
  margin-left: auto; font-size: 10px; padding: 1px 4px;
  border: 1px solid var(--kr-rule); border-radius: var(--kr-radius);
}

.kr-toggle {
  position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 20;
  padding: 16px 8px; cursor: pointer;
  background: var(--kr-tile); color: var(--kr-on-tile);
  border: 1px solid var(--kr-tile); border-right: 0;
  border-radius: var(--kr-radius) 0 0 var(--kr-radius);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.kr-toggle svg { width: 16px; height: 16px; }
.kr-toggle-count {
  min-width: 18px; padding: 1px 4px; font-size: 10px; font-weight: 600;
  text-align: center; border-radius: 9px;
  background: var(--kr-needs-you); color: var(--kr-on-tile);
}
.kr-toggle[hidden], .kr-toggle-count[hidden] { display: none; }

/* --- Ask Kristi: one bar, wherever Kristi is asked (2026-11-09) ------------

   `_partials/ask_kristi.html` draws it. The same shape on every surface (the
   home page, reports, the admin home, Kristi's panel) so a person learns it
   once: the Kendres mark, a large input, the ⌘J hint, a Graphite button,
   suggested prompts under it and the answer below. A white card with a
   strong edge on the grey page is the weight; the focus ring is Coral, the
   accent's sanctioned job. No glow and no gradient, which the brand forbids. */
.kask {
  --kask-line: var(--rule-strong, var(--k-line));
  --kask-focus: var(--accent, var(--k-accent));
  display: grid; gap: 10px;
}
.kask-bar {
  display: flex; align-items: center; gap: 12px;
  min-height: 64px; padding: 8px 8px 8px 18px;
  background: var(--kr-surface);
  border: 1.5px solid var(--kask-line);
  border-radius: 10px;
}
.kask-bar:focus-within { outline: 2px solid var(--kask-focus); outline-offset: 2px; }
.kask-mark { display: inline-flex; width: 22px; height: 22px; flex: none;
             --mark-ink: var(--kr-ink); --mark-accent: var(--kask-focus); }
.kask-mark svg { width: 22px; height: 22px; }
.kask-input {
  flex: 1; min-width: 0; height: 46px; padding: 0;
  border: 0 !important; background: transparent !important; box-shadow: none !important;
  font: inherit; font-size: 17px; color: var(--kr-ink);
}
.kask-input:focus { outline: none !important; }
.kask-input::placeholder { color: var(--kr-ink-2); }
.kask-hint {
  flex: none; padding: 2px 6px; font-size: 11px; font-family: inherit;
  color: var(--kr-ink-2); border: 1px solid var(--kr-rule); border-radius: 4px;
}
.kask-btn {
  flex: none; min-height: 46px; padding: 0 20px; cursor: pointer;
  border: 0; border-radius: 6px; font: inherit; font-size: 14px; font-weight: 600;
  background: var(--kr-tile); color: var(--kr-on-tile);
}
.kask-btn:disabled { opacity: .6; cursor: progress; }
.kask-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.kask-chips:empty { display: none; }
.kask-chips button, .kask-chips .chip {
  min-height: 32px; padding: 0 12px; cursor: pointer;
  border: 1px solid var(--kr-rule); border-radius: 16px;
  background: var(--kr-surface); color: var(--kr-ink); font: inherit; font-size: 13px;
}
.kask-chips button:hover, .kask-chips .chip:hover { border-color: var(--kr-ink-2); }
.kask-note { margin: 0; font-size: 12px; color: var(--kr-ink-2); }
.kask-answer:empty { display: none; }
.kask-answer { font-size: 14px; line-height: 1.55; color: var(--kr-ink); }
.kask-answer p { margin: 0 0 8px; }
.kask-answer a { color: var(--kr-ink); }
.kask--compact .kask-bar { min-height: 52px; padding: 6px 6px 6px 12px; gap: 8px; }
.kask--compact .kask-input { height: 38px; font-size: 15px; }
.kask--compact .kask-btn { min-height: 38px; padding: 0 14px; }
.kask--compact .kask-hint { display: none; }
@media (max-width: 640px) {
  .kask-bar { min-height: 56px; padding: 6px 6px 6px 12px; gap: 8px; }
  .kask-input { font-size: 16px; }
  .kask-hint { display: none; }
  .kask-btn { padding: 0 14px; }
}

/* The mark is Kristi's sign on the panel and its tab (2026-11-09): the five
   bars, on the dark tile, in place of a sparkle the brand does not have. */
.kr-mark, .kr-toggle { --mark-ink: var(--kr-on-tile); --mark-accent: var(--kr-needs-you); }
.kr-ask-box { padding: 12px 16px; border-bottom: 1px solid var(--kr-rule); }
.kr-ask-box .kask-answer { max-height: 40vh; overflow-y: auto; margin-top: 4px; }
.kask-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
