/* ===========================================================================
   Engineering Portal — styles
   Dark by default (data-theme="light" for the light alternate).
   Coral = version drift · green = in sync. Each metric is a distinct chip.
   =========================================================================== */
:root {
  /* dark (default) */
  --bg:           #090d18;
  --bg-2:         #0d1322;
  --surface:      #131a2c;
  --surface-2:    #18203500;   /* transparent variant base */
  --surface-2s:   #182035;
  --elevated:     #1f2942;
  --border:       #2a3554;
  --border-soft:  #212b46;
  --text:         #e8edf9;
  --muted:        #97a4c4;
  --faint:        #6b789b;

  --brand:        #818cf8;
  --brand-2:      #a78bfa;
  --brand-strong: #6366f1;
  --brand-glow:   rgba(129,140,248,.45);

  --drift-bg:     rgba(244,63,94,.13);
  --drift-bd:     rgba(251,113,133,.55);
  --drift-text:   #fda4af;
  --drift-glow:   rgba(244,63,94,.35);
  --sync-bg:      rgba(16,185,129,.12);
  --sync-bd:      rgba(52,211,153,.5);
  --sync-text:    #6ee7b7;
  --warn-bg:      rgba(245,158,11,.14);
  --warn-bd:      rgba(251,191,36,.5);
  --warn-text:    #fcd34d;
  --err-bg:       rgba(239,68,68,.14);
  --err-bd:       rgba(248,113,113,.5);
  --err-text:     #fca5a5;
  --info-bg:      rgba(96,165,250,.13);
  --info-bd:      rgba(96,165,250,.5);
  --info-text:    #93c5fd;

  /* per-metric accent colours (make each value distinct) */
  --m-tag:         #a78bfa;
  --m-replicas:    #22d3ee;
  --m-created:     #60a5fa;
  --m-mem_limit:   #fbbf24;
  --m-mem_request: #34d399;
  --m-cpu_limit:   #f472b6;
  --m-default:     #8aa0c6;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 30px -12px rgba(0,0,0,.6);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="light"] {
  --bg:           #eef1f7;
  --bg-2:         #e7ebf3;
  --surface:      #ffffff;
  --surface-2s:   #f4f6fb;
  --elevated:     #f8fafc;
  --border:       #dde3ee;
  --border-soft:  #e7ebf3;
  --text:         #0f172a;
  --muted:        #5a6781;
  --faint:        #8693ad;
  --brand:        #4f46e5;
  --brand-2:      #7c3aed;
  --brand-strong: #4338ca;
  --brand-glow:   rgba(79,70,229,.25);
  --drift-bg:     #fff1f2;  --drift-bd: #fecdd3;  --drift-text: #be123c;  --drift-glow: rgba(244,63,94,.18);
  --sync-bg:      #f0fdf4;  --sync-bd:  #bbf7d0;  --sync-text:  #15803d;
  --warn-bg:      #fffbeb;  --warn-bd:  #fde68a;  --warn-text:  #b45309;
  --err-bg:       #fef2f2;  --err-bd:   #fecaca;  --err-text:   #b91c1c;
  --info-bg:      #eff6ff;  --info-bd:  #bfdbfe;  --info-text:  #1d4ed8;
  --m-mem_limit:  #d97706; --m-tag: #7c3aed; --m-created: #2563eb; --m-replicas: #0891b2; --m-mem_request: #059669;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 10px 24px -12px rgba(15,23,42,.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(129,140,248,.10), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(167,139,250,.08), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 2rem; margin: 0 0 .3rem; letter-spacing: -.02em; }
h2 { font-size: 1.35rem; margin: 1.75rem 0 .85rem; letter-spacing: -.01em; }
h3 { font-size: 1.1rem; margin: 1rem 0 .5rem; }
h4 { font-size: 1rem; margin: .25rem 0 .6rem; }
code, .mono { font-family: var(--mono); font-size: .86em; }
::selection { background: var(--brand-glow); }

/* ---- layout ------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 1400px; margin: 0 auto; padding: .9rem 1.75rem; display: flex; align-items: center; gap: 1rem; }
.brand { font-weight: 800; font-size: 1.2rem; display: flex; align-items: center; gap: .6rem; color: var(--text); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--brand-strong), var(--brand-2)); box-shadow: 0 0 18px -2px var(--brand-glow); display: inline-block; }
.brand .logo-img { display: none; height: 34px; max-width: 170px; object-fit: contain; vertical-align: middle; }
.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 1.35rem; }
.topbar nav a { color: var(--muted); font-weight: 600; }
.topbar nav a:hover { color: var(--text); text-decoration: none; }
.topbar nav .who { color: var(--muted); font-size: .9rem; display: flex; align-items: center; gap: .4rem; }
.badge-admin { background: linear-gradient(135deg, var(--brand-strong), var(--brand-2)); color: #fff; font-size: .62rem; padding: .12rem .45rem; border-radius: 6px; text-transform: uppercase; letter-spacing: .05em; font-weight: 800; }

.theme-toggle { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--elevated); color: var(--muted); cursor: pointer; display: grid; place-items: center; font-size: 1.05rem; }
.theme-toggle:hover { color: var(--text); border-color: var(--brand); }

.container { max-width: 1400px; margin: 0 auto; padding: 2rem 1.75rem 1rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin: 0; font-size: 1rem; }
.breadcrumb { color: var(--faint); font-size: .9rem; margin-bottom: .65rem; }
.breadcrumb a { color: var(--muted); }

/* ---- cards / tiles ------------------------------------------------------ */
.grid { display: grid; gap: 1.25rem; }
.tiles { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem 1.6rem; }
.tile { display: flex; flex-direction: column; gap: .65rem; position: relative; overflow: hidden; transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease; }
.tile::after { content: ""; position: absolute; inset: 0; background: radial-gradient(400px 140px at 100% 0%, var(--brand-glow), transparent 70%); opacity: 0; transition: opacity .2s; pointer-events: none; }
.tile:hover { transform: translateY(-3px); border-color: var(--brand); text-decoration: none; box-shadow: 0 18px 40px -16px rgba(0,0,0,.7); }
.tile:hover::after { opacity: .5; }
.tile .icon { width: 52px; height: 52px; border-radius: 13px; background: linear-gradient(135deg, rgba(129,140,248,.22), rgba(167,139,250,.18)); color: var(--brand); display: grid; place-items: center; border: 1px solid var(--border); }
.tile .icon svg { width: 26px; height: 26px; }
.tile h3 { margin: .3rem 0 0; color: var(--text); font-size: 1.18rem; }
.tile p { margin: 0; color: var(--muted); font-size: .95rem; }
.tile.disabled { opacity: .5; pointer-events: none; }

/* ---- forms -------------------------------------------------------------- */
label { font-weight: 600; font-size: .9rem; }
input:not([type]), input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
  width: 100%; padding: .65rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: .95rem; background: var(--bg-2); color: var(--text); font-family: inherit;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.field { margin-bottom: 1rem; }
.help { color: var(--muted); font-size: .85rem; margin-top: .25rem; }

.btn {
  display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; font-family: inherit;
  border: 1px solid var(--border); background: var(--elevated); color: var(--text);
  padding: .65rem 1.05rem; border-radius: var(--radius-sm); font-size: .95rem; font-weight: 650;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { border-color: var(--brand); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--brand-strong), var(--brand-2)); border: none; color: #fff; box-shadow: 0 6px 18px -6px var(--brand-glow); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { background: var(--elevated); color: var(--faint); cursor: not-allowed; box-shadow: none; }
.btn-danger { color: var(--err-text); border-color: var(--err-bd); }
.btn-danger:hover { background: var(--err-bg); }
.btn-sm { padding: .4rem .7rem; font-size: .85rem; }
.btn-row { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }

/* ---- selection (clusters + columns) ------------------------------------ */
.select-group { margin-bottom: 1.4rem; }
.select-group > .legend { font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .6rem; display: flex; align-items: center; gap: .5rem; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .6rem; }
.opt { display: flex; align-items: center; gap: .6rem; min-width: 0; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-2); cursor: pointer; font-weight: 600; font-size: .95rem; transition: border-color .12s, background .12s; }
/* let long labels (e.g. a custom column key) wrap/break instead of spilling out */
.opt > span:not(.swatch):not(.tier) { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.opt:hover { border-color: var(--brand); }
.opt input { width: auto; accent-color: var(--brand-strong); }
.opt.checked { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, var(--bg-2)); box-shadow: 0 0 0 1px var(--brand) inset; }
.opt.locked { opacity: .35; cursor: not-allowed; }
.opt .swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; box-shadow: 0 0 8px -1px currentColor; }
.opt .tier { color: var(--faint); font-size: .76rem; margin-left: auto; text-transform: uppercase; letter-spacing: .04em; }
.product-block { margin-bottom: 1.2rem; }
.product-block > h4 { display: flex; align-items: center; gap: .5rem; font-size: 1rem; color: var(--text); }
.prod-logo { height: 20px; max-width: 96px; object-fit: contain; vertical-align: middle; }

