/* ============================================================================
   Siphrix console — polish layer
   Restrained, control-room motion on top of console.css: staggered panel
   entrances, row/card micro-interactions, a faint top-bar aurora, refined
   segments + focus. Loads last so it can refine without rewriting.
   ============================================================================ */

/* ---- Panel entrance (auto-plays on every route render) ------------------- */
.app-view > .panel {
  animation: panel-in .5s cubic-bezier(.22,.61,.36,1) both;
}
.app-view > .panel:nth-child(1) { animation-delay: .02s; }
.app-view > .panel:nth-child(2) { animation-delay: .09s; }
.app-view > .panel:nth-child(3) { animation-delay: .16s; }
.app-view > .panel:nth-child(4) { animation-delay: .23s; }
.app-view > .panel:nth-child(n+5) { animation-delay: .28s; }
@keyframes panel-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Panel hover: a whisper of lift + a teal hairline. */
.panel { transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease; }
.panel:hover {
  border-color: color-mix(in srgb, var(--teal) 26%, var(--line));
  box-shadow: 0 18px 40px -28px rgba(0,0,0,.8);
}

/* ---- Top bar: faint moving aurora so the shell feels alive --------------- */
.app-top { position: relative; overflow: hidden; }
.app-top::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: -1;
  background:
    radial-gradient(420px 80px at 12% -40%, rgba(43,212,189,.12), transparent 70%),
    radial-gradient(360px 80px at 88% -40%, rgba(43,212,189,.07), transparent 70%);
  opacity: .9;
  animation: top-aurora 14s ease-in-out infinite alternate;
}
@keyframes top-aurora { from { transform: translateX(-3%); } to { transform: translateX(3%); } }

/* ---- Nav: icon nudge on hover, smoother active pill --------------------- */
.side-link { position: relative; }
.side-link svg { transition: transform .2s ease, opacity .2s ease; }
.side-link:hover svg { transform: translateX(2px); opacity: 1; }
.side-link.active::before { transition: height .25s var(--spring, ease); }

/* ---- Connection / list rows: hover highlight + slide --------------------- */
.plat-row { transition: background .18s ease, padding-left .18s ease; }
.panel-body.flush .plat-row:hover {
  background: rgba(43,212,189,.05);
}
.plat-row .plat-ic { transition: transform .2s ease, color .2s ease; }
.plat-row:hover .plat-ic { transform: scale(1.08); color: var(--teal); }

/* ---- KPI cards: a slow diagonal sheen ----------------------------------- */
.kpi-card { position: relative; overflow: hidden; }
.kpi-card::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.06), transparent);
  transform: skewX(-18deg); animation: kpi-sheen 7s ease-in-out infinite;
}
@keyframes kpi-sheen { 0%,70% { left: -60%; } 100% { left: 130%; } }
.kpi-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--teal) 35%, var(--line)); }

/* ---- Segments (Off/Basic/Strict): springy press ------------------------- */
.seg button { transition: background .2s ease, color .2s ease, transform .12s ease; }
.seg button:active { transform: scale(.94); }
.seg button.on { box-shadow: 0 6px 18px -8px var(--allow-glow); }

/* ---- Primary buttons: lift + glow on hover ------------------------------ */
.btn-primary { transition: transform .15s ease, box-shadow .2s ease, filter .2s ease; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 26px -10px var(--allow-glow); }
.btn-primary:active { transform: translateY(0) scale(.99); }

/* ---- Verdict / result reveal -------------------------------------------- */
.demo-result, .dr-verdict { animation: result-in .4s var(--ease-out, ease) both; }
@keyframes result-in { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
.dr-glyph .ico { animation: glyph-pop .45s var(--spring, cubic-bezier(.34,1.56,.64,1)) both; }
@keyframes glyph-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---- Inputs: calmer, branded focus -------------------------------------- */
.inp:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--teal) 55%, var(--line)) !important;
  box-shadow: 0 0 0 3px rgba(43,212,189,.12);
}

/* ---- Alert inbox severity dots feel ------------------------------------- */
.badge.block, .badge.abort, .badge.allow { transition: transform .2s ease; }
.plat-row:hover .badge { transform: scale(1.04); }

/* ---- Sidebar brand: gentle logo sheen on hover -------------------------- */
.app-side .brand .mark--img img { transition: transform .35s var(--spring, ease); }
.app-side .brand:hover .mark--img img { transform: rotate(-4deg) scale(1.04); }

@media (prefers-reduced-motion: reduce) {
  .app-view > .panel, .demo-result, .dr-verdict, .dr-glyph .ico { animation: none; }
  .app-top::after, .kpi-card::after { animation: none; }
}

/* ---- Activity: clickable story rows ------------------------------------- */
.act-row { cursor: pointer; transition: background .15s ease; }
.act-row:hover td, .act-row.open td { background: var(--glass, rgba(255,255,255,.03)); }
.act-row:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.act-chev { color: var(--ink-3); font-size: .72rem; width: 2rem; text-align: center;
  transition: transform .2s ease; }
.act-row.open .act-chev { transform: rotate(180deg); color: var(--teal); }
.act-detail > td { padding: 0 !important; border-top: 0; }
.act-x { padding: 1rem 1.2rem 1.2rem; border-left: 2px solid var(--teal);
  background: linear-gradient(180deg, var(--glass, rgba(255,255,255,.03)), transparent);
  animation: result-in .25s ease both; }
