@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;800;900&display=swap');

:root{
  --bg0: #f6fbff;
  --bg1: #eaf3ff;

  --ink: rgba(15,23,42,.92);
  --muted: rgba(15,23,42,.70);

  --line: rgba(40,70,140,.14);
  --line2: rgba(40,70,140,.22);

  --card: rgba(255,255,255,.78);
  --shadow: 0 10px 30px rgba(15,23,42,.08);

  --accent: rgba(47,111,237,.95);
  --accentSoft: rgba(47,111,237,.14);
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: Roboto, system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 40% 0%, rgba(47,111,237,.16), transparent 60%),
    radial-gradient(900px 600px at 90% 10%, rgba(125,211,252,.22), transparent 55%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
}

a{ color: rgba(47,111,237,.95); text-decoration: none; }
a:hover{ text-decoration: underline; }

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 18px;
  border-bottom: 1px solid rgba(40,70,140,.10);
  background: rgba(255,255,255,.62);
  backdrop-filter: blur(12px);
}

.brand{ display:flex; gap:12px; align-items:center; }

.logo{
  width:44px; height:44px;
  border-radius: 14px;
  display:flex; align-items:center; justify-content:center;
  background: rgba(255,255,255,.70);
  border: 1px solid rgba(40,70,140,.14);
  box-shadow: 0 6px 18px rgba(15,23,42,.08);
  overflow:hidden;
}
.logo svg{ width: 44px; height: 44px; display:block; }

.title{ font-weight:900; letter-spacing:.2px; }
.subtitle{ font-size: 13px; color: var(--muted); }

.badge{
  font-size: 12px;
  font-weight: 800;
  color: rgba(15,23,42,.70);
  background: rgba(255,255,255,.66);
  border: 1px solid rgba(40,70,140,.12);
  padding: 6px 10px;
  border-radius: 999px;
}

.shell{
  display:grid;
  grid-template-columns: 360px 1fr;
  gap: 14px;
  padding: 14px;
}