/* ---- summary stat cards ------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin: 1.25rem 0; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; position: relative; overflow: hidden; }
.stat .num { font-size: 2.4rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.stat .lbl { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; margin-top: .35rem; }
.stat.drift .num { color: var(--drift-text); }
.stat.sync  .num { color: var(--sync-text); }
.stat.drift { box-shadow: inset 0 0 0 1px var(--drift-bd); }
.stat.sync  { box-shadow: inset 0 0 0 1px var(--sync-bd); }

/* ---- matrix table ------------------------------------------------------- */
.matrix-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table.matrix { border-collapse: separate; border-spacing: 0; width: 100%; }
table.matrix th, table.matrix td { padding: .85rem .95rem; text-align: left; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
table.matrix thead th { background: var(--bg-2); position: sticky; top: 0; z-index: 2; }
table.matrix th.app-col, table.matrix td.app-col { position: sticky; left: 0; z-index: 1; min-width: 230px; background: var(--surface); }
table.matrix thead th.app-col { z-index: 3; background: var(--bg-2); }

.env-head .env-swatch { height: 7px; border-radius: 4px; margin-bottom: .5rem; box-shadow: 0 0 12px -2px currentColor; }
.env-head .env-colour { font-size: 1.02rem; font-weight: 800; text-transform: capitalize; }
.env-head .env-sub { color: var(--muted); font-weight: 500; font-size: .8rem; margin-top: .15rem; }

tbody tr.matrow:hover td { background: color-mix(in srgb, var(--brand) 6%, transparent); }
tbody tr.is-drift td.app-col { box-shadow: inset 4px 0 0 var(--drift-bd); }
tbody tr.is-sync  td.app-col { box-shadow: inset 4px 0 0 var(--sync-bd); }
tbody tr.is-drift { background: linear-gradient(90deg, var(--drift-bg), transparent 55%); }

.app-cell { display: flex; flex-direction: column; gap: .35rem; }
.app-name { font-size: 1.02rem; font-weight: 750; display: flex; align-items: center; gap: .5rem; word-break: break-word; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot-drift { background: #fb7185; box-shadow: 0 0 9px #fb7185; }
.dot-sync  { background: #34d399; box-shadow: 0 0 9px #34d399; }
.row-flags { display: flex; gap: .35rem; flex-wrap: wrap; }
.flag { font-size: .64rem; font-weight: 800; padding: .12rem .42rem; border-radius: 5px; text-transform: uppercase; letter-spacing: .04em; }
.flag-drift { background: var(--drift-bg); color: var(--drift-text); border: 1px solid var(--drift-bd); }
.flag-partial { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-bd); }
.flag-sync { background: var(--sync-bg); color: var(--sync-text); border: 1px solid var(--sync-bd); }

/* ---- metric chips (the standout cell values) --------------------------- */
.cell-stack { display: flex; flex-direction: column; gap: .5rem; min-width: 190px; }
.chip-row { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip { --accent: var(--m-default); display: inline-flex; flex-direction: column; gap: 1px; padding: .4rem .6rem; border-radius: 9px; background: var(--elevated); border: 1px solid var(--border); border-left: 3px solid var(--accent); }
.chip-label { font-size: .6rem; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); font-weight: 800; display: flex; align-items: center; gap: .25rem; }
.chip-label .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.chip-val { font-size: .92rem; font-weight: 650; color: var(--text); }
.chip.mono .chip-val { font-family: var(--mono); font-size: .82rem; word-break: break-all; }

.chip-primary { border-left-width: 4px; padding: .55rem .75rem; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, var(--elevated)), var(--elevated)); }
.chip-primary .chip-val { font-size: .9rem; line-height: 1.3; }

/* per-metric accent */
.m-tag { --accent: var(--m-tag); }
.m-replicas { --accent: var(--m-replicas); }
.m-created { --accent: var(--m-created); }
.m-mem_limit { --accent: var(--m-mem_limit); }
.m-mem_request { --accent: var(--m-mem_request); }
.m-cpu_limit { --accent: var(--m-cpu_limit); }

/* drift / match state on a chip (overrides accent) */
.chip.is-drift { background: var(--drift-bg); border-color: var(--drift-bd); border-left-color: var(--drift-bd); box-shadow: 0 0 16px -4px var(--drift-glow); }
.chip.is-drift .chip-val { color: var(--drift-text); }
.chip.is-drift .chip-label { color: var(--drift-text); opacity: .85; }
.chip.is-drift .chip-label .dot { background: var(--drift-text); }
.chip.is-match.flagged-row { opacity: .92; }

.cell-missing { color: var(--faint); font-style: italic; font-size: .9rem; padding: .35rem 0; }
.cell-error { color: var(--err-text); font-style: italic; }

/* hide in-sync rows when "difference only" active */
#matrix.diff-only tbody tr.is-sync { display: none; }

/* ---- alerts / legend ---------------------------------------------------- */
.alert { border: 1px solid; border-radius: var(--radius-sm); padding: .85rem 1.05rem; margin: .85rem 0; font-size: .95rem; }
.alert-error { background: var(--err-bg); border-color: var(--err-bd); color: var(--err-text); }
.alert-warn  { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-text); }
.alert-info  { background: var(--info-bg); border-color: var(--info-bd); color: var(--info-text); }
.alert-ok    { background: var(--sync-bg); border-color: var(--sync-bd); color: var(--sync-text); }
.alert ul { margin: .4rem 0 0; padding-left: 1.2rem; }

