/* ============================================================================
   portal.css — dark Sterling client portal (Engine Room re-theme of AKF /portal)
   ============================================================================ */
.portal {
  width: 100%; max-width: 100%;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line-2);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 40px 120px -40px rgba(0,0,0,0.8), 0 0 70px -34px var(--accent-glow);
  color: var(--text);
  font-size: 14px;
}

/* chrome */
.pt-chrome { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: rgba(11,14,20,0.5); }
.pt-dots { display: flex; gap: 6px; }
.pt-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--line-2); }
.pt-url { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 11px; color: var(--text-3); background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; max-width: 320px; margin: 0 auto; min-width: 0; white-space: nowrap; overflow: hidden; }
.pt-url-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pt-lock { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); flex: 0 0 auto; }
.pt-demo { font-size: 10px; letter-spacing: 0.14em; color: var(--text-4); }

.pt-grid { display: grid; grid-template-columns: 200px 1fr; }

/* sidebar */
.pt-rail { border-right: 1px solid var(--line); padding: 14px 11px; display: flex; flex-direction: column; gap: 4px; background: rgba(11,14,20,0.35); }
.pt-brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 14px; font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.06em; color: var(--text); }
.pt-brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent); }
.pt-nav { display: flex; flex-direction: column; gap: 2px; }
.pt-navitem { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text-3); font-size: 14px; font-weight: 500; transition: color .2s, background .2s; }
.pt-navitem.active { background: var(--surface-3); color: var(--text); }
.pt-navitem.active .pt-navico { color: var(--accent); }
.pt-navico { display: inline-flex; }
.pt-navlabel { flex: 1; }
.pt-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 700; }
.pt-role { margin-top: auto; padding-top: 14px; display: flex; align-items: center; gap: 8px; font-size: 10px; color: var(--text-4); letter-spacing: 0.06em; }

/* main */
.pt-main { min-width: 0; }
.pt-top { display: flex; align-items: center; justify-content: space-between; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.pt-welcome { font-size: 11px; letter-spacing: 0.14em; color: var(--text-4); }
.pt-name { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -0.01em; margin-top: 2px; }
.pt-topright { display: flex; align-items: center; gap: 10px; }
.pt-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--text-3); }
.pt-bell-dot { position: absolute; top: 6px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.pt-avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-family: var(--font-mono); font-size: 11px; font-weight: 700; }

.pt-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }

/* next action */
.pt-next { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border: 1px solid var(--accent-line); border-radius: 12px; background: radial-gradient(120% 160% at 0% 0%, var(--accent-soft), transparent 55%), var(--surface); }
.pt-next-k { font-size: 10px; letter-spacing: 0.14em; color: var(--text-4); }
.pt-next-t { font-family: var(--font-display); font-weight: 600; font-size: 19px; line-height: 1.2; letter-spacing: -0.01em; margin-top: 6px; max-width: 34ch; }
.pt-next-d { font-size: 14px; color: var(--text-3); margin-top: 6px; }
.pt-btn { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; padding: 10px 14px; border-radius: 9px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 13px; cursor: pointer; box-shadow: 0 8px 26px -10px var(--accent-glow); }