.act-story { margin: 0 0 .65rem; font-size: .88rem; line-height: 1.55; color: var(--ink-2); max-width: 68ch; }
.act-story b { color: var(--ink); font-weight: 600; }
.act-x .dr-kv, .al-detail .dr-kv { margin-top: .35rem; }
.al-detail .act-story { margin-top: .2rem; }
@media (prefers-reduced-motion: reduce) { .act-x { animation: none; } }

/* ---- Activity: the target line + record excerpts --------------------- */
.act-target { font-family: var(--font-mono); font-size: .72rem; color: var(--ink-3);
  margin-top: .15rem; max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-code { font-family: var(--font-mono); font-size: .8rem; color: var(--teal);
  background: var(--glass, rgba(255,255,255,.04)); padding: .1rem .4rem; border-radius: 6px;
  word-break: break-all; }
.al-ex { border-left: 2px solid var(--line-2); margin: .2rem 0 .8rem; }
.al-ex-row { display: flex; gap: .8rem; align-items: baseline; flex-wrap: wrap;
  padding: .4rem .8rem; font-size: .82rem; color: var(--ink-2); }
.al-ex-row + .al-ex-row { border-top: 1px solid var(--line); }
.al-ex-row > .cap:first-child { min-width: 5.2rem; }

/* ---- Use the whole screen ------------------------------------------- */
.app-view { max-width: none; }
.act-target { max-width: 62ch; }

/* ---- Story panel layout --------------------------------------------- */
/* Label/value pairs read "when · 27 Jul 2026" — never glued together. */
.act-x .dr-kv > div, .al-detail .dr-kv > div {
  display: flex; gap: .7rem; align-items: baseline; }
.act-x .dr-kv > div > span, .al-detail .dr-kv > div > span {
  min-width: 8.5rem; color: var(--ink-3); flex: 0 0 auto; }
/* A long command/path gets its own block line instead of breaking a
   sentence in half. */
.act-tgt-block { display: flex; gap: .7rem; align-items: baseline;
  margin: .3rem 0 .8rem; }
.act-tgt-block > .cap { min-width: 8.5rem; flex: 0 0 auto; }
.act-tgt-block .act-code { display: inline-block; padding: .3rem .6rem;
  line-height: 1.5; max-width: 100%; }
.act-x-count { font-family: var(--font-mono); font-size: .72rem;
  color: var(--teal); background: var(--glass, rgba(255,255,255,.04));
  border: 1px solid var(--line-teal, var(--line)); border-radius: 999px;
  padding: .05rem .5rem; margin-left: .4rem; vertical-align: middle; }
.act-when-clock { display: block; font-size: .7rem; color: var(--ink-3); }

/* ---- The text a watch rule matched, pointed at ---------------------------- */
mark.act-mark { background: rgba(255,59,92,.22); color: #ff8fa3;
  border-radius: 4px; padding: 0 .15rem; font-weight: 600; }

/* ---- The last 24 hours, one bar per hour -------------------------------- */
.spark { display: flex; gap: 3px; align-items: flex-end; height: 96px; }
.spark-col { flex: 1; position: relative; min-height: 4px;
  background: color-mix(in srgb, var(--teal) 28%, transparent);
  border-radius: 3px 3px 0 0; transition: background .15s ease; }
.spark-col:hover { background: color-mix(in srgb, var(--teal) 55%, transparent); }
.spark-col > i { position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--block, #ff3b5c); opacity: .75; border-radius: inherit; }

/* ---- Who has been acting: flagged slice over the total bar --------------- */
.rk-bar { position: relative; }
.rk-fill.rk-flag { position: absolute; top: 0; left: 0; bottom: 0;
  background: var(--block, #ff3b5c); opacity: .65; }

/* ---- Rank rows: name | bar | value, value never wraps word-by-word ------- */
.rank-item { display: flex; align-items: center; gap: 1rem; }
.rank-item .rk-name { flex: 0 0 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-item .rk-bar { flex: 1 1 auto; }
.rank-item .rk-val { flex: 0 0 auto; white-space: nowrap; font-size: .8rem; }

/* ---- Small screens: the console in one hand ------------------------------ */
@media (max-width: 900px) {
  .app-view { padding: .9rem; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: .7rem; }
  .toolbar { flex-wrap: wrap; }
  .toolbar .inp { max-width: none; flex: 1 1 100%; }
  .panel-body.flush { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .dtable { min-width: 640px; }
  .form-row { flex-wrap: wrap; }
  .form-row .inp { flex: 1 1 100%; max-width: none; }
  .act-target { max-width: 40ch; }
  .act-x .dr-kv > div > span, .al-detail .dr-kv > div > span,
  .act-tgt-block > .cap { min-width: 6rem; }
  .rank-item .rk-name { flex-basis: 7rem; }
  .spark { height: 72px; gap: 2px; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .panel-head { flex-wrap: wrap; gap: .4rem; }
  .ph-actions { flex-wrap: wrap; }
  .al-ex-row { gap: .45rem; }
  .act-story { font-size: .84rem; }
}

/* ---- What a machine watches on its own -------------------------------- */
.dev-own { margin-top: .5rem; padding-left: .8rem; border-left: 2px solid var(--line-2); }
.dev-own > .cap { display: block; margin-bottom: .3rem; }
.dev-own-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .15rem 0; }
.dev-own-row .act-code { font-size: .74rem; }
