/* ============================================================================
   Prism — design system. Premium analytics look, light theme, spectrum accent.
   System fonts only (CSP blocks external fonts). Inline style attributes are
   permitted; inline <script>/onclick are not.
   ========================================================================== */
:root {
  --ink: #131a2b;
  --ink-2: #3a4356;
  --muted: #6b7688;
  --faint: #99a2b3;
  --line: #e7ebf3;
  --line-2: #eef1f7;
  --bg: #eef2f9;
  --bg-2: #f6f8fc;
  --card: #ffffff;

  --brand: #4b63e6;
  --brand-2: #7b53e0;
  --brand-ink: #3a2f8f;
  --accent: #4b63e6;

  --good: #17a05a;
  --good-bg: #e7f7ee;
  --bad: #dc3a45;
  --bad-bg: #fdeced;
  --warn: #c9821a;
  --warn-bg: #fdf3e2;
  --info: #2f6bd6;
  --info-bg: #eaf1fd;

  /* the refraction spectrum — used for accents, active bars, the header sheen */
  --spectrum: linear-gradient(90deg,#ff5d5d 0%,#ff9f1c 20%,#ffd60a 38%,#28c76f 58%,#3aa0ff 78%,#8b5cf6 100%);
  --brand-grad: linear-gradient(135deg,#4b63e6 0%,#7b53e0 100%);
  --header-grad: linear-gradient(115deg,#12182a 0%,#1d2748 48%,#2f2a5e 100%);

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(20,30,60,.06), 0 1px 3px rgba(20,30,60,.05);
  --shadow: 0 6px 22px -8px rgba(30,40,80,.18), 0 2px 6px -2px rgba(30,40,80,.08);
  --shadow-lg: 0 18px 48px -16px rgba(30,40,80,.30);
  --ease: cubic-bezier(.4,0,.2,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(1200px 480px at 88% -8%, rgba(123,83,224,.12), transparent 60%),
    radial-gradient(900px 420px at 6% -6%, rgba(75,99,230,.10), transparent 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  background-attachment: fixed;
  min-height: 100vh;
}
a { color: var(--brand); text-decoration: none; cursor: pointer; }
::selection { background: rgba(123,83,224,.18); }

/* slim custom scrollbars */
* { scrollbar-width: thin; scrollbar-color: #c4ccda transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #ccd4e1; border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #b3bdcd; background-clip: content-box; }

/* ---------------------------------------------------------------- header --- */
.pz-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .6rem 1.5rem;
  background: var(--header-grad);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 10px 30px -12px rgba(10,14,30,.55);
}
.pz-header::after {
  /* spectrum sheen along the bottom edge */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--spectrum); opacity: .9;
  background-size: 200% 100%;
  animation: sheen 9s linear infinite;
}
@keyframes sheen { to { background-position: 200% 0; } }
.pz-brand { display: flex; align-items: center; }
.pz-brand img { height: 34px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }
.pz-nav { display: flex; gap: .15rem; margin-left: .25rem; }
.pz-nav a {
  position: relative; color: #c3cbe0; padding: .5rem .85rem; border-radius: 9px;
  font-weight: 600; font-size: .88rem; letter-spacing: .1px; transition: all .18s var(--ease);
}
.pz-nav a:hover { background: rgba(255,255,255,.09); color: #fff; }
.pz-nav a.active { color: #fff; background: rgba(255,255,255,.13); }
.pz-nav a.active::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 3px; height: 2px;
  border-radius: 2px; background: var(--spectrum);
}
.pz-right { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.pz-status { display: flex; gap: .4rem; }
.pill {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .66rem; font-weight: 700; letter-spacing: .4px; padding: .28rem .6rem;
  border-radius: 999px; background: rgba(255,255,255,.08); color: #aeb7cd; text-transform: uppercase;
  border: 1px solid rgba(255,255,255,.08);
}
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #8b93a8; }
.pill.ok { color: #8ef0b6; border-color: rgba(40,199,111,.35); background: rgba(40,199,111,.12); }
.pill.ok::before { background: #34e089; box-shadow: 0 0 8px rgba(52,224,137,.8); }
.pill.down { color: #ffb0b0; border-color: rgba(220,58,69,.4); background: rgba(220,58,69,.14); }
.pill.down::before { background: #ff6b6b; box-shadow: 0 0 8px rgba(255,107,107,.8); }
.pill.sync::before { background: #ffcf5a; box-shadow: 0 0 8px rgba(255,207,90,.8); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.pz-who { font-size: .8rem; color: #b9c1d6; font-weight: 500; }
.pz-back {
  background: rgba(255,255,255,.1); color: #fff; padding: .45rem .85rem; border-radius: 9px;
  font-weight: 600; font-size: .82rem; white-space: nowrap; border: 1px solid rgba(255,255,255,.12);
  transition: all .18s var(--ease);
}
.pz-back:hover { background: rgba(255,255,255,.2); color: #fff; transform: translateY(-1px); }

/* ---------------------------------------------------------------- layout --- */
.pz-main { max-width: 1300px; margin: 0 auto; padding: 1.6rem 1.5rem 3rem; animation: fade .3s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.pz-loading { color: var(--muted); padding: 4rem; text-align: center; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1.3rem 1.35rem; margin-bottom: 1.15rem;
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.card:hover { box-shadow: var(--shadow); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
h2 { margin: 0 0 .35rem; font-size: 1.12rem; font-weight: 700; letter-spacing: -.01em; }
h3 { margin: 0 0 .6rem; font-size: .95rem; font-weight: 700; }
h2.accent, .section-title {
  display: flex; align-items: center; gap: .6rem;
}
h2.accent::before {
  content: ''; width: 4px; height: 1.05em; border-radius: 3px; background: var(--brand-grad);
}
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.row { display: flex; gap: .85rem; flex-wrap: wrap; align-items: flex-end; }
.grow { flex: 1 1 auto; }
.split { display: grid; grid-template-columns: 380px 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 940px) { .split { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- controls - */
label { display: block; font-size: .72rem; font-weight: 700; color: var(--muted); margin: 0 0 .3rem; text-transform: uppercase; letter-spacing: .5px; }
input, select, textarea {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; background: #fbfcfe; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(75,99,230,.15); }
.field { margin-bottom: .8rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 0; cursor: pointer;
  background: var(--brand-grad); color: #fff; font-weight: 600; font-size: .87rem; font-family: inherit;
  padding: .58rem 1.05rem; border-radius: var(--radius-sm);
  box-shadow: 0 4px 14px -4px rgba(75,99,230,.55), inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), filter .15s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); box-shadow: 0 8px 20px -6px rgba(75,99,230,.6), inset 0 1px 0 rgba(255,255,255,.2); }
.btn:active { transform: translateY(0); }
.btn.secondary { background: #eef1f8; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.btn.secondary:hover { background: #e5eaf4; filter: none; }
.btn.ghost { background: transparent; color: var(--brand); box-shadow: none; padding: .5rem .6rem; }
.btn.ghost:hover { background: rgba(75,99,230,.08); transform: none; }
.btn.small { padding: .4rem .7rem; font-size: .8rem; border-radius: 8px; }
.btn.danger { background: linear-gradient(135deg,#e2555f,#c9323d); box-shadow: 0 4px 14px -4px rgba(201,50,61,.5); }
.btn:disabled { opacity: .5; cursor: default; transform: none; filter: none; }
.btn-group { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- lists ---- */
.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .7rem; gap: .6rem; }
.count-badge { font-size: .7rem; font-weight: 700; color: var(--brand-ink); background: rgba(75,99,230,.1); padding: .18rem .5rem; border-radius: 999px; }
.search-wrap { position: relative; }
.search-wrap input { padding-left: 2.1rem; }
.search-wrap::before {
  content: ''; position: absolute; left: .7rem; top: 50%; width: 15px; height: 15px; margin-top: -7.5px;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2399a2b3' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E");
  opacity: .8;
}
.list { display: flex; flex-direction: column; gap: .45rem; max-height: 72vh; overflow: auto; padding: .15rem; margin: -.15rem; }
.list-item {
  position: relative; padding: .7rem .8rem .7rem .95rem; border: 1px solid var(--line);
  border-radius: 11px; cursor: pointer; background: #fff; overflow: hidden;
  transition: border-color .16s var(--ease), background .16s var(--ease), box-shadow .16s var(--ease), transform .12s var(--ease);
}
.list-item::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--brand-grad); transform: translateX(-4px); transition: transform .18s var(--ease);
}
.list-item:hover { border-color: #c9d3ea; background: #f8faff; box-shadow: var(--shadow-sm); }
.list-item:hover::before { transform: translateX(0); }
.list-item.active {
  border-color: transparent; background: linear-gradient(180deg, #f3f6ff, #eef2ff);
  box-shadow: 0 0 0 1.5px rgba(75,99,230,.5), var(--shadow-sm);
}
.list-item.active::before { transform: translateX(0); background: var(--spectrum); }
.list-item.active .t { color: var(--brand-ink); }
.list-item .t { font-weight: 650; font-size: .9rem; color: var(--ink); line-height: 1.3; }
.list-item .s { font-size: .74rem; color: var(--muted); margin-top: .28rem; display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.actions-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }

/* ---------------------------------------------------------------- tags ----- */
.tag {
  display: inline-flex; align-items: center; font-size: .66rem; font-weight: 700; letter-spacing: .2px;
  padding: .16rem .48rem; border-radius: 999px; line-height: 1.4; text-transform: uppercase;
}
.tag.adhoc { background: #eaf0ff; color: #3550c8; }
.tag.certified { background: var(--good-bg); color: #128046; }
.tag.cross { background: #f1ebff; color: #6a44cf; }
.tag.mssql { background: #eef2f8; color: #4a5568; }
.tag.mysql { background: #fdf1e5; color: #a2661a; }
.tag.known { background: #fdecef; color: #c62d3c; }
.tag.needs { background: var(--warn-bg); color: #a5761a; }
.tag.active { background: var(--good-bg); color: #128046; }

/* ---------------------------------------------------------------- tables --- */
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; max-height: 62vh; background: #fff; box-shadow: var(--shadow-sm); }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .82rem; }
table.data th {
  position: sticky; top: 0; z-index: 1; text-align: left; padding: .6rem .7rem; white-space: nowrap;
  background: #f4f7fc; color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .5px; font-weight: 700;
  border-bottom: 1px solid var(--line); backdrop-filter: blur(4px);
}
table.data td { padding: .48rem .7rem; border-bottom: 1px solid var(--line-2); white-space: nowrap; color: var(--ink-2); }
table.data tbody tr:nth-child(even) td { background: #fafbfe; }
table.data tbody tr:hover td { background: #eff3fd; color: var(--ink); }
table.data tbody tr:last-child td { border-bottom: 0; }

pre.sql {
  background: #0e1424; color: #d7e2f7; padding: 1rem 1.1rem; border-radius: 12px; overflow: auto;
  font: .8rem/1.6 'SFMono-Regular', ui-monospace, Menlo, Consolas, monospace; max-height: 360px;
  border: 1px solid #1b2540; box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

/* ---------------------------------------------------------------- chips/kpi- */
.kpi { font-size: .78rem; color: var(--muted); }
.stat-row { display: flex; gap: .55rem; flex-wrap: wrap; margin-bottom: .7rem; }
.stat {
  display: inline-flex; align-items: center; gap: .4rem; font-size: .76rem; font-weight: 600; color: var(--ink-2);
  background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .32rem .7rem; box-shadow: var(--shadow-sm);
}
.stat b { color: var(--ink); font-weight: 750; }
.stat .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.stat .dot.good { background: var(--good); } .stat .dot.warn { background: var(--warn); }

.banner { padding: .65rem .85rem; border-radius: 10px; font-size: .84rem; margin-bottom: .75rem; border: 1px solid transparent; }
.banner.info { background: var(--info-bg); color: #285cbb; border-color: #d5e4fb; }
.banner.warn { background: var(--warn-bg); color: #8a5f13; border-color: #f6e3c0; }
.banner.err { background: var(--bad-bg); color: #b02a34; border-color: #f6ced1; }

.chips { display: flex; gap: .45rem; flex-wrap: wrap; margin: .4rem 0; }
.chip-x { display: inline-flex; align-items: center; gap: .4rem; background: #eef0f6; border: 1px solid var(--line); color: var(--ink-2); border-radius: 999px; padding: .25rem .3rem .25rem .7rem; font-size: .78rem; font-weight: 600; }
.chip-x a { display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center; border-radius: 50%; background: #dde2ec; color: #556; font-size: .7rem; }
.chip-x a:hover { background: var(--bad); color: #fff; }

/* ---------------------------------------------------------------- dash ----- */
.dash-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.1rem; }
@media (max-width: 860px) { .dash-grid { grid-template-columns: 1fr; } }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 1rem; box-shadow: var(--shadow-sm); transition: box-shadow .2s, transform .2s; }
.tile:hover { box-shadow: var(--shadow); }
.tile h4 { margin: 0 0 .6rem; font-size: .9rem; font-weight: 700; }

/* ---------------------------------------------------------------- misc ----- */
.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid rgba(75,99,230,.25); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
.btn .spinner { border-color: rgba(255,255,255,.4); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.empty .ico { font-size: 2rem; opacity: .5; margin-bottom: .4rem; }

/* skeleton shimmer for loading lists */
.skel { height: 58px; border-radius: 11px; margin-bottom: .45rem; background: linear-gradient(100deg,#eef1f7 30%,#f7f9fc 50%,#eef1f7 70%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.pz-toast {
  position: fixed; bottom: 1.4rem; right: 1.4rem; background: rgba(19,26,43,.96); color: #fff;
  padding: .8rem 1.1rem; border-radius: 12px; box-shadow: var(--shadow-lg); backdrop-filter: blur(8px);
  opacity: 0; transform: translateY(14px) scale(.98); transition: .22s var(--ease); z-index: 100; max-width: 360px; font-size: .86rem; font-weight: 500;
  border: 1px solid rgba(255,255,255,.1); border-left: 3px solid var(--brand);
}
.pz-toast.show { opacity: 1; transform: translateY(0) scale(1); }
.pz-toast.err { border-left-color: var(--bad); }

code { background: #eef1f7; padding: .1rem .35rem; border-radius: 5px; font: .82em ui-monospace, Menlo, Consolas, monospace; color: #4a5468; }
hr { border: none; border-top: 1px solid var(--line); margin: 1rem 0; }
.def-block { margin: .6rem 0; padding: .8rem .9rem; border: 1px solid var(--line); border-radius: 11px; background: #fcfdff; }