/* stat cards */
.pt-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pt-stat { border: 1px solid var(--line); border-radius: 11px; padding: 12px; background: var(--surface); display: flex; flex-direction: column; }
.pt-stat-top { display: flex; align-items: center; justify-content: space-between; min-height: 26px; }
.pt-stat-ico { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--accent-soft); color: var(--accent); }
.pt-trend { font-size: 10px; }
.pt-stat-k { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-4); margin-top: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-stat-v { font-family: var(--font-display); font-weight: 600; font-size: 25px; line-height: 1.05; margin-top: 4px; letter-spacing: -0.01em; }
.pt-stat-s { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.pt-stat-k { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-prog { height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 10px; }
.pt-prog i { display: block; height: 100%; background: var(--accent); border-radius: 999px; box-shadow: 0 0 10px var(--accent-glow); }

/* docs + activity + assistant — wide 3 columns */
.pt-cols3 { display: grid; grid-template-columns: 1fr 1fr 1.12fr; gap: 12px; align-items: stretch; }
.pt-cols3 > * { min-width: 0; }
.pt-panel { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.pt-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.pt-panel-title { font-family: var(--font-display); font-weight: 600; font-size: 14px; letter-spacing: -0.005em; white-space: nowrap; }
.pt-viewall { font-size: 10px; letter-spacing: 0.08em; color: var(--accent); white-space: nowrap; flex: 0 0 auto; }
.pt-doclist, .pt-actlist { display: flex; flex-direction: column; }
.pt-doc { display: flex; align-items: center; gap: 11px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.pt-doc:last-child { border-bottom: 0; }
.pt-doc-ico { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); flex: 0 0 auto; }
.pt-doc-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pt-doc-name { font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-doc-sub { font-size: 12px; color: var(--text-4); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-doc-dl { color: var(--text-4); font-size: 14px; }

.pt-act { display: flex; gap: 11px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.pt-act:last-child { border-bottom: 0; }
.pt-act-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: 0 0 auto; }
.pt-act-dot.ok { background: var(--ok); box-shadow: 0 0 8px color-mix(in oklch, var(--ok) 60%, transparent); }
.pt-act-dot.warn { background: var(--warn); box-shadow: 0 0 8px color-mix(in oklch, var(--warn) 60%, transparent); }
.pt-act-dot.info { background: var(--info); box-shadow: 0 0 8px color-mix(in oklch, var(--info) 60%, transparent); }
.pt-act-meta { display: flex; flex-direction: column; min-width: 0; }
.pt-act-label { font-size: 14px; font-weight: 500; color: var(--text); }
.pt-act-detail { font-size: 13px; color: var(--text-3); margin-top: 2px; line-height: 1.45; }
.pt-act-time { font-size: 10px; color: var(--text-4); margin-top: 4px; letter-spacing: 0.06em; }

/* AI */
.pt-ai { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: linear-gradient(180deg, var(--surface), rgba(34,211,238,0.025)); }
.pt-ai-head { display: flex; align-items: flex-start; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.pt-ai-ico { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent); flex: 0 0 auto; }
.pt-ai-id { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pt-ai-name { font-size: 14px; font-weight: 600; color: var(--text); }
.pt-ai-sub { font-size: 12px; color: var(--text-4); margin-top: 2px; }
.pt-ai-online { font-size: 10px; }
.pt-ai-chat { display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; padding: 14px; height: 232px; overflow: hidden; }
.pt-bubble { max-width: 86%; padding: 9px 12px; border-radius: 11px; font-size: 13px; line-height: 1.5; animation: bubbleIn .35s var(--ease-out); }
.pt-bubble.user { align-self: flex-end; background: var(--surface-3); border: 1px solid var(--line-2); color: var(--text); border-bottom-right-radius: 3px; }
.pt-bubble.ai { align-self: flex-start; background: var(--accent); color: var(--accent-ink); border-bottom-left-radius: 3px; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.pt-ai-chat.clearing .pt-bubble { animation: bubbleOut .42s var(--ease) forwards; animation-delay: calc(var(--bi, 0) * 70ms); }
@keyframes bubbleOut { to { opacity: 0; transform: translateY(-10px) scale(0.96); filter: blur(2px); } }
.pt-typing { display: inline-flex; gap: 4px; align-items: center; padding: 12px 14px; }
.pt-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-ink); opacity: 0.5; animation: typing 1.1s var(--ease) infinite; }
.pt-typing i:nth-child(2) { animation-delay: .18s; }
.pt-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }
.pt-ai-composer { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); }
.pt-ai-input { flex: 1; font-size: 13px; color: var(--text-4); }
.pt-ai-send { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }

/* ── guided-tour spotlight ──────────────────────────────────────────────── */
.portal [data-spot] { position: relative; transition: opacity .45s var(--ease), filter .45s var(--ease), box-shadow .45s var(--ease), border-color .45s var(--ease); }
/* inactive panels stay readable, just recede; only the active one pops */
.portal.touring [data-spot] { opacity: 0.55; filter: saturate(0.8); }
.portal.touring [data-spot].spot-on {
  opacity: 1; filter: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 1px var(--accent-line), 0 0 0 5px color-mix(in oklch, var(--accent) 10%, transparent), 0 24px 60px -28px var(--accent-glow);
  z-index: 4;
}
.pt-rail[data-spot].spot-on { border-right-color: var(--accent-line); }
@media (prefers-reduced-motion: reduce) {
  .portal.touring [data-spot] { opacity: 1 !important; filter: none !important; }
}

/* responsive */
@media (max-width: 1000px) {
  .pt-cols3 { grid-template-columns: 1fr 1fr; }
  .pt-cols3 .pt-ai { grid-column: span 2; }
}
@media (max-width: 600px) {
  .portal { font-size: 13px; }
  .pt-grid { grid-template-columns: 1fr; }
  .pt-rail { flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; gap: 6px; }
  .pt-brand { padding: 0 8px 0 0; }
  /* the rail is now a horizontal toolbar — the nav must run horizontally too,
     otherwise the icons stack into a tall vertical strip floating mid-row */
  .pt-nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .pt-navitem { padding: 8px; }
  .pt-navlabel { display: none; }
  .pt-role { margin: 0 0 0 auto; padding: 0; }
  .pt-role .mono { display: none; }
  .pt-stats { grid-template-columns: repeat(2, 1fr); }
  .pt-cols3 { grid-template-columns: 1fr; }
  .pt-cols3 .pt-ai { grid-column: span 1; }
  .pt-next { flex-direction: column; align-items: flex-start; }
}