.legend { display: flex; gap: 1.25rem; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: .88rem; margin: .6rem 0; }
.legend .key { display: inline-flex; align-items: center; gap: .4rem; }
.legend .box { width: 16px; height: 16px; border-radius: 5px; border: 1px solid; }
.legend .box.sync  { background: var(--sync-bg); border-color: var(--sync-bd); }
.legend .box.drift { background: var(--drift-bg); border-color: var(--drift-bd); }

/* ---- toolbar / toggle switch ------------------------------------------- */
.toolbar { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: .55rem; cursor: pointer; font-weight: 650; font-size: .9rem; color: var(--muted); user-select: none; }
.switch .track { width: 42px; height: 24px; border-radius: 999px; background: var(--elevated); border: 1px solid var(--border); position: relative; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--faint); transition: transform .15s, background .15s; }
.switch[aria-pressed="true"] .track { background: var(--brand-strong); border-color: var(--brand-strong); }
.switch[aria-pressed="true"] .track::after { transform: translateX(18px); background: #fff; }
.switch[aria-pressed="true"] { color: var(--text); }

/* ---- generic data tables (admin) --------------------------------------- */
table.data { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table.data th, table.data td { padding: .75rem .95rem; border-bottom: 1px solid var(--border-soft); text-align: left; font-size: .92rem; }
table.data thead th { background: var(--bg-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
table.data tr:last-child td { border-bottom: none; }
.pill { font-size: .72rem; font-weight: 800; padding: .15rem .5rem; border-radius: 999px; }
.pill.on  { background: var(--sync-bg); color: var(--sync-text); border: 1px solid var(--sync-bd); }
.pill.off { background: var(--elevated); color: var(--muted); border: 1px solid var(--border); }
.pill.role-admin { background: rgba(167,139,250,.18); color: var(--brand-2); border: 1px solid rgba(167,139,250,.4); }
.pill.role-user  { background: var(--info-bg); color: var(--info-text); border: 1px solid var(--info-bd); }

/* ---- login -------------------------------------------------------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(129,140,248,.18), transparent 60%),
    radial-gradient(700px 500px at 10% 110%, rgba(167,139,250,.14), transparent 55%),
    var(--bg); }
.login-card { width: 400px; max-width: 94vw; }
.login-card .brand { justify-content: center; margin-bottom: 1.2rem; font-size: 1.35rem; }
.demo-creds { margin-top: 1.2rem; font-size: .82rem; color: var(--muted); background: var(--bg-2); border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: .65rem .8rem; }

.admin-nav { display: flex; gap: .55rem; flex-wrap: wrap; margin: .85rem 0 1.4rem; }
.admin-nav a { padding: .5rem .95rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-weight: 650; font-size: .85rem; color: var(--muted); }
.admin-nav a.active, .admin-nav a:hover { background: linear-gradient(135deg, var(--brand-strong), var(--brand-2)); color: #fff; border-color: transparent; text-decoration: none; }

.inline-form { display: inline; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.flex { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
footer.app-foot { text-align: center; color: var(--faint); font-size: .82rem; padding: 2.5rem 0 1.5rem; line-height: 1.8; }
footer.app-foot code { color: var(--muted); }

/* ======================================================================== */
/* Live pod status + memory  (opt-in popup on the compare matrix)           */
/* ======================================================================== */
/* per-cell trigger button */
.pod-btn { margin-top: .5rem; display: inline-flex; align-items: center; gap: .4rem;
  font: inherit; font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  color: var(--muted); background: var(--surface-2s); border: 1px solid var(--border);
  border-radius: 999px; padding: .22rem .6rem; cursor: pointer; transition: all .14s; }
.pod-btn:hover { color: var(--text); border-color: var(--brand); background: var(--elevated); box-shadow: 0 0 0 3px var(--brand-glow); }
.pod-btn-pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--sync-bd);
  box-shadow: 0 0 0 0 var(--sync-bd); animation: podpulse 2.2s infinite; }
@keyframes podpulse { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.5);} 70% { box-shadow: 0 0 0 6px rgba(52,211,153,0);} 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0);} }

