/* NeoAI Platform Portal -- the Platform Plane UI (platform.neosolenergy.com).
   Same product family as the Customer Portal (apps/customer-portal): the same tokens, card, tile, table,
   badge and state vocabulary, copied (never imported -- the apps do not share runtime code across planes).
   A separate stylesheet, not an inline <style>, so the Content-Security-Policy needs no 'unsafe-inline'
   (security policy S16/S18; docs/platform-portal/security-policy.md). */

:root {
  color-scheme: light;
  --accent: #0e7a82;
  --accent-soft: #0e7a8214;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e2e5e9;
  --text: #1a2229;
  --text-muted: #5c6773;
  --ok: #1f7a3d;
  --warn: #8a6116;
  --warn-strong: #a6650a;
  --bad: #b23b3b;
  --plane: #3d4f9f;          /* the Platform Plane marker -- distinct from the customer product's accent */
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
}
button { font: inherit; padding: .45rem .9rem; border: 1px solid var(--border); background: var(--surface);
  border-radius: 6px; cursor: pointer; color: var(--text); }
button:hover { border-color: var(--accent); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; }
h2 { margin: 0 0 .3rem; font-size: 1.35rem; }
h3 { margin: 1.6rem 0 .6rem; font-size: 1.05rem; }
.note { color: var(--text-muted); font-size: .9em; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .88em; }

/* ── header ─────────────────────────────────────────────────────────────────────────────────── */
.pp-header { display: flex; align-items: center; gap: 1rem; padding: .8rem 1.25rem; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 2; }
.pp-title { font-weight: 700; font-size: 1.1rem; color: var(--accent); display: flex; align-items: center; gap: .55rem; }
.pp-plane { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--plane);
  border: 1px solid color-mix(in srgb, var(--plane) 40%, transparent); border-radius: 999px; padding: .1rem .5rem; }
.pp-spacer { flex: 1; }
.pp-user { color: var(--text-muted); font-size: .85em; text-align: right; line-height: 1.3; }
.pp-user strong { color: var(--text); font-weight: 600; }
.pp-menu-btn { display: none; }

/* ── layout ─────────────────────────────────────────────────────────────────────────────────── */
.pp-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: calc(100vh - 57px); }
.pp-nav { background: var(--surface); border-right: 1px solid var(--border); padding: 1rem .6rem 2rem; overflow-y: auto; }
.pp-nav-group { margin-bottom: 1rem; }
.pp-nav-group-label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); padding: 0 .6rem .3rem; }
.pp-nav-link { display: flex; align-items: center; justify-content: space-between; gap: .4rem; width: 100%;
  text-align: left; border: none; background: none; border-radius: 6px; padding: .4rem .6rem; color: var(--text);
  text-decoration: none; font-size: .92em; }
.pp-nav-link:hover { background: var(--accent-soft); }
.pp-nav-link--active, .pp-nav-link--active:hover { background: var(--accent); color: #fff; }
.pp-nav-link--active .pp-nav-hint { color: #ffffffcc; border-color: #ffffff66; }
.pp-nav-hint { font-size: .68rem; color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px;
  padding: 0 .4rem; white-space: nowrap; }
.pp-main { padding: 1.5rem 1.75rem 3rem; max-width: 1240px; width: 100%; }
.pp-page-head { margin-bottom: 1.1rem; }
.pp-page-head .note { margin: .2rem 0 0; }

/* ── cards, tiles, panels ───────────────────────────────────────────────────────────────────── */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid--wide { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.2rem; }
.card h3 { margin: 0 0 .5rem; font-size: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .5rem; }
.card-head h3 { margin: 0; }
.tile-label { color: var(--text-muted); font-size: .82em; }
.tile-value { font-size: 1.6rem; font-weight: 700; color: var(--accent); margin-top: .1rem; }
.tile-sub { color: var(--text-muted); font-size: .8em; margin-top: .15rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .9rem; font-size: .92em; margin: 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ── badges ─────────────────────────────────────────────────────────────────────────────────── */
.badge { display: inline-block; font-size: .74em; font-weight: 600; padding: .08rem .55rem; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-muted); background: var(--surface); white-space: nowrap; }
.badge--ok { color: var(--ok); border-color: #1f7a3d55; background: #1f7a3d0d; }
.badge--warn { color: var(--warn); border-color: #b8860b55; background: #b8860b12; }
.badge--bad { color: var(--bad); border-color: #b23b3b55; background: #b23b3b0d; }
.badge--info { color: var(--plane); border-color: #3d4f9f44; background: #3d4f9f0d; }
.badge-row { display: flex; flex-wrap: wrap; gap: .35rem; }

/* ── tables ─────────────────────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--border); font-size: .9em; vertical-align: top; }
th { color: var(--text-muted); font-weight: 600; white-space: nowrap; background: #fafbfc; }
tr:last-child td { border-bottom: none; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: .8rem 0; }
.toolbar input, .toolbar select { font: inherit; padding: .4rem .55rem; border: 1px solid var(--border);
  border-radius: 6px; background: var(--surface); }

/* ── states: loading, empty, API required, not included, forbidden, error ───────────────────── */
@keyframes pulse { 0%, 100% { opacity: .45; } 50% { opacity: .85; } }
.skeleton { display: block; height: .85em; border-radius: 4px; background: var(--border); animation: pulse 1.4s ease-in-out infinite; margin: .45rem 0; }
.skeleton--short { width: 45%; }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; opacity: .6; } }
.state { border-radius: 10px; padding: .9rem 1.1rem; border: 1px solid var(--border); background: var(--surface); }
.state + .state { margin-top: .8rem; }
.state-title { font-weight: 600; margin: 0 0 .25rem; display: flex; align-items: center; gap: .5rem; }
.state p { margin: .25rem 0; }
.state--empty { color: var(--text-muted); }
.state--api { border-style: dashed; border-color: #3d4f9f55; background: #3d4f9f08; }
.state--notincluded, .state--forbidden { border-color: #b8860b55; background: #b8860b0d; }
.state--notincluded .state-title, .state--forbidden .state-title { color: var(--warn); }
.state--error { border-color: #b23b3b55; background: #b23b3b0d; }
.state--error .state-title { color: var(--bad); }
.state--network { background: #6b6b6b0d; }
.dependency-list { margin: .4rem 0 0; padding-left: 1.1rem; font-size: .9em; }
.state--compact { padding: .7rem .9rem; font-size: .92em; }
.state--compact .state-title { font-size: .95em; }

/* ── access screens (sign-in, not a principal, suspended) ───────────────────────────────────── */
.access-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.access-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 2rem 1.8rem; }
.access-card h1 { margin: 0 0 .2rem; color: var(--accent); font-size: 1.5rem; }
.access-card .pp-plane { display: inline-block; margin-bottom: 1rem; }
.access-card p { color: var(--text-muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; padding: .6rem 1rem; width: 100%; }
.btn-primary:hover { opacity: .92; }

/* ── responsive: the nav collapses behind a menu button at phone/tablet width ───────────────── */
@media (max-width: 860px) {
  .pp-layout { grid-template-columns: 1fr; }
  .pp-nav { display: none; border-right: none; border-bottom: 1px solid var(--border); }
  .pp-nav--open { display: block; }
  .pp-menu-btn { display: inline-block; }
  .pp-main { padding: 1rem; }
  .pp-user { display: none; }
}