.card{
  background: var(--card);
  border: 1px solid rgba(40,70,140,.12);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.card.stage{
  position: relative;
  overflow:hidden;
  background:
    radial-gradient(900px 520px at 40% 0%, rgba(47,111,237,.16), transparent 62%),
    radial-gradient(700px 520px at 80% 20%, rgba(125,211,252,.22), transparent 58%),
    rgba(255,255,255,.52);
  backdrop-filter: blur(14px);
}

.h{
  margin:0;
  padding: 16px 16px 8px 16px;
  font-weight: 900;
}
.h-xl{
  margin:0;
  font-weight: 900;
  font-size: 46px;
  letter-spacing: -.5px;
}

.small{
  font-size: 13px;
  color: var(--muted);
}

hr{
  border:0;
  border-top: 1px solid rgba(40,70,140,.10);
  margin: 12px 0;
}

.input{
  width: calc(100% - 32px);
  margin: 0 16px 10px 16px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(40,70,140,.14);
  background: rgba(255,255,255,.72);
  outline: none;
  font-weight: 700;
}
.input:focus{
  box-shadow: 0 0 0 4px var(--accentSoft);
  border-color: rgba(40,70,140,.20);
}

.results{
  padding: 0 16px 16px 16px;
  display:flex;
  flex-direction: column;
  gap: 8px;
}
.results a{
  display:block;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(40,70,140,.10);
  background: rgba(255,255,255,.72);
  color: var(--ink);
}
.results a:hover{
  border-color: rgba(40,70,140,.16);
  box-shadow: 0 0 0 4px var(--accentSoft);
  text-decoration:none;
}

.btn{
  border: 1px solid rgba(40,70,140,.14);
  background: rgba(255,255,255,.72);
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 900;
  cursor:pointer;
  color: rgba(15,23,42,.86);
}
.btn:hover{
  border-color: rgba(40,70,140,.16);
  box-shadow: 0 0 0 4px var(--accentSoft);
}

.select{
  border: 1px solid rgba(40,70,140,.14);
  background: rgba(255,255,255,.72);
  padding: 8px 10px;
  border-radius: 12px;
  font-weight: 900;
  cursor:pointer;
  color: rgba(15,23,42,.86);
  outline:none;
}
.select:focus{
  box-shadow: 0 0 0 4px var(--accentSoft);
  border-color: rgba(40,70,140,.16);
}

.stage-head{
  padding: 16px 16px 12px 16px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(40,70,140,.10);
  background: rgba(255,255,255,.46);
  backdrop-filter: blur(10px);
}

.breadcrumbs{
  display:flex;
  align-items:center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 0;
}
.crumb{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(40,70,140,.12);
  background: rgba(255,255,255,.62);
  font-weight: 900;
  cursor:pointer;
  user-select:none;
}
.crumb.current{
  cursor: default;
  background: var(--accentSoft);
}
.sep{ opacity:.55; font-weight:900; }

.stage-surface{
  position: relative;
  width: 100%;
  min-height: 680px;
  padding: 16px;
}

.stage-grid{
  display: grid;
  gap: 14px;
  align-content: start;
}

/* “Columns” behavior */
.stage-grid.grid-spacious{
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.stage-grid.grid-compact{
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.tile{
  text-align: left;
  border-radius: 18px;
  border: 1px solid rgba(40,70,140,.14);
  background: rgba(255,255,255,.82);
  padding: 14px 14px 12px 14px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(15,23,42,.08);
  transition: transform .08s ease, box-shadow .12s ease, border-color .12s ease;
  position: relative;
  overflow: hidden;
}
.tile::before{
  content:"";
  position:absolute;
  inset: 0;
  background:
    radial-gradient(520px 220px at 18% 0%, rgba(47,111,237,.16), transparent 62%),
    radial-gradient(420px 260px at 90% 20%, rgba(125,211,252,.20), transparent 60%);
  pointer-events:none;
  opacity: .9;
}
.tile:hover{
  transform: translateY(-1px);
  border-color: rgba(40,70,140,.18);
  box-shadow: 0 0 0 4px var(--accentSoft), 0 16px 50px rgba(15,23,42,.12);
}
.tile:focus{
  outline:none;
  box-shadow: 0 0 0 4px var(--accentSoft), 0 16px 50px rgba(15,23,42,.12);
}

.tile-top{ position: relative; z-index: 2; }
.tile-title{
  font-weight: 900;
  font-size: 22px;
  line-height: 1.12;
  letter-spacing: -.2px;
  margin-bottom: 8px;
  color: rgba(15,23,42,.92);
}
.tile-meta{
  display:inline-flex;
  font-weight: 900;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(40,70,140,.12);
  background: rgba(255,255,255,.66);
  color: rgba(15,23,42,.72);
}
.tile-sub{
  position: relative;
  z-index: 2;
  margin-top: 10px;
  font-weight: 700;
  color: rgba(15,23,42,.70);
  line-height: 1.35;
}

/* Entity pane (list view) */
.entity-pane{
  border-radius: 18px;
  border: 1px solid rgba(40,70,140,.12);
  background: rgba(255,255,255,.64);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 40px rgba(15,23,42,.10);
  overflow: hidden;
}
.entity-pane-top{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 12px;
  padding: 14px 14px 10px 14px;
  border-bottom: 1px solid rgba(40,70,140,.10);
  background:
    linear-gradient(90deg, var(--accentSoft), rgba(255,255,255,.56));
}
.entity-pane-h{ font-weight: 900; font-size: 20px; }
.entity-pane-controls{ display:flex; align-items:center; gap: 10px; }

.entity-list{
  max-height: 520px;
  overflow:auto;
  padding: 12px;
  display:flex;
  flex-direction: column;
  gap: 10px;
}
.entity-row{
  width: 100%;
  text-align:left;
  border-radius: 16px;
  border: 1px solid rgba(40,70,140,.10);
  background: rgba(255,255,255,.78);
  padding: 12px 12px 12px 14px;
  cursor:pointer;
  transition: transform .06s ease, box-shadow .08s ease, border-color .08s ease;
  position: relative;
}
.entity-row:hover{
  border-color: rgba(40,70,140,.16);
  box-shadow: 0 0 0 4px var(--accentSoft);
  transform: translateY(-1px);
}
.entity-row:focus{
  outline:none;
  box-shadow: 0 0 0 4px var(--accentSoft);
  border-color: rgba(40,70,140,.16);
}
.entity-row-title{
  font-weight: 900;
  font-size: 18px;
  margin-bottom: 4px;
  color: rgba(15,23,42,.92);
}
.entity-row-quick{
  font-weight: 700;
  color: rgba(15,23,42,.74);
  line-height: 1.35;
}
.entity-row-meta{ margin-top: 8px; opacity: .85; }

/* Tooltip */
.tooltip{
  position: fixed;
  z-index: 40;
  width: 340px;
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid rgba(40,70,140,.14);
  background: rgba(255,255,255,.86);
  box-shadow: 0 12px 40px rgba(15,23,42,.18);
  backdrop-filter: blur(12px);
  transform: translateY(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}
.tooltip.show{ opacity: 1; transform: translateY(0); }
.tooltip .t{ font-weight: 900; margin-bottom: 6px; }
.tooltip .m{ color: rgba(15,23,42,.72); font-weight: 700; }

/* Modal + panel */
.modal{
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15,23,42,.28);
  display:none;
  padding: 18px;
}
.modal.open{ display:flex; align-items:flex-start; justify-content:center; }
.modal-card{
  width: min(720px, 100%);
  border-radius: 18px;
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(40,70,140,.14);
  box-shadow: 0 20px 60px rgba(15,23,42,.26);
  overflow:hidden;
}
.modal-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid rgba(40,70,140,.10);
}
.m-title{ font-weight: 900; font-size: 22px; }
.m-meta{ font-size: 13px; color: rgba(15,23,42,.62); font-weight: 800; }
.m-block{ padding: 12px 14px; }
.m-h{ font-weight: 900; font-size: 12px; opacity:.66; letter-spacing:.6px; text-transform: uppercase; margin-bottom: 6px; }
.m-t{ font-weight: 700; color: rgba(15,23,42,.84); line-height: 1.4; }

.sidepanel{
  position:absolute;
  top: 16px;
  right: 16px;
  width: 420px;
  height: calc(100% - 32px);
  display:none;
}

/* NAV TREE polish (left panel formatting) */
.tree{
  padding: 8px 10px 12px 10px;
}
.tree .node{ margin-bottom: 6px; }
.tree .toggle{
  width: 100%;
  text-align:left;
  border: 1px solid rgba(40,70,140,.12);
  background: rgba(255,255,255,.62);
  padding: 10px 10px;
  border-radius: 14px;
  font-weight: 900;
  cursor:pointer;
  color: rgba(15,23,42,.88);
}
.tree .toggle:hover{
  box-shadow: 0 0 0 4px rgba(47,111,237,.10);
}
.tree .children{
  display:none;
  margin: 6px 0 10px 8px;
  padding-left: 10px;
  border-left: 2px solid rgba(40,70,140,.10);
}
.tree .children.open{
  display:block;
  background: rgba(255,255,255,0.03);
  border-left: 2px solid rgba(255,255,255,0.22);
  padding-left: 10px;
  border-radius: 12px;
}
.tree a.leaf{
  display:block;
  padding: 8px 10px;
  border-radius: 12px;
  color: rgba(15,23,42,.82);
  font-weight: 800;
}
.tree a.leaf:hover{
  background: rgba(255,255,255,.55);
  text-decoration:none;
}
.tree a.leaf.active{
  background: rgba(47,111,237,.14);
  box-shadow: inset 0 0 0 1px rgba(47,111,237,.18);
  color: rgba(15,23,42,.92);
}

@media (max-width: 1050px){
  .shell{ grid-template-columns: 1fr; }
  .stage-surface{ min-height: 620px; }
}