/* modal shell */
body.modal-open { overflow: hidden; }
.pod-modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1.2rem; }
.pod-modal[hidden] { display: none; }
.pod-backdrop { position: absolute; inset: 0; background: rgba(4,7,14,.66); backdrop-filter: blur(3px); }
.pod-dialog { position: relative; width: min(620px, 100%); max-height: 88vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }

.pod-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1rem 1.15rem .75rem; border-bottom: 1px solid var(--border-soft); }
.pod-title { font-size: 1.1rem; font-weight: 750; color: var(--text); }
.pod-sub { font-size: .82rem; color: var(--muted); margin-top: .1rem; }
.pod-head-r { display: flex; align-items: center; gap: .7rem; flex-shrink: 0; }
.pod-conn { display: inline-flex; align-items: center; gap: .4rem; font-size: .76rem; font-weight: 700; color: var(--muted); }
.pod-conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.pod-conn[data-state="live"] .pod-conn-dot { background: var(--sync-bd); box-shadow: 0 0 0 3px rgba(52,211,153,.18); animation: podpulse 2s infinite; }
.pod-conn[data-state="connecting"] .pod-conn-dot { background: var(--warn-bd); }
.pod-conn[data-state="paused"] .pod-conn-dot { background: var(--faint); }
.pod-conn[data-state="error"] .pod-conn-dot { background: var(--err-bd); }

.pod-metabar { display: flex; align-items: center; gap: .6rem; padding: .5rem 1.15rem; font-size: .76rem; color: var(--muted); background: var(--bg-2); border-bottom: 1px solid var(--border-soft); }
.pod-body { padding: .9rem 1.15rem; overflow-y: auto; display: flex; flex-direction: column; gap: .7rem; }
.pod-count { font-size: .76rem; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }
.pod-empty { padding: 1.6rem .4rem; text-align: center; color: var(--muted); }
.pod-empty.err { color: var(--err-text); }

/* a single pod */
.pod-card { border: 1px solid var(--border); border-left: 3px solid var(--sync-bd); border-radius: var(--radius-sm);
  padding: .7rem .8rem; background: var(--elevated); }
.pod-card.lvl-warn { border-left-color: var(--warn-bd); }
.pod-card.lvl-crit { border-left-color: var(--drift-bd); }
.pod-card-head { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.pod-status { display: inline-flex; align-items: center; gap: .32rem; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; padding: .12rem .45rem; border-radius: 6px; }
.pod-status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pod-status-ok { color: var(--sync-text); background: var(--sync-bg); }
.pod-status-warn { color: var(--warn-text); background: var(--warn-bg); }
.pod-status-crit { color: var(--err-text); background: var(--err-bg); }
.pod-name { font-size: .82rem; color: var(--text); }
.pod-tags { margin-left: auto; display: inline-flex; gap: .35rem; }
.pod-tag { font-size: .7rem; color: var(--muted); background: var(--surface-2s); border: 1px solid var(--border-soft); border-radius: 6px; padding: .1rem .4rem; }
.pod-tag.is-warn { color: var(--warn-text); border-color: var(--warn-bd); }

.pod-barwrap { display: flex; align-items: flex-end; gap: .6rem; margin: .55rem 0 .35rem; }
.pod-bar-col { position: relative; flex: 1; padding-top: 15px; }
.pod-bar { position: relative; width: 100%; height: 16px; border-radius: 5px; background: var(--surface-2s); border: 1px solid var(--border); overflow: hidden; }
/* "limit NNN" caption pinned above the red cap at the right end of the track */
.pod-limit-tag { position: absolute; top: 0; right: -1px; font-size: .6rem; font-weight: 800;
  letter-spacing: .03em; text-transform: uppercase; color: var(--drift-text); white-space: nowrap; line-height: 1; }
.pod-limit-tag::after { content: "▾"; position: absolute; right: 1px; top: 9px; font-size: .68rem; }
.pod-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px 0 0 5px; transition: width .8s cubic-bezier(.4,0,.2,1); }
.pod-fill.lvl-ok { background: linear-gradient(90deg,#0ea5e9,#22d3ee); }
.pod-fill.lvl-warn { background: linear-gradient(90deg,#f59e0b,#fbbf24); }
.pod-fill.lvl-crit { background: linear-gradient(90deg,#ef4444,#f43f5e); animation: barflash 1.1s ease-in-out infinite; }
@keyframes barflash { 50% { opacity: .62; } }
/* red limit cap at the right end of the track */
.pod-limit { position: absolute; right: 0; top: -1px; bottom: -1px; width: 3px; background: var(--drift-text); box-shadow: 0 0 6px var(--drift-glow); }
/* faint request marker */
.pod-req { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--faint); opacity: .8; }
.pod-spark { width: 116px; height: 26px; flex-shrink: 0; color: var(--m-replicas); }
.pod-spark.lvl-warn { color: var(--warn-text); }
.pod-spark.lvl-crit { color: var(--drift-text); }
.pod-spark .spark { width: 100%; height: 100%; display: block; }
.pod-spark .spark circle { fill: currentColor; }

.pod-memline { display: flex; align-items: baseline; gap: .5rem; font-size: .82rem; color: var(--text); font-family: var(--mono); }
.pod-pct { font-weight: 800; }
.pod-pct.lvl-warn { color: var(--warn-text); }
.pod-pct.lvl-crit { color: var(--drift-text); }
.pod-node { margin-left: auto; font-size: .7rem; }

.pod-paused { padding: 1rem 1.15rem; border-top: 1px solid var(--border-soft); background: var(--bg-2); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.pod-paused p { margin: 0; color: var(--muted); font-size: .85rem; }
.pod-foot { padding: .6rem 1.15rem .8rem; font-size: .72rem; border-top: 1px solid var(--border-soft); }

/* info ("i") button + help panel */
.pod-info-btn { width: 22px; height: 22px; flex-shrink: 0; border-radius: 50%; cursor: pointer;
  font: 800 .8rem var(--sans); font-style: italic; color: var(--muted);
  background: var(--surface-2s); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; transition: all .14s; }
.pod-info-btn:hover, .pod-info-btn.is-on { color: #fff; background: var(--brand-strong); border-color: var(--brand-strong); }
.pod-help { padding: .85rem 1.15rem; background: var(--bg-2); border-bottom: 1px solid var(--border-soft); font-size: .82rem; color: var(--muted); }
.pod-help[hidden] { display: none; }
.pod-help h4 { margin: 0 0 .5rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.pod-help ul { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: .45rem; }
.pod-help li { line-height: 1.45; }
.pod-help strong { color: var(--text); font-weight: 700; }
.pod-help .lvl-crit-txt { color: var(--drift-text); }
.pod-help .lvl-warn-txt { color: var(--warn-text); }
.pod-help-key { display: inline-flex; align-items: center; gap: .3rem; font-weight: 700; color: var(--text); margin-right: .25rem; }
.pod-help-bar { display: inline-block; width: 34px; height: 10px; border-radius: 3px; background: var(--surface-2s); border: 1px solid var(--border); position: relative; overflow: hidden; }
.pod-help-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 55%; background: linear-gradient(90deg,#0ea5e9,#22d3ee); }
.pod-help-cap { display: inline-block; width: 3px; height: 12px; background: var(--drift-text); box-shadow: 0 0 5px var(--drift-glow); border-radius: 1px; }
.pod-help-req { display: inline-block; width: 0; height: 12px; border-left: 1px dashed var(--faint); }

/* "compare with other clusters" bar in the single popup */
.pod-compare-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .7rem 1.15rem; border-top: 1px solid var(--border-soft); background: var(--bg-2); }
.pod-compare-label { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.pod-compare-envs { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; flex: 1; min-width: 0; }
.pod-env-pick { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; font-weight: 600; color: var(--text); background: var(--surface-2s); border: 1px solid var(--border); border-radius: 999px; padding: .2rem .55rem; cursor: pointer; }
.pod-env-pick input { accent-color: var(--brand-strong); }
.pod-env-pick:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.pod-env-pick input:disabled { opacity: .4; }
.pod-env-pick .swatch { width: 11px; height: 11px; border-radius: 3px; box-shadow: 0 0 7px -1px currentColor; }
.pod-pick-tier { color: var(--faint); font-size: .68rem; text-transform: uppercase; letter-spacing: .03em; margin-left: .15rem; }
.pod-compare-go { flex-shrink: 0; }
.pod-compare-go:disabled { opacity: .45; cursor: not-allowed; }

/* side-by-side grid */
.pod-grid-dialog { position: relative; width: min(1080px, 100%); max-height: 92vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.pod-gidle { font-size: .72rem; color: var(--muted); margin-right: .2rem; }
.pod-grid-body { display: grid; gap: .7rem; padding: .9rem 1.15rem; overflow: auto; }
.pod-grid-body[data-n="1"] { grid-template-columns: 1fr; }
.pod-grid-body[data-n="2"] { grid-template-columns: 1fr 1fr; }
.pod-grid-body[data-n="3"] { grid-template-columns: 1fr 1fr; }
.pod-grid-body[data-n="3"] .pod-panel:nth-child(3) { grid-column: 1 / -1; }   /* two on top, one wide below */
.pod-grid-body[data-n="4"] { grid-template-columns: 1fr 1fr; }                /* 2 × 2 */
.pod-panel { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-2); overflow: hidden; }
.pod-panel-head { display: flex; align-items: center; gap: .5rem; padding: .5rem .7rem; border-bottom: 1px solid var(--border-soft); background: var(--surface); }
.pod-panel-head .swatch { width: 13px; height: 13px; border-radius: 4px; flex: none; box-shadow: 0 0 8px -1px currentColor; }
.pod-panel-env { font-weight: 700; font-size: .9rem; color: var(--text); }
.pod-panel-head .pod-conn { margin-left: auto; }
.pod-panel-body { padding: .6rem .7rem; display: flex; flex-direction: column; gap: .55rem; overflow-y: auto; max-height: 48vh; }

@media (max-width: 720px) {
  .pod-grid-body[data-n] { grid-template-columns: 1fr; }
  .pod-grid-body[data-n="3"] .pod-panel:nth-child(3) { grid-column: auto; }
}

/* =========================================================================
   appv5 — shared components: ⓘ info button + popover, simple forms/boards
   ========================================================================= */
.info-wrap { position: relative; display: inline-flex; vertical-align: middle; }
.ibtn {
  width: 16px; height: 16px; line-height: 15px; padding: 0; margin-left: .35rem;
  border-radius: 50%; border: 1px solid var(--info-bd); background: var(--info-bg);
  color: var(--info-text); font: 700 11px/15px Georgia, "Times New Roman", serif;
  font-style: italic; cursor: pointer; flex: none; text-align: center; user-select: none;
}
.ibtn:hover { filter: brightness(1.2); }
.ipop {
  position: absolute; z-index: 60; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 280px; padding: .6rem .75rem;
  background: var(--elevated); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: .82rem; line-height: 1.45; font-weight: 400;
  box-shadow: 0 12px 32px -8px rgba(0,0,0,.6); display: none; text-align: left; white-space: normal;
}
.ipop strong { color: var(--brand); }
.info-wrap.open .ipop { display: block; }
.ipop::before {
  content: ""; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-bottom-color: var(--border);
}

/* selection forms reused by pods / checkpoints */
.pick-form { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.pick-form .field { display: flex; flex-direction: column; gap: .35rem; min-width: 180px; }
.pick-form label { font-size: .82rem; color: var(--muted); font-weight: 600; }
.env-checks { display: flex; flex-wrap: wrap; gap: .5rem; }
.env-checks label {
  display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .6rem;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2s);
  cursor: pointer; font-weight: 500; color: var(--text);
}
.env-checks input { accent-color: var(--brand-strong); }

/* generic board / record cards (availability, checkpoints, suggestions) */
.board { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.rec-card { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); padding: .9rem 1rem; }
.rec-card.blocked { border-color: var(--warn-bd); background: var(--warn-bg); }
.rec-card h4 { margin: 0 0 .3rem; display: flex; align-items: center; gap: .5rem; }
.rec-meta { font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin-top: .4rem; }
.rec-meta b { color: var(--text); font-weight: 600; }
.pill { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 700; border: 1px solid var(--border); }
.pill.ok { background: var(--sync-bg); border-color: var(--sync-bd); color: var(--sync-text); }
.pill.warn { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-text); }
.empty-state { text-align: center; color: var(--muted); padding: 2.5rem 1rem; border: 1px dashed var(--border); border-radius: var(--radius); }

/* WIP / confirm modal (suggest-feature + checkpoint save) */
.wip-emoji { font-size: 2.4rem; display: block; margin-bottom: .5rem; }
.radio-row { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; cursor: pointer; }
.radio-row input { accent-color: var(--brand-strong); }

/* =========================================================================
   appv5 — UI polish pass (user feedback 2026-06-14)
   ========================================================================= */
/* author rules beat the UA [hidden] rule, so make hidden actually hidden
   (fixes the Pods picker showing every product's clusters) */
[hidden] { display: none !important; }

/* --- home tiles: per-tile accent + lift -------------------------------- */
.tiles { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.15rem; }
.card.tile { padding: 1.5rem 1.6rem 1.55rem; border-radius: 18px; }
.tile .icon { width: 56px; height: 56px; border-radius: 15px; box-shadow: 0 8px 22px -10px var(--tile-accent, var(--brand-glow)); }
.tile h3 { font-size: 1.24rem; letter-spacing: -.01em; }
.tile p { font-size: .92rem; line-height: 1.5; }
.tile::before { content: ""; position: absolute; left: 0; top: 0; height: 100%; width: 4px;
  background: var(--tile-accent, var(--brand)); opacity: .0; transition: opacity .18s; }
.tile:hover::before { opacity: .9; }
/* accent palette keyed by icon */
.tile[data-icon="compare"]   { --tile-accent: #818cf8; }
.tile[data-icon="pulse"]     { --tile-accent: #22d3ee; }
.tile[data-icon="snapshot"]  { --tile-accent: #34d399; }
.tile[data-icon="calendar"]  { --tile-accent: #fbbf24; }
.tile[data-icon="bulb"]      { --tile-accent: #f472b6; }
.tile[data-icon="gear"]      { --tile-accent: #94a3b8; }
.tile[data-icon] .icon { color: var(--tile-accent, var(--brand));
  background: linear-gradient(135deg, color-mix(in srgb, var(--tile-accent) 26%, transparent),
                                      color-mix(in srgb, var(--tile-accent) 12%, transparent)); }

/* --- record/availability cards: rectangular + enhanced type ------------- */
.board { gap: 1rem; }
.rec-card { padding: 1.1rem 1.3rem; border-radius: 14px; }
.rec-card h4 { font-size: 1.12rem; letter-spacing: -.01em; gap: .55rem; }
.rec-card p { line-height: 1.5; }
.rec-meta { font-size: .84rem; gap: .35rem 1.1rem; margin-top: .55rem; }
/* availability: fewer, wider rectangles */
.board.board-wide { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.board.board-wide .rec-card { padding: 1.3rem 1.5rem; }
.board.board-wide .rec-card h4 { font-size: 1.22rem; }
.board.board-wide .rec-card p { font-size: 1rem; }

/* --- suggest form: bigger, friendlier ---------------------------------- */
.form-card-lg { padding: 1.8rem 2rem; border-radius: 18px; }
.form-card-lg .field label { font-size: .98rem; }
.form-card-lg input:not([type]), .form-card-lg input[type=text], .form-card-lg textarea, .form-card-lg select { font-size: 1rem; }

/* --- service multi-picker (checkpoint block form) ---------------------- */
.svc-picker { display: flex; gap: .5rem; }
.svc-picker select { flex: 1 1 auto; }
.svc-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.svc-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .55rem;
  border-radius: 999px; background: var(--info-bg); border: 1px solid var(--info-bd); color: var(--info-text);
  font-size: .82rem; }
.svc-chip button { background: none; border: none; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0; }

/* larger checkpoint save modal */
.pod-dialog.modal-lg { max-width: 640px; }
